예제 #1
0
    def edit_feature(self):

        translated_strings = self.translatable_config_strings.get_translatable_config_strings()

        layer = None
        if self.type_geometry_creation == "digitizing_polygon":
            layer = self._layers[self.EDITING_LAYER_NAME]
        elif self.type_geometry_creation == "digitizing_line":
            # Add Memory line layer
            self.temporal_layer = QgsVectorLayer("MultiLineString?crs={}".format(get_crs_authid(self._layers[self.EDITING_LAYER_NAME].sourceCrs())), translated_strings[RIGHT_OF_WAY_LINE_LAYER], "memory")
            layer = self.temporal_layer
            QgsProject.instance().addMapLayer(self.temporal_layer, True)
        else:
            return

        if layer:
            self.iface.layerTreeView().setCurrentLayer(layer)
            self._layers[self.EDITING_LAYER_NAME].committedFeaturesAdded.connect(self.finish_feature_creation)

            # Disable transactions groups
            QgsProject.instance().setAutoTransaction(False)

            # Activate snapping
            self.app.core.active_snapping_all_layers(tolerance=9)
            self.open_form(layer)

            self.logger.info_msg(__name__, QCoreApplication.translate("WizardTranslations",
                "You can now start capturing {} digitizing on the map...").format(self.WIZARD_FEATURE_NAME))
예제 #2
0
    def get_memory_line_layer(self, base_layer):
        translated_strings = self.__translatable_config_strings.get_translatable_config_strings()
        # Add Memory line layer
        temporal_layer = QgsVectorLayer(
            "MultiLineString?crs={}".format(get_crs_authid(base_layer.sourceCrs())),
            translated_strings[RIGHT_OF_WAY_LINE_LAYER], "memory")

        return temporal_layer
 def crs_changed(self):
     self.crs = get_crs_authid(self.crsSelector.crs())
     if self.crs != DEFAULT_SRS_AUTHID:
         self.lbl_crs.setStyleSheet('color: orange')
         self.lbl_crs.setToolTip(QCoreApplication.translate("WizardTranslations",
             "Your CSV data will be reprojected for you to '{}' (Colombian National Origin),<br>before attempting to import it into LADM-COL.").format(DEFAULT_SRS_AUTHID))
     else:
         self.lbl_crs.setStyleSheet('')
         self.lbl_crs.setToolTip(QCoreApplication.translate("WizardTranslations", "Coordinate Reference System"))
 def import_layer_changed(self, layer):
     if layer:
         crs = get_crs_authid(layer.crs())
         if crs != DEFAULT_SRS_AUTHID:
             self.lbl_refactor_source.setStyleSheet('color: orange')
             self.lbl_refactor_source.setToolTip(QCoreApplication.translate("WizardTranslations",
                                                                "This layer will be reprojected for you to '{}' (Colombian National Origin),<br>before attempting to import it into LADM-COL.").format(
                 DEFAULT_SRS_AUTHID))
         else:
             self.lbl_refactor_source.setStyleSheet('')
             self.lbl_refactor_source.setToolTip('')
 def crs_changed(self):
     self.srs_auth, self.srs_code = get_crs_authid(
         self.crsSelector.crs()).split(":")
     if self.srs_code != DEFAULT_SRS_CODE or self.srs_auth != DEFAULT_SRS_AUTH:
         self.crs_label.setStyleSheet('color: orange')
         self.crs_label.setToolTip(
             QCoreApplication.translate(
                 "DialogImportSchema",
                 "The {} (Colombian National Origin) is recommended,<br>since official models were created for that projection."
             ).format(DEFAULT_SRS_AUTHID))
     else:
         self.crs_label.setStyleSheet('')
         self.crs_label.setToolTip(
             QCoreApplication.translate("DialogImportSchema",
                                        "Coordinate Reference System"))