/[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 1535 by bh, Fri Aug 1 14:27:13 2003 UTC revision 1587 by bh, Fri Aug 15 10:31:07 2003 UTC
# Line 19  import classification Line 19  import classification
19    
20  from color import Transparent, Black  from color import Transparent, Black
21  from base import TitledObject, Modifiable  from base import TitledObject, Modifiable
22  from data import SHAPETYPE_POLYGON, SHAPETYPE_ARC, SHAPETYPE_POINT, Shape  from data import SHAPETYPE_POLYGON, SHAPETYPE_ARC, SHAPETYPE_POINT
23    
24  import resource  import resource
25    
# Line 253  class Layer(BaseLayer): Line 253  class Layer(BaseLayer):
253          """Return the shape with index index"""          """Return the shape with index index"""
254          return self.store.Shape(index)          return self.store.Shape(index)
255    
256      def ShapesInRegion(self, box):      def ShapesInRegion(self, bbox):
257          """Return the ids of the shapes that overlap the box.          """Return the ids of the shapes that overlap the box.
258    
259          Box is a tuple (left, bottom, right, top) in unprojected coordinates.          Box is a tuple (left, bottom, right, top) in unprojected coordinates.
260          """          """
         left, bottom, right, top = box  
   
261          if self.projection is not None:          if self.projection is not None:
262              left,  bottom = self.projection.Forward(left, bottom)              left, bottom, right, top = bbox
263              right, top    = self.projection.Forward(right, top)              xs = []; ys = []
264                for x, y in [(left, bottom), (left, top), (right, top),
265                             (right, bottom)]:
266                    x, y = self.projection.Forward(x, y)
267                    xs.append(x)
268                    ys.append(y)
269                bbox = (min(xs), min(ys), max(xs), max(ys))
270    
271          return self.store.ShapesInRegion((left, bottom, right, top))          return self.store.ShapesInRegion(bbox)
272    
273      def GetClassificationColumn(self):      def GetClassificationColumn(self):
274          return self.classification_column          return self.classification_column

Legend:
Removed from v.1535  
changed lines
  Added in v.1587

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26