1 // Boost.Geometry (aka GGL, Generic Geometry Library)
2 
3 // Copyright (c) 2014-2015, Oracle and/or its affiliates.
4 
5 // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
6 
7 // Licensed under the Boost Software License version 1.0.
8 // http://www.boost.org/users/license.html
9 
10 #ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_IS_VALID_DEBUG_PRINT_TURNS_HPP
11 #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_IS_VALID_DEBUG_PRINT_TURNS_HPP
12 
13 #ifdef BOOST_GEOMETRY_TEST_DEBUG
14 #include <iostream>
15 
16 #include <boost/geometry/io/dsv/write.hpp>
17 #include <boost/geometry/algorithms/detail/overlay/debug_turn_info.hpp>
18 #endif
19 
20 
21 namespace boost { namespace geometry
22 {
23 
24 namespace detail { namespace is_valid
25 {
26 
27 #ifdef BOOST_GEOMETRY_TEST_DEBUG
28 template <typename Turn>
debug_print_turn(Turn const & turn)29 inline void debug_print_turn(Turn const& turn)
30 {
31     std::cout << " ["
32               << geometry::method_char(turn.method)
33               << ","
34               << geometry::operation_char(turn.operations[0].operation)
35               << "/"
36               << geometry::operation_char(turn.operations[1].operation)
37               << " {"
38               << turn.operations[0].seg_id.multi_index
39               << ", "
40               << turn.operations[1].seg_id.multi_index
41               << "} {"
42               << turn.operations[0].seg_id.ring_index
43               << ", "
44               << turn.operations[1].seg_id.ring_index
45               << "} {"
46               << turn.operations[0].seg_id.segment_index
47               << ", "
48               << turn.operations[1].seg_id.segment_index
49               << "} "
50               << geometry::dsv(turn.point)
51               << "]";
52 }
53 
54 template <typename TurnIterator>
debug_print_turns(TurnIterator first,TurnIterator beyond)55 inline void debug_print_turns(TurnIterator first, TurnIterator beyond)
56 {
57     std::cout << "turns:";
58     for (TurnIterator tit = first; tit != beyond; ++tit)
59     {
60         debug_print_turn(*tit);
61     }
62     std::cout << std::endl << std::endl;
63 }
64 #else
65 template <typename Turn>
66 inline void debug_print_turn(Turn const&)
67 {}
68 
69 template <typename TurnIterator>
70 inline void debug_print_turns(TurnIterator, TurnIterator)
71 {}
72 #endif // BOOST_GEOMETRY_TEST_DEBUG
73 
74 }} // namespace detail::is_valid
75 
76 }} // namespace boost::geometry
77 
78 #endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_IS_VALID_DEBUG_PRINT_TURNS_HPP
79