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

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

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

revision 542 by jonathan, Thu Mar 20 09:43:16 2003 UTC revision 864 by frank, Thu May 8 12:29:23 2003 UTC
# Line 9  __version__ = "$Revision$" Line 9  __version__ = "$Revision$"
9    
10  from Thuban import _  from Thuban import _
11    
12    import resource
13    
14  from wxPython.wx import *  from wxPython.wx import *
 from dialogs import NonModalDialog  
15    
16  from Thuban.Model.layer import Layer  from Thuban.Model.layer import Layer
17  from Thuban.Model.map import Map  from Thuban.Model.map import Map
   
18  from Thuban.Model.messages import *  from Thuban.Model.messages import *
   
19  from Thuban.Model.classification import ClassGroup  from Thuban.Model.classification import ClassGroup
20    
21    from Thuban.UI.messages import *
22  from Thuban.UI.classifier import ClassDataPreviewer  from Thuban.UI.classifier import ClassDataPreviewer
23    from Thuban.UI.dock import DockPanel
24    from Thuban.UI.scalebar import ScaleBar
25    
26  ID_LEGEND_MOVEUP = 4001  from Thuban.Lib.connector import ConnectorError
27  ID_LEGEND_MOVEDOWN = 4002  
28    ID_LEGEND_RAISE = 4001
29    ID_LEGEND_LOWER = 4002
30  ID_LEGEND_TREE = 4003  ID_LEGEND_TREE = 4003
31  ID_LEGEND_CLASSIFY = 4004  ID_LEGEND_PROPS = 4004
32  ID_LEGEND_SHOWLAYER = 4005  ID_LEGEND_SHOWLAYER = 4005
33  ID_LEGEND_HIDELAYER = 4006  ID_LEGEND_HIDELAYER = 4006
34    
35  BMP_SIZE_W = 30  BMP_SIZE_W = 30
36  BMP_SIZE_H = 15  BMP_SIZE_H = 15
37    
38  class Legend(NonModalDialog):  RAISE_BMP = "raise_layer"
39    LOWER_BMP = "lower_layer"
40    SHOW_BMP  = "show_layer"
41    HIDE_BMP  = "hide_layer"
42    PROPS_BMP = "layer_properties"
43    
     def __init__(self, parent, name, map):  
         NonModalDialog.__init__(self, parent, name,  
                                 _("Legend: %s") % map.Title())  
44    
45          self.parent = parent  class LegendPanel(DockPanel):
46    
47        def __init__(self, parent, map, mainWindow):
48            DockPanel.__init__(self, parent, -1)
49    
50          panel = wxPanel(self, -1)          self.mainWindow = mainWindow
51            self.parent = parent
52    
53            self.buttons = []
54    
         topBox = wxBoxSizer(wxVERTICAL)  
55          panelBox = wxBoxSizer(wxVERTICAL)          panelBox = wxBoxSizer(wxVERTICAL)
56    
57          buttonBox = wxGridSizer(2, 3, 0, 0)          self.toolBar = wxToolBar(self, -1)
58            self.toolBar.SetToolBitmapSize(wxSize(24, 24))
59    
60          self.buttons = []          bmp = resource.GetBitmapResource(RAISE_BMP, wxBITMAP_TYPE_XPM)
61            self.toolBar.AddTool(ID_LEGEND_RAISE, bmp,
62                shortHelpString=_("Raise Layer"))
63    
64            bmp = resource.GetBitmapResource(LOWER_BMP, wxBITMAP_TYPE_XPM)
65            self.toolBar.AddTool(ID_LEGEND_LOWER, bmp,
66                shortHelpString=_("Lower Layer"))
67    
68          button = wxButton(self, ID_LEGEND_MOVEUP, _("Move Up"))          bmp = resource.GetBitmapResource(SHOW_BMP, wxBITMAP_TYPE_XPM)
69          buttonBox.Add(button, 0, wxGROW | wxLEFT | wxRIGHT, 0)          self.toolBar.AddTool(ID_LEGEND_SHOWLAYER, bmp,
70          self.buttons.append(button)              shortHelpString=_("Show Layer"))
71    
72          button = wxButton(self, ID_LEGEND_SHOWLAYER, _("Show Layer"))          bmp = resource.GetBitmapResource(HIDE_BMP, wxBITMAP_TYPE_XPM)
73          buttonBox.Add(button, 0, wxGROW | wxLEFT | wxRIGHT, 0)          self.toolBar.AddTool(ID_LEGEND_HIDELAYER, bmp,
74          self.buttons.append(button)              shortHelpString=_("Hide Layer"))
75    
76          button = wxButton(self, ID_LEGEND_CLASSIFY, _("Classify"))          bmp = resource.GetBitmapResource(PROPS_BMP, wxBITMAP_TYPE_XPM)
77          buttonBox.Add(button, 0, wxGROW | wxLEFT | wxRIGHT, 0)          self.toolBar.AddTool(ID_LEGEND_PROPS, bmp,
78          self.buttons.append(button)              shortHelpString=_("Edit Layer Properties"))
79    
80          button = wxButton(self, ID_LEGEND_MOVEDOWN, _("Move Down"))          self.toolBar.Realize()
81          buttonBox.Add(button, 0, wxGROW | wxLEFT | wxRIGHT, 0)          panelBox.Add(self.toolBar, 0, wxGROW, 0)
         self.buttons.append(button)  
82    
83          button = wxButton(self, ID_LEGEND_HIDELAYER, _("Hide Layer"))          EVT_TOOL(self, ID_LEGEND_RAISE, self._OnMoveUp)
84          buttonBox.Add(button, 0, wxGROW | wxLEFT | wxRIGHT, 0)          EVT_TOOL(self, ID_LEGEND_LOWER, self._OnMoveDown)
85          self.buttons.append(button)          EVT_TOOL(self, ID_LEGEND_PROPS, self._OnProperties)
86            EVT_TOOL(self, ID_LEGEND_SHOWLAYER, self._OnShowLayer)
87            EVT_TOOL(self, ID_LEGEND_HIDELAYER, self._OnHideLayer)
88    
89            self.tree = LegendTree(self, ID_LEGEND_TREE, map, mainWindow)
90    
91          EVT_BUTTON(self, ID_LEGEND_MOVEUP, self._OnMoveUp)          panelBox.Add(self.tree, 1, wxGROW, 0)
         EVT_BUTTON(self, ID_LEGEND_MOVEDOWN, self._OnMoveDown)  
         EVT_BUTTON(self, ID_LEGEND_CLASSIFY, self._OnClassify)  
         EVT_BUTTON(self, ID_LEGEND_SHOWLAYER, self._OnShowLayer)  
         EVT_BUTTON(self, ID_LEGEND_HIDELAYER, self._OnHideLayer)  
92    
93          panelBox.Add(buttonBox, 0, 0, 4)          self.scalebarbitmap = ScaleBarBitmap(self, map, mainWindow)
94            panelBox.Add(self.scalebarbitmap, 0, wxGROW, 0)
95    
96          self.tree = LegendTree(self, ID_LEGEND_TREE, map)          self.SetAutoLayout(True)
97            self.SetSizer(panelBox)
98            panelBox.SetSizeHints(self)
99    
         panelBox.Add(self.tree, 1, wxGROW, 4)  
100    
101          panel.SetAutoLayout(True)          self.panelBox = panelBox
         panel.SetSizer(panelBox)  
         panelBox.SetSizeHints(panel)  
102    
103          topBox.Add(panel, 1, wxGROW, 0)          self.__EnableButtons(False)
         panelBox.SetSizeHints(self)  
104    
105          self.SetAutoLayout(True)          self.Create()
106          self.SetSizer(topBox)  
107            EVT_CLOSE(self, self._OnClose)
108    
109    
110        def GetMap(self):
111            return self.tree.GetMap()
112    
113        def SetMap(self, map):
114            self.tree.SetMap(map)
115            self.scalebarbitmap.SetCanvas(self.mainWindow.canvas)
116    
117        def DoOnSelChanged(self, layer, group):
118    
119            ok = isinstance(layer, Layer)
120            self.__EnableButtons(ok)
121    
122            self.mainWindow.SelectLayer(layer)
123    
124      def DoOnSelChanged(self):      def DoOnProperties(self):
125          self.__EnableButtons(self.tree.GetSelection().IsOk())          list = self.tree.GetSelectedHierarchy()
126    
127      def _OnClassify(self, event):          ok = isinstance(list[0], Layer)
128          self.tree.DoOnClassify()          if ok:
129                self.mainWindow.OpenLayerProperties(list[0], list[1])
130    
131        def Destroy(self):
132            self.__Close()
133    
134        def _OnProperties(self, event):
135            self.DoOnProperties()
136    
137      def _OnMoveUp(self, event):      def _OnMoveUp(self, event):
138          self.tree.MoveCurrentItemUp()          self.tree.MoveCurrentItemUp()
# Line 109  class Legend(NonModalDialog): Line 144  class Legend(NonModalDialog):
144          self.tree.DoOnShowLayer()          self.tree.DoOnShowLayer()
145          pass          pass
146    
147        #def Close(self, force = False):
148            #DockPanel.Close(self, force)
149            
150        def _OnClose(self, event):
151            self.__Close()
152    
153      def _OnHideLayer(self, event):      def _OnHideLayer(self, event):
154          self.tree.DoOnHideLayer()          self.tree.DoOnHideLayer()
155          pass          pass
156    
   
157      def __EnableButtons(self, on):      def __EnableButtons(self, on):
158          for b in self.buttons:          self.toolBar.EnableTool(ID_LEGEND_RAISE, on)
159              b.Enable(on)          self.toolBar.EnableTool(ID_LEGEND_LOWER, on)
160            self.toolBar.EnableTool(ID_LEGEND_SHOWLAYER,  on)
161            self.toolBar.EnableTool(ID_LEGEND_HIDELAYER,  on)
162            self.toolBar.EnableTool(ID_LEGEND_PROPS, on)
163    
164        def __Close(self):
165            self.tree.Close()
166    
167  class LegendTree(wxTreeCtrl):  class LegendTree(wxTreeCtrl):
168    
169      def __init__(self, parent, id, map):      def __init__(self, parent, id, map, mainWindow):
170          wxTreeCtrl.__init__(self, parent, id,          wxTreeCtrl.__init__(self, parent, id,
171                              style = wxTR_DEFAULT_STYLE | wxTR_HIDE_ROOT,                              style = wxTR_DEFAULT_STYLE | wxTR_HIDE_ROOT,
172                              size = (200, 200))                              size = (200, 200))
173    
174            self.mainWindow = mainWindow
175            self.map = None
176          self.parent = parent          self.parent = parent
177          self.map = map          self.layer2id = {}
         self.layer2id = None  
   
178    
179          self.image_list = None          self.image_list = None
180          self.emptyImageIndex = 0          self.emptyImageIndex = 0
181    
182          self.previewer = ClassDataPreviewer()          self.previewer = ClassDataPreviewer()
183    
   
184          EVT_TREE_ITEM_ACTIVATED(self, ID_LEGEND_TREE, self._OnItemActivated)          EVT_TREE_ITEM_ACTIVATED(self, ID_LEGEND_TREE, self._OnItemActivated)
185          EVT_TREE_SEL_CHANGED(self, ID_LEGEND_TREE, self._OnSelChanged)          EVT_TREE_SEL_CHANGED(self, ID_LEGEND_TREE, self._OnSelChanged)
186    
187          map.Subscribe(MAP_STACKING_CHANGED, self._OnMsgMapStackingChanged)          EVT_CLOSE(self, self._OnClose)
         map.Subscribe(MAP_LAYERS_CHANGED, self._OnMsgMapLayersChanged)  
188    
189          self.__FillTree(map)          self.SetMap(map)
190    
191      def MoveCurrentItemUp(self):      def _OnClose(self, event):
192          cur_id = self.GetSelection()          self.SetMap(None)
         assert(cur_id.IsOk())  
193    
194          cur_data = self.GetPyData(cur_id)      def GetMap(self):
195            return self.map
196    
197        def SetMap(self, map):
198    
199            sub_list = [(MAP_STACKING_CHANGED, self._OnMsgMapStackingChanged),
200                        (MAP_LAYERS_ADDED, self._OnMsgMapLayersAddedRemoved),
201                        (MAP_LAYERS_REMOVED, self._OnMsgMapLayersAddedRemoved)]
202    
203            if self.map is not None:
204                for msg, func in sub_list: self.map.Unsubscribe(msg, func)
205                #self.mainWindow.application.Unsubscribe(SESSION_REPLACED,
206                    #self._OnMsgMapsChanged)
207                #try:
208                    #self.mainWindow.application.session.Unsubscribe(MAPS_CHANGED,
209                        #self._OnMsgMapsChanged)
210                #except ConnectorError:
211                    #pass
212                self.__DeleteAllItems()
213            
214            self.map = map
215    
216          #prev_id = self.GetPrevSibling(cur_id)          if self.map is not None:
217                for msg, func in sub_list: self.map.Subscribe(msg, func)
218                #self.mainWindow.application.session.Subscribe(MAPS_CHANGED,
219                    #self._OnMsgMapsChanged)
220                #self.mainWindow.application.Subscribe(SESSION_REPLACED,
221                    #self._OnMsgMapsChanged)
222                self.__FillTree(self.map)
223    
224          #      def MoveCurrentItemUp(self):
225          # Get out if there's nowhere to go          layer, group = self.GetSelectedHierarchy()
         #  
         #if prev_id == INVALID_TREE_ID: return  
226    
227          if isinstance(cur_data, Layer):          if layer is not None:
228              self.map.RaiseLayer(cur_data)              self.map.RaiseLayer(layer)
         elif isinstance(cur_data, ClassGroup):  
             pass  
229          else:          else:
230              assert(False, "Shouldn't be here.")              assert False, "Shouldn't be allowed."
231              pass              pass
232    
233      def MoveCurrentItemDown(self):      def MoveCurrentItemDown(self):
234          cur_id = self.GetSelection()          layer, group = self.GetSelectedHierarchy()
         assert(cur_id.IsOk())  
235    
236          cur_data = self.GetPyData(cur_id)          if layer is not None:
237                self.map.LowerLayer(layer)
         if isinstance(cur_data, Layer):  
             self.map.LowerLayer(cur_data)  
         elif isinstance(cur_data, ClassGroup):  
             pass  
238          else:          else:
239              assert(False, "Shouldn't be here.")              assert False, "Shouldn't be allowed."
240              pass              pass
241    
   
242      def OnCompareItems(self, item1, item2):      def OnCompareItems(self, item1, item2):
243    
244          data1 = self.GetPyData(item1)          data1 = self.GetPyData(item1)
# Line 193  class LegendTree(wxTreeCtrl): Line 252  class LegendTree(wxTreeCtrl):
252    
253    
254      def DoOnShowLayer(self):      def DoOnShowLayer(self):
255          self.__ShowHideLayer(True)          #self.__ShowHideLayer(True)
256            layer, group = self.GetSelectedHierarchy()
257            layer.SetVisible(True)
258    
259      def DoOnHideLayer(self):      def DoOnHideLayer(self):
260          self.__ShowHideLayer(False)          #self.__ShowHideLayer(False)
261            layer, group = self.GetSelectedHierarchy()
262            layer.SetVisible(False)
263    
264      def DoOnClassify(self):      def Sort(self):
265          id = self.GetSelection()          self.SortChildren(self.GetRootItem())
         assert(id.IsOk())  
266    
267          item = self.GetPyData(id)      def GetSelectedHierarchy(self):
268          if isinstance(item, ClassGroup):          id = self.GetSelection()
             id = self.GetItemParent(id)  
             assert(id.IsOk())  
             item = self.GetPyData(id)  
269    
270          self.parent.parent.OpenClassifier(item)          if not id.IsOk():
271                return (None, None)
272    
273      def Sort(self):          layer = self.GetPyData(id)
274          self.SortChildren(self.GetRootItem())          group = None
275    
276            if isinstance(layer, ClassGroup):
277                id = self.GetItemParent(id)
278                assert id.IsOk()
279                group = layer
280                layer = self.GetPyData(id)
281    
282            return (layer, group)
283    
284        def _OnMsgMapsChanged(self):
285            #print self.map is self.mainWindow.Map()
286            self.SetMap(self.mainWindow.Map())
287            
288      def _OnSelChanged(self, event):      def _OnSelChanged(self, event):
289          self.parent.DoOnSelChanged()          self.__UpdateSelection()
290    
291      def _OnItemActivated(self, event):      def _OnItemActivated(self, event):
292          self.DoOnClassify()          self.parent.DoOnProperties()
293    
294      def _OnMsgLayerChanged(self, layer):      def _OnMsgLayerChanged(self, layer):
295          assert(isinstance(layer, Layer))          assert isinstance(layer, Layer)
296    
297          id = self.layer2id[layer]          id = self.layer2id[layer]
298            assert id.IsOk()
299    
300          self.__FillTreeLayer(id)          # XXX: yikes! this is so bad, we should be doing what is
301            #      commented out, but there is a problem with keeping
302            #      track of the images in the image list when we replace
303            #      a layer. it ends up causing a seg fault.
304            self.__FillTree(self.map)
305            self.__UpdateSelection()
306            #self.__FillTreeLayer(id)
307    
308      def _OnMsgMapStackingChanged(self, *args):      def _OnMsgMapStackingChanged(self, *args):
309          self.Sort()          self.Sort()
310            id = self.GetSelection()
311    
312            if id.IsOk():
313                self.EnsureVisible(id)
314            self.__UpdateSelection()
315    
316      def _OnMsgMapLayersChanged(self, map):      def _OnMsgMapLayersAddedRemoved(self, map):
317          assert(id(map) == id(self.map))          assert map is self.map
318    
319          self.__FillTree(self.map)          self.__FillTree(self.map)
320            self.__UpdateSelection()
321    
322      def __FillTree(self, map):      def _OnMsgLayerVisibilityChanged(self, layer):
323            assert isinstance(layer, Layer)
324    
325            self.__ShowHideLayer(layer)
326            self.__UpdateSelection()
327    
328        def _OnMsgLayerTitleChanged(self, layer):
329    
330          assert(isinstance(map, Map))          id = self.layer2id[layer]
331            if id.IsOk():
332                self.SetItemText(id, layer.Title())
333            self.__UpdateSelection()
334    
335        def __UpdateSelection(self):
336            layer, group = self.GetSelectedHierarchy()
337            self.parent.DoOnSelChanged(layer, group)
338            
339        def __FillTree(self, map):
340    
341          self.Freeze()          self.Freeze()
342    
# Line 263  class LegendTree(wxTreeCtrl): Line 363  class LegendTree(wxTreeCtrl):
363              for l in map.Layers():              for l in map.Layers():
364                  id = self.PrependItem(root, l.Title())                  id = self.PrependItem(root, l.Title())
365                  l.Subscribe(LAYER_CHANGED, self._OnMsgLayerChanged)                  l.Subscribe(LAYER_CHANGED, self._OnMsgLayerChanged)
366                    l.Subscribe(LAYER_VISIBILITY_CHANGED,
367                                self._OnMsgLayerVisibilityChanged)
368                    l.Subscribe(TITLE_CHANGED, self._OnMsgLayerTitleChanged)
369                  self.SetPyData(id, l)                  self.SetPyData(id, l)
370                  font = self.GetItemFont(id)                  self.__SetVisibilityStyle(l.Visible(), id)
                 if not l.Visible():  
                     font.SetStyle(wxITALIC)  
                     self.SetItemFont(id, font)  
371    
372                  self.layer2id[l] = id                  self.layer2id[l] = id
373    
# Line 287  class LegendTree(wxTreeCtrl): Line 387  class LegendTree(wxTreeCtrl):
387    
388          shapeType = layer.ShapeType()          shapeType = layer.ShapeType()
389    
390            show = layer.Visible()
391          for g in clazz:          for g in clazz:
392              id = self.AppendItem(pid, g.GetDisplayText())              if g.IsVisible():
393              self.SetPyData(id, g)                  id = self.AppendItem(pid, g.GetDisplayText())
394                    self.SetPyData(id, g)
395              bmp = self.__BuildGroupImage(g, shapeType)                  self.__SetVisibilityStyle(show, id)
396    
397              if bmp is None:                  bmp = self.__BuildGroupImage(g, shapeType)
398                  self.SetItemImage(id, self.emptyImageIndex)  
399              else:                  if bmp is None:
400                  i = self.image_list.Add(bmp)                      self.SetItemImage(id, self.emptyImageIndex)
401                  self.SetItemImage(id, i)                  else:
402                        i = self.image_list.Add(bmp)
403              #self.layer2id[g] = id                      self.SetItemImage(id, i)
404    
405          self.Thaw()          self.Thaw()
406    
407      def __BuildGroupImage(self, group, shapeType):      def __BuildGroupImage(self, group, shapeType):
         assert(isinstance(group, ClassGroup))  
408    
409          bmp = wxEmptyBitmap(BMP_SIZE_W, BMP_SIZE_H)          bmp = wxEmptyBitmap(BMP_SIZE_W, BMP_SIZE_H)
410          #brush = wxBrush(Color2wxColour(item[1]), wxSOLID)          #brush = wxBrush(Color2wxColour(item[1]), wxSOLID)
# Line 317  class LegendTree(wxTreeCtrl): Line 417  class LegendTree(wxTreeCtrl):
417          return bmp          return bmp
418    
419      def __DeleteAllItems(self):      def __DeleteAllItems(self):
420    
421            while len(self.layer2id) > 0:
422                layer, id = self.layer2id.popitem()
423                layer.Unsubscribe(LAYER_CHANGED,
424                                  self._OnMsgLayerChanged)
425                layer.Unsubscribe(LAYER_VISIBILITY_CHANGED,
426                                  self._OnMsgLayerVisibilityChanged)
427                layer.Unsubscribe(TITLE_CHANGED, self._OnMsgLayerTitleChanged)
428    
429          self.DeleteAllItems()          self.DeleteAllItems()
         self.layer2id = {}  
430    
431        def __SetVisibilityStyle(self, visible, id):
432            font = self.GetItemFont(id)
433    
434      def __ShowHideLayer(self, show):          if visible:
435          id = self.GetSelection()              font.SetStyle(wxNORMAL)
436          assert(id.IsOk())              color = wxBLACK
437            else:
438                font.SetStyle(wxITALIC)
439                color = wxLIGHT_GREY
440    
441            self.SetItemTextColour(id, color)
442            self.SetItemFont(id, font)
443                    
444          item = self.GetPyData(id)      def __ShowHideLayer(self, layer):
445          if isinstance(item, ClassGroup):          parent = self.layer2id[layer]
446              id = self.GetItemParent(id)          assert parent.IsOk()
447              assert(id.IsOk())  
448              item = self.GetPyData(id)          visible = layer.Visible()
449    
450            self.__SetVisibilityStyle(visible, parent)
451    
452          if show != item.Visible():          id, cookie = self.GetFirstChild(parent, 123)
453    
454              item.SetVisible(show)          while id.IsOk():
455                self.__SetVisibilityStyle(visible, id)
456                id, cookie = self.GetNextChild(parent, cookie)
457                
458    class ScaleBarBitmap(wxBoxSizer):
459    
460              font = self.GetItemFont(id)      def __init__(self, parent, map, mainWindow):
461              if show:          # While the width is fixed, get the height _now_.
462                  font.SetStyle(wxNORMAL)          dc = wxMemoryDC()
463                  self.SetItemFont(id, font)          textwidth, textheight = dc.GetTextExtent("%d"%0)
464              else:          self.width = 200
465                  font.SetStyle(wxITALIC)          self.height = textheight + 3*2 + 8
466                  self.SetItemFont(id, font)  
467            wxBoxSizer.__init__(self, wxVERTICAL)
468            bmp=wxEmptyBitmap(self.width, self.height)
469            self.scalebarBitmap = wxStaticBitmap(parent, -1, bmp)
470            self.Add(self.scalebarBitmap, 0, wxALIGN_CENTER|wxLEFT|wxTOP|wxRIGHT, 1)
471    
472            self.mainWindow = mainWindow
473            self.parent = parent
474            self.canvas = None
475            self.SetCanvas(self.mainWindow.canvas)
476    
477        def SetCanvas(self, canvas):
478            sub_list = [(SCALE_CHANGED, self._OnMsgScaleChanged)]
479    
480            if self.canvas is not None:
481                for msg, func in sub_list: self.canvas.Unsubscribe(msg, func)
482            
483            self.canvas = canvas
484            self.scalebar = ScaleBar(canvas.map)
485    
486            if self.canvas is not None:
487                for msg, func in sub_list: self.canvas.Subscribe(msg, func)
488                self.__SetScale(self.canvas.scale)
489    
490        def _OnMsgScaleChanged(self, scale):
491            self.__SetScale(scale)
492    
493        def __SetScale(self, scale):
494            bmp = wxEmptyBitmap(self.width, self.height)
495            dc = wxMemoryDC()
496            dc.SelectObject(bmp)
497            dc.Clear()
498    
499            self.scalebar.DrawScalebar(scale, dc)
500    
501            self.scalebarBitmap.SetBitmap(bmp)
502    

Legend:
Removed from v.542  
changed lines
  Added in v.864

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26