[geos-commits] r2705 - in trunk: . tests/unit/operation/buffer

svn_geos at osgeo.org svn_geos at osgeo.org
Thu Oct 29 11:11:17 EDT 2009


Author: mloskot
Date: 2009-10-29 11:11:15 -0400 (Thu, 29 Oct 2009)
New Revision: 2705

Modified:
   trunk/ChangeLog
   trunk/tests/unit/operation/buffer/BufferOpTest.cpp
Log:
Added test case for buffer of multipolygon from XMLTester's buffer.xml, case #25 but with custom quadrant segments


Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2009-10-29 14:24:56 UTC (rev 2704)
+++ trunk/ChangeLog	2009-10-29 15:11:15 UTC (rev 2705)
@@ -1,3 +1,9 @@
+2009-10-29 15:15  Mateusz Loskot <mateusz at loskot.net>
+
+	* [r2705] tests/unit/operation/buffer/BufferOpTest.cpp: Added test case
+	  for buffer of multipolygon from XMLTester's buffer.xml, case #25 but
+	  with custom quadrant segments
+
 2009-10-29 14:25  Mateusz Loskot <mateusz at loskot.net>
 
 	* [r2704] tests/unit/operation/buffer/BufferOpTest.cpp: Added test case
@@ -2,3 +8,2 @@
 	  for buffer of POINT(0 0) with distance 1.0 and 32 quadrant segments.
-
 2009-10-29 12:30  Mateusz Loskot <mateusz at loskot.net>

Modified: trunk/tests/unit/operation/buffer/BufferOpTest.cpp
===================================================================
--- trunk/tests/unit/operation/buffer/BufferOpTest.cpp	2009-10-29 14:24:56 UTC (rev 2704)
+++ trunk/tests/unit/operation/buffer/BufferOpTest.cpp	2009-10-29 15:11:15 UTC (rev 2705)
@@ -60,6 +60,7 @@
         GeomPtr gBuffer(op.getResultGeometry(distance));
 
         ensure(gBuffer->isEmpty());
+        ensure(gBuffer->isValid());
         ensure_equals(gBuffer->getGeometryTypeId(), geos::geom::GEOS_POLYGON);
         ensure_equals(gBuffer->getNumPoints(), 0);
     }
@@ -79,6 +80,7 @@
         GeomPtr gBuffer(op.getResultGeometry(distance));
 
         ensure_not(gBuffer->isEmpty());
+        ensure(gBuffer->isValid());
         ensure_equals(gBuffer->getGeometryTypeId(), geos::geom::GEOS_POLYGON);
         ensure(gBuffer->getNumPoints() > 32);
     }
@@ -103,8 +105,48 @@
         GeomPtr gBuffer(op.getResultGeometry(distance));
 
         ensure_not(gBuffer->isEmpty());
+        ensure(gBuffer->isValid());
         ensure_equals(gBuffer->getGeometryTypeId(), geos::geom::GEOS_POLYGON);
         ensure(gBuffer->getNumPoints() > 129);
     }
 
+    template<>
+    template<>
+    void object::test<4>()
+    {
+        using geos::operation::buffer::BufferOp;
+        using geos::operation::buffer::BufferParameters;
+
+        ensure_equals(BufferParameters::DEFAULT_QUADRANT_SEGMENTS, 8);
+
+        std::string wkt0("MULTIPOLYGON(((708258.754920656 2402197.91172757,708257.029447455 2402206.56901508,708652.961095455 2402312.65463437,708657.068786251 2402304.6356364,708258.754920656 2402197.91172757)),((708653.498611049 2402311.54647056,708708.895756966 2402203.47250014,708280.326454234 2402089.6337791,708247.896591321 2402252.48269854,708367.379593851 2402324.00761653,708248.882609455 2402253.07294874,708249.523621829 2402244.3124463,708261.854734465 2402182.39086576,708262.818392579 2402183.35452387,708653.498611049 2402311.54647056)))");
+        GeomPtr g0(wktreader.read(wkt0));
+
+        // Buffer point with custom parameters: 24 quadrant segments
+        {
+            int const segments = BufferParameters::DEFAULT_QUADRANT_SEGMENTS * 3;
+            BufferParameters params(segments);
+            BufferOp op(g0.get(), params);
+            double const distance = 0.0001;
+            GeomPtr gBuffer(op.getResultGeometry(distance));
+            ensure_not(gBuffer->isEmpty());
+            ensure(gBuffer->isValid());
+            ensure_equals(gBuffer->getGeometryTypeId(), geos::geom::GEOS_POLYGON);
+            ensure(gBuffer->getNumPoints() >= 245);
+        }
+
+        // Buffer point with custom parameters: 32 quadrant segments
+        {
+            int const segments = BufferParameters::DEFAULT_QUADRANT_SEGMENTS * 4;
+            BufferParameters params(segments);
+            BufferOp op(g0.get(), params);
+            double const distance = 0.0001;
+            GeomPtr gBuffer(op.getResultGeometry(distance));
+            ensure_not(gBuffer->isEmpty());
+            ensure(gBuffer->isValid());
+            ensure_equals(gBuffer->getGeometryTypeId(), geos::geom::GEOS_POLYGON);
+            ensure(gBuffer->getNumPoints() >= 318);
+        }
+    }
+
 } // namespace tut



More information about the geos-commits mailing list