Forráskód Böngészése

New function to print the temporal relationship matrix

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@48778 15284696-431f-4ddb-bdfa-cd5b030d7da7
Soeren Gebbert 13 éve
szülő
commit
73ee0e51a7
1 módosított fájl, 32 hozzáadás és 0 törlés
  1. 32 0
      lib/python/temporal/abstract_space_time_dataset.py

+ 32 - 0
lib/python/temporal/abstract_space_time_dataset.py

@@ -107,6 +107,38 @@ class abstract_space_time_dataset(abstract_dataset):
 
         return granularity, temporal_type, semantic_type, title, description
 
+    def print_temporal_relation_matrix(self, dbif=None):
+        """Print the temporal relation matrix of all registered maps to stdout
+
+           The temproal relation matrix includes the temporal relations between
+           all registered maps. The relations are strings stored in a list of lists.
+           
+           @param dbif: The database interface to be used
+        """
+
+        connect = False
+
+        if dbif == None:
+            dbif = sql_database_interface()
+            dbif.connect()
+            connect = True
+
+        matrix = []
+
+        maps = self.get_registered_maps_as_objects(where=None, order="start_time", dbif=dbif)
+
+        for map in maps:
+            print map.get_id(),
+        print " "    
+
+        for mapA in maps:
+            for mapB in maps:
+                print mapA.temporal_relation(mapB),
+            print " "
+
+        if connect == True:
+            dbif.close()
+
     def get_temporal_relation_matrix(self, dbif=None):
         """Return the temporal relation matrix of all registered maps as listof lists