]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/geometry/include/boost/geometry/algorithms/detail/turns/print_turns.hpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / geometry / include / boost / geometry / algorithms / detail / turns / print_turns.hpp
1 // Boost.Geometry (aka GGL, Generic Geometry Library)
2
3 // Copyright (c) 2014, Oracle and/or its affiliates.
4
5 // Licensed under the Boost Software License version 1.0.
6 // http://www.boost.org/users/license.html
7
8 // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
9
10 #ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_TURNS_PRINT_TURNS_HPP
11 #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_TURNS_PRINT_TURNS_HPP
12
13 #include <algorithm>
14 #include <iostream>
15
16 #include <boost/range.hpp>
17
18 #include <boost/geometry/algorithms/detail/overlay/traversal_info.hpp>
19 #include <boost/geometry/algorithms/detail/overlay/turn_info.hpp>
20 #include <boost/geometry/algorithms/detail/overlay/debug_turn_info.hpp>
21 #include <boost/geometry/io/wkt/write.hpp>
22 #include <boost/geometry/io/dsv/write.hpp>
23
24 namespace boost { namespace geometry
25 {
26
27 namespace detail { namespace turns
28 {
29
30 struct turn_printer
31 {
32 turn_printer(std::ostream & os)
33 : index(0)
34 , out(os)
35 {}
36
37 template <typename Turn>
38 void operator()(Turn const& turn)
39 {
40 out << index
41 << ": " << geometry::method_char(turn.method);
42
43 if ( turn.discarded )
44 out << " (discarded)\n";
45 else if ( turn.blocked() )
46 out << " (blocked)\n";
47 else
48 out << '\n';
49
50 double fraction[2];
51
52 fraction[0] = turn.operations[0].fraction.numerator()
53 / turn.operations[0].fraction.denominator();
54
55 out << geometry::operation_char(turn.operations[0].operation)
56 <<": seg: " << turn.operations[0].seg_id.source_index
57 << ", m: " << turn.operations[0].seg_id.multi_index
58 << ", r: " << turn.operations[0].seg_id.ring_index
59 << ", s: " << turn.operations[0].seg_id.segment_index;
60 out << ", fr: " << fraction[0];
61 out << ", col?: " << turn.operations[0].is_collinear;
62 out << ' ' << geometry::dsv(turn.point) << ' ';
63
64 out << '\n';
65
66 fraction[1] = turn.operations[1].fraction.numerator()
67 / turn.operations[1].fraction.denominator();
68
69 out << geometry::operation_char(turn.operations[1].operation)
70 << ": seg: " << turn.operations[1].seg_id.source_index
71 << ", m: " << turn.operations[1].seg_id.multi_index
72 << ", r: " << turn.operations[1].seg_id.ring_index
73 << ", s: " << turn.operations[1].seg_id.segment_index;
74 out << ", fr: " << fraction[1];
75 out << ", col?: " << turn.operations[1].is_collinear;
76 out << ' ' << geometry::dsv(turn.point) << ' ';
77
78 ++index;
79 out << std::endl;
80 }
81
82 int index;
83 std::ostream & out;
84 };
85
86 template <typename Geometry1, typename Geometry2, typename Turns>
87 static inline void print_turns(Geometry1 const& g1,
88 Geometry2 const& g2,
89 Turns const& turns)
90 {
91 std::cout << geometry::wkt(g1) << std::endl;
92 std::cout << geometry::wkt(g2) << std::endl;
93
94 std::for_each(boost::begin(turns), boost::end(turns), turn_printer(std::cout));
95 }
96
97
98
99
100 }} // namespace detail::turns
101
102 }} // namespace boost::geometry
103
104
105 #endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_TURNS_PRINT_TURNS_HPP