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 |