]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | // Generic Geometry2 Library |
2 | // Unit Test | |
3 | ||
4 | // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. | |
5 | ||
6 | // This file was modified by Oracle on 2015. | |
7 | // Modifications copyright (c) 2015 Oracle and/or its affiliates. | |
8 | ||
9 | // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle | |
10 | ||
11 | // Use, modification and distribution is subject to the Boost Software License, | |
12 | // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at | |
13 | // http://www.boost.org/LICENSE_1_0.txt) | |
14 | ||
15 | #ifndef BOOST_GEOMETRY_TEST_OVERLAPS_HPP | |
16 | #define BOOST_GEOMETRY_TEST_OVERLAPS_HPP | |
17 | ||
18 | ||
19 | #include <geometry_test_common.hpp> | |
20 | ||
21 | #include <boost/geometry/core/ring_type.hpp> | |
22 | #include <boost/geometry/algorithms/overlaps.hpp> | |
23 | #include <boost/geometry/strategies/strategies.hpp> | |
24 | #include <boost/geometry/geometries/geometries.hpp> | |
25 | #include <boost/geometry/geometries/point_xy.hpp> | |
26 | ||
27 | #include <boost/geometry/io/wkt/read.hpp> | |
28 | ||
29 | ||
30 | template <typename Geometry1, typename Geometry2> | |
31 | void test_geometry(Geometry1 const& geometry1, | |
32 | Geometry2 const& geometry2, | |
33 | std::string const& wkt1, | |
34 | std::string const& wkt2, | |
35 | bool expected) | |
36 | { | |
37 | bool detected = bg::overlaps(geometry1, geometry2); | |
38 | ||
39 | BOOST_CHECK_MESSAGE(detected == expected, | |
40 | "overlaps: " << wkt1 | |
41 | << " with " << wkt2 | |
42 | << " -> Expected: " << expected | |
43 | << " detected: " << detected); | |
44 | ||
45 | detected = bg::overlaps(geometry2, geometry1); | |
46 | ||
47 | BOOST_CHECK_MESSAGE(detected == expected, | |
48 | "overlaps: " << wkt1 | |
49 | << " with " << wkt2 | |
50 | << " -> Expected: " << expected | |
51 | << " detected: " << detected); | |
52 | } | |
53 | ||
54 | template <typename Geometry1, typename Geometry2> | |
55 | void test_geometry(std::string const& wkt1, | |
56 | std::string const& wkt2, | |
57 | bool expected) | |
58 | { | |
59 | Geometry1 geometry1; | |
60 | Geometry2 geometry2; | |
61 | ||
62 | bg::read_wkt(wkt1, geometry1); | |
63 | bg::read_wkt(wkt2, geometry2); | |
64 | ||
65 | test_geometry(geometry1, geometry2, wkt1, wkt2, expected); | |
66 | } | |
67 | ||
68 | ||
69 | #endif |