/[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 725 by jonathan, Thu Apr 24 16:05:36 2003 UTC revision 794 by jonathan, Wed Apr 30 17:00:52 2003 UTC
# Line 66  class BaseLayer(TitledObject, Modifiable Line 66  class BaseLayer(TitledObject, Modifiable
66    
67      """Base class for the layers."""      """Base class for the layers."""
68    
69      def __init__(self, title, visible = 1):      def __init__(self, title, visible = True):
70          """Initialize the layer.          """Initialize the layer.
71    
72          title -- the title          title -- the title
# Line 106  class Layer(BaseLayer): Line 106  class Layer(BaseLayer):
106                   fill = Color.Transparent,                   fill = Color.Transparent,
107                   stroke = Color.Black,                   stroke = Color.Black,
108                   lineWidth = 1,                   lineWidth = 1,
109                   visible = 1):                   visible = True):
110          """Initialize the layer.          """Initialize the layer.
111    
112          title -- the title          title -- the title
# Line 176  class Layer(BaseLayer): Line 176  class Layer(BaseLayer):
176                                           maxdepth)                                           maxdepth)
177          if self.__classification is not None:          if self.__classification is not None:
178              fieldname = self.__classification.GetField()              fieldname = self.__classification.GetField()
179              if not self.store.Table().field_info_by_name(fieldname):              if fieldname is not None and \
180                   not self.store.Table().field_info_by_name(fieldname):
181                  self.SetClassification(None)                  self.SetClassification(None)
182          self.changed(LAYER_CHANGED, self)          self.changed(LAYER_CHANGED, self)
183    
# Line 244  class Layer(BaseLayer): Line 245  class Layer(BaseLayer):
245      def ShapesInRegion(self, box):      def ShapesInRegion(self, box):
246          """Return the ids of the shapes that overlap the box.          """Return the ids of the shapes that overlap the box.
247    
248          Box is a tuple (left, bottom, right, top) in the coordinate          Box is a tuple (left, bottom, right, top) in unprojected coordinates.
         system used by the layer's shapefile.  
249          """          """
250          left, bottom, right, top = box          left, bottom, right, top = box
251    
252            if self.projection is not None:
253                left,  bottom = self.projection.Forward(left, bottom)
254                right, top    = self.projection.Forward(right, top)
255    
256          return self.shapetree.find_shapes((left, bottom), (right, top))          return self.shapetree.find_shapes((left, bottom), (right, top))
257    
258      def GetProjection(self):      def GetProjection(self):
# Line 308  class Layer(BaseLayer): Line 313  class Layer(BaseLayer):
313              items.append(_("Extent (lat-lon):"))              items.append(_("Extent (lat-lon):"))
314          items.append(_("Shapetype: %s") % shapetype_names[self.ShapeType()])          items.append(_("Shapetype: %s") % shapetype_names[self.ShapeType()])
315    
316            if self.projection and len(self.projection.params) > 0:
317                items.append((_("Projection"),
318                            [str(param) for param in self.projection.params]))
319    
320          items.append(self.__classification)          items.append(self.__classification)
321    
322          return (_("Layer '%s'") % self.Title(), items)          return (_("Layer '%s'") % self.Title(), items)
323    
324    

Legend:
Removed from v.725  
changed lines
  Added in v.794

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26