def __init__(self): """Initialize the widget.""" wx.Frame.__init__(self, None, size=DefaultAppSize, title=('PySlip %s - multiwidget test' % pyslip.__version__)) self.SetMinSize(DefaultAppSize) self.panel = wx.Panel(self, wx.ID_ANY) self.panel.SetBackgroundColour(wx.WHITE) self.panel.ClearBackground() # note that we need a unique Tile source for each widget # sharing directories is OK gmt_tile_src_1 = GMTTiles.Tiles() gmt_tile_src_2 = GMTTiles.Tiles() osm_tile_src_1 = NetTiles.Tiles() osm_tile_src_2 = NetTiles.Tiles() # build the GUI box = wx.BoxSizer(wx.VERTICAL) gsz = wx.GridSizer(rows=2, cols=2, vgap=5, hgap=5) self.pyslip1 = pyslip.pySlip(self.panel, tile_src=gmt_tile_src_1, style=wx.SIMPLE_BORDER) gsz.Add(self.pyslip1, border=1, flag=wx.ALL|wx.EXPAND) self.pyslip2 = pyslip.pySlip(self.panel, tile_src=osm_tile_src_1, style=wx.SIMPLE_BORDER) gsz.Add(self.pyslip2, border=1, flag=wx.ALL|wx.EXPAND) self.pyslip3 = pyslip.pySlip(self.panel, tile_src=osm_tile_src_2, style=wx.SIMPLE_BORDER) gsz.Add(self.pyslip3, border=1, flag=wx.ALL|wx.EXPAND) self.pyslip4 = pyslip.pySlip(self.panel, tile_src=gmt_tile_src_2, style=wx.SIMPLE_BORDER) gsz.Add(self.pyslip4, border=1, flag=wx.ALL|wx.EXPAND) box.Add(gsz, proportion=1, flag=wx.ALL|wx.EXPAND) self.panel.SetSizer(box) self.SetSizeHints(MinW, MinH, MaxW, MaxH) self.panel.Fit() self.Centre() self.Show(True) # set initial view position self.pyslip1.GotoLevelAndPosition(InitViewLevel, InitViewPosition) self.pyslip2.GotoLevelAndPosition(InitViewLevel+1, InitViewPosition) self.pyslip3.GotoLevelAndPosition(InitViewLevel, InitViewPosition) self.pyslip4.GotoLevelAndPosition(InitViewLevel-1, InitViewPosition)
def __init__(self): wx.Frame.__init__(self, None, size=DefaultAppSize, title=('PySlip %s - map-relative polygon test' % pyslip.__version__)) self.SetMinSize(DefaultAppSize) self.panel = wx.Panel(self, wx.ID_ANY) self.panel.SetBackgroundColour(wx.WHITE) self.panel.ClearBackground() # create the tile source object self.tile_src = Tiles.Tiles() # build the GUI box = wx.BoxSizer(wx.HORIZONTAL) self.panel.SetSizer(box) self.pyslip = pyslip.pySlip(self.panel, tile_src=self.tile_src, style=wx.SIMPLE_BORDER) box.Add(self.pyslip, proportion=1, border=1, flag=wx.EXPAND) self.panel.SetSizerAndFit(box) self.panel.Layout() # add test text layer self.poly_layer = self.pyslip.AddPolygonLayer(PolyMapData, map_rel=True, name='<poly_map_layer>', size=DefaultAppSize) self.text_layer = self.pyslip.AddTextLayer(TextMapData, map_rel=True, name='<text_map_layer>') # set initial view position self.Centre() self.Show(True) wx.CallLater(25, self.final_setup, InitViewLevel, InitViewPosition)
def __init__(self): wx.Frame.__init__(self, None, size=DefaultAppSize, title=('PySlip %s - view-relative image test' % pyslip.__version__)) self.SetMinSize(DefaultAppSize) self.panel = wx.Panel(self, wx.ID_ANY) self.panel.SetBackgroundColour(wx.WHITE) self.panel.ClearBackground() # create the tile source object self.tile_src = Tiles.Tiles() # build the GUI box = wx.BoxSizer(wx.VERTICAL) self.pyslip = pyslip.pySlip(self.panel, tile_src=self.tile_src, style=wx.SIMPLE_BORDER) box.Add(self.pyslip, proportion=1, border=1, flag=wx.EXPAND) self.panel.SetSizer(box) self.panel.Layout() self.Centre() self.Show(True) # add test layer(s) and set initial view position self.text_layer = self.pyslip.AddImageLayer(ImageViewData, map_rel=False, name='<image_view_layer>', offset_x=0, offset_y=0) wx.CallLater(25, self.final_setup, InitViewLevel, InitViewPosition)
def __init__(self): wx.Frame.__init__(self, None, size=DemoAppSize, title=('PySlip %s - zoom undo test' % pyslip.__version__)) self.SetMinSize(DemoAppSize) self.panel = wx.Panel(self, wx.ID_ANY) self.panel.SetBackgroundColour(wx.WHITE) self.panel.ClearBackground() # create the tile source object self.tile_src = Tiles.Tiles() # build the GUI box = wx.BoxSizer(wx.HORIZONTAL) self.panel.SetSizer(box) self.pyslip = pyslip.pySlip(self.panel, tile_src=self.tile_src, style=wx.SIMPLE_BORDER) box.Add(self.pyslip, proportion=1, border=1, flag=wx.EXPAND) self.panel.SetSizerAndFit(box) self.panel.Layout() self.Centre() self.Show(True) # set initial view position wx.CallLater(25, self.final_setup, InitViewLevel, InitViewPosition) # bind the pySlip widget to the "zoom undo" method self.pyslip.Bind(pyslip.EVT_PYSLIP_LEVEL, self.onZoom)
def make_gui_view(self, parent): """Build the map view widget parent reference to the widget parent Returns the static box sizer. """ # create gui objects sb = AppStaticBox(parent, '') self.pyslip = pyslip.pySlip(parent, tile_src=self.tile_source) # lay out objects box = wx.StaticBoxSizer(sb, orient=wx.HORIZONTAL) box.Add(self.pyslip, proportion=1, border=0, flag=wx.EXPAND) return box
def make_gui(self, parent): """Create application GUI.""" # start application layout all_display = wx.BoxSizer(wx.HORIZONTAL) parent.SetSizer(all_display) # put map view in left of horizontal box self.pyslip = pyslip.pySlip(parent, tile_src=self.tile_source, style=wx.SIMPLE_BORDER) all_display.Add(self.pyslip, proportion=1, border=1, flag=wx.EXPAND) # small spacer here - separate view and controls all_display.AddSpacer(HSpacerSize) # add controls to right of spacer controls = self.make_gui_controls(parent) all_display.Add(controls, proportion=0, border=1) parent.SetSizerAndFit(all_display)
def __init__(self): wx.Frame.__init__(self, None, size=DefaultAppSize, title='PySlip view-relative text test') self.SetMinSize(DefaultAppSize) self.panel = wx.Panel(self, wx.ID_ANY) self.panel.SetBackgroundColour(wx.WHITE) self.panel.ClearBackground() # create the tile source object self.tile_src = Tiles.Tiles() # build the GUI box = wx.BoxSizer(wx.HORIZONTAL) self.panel.SetSizer(box) self.pyslip = pyslip.pySlip(self.panel, tile_src=self.tile_src, style=wx.SIMPLE_BORDER) box.Add(self.pyslip, proportion=1, border=1, flag=wx.EXPAND) self.panel.SetSizerAndFit(box) self.panel.Layout() self.Centre() self.Show(True) # set initial view position wx.CallLater(25, self.final_setup, InitViewLevel, InitViewPosition) # add test test layer self.text_layer = self.pyslip.AddTextLayer(TextViewData, map_rel=False, name='<text_view_layer>', offset_x=20, offset_y=20, fontsize=20, colour='red')
def __init__(self): wx.Frame.__init__(self, None, size=DefaultAppSize, title=('PySlip %s - view-relative point test' % pyslip.__version__)) self.SetMinSize(DefaultAppSize) self.panel = wx.Panel(self, wx.ID_ANY) self.panel.SetBackgroundColour(wx.WHITE) self.panel.ClearBackground() # create the tile source object self.tile_src = Tiles.Tiles() # build the GUI box = wx.BoxSizer(wx.HORIZONTAL) self.panel.SetSizer(box) self.pyslip = pyslip.pySlip(self.panel, tile_src=self.tile_src, style=wx.SIMPLE_BORDER) box.Add(self.pyslip, proportion=1, border=1, flag=wx.EXPAND) self.panel.SetSizer(box) self.panel.Layout() self.Centre() self.Show(True) # add test point layers self.pyslip.AddPointLayer(PointViewDataNW, placement='nw', map_rel=False, colour='blue', radius=2, offset_x=0, offset_y=0, name='<point_map_layer>') self.pyslip.AddPointLayer(PointViewDataCN, placement='cn', map_rel=False, colour='red', radius=2, offset_x=0, offset_y=0, name='<point_map_layer>') self.pyslip.AddPointLayer(PointViewDataNE, placement='ne', map_rel=False, colour='green', radius=2, offset_x=0, offset_y=0, name='<point_map_layer>') self.pyslip.AddPointLayer(PointViewDataCE, placement='ce', map_rel=False, colour='black', radius=2, offset_x=0, offset_y=0, name='<point_map_layer>') self.pyslip.AddPointLayer(PointViewDataSE, placement='se', map_rel=False, colour='yellow', radius=2, offset_x=0, offset_y=0, name='<point_map_layer>') self.pyslip.AddPointLayer(PointViewDataCS, placement='cs', map_rel=False, colour='gray', radius=2, offset_x=0, offset_y=0, name='<point_map_layer>') self.pyslip.AddPointLayer(PointViewDataSW, placement='sw', map_rel=False, colour='#7f7fff', radius=2, offset_x=0, offset_y=0, name='<point_map_layer>') self.pyslip.AddPointLayer(PointViewDataCW, placement='cw', map_rel=False, colour='#ff7f7f', radius=2, offset_x=0, offset_y=0, name='<point_map_layer>') self.pyslip.AddPointLayer(PointViewDataCC, placement='cc', map_rel=False, colour='#7fff7f', radius=2, offset_x=0, offset_y=0, name='<point_map_layer>') # set initial view position wx.CallLater(25, self.final_setup, InitViewLevel, InitViewPosition)
def __init__(self): super().__init__(None, title='JC Geotag Tool') self.panel = wx.Panel(self, wx.ID_ANY) self.panel.SetBackgroundColour(wx.WHITE) self.panel.ClearBackground() all_display = wx.BoxSizer(wx.HORIZONTAL) self.panel.SetSizer(all_display) obj = __import__('pyslip', globals(), locals(), ['stamen_transport']) tileset = getattr(obj, 'stamen_transport') tile_obj = tileset.Tiles() # put map view in left of horizontal box self.pyslip = pyslip.pySlip(self.panel, tile_src=tile_obj, style=wx.SIMPLE_BORDER) all_display.Add(self.pyslip, proportion=1, flag=wx.EXPAND) # add controls at right controls = self.make_gui_controls(self.panel) all_display.Add(controls, proportion=0) self.panel.SetSizerAndFit(all_display) self.pyslip.Bind(pyslip.EVT_PYSLIP_LEVEL, self.level_change_event) self.pyslip.Bind(pyslip.EVT_PYSLIP_POSITION, self.mouse_posn_event) self.pyslip.Bind(wx.EVT_RIGHT_DOWN, self.right_click_event) original_img = '550D_2020-08-28_IMG_7103.jpg' thumb_img = '550D_2020-08-28_IMG_7103.jpg.thumb' img = Image.open(original_img) img.thumbnail((64, 64), Image.ANTIALIAS) img.save('550D_2020-08-28_IMG_7103.jpg.thumb', "JPEG") ShipImg = thumb_img ImageData = [ (120.0, 24.0, ShipImg, {'placement': 'cc'}), # Venus - 1826 (120.1, 24.1, ShipImg, {'placement': 'ne'}), # Wolverine - 1879 (120.2, 24.2, ShipImg, {'placement': 'nw'}), # Thomas Day - 1884 (120.3, 24.3, ShipImg, {'placement': 'sw'}), # Sybil - 1902 (120.4, 24.4, ShipImg, {'placement': 'se'}), # Prince of Denmark - 1863 (120.5, 24.5, ShipImg), # Moltke - 1911 (120.6, 24.6, ShipImg) ] MRShowLevels = [3, 4, 5, 6, 7, 8, 9, 10] self.image_layer = \ self.pyslip.AddImageLayer(ImageData, map_rel=True, visible=True, delta=10, show_levels=MRShowLevels, name='<image_layer>') self.point_layer = None self.pyslip.GotoLevelAndPosition(8, (118.01, 26.01)) self.last_clicked_loc = None self.Centre() self.Show() self.Maximize(True)