]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/geometry/test/algorithms/simplify_multi.cpp
update sources to ceph Nautilus 14.2.1
[ceph.git] / ceph / src / boost / libs / geometry / test / algorithms / simplify_multi.cpp
1 // Boost.Geometry (aka GGL, Generic Geometry Library)
2 //
3 // Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands.
4 // Use, modification and distribution is subject to the Boost Software License,
5 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
6 // http://www.boost.org/LICENSE_1_0.txt)
7
8 #include <geometry_test_common.hpp>
9
10 #include <boost/geometry/geometries/box.hpp>
11 #include <boost/geometry/geometries/ring.hpp>
12 #include <boost/geometry/geometries/linestring.hpp>
13 #include <boost/geometry/geometries/point.hpp>
14 #include <boost/geometry/geometries/polygon.hpp>
15
16 #include <boost/geometry/geometries/point_xy.hpp>
17
18 #include <boost/geometry/geometries/multi_point.hpp>
19 #include <boost/geometry/geometries/multi_linestring.hpp>
20 #include <boost/geometry/geometries/multi_polygon.hpp>
21
22 #include <algorithms/test_simplify.hpp>
23
24
25 template <typename P>
26 void test_all()
27 {
28 test_geometry<bg::model::multi_point<P> >(
29 "MULTIPOINT((0 0),(1 1))",
30 "MULTIPOINT((0 0),(1 1))", 1.0);
31
32 test_geometry<bg::model::multi_linestring<bg::model::linestring<P> > >(
33 "MULTILINESTRING((0 0,5 5,10 10))",
34 "MULTILINESTRING((0 0,10 10))", 1.0);
35
36 typedef bg::model::multi_polygon<bg::model::polygon<P> > mp;
37 test_geometry<mp>(
38 "MULTIPOLYGON(((4 0,8 2,8 7,4 9,0 7,0 2,2 1,4 0)))",
39 "MULTIPOLYGON(((4 0,8 2,8 7,4 9,0 7,0 2,4 0)))", 1.0);
40 test_geometry<mp>(
41 "MULTIPOLYGON(((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)))",
42 "MULTIPOLYGON(((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);
43
44 // Ticket 5954 https://svn.boost.org/trac/boost/ticket/5954
45 test_geometry<mp>(
46 "MULTIPOLYGON(((0.561648 1,1 1,1 0,0.468083 0,0.52758 0.00800554,0.599683 0.0280924,0.601611 0.265374,0.622693 0.316765,0.69507 0.357497,0.695623 0.429711,0.655111 0.502298,0.696467 0.543147,0.840712 0.593546,0.882583 0.66546,0.852357 0.748213,0.84264 0.789567,0.832667 0.841202,0.832667 0.841202,0.740538 0.873004,0.617349 0.905045,0.566576 0.977697,0.561648 1)),((0 0.801979,0.0308575 0.786234,0.0705513 0.631135,0.141616 0.527248,0.233985 0.505872,0.264777 0.526263,0.336631 0.505009,0.356603 0.422321,0.355803 0.350038,0.375252 0.205364,0.415206 0.0709182,0.45479 0,0 0,0 0,0 0.801979)))",
47 0.51961289352, 1.0 / 2048.0);
48
49 // Same polygon but multiplied with 2047.0
50 test_geometry<mp>(
51 "MULTIPOLYGON(((1149.69 2047,2047 2047,2047 0,958.166 0,1079.96 16.3873,1227.55 57.5051,1231.5 543.221,1274.65 648.418,1422.81 731.796,1423.94 879.618,1341.01 1028.2,1425.67 1111.82,1720.94 1214.99,1806.65 1362.2,1744.77 1531.59,1724.88 1616.24,1704.47 1721.94,1704.47 1721.94,1515.88 1787.04,1263.71 1852.63,1159.78 2001.35,1149.69 2047)),((0 1641.65,63.1653 1609.42,144.419 1291.93,289.888 1079.28,478.967 1035.52,541.999 1077.26,689.084 1033.75,729.966 864.491,728.329 716.528,768.141 420.38,849.927 145.17,930.955 0,0 0,0 0,0 1641.65)))",
52 0.51961289352 * (2047.0 * 2047.0), 1.0);
53 // End ticket 5954
54 }
55
56 int test_main( int , char* [] )
57 {
58 test_all<bg::model::d2::point_xy<double> >();
59
60 #ifdef HAVE_TTMATH
61 test_all<bg::model::d2::point_xy<ttmath_big> >();
62 #endif
63
64 return 0;
65 }