Пример #1
0
    def _vertex_selection_changed(self):
        """
        Triggered when the selected vertex is changed
        """
        selection = self.table_view.selectionModel().selectedIndexes()
        vertex_number = None
        if selection:
            selected_index = self.vertex_model.index(
                self.table_view.selectionModel().selectedIndexes()[0].row(), 0)
            if selected_index.isValid():
                vertex_number = self.vertex_model.data(
                    selected_index, VertexModel.VERTEX_NUMBER_ROLE)

                point = self.vertex_model.data(selected_index,
                                               VertexModel.VERTEX_POINT_ROLE)
                map_point = self.map_canvas.mapSettings(
                ).layerToMapCoordinates(self.layer, point)

                if SettingsRegistry.center_on_selected():
                    self.map_canvas.setCenter(QgsPointXY(map_point))
                    self.map_canvas.refresh()

                if SettingsRegistry.flash_vertex():
                    geom = QgsGeometry(map_point)
                    self.map_canvas.flashGeometries([geom])

        feature_id = None
        if self.vertex_model.feature is not None:
            feature_id = self.vertex_model.feature.id()

        self.selected_vertex_changed.emit(feature_id, vertex_number)
Пример #2
0
    def restore_settings(self):
        """
        Restores saved settings
        """
        current_label_filter = SettingsRegistry.label_filtering()
        self.filtering_combo.setCurrentIndex(self.filtering_combo.findData(current_label_filter))
        self.check_center_on_selection.setChecked(SettingsRegistry.center_on_selected())
        self.check_flash_feature.setChecked(SettingsRegistry.flash_feature())
        self.check_flash_vertex.setChecked(SettingsRegistry.flash_vertex())

        self.point_symbol_button.setSymbol(SettingsRegistry.vertex_symbol())
        self.vertex_font_button.setTextFormat(SettingsRegistry.vertex_format())
        self.number_format = SettingsRegistry.number_format()