[geos-commits] r3524 - in branches/3.3: . 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:49:58 EST 2011


Author: strk
Date: 2011-11-30 01:49:58 -0800 (Wed, 30 Nov 2011)
New Revision: 3524

Modified:
   branches/3.3/NEWS
   branches/3.3/include/geos/noding/snapround/MCIndexSnapRounder.h
   branches/3.3/src/noding/snapround/MCIndexSnapRounder.cpp
   branches/3.3/tests/unit/operation/buffer/BufferOpTest.cpp
Log:
Fix MCIndexSnapRounder use of provided precision model.

Fixes bug #473 (RightmostEdgeFinder assertion failure).
Includes regression test.

Modified: branches/3.3/NEWS
===================================================================
--- branches/3.3/NEWS	2011-11-30 09:45:49 UTC (rev 3523)
+++ branches/3.3/NEWS	2011-11-30 09:49:58 UTC (rev 3524)
@@ -7,6 +7,7 @@
     - Fix noding of self-intersecting lines through UnaryUnion (#482)
     - Fix handling of collapsed edges skipping in BufferOp (#494)
     - Print up to 18 digits of precision for TopologyException points
+    - Fix noding with reduced precision in Buffer operation (#473)
 
 Changes in 3.3.1
 2011-09-27

Modified: branches/3.3/include/geos/noding/snapround/MCIndexSnapRounder.h
===================================================================
--- branches/3.3/include/geos/noding/snapround/MCIndexSnapRounder.h	2011-11-30 09:45:49 UTC (rev 3523)
+++ branches/3.3/include/geos/noding/snapround/MCIndexSnapRounder.h	2011-11-30 09:49:58 UTC (rev 3524)
@@ -13,7 +13,7 @@
  *
  **********************************************************************
  *
- * Last port: noding/snapround/MCIndexSnapRounder.java r320 (JTS-1.12)
+ * Last port: noding/snapround/MCIndexSnapRounder.java r480 (JTS-1.12)
  *
  **********************************************************************/
 
@@ -81,7 +81,9 @@
 		pm(nPm),
 		scaleFactor(nPm.getScale()),
 		pointSnapper(0)
-  {}
+  {
+    li.setPrecisionModel(&pm);
+  }
 
 	std::vector<SegmentString*>* getNodedSubstrings() const {
 	  return NodedSegmentString::getNodedSubstrings(*nodedSegStrings);

Modified: branches/3.3/src/noding/snapround/MCIndexSnapRounder.cpp
===================================================================
--- branches/3.3/src/noding/snapround/MCIndexSnapRounder.cpp	2011-11-30 09:45:49 UTC (rev 3523)
+++ branches/3.3/src/noding/snapround/MCIndexSnapRounder.cpp	2011-11-30 09:49:58 UTC (rev 3524)
@@ -13,7 +13,7 @@
  *
  **********************************************************************
  *
- * Last port: noding/snapround/MCIndexSnapRounder.java r320 (JTS-1.12)
+ * Last port: noding/snapround/MCIndexSnapRounder.java r480 (JTS-1.12)
  *
  **********************************************************************/
 

Modified: branches/3.3/tests/unit/operation/buffer/BufferOpTest.cpp
===================================================================
--- branches/3.3/tests/unit/operation/buffer/BufferOpTest.cpp	2011-11-30 09:45:49 UTC (rev 3523)
+++ branches/3.3/tests/unit/operation/buffer/BufferOpTest.cpp	2011-11-30 09:49:58 UTC (rev 3524)
@@ -270,5 +270,49 @@
         ensure(gBuffer->getNumPoints() >= std::size_t(5));
     }
 
+    // Test for ticket #473
+    template<>
+    template<>
+    void object::test<10>()
+    {
+        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