]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/geometry/test/algorithms/relational_operations/relate/relate_pointlike_geometry.cpp
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / geometry / test / algorithms / relational_operations / relate / relate_pointlike_geometry.cpp
1 // Boost.Geometry (aka GGL, Generic Geometry Library)
2
3 // Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands.
4
5 // This file was modified by Oracle on 2013, 2014, 2015.
6 // Modifications copyright (c) 2013-2015 Oracle and/or its affiliates.
7
8 // Use, modification and distribution is subject to the Boost Software License,
9 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
10 // http://www.boost.org/LICENSE_1_0.txt)
11
12 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
13
14 #include "test_relate.hpp"
15 #include "../nan_cases.hpp"
16
17 //TEST
18 //#include <to_svg.hpp>
19
20 template <typename P>
21 void test_point_point()
22 {
23 test_geometry<P, P>("POINT(0 0)", "POINT(0 0)", "0FFFFFFF2");
24 test_geometry<P, P>("POINT(1 0)", "POINT(0 0)", "FF0FFF0F2");
25 }
26
27 template <typename P>
28 void test_point_multipoint()
29 {
30 typedef bg::model::multi_point<P> mpt;
31
32 test_geometry<P, mpt>("POINT(0 0)", "MULTIPOINT(0 0)", "0FFFFFFF2");
33 test_geometry<P, mpt>("POINT(1 0)", "MULTIPOINT(0 0)", "FF0FFF0F2");
34 test_geometry<P, mpt>("POINT(0 0)", "MULTIPOINT(0 0, 1 0)", "0FFFFF0F2");
35 }
36
37 template <typename P>
38 void test_multipoint_multipoint()
39 {
40 typedef bg::model::multi_point<P> mpt;
41
42 test_geometry<mpt, mpt>("MULTIPOINT(0 0)", "MULTIPOINT(0 0)", "0FFFFFFF2");
43 test_geometry<mpt, mpt>("MULTIPOINT(1 0)", "MULTIPOINT(0 0)", "FF0FFF0F2");
44 test_geometry<mpt, mpt>("MULTIPOINT(0 0)", "MULTIPOINT(0 0, 1 0)", "0FFFFF0F2");
45 test_geometry<mpt, mpt>("MULTIPOINT(0 0, 1 0)", "MULTIPOINT(0 0)", "0F0FFFFF2");
46 test_geometry<mpt, mpt>("MULTIPOINT(0 0, 1 1)", "MULTIPOINT(0 0, 1 0)", "0F0FFF0F2");
47
48 //typedef bg::model::d2::point_xy<float> ptf;
49 //typedef bg::model::multi_point<ptf> mptf;
50 //test_geometry<mptf, mpt>("MULTIPOINT(0 0)", "MULTIPOINT(0 0)", "0FFFFFFF2");
51
52 // assertion failure in relate->boundary_checker->std::equal_range with msvc
53 if (BOOST_GEOMETRY_CONDITION(is_nan_case_supported<mpt>::value))
54 {
55 mpt g;
56 std::string wkt;
57 nan_case(g, wkt);
58
59 check_geometry(g, g, wkt, wkt, "*********");
60 }
61 }
62
63 template <typename P>
64 void test_point_linestring()
65 {
66 typedef bg::model::linestring<P> ls;
67
68 test_geometry<P, ls>("POINT(0 0)", "LINESTRING(0 0, 2 2, 3 2)", "F0FFFF102");
69 test_geometry<P, ls>("POINT(1 1)", "LINESTRING(0 0, 2 2, 3 2)", "0FFFFF102");
70 test_geometry<P, ls>("POINT(3 2)", "LINESTRING(0 0, 2 2, 3 2)", "F0FFFF102");
71 test_geometry<P, ls>("POINT(1 0)", "LINESTRING(0 0, 2 2, 3 2)", "FF0FFF102");
72
73 test_geometry<P, ls>("POINT(0 0)", "LINESTRING(0 0, 2 2, 3 2, 0 0)", "0FFFFF1F2");
74 test_geometry<P, ls>("POINT(1 1)", "LINESTRING(0 0, 2 2, 3 2, 0 0)", "0FFFFF1F2");
75 test_geometry<P, ls>("POINT(3 2)", "LINESTRING(0 0, 2 2, 3 2, 0 0)", "0FFFFF1F2");
76 test_geometry<P, ls>("POINT(1 0)", "LINESTRING(0 0, 2 2, 3 2, 0 0)", "FF0FFF1F2");
77 }
78
79 template <typename P>
80 void test_point_multilinestring()
81 {
82 typedef bg::model::linestring<P> ls;
83 typedef bg::model::multi_linestring<ls> mls;
84
85 test_geometry<P, mls>("POINT(0 0)", "MULTILINESTRING((0 0, 2 0, 2 2),(0 0, 0 2))", "0FFFFF102");
86 test_geometry<P, mls>("POINT(0 0)", "MULTILINESTRING((0 0, 2 0, 2 2),(0 0, 0 2, 2 2))", "0FFFFF1F2");
87 test_geometry<P, mls>("POINT(0 0)", "MULTILINESTRING((0 0, 2 0, 2 2),(0 0, 0 2, 2 2),(0 0, 1 1))", "F0FFFF102");
88
89 test_geometry<P, mls>("POINT(0 0)", "MULTILINESTRING((0 0,5 0),(0 0,0 5,5 0),(0 0,-5 0),(0 0,0 -5,-5 0))", "0FFFFF1F2");
90 test_geometry<P, mls>("POINT(5 0)", "MULTILINESTRING((0 0,5 0),(0 0,0 5,5 0),(0 0,-5 0),(0 0,0 -5,-5 0))", "0FFFFF1F2");
91 test_geometry<P, mls>("POINT(1 0)", "MULTILINESTRING((0 0,5 0),(0 0,0 5,5 0),(0 0,-5 0),(0 0,0 -5,-5 0))", "0FFFFF1F2");
92
93 // assertion failure in relate->boundary_checker->std::equal_range with msvc
94 if (BOOST_GEOMETRY_CONDITION(is_nan_case_supported<mls>::value))
95 {
96 // on the boundary
97 std::string wkt0 = "POINT(3.1e+307 1)";
98 P g0;
99 bg::read_wkt(wkt0, g0);
100
101 // disjoint
102 std::string wkt1 = "POINT(1.1e+308 1.2e+308)";
103 P g1;
104 bg::read_wkt(wkt1, g1);
105
106 mls g2;
107 std::string wkt2;
108 nan_case(g2, wkt2);
109
110 check_geometry(g0, g2, wkt0, wkt2, "*********");
111 check_geometry(g1, g2, wkt1, wkt2, "*********");
112 }
113 }
114
115 template <typename P>
116 void test_all()
117 {
118 test_point_point<P>();
119 test_point_multipoint<P>();
120 test_multipoint_multipoint<P>();
121 test_point_linestring<P>();
122 test_point_multilinestring<P>();
123 }
124
125 int test_main( int , char* [] )
126 {
127 check_mask();
128
129 test_all<bg::model::d2::point_xy<int> >();
130 test_all<bg::model::d2::point_xy<double> >();
131
132 #if defined(HAVE_TTMATH)
133 test_all<bg::model::d2::point_xy<ttmath_big> >();
134 #endif
135
136 return 0;
137 }