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

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

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

revision 911 by frank, Fri May 9 08:33:29 2003 UTC revision 912 by frank, Fri May 16 16:24:44 2003 UTC
# Line 17  class ScaleBar: Line 17  class ScaleBar:
17      def __init__(self, map):      def __init__(self, map):
18          self.map = map          self.map = map
19    
20      def DrawScalebar(self, scale, dc):      def DrawScaleBar(self, scale, dc, position, size):
21          """Draw a scalebar on a given DC"""          """Draw a scalebar on a given DC"""
22    
23          # Only draw a legend if the corresponding map has a layer          # Only draw a legend if the corresponding map has a layer
# Line 35  class ScaleBar: Line 35  class ScaleBar:
35                  BlackText = wxBLACK                  BlackText = wxBLACK
36                                    
37              # Get the dimension              # Get the dimension
38              width, height = dc.GetSizeTuple()              width, height = size
39                posx, posy    = position
40              l1width, l1height = dc.GetTextExtent("%d"%0)              l1width, l1height = dc.GetTextExtent("%d"%0)
41    
42              # Make a first guess for the interval (to get the size we have              # Make a first guess for the interval (to get the size we have
# Line 59  class ScaleBar: Line 60  class ScaleBar:
60    
61                  brush = wxBrush(wxWHITE, wxSOLID)                  brush = wxBrush(wxWHITE, wxSOLID)
62                  dc.SetBrush(brush)                  dc.SetBrush(brush)
63                  dc.DrawRectangle(4,2,width,8)                  dc.DrawRectangle(posx+4,posy+2,width,8)
64    
65                  dc.SetBrush(BlackBrush)                  dc.SetBrush(BlackBrush)
66                  dc.DrawRectangle(width+4,2,width,8)                  dc.DrawRectangle(posx+width+4,posy+2,width,8)
67    
68                  dc.SetTextForeground(BlackText)                  dc.SetTextForeground(BlackText)
69                  dc.DrawText("%d"%0, 4 - l1width/2, 12)                  dc.DrawText("%d"%0, posx+ 4 - l1width/2, posy+12)
70    
71                  l2width, l2height = dc.GetTextExtent("%s %s"%(label, unit))                  l2width, l2height = dc.GetTextExtent("%s %s"%(label, unit))
72                  dc.DrawText("%s %s"%(interval, unit), 2*width+4 - l2width/2, 12)                  dc.DrawText("%s %s"%(interval, unit), posx+ 2*width+4 - l2width/2, posy + 12)
73    

Legend:
Removed from v.911  
changed lines
  Added in v.912

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26