is_self_turn.hpp 1.5 KB

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