/[thuban]/trunk/thuban/Thuban/Model/layer.py
ViewVC logotype

Diff of /trunk/thuban/Thuban/Model/layer.py

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

revision 481 by jonathan, Thu Mar 6 16:46:36 2003 UTC revision 545 by jonathan, Thu Mar 20 09:44:04 2003 UTC
# Line 16  from Thuban import _ Line 16  from Thuban import _
16  import shapelib, shptree  import shapelib, shptree
17    
18  from messages import LAYER_PROJECTION_CHANGED, LAYER_LEGEND_CHANGED, \  from messages import LAYER_PROJECTION_CHANGED, LAYER_LEGEND_CHANGED, \
19       LAYER_VISIBILITY_CHANGED       LAYER_VISIBILITY_CHANGED, LAYER_CHANGED
20    
21  from color import Color  from color import Color
22    
# Line 147  class Layer(BaseLayer): Line 147  class Layer(BaseLayer):
147          # tries to set its parent layer the variable will exist          # tries to set its parent layer the variable will exist
148          #          #
149          self.__classification = None          self.__classification = None
150            self.__setClassLock = False
151    
152    
153            self.SetClassification(None)
154    
         self.SetClassification(classification.Classification(self))  
155          self.__classification.SetDefaultLineColor(stroke)          self.__classification.SetDefaultLineColor(stroke)
156          self.__classification.SetDefaultLineWidth(lineWidth)          self.__classification.SetDefaultLineWidth(lineWidth)
157          self.__classification.SetDefaultFill(fill)          self.__classification.SetDefaultFill(fill)
158            self.__classification.SetLayer(self)
159    
160          self.UnsetModified()          self.UnsetModified()
161    
# Line 187  class Layer(BaseLayer): Line 191  class Layer(BaseLayer):
191              self.shapefile.close()              self.shapefile.close()
192              self.shapefile = None              self.shapefile = None
193              self.shapetree = None              self.shapetree = None
194            self.SetClassification(None)
195          self.table.Destroy()          self.table.Destroy()
196    
197      def BoundingBox(self):      def BoundingBox(self):
# Line 268  class Layer(BaseLayer): Line 273  class Layer(BaseLayer):
273          return self.__classification          return self.__classification
274    
275      def SetClassification(self, clazz):      def SetClassification(self, clazz):
276            """Set the classification to 'clazz'
277    
278            If 'clazz' is None a default classification is created
279            """
280    
281          # prevent infinite recursion when calling SetLayer()          # prevent infinite recursion when calling SetLayer()
282          if clazz == self.__classification:          if self.__setClassLock: return
             return  
283    
284          self.__classification = clazz          self.__setClassLock = True
285          self.__classification.SetLayer(self)  
286          self.changed(LAYER_LEGEND_CHANGED, self)          if clazz is None:
287                if self.__classification is not None:
288                    self.__classification.SetLayer(None)
289                self.__classification = classification.Classification()
290            else:
291                self.__classification = clazz
292                try:
293                    self.__classification.SetLayer(self)
294                except ValueError:
295                    self.__setClassLock = False
296                    raise ValueError
297    
298            self.changed(LAYER_CHANGED, self)
299    
300            self.__setClassLock = False
301    
302        def ClassChanged(self):
303            """Called from the classification object when it has changed."""
304            self.changed(LAYER_LEGEND_CHANGED, self)
305    
306      def TreeInfo(self):      def TreeInfo(self):
307          items = []          items = []
308    

Legend:
Removed from v.481  
changed lines
  Added in v.545

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26