/[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 1240 by frank, Thu Jun 19 09:25:31 2003 UTC revision 1253 by jonathan, Fri Jun 20 09:28:43 2003 UTC
# Line 9  __version__ = "$Revision$" Line 9  __version__ = "$Revision$"
9    
10  from Thuban import _  from Thuban import _
11  from Thuban.Model.scalebar import deriveInterval, roundInterval  from Thuban.Model.scalebar import deriveInterval, roundInterval
12    from Thuban.Model.proj import PROJ_UNITS_METERS
13    
14  from wxPython.wx import *  from wxPython.wx import *
15    
# Line 21  class ScaleBar: Line 22  class ScaleBar:
22          """Draw a scalebar on a given DC"""          """Draw a scalebar on a given DC"""
23    
24          # Only draw a legend if the corresponding map has a layer          # Only draw a legend if the corresponding map has a layer
25          if self.map is not None and len(self.map.layers) > 0 and scale > 0.0:          if self.map is not None \
26                and self.map.projection is not None \
27              # If no projection is specified, the scale information _might_              and len(self.map.layers) > 0 \
28              # be reasonable. So gray out the scalebar in these cases.              and scale > 0.0:
29              if self.map.projection is None:  
30                  BlackPen = wxGREY_PEN              # We have a projection, draw the scalebar in bw
31                  BlackBrush = wxGREY_BRUSH              BlackPen = wxBLACK_PEN
32                  BlackText = wxColor(127,127,127)              BlackBrush = wxBLACK_BRUSH
33              else:              BlackText = wxBLACK
                 params = {}  
                 # For geographic projection we have to convert the scale from  
                 # Unit DD to meters.  
                 for p in self.map.projection.params:  
                     key, value = p.split('=')  
                     params[key] = value  
                 if params['proj'] == 'latlong':  
                     scale = scale * 0.017453 / 1000.0  
                 # We have a projection, draw the scalebar in bw  
                 BlackPen = wxBLACK_PEN  
                 BlackBrush = wxBLACK_BRUSH  
                 BlackText = wxBLACK  
34                                    
35              # Get the dimension              # Get the dimension
36              width, height = size              width, height = size

Legend:
Removed from v.1240  
changed lines
  Added in v.1253

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26