]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/geometry/test/algorithms/for_each_multi.cpp
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / geometry / test / algorithms / for_each_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/algorithms/for_each.hpp>
11
12 #include <boost/geometry/io/wkt/wkt.hpp>
13
14 #include <boost/geometry/geometries/box.hpp>
15 #include <boost/geometry/geometries/ring.hpp>
16 #include <boost/geometry/geometries/linestring.hpp>
17 #include <boost/geometry/geometries/point.hpp>
18 #include <boost/geometry/geometries/point_xy.hpp>
19 #include <boost/geometry/geometries/polygon.hpp>
20
21 #include <boost/geometry/geometries/multi_point.hpp>
22 #include <boost/geometry/geometries/multi_linestring.hpp>
23 #include <boost/geometry/geometries/multi_polygon.hpp>
24
25 #include <algorithms/test_for_each.hpp>
26
27
28 template <typename P>
29 void test_all()
30 {
31 test_geometry<bg::model::multi_point<P> >
32 (
33 "MULTIPOINT((1 1))"
34
35 // per point
36 , 1
37 , "MULTIPOINT((101 1))"
38 , "MULTIPOINT((101 100))"
39 // per segment
40 , ""
41 , 0
42 , "MULTIPOINT((1 1))"
43 );
44
45 test_geometry<bg::model::multi_linestring<bg::model::linestring<P> > >
46 (
47 "MULTILINESTRING((1 1,2 2))"
48
49 , 3
50 , "MULTILINESTRING((101 1,102 2))"
51 , "MULTILINESTRING((101 100,102 200))"
52
53 , "((1, 1), (2, 2))"
54 , std::sqrt(2.0)
55 , "MULTILINESTRING((10 1,2 2))"
56 );
57
58 typedef bg::model::multi_polygon<bg::model::polygon<P> > mp;
59 test_geometry<mp>
60 (
61 "MULTIPOLYGON(((1 1,1 4,4 4,4 1,1 1)))"
62
63 , 11
64 , "MULTIPOLYGON(((101 1,101 4,104 4,104 1,101 1)))"
65 , "MULTIPOLYGON(((101 100,101 400,104 400,104 100,101 100)))"
66
67 , "((1, 1), (1, 4)) ((1, 4), (4, 4)) ((4, 4), (4, 1)) ((4, 1), (1, 1))"
68 , 4 * 3.0
69 , "MULTIPOLYGON(((10 1,10 4,4 4,4 1,1 1,10 1)))"
70 );
71
72 // open multipolygon
73 typedef bg::model::multi_polygon<bg::model::polygon<P, true, false> > omp;
74 test_geometry<omp>
75 (
76 "MULTIPOLYGON(((1 1,1 4,4 4,4 1)))"
77
78 , 10
79 , "MULTIPOLYGON(((101 1,101 4,104 4,104 1,101 1)))"
80 , "MULTIPOLYGON(((101 100,101 400,104 400,104 100,101 100)))"
81
82 , "((1, 1), (1, 4)) ((1, 4), (4, 4)) ((4, 4), (4, 1)) ((4, 1), (1, 1))"
83 , 4 * 3.0
84 , "MULTIPOLYGON(((10 1,10 4,4 4,4 1,10 1)))"
85 );
86 }
87
88 int test_main( int , char* [] )
89 {
90 test_all<bg::model::d2::point_xy<double> >();
91
92 #ifdef HAVE_TTMATH
93 test_all<bg::model::d2::point_xy<ttmath_big> >();
94 #endif
95
96 return 0;
97 }