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

Tracker fixes #4672

Merged
merged 2 commits into from
Oct 21, 2023
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
7 changes: 5 additions & 2 deletions src/core/layertreemapcanvasbridge.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,9 @@ void LayerTreeMapCanvasBridge::mapThemeChanged()

void LayerTreeMapCanvasBridge::layerInTrackingChanged( QgsVectorLayer *layer, bool tracking )
{
QgsLayerTreeLayer *nodeLayer = mRoot->findLayer( layer->id() );
mModel->setLayerInTracking( nodeLayer, tracking );
if ( layer )
{
QgsLayerTreeLayer *nodeLayer = mRoot->findLayer( layer->id() );
mModel->setLayerInTracking( nodeLayer, tracking );
}
}
3 changes: 3 additions & 0 deletions src/core/rubberbandmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,9 @@ void RubberbandModel::setDataFromGeometry( QgsGeometry geometry, const QgsCoordi

mPointList << pt;
}
// 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 << pt;

mCurrentCoordinateIndex = mPointList.size() - 1;

Expand Down
11 changes: 6 additions & 5 deletions src/qml/LayerTreeItemProperties.qml
Original file line number Diff line number Diff line change
Expand Up @@ -297,18 +297,19 @@ Popup {
icon.source: Theme.getThemeVectorIcon( 'directions_walk_24dp' )

onClicked: {
var layer = layerTree.data(index, FlatLayerTreeModel.VectorLayerPointer)
close()

if ( trackingModel.layerInTracking( layerTree.data(index, FlatLayerTreeModel.VectorLayerPointer) ) ) {
trackingModel.stopTracker(layerTree.data(index, FlatLayerTreeModel.VectorLayerPointer));
displayToast( qsTr( 'Track on layer %1 stopped' ).arg( layerTree.data(index, FlatLayerTreeModel.VectorLayerPointer).name ) )
if (trackingModel.layerInTracking(layer)) {
trackingModel.stopTracker(layer);
displayToast(qsTr('Track on layer %1 stopped').arg(layer.name))
} else {
var tracker;
var idx = projectInfo.restoreTracker(layerTree.data(index, FlatLayerTreeModel.VectorLayerPointer))
var idx = projectInfo.restoreTracker(layer)
if (idx.valid) {
tracker = trackings.itemAt(idx.row).tracker
} else {
idx = trackingModel.createTracker(layerTree.data(index, FlatLayerTreeModel.VectorLayerPointer))
idx = trackingModel.createTracker(layer)
tracker = trackings.itemAt(idx.row).tracker
tracker.visible = itemVisibleCheckBox.checked
tracker.minimumDistance = positioningSettings.trackerMinimumDistanceConstraint ? positioningSettings.trackerMinimumDistance : 0
Expand Down
Loading