]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/geometry/test/algorithms/equals/equals_sph.cpp
import quincy beta 17.1.0
[ceph.git] / ceph / src / boost / libs / geometry / test / algorithms / equals / equals_sph.cpp
1 // Boost.Geometry
2
3 // Copyright (c) 2016 Oracle and/or its affiliates.
4 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
5
6 // Use, modification and distribution is subject to the Boost Software License,
7 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
8 // http://www.boost.org/LICENSE_1_0.txt)
9
10 #include "test_equals.hpp"
11
12 #include <algorithms/overlay/overlay_cases.hpp>
13 #include <algorithms/overlay/multi_overlay_cases.hpp>
14
15 #include <boost/geometry/geometries/geometries.hpp>
16
17
18 template <typename P>
19 void test_polygon_polygon()
20 {
21 typedef bg::model::polygon<P> poly;
22 typedef bg::model::ring<P> ring;
23
24 test_geometry<poly, ring>(case_1[0], case_1[0],
25 true);
26 test_geometry<ring, ring>(case_1[0], case_1[1],
27 false);
28 test_geometry<ring, poly>(case_1[0], case_1[1],
29 false);
30
31 test_geometry<poly, poly>(case_1[0], case_1[1],
32 false);
33 test_geometry<poly, poly>(case_2[0], case_2[1],
34 false);
35 test_geometry<poly, poly>(case_3_sph[0], case_3_sph[1],
36 false);
37 test_geometry<poly, poly>(case_3_2_sph[0], case_3_2_sph[1],
38 true);
39 test_geometry<poly, poly>(case_4[0], case_4[1],
40 false);
41 test_geometry<poly, poly>(case_5[0], case_5[1],
42 false);
43 test_geometry<poly, poly>(case_6_sph[0], case_6_sph[1],
44 false);
45
46 test_geometry<poly, poly>(case_7[0], case_7[1],
47 false);
48 test_geometry<poly, poly>(case_8_sph[0], case_8_sph[1],
49 false);
50 test_geometry<poly, poly>(case_9_sph[0], case_9_sph[1],
51 false);
52 test_geometry<poly, poly>(case_10_sph[0], case_10_sph[1],
53 false);
54 test_geometry<poly, poly>(case_11_sph[0], case_11_sph[1],
55 false);
56 test_geometry<poly, poly>(case_12[0], case_12[1],
57 false);
58
59 test_geometry<poly, poly>(case_13_sph[0], case_13_sph[1],
60 false);
61 test_geometry<poly, poly>(case_14_sph[0], case_14_sph[1],
62 false);
63 test_geometry<poly, poly>(case_15_sph[0], case_15_sph[1],
64 false);
65 test_geometry<poly, poly>(case_16_sph[0], case_16_sph[1],
66 false);
67 test_geometry<poly, poly>(case_17_sph[0], case_17_sph[1],
68 false);
69 test_geometry<poly, poly>(case_18_sph[0], case_18_sph[1],
70 false);
71 }
72
73 template <typename P>
74 void test_polygon_multi_polygon()
75 {
76 typedef bg::model::polygon<P> poly;
77 typedef bg::model::ring<P> ring;
78 typedef bg::model::multi_polygon<poly> mpoly;
79
80 test_geometry<ring, mpoly>(case_1[0], case_multi_2[0],
81 false);
82 test_geometry<poly, mpoly>(case_2[0], case_multi_2[0],
83 false);
84 }
85
86 template <typename P>
87 void test_multi_polygon_multi_polygon()
88 {
89 typedef bg::model::polygon<P> poly;
90 typedef bg::model::multi_polygon<poly> mpoly;
91
92 test_geometry<mpoly, mpoly>(case_multi_2[0], case_multi_2[1],
93 false);
94 }
95
96 template <typename P>
97 void test_linestring_linestring()
98 {
99 typedef bg::model::linestring<P> ls;
100
101 test_geometry<ls, ls>("LINESTRING(0 0, 2 2, 3 2)", "LINESTRING(0 0, 2 2, 3 2)", true);
102
103 test_geometry<ls, ls>("LINESTRING(1 0,2 2,2 3)", "LINESTRING(0 0, 2 2, 3 2)", false);
104 }
105
106 template <typename P>
107 void test_linestring_multi_linestring()
108 {
109 typedef bg::model::linestring<P> ls;
110 typedef bg::model::multi_linestring<ls> mls;
111
112 test_geometry<ls, mls>("LINESTRING(0 0,10 0)",
113 "MULTILINESTRING((1 0,2 0),(1 1,2 1))",
114 false);
115
116 test_geometry<ls, mls>("LINESTRING(0 0,5 0,5 5,0 5,0 0)",
117 "MULTILINESTRING((5 5,0 5,0 0),(0 0,5 0,5 5))",
118 true);
119 }
120
121 template <typename P>
122 void test_multi_linestring_multi_linestring()
123 {
124 typedef bg::model::linestring<P> ls;
125 typedef bg::model::multi_linestring<ls> mls;
126
127 test_geometry<mls, mls>("MULTILINESTRING((0 0,0 0,18 0,18 0,19 0,19 0,19 0,30 0,30 0))",
128 "MULTILINESTRING((0 10,5 0,20 0,20 0,30 0))",
129 false);
130 }
131
132
133 template <typename P>
134 void test_all()
135 {
136 test_polygon_polygon<P>();
137 test_polygon_multi_polygon<P>();
138 test_multi_polygon_multi_polygon<P>();
139
140 test_linestring_linestring<P>();
141 test_linestring_multi_linestring<P>();
142 test_multi_linestring_multi_linestring<P>();
143 }
144
145
146 int test_main( int , char* [] )
147 {
148 test_all<bg::model::point<double, 2, bg::cs::spherical_equatorial<bg::degree> > >();
149
150 return 0;
151 }