/[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 1298 by jonathan, Tue Jun 24 18:00:26 2003 UTC revision 1419 by bh, Tue Jul 15 09:29:18 2003 UTC
# Line 33  from Thuban.Model.label import ALIGN_CEN Line 33  from Thuban.Model.label import ALIGN_CEN
33       ALIGN_LEFT, ALIGN_RIGHT, ALIGN_BASELINE       ALIGN_LEFT, ALIGN_RIGHT, ALIGN_BASELINE
34    
35  from Thuban.Model.classification import Classification  from Thuban.Model.classification import Classification
36  from Thuban.Model.color import Color  from Thuban.Model.color import Transparent
37  import Thuban.Model.resource  import Thuban.Model.resource
38    
39  if Thuban.Model.resource.has_gdal_support():  if Thuban.Model.resource.has_gdal_support():
# Line 123  class MapRenderer: Line 123  class MapRenderer:
123          defaultGroup = lc.GetDefaultGroup()          defaultGroup = lc.GetDefaultGroup()
124    
125    
         if shapetype != SHAPETYPE_POINT:  
             polygon_render_param = self.polygon_render_param(layer)  
   
126          if shapetype == SHAPETYPE_POINT:          if shapetype == SHAPETYPE_POINT:
127              draw_func = lambda i: \              draw_func = self.draw_point_shape
128                     self.draw_point_shape(layer, i)              draw_func_param = layer
129          else:          else:
130              draw_func = lambda i: \              draw_func = draw_polygon_shape
131                     self.draw_polygon_shape(polygon_render_param, i, pen, brush)              draw_func_param = self.polygon_render_param(layer)
132    
133          table = layer.ShapeStore().Table()          table = layer.ShapeStore().Table()
134          for i in self.layer_ids(layer):          for i in self.layer_ids(layer):
# Line 158  class MapRenderer: Line 155  class MapRenderer:
155                      old_prop = prop                      old_prop = prop
156    
157                      if shapetype == SHAPETYPE_ARC:                      if shapetype == SHAPETYPE_ARC:
158                          fill = Color.Transparent                          fill = Transparent
159                      else:                      else:
160                          fill = prop.GetFill()                          fill = prop.GetFill()
161    
162    
163                      if fill is Color.Transparent:                      if fill is Transparent:
164                          brush = wxTRANSPARENT_BRUSH                          brush = wxTRANSPARENT_BRUSH
165                      else:                      else:
166                          color = Color2wxColour(fill)                          color = Color2wxColour(fill)
# Line 171  class MapRenderer: Line 168  class MapRenderer:
168    
169                      stroke = prop.GetLineColor()                      stroke = prop.GetLineColor()
170                      stroke_width = prop.GetLineWidth()                      stroke_width = prop.GetLineWidth()
171                      if stroke is Color.Transparent:                      if stroke is Transparent:
172                          pen = wxTRANSPARENT_PEN                          pen = wxTRANSPARENT_PEN
173                      else:                      else:
174                          color = Color2wxColour(stroke)                          color = Color2wxColour(stroke)
175                          pen = wxPen(color, stroke_width, wxSOLID)                          pen = wxPen(color, stroke_width, wxSOLID)
176    
177                      if shapetype == SHAPETYPE_POINT:              draw_func(draw_func_param, i, pen, brush)
                         self.dc.SetBrush(brush)  
                         self.dc.SetPen(pen)  
   
             draw_func(i)  
178    
179      def draw_raster_layer(self, layer):      def draw_raster_layer(self, layer):
180          data = None          data = None
# Line 273  class MapRenderer: Line 266  class MapRenderer:
266          points = self.projected_points(layer, index)          points = self.projected_points(layer, index)
267          self.dc.DrawLines(points)          self.dc.DrawLines(points)
268    
269      def draw_point_shape(self, layer, index):      def draw_point_shape(self, layer, index, pen, brush):
270          pp = self.projected_points(layer, index)          pp = self.projected_points(layer, index)
271    
272          if len(pp) == 0: return # ignore Null Shapes which have no points          if len(pp) == 0: return # ignore Null Shapes which have no points
273    
274          p = pp[0]          p = pp[0]
275          radius = self.resolution * 5          radius = self.resolution * 5
276            self.dc.SetBrush(brush)
277            self.dc.SetPen(pen)
278          self.dc.DrawEllipse(p.x - radius, p.y - radius, 2*radius, 2*radius)          self.dc.DrawEllipse(p.x - radius, p.y - radius, 2*radius, 2*radius)
279    
280      def draw_label_layer(self, layer):      def draw_label_layer(self, layer):
# Line 515  class ExportRenderer(ScreenRenderer): Line 510  class ExportRenderer(ScreenRenderer):
510          # Render the legend          # Render the legend
511          dc.SetTextForeground(wxBLACK)          dc.SetTextForeground(wxBLACK)
512          if map.HasLayers():          if map.HasLayers():
513              for l in map.Layers():              layers = map.Layers()
514                layers.reverse()
515                for l in layers:
516                  if l.Visible():                  if l.Visible():
517                      # Render title                      # Render title
518                      dc.DrawText(l.Title(), posx, posy)                      dc.DrawText(l.Title(), posx, posy)

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

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26