[geos-commits] r3629 - trunk/src/operation/polygonize

svn_geos at osgeo.org svn_geos at osgeo.org
Mon May 14 15:03:44 EDT 2012


Author: strk
Date: 2012-05-14 12:03:44 -0700 (Mon, 14 May 2012)
New Revision: 3629

Modified:
   trunk/src/operation/polygonize/EdgeRing.cpp
Log:
Reduce calls to ptNotInList, greatly speeding up Polygonizer (#545)

Modified: trunk/src/operation/polygonize/EdgeRing.cpp
===================================================================
--- trunk/src/operation/polygonize/EdgeRing.cpp	2012-05-14 19:00:04 UTC (rev 3628)
+++ trunk/src/operation/polygonize/EdgeRing.cpp	2012-05-14 19:03:44 UTC (rev 3629)
@@ -70,12 +70,17 @@
 		const CoordinateSequence *tryCoords =
 			tryRing->getCoordinatesRO();
 
-		testPt=ptNotInList(testRing->getCoordinatesRO(),
-			tryCoords);
+		if ( tryEnv->contains(testEnv) ) {
 
-		if (tryEnv->contains(testEnv)
-			&& CGAlgorithms::isPointInRing(testPt, tryCoords))
+			// TODO: don't copy testPt !
+			testPt = ptNotInList(testRing->getCoordinatesRO(), tryCoords);
+
+			if ( CGAlgorithms::isPointInRing(testPt, tryCoords) ) {
 				isContained=true;
+			}
+
+    }
+
 		// check if this new containing ring is smaller
 		// than the current minimum ring
 		if (isContained) {
@@ -96,6 +101,7 @@
     for (std::size_t i = 0; i < npts; ++i)
     {
         const Coordinate& testPt = testPts->getAt(i);
+        // TODO: shouldn't this be ! isInList ?
         if (isInList(testPt, pts))
             return testPt;
     }



More information about the geos-commits mailing list