[geos-commits] r3243 - in trunk: . src/operation/buffer tests/xmltester/tests/general

svn_geos at osgeo.org svn_geos at osgeo.org
Wed Feb 23 11:21:24 EST 2011


Author: strk
Date: 2011-02-23 08:21:24 -0800 (Wed, 23 Feb 2011)
New Revision: 3243

Modified:
   trunk/NEWS
   trunk/src/operation/buffer/OffsetCurveSetBuilder.cpp
   trunk/tests/xmltester/tests/general/TestBuffer.xml
Log:
Fixed buffer OffsetCurveSetBuilder to handle "flat" rings correctly

Modified: trunk/NEWS
===================================================================
--- trunk/NEWS	2011-02-23 15:45:51 UTC (rev 3242)
+++ trunk/NEWS	2011-02-23 16:21:24 UTC (rev 3243)
@@ -35,6 +35,7 @@
   - Fixed LineMerger to skip lines with only a single unique coordinate
   - Fix NodedSegmentString to handle zero-length line segments correctly
     (via safeOctant)
+  - Fixed buffer OffsetCurveSetBuilder to handle "flat" rings correctly
 
 Changes in 3.2.0 
 2009-12-14

Modified: trunk/src/operation/buffer/OffsetCurveSetBuilder.cpp
===================================================================
--- trunk/src/operation/buffer/OffsetCurveSetBuilder.cpp	2011-02-23 15:45:51 UTC (rev 3242)
+++ trunk/src/operation/buffer/OffsetCurveSetBuilder.cpp	2011-02-23 16:21:24 UTC (rev 3243)
@@ -289,7 +289,9 @@
 #if GEOS_DEBUG
 	std::cerr<<"OffsetCurveSetBuilder::addPolygonRing: CCW: "<<CGAlgorithms::isCCW(coord)<<std::endl;
 #endif
-	if (CGAlgorithms::isCCW(coord)) {
+	if (coord->size() >= LinearRing::MINIMUM_VALID_SIZE
+			&& CGAlgorithms::isCCW(coord))
+	{
 		leftLoc=cwRightLoc;
 		rightLoc=cwLeftLoc;
 #if GEOS_DEBUG

Modified: trunk/tests/xmltester/tests/general/TestBuffer.xml
===================================================================
--- trunk/tests/xmltester/tests/general/TestBuffer.xml	2011-02-23 15:45:51 UTC (rev 3242)
+++ trunk/tests/xmltester/tests/general/TestBuffer.xml	2011-02-23 16:21:24 UTC (rev 3243)
@@ -115,5 +115,21 @@
   </op></test>
 </case>
 
+<case>
+  <desc>
+  	Degenerate polygon - ring is flat.
+  	This case tests a fix made in ver 1.12
+  </desc>
+  <a>
+    POLYGON ((100 100, 200 100, 200 100, 100 100))
+  </a>
+<test><op name='buffer' arg1='A' arg2='0.0'>   
+POLYGON EMPTY
+  </op></test>
+<test><op name='buffer' arg1='A' arg2='10.0'>   
+POLYGON ((100 90, 98.04909677983872 90.19214719596769, 96.1731656763491 90.76120467488714, 94.44429766980397 91.68530387697454, 92.92893218813452 92.92893218813452, 91.68530387697454 94.44429766980397, 90.76120467488713 96.1731656763491, 90.19214719596769 98.04909677983872, 90 100, 90.19214719596769 101.95090322016128, 90.76120467488713 103.8268343236509, 91.68530387697454 105.55570233019603, 92.92893218813452 107.07106781186548, 94.44429766980397 108.31469612302546, 96.1731656763491 109.23879532511287, 98.04909677983872 109.80785280403231, 100 110, 200 110, 201.95090322016128 109.80785280403231, 203.8268343236509 109.23879532511287, 205.55570233019603 108.31469612302546, 207.07106781186548 107.07106781186548, 208.31469612302544 105.55570233019603, 209.23879532511287 103.8268343236509, 209.8078528040323 101.95090322016128, 210 100, 209.8078528040323 98.04909677983872, 209.23879532511287 96.1731656763491, 208.31469612302544 94.44429766980397, 207.07106781186548 92.92893218813
 452, 205.55570233019603 91.68530387697454, 203.8268343236509 90.76120467488713, 201.95090322016128 90.19214719596769, 200 90, 100 90))
+  </op></test>
+</case>
 
+
 </run>



More information about the geos-commits mailing list