7 |
|
|
8 |
"""Mock geometric/geographic objects""" |
"""Mock geometric/geographic objects""" |
9 |
|
|
10 |
|
from __future__ import generators |
11 |
|
|
12 |
__version__ = "$Revision$" |
__version__ = "$Revision$" |
13 |
# $Source$ |
# $Source$ |
14 |
# $Id$ |
# $Id$ |
38 |
ys.append(y) |
ys.append(y) |
39 |
return (min(xs), min(ys), max(xs), max(ys)) |
return (min(xs), min(ys), max(xs), max(ys)) |
40 |
|
|
41 |
|
|
42 |
class SimpleShapeStore: |
class SimpleShapeStore: |
43 |
|
|
44 |
"""A simple shapestore object which holds its data in memory""" |
"""A simple shapestore object which holds its data in memory""" |
86 |
left, right = right, left |
left, right = right, left |
87 |
if bottom > top: |
if bottom > top: |
88 |
bottom, top = top, bottom |
bottom, top = top, bottom |
|
ids = [] |
|
89 |
for i in xrange(len(self.shapes)): |
for i in xrange(len(self.shapes)): |
90 |
shape = SimpleShape(i, self.shapes[i]) |
shape = SimpleShape(i, self.shapes[i]) |
91 |
sleft, sbottom, sright, stop = shape.compute_bbox() |
sleft, sbottom, sright, stop = shape.compute_bbox() |
92 |
if (left <= sright and right >= sleft |
if (left <= sright and right >= sleft |
93 |
and top >= sbottom and bottom <= stop): |
and top >= sbottom and bottom <= stop): |
94 |
ids.append(i) |
yield shape |
95 |
return ids |
|
96 |
|
def AllShapes(self): |
97 |
|
for i in xrange(len(self.shapes)): |
98 |
|
yield SimpleShape(i, self.shapes[i]) |
99 |
|
|
100 |
|
|
101 |
class AffineProjection: |
class AffineProjection: |