/[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 1926 by bh, Mon Nov 10 16:57:19 2003 UTC revision 2224 by bh, Fri May 28 17:29:30 2004 UTC
# Line 1  Line 1 
1  # Copyright (c) 2001, 2002, 2003 by Intevation GmbH  # Copyright (c) 2001, 2002, 2003, 2004 by Intevation GmbH
2  # Authors:  # Authors:
3  # Bernhard Herzog <[email protected]>  # Bernhard Herzog <[email protected]>
4  # Jonathan Coles <[email protected]>  # Jonathan Coles <[email protected]>
# Line 42  if Thuban.Model.resource.has_gdal_suppor Line 42  if Thuban.Model.resource.has_gdal_suppor
42  # (layer_class, draw_function) pairs. If the renderer has to draw a  # (layer_class, draw_function) pairs. If the renderer has to draw a
43  # non-builtin layer type, i.e. a layer that is not a subclass of Layer  # non-builtin layer type, i.e. a layer that is not a subclass of Layer
44  # or RasterLayer, it iterates through that list, tests whether the layer  # or RasterLayer, it iterates through that list, tests whether the layer
45  # to be drawin is an instance of layer_class and if so calls  # to be drawn is an instance of layer_class and if so calls
46  # draw_function with the renderer and the layer as arguments. Since  # draw_function with the renderer and the layer as arguments. Since
47  # drawing is done incrementally, the draw_function should return an  # drawing is done incrementally, the draw_function should return an
48  # iterable. The easiest way is to simply implement the draw_function as  # iterable. The easiest way is to simply implement the draw_function as
# Line 64  def add_renderer_extension(layer_class, Line 64  def add_renderer_extension(layer_class,
64      function should return an iterable. The easiest way is to simply      function should return an iterable. The easiest way is to simply
65      implement the draw_function as a generator and to yield True in      implement the draw_function as a generator and to yield True in
66      suitable places, or to return the empty tuple if it's not possible      suitable places, or to return the empty tuple if it's not possible
67      to do the rendering in incrementally.      to do the rendering incrementally.
68      """      """
69      _renderer_extensions.append((layer_class, function))      _renderer_extensions.append((layer_class, function))
70    
# Line 434  class BaseRenderer: Line 434  class BaseRenderer:
434          if not points:          if not points:
435              return              return
436    
437          radius = self.resolution * 5          radius = int(round(self.resolution * 5))
438          self.dc.SetBrush(brush)          self.dc.SetBrush(brush)
439          self.dc.SetPen(pen)          self.dc.SetPen(pen)
440          for part in points:          for part in points:
# Line 531  class BaseRenderer: Line 531  class BaseRenderer:
531              text = label.text              text = label.text
532              if forward:              if forward:
533                  x, y = forward(x, y)                  x, y = forward(x, y)
534              x = x * scale + offx              x = int(round(x * scale + offx))
535              y = -y * scale + offy              y = int(round(-y * scale + offy))
536              width, height = self.dc.GetTextExtent(text)              width, height = self.dc.GetTextExtent(text)
537              if label.halign == ALIGN_LEFT:              if label.halign == ALIGN_LEFT:
538                  # nothing to be done                  # nothing to be done

Legend:
Removed from v.1926  
changed lines
  Added in v.2224

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26