From afbee99db25a8fe6c934a0aa81c7b08a0dc50d42 Mon Sep 17 00:00:00 2001 From: strk Date: Mon, 28 Feb 2011 12:19:22 +0000 Subject: [PATCH] Cleanup debugging output. Previous version didn't really print the _noded_ output at all. git-svn-id: http://svn.osgeo.org/geos/trunk@3251 5242fede-7e19-0410-aef8-94bd7d2200fb --- src/operation/buffer/BufferBuilder.cpp | 60 +++++++++++++++++++++------------- 1 file changed, 38 insertions(+), 22 deletions(-) diff --git a/src/operation/buffer/BufferBuilder.cpp b/src/operation/buffer/BufferBuilder.cpp index ecb70bd8..959d807a 100644 --- a/src/operation/buffer/BufferBuilder.cpp +++ b/src/operation/buffer/BufferBuilder.cpp @@ -48,6 +48,7 @@ #include #include #include +#include // for debugging #include #include @@ -76,6 +77,25 @@ using namespace geos::algorithm; using namespace geos::operation::overlay; using namespace geos::operation::linemerge; +namespace { + +// Debug routine +template +std::auto_ptr +convertSegStrings(const GeometryFactory* fact, Iterator it, Iterator et) +{ + std::vector lines; + while(it != et) { + const SegmentString* ss = *it; + LineString* line = fact->createLineString(ss->getCoordinates()); + lines.push_back(line); + ++it; + } + return std::auto_ptr(fact->buildGeometry(lines)); +} + +} + namespace geos { namespace operation { // geos.operation namespace buffer { // geos.operation.buffer @@ -373,29 +393,8 @@ BufferBuilder::buffer(const Geometry *g, double distance) std::cerr<<"BufferBuilder::buffer computing NodedEdges"<size() - << " nodes # " << segStr->getNodeList().size() - << std::endl; -} -#endif - computeNodedEdges(bufferSegStrList, precisionModel); - -#if JTS_DEBUG -std::cerr << "after noding: SegStr # " << bufferSegStrList.size() << std::endl; -for (size_t i = 0, n=bufferSegStrList.size(); isize() - << " nodes # " << segStr->getNodeList().size() - << std::endl; -} -#endif + // NOTE: bufferSegStrList should not be needed anymore from now on #if GEOS_DEBUG > 1 std::cerr << std::endl << edgeList << std::endl; @@ -499,11 +498,28 @@ BufferBuilder::computeNodedEdges(SegmentString::NonConstVect& bufferSegStrList, { Noder* noder = getNoder( precisionModel ); +#if JTS_DEBUG +geos::io::WKTWriter wktWriter; wktWriter.setTrim(true); +std::cerr << "before noding: " + << wktWriter.write( + convertSegStrings(geomFact, bufferSegStrList.begin(), + bufferSegStrList.end()).get() + ) << std::endl; +#endif + noder->computeNodes(&bufferSegStrList); SegmentString::NonConstVect* nodedSegStrings = \ noder->getNodedSubstrings(); +#if JTS_DEBUG +std::cerr << "after noding: " + << wktWriter.write( + convertSegStrings(geomFact, bufferSegStrList.begin(), + bufferSegStrList.end()).get() + ) << std::endl; +#endif + for (SegmentString::NonConstVect::iterator i=nodedSegStrings->begin(), e=nodedSegStrings->end(); -- 2.11.4.GIT