[geos-commits] r3523 - in trunk: include/geos/noding/snapround
src/noding/snapround tests/unit/operation/buffer
svn_geos at osgeo.org
svn_geos at osgeo.org
Wed Nov 30 04:45:49 EST 2011
Author: strk
Date: 2011-11-30 01:45:49 -0800 (Wed, 30 Nov 2011)
New Revision: 3523
Modified:
trunk/include/geos/noding/snapround/MCIndexSnapRounder.h
trunk/src/noding/snapround/MCIndexSnapRounder.cpp
trunk/tests/unit/operation/buffer/BufferOpTest.cpp
Log:
Fix MCIndexSnapRounder use of provided precision model.
Fixes bug #473 (RightmostEdgeFinder assertion failure).
Includes regression test.
Modified: trunk/include/geos/noding/snapround/MCIndexSnapRounder.h
===================================================================
--- trunk/include/geos/noding/snapround/MCIndexSnapRounder.h 2011-11-29 14:01:56 UTC (rev 3522)
+++ trunk/include/geos/noding/snapround/MCIndexSnapRounder.h 2011-11-30 09:45:49 UTC (rev 3523)
@@ -12,7 +12,7 @@
*
**********************************************************************
*
- * Last port: noding/snapround/MCIndexSnapRounder.java r320 (JTS-1.12)
+ * Last port: noding/snapround/MCIndexSnapRounder.java r480 (JTS-1.12)
*
**********************************************************************/
@@ -80,7 +80,9 @@
pm(nPm),
scaleFactor(nPm.getScale()),
pointSnapper(0)
- {}
+ {
+ li.setPrecisionModel(&pm);
+ }
std::vector<SegmentString*>* getNodedSubstrings() const {
return NodedSegmentString::getNodedSubstrings(*nodedSegStrings);
Modified: trunk/src/noding/snapround/MCIndexSnapRounder.cpp
===================================================================
--- trunk/src/noding/snapround/MCIndexSnapRounder.cpp 2011-11-29 14:01:56 UTC (rev 3522)
+++ trunk/src/noding/snapround/MCIndexSnapRounder.cpp 2011-11-30 09:45:49 UTC (rev 3523)
@@ -12,7 +12,7 @@
*
**********************************************************************
*
- * Last port: noding/snapround/MCIndexSnapRounder.java r320 (JTS-1.12)
+ * Last port: noding/snapround/MCIndexSnapRounder.java r480 (JTS-1.12)
*
**********************************************************************/
Modified: trunk/tests/unit/operation/buffer/BufferOpTest.cpp
===================================================================
--- trunk/tests/unit/operation/buffer/BufferOpTest.cpp 2011-11-29 14:01:56 UTC (rev 3522)
+++ trunk/tests/unit/operation/buffer/BufferOpTest.cpp 2011-11-30 09:45:49 UTC (rev 3523)
@@ -305,5 +305,49 @@
ensure(gBuffer2->equals(gBuffer1.get()));
}
+ // Test for ticket #473
+ template<>
+ template<>
+ void object::test<11>()
+ {
+ using geos::operation::buffer::BufferOp;
+ using geos::operation::buffer::BufferParameters;
+
+ std::string wkt0("\
+MULTILINESTRING( \
+ (-22720.6801580484 130376.223341197, \
+ -22620.6136206117 130339.222540348, \
+ -22620.6133224902 130339.333510463), \
+ (-22720.3807106115 130487.193473695, \
+ -22620.3154956134 130450.192663993, \
+ -22620.3151974850 130450.303634126), \
+ (-22620.6133224902 130339.333510463, -22620.6127262471 130339.555450692), \
+ (-22620.1376011539 130450.303157004, -22620.3151974850 130450.303634126), \
+ (-22620.3151974850 130450.303634126, -22620.3146012281 130450.525574392), \
+ (-21480.3713729115 130150.471377565, \
+ -21481.6134583498 130150.918429232, \
+ -21482.5899891895 130151.031891269, \
+ -21480.9946803241 130149.807142948), \
+ (-21477.6185334698 130150.464355720,\
+ -21478.0611246018 130151.020338484, \
+ -21377.8977465929 130114.034129489) \
+) \
+ ");
+
+ GeomPtr g0(wktreader.read(wkt0));
+
+ BufferParameters params(8, BufferParameters::CAP_SQUARE,
+ BufferParameters::JOIN_MITRE,
+ 1.0);
+ const double distance = 5.0;
+ BufferOp op(g0.get(), params);
+ GeomPtr gBuffer(op.getResultGeometry(distance));
+
+ // We're basically only interested an rough sense of a
+ // meaningful result.
+ ensure_equals(gBuffer->getNumPoints(), std::size_t(46));
+ ensure_equals(int(gBuffer->getArea()), 3520);
+ }
+
} // namespace tut
More information about the geos-commits
mailing list