debug_turn.hpp 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. // Boost.Geometry (aka GGL, Generic Geometry Library)
  2. // Copyright (c) 2014, Oracle and/or its affiliates.
  3. // Licensed under the Boost Software License version 1.0.
  4. // http://www.boost.org/users/license.html
  5. // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
  6. #ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_TURNS_DEBUG_TURN_HPP
  7. #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_TURNS_DEBUG_TURN_HPP
  8. #ifdef BOOST_GEOMETRY_DEBUG_TURNS
  9. #include <iostream>
  10. #include <string>
  11. #include <boost/algorithm/string/predicate.hpp>
  12. #include <boost/geometry/io/wkt/write.hpp>
  13. #include <boost/geometry/algorithms/detail/overlay/debug_turn_info.hpp>
  14. #endif // BOOST_GEOMETRY_DEBUG_TURNS
  15. namespace boost { namespace geometry
  16. {
  17. #ifndef DOXYGEN_NO_DETAIL
  18. namespace detail { namespace turns
  19. {
  20. #ifdef BOOST_GEOMETRY_DEBUG_TURNS
  21. template <typename Turn, typename Operation>
  22. inline void debug_turn(Turn const& turn, Operation op,
  23. std::string const& header)
  24. {
  25. std::cout << header
  26. << " at " << op.seg_id
  27. << " meth: " << method_char(turn.method)
  28. << " op: " << operation_char(op.operation)
  29. << " of: " << operation_char(turn.operations[0].operation)
  30. << operation_char(turn.operations[1].operation)
  31. << " " << geometry::wkt(turn.point)
  32. << std::endl;
  33. if (boost::contains(header, "Finished"))
  34. {
  35. std::cout << std::endl;
  36. }
  37. }
  38. #else
  39. template <typename Turn, typename Operation>
  40. inline void debug_turn(Turn const& , Operation, const char*)
  41. {
  42. }
  43. #endif // BOOST_GEOMETRY_DEBUG_TURNS
  44. }} // namespace detail::turns
  45. #endif // DOXYGEN_NO_DETAIL
  46. }} // namespace boost:geometry
  47. #endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_TURNS_DEBUG_TURN_HPP