/[thuban]/branches/WIP-pyshapelib-bramz/Thuban/Model/data.py
ViewVC logotype

Diff of /branches/WIP-pyshapelib-bramz/Thuban/Model/data.py

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

revision 1605 by bh, Tue Aug 19 11:00:40 2003 UTC revision 1972 by bh, Mon Nov 24 19:23:08 2003 UTC
# Line 124  class ShapefileStore: Line 124  class ShapefileStore:
124          # safer to always work with absolute paths.          # safer to always work with absolute paths.
125          self.filename = os.path.abspath(filename)          self.filename = os.path.abspath(filename)
126    
         self.shapefile = shapelib.ShapeFile(self.filename)  
127          self.dbftable = table.DBFTable(filename)          self.dbftable = table.DBFTable(filename)
128          self.table = ShapeTable(self, session.TransientDB(), self.dbftable)          self.table = ShapeTable(self, session.TransientDB(), self.dbftable)
129            self._open_shapefile()
130    
131        def _open_shapefile(self):
132            self.shapefile = shapelib.ShapeFile(self.filename)
133          self.numshapes, shapetype, mins, maxs = self.shapefile.info()          self.numshapes, shapetype, mins, maxs = self.shapefile.info()
134          if self.numshapes:          if self.numshapes:
135              self.bbox = mins[:2] + maxs[:2]              self.bbox = mins[:2] + maxs[:2]
# Line 206  class ShapefileStore: Line 208  class ShapefileStore:
208          form (minx, miny, maxx, maxy) in the coordinate system of the          form (minx, miny, maxx, maxy) in the coordinate system of the
209          shape store.          shape store.
210          """          """
211            # Bind a few globals to locals to make it a bit faster
212            cls = ShapefileShape
213            shapefile = self.shapefile
214    
215          left, bottom, right, top = bbox          left, bottom, right, top = bbox
216          for i in self.shapetree.find_shapes((left, bottom), (right, top)):          for i in self.shapetree.find_shapes((left, bottom), (right, top)):
217              yield ShapefileShape(self.shapefile, i)              yield cls(shapefile, i)
218    
219      def AllShapes(self):      def AllShapes(self):
220          """Return an iterable over the shapes in the shape store."""          """Return an iterable over the shapes in the shape store."""

Legend:
Removed from v.1605  
changed lines
  Added in v.1972

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26