debug_print_turns.hpp 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. // Boost.Geometry (aka GGL, Generic Geometry Library)
  2. // Copyright (c) 2014-2015, Oracle and/or its affiliates.
  3. // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
  4. // Licensed under the Boost Software License version 1.0.
  5. // http://www.boost.org/users/license.html
  6. #ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_IS_VALID_DEBUG_PRINT_TURNS_HPP
  7. #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_IS_VALID_DEBUG_PRINT_TURNS_HPP
  8. #ifdef BOOST_GEOMETRY_TEST_DEBUG
  9. #include <iostream>
  10. #include <boost/geometry/io/dsv/write.hpp>
  11. #include <boost/geometry/algorithms/detail/overlay/debug_turn_info.hpp>
  12. #endif
  13. namespace boost { namespace geometry
  14. {
  15. namespace detail { namespace is_valid
  16. {
  17. #ifdef BOOST_GEOMETRY_TEST_DEBUG
  18. template <typename Turn>
  19. inline void debug_print_turn(Turn const& turn)
  20. {
  21. std::cout << " ["
  22. << geometry::method_char(turn.method)
  23. << ","
  24. << geometry::operation_char(turn.operations[0].operation)
  25. << "/"
  26. << geometry::operation_char(turn.operations[1].operation)
  27. << " {"
  28. << turn.operations[0].seg_id.multi_index
  29. << ", "
  30. << turn.operations[1].seg_id.multi_index
  31. << "} {"
  32. << turn.operations[0].seg_id.ring_index
  33. << ", "
  34. << turn.operations[1].seg_id.ring_index
  35. << "} {"
  36. << turn.operations[0].seg_id.segment_index
  37. << ", "
  38. << turn.operations[1].seg_id.segment_index
  39. << "} "
  40. << geometry::dsv(turn.point)
  41. << "]";
  42. }
  43. template <typename TurnIterator>
  44. inline void debug_print_turns(TurnIterator first, TurnIterator beyond)
  45. {
  46. std::cout << "turns:";
  47. for (TurnIterator tit = first; tit != beyond; ++tit)
  48. {
  49. debug_print_turn(*tit);
  50. }
  51. std::cout << std::endl << std::endl;
  52. }
  53. #else
  54. template <typename Turn>
  55. inline void debug_print_turn(Turn const&)
  56. {}
  57. template <typename TurnIterator>
  58. inline void debug_print_turns(TurnIterator, TurnIterator)
  59. {}
  60. #endif // BOOST_GEOMETRY_TEST_DEBUG
  61. }} // namespace detail::is_valid
  62. }} // namespace boost::geometry
  63. #endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_IS_VALID_DEBUG_PRINT_TURNS_HPP