Skip to content

Commit

Permalink
refactor(ReshapeMapTool): resize, not overwrite
Browse files Browse the repository at this point in the history
So we keep the existing snapping matches
  • Loading branch information
troopa81 committed Sep 18, 2024
1 parent c3c3ccc commit 5480379
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/gui/maptools/qgsmaptoolcapture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,10 @@ bool QgsMapToolCapture::tracingAddVertex( const QgsPointXY &point )
// Curves de-approximation
if ( QgsSettingsRegistryCore::settingsDigitizingConvertToCurve->value() )
{
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
int pointBefore = mCaptureCurve.numPoints();
#endif

// If the tool and the layer support curves
QgsVectorLayer *vlayer = qobject_cast<QgsVectorLayer *>( layer() );
if ( vlayer && capabilities().testFlag( QgsMapToolCapture::Capability::SupportsCurves ) && vlayer->dataProvider()->capabilities().testFlag( Qgis::VectorProviderCapability::CircularGeometries ) )
Expand All @@ -344,7 +348,14 @@ bool QgsMapToolCapture::tracingAddVertex( const QgsPointXY &point )
}

#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
mSnappingMatches = QVector( mCaptureCurve.numPoints(), QgsPointLocator::Match() ).toList();
// sync the snapping matches list
const int pointAfter = mCaptureCurve.numPoints();

for ( ; pointBefore < pointAfter; ++pointBefore )
mSnappingMatches.append( QgsPointLocator::Match() );

for ( ; pointBefore > pointAfter; --pointBefore )
mSnappingMatches.removeLast();
#else
mSnappingMatches.resize( mCaptureCurve.numPoints() );
#endif
Expand Down

0 comments on commit 5480379

Please sign in to comment.