[geos-commits] r3509 - trunk/tests/unit/operation/buffer
svn_geos at osgeo.org
svn_geos at osgeo.org
Wed Oct 26 12:49:37 EDT 2011
Author: mloskot
Date: 2011-10-26 09:49:36 -0700 (Wed, 26 Oct 2011)
New Revision: 3509
Modified:
trunk/tests/unit/operation/buffer/BufferOpTest.cpp
Log:
* Test of two ways of executing buffer operation.
* Test problems with BufferOp when using BufferParameters reported by Markus Meyer.
* TODO: if possible, replace sample WKT with WKT from Markus.
Modified: trunk/tests/unit/operation/buffer/BufferOpTest.cpp
===================================================================
--- trunk/tests/unit/operation/buffer/BufferOpTest.cpp 2011-10-26 16:14:03 UTC (rev 3508)
+++ trunk/tests/unit/operation/buffer/BufferOpTest.cpp 2011-10-26 16:49:36 UTC (rev 3509)
@@ -269,5 +269,41 @@
ensure(gBuffer->getNumPoints() >= std::size_t(5));
}
+ // Test two ways of executing buffer operation
+ // Problems with BufferOp when using BufferParameters by Markus Meyer
+ // http://lists.osgeo.org/pipermail/geos-devel/2011-October/005507.html
+ template<>
+ template<>
+ void object::test<10>()
+ {
+ using geos::operation::buffer::BufferOp;
+ using geos::operation::buffer::BufferParameters;
+
+ // TODO: Replace with Markus Meyer's test geometry once received
+ std::string wkt0("POLYGON((144130.790985 514542.589985,144136.106985 514541.268985,144140.618985 514541.819985,144146.580985 514542.271985,144155.308985 514545.689985,144159.779985 514546.073985,144165.774985 514546.027985,144170.614985 514545.336985,144174.457985 514542.248985,144180.591985 514535.602985,144185.031985 514531.945985,144188.930985 514529.699985,144202.240985 514526.170985,144204.522985 514525.434985,144208.647985 514523.675985,144209.506985 514523.064985,144212.582985 514519.733985,144214.710985 514516.736985,144217.305985 514512.269985,144225.821985 514492.742985,144230.222985 514479.998985,144238.048985 514458.756985,144239.749985 514453.779985,144242.237985 514445.130985,144246.840985 514428.052985,144247.696985 514425.401985,144249.538985 514420.578985,144253.385985 514411.927985,144260.058985 514394.218985,144264.745985 514384.187985,144266.213985 514379.927985,144267.402985 514375.585985,144266.909985 514372.870985,144264.565985 514368.375985,14
4255.527985 514363.949985,144249.852985 514362.074985,144245.934985 514359.844985,144246.620985 514355.223985,144248.164985 514351.697985,144250.544985 514347.859985,144251.479985 514346.801985,144258.417985 514340.953985,144264.816985 514336.013985,144266.807985 514330.309985,144266.470985 514325.834985,144264.754985 514315.479985,144263.754985 514311.093985,144261.914985 514304.532985,144260.268985 514300.367985,144258.258985 514296.998985,144255.314985 514293.564985,144253.224985 514291.582985,144249.714985 514288.669985,144245.918985 514286.308985,144244.887985 514285.843985,144240.548985 514284.624985,144234.199985 514283.756985,144225.189985 514283.542985,144216.921985 514283.099985,144200.074985 514283.128985,144195.587985 514283.291985,144186.779985 514284.886985,144177.834985 514285.878985,144169.973985 514286.948985,144165.504985 514287.444985,144158.597985 514287.500985,144150.714985 514288.363985,144146.268985 514289.065985,144138.749985 514290.519985,144129.9989
85 514292.618985,144122.836985 514294.931985,144118.663985 514296.619985,144116.254985 514315.702985,144113.154985 514338.329985,144110.932985 514350.449985,144109.642985 514359.358985,144103.633985 514384.235985,144100.698985 514392.568985,144099.732985 514399.419985,144098.307985 514417.516985,144097.345985 514425.834985,144096.877985 514434.147985,144095.446985 514450.289985,144095.470985 514467.498985,144095.977985 514472.854985,144095.698985 514478.235985,144090.849985 514512.499985,144086.867985 514532.967985,144086.837985 514540.297985,144083.986985 514558.486985,144082.564985 514573.165985,144082.617985 514579.549985,144083.019985 514582.853985,144084.070985 514587.218985,144088.382985 514601.055985,144090.700985 514599.014985,144094.407985 514596.448985,144099.296985 514594.867985,144103.775985 514594.417985,144104.772985 514593.932985,144108.205985 514590.960985,144109.332985 514588.480985,144110.651985 514584.097985,144115.058985 514573.308985,144115.953985 514570
.340985,144117.115985 514565.480985,144117.981985 514561.064985,144120.043985 514555.351985,144121.899985 514551.257985,144123.475985 514548.300985,144126.738985 514544.570985,144130.790985 514542.589985))");
+ GeomPtr g0(wktreader.read(wkt0));
+ ensure_equals(g0->getNumPoints(), std::size_t(112));
+
+ double const distance = -75.0;
+ int const segments = 16;
+
+ BufferParameters params1(segments, BufferParameters::CAP_ROUND);
+ BufferOp op1(g0.get(), params1);
+ GeomPtr gBuffer1(op1.getResultGeometry(distance));
+ ensure_not(gBuffer1->isEmpty());
+ ensure(gBuffer1->isValid());
+ ensure_equals(gBuffer1->getGeometryTypeId(), geos::geom::GEOS_POLYGON);
+ ensure(gBuffer1->getNumPoints() >= std::size_t(5));
+
+ GeomPtr gBuffer2(BufferOp::bufferOp(g0.get(), distance, segments, BufferParameters::CAP_ROUND));
+ ensure_not(gBuffer2->isEmpty());
+ ensure(gBuffer2->isValid());
+ ensure_equals(gBuffer2->getGeometryTypeId(), geos::geom::GEOS_POLYGON);
+ ensure(gBuffer2->getNumPoints() >= std::size_t(5));
+
+ ensure(gBuffer1->equals(gBuffer2.get()));
+ ensure(gBuffer2->equals(gBuffer1.get()));
+ }
+
} // namespace tut
More information about the geos-commits
mailing list