]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
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_overlaps.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<ring, ring>(case_1[0], case_1[1], | |
25 | true); | |
26 | test_geometry<ring, poly>(case_1[0], case_1[1], | |
27 | true); | |
28 | ||
29 | test_geometry<poly, poly>(case_1[0], case_1[1], | |
30 | true); | |
31 | test_geometry<poly, poly>(case_2[0], case_2[1], | |
32 | true); | |
33 | test_geometry<poly, poly>(case_3_sph[0], case_3_sph[1], | |
34 | false); | |
35 | test_geometry<poly, poly>(case_3_2_sph[0], case_3_2_sph[1], | |
36 | false); | |
37 | test_geometry<poly, poly>(case_4[0], case_4[1], | |
38 | true); | |
39 | test_geometry<poly, poly>(case_5[0], case_5[1], | |
40 | true); | |
41 | test_geometry<poly, poly>(case_6_sph[0], case_6_sph[1], | |
42 | false); | |
43 | ||
44 | test_geometry<poly, poly>(case_7[0], case_7[1], | |
45 | false); | |
46 | test_geometry<poly, poly>(case_8_sph[0], case_8_sph[1], | |
47 | false); | |
48 | test_geometry<poly, poly>(case_9_sph[0], case_9_sph[1], | |
49 | false); | |
50 | test_geometry<poly, poly>(case_10_sph[0], case_10_sph[1], | |
51 | false); | |
52 | test_geometry<poly, poly>(case_11_sph[0], case_11_sph[1], | |
53 | false); | |
54 | test_geometry<poly, poly>(case_12[0], case_12[1], | |
55 | true); | |
56 | ||
57 | test_geometry<poly, poly>(case_13_sph[0], case_13_sph[1], | |
58 | false); | |
59 | test_geometry<poly, poly>(case_14_sph[0], case_14_sph[1], | |
60 | false); | |
61 | test_geometry<poly, poly>(case_15_sph[0], case_15_sph[1], | |
62 | false); | |
63 | test_geometry<poly, poly>(case_16_sph[0], case_16_sph[1], | |
64 | false); | |
65 | test_geometry<poly, poly>(case_17_sph[0], case_17_sph[1], | |
66 | false); | |
67 | test_geometry<poly, poly>(case_18_sph[0], case_18_sph[1], | |
68 | false); | |
69 | } | |
70 | ||
71 | template <typename P> | |
72 | void test_polygon_multi_polygon() | |
73 | { | |
74 | typedef bg::model::polygon<P> poly; | |
75 | typedef bg::model::ring<P> ring; | |
76 | typedef bg::model::multi_polygon<poly> mpoly; | |
77 | ||
78 | test_geometry<ring, mpoly>(case_1[0], case_multi_2[0], | |
79 | true); | |
80 | test_geometry<poly, mpoly>(case_2[0], case_multi_2[0], | |
81 | true); | |
82 | } | |
83 | ||
84 | template <typename P> | |
85 | void test_multi_polygon_multi_polygon() | |
86 | { | |
87 | typedef bg::model::polygon<P> poly; | |
88 | typedef bg::model::multi_polygon<poly> mpoly; | |
89 | ||
90 | test_geometry<mpoly, mpoly>(case_multi_2[0], case_multi_2[1], | |
91 | true); | |
92 | } | |
93 | ||
94 | template <typename P> | |
95 | void test_linestring_linestring() | |
96 | { | |
97 | typedef bg::model::linestring<P> ls; | |
98 | ||
99 | test_geometry<ls, ls>("LINESTRING(0 0, 2 2, 3 2)", "LINESTRING(0 0, 2 2, 3 2)", false); | |
100 | ||
101 | test_geometry<ls, ls>("LINESTRING(1 0,2 2,2 3)", "LINESTRING(0 0, 2 2, 3 2)", false); | |
102 | } | |
103 | ||
104 | template <typename P> | |
105 | void test_linestring_multi_linestring() | |
106 | { | |
107 | typedef bg::model::linestring<P> ls; | |
108 | typedef bg::model::multi_linestring<ls> mls; | |
109 | ||
110 | test_geometry<ls, mls>("LINESTRING(0 0,10 0)", | |
111 | "MULTILINESTRING((1 0,2 0),(1 1,2 1))", | |
112 | true); | |
113 | ||
114 | test_geometry<ls, mls>("LINESTRING(0 0,5 0,5 5,0 5,0 0)", | |
115 | "MULTILINESTRING((5 5,0 5,0 0),(0 0,5 0,5 5))", | |
116 | false); | |
117 | } | |
118 | ||
119 | template <typename P> | |
120 | void test_multi_linestring_multi_linestring() | |
121 | { | |
122 | typedef bg::model::linestring<P> ls; | |
123 | typedef bg::model::multi_linestring<ls> mls; | |
124 | ||
125 | test_geometry<mls, mls>("MULTILINESTRING((0 0,0 0,18 0,18 0,19 0,19 0,19 0,30 0,30 0))", | |
126 | "MULTILINESTRING((0 10,5 0,20 0,20 0,30 0))", | |
127 | true); | |
128 | } | |
129 | ||
130 | ||
131 | template <typename P> | |
132 | void test_all() | |
133 | { | |
134 | test_polygon_polygon<P>(); | |
135 | test_polygon_multi_polygon<P>(); | |
136 | test_multi_polygon_multi_polygon<P>(); | |
137 | ||
138 | test_linestring_linestring<P>(); | |
139 | test_linestring_multi_linestring<P>(); | |
140 | test_multi_linestring_multi_linestring<P>(); | |
141 | } | |
142 | ||
143 | ||
144 | int test_main( int , char* [] ) | |
145 | { | |
146 | test_all<bg::model::point<double, 2, bg::cs::spherical_equatorial<bg::degree> > >(); | |
147 | ||
148 | #if defined(HAVE_TTMATH) | |
149 | test_cs<bg::model::point<ttmath_big, 2, bg::cs::spherical_equatorial<bg::degree> > >(); | |
150 | #endif | |
151 | ||
152 | return 0; | |
153 | } |