Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A couple of tracker fixes #5236

Merged
merged 2 commits into from
May 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions src/core/rubberbandmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -344,15 +344,15 @@ void RubberbandModel::setDataFromGeometry( QgsGeometry geometry, const QgsCoordi
{
break;
}

// skip last vertex on polygon, as it's duplicate of the last one
if ( geometry.type() == Qgis::GeometryType::Polygon && vertexId.vertex == abstractGeom->vertexCount() )
{
continue;
}

mPointList << pt;
}

// for polygons, remove the last vertex which is a duplicate of the first vertex
if ( geometry.type() == Qgis::GeometryType::Polygon )
{
mPointList.removeLast();
}

// insert the last point twice so the resutling rubberband's current coordinate property being modified (by e.g.
// the GNSS position) will not replace the last vertex from the passed geometry
mPointList << mPointList.last();
Expand Down
12 changes: 7 additions & 5 deletions src/qml/TrackerSettings.qml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ Popup {
trackerSettings.focus = true
} else {
featureModel.resetAttributes()
featureModel.applyGeometry()
tracker.feature = featureModel.feature

if (embeddedAttributeFormModel.rowCount() > 0 && !featureModel.suppressFeatureForm()) {
Expand All @@ -45,6 +46,7 @@ Popup {
projectInfo.saveTracker(featureModel.currentLayer)
}
}
tracker = undefined
}
}
}
Expand Down Expand Up @@ -485,6 +487,7 @@ Popup {
onClicked: {
applySettings()
featureModel.resetAttributes()
featureModel.applyGeometry()
tracker.feature = featureModel.feature
if (embeddedAttributeFormModel.rowCount() > 0 && !featureModel.suppressFeatureForm()) {
embeddedFeatureForm.active = true
Expand All @@ -494,6 +497,7 @@ Popup {
if (featureModel.currentLayer.geometryType === Qgis.GeometryType.Point) {
projectInfo.saveTracker(featureModel.currentLayer)
}
tracker = undefined
trackerSettings.close()
}
}
Expand Down Expand Up @@ -526,11 +530,7 @@ Popup {
id: featureModel
project: qgisProject

geometry: Geometry {
id: featureModelGeometry
rubberbandModel: rubberbandModel
vectorLayer: featureModel.currentLayer
}
geometry: Geometry {}

positionInformation: coordinateLocator.positionInformation
positionLocked: true
Expand Down Expand Up @@ -590,6 +590,7 @@ Popup {
if (featureModel.currentLayer.geometryType === Qgis.GeometryType.Point) {
projectInfo.saveTracker(featureModel.currentLayer)
}
tracker = undefined
trackerSettings.close()
}

Expand All @@ -598,6 +599,7 @@ Popup {
embeddedFeatureForm.active = false
embeddedFeatureForm.focus = false
trackingModel.stopTracker(tracker.vectorLayer)
tracker = undefined
trackerSettings.close()
}
}
Expand Down
Loading