def __init__(self, tile_dir):
        super().__init__()

        self.tile_directory = tile_dir
        self.tile_source = Tiles.Tiles()

        # build the GUI
        hbox = QHBoxLayout()

        qwidget = QWidget(self)
        qwidget.setLayout(hbox)
        self.setCentralWidget(qwidget)

        self.pyslipqt = pySlipQt.PySlipQt(self,
                                          tile_src=self.tile_source,
                                          start_level=MinTileLevel)
        hbox.addWidget(self.pyslipqt)

        # set the size of the demo window, etc
        self.setGeometry(100, 100, DemoWidth, DemoHeight)
        self.setWindowTitle(DemoName)

        # add test layers
        # add test test layer
        self.text_layer = self.pyslipqt.AddTextLayer(TextMapData,
                                                     map_rel=True,
                                                     name='<text_map_layer>',
                                                     offset_x=5,
                                                     offset_y=1)

        self.show()

        # finally, set initial view position
        self.pyslipqt.GotoLevelAndPosition(InitViewLevel, InitViewPosition)
Example #2
0
    def __init__(self, tiles):
        super().__init__()

        self.setGeometry(300, 300, DemoWidth, DemoHeight)
        self.setWindowTitle(DemoName)
        self.show()

        # create the tile source object
        self.tile_src = tiles.Tiles()

        # build the GUI
        box = QHBoxLayout()
        box.setContentsMargins(1, 1, 1, 1)

        qwidget = QWidget(self)
        qwidget.setLayout(box)
        self.setCentralWidget(qwidget)

        self.pyslipqt = pySlipQt.PySlipQt(self,
                                          tile_src=self.tile_src,
                                          start_level=InitViewLevel)
        box.addWidget(self.pyslipqt)

        self.show()

        # bind the pySlipQt widget to the "zoom undo" method
        self.pyslipqt.events.EVT_PYSLIPQT_LEVEL.connect(self.on_zoom)

        # set initial view position
        self.pyslipqt.GotoLevelAndPosition(InitViewLevel, InitViewPosition)
    def __init__(self, tile_dir):
        super().__init__()

        self.tile_directory = tile_dir
        self.tile_source = Tiles.Tiles()

        # build the GUI
        hbox = QHBoxLayout()

        qwidget = QWidget(self)
        qwidget.setLayout(hbox)
        self.setCentralWidget(qwidget)

        self.pyslipqt = pySlipQt.PySlipQt(self, tile_src=self.tile_source,
                                          start_level=MinTileLevel)
        hbox.addWidget(self.pyslipqt)

        # set the size of the demo window, etc
        self.setGeometry(100, 100, DemoWidth, DemoHeight)
        self.setWindowTitle(DemoName)

        # add test layers
        self.poly_layer = self.pyslipqt.AddPolygonLayer(PolygonMapData)
        self.image_layer = self.pyslipqt.AddImageLayer(ImageMapData,
                                                     map_rel=True,
                                                     placement='ce',
                                                     name='<image_map_layer>')

        self.show()

        # set initial view position
        self.pyslipqt.GotoLevelAndPosition(InitViewLevel, InitViewPosition)
    def __init__(self, tile_dir):
        super().__init__()

        self.tile_directory = tile_dir

        # 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
        grid = QGridLayout()

        qwidget = QWidget(self)
        qwidget.setLayout(grid)
        self.setCentralWidget(qwidget)

        self.pyslipqt1 = pySlipQt.PySlipQt(self,
                                           tile_src=gmt_tile_src_1,
                                           start_level=MinTileLevel)
        grid.addWidget(self.pyslipqt1, 0, 0)
        self.pyslipqt2 = pySlipQt.PySlipQt(self,
                                           tile_src=osm_tile_src_1,
                                           start_level=MinTileLevel)
        grid.addWidget(self.pyslipqt2, 0, 1)
        self.pyslipqt3 = pySlipQt.PySlipQt(self,
                                           tile_src=osm_tile_src_2,
                                           start_level=MinTileLevel)
        grid.addWidget(self.pyslipqt3, 1, 0)
        self.pyslipqt4 = pySlipQt.PySlipQt(self,
                                           tile_src=gmt_tile_src_2,
                                           start_level=MinTileLevel)
        grid.addWidget(self.pyslipqt4, 1, 1)

        # set the size of the demo window, etc
        self.setGeometry(100, 100, DemoWidth, DemoHeight)
        self.setWindowTitle(DemoName)

        # set initial view position
        #        gmt_tile_src_1.GotoLevelAndPosition(InitViewLevel, InitViewPosition)
        #        gmt_tile_src_2.GotoLevelAndPosition(InitViewLevel, InitViewPosition)
        #        osm_tile_src_1.GotoLevelAndPosition(InitViewLevel, InitViewPosition)
        #        osm_tile_src_2.GotoLevelAndPosition(InitViewLevel, InitViewPosition)

        self.show()
Example #5
0
    def __init__(self, tile_dir=TileDirectory):
        super().__init__()

        self.tile_directory = tile_dir
        self.tile_source = Tiles.Tiles()

        # variables for layer IDs
        self.poly_map_layer = None
        self.poly_view_layer = None

        # build the GUI
        grid = QGridLayout()
        grid.setColumnStretch(0, 1)
        grid.setContentsMargins(2, 2, 2, 2)

        qwidget = QWidget(self)
        qwidget.setLayout(grid)
        self.setCentralWidget(qwidget)

        # build the 'controls' part of GUI
        num_rows = self.make_gui(grid)

        self.pyslipqt = pySlipQt.PySlipQt(self,
                                          tile_src=self.tile_source,
                                          start_level=MinTileLevel)
        grid.addWidget(self.pyslipqt, 0, 0, num_rows + 1, 1)
        grid.setRowStretch(num_rows, 1)

        # set the size of the demo window, etc
        self.setGeometry(100, 100, DemoWidth, DemoHeight)
        self.setWindowTitle(DemoName)

        # tie events from controls to handlers
        self.map_poly.remove.connect(self.remove_poly_map)
        self.map_poly.change.connect(self.change_poly_map)

        self.view_poly.remove.connect(self.remove_poly_view)
        self.view_poly.change.connect(self.change_poly_view)

        self.pyslipqt.events.EVT_PYSLIPQT_LEVEL.connect(
            self.handle_level_change)
        self.pyslipqt.events.EVT_PYSLIPQT_POSITION.connect(
            self.handle_position_event)

        self.map_level.set_text('0')

        self.show()

        # set initial view position
        self.map_level.set_text('%d' % InitViewLevel)
        self.pyslipqt.GotoLevelAndPosition(InitViewLevel, InitViewPosition)
    def make_gui(self):
        """Create application GUI."""

        # build the GUI
        grid = QGridLayout()

        qwidget = QWidget(self)
        qwidget.setLayout(grid)
        self.setCentralWidget(qwidget)

        # add controls to right of spacer
        rows = self.make_gui_controls(grid)
        #        grid.addLayout(controls)

        # put map view in left of horizontal box
        self.pyslipqt = pySlipQt.PySlipQt(self,
                                          start_level=InitViewLevel,
                                          tile_src=self.tile_source)
        grid.addWidget(self.pyslipqt, 0, 0, rows + 1, 1)