• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_MARGIN_HPP
11 #define BOOST_GEOMETRY_INDEX_TEST_MARGIN_HPP
12 
13 #include <geometry_index_test_common.hpp>
14 
15 #include <boost/geometry/index/detail/algorithms/margin.hpp>
16 
17 //#include <boost/geometry/io/wkt/read.hpp>
18 
19 template <typename Geometry>
test_margin(Geometry const & geometry,typename bgi::detail::default_margin_result<Geometry>::type expected_value)20 void test_margin(Geometry const& geometry,
21             typename bgi::detail::default_margin_result<Geometry>::type expected_value)
22 {
23     typename bgi::detail::default_margin_result<Geometry>::type value = bgi::detail::comparable_margin(geometry);
24 
25 #ifdef BOOST_GEOMETRY_TEST_DEBUG
26     std::ostringstream out;
27     out << typeid(typename bg::coordinate_type<Geometry>::type).name()
28         << " "
29         << typeid(typename bgi::detail::default_margin_result<Geometry>::type).name()
30         << " "
31         << "content : " << value
32         << std::endl;
33     std::cout << out.str();
34 #endif
35 
36     BOOST_CHECK_CLOSE(value, expected_value, 0.0001);
37 }
38 
39 template <typename Geometry>
test_geometry(std::string const & wkt,typename bgi::detail::default_margin_result<Geometry>::type expected_value)40 void test_geometry(std::string const& wkt,
41             typename bgi::detail::default_margin_result<Geometry>::type expected_value)
42 {
43     Geometry geometry;
44     bg::read_wkt(wkt, geometry);
45     test_margin(geometry, expected_value);
46 }
47 
48 #endif
49