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

svn_geos at osgeo.org svn_geos at osgeo.org
Wed Apr 8 09:16:37 EDT 2009


Author: strk
Date: 2009-04-08 09:16:37 -0400 (Wed, 08 Apr 2009)
New Revision: 2326

Modified:
   trunk/source/headers/geos/noding/snapround/SimpleSnapRounder.h
   trunk/source/noding/snapround/SimpleSnapRounder.cpp
Log:
Complete porting of SimpleSnapRounder (refactoring for adding snapped nodes)

Modified: trunk/source/headers/geos/noding/snapround/SimpleSnapRounder.h
===================================================================
--- trunk/source/headers/geos/noding/snapround/SimpleSnapRounder.h	2009-04-08 13:02:06 UTC (rev 2325)
+++ trunk/source/headers/geos/noding/snapround/SimpleSnapRounder.h	2009-04-08 13:16:37 UTC (rev 2326)
@@ -125,19 +125,6 @@
 	void add(const SegmentString* segStr);
 
 	/**
-	 * Adds a new node (equal to the snap pt) to the segment if the segment
-	 * passes through the hot pixel.
-	 *
-	 * @param hotPix
-	 * @param segStr
-	 * @param segIndex
-	 * @return <code>true</code> if a node was added
-	 */
-	static bool addSnappedNode(const HotPixel& hotPix,
-			NodedSegmentString& segStr,
-			unsigned int segIndex);
-
-	/**
 	 * Computes nodes introduced as a result of
 	 * snapping segments to vertices of other segments
 	 *

Modified: trunk/source/noding/snapround/SimpleSnapRounder.cpp
===================================================================
--- trunk/source/noding/snapround/SimpleSnapRounder.cpp	2009-04-08 13:02:06 UTC (rev 2325)
+++ trunk/source/noding/snapround/SimpleSnapRounder.cpp	2009-04-08 13:16:37 UTC (rev 2326)
@@ -117,30 +117,11 @@
 		const Coordinate& snapPt = *it;
 		HotPixel hotPixel(snapPt, scaleFactor, li);
 		for (int i=0, n=ss->size()-1; i<n; ++i) {
-			addSnappedNode(hotPixel, *ss, i);
+			hotPixel.addSnappedNode(*ss, i);
 		}
 	}
 }
 
-/* public static */
-bool
-SimpleSnapRounder::addSnappedNode(const HotPixel& hotPix,
-		NodedSegmentString& segStr, unsigned int segIndex)
-{
-	const Coordinate& p0 = segStr.getCoordinate(segIndex);
-	const Coordinate& p1 = segStr.getCoordinate(segIndex + 1);
-
-	if (hotPix.intersects(p0, p1)) {
-		//cerr<<"snapped: "<<snapPt<<endl;
-		//cerr<<"POINT ("<<snapPt.x<<" "<<snapPt.y<<")"<<endl;
-		segStr.addIntersection(hotPix.getCoordinate(), segIndex);
-
-		return true;
-	}
-
-	return false;
-}
-
 /*private*/
 void
 SimpleSnapRounder::computeVertexSnaps(NodedSegmentString* e0, NodedSegmentString* e1)
@@ -160,7 +141,7 @@
 				continue;
 			}
 //cerr<<"trying "<<p0<<" against "<<pts1->getAt(i1)<<" "<<pts1->getAt(i1 + 1)<<endl;
-			bool isNodeAdded = addSnappedNode(hotPixel, *e1, i1);
+			bool isNodeAdded = hotPixel.addSnappedNode(*e1, i1);
 			// if a node is created for a vertex, that vertex must be noded too
 			if (isNodeAdded) {
 				e0->addIntersection(p0, i0);



More information about the geos-commits mailing list