def __init__(self, parent = None, giface = None, title = _("GRASS GIS Map Swipe"), name = "swipe", **kwargs): DoubleMapFrame.__init__(self, parent = parent, title = title, name = name, firstMap = Map(), secondMap = Map(), **kwargs) Debug.msg (1, "SwipeMapFrame.__init__()") # # Add toolbars # toolbars = ['swipeMisc', 'swipeMap', 'swipeMain'] if sys.platform == 'win32': self.AddToolbar(toolbars.pop(1)) toolbars.reverse() else: self.AddToolbar(toolbars.pop(0)) for toolb in toolbars: self.AddToolbar(toolb) self._giface = giface # # create widgets # self.splitter = MapSplitter(parent = self, id = wx.ID_ANY) self.sliderH = wx.Slider(self, id = wx.ID_ANY, style = wx.SL_HORIZONTAL) self.sliderV = wx.Slider(self, id = wx.ID_ANY, style = wx.SL_VERTICAL) self.mapWindowProperties = MapWindowProperties() self.mapWindowProperties.setValuesFromUserSettings() self.mapWindowProperties.autoRenderChanged.connect(self.OnAutoRenderChanged) self.firstMapWindow = SwipeBufferedWindow(parent = self.splitter, giface = self._giface, properties=self.mapWindowProperties, Map = self.firstMap) self.secondMapWindow = SwipeBufferedWindow(parent = self.splitter, giface = self._giface, properties=self.mapWindowProperties, Map = self.secondMap) # bind query signal self.firstMapWindow.mapQueried.connect(self.Query) self.secondMapWindow.mapQueried.connect(self.Query) # bind tracking cursosr to mirror it self.firstMapWindow.Bind(wx.EVT_MOTION, lambda evt: self.TrackCursor(evt)) self.secondMapWindow.Bind(wx.EVT_MOTION, lambda evt: self.TrackCursor(evt)) self.MapWindow = self.firstMapWindow # current by default self.firstMapWindow.zoomhistory = self.secondMapWindow.zoomhistory self.SetBindRegions(True) self._mode = 'swipe' self._addPanes() self._bindWindowsActivation() self._setUpMapWindow(self.firstMapWindow) self._setUpMapWindow(self.secondMapWindow) self._mgr.GetPane('sliderV').Hide() self._mgr.GetPane('sliderH').Show() self.slider = self.sliderH self.InitStatusbar() self.Bind(wx.EVT_SIZE, self.OnSize) self.Bind(wx.EVT_IDLE, self.OnIdle) self.Bind(wx.EVT_CLOSE, self.OnCloseWindow) self.SetSize((800, 600)) self._mgr.Update() self.rasters = {'first': None, 'second': None} self._inputDialog = None self._preferencesDialog = None self._queryDialog = None # default action in map toolbar self.GetMapToolbar().SelectDefault() self.resize = False wx.CallAfter(self.CallAfterInit)
def __init__(self, parent=None, giface=None, title=_("GRASS GIS Map Swipe"), name="swipe", **kwargs): DoubleMapFrame.__init__(self, parent=parent, title=title, name=name, firstMap=Map(), secondMap=Map(), **kwargs) Debug.msg(1, "SwipeMapFrame.__init__()") # # Add toolbars # self.AddToolbars() self._giface = giface # # create widgets # self.splitter = MapSplitter(parent=self, id=wx.ID_ANY) self.sliderH = wx.Slider(self, id=wx.ID_ANY, style=wx.SL_HORIZONTAL) self.sliderV = wx.Slider(self, id=wx.ID_ANY, style=wx.SL_VERTICAL) self.mapWindowProperties = MapWindowProperties() self.mapWindowProperties.setValuesFromUserSettings() self.mapWindowProperties.autoRenderChanged.connect( self.OnAutoRenderChanged) self.firstMapWindow = SwipeBufferedWindow( parent=self.splitter, giface=self._giface, properties=self.mapWindowProperties, Map=self.firstMap) self.secondMapWindow = SwipeBufferedWindow( parent=self.splitter, giface=self._giface, properties=self.mapWindowProperties, Map=self.secondMap) # bind query signal self.firstMapWindow.mapQueried.connect(self.Query) self.secondMapWindow.mapQueried.connect(self.Query) # bind tracking cursosr to mirror it self.firstMapWindow.Bind( wx.EVT_MOTION, lambda evt: self.TrackCursor(evt)) self.secondMapWindow.Bind( wx.EVT_MOTION, lambda evt: self.TrackCursor(evt)) self.MapWindow = self.firstMapWindow # current by default self.firstMapWindow.zoomhistory = self.secondMapWindow.zoomhistory self.SetBindRegions(True) self._mode = 'swipe' self._addPanes() self._bindWindowsActivation() self._setUpMapWindow(self.firstMapWindow) self._setUpMapWindow(self.secondMapWindow) self._mgr.GetPane('sliderV').Hide() self._mgr.GetPane('sliderH').Show() self.slider = self.sliderH self.InitStatusbar() self.Bind(wx.EVT_SIZE, self.OnSize) self.Bind(wx.EVT_IDLE, self.OnIdle) self.Bind(wx.EVT_CLOSE, self.OnCloseWindow) self.SetSize((800, 600)) self._mgr.Update() self.rasters = {'first': None, 'second': None} self._inputDialog = None self._preferencesDialog = None self._queryDialog = None # default action in map toolbar self.GetMapToolbar().SelectDefault() self.resize = False wx.CallAfter(self.CallAfterInit)
def __init__( self, parent=None, giface=None, title=_("Map Swipe"), name="swipe", **kwargs ): DoubleMapFrame.__init__( self, parent=parent, title=title, name=name, firstMap=Map(), secondMap=Map(), **kwargs, ) Debug.msg(1, "SwipeMapFrame.__init__()") # # Add toolbars # for name in ("swipeMain", "swipeMap", "swipeMisc"): self.AddToolbar(name) self._mgr.Update() self._giface = giface # # create widgets # self.splitter = MapSplitter(parent=self, id=wx.ID_ANY) self.sliderH = wx.Slider(self, id=wx.ID_ANY, style=wx.SL_HORIZONTAL) self.sliderV = wx.Slider(self, id=wx.ID_ANY, style=wx.SL_VERTICAL) self.mapWindowProperties = MapWindowProperties() self.mapWindowProperties.setValuesFromUserSettings() self.mapWindowProperties.autoRenderChanged.connect(self.OnAutoRenderChanged) self.firstMapWindow = SwipeBufferedWindow( parent=self.splitter, giface=self._giface, properties=self.mapWindowProperties, Map=self.firstMap, ) self.secondMapWindow = SwipeBufferedWindow( parent=self.splitter, giface=self._giface, properties=self.mapWindowProperties, Map=self.secondMap, ) # bind query signal self.firstMapWindow.mapQueried.connect(self.Query) self.secondMapWindow.mapQueried.connect(self.Query) # bind tracking cursosr to mirror it self.firstMapWindow.Bind(wx.EVT_MOTION, lambda evt: self.TrackCursor(evt)) self.secondMapWindow.Bind(wx.EVT_MOTION, lambda evt: self.TrackCursor(evt)) self.MapWindow = self.firstMapWindow # current by default self.firstMapWindow.zoomhistory = self.secondMapWindow.zoomhistory self.SetBindRegions(True) self._mode = "swipe" # statusbar items statusbarItems = [ sb.SbCoordinates, sb.SbRegionExtent, sb.SbCompRegionExtent, sb.SbShowRegion, sb.SbAlignExtent, sb.SbResolution, sb.SbDisplayGeometry, sb.SbMapScale, sb.SbGoTo, sb.SbProjection, ] self.statusbar = self.CreateStatusbar(statusbarItems) self._addPanes() self._bindWindowsActivation() self._setUpMapWindow(self.firstMapWindow) self._setUpMapWindow(self.secondMapWindow) self._mgr.GetPane("sliderV").Hide() self._mgr.GetPane("sliderH").Show() self.slider = self.sliderH self.Bind(wx.EVT_SIZE, self.OnSize) self.Bind(wx.EVT_IDLE, self.OnIdle) self.Bind(wx.EVT_CLOSE, self.OnCloseWindow) self.SetSize((800, 600)) self._mgr.Update() self.rasters = {"first": None, "second": None} self._inputDialog = None self._preferencesDialog = None self._queryDialog = None # default action in map toolbar self.GetMapToolbar().SelectDefault() self.resize = False wx.CallAfter(self.CallAfterInit)