mapdisp.py 22 KB

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