point_in_poly_winding.hpp 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. // Boost.Geometry (aka GGL, Generic Geometry Library)
  2. // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
  3. // Copyright (c) 2013 Adam Wulkiewicz, Lodz, Poland.
  4. // This file was modified by Oracle on 2013, 2014, 2016, 2017, 2019.
  5. // Modifications copyright (c) 2013-2019 Oracle and/or its affiliates.
  6. // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
  7. // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
  8. // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
  9. // Use, modification and distribution is subject to the Boost Software License,
  10. // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
  11. // http://www.boost.org/LICENSE_1_0.txt)
  12. #ifndef BOOST_GEOMETRY_STRATEGY_AGNOSTIC_POINT_IN_POLY_WINDING_HPP
  13. #define BOOST_GEOMETRY_STRATEGY_AGNOSTIC_POINT_IN_POLY_WINDING_HPP
  14. #include <boost/mpl/assert.hpp>
  15. #include <boost/geometry/core/cs.hpp>
  16. #include <boost/geometry/core/tag_cast.hpp>
  17. #include <boost/geometry/core/tags.hpp>
  18. #include <boost/geometry/strategies/cartesian/point_in_poly_winding.hpp>
  19. #include <boost/geometry/strategies/side.hpp>
  20. #include <boost/geometry/strategies/spherical/point_in_poly_winding.hpp>
  21. namespace boost { namespace geometry
  22. {
  23. namespace strategy { namespace within
  24. {
  25. #ifndef DOXYGEN_NO_DETAIL
  26. namespace detail
  27. {
  28. template
  29. <
  30. typename Point,
  31. typename PointOfSegment,
  32. typename CalculationType,
  33. typename CSTag = typename tag_cast
  34. <
  35. typename cs_tag<Point>::type,
  36. spherical_tag
  37. >::type
  38. >
  39. struct winding_base_type
  40. {
  41. BOOST_MPL_ASSERT_MSG(false,
  42. NOT_IMPLEMENTED_FOR_THIS_COORDINATE_SYSTEM,
  43. (CSTag));
  44. };
  45. template <typename Point, typename PointOfSegment, typename CalculationType>
  46. struct winding_base_type<Point, PointOfSegment, CalculationType, cartesian_tag>
  47. {
  48. typedef within::cartesian_winding<void, void, CalculationType> type;
  49. };
  50. template <typename Point, typename PointOfSegment, typename CalculationType>
  51. struct winding_base_type<Point, PointOfSegment, CalculationType, spherical_tag>
  52. {
  53. typedef within::detail::spherical_winding_base
  54. <
  55. typename strategy::side::services::default_strategy
  56. <
  57. typename cs_tag<Point>::type
  58. >::type,
  59. CalculationType
  60. > type;
  61. };
  62. } // namespace detail
  63. #endif // DOXYGEN_NO_DETAIL
  64. /*!
  65. \brief Within detection using winding rule. Side strategy used internally is
  66. choosen based on Point's coordinate system.
  67. \ingroup strategies
  68. \tparam Point \tparam_point
  69. \tparam PointOfSegment \tparam_segment_point
  70. \tparam CalculationType \tparam_calculation
  71. \qbk{
  72. [heading See also]
  73. [link geometry.reference.algorithms.within.within_3_with_strategy within (with strategy)]
  74. }
  75. */
  76. template
  77. <
  78. typename Point,
  79. typename PointOfSegment = Point,
  80. typename CalculationType = void
  81. >
  82. class winding
  83. : public within::detail::winding_base_type
  84. <
  85. Point, PointOfSegment, CalculationType
  86. >::type
  87. {
  88. typedef typename within::detail::winding_base_type
  89. <
  90. Point, PointOfSegment, CalculationType
  91. >::type base_t;
  92. public:
  93. winding() {}
  94. template <typename Model>
  95. explicit winding(Model const& model)
  96. : base_t(model)
  97. {}
  98. };
  99. }} // namespace strategy::within
  100. }} // namespace boost::geometry
  101. #endif // BOOST_GEOMETRY_STRATEGY_AGNOSTIC_POINT_IN_POLY_WINDING_HPP