Browse Source

Grant access to a copy of the internal topology relation dictionary.

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@56966 15284696-431f-4ddb-bdfa-cd5b030d7da7
Soeren Gebbert 11 years ago
parent
commit
d21ce66a25

+ 16 - 0
lib/python/temporal/spatial_topology_dataset_connector.py

@@ -17,6 +17,7 @@ for details.
 
 @author Soeren Gebbert
 """
+import copy
 
 class SpatialTopologyDatasetConnector(object):
     """!This class implements a spatial topology access structure to connect spatial related datasets
@@ -65,6 +66,11 @@ class SpatialTopologyDatasetConnector(object):
         in=a@P
         contain=a@P
         meet=a@P
+        >>> rlist = tmr.get_spatial_relations()
+        >>> if "COVER" in rlist.keys():
+        ...    print rlist["COVER"][0].get_id()
+        a@P
+
         
         @endcode
     """
@@ -77,6 +83,16 @@ class SpatialTopologyDatasetConnector(object):
         self._spatial_topology = {}
         self._has_spatial_topology = False
         
+    def get_spatial_relations(self):
+        """!Return the dictionary of spatial relationships
+        
+            Keys are the spatial relationships in upper case,
+            values are abstract map objects.
+            
+            @return The spatial relations dictionary
+        """
+        return copy.copy(self._spatial_topology)
+    
     def get_number_of_spatial_relations(self):
         """! Return a dictionary in which the keys are the relation names and the value
         are the number of relations.

+ 16 - 1
lib/python/temporal/temporal_topology_dataset_connector.py

@@ -17,6 +17,7 @@ for details.
 
 @author Soeren Gebbert
 """
+import copy
 
 class TemporalTopologyDatasetConnector(object):
     """!This class implements a temporal topology access structure to connect temporal related datasets
@@ -104,7 +105,11 @@ class TemporalTopologyDatasetConnector(object):
         started=a@P
         finishes=a@P
         finished=a@P
-        
+        >>> rlist = tmr.get_temporal_relations()
+        >>> if "FINISHED" in rlist.keys():
+        ...    print rlist["FINISHED"][0].get_id()
+        a@P
+
         @endcode
     """
 
@@ -116,6 +121,16 @@ class TemporalTopologyDatasetConnector(object):
         self._temporal_topology = {}
         self._has_temporal_topology = False
         
+    def get_temporal_relations(self):
+        """!Return the dictionary of temporal relationships
+        
+            Keys are the temporal relationships in upper case,
+            values are abstract map objects.
+            
+            @return The temporal relations dictionary
+        """
+        return copy.copy(self._temporal_topology)
+        
     def get_number_of_temporal_relations(self):
         """! Return a dictionary in which the keys are the relation names and the value
         are the number of relations.