/[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 1593 by bh, Fri Aug 15 14:10:27 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 an iterable over the shapes that overlap the bounding box.
258    
259          Box is a tuple (left, bottom, right, top) in unprojected coordinates.          The bbox parameter should be the bounding box as a tuple in the
260            form (minx, miny, maxx, maxy) in unprojected coordinates.
261          """          """
         left, bottom, right, top = box  
   
262          if self.projection is not None:          if self.projection is not None:
263              left,  bottom = self.projection.Forward(left, bottom)              left, bottom, right, top = bbox
264              right, top    = self.projection.Forward(right, top)              xs = []; ys = []
265                for x, y in [(left, bottom), (left, top), (right, top),
266                             (right, bottom)]:
267                    x, y = self.projection.Forward(x, y)
268                    xs.append(x)
269                    ys.append(y)
270                bbox = (min(xs), min(ys), max(xs), max(ys))
271    
272          return self.store.ShapesInRegion((left, bottom, right, top))          return self.store.ShapesInRegion(bbox)
273    
274      def GetClassificationColumn(self):      def GetClassificationColumn(self):
275          return self.classification_column          return self.classification_column

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

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26