/[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 362 by jonathan, Mon Jan 27 11:39:03 2003 UTC revision 424 by bh, Mon Feb 24 14:17:07 2003 UTC
# Line 1  Line 1 
1  # Copyright (c) 2001, 2002 by Intevation GmbH  # Copyright (c) 2001, 2002, 2003 by Intevation GmbH
2  # Authors:  # Authors:
3  # Bernhard Herzog <[email protected]>  # Bernhard Herzog <[email protected]>
4    # Jonathan Coles <[email protected]>
5  #  #
6  # This program is free software under the GPL (>=v2)  # This program is free software under the GPL (>=v2)
7  # Read the file COPYING coming with Thuban for details.  # Read the file COPYING coming with Thuban for details.
# Line 13  from wxPython.wx import wxPoint, wxColou Line 14  from wxPython.wx import wxPoint, wxColou
14    
15  from wxproj import draw_polygon_shape  from wxproj import draw_polygon_shape
16    
17    from Thuban import _
18    
19  from Thuban.Model.layer import SHAPETYPE_POLYGON, SHAPETYPE_ARC, \  from Thuban.Model.layer import SHAPETYPE_POLYGON, SHAPETYPE_ARC, \
20       SHAPETYPE_POINT       SHAPETYPE_POINT
21  from Thuban.Model.label import ALIGN_CENTER, ALIGN_TOP, ALIGN_BOTTOM, \  from Thuban.Model.label import ALIGN_CENTER, ALIGN_TOP, ALIGN_BOTTOM, \
22       ALIGN_LEFT, ALIGN_RIGHT, ALIGN_BASELINE       ALIGN_LEFT, ALIGN_RIGHT, ALIGN_BASELINE
23    
24    from Thuban.Model.classification import Classification
25    from Thuban.Model.color import Color
26    
27    
28  class MapRenderer:  class MapRenderer:
29    
# Line 74  class MapRenderer: Line 80  class MapRenderer:
80          old_prop = None          old_prop = None
81          for i in self.layer_ids(layer):          for i in self.layer_ids(layer):
82              value = None              value = None
83              shape = layer.Shape(i)              lc = layer.GetClassification()
84              field = layer.classification.field              field = lc.field
85    
86              if field is not None:              if field is not None:
87                  record = layer.table.read_record(i)                  record = layer.table.read_record(i)
# Line 87  class MapRenderer: Line 93  class MapRenderer:
93              # be null, at which point this call will              # be null, at which point this call will
94              # at least retreive the NullData              # at least retreive the NullData
95              #              #
96              prop = layer.classification.getProperties(value)              prop = lc.GetProperties(value)
97    
98              if prop != old_prop:              if prop != old_prop:
99                  old_prop = prop                  old_prop = prop
100    
101                  if shapetype == SHAPETYPE_ARC:                  if shapetype == SHAPETYPE_ARC:
102                      fill = None                      fill = Color.None
103                  else:                  else:
104                      fill = prop['fill']                      fill = prop.GetFill()
105            
106                  if fill is None:                  if fill is Color.None:
107                      brush = wxTRANSPARENT_BRUSH                      brush = wxTRANSPARENT_BRUSH
108                  else:                  else:
109                      color = wxColour(fill.red * 255,                      color = wxColour(fill.red * 255,
# Line 105  class MapRenderer: Line 111  class MapRenderer:
111                                       fill.blue * 255)                                       fill.blue * 255)
112                      brush = wxBrush(color, wxSOLID)                      brush = wxBrush(color, wxSOLID)
113            
114                  stroke = prop['stroke']                  stroke = prop.GetStroke()
115                  stroke_width = prop['stroke_width']                  stroke_width = prop.GetStrokeWidth()
116                  if stroke is None:                  if stroke is Color.None:
117                      pen = wxTRANSPARENT_PEN                      pen = wxTRANSPARENT_PEN
118                  else:                  else:
119                      color = wxColour(stroke.red * 255,                      color = wxColour(stroke.red * 255,
# Line 244  class ScreenRenderer(MapRenderer): Line 250  class ScreenRenderer(MapRenderer):
250                  if shapetype == SHAPETYPE_POINT:                  if shapetype == SHAPETYPE_POINT:
251                      self.draw_point_shape(layer, index)                      self.draw_point_shape(layer, index)
252                  else:                  else:
253                      raise TypeError("Unhandled shape type %s" % shapetype)                      raise TypeError(_("Unhandled shape type %s") % shapetype)
254    
255      def layer_ids(self, layer):      def layer_ids(self, layer):
256          """Return the shapeids covered by the region that has to be redrawn          """Return the shapeids covered by the region that has to be redrawn

Legend:
Removed from v.362  
changed lines
  Added in v.424

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26