/[thuban]/branches/WIP-pyshapelib-bramz/Thuban/Model/classification.py
ViewVC logotype

Diff of /branches/WIP-pyshapelib-bramz/Thuban/Model/classification.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 528 by jonathan, Wed Mar 12 19:55:13 2003 UTC revision 544 by jonathan, Thu Mar 20 09:43:48 2003 UTC
# Line 476  class ClassGroup: Line 476  class ClassGroup:
476          assert(isinstance(label, StringType))          assert(isinstance(label, StringType))
477          self.label = label          self.label = label
478    
479        def GetDisplayText(self):
480            assert(False, "GetDisplay must be overridden by subclass!")
481            return ""
482    
483      def Matches(self, value):      def Matches(self, value):
484          """Determines if this Group is associated with the given value.          """Determines if this Group is associated with the given value.
485    
486          Returns False. This needs to be overridden by all subclasses.          Returns False. This needs to be overridden by all subclasses.
487          """          """
488            assert(False, "GetMatches must be overridden by subclass!")
489          return False          return False
490    
491      def GetProperties(self):      def GetProperties(self):
# Line 488  class ClassGroup: Line 493  class ClassGroup:
493    
494          Returns None. This needs to be overridden by all subclasses.          Returns None. This needs to be overridden by all subclasses.
495          """          """
496            assert(False, "GetProperties must be overridden by subclass!")
497          return None          return None
498    
499            
# Line 553  class ClassGroupSingleton(ClassGroup): Line 559  class ClassGroupSingleton(ClassGroup):
559          assert(isinstance(prop, ClassGroupProperties))          assert(isinstance(prop, ClassGroupProperties))
560          self.prop = prop          self.prop = prop
561    
562        def GetDisplayText(self):
563            label = self.GetLabel()
564    
565            if label != "": return label
566    
567            return str(self.GetValue())
568    
569      def __eq__(self, other):      def __eq__(self, other):
570          return isinstance(other, ClassGroupSingleton) \          return isinstance(other, ClassGroupSingleton) \
571              and self.GetProperties() == other.GetProperties() \              and self.GetProperties() == other.GetProperties() \
# Line 603  class ClassGroupDefault(ClassGroup): Line 616  class ClassGroupDefault(ClassGroup):
616          assert(isinstance(prop, ClassGroupProperties))          assert(isinstance(prop, ClassGroupProperties))
617          self.prop = prop          self.prop = prop
618    
619        def GetDisplayText(self):
620            label = self.GetLabel()
621    
622            if label != "": return label
623    
624            return "DEFAULT"
625    
626      def __eq__(self, other):      def __eq__(self, other):
627          return isinstance(other, ClassGroupDefault) \          return isinstance(other, ClassGroupDefault) \
628              and self.GetProperties() == other.GetProperties()              and self.GetProperties() == other.GetProperties()
# Line 715  class ClassGroupRange(ClassGroup): Line 735  class ClassGroupRange(ClassGroup):
735          assert(isinstance(prop, ClassGroupProperties))          assert(isinstance(prop, ClassGroupProperties))
736          self.prop = prop          self.prop = prop
737    
738        def GetDisplayText(self):
739            label = self.GetLabel()
740    
741            if label != "": return label
742    
743            return _("%s - %s") % (self.GetMin(), self.GetMax())
744    
745      def __eq__(self, other):      def __eq__(self, other):
746          return isinstance(other, ClassGroupRange) \          return isinstance(other, ClassGroupRange) \
747              and self.GetProperties() == other.GetProperties() \              and self.GetProperties() == other.GetProperties() \
# Line 746  class ClassGroupMap(ClassGroup): Line 773  class ClassGroupMap(ClassGroup):
773      def GetPropertiesFromValue(self, value):      def GetPropertiesFromValue(self, value):
774          pass          pass
775    
776        def GetDisplayText(self):
777            return "Map: " + self.map_type
778    
779      #      #
780      # built-in mappings      # built-in mappings
781      #      #

Legend:
Removed from v.528  
changed lines
  Added in v.544

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26