/[thuban]/branches/WIP-pyshapelib-bramz/Thuban/UI/renderer.py
ViewVC logotype

Diff of /branches/WIP-pyshapelib-bramz/Thuban/UI/renderer.py

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

revision 1552 by bh, Wed Aug 6 17:21:32 2003 UTC revision 1750 by bh, Wed Sep 24 15:46:27 2003 UTC
# Line 24  from Thuban.UI.common import Color2wxCol Line 24  from Thuban.UI.common import Color2wxCol
24  from Thuban.UI.classifier import ClassDataPreviewer  from Thuban.UI.classifier import ClassDataPreviewer
25  from Thuban.UI.scalebar import ScaleBar  from Thuban.UI.scalebar import ScaleBar
26    
27  from Thuban.Model.data import SHAPETYPE_POLYGON, SHAPETYPE_ARC, SHAPETYPE_POINT  from Thuban.Model.data import SHAPETYPE_POLYGON, SHAPETYPE_ARC, \
28         SHAPETYPE_POINT, RAW_SHAPEFILE
29    
30  from Thuban.Model.color import Transparent  from Thuban.Model.color import Transparent
31  import Thuban.Model.resource  import Thuban.Model.resource
# Line 57  class MapRenderer(BaseRenderer): Line 58  class MapRenderer(BaseRenderer):
58      def low_level_renderer(self, layer):      def low_level_renderer(self, layer):
59          """Override inherited method to provide more efficient renderers          """Override inherited method to provide more efficient renderers
60    
61          For point shapes, return self.draw_point_shape and layer just as          If the underlying data format is not a shapefile or the layer
62          the base class method. For arc and polygon use the more          contains points shapes, simply use what the inherited method
63          efficient wxproj.draw_polygon_shape and its corresponding          returns.
64          parameter created with wxproj.draw_polygon_init.  
65            Otherwise, i.e. for arc and polygon use the more efficient
66            wxproj.draw_polygon_shape and its corresponding parameter
67            created with wxproj.draw_polygon_init.
68          """          """
69          shapetype = layer.ShapeType()          if (layer.ShapeStore().RawShapeFormat() == RAW_SHAPEFILE
70          if shapetype == SHAPETYPE_POINT:              and layer.ShapeType() in (SHAPETYPE_ARC, SHAPETYPE_POLYGON)):
             func = self.draw_point_shape  
             param = layer  
         else:  
71              offx, offy = self.offset              offx, offy = self.offset
72              param = draw_polygon_init(layer.ShapeStore().Shapefile(), self.dc,              return (True, draw_polygon_shape,
73                                        self.map.projection,                      draw_polygon_init(layer.ShapeStore().Shapefile(),
74                                          self.dc, self.map.projection,
75                                        layer.projection,                                        layer.projection,
76                                        self.scale, -self.scale,                                        self.scale, -self.scale, offx, offy))
77                                        offx, offy)          else:
78              func = draw_polygon_shape              return BaseRenderer.low_level_renderer(self, layer)
         return func, param  
79    
80      def label_font(self):      def label_font(self):
81          return wxFont(self.resolution * 10, wxSWISS, wxNORMAL, wxNORMAL)          return wxFont(self.resolution * 10, wxSWISS, wxNORMAL, wxNORMAL)
# Line 111  class ScreenRenderer(MapRenderer): Line 112  class ScreenRenderer(MapRenderer):
112              brush = wxBrush(wxBLACK, wxCROSS_HATCH)              brush = wxBrush(wxBLACK, wxCROSS_HATCH)
113    
114              shapetype = layer.ShapeType()              shapetype = layer.ShapeType()
115              func, param = self.low_level_renderer(layer)              useraw, func, param = self.low_level_renderer(layer)
116              args = (pen, brush)              args = (pen, brush)
117              for index in self.selected_shapes:              for index in self.selected_shapes:
118                  func(param, index, *args)                  shape = layer.Shape(index)
119                    if useraw:
120                        data = shape.RawData()
121                    else:
122                        data = shape.Points()
123                    func(param, data, *args)
124    
125      def layer_ids(self, layer):      def layer_shapes(self, layer):
126          """Return the shapeids covered by the region that has to be redrawn          """Return the shapeids covered by the region that has to be redrawn
127    
128          Call the layer's ShapesInRegion method to determine the ids so          Call the layer's ShapesInRegion method to determine the ids so
# Line 263  class ExportRenderer(ScreenRenderer): Line 269  class ExportRenderer(ScreenRenderer):
269          # Render the legend          # Render the legend
270          dc.SetTextForeground(wxBLACK)          dc.SetTextForeground(wxBLACK)
271          if map.HasLayers():          if map.HasLayers():
272              layers = map.Layers()              layers = map.Layers()[:]
273              layers.reverse()              layers.reverse()
274              for l in layers:              for l in layers:
275                  if l.Visible():                  if l.Visible():

Legend:
Removed from v.1552  
changed lines
  Added in v.1750

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26