debug_turn_info.hpp 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. // Boost.Geometry (aka GGL, Generic Geometry Library)
  2. // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
  3. // Use, modification and distribution is subject to the Boost Software License,
  4. // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
  5. // http://www.boost.org/LICENSE_1_0.txt)
  6. #ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_DEBUG_TURN_INFO_HPP
  7. #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_DEBUG_TURN_INFO_HPP
  8. #include <boost/geometry/algorithms/detail/overlay/turn_info.hpp>
  9. #include <boost/geometry/algorithms/detail/overlay/visit_info.hpp>
  10. namespace boost { namespace geometry
  11. {
  12. inline char method_char(detail::overlay::method_type const& method)
  13. {
  14. using namespace detail::overlay;
  15. switch(method)
  16. {
  17. case method_none : return '-';
  18. case method_disjoint : return 'd';
  19. case method_crosses : return 'i';
  20. case method_touch : return 't';
  21. case method_touch_interior : return 'm';
  22. case method_collinear : return 'c';
  23. case method_equal : return 'e';
  24. case method_start : return 's';
  25. case method_error : return '!';
  26. default : return '?';
  27. }
  28. }
  29. inline char operation_char(detail::overlay::operation_type const& operation)
  30. {
  31. using namespace detail::overlay;
  32. switch(operation)
  33. {
  34. case operation_none : return '-';
  35. case operation_union : return 'u';
  36. case operation_intersection : return 'i';
  37. case operation_blocked : return 'x';
  38. case operation_continue : return 'c';
  39. case operation_opposite : return 'o';
  40. default : return '?';
  41. }
  42. }
  43. inline char visited_char(detail::overlay::visit_info const& v)
  44. {
  45. if (v.rejected()) return 'R';
  46. if (v.started()) return 's';
  47. if (v.visited()) return 'v';
  48. if (v.none()) return '-';
  49. if (v.finished()) return 'f';
  50. return '?';
  51. }
  52. }} // namespace boost::geometry
  53. #endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_DEBUG_TURN_INFO_HPP