/[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 996 by bh, Thu May 22 18:21:10 2003 UTC revision 1142 by bh, Tue Jun 10 09:41:57 2003 UTC
# Line 18  import gdal Line 18  import gdal
18  from gdalconst import GA_ReadOnly  from gdalconst import GA_ReadOnly
19    
20  from messages import LAYER_PROJECTION_CHANGED, LAYER_VISIBILITY_CHANGED, \  from messages import LAYER_PROJECTION_CHANGED, LAYER_VISIBILITY_CHANGED, \
21       LAYER_CHANGED       LAYER_CHANGED, LAYER_SHAPESTORE_REPLACED
22    
23  from color import Color  from color import Color
24    
# Line 199  class Layer(BaseLayer): Line 199  class Layer(BaseLayer):
199    
200          self.shapetree = shptree.SHPTree(self.shapefile.cobject(), 2,          self.shapetree = shptree.SHPTree(self.shapefile.cobject(), 2,
201                                           maxdepth)                                           maxdepth)
202            # Set the classification to None if there is a classification
203            # and the new shapestore doesn't have a table with a suitable
204            # column, i.e one with the same name and type as before
205            # FIXME: Maybe we should keep it the same if the type is
206            # compatible enough such as FIELDTYPE_DOUBLE and FIELDTYPE_INT
207          if self.__classification is not None:          if self.__classification is not None:
208              fieldname = self.__classification.GetField()              fieldname = self.__classification.GetField()
209              if fieldname is not None and \              fieldtype = self.__classification.GetFieldType()
210                 not self.store.Table().HasColumn(fieldname):              table = self.store.Table()
211                if (fieldname is not None
212                    and (not table.HasColumn(fieldname)
213                         or table.Column(fieldname).type != fieldtype)):
214                  self.SetClassification(None)                  self.SetClassification(None)
215          self.changed(LAYER_CHANGED, self)          self.changed(LAYER_SHAPESTORE_REPLACED, self)
216    
217      def ShapeStore(self):      def ShapeStore(self):
218          return self.store          return self.store
# Line 212  class Layer(BaseLayer): Line 220  class Layer(BaseLayer):
220      def Destroy(self):      def Destroy(self):
221          BaseLayer.Destroy(self)          BaseLayer.Destroy(self)
222          self.SetClassification(None)          self.SetClassification(None)
223            self.store = self.shapetree = None
224            self.table = self.shapefile = self.shapetable = None
225    
226      def BoundingBox(self):      def BoundingBox(self):
227          """Return the layer's bounding box in the intrinsic coordinate system.          """Return the layer's bounding box in the intrinsic coordinate system.
# Line 350  class Layer(BaseLayer): Line 360  class Layer(BaseLayer):
360      def TreeInfo(self):      def TreeInfo(self):
361          items = []          items = []
362    
363            if hasattr(self, 'filename'):
364                items.append(_("Filename: %s") % self.filename)
365    
366          if self.Visible():          if self.Visible():
367              items.append(_("Shown"))              items.append(_("Shown"))
368          else:          else:

Legend:
Removed from v.996  
changed lines
  Added in v.1142

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26