mapdisplay.py 22 KB

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