gcpmapdisp.py 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660
  1. """!
  2. @package gcpmapdisp.py
  3. @brief display to manage ground control points with two toolbars, one for
  4. various display management functions, one for manipulating GCPs.
  5. Classes:
  6. - MapFrame
  7. (C) 2006-2010 by the GRASS Development Team
  8. This program is free software under the GNU General Public
  9. License (>=v2). Read the file COPYING that comes with GRASS
  10. for details.
  11. Derived from mapdisp.py
  12. @author Markus Metz
  13. """
  14. import os
  15. import sys
  16. import glob
  17. import math
  18. import tempfile
  19. import copy
  20. import platform
  21. import globalvar
  22. import wx
  23. import wx.aui
  24. try:
  25. import subprocess
  26. except:
  27. CompatPath = os.path.join(globalvar.ETCWXDIR)
  28. sys.path.append(CompatPath)
  29. from compat import subprocess
  30. gmpath = os.path.join(globalvar.ETCWXDIR, "icons")
  31. sys.path.append(gmpath)
  32. grassPath = os.path.join(globalvar.ETCDIR, "python")
  33. sys.path.append(grassPath)
  34. import render
  35. import toolbars
  36. import menuform
  37. import gselect
  38. import disp_print
  39. import gcmd
  40. import dbm
  41. import dbm_dialogs
  42. import globalvar
  43. import utils
  44. import gdialogs
  45. import mapdisp_statusbar as sb
  46. from mapdisp import MapFrameBase
  47. from grass.script import core as grass
  48. from debug import Debug
  49. from icon import Icons
  50. from preferences import globalSettings as UserSettings
  51. from mapdisp_window import BufferedWindow
  52. # for standalone app
  53. cmdfilename = None
  54. class MapFrame(MapFrameBase):
  55. """!Main frame for map display window. Drawing takes place in
  56. child double buffered drawing window.
  57. """
  58. def __init__(self, parent=None, title=_("GRASS GIS Manage Ground Control Points"),
  59. toolbars=["gcpdisp"], tree=None, notebook=None, lmgr=None,
  60. page=None, Map=None, auimgr=None, name = 'GCPMapWindow', **kwargs):
  61. """!Main map display window with toolbars, statusbar and
  62. DrawWindow
  63. @param toolbars array of activated toolbars, e.g. ['map', 'digit']
  64. @param tree reference to layer tree
  65. @param notebook control book ID in Layer Manager
  66. @param lmgr Layer Manager
  67. @param page notebook page with layer tree
  68. @param Map instance of render.Map
  69. @param auimgs AUI manager
  70. @param kwargs wx.Frame attribures
  71. """
  72. MapFrameBase.__init__(self, parent = parent, title = title, toolbars = toolbars,
  73. Map = Map, auimgr = auimgr, name = name, **kwargs)
  74. self._layerManager = lmgr # Layer Manager object
  75. self.tree = tree # Layer Manager layer tree object
  76. self.page = page # Notebook page holding the layer tree
  77. self.layerbook = notebook # Layer Manager layer tree notebook
  78. #
  79. # Add toolbars
  80. #
  81. for toolb in toolbars:
  82. self.AddToolbar(toolb)
  83. self.activemap = self.toolbars['gcpdisp'].togglemap
  84. self.activemap.SetSelection(0)
  85. self.SrcMap = self.grwiz.SrcMap # instance of render.Map
  86. self.TgtMap = self.grwiz.TgtMap # instance of render.Map
  87. self._mgr.SetDockSizeConstraint(0.5, 0.5)
  88. #
  89. # Add statusbar
  90. #
  91. # items for choice
  92. self.statusbarItems = [sb.SbCoordinates,
  93. sb.SbRegionExtent,
  94. sb.SbCompRegionExtent,
  95. sb.SbShowRegion,
  96. sb.SbResolution,
  97. sb.SbDisplayGeometry,
  98. sb.SbMapScale,
  99. sb.SbProjection,
  100. sb.SbGoToGCP,
  101. sb.SbRMSError]
  102. # create statusbar and its manager
  103. statusbar = self.CreateStatusBar(number = 4, style = 0)
  104. statusbar.SetStatusWidths([-5, -2, -1, -1])
  105. self.statusbarManager = sb.SbManager(mapframe = self, statusbar = statusbar)
  106. # fill statusbar manager
  107. self.statusbarManager.AddStatusbarItemsByClass(self.statusbarItems, mapframe = self, statusbar = statusbar)
  108. self.statusbarManager.AddStatusbarItem(sb.SbMask(self, statusbar = statusbar, position = 2))
  109. self.statusbarManager.AddStatusbarItem(sb.SbRender(self, statusbar = statusbar, position = 3))
  110. self.statusbarManager.SetMode(8) # goto GCP
  111. self.statusbarManager.Update()
  112. #
  113. # Init map display (buffered DC & set default cursor)
  114. #
  115. self.grwiz.SwitchEnv('source')
  116. self.SrcMapWindow = BufferedWindow(self, id=wx.ID_ANY,
  117. Map=self.SrcMap, tree=self.tree, lmgr=self._layerManager)
  118. self.grwiz.SwitchEnv('target')
  119. self.TgtMapWindow = BufferedWindow(self, id=wx.ID_ANY,
  120. Map=self.TgtMap, tree=self.tree, lmgr=self._layerManager)
  121. self.MapWindow = self.SrcMapWindow
  122. self.Map = self.SrcMap
  123. self.SrcMapWindow.SetCursor(self.cursors["cross"])
  124. self.TgtMapWindow.SetCursor(self.cursors["cross"])
  125. #
  126. # initialize region values
  127. #
  128. self._initMap(map = self.SrcMap)
  129. self._initMap(map = self.TgtMap)
  130. #
  131. # Bind various events
  132. #
  133. self.Bind(wx.EVT_ACTIVATE, self.OnFocus)
  134. self.Bind(render.EVT_UPDATE_PRGBAR, self.OnUpdateProgress)
  135. self.Bind(wx.EVT_SIZE, self.OnDispResize)
  136. self.activemap.Bind(wx.EVT_CHOICE, self.OnUpdateActive)
  137. #
  138. # Update fancy gui style
  139. #
  140. # AuiManager wants a CentrePane, workaround to get two equally sized windows
  141. self.list = self.CreateGCPList()
  142. #self.SrcMapWindow.SetSize((300, 300))
  143. #self.TgtMapWindow.SetSize((300, 300))
  144. self.list.SetSize((100, 150))
  145. self._mgr.AddPane(self.list, wx.aui.AuiPaneInfo().
  146. Name("gcplist").Caption(_("GCP List")).LeftDockable(False).
  147. RightDockable(False).PinButton().FloatingSize((600,200)).
  148. CloseButton(False).DestroyOnClose(True).
  149. Top().Layer(1).MinSize((200,100)))
  150. self._mgr.AddPane(self.SrcMapWindow, wx.aui.AuiPaneInfo().
  151. Name("source").Caption(_("Source Display")).Dockable(False).
  152. CloseButton(False).DestroyOnClose(True).Floatable(False).
  153. Centre())
  154. self._mgr.AddPane(self.TgtMapWindow, wx.aui.AuiPaneInfo().
  155. Name("target").Caption(_("Target Display")).Dockable(False).
  156. CloseButton(False).DestroyOnClose(True).Floatable(False).
  157. Right().Layer(0))
  158. srcwidth, srcheight = self.SrcMapWindow.GetSize()
  159. tgtwidth, tgtheight = self.TgtMapWindow.GetSize()
  160. srcwidth = (srcwidth + tgtwidth) / 2
  161. self._mgr.GetPane("target").Hide()
  162. self._mgr.Update()
  163. self._mgr.GetPane("source").BestSize((srcwidth, srcheight))
  164. self._mgr.GetPane("target").BestSize((srcwidth, srcheight))
  165. if self.show_target:
  166. self._mgr.GetPane("target").Show()
  167. else:
  168. self.activemap.Enable(False)
  169. # needed by Mac OS, does not harm on Linux, breaks display on Windows
  170. if platform.system() != 'Windows':
  171. self._mgr.Update()
  172. #
  173. # Init print module and classes
  174. #
  175. self.printopt = disp_print.PrintOptions(self, self.MapWindow)
  176. #
  177. # Initialization of digitization tool
  178. #
  179. self.digit = None
  180. # set active map
  181. self.MapWindow = self.SrcMapWindow
  182. self.Map = self.SrcMap
  183. # do not init zoom history here, that happens when zooming to map(s)
  184. #
  185. # Re-use dialogs
  186. #
  187. self.dialogs = {}
  188. self.dialogs['attributes'] = None
  189. self.dialogs['category'] = None
  190. self.dialogs['barscale'] = None
  191. self.dialogs['legend'] = None
  192. self.decorationDialog = None # decoration/overlays
  193. def AddToolbar(self, name):
  194. """!Add defined toolbar to the window
  195. Currently known toolbars are:
  196. - 'map' - basic map toolbar
  197. - 'vdigit' - vector digitizer
  198. - 'gcpdisp' - GCP Manager, Display
  199. - 'gcpman' - GCP Manager, points management
  200. - 'nviz' - 3D view mode
  201. """
  202. # default toolbar
  203. if name == "map":
  204. self.toolbars['map'] = toolbars.MapToolbar(self, self.Map)
  205. self._mgr.AddPane(self.toolbars['map'],
  206. wx.aui.AuiPaneInfo().
  207. Name("maptoolbar").Caption(_("Map Toolbar")).
  208. ToolbarPane().Top().
  209. LeftDockable(False).RightDockable(False).
  210. BottomDockable(False).TopDockable(True).
  211. CloseButton(False).Layer(2).
  212. BestSize((self.toolbars['map'].GetSize())))
  213. # GCP display
  214. elif name == "gcpdisp":
  215. self.toolbars['gcpdisp'] = toolbars.GCPDisplayToolbar(self)
  216. self._mgr.AddPane(self.toolbars['gcpdisp'],
  217. wx.aui.AuiPaneInfo().
  218. Name("gcpdisplaytoolbar").Caption(_("GCP Display toolbar")).
  219. ToolbarPane().Top().
  220. LeftDockable(False).RightDockable(False).
  221. BottomDockable(False).TopDockable(True).
  222. CloseButton(False).Layer(2))
  223. if self.show_target == False:
  224. self.toolbars['gcpdisp'].Enable('zoommenu', enable = False)
  225. self.toolbars['gcpman'] = toolbars.GCPManToolbar(self)
  226. self._mgr.AddPane(self.toolbars['gcpman'],
  227. wx.aui.AuiPaneInfo().
  228. Name("gcpmanagertoolbar").Caption(_("GCP Manager toolbar")).
  229. ToolbarPane().Top().Row(1).
  230. LeftDockable(False).RightDockable(False).
  231. BottomDockable(False).TopDockable(True).
  232. CloseButton(False).Layer(2))
  233. self._mgr.Update()
  234. def OnUpdateProgress(self, event):
  235. """
  236. Update progress bar info
  237. """
  238. self.GetProgressBar().SetValue(event.value)
  239. event.Skip()
  240. def OnFocus(self, event):
  241. """
  242. Change choicebook page to match display.
  243. Or set display for georectifying
  244. """
  245. if self._layerManager and \
  246. self._layerManager.gcpmanagement:
  247. # in GCP Management, set focus to current MapWindow for mouse actions
  248. self.OnPointer(event)
  249. self.MapWindow.SetFocus()
  250. else:
  251. # change bookcontrol page to page associated with display
  252. # GCP Manager: use bookcontrol?
  253. if self.page:
  254. pgnum = self.layerbook.GetPageIndex(self.page)
  255. if pgnum > -1:
  256. self.layerbook.SetSelection(pgnum)
  257. event.Skip()
  258. def OnDraw(self, event):
  259. """!Re-display current map composition
  260. """
  261. self.MapWindow.UpdateMap(render = False)
  262. def OnRender(self, event):
  263. """!Re-render map composition (each map layer)
  264. """
  265. # delete tmp map layers (queries)
  266. qlayer = self.Map.GetListOfLayers(l_name=globalvar.QUERYLAYER)
  267. for layer in qlayer:
  268. self.Map.DeleteLayer(layer)
  269. self.SrcMapWindow.UpdateMap(render=True)
  270. if self.show_target:
  271. self.TgtMapWindow.UpdateMap(render=True)
  272. # update statusbar
  273. self.StatusbarUpdate()
  274. def OnPointer(self, event):
  275. """!Pointer button clicked
  276. """
  277. # change the cursor
  278. self.SrcMapWindow.SetCursor(self.cursors["cross"])
  279. self.SrcMapWindow.mouse['use'] = "pointer"
  280. self.SrcMapWindow.mouse['box'] = "point"
  281. self.TgtMapWindow.SetCursor(self.cursors["cross"])
  282. self.TgtMapWindow.mouse['use'] = "pointer"
  283. self.TgtMapWindow.mouse['box'] = "point"
  284. def OnZoomIn(self, event):
  285. """
  286. Zoom in the map.
  287. Set mouse cursor, zoombox attributes, and zoom direction
  288. """
  289. if self.GetToolbar('map'):
  290. self.toolbars['map'].OnTool(event)
  291. self.toolbars['map'].action['desc'] = ''
  292. self.MapWindow.mouse['use'] = "zoom"
  293. self.MapWindow.mouse['box'] = "box"
  294. self.MapWindow.zoomtype = 1
  295. self.MapWindow.pen = wx.Pen(colour='Red', width=2, style=wx.SHORT_DASH)
  296. # change the cursor
  297. self.MapWindow.SetCursor(self.cursors["cross"])
  298. if self.MapWindow == self.SrcMapWindow:
  299. win = self.TgtMapWindow
  300. elif self.MapWindow == self.TgtMapWindow:
  301. win = self.SrcMapWindow
  302. win.mouse['use'] = "zoom"
  303. win.mouse['box'] = "box"
  304. win.zoomtype = 1
  305. win.pen = wx.Pen(colour='Red', width=2, style=wx.SHORT_DASH)
  306. # change the cursor
  307. win.SetCursor(self.cursors["cross"])
  308. def OnZoomOut(self, event):
  309. """
  310. Zoom out the map.
  311. Set mouse cursor, zoombox attributes, and zoom direction
  312. """
  313. if self.GetToolbar('map'):
  314. self.toolbars['map'].OnTool(event)
  315. self.toolbars['map'].action['desc'] = ''
  316. self.MapWindow.mouse['use'] = "zoom"
  317. self.MapWindow.mouse['box'] = "box"
  318. self.MapWindow.zoomtype = -1
  319. self.MapWindow.pen = wx.Pen(colour='Red', width=2, style=wx.SHORT_DASH)
  320. # change the cursor
  321. self.MapWindow.SetCursor(self.cursors["cross"])
  322. if self.MapWindow == self.SrcMapWindow:
  323. win = self.TgtMapWindow
  324. elif self.MapWindow == self.TgtMapWindow:
  325. win = self.SrcMapWindow
  326. win.mouse['use'] = "zoom"
  327. win.mouse['box'] = "box"
  328. win.zoomtype = -1
  329. win.pen = wx.Pen(colour='Red', width=2, style=wx.SHORT_DASH)
  330. # change the cursor
  331. win.SetCursor(self.cursors["cross"])
  332. def OnPan(self, event):
  333. """
  334. Panning, set mouse to drag
  335. """
  336. if self.GetToolbar('map'):
  337. self.toolbars['map'].OnTool(event)
  338. self.toolbars['map'].action['desc'] = ''
  339. self.MapWindow.mouse['use'] = "pan"
  340. self.MapWindow.mouse['box'] = "pan"
  341. self.MapWindow.zoomtype = 0
  342. # change the cursor
  343. self.MapWindow.SetCursor(self.cursors["hand"])
  344. if self.MapWindow == self.SrcMapWindow:
  345. win = self.TgtMapWindow
  346. elif self.MapWindow == self.TgtMapWindow:
  347. win = self.SrcMapWindow
  348. win.mouse['use'] = "pan"
  349. win.mouse['box'] = "pan"
  350. win.zoomtype = 0
  351. # change the cursor
  352. win.SetCursor(self.cursors["hand"])
  353. def OnErase(self, event):
  354. """
  355. Erase the canvas
  356. """
  357. self.MapWindow.EraseMap()
  358. if self.MapWindow == self.SrcMapWindow:
  359. win = self.TgtMapWindow
  360. elif self.MapWindow == self.TgtMapWindow:
  361. win = self.SrcMapWindow
  362. win.EraseMap()
  363. def OnZoomRegion(self, event):
  364. """
  365. Zoom to region
  366. """
  367. self.Map.getRegion()
  368. self.Map.getResolution()
  369. self.UpdateMap()
  370. # event.Skip()
  371. def OnAlignRegion(self, event):
  372. """
  373. Align region
  374. """
  375. if not self.Map.alignRegion:
  376. self.Map.alignRegion = True
  377. else:
  378. self.Map.alignRegion = False
  379. # event.Skip()
  380. def SaveToFile(self, event):
  381. """!Save map to image
  382. """
  383. img = self.MapWindow.img
  384. if not img:
  385. gcmd.GMessage(parent = self,
  386. message = _("Nothing to render (empty map). Operation canceled."))
  387. return
  388. filetype, ltype = gdialogs.GetImageHandlers(img)
  389. # get size
  390. dlg = gdialogs.ImageSizeDialog(self)
  391. dlg.CentreOnParent()
  392. if dlg.ShowModal() != wx.ID_OK:
  393. dlg.Destroy()
  394. return
  395. width, height = dlg.GetValues()
  396. dlg.Destroy()
  397. # get filename
  398. dlg = wx.FileDialog(parent = self,
  399. message = _("Choose a file name to save the image "
  400. "(no need to add extension)"),
  401. wildcard = filetype,
  402. style=wx.SAVE | wx.FD_OVERWRITE_PROMPT)
  403. if dlg.ShowModal() == wx.ID_OK:
  404. path = dlg.GetPath()
  405. if not path:
  406. dlg.Destroy()
  407. return
  408. base, ext = os.path.splitext(path)
  409. fileType = ltype[dlg.GetFilterIndex()]['type']
  410. extType = ltype[dlg.GetFilterIndex()]['ext']
  411. if ext != extType:
  412. path = base + '.' + extType
  413. self.MapWindow.SaveToFile(path, fileType,
  414. width, height)
  415. dlg.Destroy()
  416. def PrintMenu(self, event):
  417. """
  418. Print options and output menu for map display
  419. """
  420. point = wx.GetMousePosition()
  421. printmenu = wx.Menu()
  422. # Add items to the menu
  423. setup = wx.MenuItem(printmenu, wx.ID_ANY, _('Page setup'))
  424. printmenu.AppendItem(setup)
  425. self.Bind(wx.EVT_MENU, self.printopt.OnPageSetup, setup)
  426. preview = wx.MenuItem(printmenu, wx.ID_ANY, _('Print preview'))
  427. printmenu.AppendItem(preview)
  428. self.Bind(wx.EVT_MENU, self.printopt.OnPrintPreview, preview)
  429. doprint = wx.MenuItem(printmenu, wx.ID_ANY, _('Print display'))
  430. printmenu.AppendItem(doprint)
  431. self.Bind(wx.EVT_MENU, self.printopt.OnDoPrint, doprint)
  432. # Popup the menu. If an item is selected then its handler
  433. # will be called before PopupMenu returns.
  434. self.PopupMenu(printmenu)
  435. printmenu.Destroy()
  436. def FormatDist(self, dist):
  437. """!Format length numbers and units in a nice way,
  438. as a function of length. From code by Hamish Bowman
  439. Grass Development Team 2006"""
  440. mapunits = self.Map.projinfo['units']
  441. if mapunits == 'metres': mapunits = 'meters'
  442. outunits = mapunits
  443. dist = float(dist)
  444. divisor = 1.0
  445. # figure out which units to use
  446. if mapunits == 'meters':
  447. if dist > 2500.0:
  448. outunits = 'km'
  449. divisor = 1000.0
  450. else: outunits = 'm'
  451. elif mapunits == 'feet':
  452. # nano-bug: we match any "feet", but US Survey feet is really
  453. # 5279.9894 per statute mile, or 10.6' per 1000 miles. As >1000
  454. # miles the tick markers are rounded to the nearest 10th of a
  455. # mile (528'), the difference in foot flavours is ignored.
  456. if dist > 5280.0:
  457. outunits = 'miles'
  458. divisor = 5280.0
  459. else:
  460. outunits = 'ft'
  461. elif 'degree' in mapunits:
  462. if dist < 1:
  463. outunits = 'min'
  464. divisor = (1/60.0)
  465. else:
  466. outunits = 'deg'
  467. # format numbers in a nice way
  468. if (dist/divisor) >= 2500.0:
  469. outdist = round(dist/divisor)
  470. elif (dist/divisor) >= 1000.0:
  471. outdist = round(dist/divisor,1)
  472. elif (dist/divisor) > 0.0:
  473. outdist = round(dist/divisor,int(math.ceil(3-math.log10(dist/divisor))))
  474. else:
  475. outdist = float(dist/divisor)
  476. return (outdist, outunits)
  477. def OnZoomToRaster(self, event):
  478. """!
  479. Set display extents to match selected raster map (ignore NULLs)
  480. """
  481. self.MapWindow.ZoomToMap(ignoreNulls = True)
  482. def OnZoomToSaved(self, event):
  483. """!Set display geometry to match extents in
  484. saved region file
  485. """
  486. self.MapWindow.ZoomToSaved()
  487. def OnDisplayToWind(self, event):
  488. """!Set computational region (WIND file) to match display
  489. extents
  490. """
  491. self.MapWindow.DisplayToWind()
  492. def SaveDisplayRegion(self, event):
  493. """!Save display extents to named region file.
  494. """
  495. self.MapWindow.SaveDisplayRegion()
  496. def OnZoomMenu(self, event):
  497. """!Popup Zoom menu
  498. """
  499. point = wx.GetMousePosition()
  500. zoommenu = wx.Menu()
  501. # Add items to the menu
  502. zoomwind = wx.MenuItem(zoommenu, wx.ID_ANY, _('Zoom to computational region (set with g.region)'))
  503. zoommenu.AppendItem(zoomwind)
  504. self.Bind(wx.EVT_MENU, self.OnZoomToWind, zoomwind)
  505. zoomdefault = wx.MenuItem(zoommenu, wx.ID_ANY, _('Zoom to default region'))
  506. zoommenu.AppendItem(zoomdefault)
  507. self.Bind(wx.EVT_MENU, self.OnZoomToDefault, zoomdefault)
  508. zoomsaved = wx.MenuItem(zoommenu, wx.ID_ANY, _('Zoom to saved region'))
  509. zoommenu.AppendItem(zoomsaved)
  510. self.Bind(wx.EVT_MENU, self.OnZoomToSaved, zoomsaved)
  511. savewind = wx.MenuItem(zoommenu, wx.ID_ANY, _('Set computational region from display'))
  512. zoommenu.AppendItem(savewind)
  513. self.Bind(wx.EVT_MENU, self.OnDisplayToWind, savewind)
  514. savezoom = wx.MenuItem(zoommenu, wx.ID_ANY, _('Save display geometry to named region'))
  515. zoommenu.AppendItem(savezoom)
  516. self.Bind(wx.EVT_MENU, self.SaveDisplayRegion, savezoom)
  517. # Popup the menu. If an item is selected then its handler
  518. # will be called before PopupMenu returns.
  519. self.PopupMenu(zoommenu)
  520. zoommenu.Destroy()
  521. def IsStandalone(self):
  522. """!Check if Map display is standalone"""
  523. if self._layerManager:
  524. return False
  525. return True
  526. def GetLayerManager(self):
  527. """!Get reference to Layer Manager
  528. @return window reference
  529. @return None (if standalone)
  530. """
  531. return self._layerManager
  532. def GetSrcWindow(self):
  533. return self.SrcMapWindow
  534. def GetTgtWindow(self):
  535. return self.TgtMapWindow
  536. def GetShowTarget(self):
  537. return self.show_target
  538. def GetMapToolbar(self):
  539. """!Returns toolbar with zooming tools"""
  540. return self.toolbars['gcpdisp']
  541. # end of class MapFrame