]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/geometry/test/algorithms/relational_operations/intersects/test_intersects.hpp
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / geometry / test / algorithms / relational_operations / intersects / test_intersects.hpp
1 // Boost.Geometry (aka GGL, Generic Geometry Library)
2 // Unit Test
3
4 // Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands.
5 // Copyright (c) 2013-2015 Adam Wulkiewicz, Lodz, Poland.
6
7 // Use, modification and distribution is subject to the Boost Software License,
8 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
9 // http://www.boost.org/LICENSE_1_0.txt)
10
11 #ifndef BOOST_GEOMETRY_TEST_INTERSECTS_HPP
12 #define BOOST_GEOMETRY_TEST_INTERSECTS_HPP
13
14
15 #include <geometry_test_common.hpp>
16
17
18 #include <boost/geometry/core/geometry_id.hpp>
19 #include <boost/geometry/core/point_order.hpp>
20 #include <boost/geometry/core/ring_type.hpp>
21 #include <boost/geometry/algorithms/covered_by.hpp>
22 #include <boost/geometry/algorithms/intersects.hpp>
23 #include <boost/geometry/strategies/strategies.hpp>
24 #include <boost/geometry/geometries/ring.hpp>
25 #include <boost/geometry/geometries/polygon.hpp>
26 #include <boost/geometry/geometries/multi_linestring.hpp>
27 #include <boost/geometry/geometries/multi_polygon.hpp>
28
29 #include <boost/geometry/io/wkt/read.hpp>
30
31 template <typename Geometry1, typename Geometry2>
32 void test_geometry(std::string const& wkt1,
33 std::string const& wkt2, bool expected)
34 {
35 Geometry1 geometry1;
36 Geometry2 geometry2;
37
38 bg::read_wkt(wkt1, geometry1);
39 bg::read_wkt(wkt2, geometry2);
40
41 bool detected = bg::intersects(geometry1, geometry2);
42 bool detected2 = bg::intersects(geometry2, geometry1);
43
44 BOOST_CHECK_MESSAGE(detected == expected,
45 "intersects: " << wkt1
46 << " with " << wkt2
47 << " -> Expected: " << expected
48 << " detected: " << detected);
49 BOOST_CHECK_MESSAGE(detected2 == expected,
50 "intersects: " << wkt1
51 << " with " << wkt2
52 << " -> Expected: " << expected
53 << " detected: " << detected2);
54 }
55
56
57 template <typename Geometry>
58 void test_self_intersects(std::string const& wkt, bool expected)
59 {
60 Geometry geometry;
61
62 bg::read_wkt(wkt, geometry);
63
64 bool detected = bg::intersects(geometry);
65
66 BOOST_CHECK_MESSAGE(detected == expected,
67 "intersects: " << wkt
68 << " -> Expected: " << expected
69 << " detected: " << detected);
70 }
71
72
73
74 #endif