[QGIS Commit] r10517 - trunk/qgis/src/app

svn_qgis at osgeo.org svn_qgis at osgeo.org
Thu Apr 9 09:38:18 EDT 2009


Author: mhugent
Date: 2009-04-09 09:38:18 -0400 (Thu, 09 Apr 2009)
New Revision: 10517

Modified:
   trunk/qgis/src/app/qgsmaptooladdvertex.cpp
Log:
Fix for bug #1570, move vertex after add vertex introduces new vertices when snapping is active

Modified: trunk/qgis/src/app/qgsmaptooladdvertex.cpp
===================================================================
--- trunk/qgis/src/app/qgsmaptooladdvertex.cpp	2009-04-09 12:57:45 UTC (rev 10516)
+++ trunk/qgis/src/app/qgsmaptooladdvertex.cpp	2009-04-09 13:38:18 UTC (rev 10517)
@@ -96,7 +96,25 @@
       int topologicalEditing = QgsProject::instance()->readNumEntry( "Digitizing", "/TopologicalEditing", 0 );
       if ( topologicalEditing )
       {
-        insertSegmentVerticesForSnap( snapResults, vlayer );
+        //ignore the snapping results that are on features / segments already considered in mRecentSnappingResults
+        QList<QgsSnappingResult> filteredSnapResults = snapResults;
+        QList<QgsSnappingResult>::iterator recentIt = mRecentSnappingResults.begin();
+        for(; recentIt != mRecentSnappingResults.end(); ++recentIt)
+        {
+            QList<QgsSnappingResult>::iterator filterIt = filteredSnapResults.begin();
+            for(; filterIt != filteredSnapResults.end(); ++filterIt)
+            {
+                if(filterIt->snappedAtGeometry == recentIt->snappedAtGeometry \
+                    && filterIt->snappedVertexNr == recentIt->snappedVertexNr \
+                    && filterIt->beforeVertexNr == recentIt->beforeVertexNr )
+                {
+                    filteredSnapResults.erase(filterIt);
+                    continue;
+                }
+
+            }
+        }
+        insertSegmentVerticesForSnap( filteredSnapResults, vlayer );
       }
 
       snappedPointMapCoord = snapPointFromResults( snapResults, e->pos() );



More information about the QGIS-commit mailing list