template<> template<> void object::test<1>() { std::string wkt("POLYGON((20 220, 40 220, 60 220, 80 220, 100 220, \ 120 220, 140 220, 140 180, 100 180, 60 180, 20 180, 20 220))"); GeomPtr g(wktreader.read(wkt)); GeomPtr simplified = DouglasPeuckerSimplifier::simplify( g.get(), 10.0); ensure( simplified->isValid() ); // topology is unchanged ensure( simplified->equals(g.get()) ); } // 2 - PolygonReductionWithSplit template<> template<> void object::test<2>() { std::string wkt_in("POLYGON ((40 240, 160 241, 280 240, 280 160, \ 160 240, 40 140, 40 240))"); std::string wkt_ex("MULTIPOLYGON (((40.0 240.0, 160.0 240.0, 40.0 140.0, 40.0 240.0)), \ ((160.0 240.0, 280.0 240.0, 280.0 160.0, 160.0 240.0)))"); GeomPtr g(wktreader.read(wkt_in));
// // PolygonNoReduction template<> template<> void object::test<1>() { std::string wkt("POLYGON((20 220, 40 220, 60 220, 80 220, \ 100 220, 120 220, 140 220, 140 180, 100 180, \ 60 180, 20 180, 20 220))"); GeomPtr g(wktreader.read(wkt)); GeomPtr simplified = TopologyPreservingSimplifier::simplify(g.get(), 10.0); ensure( "Simplified geometry is invalid!", simplified->isValid() ); ensure( "Simplified and original geometry inequal", simplified->equals(g.get()) ); ensure_equals_geometry( g.get(), simplified.get() ); } // PolygonNoReductionWithConflicts template<> template<> void object::test<2>() { std::string wkt("POLYGON ((40 240, 160 241, 280 240, 280 160, \ 160 240, 40 140, 40 240))"); GeomPtr g(wktreader.read(wkt)); GeomPtr simplified = TopologyPreservingSimplifier::simplify(g.get(), 10.0); ensure( "Simplified geometry is invalid!", simplified->isValid() );