mapdisp.py 22 KB

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