Explorar el Código

Fixed temporal topology check

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@55721 15284696-431f-4ddb-bdfa-cd5b030d7da7
Soeren Gebbert hace 12 años
padre
commit
984d9aea8b
Se han modificado 1 ficheros con 21 adiciones y 17 borrados
  1. 21 17
      lib/python/temporal/abstract_space_time_dataset.py

+ 21 - 17
lib/python/temporal/abstract_space_time_dataset.py

@@ -196,7 +196,7 @@ class AbstractSpaceTimeDataset(AbstractDataset):
         return temporal_type, semantic_type, title, description
         return temporal_type, semantic_type, title, description
 
 
     def get_granularity(self):
     def get_granularity(self):
-        """!Return the granularity
+        """!Return the granularity of the space time dataset
         
         
            Granularity can be of absolute time or relative time.
            Granularity can be of absolute time or relative time.
            In case of absolute time a string containing an integer
            In case of absolute time a string containing an integer
@@ -341,7 +341,7 @@ class AbstractSpaceTimeDataset(AbstractDataset):
             maps = self.get_registered_maps_as_objects(
             maps = self.get_registered_maps_as_objects(
                 where=None, order="start_time", dbif=dbif)
                 where=None, order="start_time", dbif=dbif)
 
 
-        print_temporal_topology_relationships(maps, maps)
+        print_temporal_topology_relationships(maps)
 
 
     def count_temporal_relations(self, maps=None, dbif=None):
     def count_temporal_relations(self, maps=None, dbif=None):
         """!Count the temporal relations between the registered maps.
         """!Count the temporal relations between the registered maps.
@@ -359,16 +359,17 @@ class AbstractSpaceTimeDataset(AbstractDataset):
             maps = self.get_registered_maps_as_objects(
             maps = self.get_registered_maps_as_objects(
                 where=None, order="start_time", dbif=dbif)
                 where=None, order="start_time", dbif=dbif)
 
 
-        return count_temporal_topology_relationships(maps, maps)
+        return count_temporal_topology_relationships(maps)
 
 
     def check_temporal_topology(self, maps=None, dbif=None):
     def check_temporal_topology(self, maps=None, dbif=None):
-        """!Check the temporal topology
+        """!Check the temporal topology of all maps of the current space time dataset or
+           of an optional list of maps
 
 
            Correct topology means, that time intervals are not overlap or
            Correct topology means, that time intervals are not overlap or
            that intervals does not contain other intervals. 
            that intervals does not contain other intervals. 
            Equal time intervals  are not allowed.
            Equal time intervals  are not allowed.
 
 
-           The map list must be ordered by start time
+           The optional map list must be ordered by start time
 
 
            Allowed and not allowed temporal relationships for correct topology:
            Allowed and not allowed temporal relationships for correct topology:
            @verbatim
            @verbatim
@@ -388,7 +389,7 @@ class AbstractSpaceTimeDataset(AbstractDataset):
            - finished   -> not allowed
            - finished   -> not allowed
            @endverbatim
            @endverbatim
 
 
-           @param maps: A sorted (start_time) list of AbstractDataset objects
+           @param maps: An optional list of AbstractDataset objects, in case of None all maps of the space time dataset are checked
            @param dbif: The database interface to be used
            @param dbif: The database interface to be used
            @return True if topology is correct
            @return True if topology is correct
         """
         """
@@ -396,31 +397,34 @@ class AbstractSpaceTimeDataset(AbstractDataset):
             maps = self.get_registered_maps_as_objects(
             maps = self.get_registered_maps_as_objects(
                 where=None, order="start_time", dbif=dbif)
                 where=None, order="start_time", dbif=dbif)
 
 
-        relations = count_temporal_topology_relationships(maps, maps)
+        relations = count_temporal_topology_relationships(maps)
+        
+        if relations == None:
+            return False
 
 
         map_time = self.get_map_time()
         map_time = self.get_map_time()
 
 
         if map_time == "interval" or map_time == "mixed":
         if map_time == "interval" or map_time == "mixed":
-            if "equivalent" in relations:
+            if "equal" in relations and relations["equal"] > 0:
                 return False
                 return False
-            if "during" in relations:
+            if "during" in relations and relations["during"] > 0:
                 return False
                 return False
-            if "contains" in relations:
+            if "contains" in relations and relations["contains"] > 0:
                 return False
                 return False
-            if "overlaps" in relations:
+            if "overlaps" in relations and relations["overlaps"] > 0:
                 return False
                 return False
-            if "overlapped" in relations:
+            if "overlapped" in relations and relations["overlapped"] > 0:
                 return False
                 return False
-            if "starts" in relations:
+            if "starts" in relations and relations["starts"] > 0:
                 return False
                 return False
-            if "finishes" in relations:
+            if "finishes" in relations and relations["finishes"] > 0:
                 return False
                 return False
-            if "started" in relations:
+            if "started" in relations and relations["started"] > 0:
                 return False
                 return False
-            if "finished" in relations:
+            if "finished" in relations and relations["finished"] > 0:
                 return False
                 return False
         elif map_time == "point":
         elif map_time == "point":
-            if "equivalent" in relations:
+            if "equal" in relations and relations["equal"] > 0:
                 return False
                 return False
         else:
         else:
             return False
             return False