always_simple.hpp 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. // Boost.Geometry (aka GGL, Generic Geometry Library)
  2. // Copyright (c) 2014-2017, Oracle and/or its affiliates.
  3. // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
  4. // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
  5. // Licensed under the Boost Software License version 1.0.
  6. // http://www.boost.org/users/license.html
  7. #ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_IS_SIMPLE_ALWAYS_SIMPLE_HPP
  8. #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_IS_SIMPLE_ALWAYS_SIMPLE_HPP
  9. #include <boost/geometry/core/tags.hpp>
  10. #include <boost/geometry/algorithms/dispatch/is_simple.hpp>
  11. namespace boost { namespace geometry
  12. {
  13. #ifndef DOXYGEN_NO_DETAIL
  14. namespace detail { namespace is_simple
  15. {
  16. template <typename Geometry>
  17. struct always_simple
  18. {
  19. template <typename Strategy>
  20. static inline bool apply(Geometry const&, Strategy const&)
  21. {
  22. return true;
  23. }
  24. };
  25. }} // namespace detail::is_simple
  26. #endif // DOXYGEN_NO_DETAIL
  27. #ifndef DOXYGEN_NO_DISPATCH
  28. namespace dispatch
  29. {
  30. // A point is always simple
  31. template <typename Point>
  32. struct is_simple<Point, point_tag>
  33. : detail::is_simple::always_simple<Point>
  34. {};
  35. // A valid segment is always simple.
  36. // A segment is a curve.
  37. // A curve is simple if it does not pass through the same point twice,
  38. // with the possible exception of its two endpoints
  39. //
  40. // Reference: OGC 06-103r4 (6.1.6.1)
  41. template <typename Segment>
  42. struct is_simple<Segment, segment_tag>
  43. : detail::is_simple::always_simple<Segment>
  44. {};
  45. // A valid box is always simple
  46. // A box is a Polygon, and it satisfies the conditions for Polygon validity.
  47. //
  48. // Reference (for polygon validity): OGC 06-103r4 (6.1.11.1)
  49. template <typename Box>
  50. struct is_simple<Box, box_tag>
  51. : detail::is_simple::always_simple<Box>
  52. {};
  53. } // namespace dispatch
  54. #endif // DOXYGEN_NO_DISPATCH
  55. }} // namespace boost::geometry
  56. #endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_IS_SIMPLE_ALWAYS_SIMPLE_HPP