mapdisp.py 22 KB

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