test_union_content.hpp 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. // Boost.Geometry Index
  2. // Unit Test
  3. // Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland.
  4. // Use, modification and distribution is subject to the Boost Software License,
  5. // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
  6. // http://www.boost.org/LICENSE_1_0.txt)
  7. #ifndef BOOST_GEOMETRY_INDEX_TEST_UNION_CONTENT_HPP
  8. #define BOOST_GEOMETRY_INDEX_TEST_UNION_CONTENT_HPP
  9. #include <geometry_index_test_common.hpp>
  10. #include <boost/geometry/index/detail/algorithms/union_content.hpp>
  11. template <typename Geometry>
  12. void test_union_content(Geometry const& geometry1, Geometry const& geometry2,
  13. typename bgi::detail::default_content_result<Geometry>::type expected_value)
  14. {
  15. typename bgi::detail::default_content_result<Geometry>::type value = bgi::detail::union_content(geometry1, geometry2);
  16. #ifdef BOOST_GEOMETRY_TEST_DEBUG
  17. std::ostringstream out;
  18. out << typeid(typename bg::coordinate_type<Geometry>::type).name()
  19. << " "
  20. << typeid(typename bgi::detail::default_content_result<Geometry>::type).name()
  21. << " "
  22. << "union_content : " << value
  23. << std::endl;
  24. std::cout << out.str();
  25. #endif
  26. BOOST_CHECK_CLOSE(value, expected_value, 0.0001);
  27. }
  28. template <typename Geometry>
  29. void test_geometry(std::string const& wkt1, std::string const& wkt2,
  30. typename bgi::detail::default_content_result<Geometry>::type expected_value)
  31. {
  32. Geometry geometry1, geometry2;
  33. bg::read_wkt(wkt1, geometry1);
  34. bg::read_wkt(wkt2, geometry2);
  35. test_union_content(geometry1, geometry2, expected_value);
  36. }
  37. #endif