/[thuban]/branches/WIP-pyshapelib-bramz/test/mockgeo.py
ViewVC logotype

Diff of /branches/WIP-pyshapelib-bramz/test/mockgeo.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1585 by bh, Fri Aug 15 10:26:40 2003 UTC revision 1593 by bh, Fri Aug 15 14:10:27 2003 UTC
# Line 7  Line 7 
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$
# Line 36  class SimpleShape: Line 38  class SimpleShape:
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"""
# Line 83  class SimpleShapeStore: Line 86  class SimpleShapeStore:
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:

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

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26