]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/geometry/test/algorithms/disjoint/test_disjoint_seg_box.hpp
import new upstream nautilus stable release 14.2.8
[ceph.git] / ceph / src / boost / libs / geometry / test / algorithms / disjoint / test_disjoint_seg_box.hpp
1 // Boost.Geometry
2
3 // Copyright (c) 2016-2017 Oracle and/or its affiliates.
4
5 // Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
6 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
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 #include <boost/geometry/algorithms/disjoint.hpp>
13 #include <boost/geometry/algorithms/make.hpp>
14
15 #include <boost/geometry/io/wkt/read.hpp>
16
17 template <typename Geometry1, typename Geometry2>
18 inline void test_disjoint_check(bool result, bool expected_result,
19 Geometry1 const& geometry1, Geometry2 const& geometry2)
20 {
21 BOOST_CHECK_MESSAGE((result == expected_result),
22 "result {" << result << "} different than expected result {"
23 << expected_result << "} for geometries "
24 << bg::wkt(geometry1) << " and " << bg::wkt(geometry2));
25 }
26
27 template <typename Geometry1, typename Geometry2>
28 inline void test_disjoint(std::string const& wkt1,
29 std::string const& wkt2,
30 bool const expected_result)
31 {
32 Geometry1 geometry1;
33 bg::read_wkt(wkt1, geometry1);
34
35 Geometry2 geometry2;
36 bg::read_wkt(wkt2, geometry2);
37
38 test_disjoint_check(bg::disjoint(geometry1, geometry2), expected_result,
39 geometry1, geometry2);
40 //reverse
41 test_disjoint_check(bg::disjoint(geometry2, geometry1), expected_result,
42 geometry2, geometry1);
43 }
44
45 template <typename Geometry1, typename Geometry2, typename Strategy>
46 inline void test_disjoint_strategy(std::string const& wkt1,
47 std::string const& wkt2,
48 bool const expected_result,
49 Strategy strategy)
50 {
51 Geometry1 geometry1;
52 bg::read_wkt(wkt1, geometry1);
53
54 Geometry2 geometry2;
55 bg::read_wkt(wkt2, geometry2);
56
57 test_disjoint_check(bg::disjoint(geometry1, geometry2, strategy), expected_result,
58 geometry1, geometry2);
59 //reverse
60 test_disjoint_check(bg::disjoint(geometry2, geometry1, strategy), expected_result,
61 geometry2, geometry1);
62 }