/[thuban]/branches/WIP-pyshapelib-bramz/Thuban/UI/baserenderer.py
ViewVC logotype

Diff of /branches/WIP-pyshapelib-bramz/Thuban/UI/baserenderer.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1913 by bh, Wed Oct 29 17:43:40 2003 UTC revision 1914 by bh, Mon Nov 3 14:17:51 2003 UTC
# Line 194  class BaseRenderer: Line 194  class BaseRenderer:
194          # Determine which render function to use.          # Determine which render function to use.
195          useraw, draw_func, draw_func_param = self.low_level_renderer(layer)          useraw, draw_func, draw_func_param = self.low_level_renderer(layer)
196    
197            #
198          # Iterate through all shapes that have to be drawn.          # Iterate through all shapes that have to be drawn.
199            #
200    
201            # Count the shapes drawn so that we can yield every few hundred
202            # shapes
203          count = 0          count = 0
204    
205            # Cache the tools (pens and brushes) for the classification
206            # groups. This is a mapping from the group's ids to the a tuple
207            # (pen, brush)
208            tool_cache = {}
209    
210          for shape in self.layer_shapes(layer):          for shape in self.layer_shapes(layer):
211              count += 1              count += 1
212              if field is None:              if field is None:
213                  group = defaultGroup                  group = defaultGroup
214              else:              else:
215                  record = table.ReadRowAsDict(shape.ShapeID())                  value = table.ReadRowAsDict(shape.ShapeID())[field]
216                  assert record is not None                  group = lc.FindGroup(value)
                 group = lc.FindGroup(record[field])  
217    
218              if not group.IsVisible():              if not group.IsVisible():
219                  continue                  continue
220    
221              # don't recreate new objects if they are the same as before              try:
222              if group is not old_group:                  pen, brush = tool_cache[id(group)]
223                  old_group = group              except KeyError:
224                    pen, brush = tool_cache[id(group)] \
225                  prop = group.GetProperties()                               = self.tools_for_property(group.GetProperties())
   
                 if prop != old_prop:  
                     pen, brush = self.tools_for_property(prop)  
226    
227              if useraw:              if useraw:
228                  data = shape.RawData()                  data = shape.RawData()

Legend:
Removed from v.1913  
changed lines
  Added in v.1914

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26