1 // Boost.Geometry (aka GGL, Generic Geometry Library)
2 
3 // Copyright (c) 2017-2017 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_IS_SELF_TURN_HPP
10 #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_IS_SELF_TURN_HPP
11 
12 #include <boost/geometry/algorithms/detail/overlay/overlay_type.hpp>
13 
14 namespace boost { namespace geometry
15 {
16 
17 
18 #ifndef DOXYGEN_NO_DETAIL
19 namespace detail { namespace overlay
20 {
21 
22 template <overlay_type OverlayType>
23 struct is_self_turn_check
24 {
25     template <typename Turn>
applyboost::geometry::detail::overlay::is_self_turn_check26     static inline bool apply(Turn const& turn)
27     {
28         return turn.operations[0].seg_id.source_index
29                 == turn.operations[1].seg_id.source_index;
30     }
31 };
32 
33 template <>
34 struct is_self_turn_check<overlay_buffer>
35 {
36     template <typename Turn>
applyboost::geometry::detail::overlay::is_self_turn_check37     static inline bool apply(Turn const& turn)
38     {
39         return false;
40     }
41 };
42 
43 template <>
44 struct is_self_turn_check<overlay_dissolve>
45 {
46     template <typename Turn>
applyboost::geometry::detail::overlay::is_self_turn_check47     static inline bool apply(Turn const& turn)
48     {
49         return false;
50     }
51 };
52 
53 
54 template <overlay_type OverlayType, typename Turn>
is_self_turn(Turn const & turn)55 bool is_self_turn(Turn const& turn)
56 {
57     return is_self_turn_check<OverlayType>::apply(turn);
58 }
59 
60 
61 }} // namespace detail::overlay
62 #endif // DOXYGEN_NO_DETAIL
63 
64 
65 }} // namespace boost::geometry
66 
67 
68 #endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_IS_SELF_TURN_HPP
69