[geos-commits] r3342 - in trunk: src/operation/buffer tests/unit/capi

svn_geos at osgeo.org svn_geos at osgeo.org
Tue May 10 14:10:56 EDT 2011


Author: strk
Date: 2011-05-10 11:10:56 -0700 (Tue, 10 May 2011)
New Revision: 3342

Modified:
   trunk/src/operation/buffer/BufferBuilder.cpp
   trunk/tests/unit/capi/GEOSOffsetCurveTest.cpp
Log:
Have GEOSOffsetCurve return LINESTRING EMPTY for collapsing lines (right offset on right-turning curve can do that). Regress test one such case, taken from http://trac.osgeo.org/postgis/ticket/413.

Modified: trunk/src/operation/buffer/BufferBuilder.cpp
===================================================================
--- trunk/src/operation/buffer/BufferBuilder.cpp	2011-05-10 11:11:54 UTC (rev 3341)
+++ trunk/src/operation/buffer/BufferBuilder.cpp	2011-05-10 18:10:56 UTC (rev 3342)
@@ -356,7 +356,7 @@
    else
    {
       delete mergedLinesGeom;
-      return NULL;
+      return geomFact->createLineString();
    }
 }
 

Modified: trunk/tests/unit/capi/GEOSOffsetCurveTest.cpp
===================================================================
--- trunk/tests/unit/capi/GEOSOffsetCurveTest.cpp	2011-05-10 11:11:54 UTC (rev 3341)
+++ trunk/tests/unit/capi/GEOSOffsetCurveTest.cpp	2011-05-10 18:10:56 UTC (rev 3342)
@@ -148,6 +148,26 @@
         ));
     }
 
+    // See http://trac.osgeo.org/postgis/ticket/413
+    template<>
+    template<>
+    void object::test<5>()
+    {
+        geom1_ = GEOSGeomFromWKT("LINESTRING(33282908 6005055,33282900 6005050,33282892 6005042,33282876 6005007,33282863 6004982,33282866 6004971,33282876 6004975,33282967 6005018,33282999 6005031)");
 
+        ensure( 0 != geom1_ );
+
+        geom2_ = GEOSOffsetCurve(geom1_, 44, 1, GEOSBUF_JOIN_MITRE, 1);
+
+        ensure( 0 != geom2_ );
+
+        wkt_ = GEOSWKTWriter_write(wktw_, geom2_);
+
+        ensure_equals(std::string(wkt_), std::string(
+"LINESTRING EMPTY"
+        ));
+    }
+
+
 } // namespace tut
 



More information about the geos-commits mailing list