[GRASS-SVN] r56966 - grass/trunk/lib/python/temporal

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Jul 2 01:38:04 PDT 2013


Author: huhabla
Date: 2013-07-02 01:38:02 -0700 (Tue, 02 Jul 2013)
New Revision: 56966

Modified:
   grass/trunk/lib/python/temporal/spatial_topology_dataset_connector.py
   grass/trunk/lib/python/temporal/temporal_topology_dataset_connector.py
Log:
Grant access to a copy of the internal topology relation dictionary.


Modified: grass/trunk/lib/python/temporal/spatial_topology_dataset_connector.py
===================================================================
--- grass/trunk/lib/python/temporal/spatial_topology_dataset_connector.py	2013-07-02 07:14:11 UTC (rev 56965)
+++ grass/trunk/lib/python/temporal/spatial_topology_dataset_connector.py	2013-07-02 08:38:02 UTC (rev 56966)
@@ -17,6 +17,7 @@
 
 @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 @@
         in=a at P
         contain=a at P
         meet=a at P
+        >>> rlist = tmr.get_spatial_relations()
+        >>> if "COVER" in rlist.keys():
+        ...    print rlist["COVER"][0].get_id()
+        a at P
+
         
         @endcode
     """
@@ -77,6 +83,16 @@
         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.

Modified: grass/trunk/lib/python/temporal/temporal_topology_dataset_connector.py
===================================================================
--- grass/trunk/lib/python/temporal/temporal_topology_dataset_connector.py	2013-07-02 07:14:11 UTC (rev 56965)
+++ grass/trunk/lib/python/temporal/temporal_topology_dataset_connector.py	2013-07-02 08:38:02 UTC (rev 56966)
@@ -17,6 +17,7 @@
 
 @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 @@
         started=a at P
         finishes=a at P
         finished=a at P
-        
+        >>> rlist = tmr.get_temporal_relations()
+        >>> if "FINISHED" in rlist.keys():
+        ...    print rlist["FINISHED"][0].get_id()
+        a at P
+
         @endcode
     """
 
@@ -116,6 +121,16 @@
         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.



More information about the grass-commit mailing list