[QGIS Commit] r9312 - trunk/qgis/src/core

svn_qgis at osgeo.org svn_qgis at osgeo.org
Sat Sep 13 10:13:38 EDT 2008


Author: mhugent
Date: 2008-09-13 10:13:38 -0400 (Sat, 13 Sep 2008)
New Revision: 9312

Modified:
   trunk/qgis/src/core/qgssnapper.cpp
Log:
Make topological vertex moves more robust to rounding differences

Modified: trunk/qgis/src/core/qgssnapper.cpp
===================================================================
--- trunk/qgis/src/core/qgssnapper.cpp	2008-09-12 23:48:55 UTC (rev 9311)
+++ trunk/qgis/src/core/qgssnapper.cpp	2008-09-13 14:13:38 UTC (rev 9312)
@@ -101,15 +101,22 @@
     snappingResult.push_back( evalIt.value() );
   }
   else if ( mSnapMode == QgsSnapper::SEVERAL_RESULTS_SAME_POSITION )
-  {
+  {    
+    //take all snapping Results within a certain tolerance because rounding differences may occur
+    double tolerance = 0.000001;
+    double minDistance = evalIt.key();
 
-    double minDistance = evalIt.key();
-    QList<QgsSnappingResult> values = snappingResultList.values( minDistance );
-    for ( int i = 0; i < values.size(); ++i )
-    {
-      snappingResult.push_back( values.at( i ) );
-    }
+    for(evalIt = snappingResultList.begin(); evalIt != snappingResultList.end(); ++evalIt)
+      {
+	if(evalIt.key() > (minDistance + tolerance))
+	  {
+	    break;
+	  }
+	snappingResult.push_back(evalIt.value());
+      }
+    
   }
+   
   else //take all results
   {
     for ( ;evalIt != snappingResultList.end(); ++evalIt )



More information about the QGIS-commit mailing list