[geos-commits] r3814 - trunk/src/operation/overlay/snap

svn_geos at osgeo.org svn_geos at osgeo.org
Fri Jun 7 02:29:05 PDT 2013


Author: strk
Date: 2013-06-07 02:29:05 -0700 (Fri, 07 Jun 2013)
New Revision: 3814

Modified:
   trunk/src/operation/overlay/snap/LineStringSnapper.cpp
Log:
Simplify code looking for closer vertex snap

Modified: trunk/src/operation/overlay/snap/LineStringSnapper.cpp
===================================================================
--- trunk/src/operation/overlay/snap/LineStringSnapper.cpp	2013-06-07 09:21:56 UTC (rev 3813)
+++ trunk/src/operation/overlay/snap/LineStringSnapper.cpp	2013-06-07 09:29:05 UTC (rev 3814)
@@ -171,7 +171,7 @@
 {
 	Coordinate::ConstVect::const_iterator end = snapPts.end();
 	Coordinate::ConstVect::const_iterator candidate = end;
-	double minDist;
+	double minDist = snapTolerance;
 
 	// TODO: use std::find_if
 	for ( Coordinate::ConstVect::const_iterator
@@ -195,12 +195,10 @@
 cerr << " distance from snap point " << snapPt << ": " << dist << endl;
 #endif
 
-		if ( dist < snapTolerance )
+		if ( dist < minDist )
 		{
-      if ( candidate == end || dist < minDist ) {
-        minDist = dist;
-        candidate = it;
-      }
+      minDist = dist;
+      candidate = it;
 		}
 	}
 



More information about the geos-commits mailing list