1 // Boost.Geometry Index
2 // Unit Test
3
4 // Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland.
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 #ifndef BOOST_GEOMETRY_INDEX_TEST_UNION_CONTENT_HPP
11 #define BOOST_GEOMETRY_INDEX_TEST_UNION_CONTENT_HPP
12
13 #include <geometry_index_test_common.hpp>
14
15 #include <boost/geometry/index/detail/algorithms/union_content.hpp>
16
17 template <typename Geometry>
test_union_content(Geometry const & geometry1,Geometry const & geometry2,typename bgi::detail::default_content_result<Geometry>::type expected_value)18 void test_union_content(Geometry const& geometry1, Geometry const& geometry2,
19 typename bgi::detail::default_content_result<Geometry>::type expected_value)
20 {
21 typename bgi::detail::default_content_result<Geometry>::type value = bgi::detail::union_content(geometry1, geometry2);
22
23 #ifdef BOOST_GEOMETRY_TEST_DEBUG
24 std::ostringstream out;
25 out << typeid(typename bg::coordinate_type<Geometry>::type).name()
26 << " "
27 << typeid(typename bgi::detail::default_content_result<Geometry>::type).name()
28 << " "
29 << "union_content : " << value
30 << std::endl;
31 std::cout << out.str();
32 #endif
33
34 BOOST_CHECK_CLOSE(value, expected_value, 0.0001);
35 }
36
37 template <typename Geometry>
test_geometry(std::string const & wkt1,std::string const & wkt2,typename bgi::detail::default_content_result<Geometry>::type expected_value)38 void test_geometry(std::string const& wkt1, std::string const& wkt2,
39 typename bgi::detail::default_content_result<Geometry>::type expected_value)
40 {
41 Geometry geometry1, geometry2;
42 bg::read_wkt(wkt1, geometry1);
43 bg::read_wkt(wkt2, geometry2);
44 test_union_content(geometry1, geometry2, expected_value);
45 }
46
47 #endif
48