mapdisplay.py 22 KB

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