mirror of
https://github.com/boostorg/geometry.git
synced 2025-05-09 23:24:02 +00:00
[geometry] Added real-life testcase for simplify
[SVN r86549]
This commit is contained in:
parent
fbdf22bb72
commit
28d1a9cf3a
@ -38,6 +38,21 @@ void test_all()
|
||||
"LINESTRING(0 0,5 5,7 5,10 10)",
|
||||
"LINESTRING(0 0,5 5,7 5,10 10)", 1.0);
|
||||
|
||||
// Mail 2013-10-07, real-life test, piece of River Leine
|
||||
// PostGIS returns exactly the same result
|
||||
test_geometry<bg::model::linestring<P> >(
|
||||
"LINESTRING(4293586 3290439,4293568 3290340,4293566 3290332,4293570 3290244,4293576 3290192"
|
||||
",4293785 3289660,4293832 3289597,4293879 3289564,4293937 3289545,4294130 3289558"
|
||||
",4294204 3289553,4294240 3289539,4294301 3289479,4294317 3289420,4294311 3289353"
|
||||
",4294276 3289302,4293870 3289045,4293795 3288978,4293713 3288879,4293669 3288767"
|
||||
",4293654 3288652,4293657 3288563,4293690 3288452,4293761 3288360,4293914 3288215"
|
||||
",4293953 3288142,4293960 3288044,4293951 3287961,4293913 3287875,4293708 3287628"
|
||||
",4293658 3287542,4293633 3287459,4293630 3287383,4293651 3287323,4293697 3287271"
|
||||
",4293880 3287128,4293930 3287045,4293938 3286977,4293931 3286901,4293785 3286525"
|
||||
",4293775 3286426,4293786 3286358,4293821 3286294,4294072 3286076,4294134 3285986)",
|
||||
"LINESTRING(4293586 3290439,4293785 3289660,4294317 3289420,4293654 3288652,4293960 3288044"
|
||||
",4293633 3287459,4293786 3286358,4294134 3285986)", 250);
|
||||
|
||||
/* TODO fix this
|
||||
test_geometry<test::wrapped_boost_array<P, 10> >(
|
||||
"LINESTRING(0 0,5 5,7 5,10 10)",
|
||||
@ -62,9 +77,7 @@ 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))
|
||||
etc
|
||||
*/
|
||||
|
||||
// Just check compilation
|
||||
|
@ -11,6 +11,8 @@
|
||||
|
||||
// Test-functionality, shared between single and multi tests
|
||||
|
||||
#include <iomanip>
|
||||
#include <sstream>
|
||||
#include <geometry_test_common.hpp>
|
||||
#include <boost/geometry/algorithms/simplify.hpp>
|
||||
#include <boost/geometry/algorithms/distance.hpp>
|
||||
@ -35,7 +37,7 @@ struct test_inserter<bg::linestring_tag, Geometry>
|
||||
std::back_inserter(simplified), distance);
|
||||
|
||||
std::ostringstream out;
|
||||
out << bg::wkt(simplified);
|
||||
out << std::setprecision(16) << bg::wkt(simplified);
|
||||
BOOST_CHECK_EQUAL(out.str(), expected);
|
||||
}
|
||||
};
|
||||
@ -53,12 +55,12 @@ void test_geometry(std::string const& wkt, std::string const& expected, double d
|
||||
|
||||
{
|
||||
std::ostringstream out;
|
||||
out << bg::wkt(simplified);
|
||||
out << std::setprecision(16) << bg::wkt(simplified);
|
||||
|
||||
BOOST_CHECK_MESSAGE(out.str() == expected,
|
||||
"simplify: " << bg::wkt(geometry)
|
||||
<< " expected " << expected
|
||||
<< " got " << bg::wkt(simplified));
|
||||
<< " got " << out.str());
|
||||
}
|
||||
|
||||
// Check using user-specified strategy
|
||||
@ -76,7 +78,7 @@ void test_geometry(std::string const& wkt, std::string const& expected, double d
|
||||
|
||||
{
|
||||
std::ostringstream out;
|
||||
out << bg::wkt(simplified);
|
||||
out << std::setprecision(16) << bg::wkt(simplified);
|
||||
BOOST_CHECK_EQUAL(out.str(), expected);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user