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 |