Esempio n. 1
0
 def setInternalLabelProperty(self, prop):
     if self.isValidLabelProperty(prop):  # raises exception if not
         if self.internallabelprop not in [prop, None]:
             raise pynt.ConsistencyException(
                 "Layer %s has internal label property %s, can not override it to %s"
                 % (self, self.internallabelprop, prop))
         self.internallabelprop = prop
Esempio n. 2
0
 def isValidLabelProperty(self, prop):
     """Raises an error if the given property would not be consistent with the current label 
     properties, or with a label property in the first place"""
     curlabeltype = self.getLabelType()
     assert (isinstance(prop, Property))
     assert (isinstance(prop.range,
                        LabelSet))  # or prop.range in [int, str])
     if not prop.incompatible:
         raise pynt.ConsistencyException(
             "Label property %s must have incompatible flag set to True." %
             (prop))
     elif curlabeltype not in [None, prop.range]:
         raise pynt.ConsistencyException(
             "Can't set label property %s with labelset %s: The labelset of layer %s is already set to %s"
             % (prop, prop.range, self.getName(), curlabeltype))
     return True