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