/[thuban]/trunk/thuban/Thuban/Model/layer.py
ViewVC logotype

Diff of /trunk/thuban/Thuban/Model/layer.py

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

revision 363 by bh, Fri Aug 23 15:25:07 2002 UTC revision 364 by jonathan, Mon Jan 27 11:47:12 2003 UTC
# Line 19  from color import Color Line 19  from color import Color
19  # Some predefined colors for internal use  # Some predefined colors for internal use
20  _black = Color(0, 0, 0)  _black = Color(0, 0, 0)
21    
22    from classification import Classification
23    
24  from table import Table  from table import Table
25    
# Line 140  class Layer(BaseLayer): Line 141  class Layer(BaseLayer):
141          self.shapetable = Table(filename)          self.shapetable = Table(filename)
142          self.table = self.shapetable          self.table = self.shapetable
143    
144            self.classification = Classification()
145            self.classification.setNull(
146                {'stroke':stroke, 'stroke_width':stroke_width, 'fill':fill})
147    
148      def open_shapefile(self):      def open_shapefile(self):
149          if self.shapefile is None:          if self.shapefile is None:
150              self.shapefile = shapelib.ShapeFile(self.filename)              self.shapefile = shapelib.ShapeFile(self.filename)
# Line 215  class Layer(BaseLayer): Line 220  class Layer(BaseLayer):
220          """Return the shape with index index"""          """Return the shape with index index"""
221          self.open_shapefile()          self.open_shapefile()
222          shape = self.shapefile.read_object(index)          shape = self.shapefile.read_object(index)
223    
224          if self.shapetype == SHAPETYPE_POINT:          if self.shapetype == SHAPETYPE_POINT:
225              points = shape.vertices()              points = shape.vertices()
226          else:          else:
# Line 223  class Layer(BaseLayer): Line 229  class Layer(BaseLayer):
229              points = []              points = []
230              for x, y in poly:              for x, y in poly:
231                  points.append((x, y))                  points.append((x, y))
232    
233          return Shape(points)          return Shape(points)
234    
235      def ShapesInRegion(self, box):      def ShapesInRegion(self, box):

Legend:
Removed from v.363  
changed lines
  Added in v.364

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26