/[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 1927 by bh, Mon Nov 10 16:57:35 2003 UTC revision 2394 by jan, Wed Nov 17 22:02:29 2004 UTC
# Line 1  Line 1 
1  # Copyright (c) 2001, 2002, 2003 by Intevation GmbH  # Copyright (c) 2001-2004 by Intevation GmbH
2  # Authors:  # Authors:
3  # Bernhard Herzog <[email protected]>  # Bernhard Herzog <[email protected]> (2001-2003)
4  # Jonathan Coles <[email protected]>  # Jonathan Coles <[email protected]> (2003)
5  # Frank Koormann <[email protected]>  # Frank Koormann <[email protected]> (2003)
6    # Jan-Oliver Wagner <[email protected]> (2003, 2004)
7  #  #
8  # This program is free software under the GPL (>=v2)  # This program is free software under the GPL (>=v2)
9  # Read the file COPYING coming with Thuban for details.  # Read the file COPYING coming with Thuban for details.
# Line 51  class MapRenderer(BaseRenderer): Line 52  class MapRenderer(BaseRenderer):
52      TRANSPARENT_PEN = wxTRANSPARENT_PEN      TRANSPARENT_PEN = wxTRANSPARENT_PEN
53      TRANSPARENT_BRUSH = wxTRANSPARENT_BRUSH      TRANSPARENT_BRUSH = wxTRANSPARENT_BRUSH
54    
55      make_point = wxPoint      def make_point(self, x, y):
56            return wxPoint(int(round(x)), int(round(y)))
57    
58      def tools_for_property(self, prop):      def tools_for_property(self, prop):
59          fill = prop.GetFill()          fill = prop.GetFill()
# Line 90  class MapRenderer(BaseRenderer): Line 92  class MapRenderer(BaseRenderer):
92              return BaseRenderer.low_level_renderer(self, layer)              return BaseRenderer.low_level_renderer(self, layer)
93    
94      def label_font(self):      def label_font(self):
95          return wxFont(self.resolution * 10, wxSWISS, wxNORMAL, wxNORMAL)          return wxFont(int(round(self.resolution * 10)), wxSWISS, wxNORMAL,
96                          wxNORMAL)
97    
98      def draw_raster_data(self, data, format = 'BMP'):      def draw_raster_data(self, data, format = 'BMP'):
99          stream = cStringIO.StringIO(data)          stream = cStringIO.StringIO(data)
# Line 127  class ScreenRenderer(MapRenderer): Line 130  class ScreenRenderer(MapRenderer):
130          return self.render_map_incrementally()          return self.render_map_incrementally()
131    
132      def draw_selection_incrementally(self, layer, selected_shapes):      def draw_selection_incrementally(self, layer, selected_shapes):
133            """Draw the selected shapes in a emphasized way (i.e.
134            with a special pen and brush.
135            The drawing is performed incrementally, that means every
136            n shapes, the user can have interactions with the map.
137            n is currently fixed to 500.
138    
139            layer -- the layer where the shapes belong to.
140            selected_shapes -- a list of the shape-ids representing the
141                               selected shapes for the given layer.
142            """
143          pen = wxPen(wxBLACK, 3, wxSOLID)          pen = wxPen(wxBLACK, 3, wxSOLID)
144          brush = wxBrush(wxBLACK, wxCROSS_HATCH)          brush = wxBrush(wxBLACK, wxCROSS_HATCH)
145    
146          shapetype = layer.ShapeType()          shapetype = layer.ShapeType()
147          useraw, func, param = self.low_level_renderer(layer)          useraw, func, param = self.low_level_renderer(layer)
148          args = (pen, brush)          args = (pen, brush)
149    
150            # for point shapes we need to find out the properties
151            # to determine the size. Based on table and field,
152            # we can find out the properties for object - see below.
153            if shapetype == SHAPETYPE_POINT:
154                lc = layer.GetClassification()
155                field = layer.GetClassificationColumn()
156                table = layer.ShapeStore().Table()
157    
158          count = 0          count = 0
159          for index in selected_shapes:          for index in selected_shapes:
160              count += 1              count += 1
161              shape = layer.Shape(index)              shape = layer.Shape(index)
162    
163                # Get the size of the specific property for this
164                # point
165                if shapetype == SHAPETYPE_POINT:
166                    value = table.ReadValue(shape.ShapeID(), field)
167                    group = lc.FindGroup(value)
168                    size = group.GetProperties().GetSize()
169                    args = (pen, brush, size)
170    
171              if useraw:              if useraw:
172                  data = shape.RawData()                  data = shape.RawData()
173              else:              else:

Legend:
Removed from v.1927  
changed lines
  Added in v.2394

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26