// Boost.Geometry (aka GGL, Generic Geometry Library) // Unit Test // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2008-2012 Bruno Lalande, Paris, France. // Copyright (c) 2009-2012 Mateusz Loskot, London, UK. // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) #include #include #include #include #include #include template void test_all() { test_geometry >( "LINESTRING(0 0,5 5,10 10)", "LINESTRING(0 0,10 10)", 1.0); test_geometry >( "LINESTRING(0 0, 5 5, 6 5, 10 10)", "LINESTRING(0 0,10 10)", 1.0); test_geometry >( "LINESTRING(0 0,5 5,7 5,10 10)", "LINESTRING(0 0,5 5,7 5,10 10)", 1.0); /* TODO fix this test_geometry >( "LINESTRING(0 0,5 5,7 5,10 10)", "LINESTRING(0 0,5 5,7 5,10 10)", 1.0); */ test_geometry >( "POLYGON((4 0,8 2,8 7,4 9,0 7,0 2,2 1,4 0))", "POLYGON((4 0,8 2,8 7,4 9,0 7,0 2,4 0))", 1.0); test_geometry >( "POLYGON((4 0,8 2,8 7,4 9,0 7,0 2,2 1,4 0))", "POLYGON((4 0,8 2,8 7,4 9,0 7,0 2,4 0))", 1.0); test_geometry >( "POLYGON((4 0,8 2,8 7,4 9,0 7,0 2,2 1,4 0),(7 3,7 6,1 6,1 3,4 3,7 3))", "POLYGON((4 0,8 2,8 7,4 9,0 7,0 2,4 0),(7 3,7 6,1 6,1 3,7 3))", 1.0); /* Above can be checked in PostGIS by: select astext(ST_Simplify(geomfromtext('LINESTRING(0 0, 5 5, 10 10)'),1.0)) as simplified union all select astext(ST_Simplify(geomfromtext('LINESTRING(0 0, 5 5, 6 5, 10 10)'),1.0)) union all select astext(ST_Simplify(geomfromtext('LINESTRING(0 0, 5 5, 7 5, 10 10)'),1.0)) union all select astext(ST_Simplify(geomfromtext('POLYGON((4 0, 8 2, 8 7, 4 9, 0 7, 0 2, 2 1, 4 0))'),1.0)) union all select astext(ST_Simplify(geomfromtext('POLYGON((4 0, 8 2, 8 7, 4 9, 0 7, 0 2, 2 1, 4 0),(7 3, 7 6, 1 6, 1 3, 4 3, 7 3))'),1.0)) */ // Just check compilation test_geometry

( "POINT(0 0)", "POINT(0 0)", 1.0); test_geometry >( "POLYGON((4 0,8 2,8 7,4 9,0 7,0 2,2 1,4 0))", "POLYGON((4 0,8 2,8 7,4 9,0 7,0 2,4 0))", 1.0); } template void test_spherical() { test_geometry >( "LINESTRING(4.1 52.1,4.2 52.2,4.3 52.3)", "LINESTRING(4.1 52.1,4.3 52.3)", 0.01); } int test_main(int, char* []) { // Integer compiles, but simplify-process fails (due to distances) //test_all >(); test_all >(); test_all >(); test_spherical > >(); #if defined(HAVE_TTMATH) test_all >(); test_spherical > >(); #endif return 0; }