mapdisp.py 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689
  1. """!
  2. @package gui_core.mapdisp
  3. @brief Base classes for Map display window
  4. Classes:
  5. - mapdisp::MapFrameBase
  6. - mapdisp::SingleMapFrame
  7. - mapdisp::DoubleMapFrame
  8. (C) 2009-2012 by the GRASS Development Team
  9. This program is free software under the GNU General Public License
  10. (>=v2). Read the file COPYING that comes with GRASS for details.
  11. @author Martin Landa <landa.martin gmail.com>
  12. @author Michael Barton <michael.barton@asu.edu>
  13. @author Vaclav Petras <wenzeslaus gmail.com>
  14. @author Anna Kratochvilova <kratochanna gmail.com>
  15. """
  16. import os
  17. import sys
  18. import wx
  19. import wx.aui
  20. from core import globalvar
  21. from core.debug import Debug
  22. from core.utils import _
  23. from grass.script import core as grass
  24. class MapFrameBase(wx.Frame):
  25. """!Base class for map display window
  26. Derived class must use (create and initialize) \c statusbarManager
  27. or override
  28. GetProperty(), SetProperty() and HasProperty() methods.
  29. Several methods has to be overriden or
  30. \c NotImplementedError("MethodName") will be raised.
  31. If derived class enables and disables auto-rendering,
  32. it should override IsAutoRendered method.
  33. It is expected that derived class will call _setUpMapWindow().
  34. Derived class can has one or more map windows (and map renderes)
  35. but implementation of MapFrameBase expects that one window and
  36. one map will be current.
  37. Current instances of map window and map renderer should be returned
  38. by methods GetWindow() and GetMap() respectively.
  39. AUI manager is stored in \c self._mgr.
  40. """
  41. def __init__(self, parent = None, id = wx.ID_ANY, title = None,
  42. style = wx.DEFAULT_FRAME_STYLE,
  43. auimgr = None, name = None, **kwargs):
  44. """!
  45. @warning Use \a auimgr parameter only if you know what you are doing.
  46. @param parent gui parent
  47. @param id wx id
  48. @param title window title
  49. @param style \c wx.Frame style
  50. @param toolbars array of activated toolbars, e.g. ['map', 'digit']
  51. @param auimgr AUI manager (if \c None, wx.aui.AuiManager is used)
  52. @param name frame name
  53. @param kwargs arguments passed to \c wx.Frame
  54. """
  55. self.parent = parent
  56. wx.Frame.__init__(self, parent, id, title, style = style, name = name, **kwargs)
  57. #
  58. # set the size & system icon
  59. #
  60. self.SetClientSize(self.GetSize())
  61. self.iconsize = (16, 16)
  62. self.SetIcon(wx.Icon(os.path.join(globalvar.ETCICONDIR, 'grass_map.ico'), wx.BITMAP_TYPE_ICO))
  63. # toolbars
  64. self.toolbars = {}
  65. #
  66. # Fancy gui
  67. #
  68. if auimgr == None:
  69. self._mgr = wx.aui.AuiManager(self)
  70. else:
  71. self._mgr = auimgr
  72. def _initMap(self, Map):
  73. """!Initialize map display, set dimensions and map region
  74. """
  75. if not grass.find_program('g.region', '--help'):
  76. sys.exit(_("GRASS module '%s' not found. Unable to start map "
  77. "display window.") % 'g.region')
  78. Debug.msg(2, "MapFrame._initMap():")
  79. Map.ChangeMapSize(self.GetClientSize())
  80. Map.region = Map.GetRegion() # g.region -upgc
  81. # self.Map.SetRegion() # adjust region to match display window
  82. def OnSize(self, event):
  83. """!Adjust statusbar on changing size"""
  84. # reposition checkbox in statusbar
  85. self.StatusbarReposition()
  86. # update statusbar
  87. self.StatusbarUpdate()
  88. def SetProperty(self, name, value):
  89. """!Sets property"""
  90. self.statusbarManager.SetProperty(name, value)
  91. def GetProperty(self, name):
  92. """!Returns property"""
  93. return self.statusbarManager.GetProperty(name)
  94. def HasProperty(self, name):
  95. """!Checks whether object has property"""
  96. return self.statusbarManager.HasProperty(name)
  97. def GetPPM(self):
  98. """! Get pixel per meter
  99. @todo now computed every time, is it necessary?
  100. @todo enable user to specify ppm (and store it in UserSettings)
  101. """
  102. # TODO: need to be fixed...
  103. ### screen X region problem
  104. ### user should specify ppm
  105. dc = wx.ScreenDC()
  106. dpSizePx = wx.DisplaySize() # display size in pixels
  107. dpSizeMM = wx.DisplaySizeMM() # display size in mm (system)
  108. dpSizeIn = (dpSizeMM[0] / 25.4, dpSizeMM[1] / 25.4) # inches
  109. sysPpi = dc.GetPPI()
  110. comPpi = (dpSizePx[0] / dpSizeIn[0],
  111. dpSizePx[1] / dpSizeIn[1])
  112. ppi = comPpi # pixel per inch
  113. ppm = ((ppi[0] / 2.54) * 100, # pixel per meter
  114. (ppi[1] / 2.54) * 100)
  115. Debug.msg(4, "MapFrameBase.GetPPM(): size: px=%d,%d mm=%f,%f "
  116. "in=%f,%f ppi: sys=%d,%d com=%d,%d; ppm=%f,%f" % \
  117. (dpSizePx[0], dpSizePx[1], dpSizeMM[0], dpSizeMM[1],
  118. dpSizeIn[0], dpSizeIn[1],
  119. sysPpi[0], sysPpi[1], comPpi[0], comPpi[1],
  120. ppm[0], ppm[1]))
  121. return ppm
  122. def SetMapScale(self, value, map = None):
  123. """! Set current map scale
  124. @param value scale value (n if scale is 1:n)
  125. @param map Map instance (if none self.Map is used)
  126. """
  127. if not map:
  128. map = self.Map
  129. region = self.Map.region
  130. dEW = value * (region['cols'] / self.GetPPM()[0])
  131. dNS = value * (region['rows'] / self.GetPPM()[1])
  132. region['n'] = region['center_northing'] + dNS / 2.
  133. region['s'] = region['center_northing'] - dNS / 2.
  134. region['w'] = region['center_easting'] - dEW / 2.
  135. region['e'] = region['center_easting'] + dEW / 2.
  136. # add to zoom history
  137. self.GetWindow().ZoomHistory(region['n'], region['s'],
  138. region['e'], region['w'])
  139. def GetMapScale(self, map = None):
  140. """! Get current map scale
  141. @param map Map instance (if none self.Map is used)
  142. """
  143. if not map:
  144. map = self.GetMap()
  145. region = map.region
  146. ppm = self.GetPPM()
  147. heightCm = region['rows'] / ppm[1] * 100
  148. widthCm = region['cols'] / ppm[0] * 100
  149. Debug.msg(4, "MapFrame.GetMapScale(): width_cm=%f, height_cm=%f" %
  150. (widthCm, heightCm))
  151. xscale = (region['e'] - region['w']) / (region['cols'] / ppm[0])
  152. yscale = (region['n'] - region['s']) / (region['rows'] / ppm[1])
  153. scale = (xscale + yscale) / 2.
  154. Debug.msg(3, "MapFrame.GetMapScale(): xscale=%f, yscale=%f -> scale=%f" % \
  155. (xscale, yscale, scale))
  156. return scale
  157. def GetProgressBar(self):
  158. """!Returns progress bar
  159. Progress bar can be used by other classes.
  160. """
  161. return self.statusbarManager.GetProgressBar()
  162. def GetMap(self):
  163. """!Returns current map (renderer) instance"""
  164. raise NotImplementedError("GetMap")
  165. def GetWindow(self):
  166. """!Returns current map window"""
  167. raise NotImplementedError("GetWindow")
  168. def GetWindows(self):
  169. """!Returns list of map windows"""
  170. raise NotImplementedError("GetWindows")
  171. def GetMapToolbar(self):
  172. """!Returns toolbar with zooming tools"""
  173. raise NotImplementedError("GetMapToolbar")
  174. def GetToolbar(self, name):
  175. """!Returns toolbar if exists else None.
  176. Toolbars dictionary contains currently used toolbars only.
  177. """
  178. if name in self.toolbars:
  179. return self.toolbars[name]
  180. return None
  181. def StatusbarUpdate(self):
  182. """!Update statusbar content"""
  183. Debug.msg(5, "MapFrameBase.StatusbarUpdate()")
  184. self.statusbarManager.Update()
  185. def IsAutoRendered(self):
  186. """!Check if auto-rendering is enabled"""
  187. # TODO: this is now not the right place to access this attribute
  188. # TODO: add mapWindowProperties to init parameters
  189. # and pass the right object in the init of derived class?
  190. # or do not use this method at all, let mapwindow decide
  191. return self.mapWindowProperties.autoRender
  192. def CoordinatesChanged(self):
  193. """!Shows current coordinates on statusbar.
  194. """
  195. # assuming that the first mode is coordinates
  196. # probably shold not be here but good solution is not available now
  197. if self.statusbarManager.GetMode() == 0:
  198. self.statusbarManager.ShowItem('coordinates')
  199. def StatusbarReposition(self):
  200. """!Reposition items in statusbar"""
  201. self.statusbarManager.Reposition()
  202. def StatusbarEnableLongHelp(self, enable = True):
  203. """!Enable/disable toolbars long help"""
  204. for toolbar in self.toolbars.itervalues():
  205. toolbar.EnableLongHelp(enable)
  206. def IsStandalone(self):
  207. """!Check if map frame is standalone"""
  208. raise NotImplementedError("IsStandalone")
  209. def OnRender(self, event):
  210. """!Re-render map composition (each map layer)
  211. """
  212. raise NotImplementedError("OnRender")
  213. def OnDraw(self, event):
  214. """!Re-display current map composition
  215. """
  216. self.MapWindow.UpdateMap(render = False)
  217. def OnErase(self, event):
  218. """!Erase the canvas
  219. """
  220. self.MapWindow.EraseMap()
  221. def OnZoomIn(self, event):
  222. """!Zoom in the map.
  223. Set mouse cursor, zoombox attributes, and zoom direction
  224. """
  225. toolbar = self.GetMapToolbar()
  226. self.SwitchTool(toolbar, event)
  227. win = self.GetWindow()
  228. self._prepareZoom(mapWindow = win, zoomType = 1)
  229. def OnZoomOut(self, event):
  230. """!Zoom out the map.
  231. Set mouse cursor, zoombox attributes, and zoom direction
  232. """
  233. toolbar = self.GetMapToolbar()
  234. self.SwitchTool(toolbar, event)
  235. win = self.GetWindow()
  236. self._prepareZoom(mapWindow = win, zoomType = -1)
  237. def _setUpMapWindow(self, mapWindow):
  238. """Binds map windows' zoom history signals to map toolbar."""
  239. # enable or disable zoom history tool
  240. mapWindow.zoomHistoryAvailable.connect(
  241. lambda:
  242. self.GetMapToolbar().Enable('zoomBack', enable=True))
  243. mapWindow.zoomHistoryUnavailable.connect(
  244. lambda:
  245. self.GetMapToolbar().Enable('zoomBack', enable=False))
  246. mapWindow.mouseMoving.connect(self.CoordinatesChanged)
  247. def _prepareZoom(self, mapWindow, zoomType):
  248. """!Prepares MapWindow for zoom, toggles toolbar
  249. @param mapWindow MapWindow to prepare
  250. @param zoomType 1 for zoom in, -1 for zoom out
  251. """
  252. mapWindow.mouse['use'] = "zoom"
  253. mapWindow.mouse['box'] = "box"
  254. mapWindow.zoomtype = zoomType
  255. mapWindow.pen = wx.Pen(colour = 'Red', width = 2, style = wx.SHORT_DASH)
  256. # change the cursor
  257. mapWindow.SetNamedCursor('cross')
  258. def SwitchTool(self, toolbar, event):
  259. """!Helper function to switch tools"""
  260. # unregistration of all registered mouse event handlers of
  261. # Mapwindow
  262. self.MapWindow.UnregisterAllHandlers()
  263. if toolbar:
  264. toolbar.OnTool(event)
  265. toolbar.action['desc'] = ''
  266. def OnPointer(self, event):
  267. """!Sets mouse mode to pointer."""
  268. self.MapWindow.mouse['use'] = 'pointer'
  269. def OnPan(self, event):
  270. """!Panning, set mouse to drag
  271. """
  272. toolbar = self.GetMapToolbar()
  273. self.SwitchTool(toolbar, event)
  274. win = self.GetWindow()
  275. self._preparePan(mapWindow = win)
  276. def _preparePan(self, mapWindow):
  277. """!Prepares MapWindow for pan, toggles toolbar
  278. @param mapWindow MapWindow to prepare
  279. """
  280. mapWindow.mouse['use'] = "pan"
  281. mapWindow.mouse['box'] = "pan"
  282. mapWindow.zoomtype = 0
  283. # change the cursor
  284. mapWindow.SetNamedCursor('hand')
  285. def OnZoomBack(self, event):
  286. """!Zoom last (previously stored position)
  287. """
  288. self.MapWindow.ZoomBack()
  289. def OnZoomToMap(self, event):
  290. """!
  291. Set display extents to match selected raster (including NULLs)
  292. or vector map.
  293. """
  294. self.MapWindow.ZoomToMap(layers = self.Map.GetListOfLayers())
  295. def OnZoomToWind(self, event):
  296. """!Set display geometry to match computational region
  297. settings (set with g.region)
  298. """
  299. self.MapWindow.ZoomToWind()
  300. def OnZoomToDefault(self, event):
  301. """!Set display geometry to match default region settings
  302. """
  303. self.MapWindow.ZoomToDefault()
  304. class SingleMapFrame(MapFrameBase):
  305. """! Frame with one map window.
  306. It is base class for frames which needs only one map.
  307. Derived class should have \c self.MapWindow or
  308. it has to override GetWindow() methods.
  309. @note To access maps use getters only
  310. (when using class or when writing class itself).
  311. """
  312. def __init__(self, parent = None, giface = None, id = wx.ID_ANY, title = None,
  313. style = wx.DEFAULT_FRAME_STYLE,
  314. Map = None,
  315. auimgr = None, name = None, **kwargs):
  316. """!
  317. @param parent gui parent
  318. @param id wx id
  319. @param title window title
  320. @param style \c wx.Frame style
  321. @param Map instance of render.Map
  322. @param name frame name
  323. @param kwargs arguments passed to MapFrameBase
  324. """
  325. MapFrameBase.__init__(self, parent = parent, id = id, title = title,
  326. style = style,
  327. auimgr = auimgr, name = name, **kwargs)
  328. self.Map = Map # instance of render.Map
  329. #
  330. # initialize region values
  331. #
  332. self._initMap(Map = self.Map)
  333. def GetMap(self):
  334. """!Returns map (renderer) instance"""
  335. return self.Map
  336. def GetWindow(self):
  337. """!Returns map window"""
  338. return self.MapWindow
  339. def GetWindows(self):
  340. """!Returns list of map windows"""
  341. return [self.MapWindow]
  342. def OnRender(self, event):
  343. """!Re-render map composition (each map layer)
  344. """
  345. self.GetWindow().UpdateMap(render = True, renderVector = True)
  346. # update statusbar
  347. self.StatusbarUpdate()
  348. class DoubleMapFrame(MapFrameBase):
  349. """! Frame with two map windows.
  350. It is base class for frames which needs two maps.
  351. There is no primary and secondary map. Both maps are equal.
  352. However, one map is current.
  353. It is expected that derived class will call _bindWindowsActivation()
  354. when both map windows will be initialized.
  355. Drived class should have method GetMapToolbar() returns toolbar
  356. which has methods SetActiveMap() and Enable().
  357. @note To access maps use getters only
  358. (when using class or when writing class itself).
  359. @todo Use it in GCP manager
  360. (probably changes to both DoubleMapFrame and GCP MapFrame will be neccessary).
  361. """
  362. def __init__(self, parent = None, id = wx.ID_ANY, title = None,
  363. style = wx.DEFAULT_FRAME_STYLE,
  364. firstMap = None, secondMap = None,
  365. auimgr = None, name = None, **kwargs):
  366. """!
  367. \a firstMap is set as active (by assign it to \c self.Map).
  368. Derived class should assging to \c self.MapWindow to make one
  369. map window current by dafault.
  370. @param parent gui parent
  371. @param id wx id
  372. @param title window title
  373. @param style \c wx.Frame style
  374. @param name frame name
  375. @param kwargs arguments passed to MapFrameBase
  376. """
  377. MapFrameBase.__init__(self, parent = parent, id = id, title = title,
  378. style = style,
  379. auimgr = auimgr, name = name, **kwargs)
  380. self.firstMap = firstMap
  381. self.secondMap = secondMap
  382. self.Map = firstMap
  383. #
  384. # initialize region values
  385. #
  386. self._initMap(Map = self.firstMap)
  387. self._initMap(Map = self.secondMap)
  388. self._bindRegions = False
  389. def _bindWindowsActivation(self):
  390. self.GetFirstWindow().Bind(wx.EVT_ENTER_WINDOW, self.ActivateFirstMap)
  391. self.GetSecondWindow().Bind(wx.EVT_ENTER_WINDOW, self.ActivateSecondMap)
  392. def GetFirstMap(self):
  393. """!Returns first Map instance
  394. """
  395. return self.firstMap
  396. def GetSecondMap(self):
  397. """!Returns second Map instance
  398. """
  399. return self.secondMap
  400. def GetFirstWindow(self):
  401. """!Get first map window"""
  402. return self.firstMapWindow
  403. def GetSecondWindow(self):
  404. """!Get second map window"""
  405. return self.secondMapWindow
  406. def GetMap(self):
  407. """!Returns current map (renderer) instance
  408. @note Use this method to access current map renderer.
  409. (It is not guarented that current map will be stored in
  410. \c self.Map in future versions.)
  411. """
  412. return self.Map
  413. def GetWindow(self):
  414. """!Returns current map window
  415. @see GetMap()
  416. """
  417. return self.MapWindow
  418. def GetWindows(self):
  419. """!Return list of all windows"""
  420. return [self.firstMapWindow, self.secondMapWindow]
  421. def ActivateFirstMap(self, event = None):
  422. """!Make first Map and MapWindow active and (un)bind regions of the two Maps."""
  423. if self.MapWindow == self.firstMapWindow:
  424. return
  425. self.Map = self.firstMap
  426. self.MapWindow = self.firstMapWindow
  427. self.GetMapToolbar().SetActiveMap(0)
  428. # bind/unbind regions
  429. if self._bindRegions:
  430. self.firstMapWindow.zoomChanged.connect(self.OnZoomChangedFirstMap)
  431. self.secondMapWindow.zoomChanged.disconnect(self.OnZoomChangedSecondMap)
  432. def ActivateSecondMap(self, event = None):
  433. """!Make second Map and MapWindow active and (un)bind regions of the two Maps."""
  434. if self.MapWindow == self.secondMapWindow:
  435. return
  436. self.Map = self.secondMap
  437. self.MapWindow = self.secondMapWindow
  438. self.GetMapToolbar().SetActiveMap(1)
  439. if self._bindRegions:
  440. self.secondMapWindow.zoomChanged.connect(self.OnZoomChangedSecondMap)
  441. self.firstMapWindow.zoomChanged.disconnect(self.OnZoomChangedFirstMap)
  442. def SetBindRegions(self, on):
  443. """!Set or unset binding display regions."""
  444. self._bindRegions = on
  445. if on:
  446. if self.MapWindow == self.firstMapWindow:
  447. self.firstMapWindow.zoomChanged.connect(self.OnZoomChangedFirstMap)
  448. else:
  449. self.secondMapWindow.zoomChanged.connect(self.OnZoomChangedSecondMap)
  450. else:
  451. if self.MapWindow == self.firstMapWindow:
  452. self.firstMapWindow.zoomChanged.disconnect(self.OnZoomChangedFirstMap)
  453. else:
  454. self.secondMapWindow.zoomChanged.disconnect(self.OnZoomChangedSecondMap)
  455. def OnZoomChangedFirstMap(self):
  456. """!Display region of the first window (Map) changed.
  457. Synchronize the region of the second map and re-render it.
  458. This is the default implementation which can be overridden.
  459. """
  460. region = self.GetFirstMap().GetCurrentRegion()
  461. self.GetSecondMap().region.update(region)
  462. self.Render(mapToRender = self.GetSecondWindow())
  463. def OnZoomChangedSecondMap(self):
  464. """!Display region of the second window (Map) changed.
  465. Synchronize the region of the second map and re-render it.
  466. This is the default implementation which can be overridden.
  467. """
  468. region = self.GetSecondMap().GetCurrentRegion()
  469. self.GetFirstMap().region.update(region)
  470. self.Render(mapToRender = self.GetFirstWindow())
  471. def OnZoomIn(self, event):
  472. """!Zoom in the map.
  473. Set mouse cursor, zoombox attributes, and zoom direction
  474. """
  475. toolbar = self.GetMapToolbar()
  476. self.SwitchTool(toolbar, event)
  477. win = self.GetFirstWindow()
  478. self._prepareZoom(mapWindow = win, zoomType = 1)
  479. win = self.GetSecondWindow()
  480. self._prepareZoom(mapWindow = win, zoomType = 1)
  481. def OnZoomOut(self, event):
  482. """!Zoom out the map.
  483. Set mouse cursor, zoombox attributes, and zoom direction
  484. """
  485. toolbar = self.GetMapToolbar()
  486. self.SwitchTool(toolbar, event)
  487. win = self.GetFirstWindow()
  488. self._prepareZoom(mapWindow = win, zoomType = -1)
  489. win = self.GetSecondWindow()
  490. self._prepareZoom(mapWindow = win, zoomType = -1)
  491. def OnPan(self, event):
  492. """!Panning, set mouse to drag
  493. """
  494. toolbar = self.GetMapToolbar()
  495. self.SwitchTool(toolbar, event)
  496. win = self.GetFirstWindow()
  497. self._preparePan(mapWindow = win)
  498. win = self.GetSecondWindow()
  499. self._preparePan(mapWindow = win)
  500. def OnPointer(self, event):
  501. """!Set pointer mode (dragging overlays)"""
  502. toolbar = self.GetMapToolbar()
  503. self.SwitchTool(toolbar, event)
  504. self.GetFirstWindow().mouse['use'] = 'pointer'
  505. self.GetFirstWindow().SetNamedCursor('default')
  506. self.GetSecondWindow().mouse['use'] = 'pointer'
  507. self.GetSecondWindow().SetNamedCursor('default')
  508. def OnRender(self, event):
  509. """!Re-render map composition (each map layer)
  510. """
  511. self.Render(mapToRender = self.GetFirstWindow())
  512. self.Render(mapToRender = self.GetSecondWindow())
  513. def Render(self, mapToRender):
  514. """!Re-render map composition"""
  515. mapToRender.UpdateMap(render = True,
  516. renderVector = mapToRender == self.GetFirstWindow())
  517. # update statusbar
  518. self.StatusbarUpdate()
  519. def OnErase(self, event):
  520. """!Erase the canvas
  521. """
  522. self.Erase(mapToErase = self.GetFirstWindow())
  523. self.Erase(mapToErase = self.GetSecondWindow())
  524. def Erase(self, mapToErase):
  525. """!Erase the canvas
  526. """
  527. mapToErase.EraseMap()
  528. def OnDraw(self, event):
  529. """!Re-display current map composition
  530. """
  531. self.Draw(mapToDraw = self.GetFirstWindow())
  532. self.Draw(mapToDraw = self.GetSecondWindow())
  533. def Draw(self, mapToDraw):
  534. """!Re-display current map composition
  535. """
  536. mapToDraw.UpdateMap(render = False)