/[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 464 by jonathan, Wed Mar 5 18:17:47 2003 UTC revision 558 by jonathan, Wed Mar 26 11:05:20 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 142  class Layer(BaseLayer): Line 142  class Layer(BaseLayer):
142          self.shapetable = Table(filename)          self.shapetable = Table(filename)
143          self.table = self.shapetable          self.table = self.shapetable
144    
145          self.__classification = classification.Classification(self)          #
146            # this is really important so that when the classification class
147            # tries to set its parent layer the variable will exist
148            #
149            self.__classification = None
150            self.__setClassLock = False
151    
152    
153            self.SetClassification(None)
154    
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 181  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 262  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          self.__classification = clazz          """Set the classification to 'clazz'
277          self.changed(LAYER_LEGEND_CHANGED, self)  
278            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:
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_CHANGED, self)
305    
306      def TreeInfo(self):      def TreeInfo(self):
307          items = []          items = []
308    

Legend:
Removed from v.464  
changed lines
  Added in v.558

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26