/[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 492 by jonathan, Mon Mar 10 10:44:57 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)          self.SetClassification(None)
# Line 190  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 276  class Layer(BaseLayer): Line 278  class Layer(BaseLayer):
278          If 'clazz' is None a default classification is created          If 'clazz' is None a default classification is created
279          """          """
280    
281            # prevent infinite recursion when calling SetLayer()
282            if self.__setClassLock: return
283    
284            self.__setClassLock = True
285    
286          if clazz is None:          if clazz is None:
287                if self.__classification is not None:
288                    self.__classification.SetLayer(None)
289              self.__classification = classification.Classification()              self.__classification = classification.Classification()
290          else:          else:
   
             # prevent infinite recursion when calling SetLayer()  
             if clazz == self.__classification:  
                 return  
   
291              self.__classification = clazz              self.__classification = clazz
292              self.__classification.SetLayer(self)              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.changed(LAYER_LEGEND_CHANGED, self)          self.__setClassLock = False
301    
302      def ClassChanged(self):      def ClassChanged(self):
303          """Called from the classification object when it has changed."""          """Called from the classification object when it has changed."""

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

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26