def testMapWindowApi(self, giface, map_): self.frame = wx.Frame(parent=None, title=_("Map window API test frame")) panel = wx.Panel(parent=self.frame, id=wx.ID_ANY) sizer = wx.BoxSizer(wx.VERTICAL) mapWindowProperties = MapWindowProperties() mapWindowProperties.setValuesFromUserSettings() mapWindowProperties.showRegion = True width, height = self.frame.GetClientSize() copyOfInitMap(map_, width, height) window = BufferedMapWindow(parent=panel, giface=giface, Map=map_, properties=mapWindowProperties) giface.mapWindow = window sizer.Add(window, proportion=1, flag=wx.EXPAND | wx.ALL, border=5) panel.SetSizer(sizer) panel.Layout() window.ZoomToWind() self.frame.Show()
def testMapWindowDistance(self, giface, map_): self.frame = wx.Frame( parent=None, title=_("Map window distance measurement test frame")) panel = wx.Panel(parent=self.frame, id=wx.ID_ANY) sizer = wx.BoxSizer(wx.VERTICAL) mapWindowProperties = MapWindowProperties() mapWindowProperties.setValuesFromUserSettings() mapWindowProperties.showRegion = True width, height = self.frame.GetClientSize() copyOfInitMap(map_, width, height) window = BufferedMapWindow(parent=panel, giface=giface, Map=map_, properties=mapWindowProperties) giface.mapWindow = window sizer.Add(window, proportion=1, flag=wx.EXPAND | wx.ALL, border=5) panel.SetSizer(sizer) panel.Layout() window.ZoomToWind() self._listenToAllMapWindowSignals(window) self.frame.Show() from mapwin.analysis import MeasureDistanceController self.controller = MeasureDistanceController(giface, window) self.controller.Start()
def testMapWindowProfile(self, giface, map_): self.frame = wx.Frame(parent=None, title=_("Map window profile tool test frame")) panel = wx.Panel(parent=self.frame, id=wx.ID_ANY) sizer = wx.BoxSizer(wx.VERTICAL) mapWindowProperties = MapWindowProperties() mapWindowProperties.setValuesFromUserSettings() mapWindowProperties.showRegion = True width, height = self.frame.GetClientSize() copyOfInitMap(map_, width, height) window = BufferedMapWindow(parent=panel, giface=giface, Map=map_, properties=mapWindowProperties) giface.mapWindow = window sizer.Add(window, proportion=1, flag=wx.EXPAND | wx.ALL, border=5) panel.SetSizer(sizer) panel.Layout() window.ZoomToWind() self._listenToAllMapWindowSignals(window) self.frame.Show() from mapwin.analysis import ProfileController self.controller = ProfileController(giface, window) self.controller.Start() rasters = [] for layer in giface.GetLayerList().GetSelectedLayers(): if layer.maplayer.GetType() == "raster": rasters.append(layer.maplayer.GetName()) from wxplot.profile import ProfileFrame profileWindow = ProfileFrame( parent=self.frame, giface=giface, controller=self.controller, units=map_.projinfo["units"], rasterList=rasters, ) profileWindow.CentreOnParent() profileWindow.Show() # Open raster select dialog to make sure that a raster (and # the desired raster) is selected to be profiled profileWindow.OnSelectRaster(None)