stream_info.hpp 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. // Boost.Geometry (aka GGL, Generic Geometry Library)
  2. // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
  3. // This file was modified by Oracle on 2018.
  4. // Modifications copyright (c) 2018 Oracle and/or its affiliates.
  5. // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
  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. #ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_STREAM_INFO_HPP
  10. #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_STREAM_INFO_HPP
  11. #include <string>
  12. #include <boost/geometry/algorithms/detail/overlay/turn_info.hpp>
  13. namespace boost { namespace geometry
  14. {
  15. #ifndef DOXYGEN_NO_DETAIL
  16. namespace detail { namespace overlay
  17. {
  18. static inline std::string dir(int d)
  19. {
  20. return d == 0 ? "-" : (d == 1 ? "L" : d == -1 ? "R" : "#");
  21. }
  22. static inline std::string how_str(int h)
  23. {
  24. return h == 0 ? "-" : (h == 1 ? "A" : "D");
  25. }
  26. template <typename P, typename SR, typename O, typename C>
  27. std::ostream& operator<<(std::ostream &os, turn_info<P, SR, O, C> const& info)
  28. {
  29. os << "\t"
  30. << " src " << info.seg_id.source_index
  31. << " seg " << info.seg_id.segment_index
  32. << " (// " << info.other_id.source_index
  33. << "." << info.other_id.segment_index << ")"
  34. << " how " << info.how
  35. << "[" << how_str(info.arrival)
  36. << " " << dir(info.direction)
  37. << (info.opposite ? " o" : "")
  38. << "]"
  39. << " sd "
  40. << dir(info.sides.template get<0,0>())
  41. << dir(info.sides.template get<0,1>())
  42. << dir(info.sides.template get<1,0>())
  43. << dir(info.sides.template get<1,1>())
  44. << " nxt seg " << info.travels_to_vertex_index
  45. << " , ip " << info.travels_to_ip_index
  46. << " , or " << info.next_ip_index
  47. << " frac " << info.fraction
  48. << info.visit_state;
  49. if (info.flagged)
  50. {
  51. os << " FLAGGED";
  52. }
  53. return os;
  54. }
  55. }} // namespace detail::overlay
  56. #endif //DOXYGEN_NO_DETAIL
  57. }} // namespace boost::geometry
  58. #endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_STREAM_INFO_HPP