Imported Upstream version 1.57.0
[platform/upstream/boost.git] / boost / geometry / algorithms / detail / overlay / stream_info.hpp
1 // Boost.Geometry (aka GGL, Generic Geometry Library)
2
3 // Copyright (c) 2007-2012 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
26     static inline std::string dir(int d)
27     {
28         return d == 0 ? "-" : (d == 1 ? "L" : d == -1 ? "R" : "#");
29     }
30     static inline std::string how_str(int h)
31     {
32         return h == 0 ? "-" : (h == 1 ? "A" : "D");
33     }
34
35     template <typename P>
36     std::ostream& operator<<(std::ostream &os, turn_info<P> const& info)
37     {
38         os  << "\t"
39             << " src " << info.seg_id.source_index
40             << " seg " << info.seg_id.segment_index
41             << " (// " << info.other_id.source_index
42                 << "." << info.other_id.segment_index << ")"
43             << " how " << info.how
44                 << "[" << how_str(info.arrival)
45                 << " " << dir(info.direction)
46                 << (info.opposite ? " o" : "")
47                 << "]"
48             << " sd "
49                 << dir(info.sides.get<0,0>())
50                 << dir(info.sides.get<0,1>())
51                 << dir(info.sides.get<1,0>())
52                 << dir(info.sides.get<1,1>())
53             << " nxt seg " << info.travels_to_vertex_index
54             << " , ip " << info.travels_to_ip_index
55             << " , or " << info.next_ip_index
56             << " frac " << info.fraction
57             << info.visit_state;
58         if (info.flagged)
59         {
60             os << " FLAGGED";
61         }
62         return os;
63     }
64
65
66
67 }} // namespace detail::overlay
68 #endif //DOXYGEN_NO_DETAIL
69
70
71 }} // namespace boost::geometry
72
73
74 #endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_STREAM_INFO_HPP