1 // Boost.Geometry (aka GGL, Generic Geometry Library) 2 3 // Copyright (c) 2007-2011 Barend Gehrels, Amsterdam, the Netherlands. 4 5 // Use, modification and distribution is subject to the Boost Software License, 6 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at 7 // http://www.boost.org/LICENSE_1_0.txt) 8 9 #ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_STREAM_INFO_HPP 10 #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_STREAM_INFO_HPP 11 12 13 #include <string> 14 15 #include <boost/array.hpp> 16 17 18 namespace boost { namespace geometry 19 { 20 21 #ifndef DOXYGEN_NO_DETAIL 22 namespace detail { namespace overlay 23 { 24 25 dir(int d)26 static inline std::string dir(int d) 27 { 28 return d == 0 ? "-" : (d == 1 ? "L" : d == -1 ? "R" : "#"); 29 } how_str(int h)30 static inline std::string how_str(int h) 31 { 32 return h == 0 ? "-" : (h == 1 ? "A" : "D"); 33 } 34 35 template <typename P> operator <<(std::ostream & os,turn_info<P> const & info)36 std::ostream& operator<<(std::ostream &os, turn_info<P> const& info) 37 { 38 typename geometry::coordinate_type<P>::type d = info.distance; 39 os << "\t" 40 << " src " << info.seg_id.source_index 41 << " seg " << info.seg_id.segment_index 42 << " (// " << info.other_id.source_index 43 << "." << info.other_id.segment_index << ")" 44 << " how " << info.how 45 << "[" << how_str(info.arrival) 46 << " " << dir(info.direction) 47 << (info.opposite ? " o" : "") 48 << "]" 49 << " sd " 50 << dir(info.sides.get<0,0>()) 51 << dir(info.sides.get<0,1>()) 52 << dir(info.sides.get<1,0>()) 53 << dir(info.sides.get<1,1>()) 54 << " nxt seg " << info.travels_to_vertex_index 55 << " , ip " << info.travels_to_ip_index 56 << " , or " << info.next_ip_index 57 << " dst " << double(d) 58 << info.visit_state; 59 if (info.flagged) 60 { 61 os << " FLAGGED"; 62 } 63 return os; 64 } 65 66 67 68 }} // namespace detail::overlay 69 #endif //DOXYGEN_NO_DETAIL 70 71 72 }} // namespace boost::geometry 73 74 75 #endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_STREAM_INFO_HPP 76