• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Boost.Geometry (aka GGL, Generic Geometry Library)
2 
3 // Copyright (c) 2017-2017 Barend Gehrels, Amsterdam, the Netherlands.
4 // Copyright (c) 2017 Adam Wulkiewicz, Lodz, Poland.
5 
6 // Use, modification and distribution is subject to the Boost Software License,
7 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
8 // http://www.boost.org/LICENSE_1_0.txt)
9 
10 #ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_IS_SELF_TURN_HPP
11 #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_IS_SELF_TURN_HPP
12 
13 #include <boost/geometry/algorithms/detail/overlay/overlay_type.hpp>
14 
15 namespace boost { namespace geometry
16 {
17 
18 
19 #ifndef DOXYGEN_NO_DETAIL
20 namespace detail { namespace overlay
21 {
22 
23 template <overlay_type OverlayType>
24 struct is_self_turn_check
25 {
26     template <typename Turn>
applyboost::geometry::detail::overlay::is_self_turn_check27     static inline bool apply(Turn const& turn)
28     {
29         return turn.operations[0].seg_id.source_index
30                 == turn.operations[1].seg_id.source_index;
31     }
32 };
33 
34 template <>
35 struct is_self_turn_check<overlay_buffer>
36 {
37     template <typename Turn>
applyboost::geometry::detail::overlay::is_self_turn_check38     static inline bool apply(Turn const& /*turn*/)
39     {
40         return false;
41     }
42 };
43 
44 template <>
45 struct is_self_turn_check<overlay_dissolve>
46 {
47     template <typename Turn>
applyboost::geometry::detail::overlay::is_self_turn_check48     static inline bool apply(Turn const& /*turn*/)
49     {
50         return false;
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