/[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 1419 by bh, Tue Jul 15 09:29:18 2003 UTC revision 1539 by bh, Fri Aug 1 14:27:57 2003 UTC
# Line 27  from Thuban.UI.common import Color2wxCol Line 27  from Thuban.UI.common import Color2wxCol
27  from Thuban.UI.classifier import ClassDataPreviewer  from Thuban.UI.classifier import ClassDataPreviewer
28  from Thuban.UI.scalebar import ScaleBar  from Thuban.UI.scalebar import ScaleBar
29    
30  from Thuban.Model.layer import Layer, RasterLayer, \  from Thuban.Model.layer import Layer, RasterLayer
31       SHAPETYPE_POLYGON, SHAPETYPE_ARC, SHAPETYPE_POINT  from Thuban.Model.data import SHAPETYPE_POLYGON, SHAPETYPE_ARC, SHAPETYPE_POINT
32  from Thuban.Model.label import ALIGN_CENTER, ALIGN_TOP, ALIGN_BOTTOM, \  from Thuban.Model.label import ALIGN_CENTER, ALIGN_TOP, ALIGN_BOTTOM, \
33       ALIGN_LEFT, ALIGN_RIGHT, ALIGN_BASELINE       ALIGN_LEFT, ALIGN_RIGHT, ALIGN_BASELINE
34    
# Line 75  class MapRenderer: Line 75  class MapRenderer:
75          self.map = map          self.map = map
76          seenRaster = True          seenRaster = True
77    
78          if self.scale == 0:          self.dc.BeginDrawing()
             return  
79    
80          #          #
81          # This is only a good optimization if there is only one          # This is only a good optimization if there is only one
# Line 104  class MapRenderer: Line 103  class MapRenderer:
103    
104          self.draw_label_layer(map.LabelLayer())          self.draw_label_layer(map.LabelLayer())
105    
106            self.dc.EndDrawing()
107    
108      def draw_shape_layer(self, layer):      def draw_shape_layer(self, layer):
109          scale = self.scale          scale = self.scale
110          offx, offy = self.offset          offx, offy = self.offset
# Line 119  class MapRenderer: Line 120  class MapRenderer:
120          old_prop = None          old_prop = None
121          old_group = None          old_group = None
122          lc = layer.GetClassification()          lc = layer.GetClassification()
123          field = lc.GetField()          field = layer.GetClassificationColumn()
124          defaultGroup = lc.GetDefaultGroup()          defaultGroup = lc.GetDefaultGroup()
125    
126    
127    
128          if shapetype == SHAPETYPE_POINT:          if shapetype == SHAPETYPE_POINT:
129              draw_func = self.draw_point_shape              draw_func = self.draw_point_shape
130              draw_func_param = layer              draw_func_param = layer
# Line 214  class MapRenderer: Line 216  class MapRenderer:
216                  stream = cStringIO.StringIO(data)                  stream = cStringIO.StringIO(data)
217                  image = wxImageFromStream(stream, wxBITMAP_TYPE_BMP)                  image = wxImageFromStream(stream, wxBITMAP_TYPE_BMP)
218                  bitmap = wxBitmapFromImage(image)                  bitmap = wxBitmapFromImage(image)
                 self.dc.BeginDrawing()  
219                  self.dc.DrawBitmap(bitmap, 0, 0)                  self.dc.DrawBitmap(bitmap, 0, 0)
                 self.dc.EndDrawing()  
220    
221      def layer_ids(self, layer):      def layer_ids(self, layer):
222          """Return the shape ids of the given layer that have to be drawn.          """Return the shape ids of the given layer that have to be drawn.
# Line 352  class ScreenRenderer(MapRenderer): Line 352  class ScreenRenderer(MapRenderer):
352                  args = (pen, None)                  args = (pen, None)
353              elif shapetype == SHAPETYPE_POINT:              elif shapetype == SHAPETYPE_POINT:
354                  renderparam = layer                  renderparam = layer
                 self.dc.SetBrush(brush)  
                 self.dc.SetPen(pen)  
355                  func = self.draw_point_shape                  func = self.draw_point_shape
356                  args = ()                  args = (pen, brush)
357              else:              else:
358                  raise TypeError(_("Unhandled shape type %s") % shapetype)                  raise TypeError(_("Unhandled shape type %s") % shapetype)
359    
360              for index in self.selected_shapes:              for index in self.selected_shapes:
361                  func(renderparam, index, *args)                  func(renderparam, index, *args)
362    
   
363      def layer_ids(self, layer):      def layer_ids(self, layer):
364          """Return the shapeids covered by the region that has to be redrawn          """Return the shapeids covered by the region that has to be redrawn
365    

Legend:
Removed from v.1419  
changed lines
  Added in v.1539

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26