[geos-commits] r2481 - in trunk/source: headers/geos/noding noding

svn_geos at osgeo.org svn_geos at osgeo.org
Wed May 6 13:54:38 EDT 2009


Author: strk
Date: 2009-05-06 13:54:38 -0400 (Wed, 06 May 2009)
New Revision: 2481

Modified:
   trunk/source/headers/geos/noding/SegmentNodeList.h
   trunk/source/noding/SegmentNodeList.cpp
Log:
findCollapsesFromExistingVertices: don't choke on sets of < 2 points. Fixes bug #219.


Modified: trunk/source/headers/geos/noding/SegmentNodeList.h
===================================================================
--- trunk/source/headers/geos/noding/SegmentNodeList.h	2009-05-06 17:52:01 UTC (rev 2480)
+++ trunk/source/headers/geos/noding/SegmentNodeList.h	2009-05-06 17:54:38 UTC (rev 2481)
@@ -13,7 +13,7 @@
  *
  **********************************************************************
  *
- * Last port: noding/SegmentNodeList.java rev. 1.8 (JTS-1.9)
+ * Last port: noding/SegmentNodeList.java rev. 1.8 (JTS-1.10)
  *
  **********************************************************************/
 

Modified: trunk/source/noding/SegmentNodeList.cpp
===================================================================
--- trunk/source/noding/SegmentNodeList.cpp	2009-05-06 17:52:01 UTC (rev 2480)
+++ trunk/source/noding/SegmentNodeList.cpp	2009-05-06 17:54:38 UTC (rev 2481)
@@ -14,7 +14,7 @@
  *
  **********************************************************************
  *
- * Last port: noding/SegmentNodeList.java rev. 1.8 (JTS-1.9)
+ * Last port: noding/SegmentNodeList.java rev. 1.8 (JTS-1.10)
  *
  **********************************************************************/
 
@@ -120,10 +120,11 @@
 SegmentNodeList::findCollapsesFromExistingVertices(
 			std::vector<size_t>& collapsedVertexIndexes)
 {
+	if ( edge.size() < 2 ) return; // or we'll never exit the loop below
+
 	for (size_t i=0, n=edge.size()-2; i<n; ++i)
 	{
 		const Coordinate& p0 = edge.getCoordinate(i);
-		//const Coordinate& p1 = edge.getCoordinate(i + 1);
 		const Coordinate& p2 = edge.getCoordinate(i + 2);
 		if (p0.equals2D(p2)) {
 			// add base of collapse as node



More information about the geos-commits mailing list