Skip to content

Commit d89dc9d

Browse files
author
mhugent
committedSep 13, 2008
Make topological vertex moves more robust to rounding differences
git-svn-id: http://svn.osgeo.org/qgis/trunk@9312 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent d660c6d commit d89dc9d

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed
 

‎src/core/qgssnapper.cpp

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -101,15 +101,22 @@ int QgsSnapper::snapPoint( const QPoint& startPoint, QList<QgsSnappingResult>& s
101101
snappingResult.push_back( evalIt.value() );
102102
}
103103
else if ( mSnapMode == QgsSnapper::SEVERAL_RESULTS_SAME_POSITION )
104-
{
105-
104+
{
105+
//take all snapping Results within a certain tolerance because rounding differences may occur
106+
double tolerance = 0.000001;
106107
double minDistance = evalIt.key();
107-
QList<QgsSnappingResult> values = snappingResultList.values( minDistance );
108-
for ( int i = 0; i < values.size(); ++i )
109-
{
110-
snappingResult.push_back( values.at( i ) );
111-
}
108+
109+
for(evalIt = snappingResultList.begin(); evalIt != snappingResultList.end(); ++evalIt)
110+
{
111+
if(evalIt.key() > (minDistance + tolerance))
112+
{
113+
break;
114+
}
115+
snappingResult.push_back(evalIt.value());
116+
}
117+
112118
}
119+
113120
else //take all results
114121
{
115122
for ( ;evalIt != snappingResultList.end(); ++evalIt )

0 commit comments

Comments
 (0)