/[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 380 by jonathan, Tue Jan 28 12:13:28 2003 UTC revision 381 by jonathan, Tue Jan 28 18:37:05 2003 UTC
# Line 21  on the mapping algorithm. Line 21  on the mapping algorithm.
21  """  """
22        
23  from Thuban import _  from Thuban import _
24    from Thuban.Model.color import Color
25    
26    from wxPython.wx import *
27    
28  # constants  # constants
29  RANGE_MIN  = 0  RANGE_MIN  = 0
# Line 118  class Classification: Line 121  class Classification:
121    
122          return self.NullData          return self.NullData
123    
124        def TreeInfo(self):
125            items = []
126    
127            #
128            # shouldn't print anything if there are no classifications
129            #
130    
131            
132            def color_string(color):
133                if color is None:
134                    return "None"
135                return "(%.3f, %.3f, %.3f)" % (color.red, color.green, color.blue)
136    
137            if self.NullData is not None:
138                i = []
139                for key, value in self.NullData.items():
140                    if isinstance(value, Color):
141                        i.append((_("%s: %s") % (key, color_string(value)), value))
142                    else:
143                        i.append(_("%s: %s") % (key, value))
144                items.append((_("'NULL'"), i))
145    
146            for name, data in self.points.items():
147                i = []
148                for key, value in data.items():
149                    if isinstance(value, Color):
150                        i.append((_("%s: %s") % (key, color_string(value)), value))
151                    else:
152                        i.append(_("%s: %s") % (key, value))
153                items.append((_("%s") % name, i))
154    
155            for p in self.ranges:
156                i = []
157                data = p[RANGE_DATA]
158                for key, value in data.items():
159                    if isinstance(value, Color):
160                        i.append((_("%s: %s") % (key, color_string(value)), value))
161                    else:
162                        i.append(_("%s: %s") % (key, value))
163                items.append((_("%s-%s") % (p[RANGE_MIN], p[RANGE_MAX], i)))
164          
165            return (_("Classifications"), items)
166    

Legend:
Removed from v.380  
changed lines
  Added in v.381

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26