mapdisplay.py 22 KB

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