diff --git a/src/tools/qgepmaptooladdfeature.py b/src/tools/qgepmaptooladdfeature.py index da2646a1..ccb5f8ac 100644 --- a/src/tools/qgepmaptooladdfeature.py +++ b/src/tools/qgepmaptooladdfeature.py @@ -31,6 +31,7 @@ from builtins import range from qgis.gui import ( QgsAttributeForm, + QgsAttributeEditorContext, QgsMapToolAdvancedDigitizing, QgsMapTool, QgsRubberBand, @@ -150,7 +151,7 @@ def right_clicked(self, _): f = QgsFeature(self.layer.fields()) f.setGeometry(self.rubberband.asGeometry()) dlg = self.iface.getFeatureForm(self.layer, f) - dlg.setMode(QgsAttributeForm.AddFeatureMode) + dlg.setMode(QgsAttributeEditorContext.AddFeatureMode) dlg.exec_() self.rubberband.reset3D() self.temp_rubberband.reset() @@ -274,12 +275,12 @@ def snap(self, event): req = QgsFeatureRequest(match.featureId()) f = next(match.layer().getFeatures(req)) assert f.isValid() - if match.layer().wkbType() == QgsWkbTypes.WKBPoint25D: - point = QgsPoint(f.geometry().geometry()) + if match.layer().geometryType() == QgsWkbTypes.PointGeometry: + point = QgsPoint(f.geometry().constGet()) else: (ok, vertex_id) = f.geometry().vertexIdFromVertexNr(match.vertexIndex()) assert ok - point = f.geometry().geometry().vertexAt(vertex_id) + point = f.geometry().constGet().vertexAt(vertex_id) assert type(point) == QgsPoint return point, match else: @@ -332,7 +333,7 @@ def right_clicked(self, _): f.setAttribute(level_field_index, self.rubberband.points[pt_idx].z()) dlg = self.iface.getFeatureForm(self.layer, f) - dlg.setMode(QgsAttributeForm.AddFeatureMode) + dlg.setMode(QgsAttributeEditorContext.AddFeatureMode) dlg.exec_() self.rubberband.reset3D()