mapdisplay.py 22 KB

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