/[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 290 by bh, Thu Aug 29 14:11:28 2002 UTC revision 362 by jonathan, Mon Jan 27 11:39:03 2003 UTC
# Line 63  class MapRenderer: Line 63  class MapRenderer:
63          scale = self.scale          scale = self.scale
64          offx, offy = self.offset          offx, offy = self.offset
65    
         fill = layer.fill  
         if fill is None:  
             brush = wxTRANSPARENT_BRUSH  
         else:  
             color = wxColour(fill.red * 255,  
                              fill.green * 255,  
                              fill.blue * 255)  
             brush = wxBrush(color, wxSOLID)  
         stroke = layer.stroke  
         stroke_width = layer.stroke_width  
         if stroke is None:  
             pen = wxTRANSPARENT_PEN  
         else:  
             color = wxColour(stroke.red * 255,  
                              stroke.green * 255,  
                              stroke.blue * 255)  
             pen = wxPen(color, stroke_width, wxSOLID)  
   
66          map_proj = self.map.projection          map_proj = self.map.projection
67          layer_proj = layer.projection          layer_proj = layer.projection
68    
69          shapetype = layer.ShapeType()          shapetype = layer.ShapeType()
70    
71          if shapetype == SHAPETYPE_POLYGON:          brush = wxTRANSPARENT_BRUSH
72              for i in self.layer_ids(layer):          pen   = wxTRANSPARENT_PEN
73    
74            old_prop = None
75            for i in self.layer_ids(layer):
76                value = None
77                shape = layer.Shape(i)
78                field = layer.classification.field
79    
80                if field is not None:
81                    record = layer.table.read_record(i)
82                    if record is not None:
83                        value = record[field]
84    
85                #
86                # if the above statements fail 'value' should
87                # be null, at which point this call will
88                # at least retreive the NullData
89                #
90                prop = layer.classification.getProperties(value)
91    
92                if prop != old_prop:
93                    old_prop = prop
94    
95                    if shapetype == SHAPETYPE_ARC:
96                        fill = None
97                    else:
98                        fill = prop['fill']
99        
100                    if fill is None:
101                        brush = wxTRANSPARENT_BRUSH
102                    else:
103                        color = wxColour(fill.red * 255,
104                                         fill.green * 255,
105                                         fill.blue * 255)
106                        brush = wxBrush(color, wxSOLID)
107        
108                    stroke = prop['stroke']
109                    stroke_width = prop['stroke_width']
110                    if stroke is None:
111                        pen = wxTRANSPARENT_PEN
112                    else:
113                        color = wxColour(stroke.red * 255,
114                                         stroke.green * 255,
115                                         stroke.blue * 255)
116                        pen = wxPen(color, stroke_width, wxSOLID)
117        
118                if shapetype == SHAPETYPE_POINT:
119                    self.dc.SetBrush(brush)
120                    self.dc.SetPen(pen)
121                    self.draw_point_shape(layer, i)
122                else:
123                  self.draw_polygon_shape(layer, i, pen, brush)                  self.draw_polygon_shape(layer, i, pen, brush)
         elif shapetype == SHAPETYPE_ARC:  
             for i in self.layer_ids(layer):  
                 self.draw_polygon_shape(layer, i, pen, None)  
         else:  
             self.dc.SetBrush(brush)  
             self.dc.SetPen(pen)  
             if shapetype == SHAPETYPE_ARC:  
                 f = self.draw_arc_shape  
             elif shapetype == SHAPETYPE_POINT:  
                 f = self.draw_point_shape  
             for i in self.layer_ids(layer):  
                 f(layer, i)  
124    
125      def layer_ids(self, layer):      def layer_ids(self, layer):
126          """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.

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

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26