diff --git a/include/boost/geometry/algorithms/detail/within/point_in_geometry.hpp b/include/boost/geometry/algorithms/detail/within/point_in_geometry.hpp index 0b45c7627..ea10fc465 100644 --- a/include/boost/geometry/algorithms/detail/within/point_in_geometry.hpp +++ b/include/boost/geometry/algorithms/detail/within/point_in_geometry.hpp @@ -17,18 +17,34 @@ #ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_WITHIN_POINT_IN_GEOMETRY_HPP #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_WITHIN_POINT_IN_GEOMETRY_HPP +#include +#include +#include + #include #include #include #include #include +#include namespace boost { namespace geometry { #ifndef DOXYGEN_NO_DETAIL namespace detail { namespace within { +int check_result_type(int result) +{ + return result; +} + +template +void check_result_type(T result) +{ + BOOST_ASSERT(false); +} + template inline int point_in_range(Point const& point, Range const& range, Strategy const& strategy) { @@ -50,7 +66,7 @@ int point_in_range(Point const& point, Range const& range, Strategy const& strat } } - return strategy.result(state); + return check_result_type(strategy.result(state)); } }} // namespace detail::within @@ -67,17 +83,6 @@ template {}; -template -struct point_in_geometry -{ - template static inline - int apply(Point const& point, Box const& box, Strategy const& strategy) - { - // this is different Strategy concept than the one used for ranges - return strategy.apply(point, box); - } -}; - template struct point_in_geometry { @@ -221,26 +226,30 @@ inline int point_in_geometry(Point const& point, Geometry const& geometry) Geometry >::type strategy_type; + typedef typename strategy::covered_by::services::default_strategy + < + typename tag::type, + typename tag::type, + typename tag::type, + typename tag_cast::type, areal_tag>::type, + typename tag_cast + < + typename cs_tag::type, spherical_tag + >::type, + typename tag_cast + < + typename cs_tag::type, spherical_tag + >::type, + Point, + Geometry + >::type strategy_type2; + + BOOST_STATIC_ASSERT(boost::is_same::value); + return point_in_geometry(point, geometry, strategy_type()); } -template -inline bool within_point_geometry(Point const& point, Geometry const& geometry) -{ - return point_in_geometry(point, geometry) > 0; -} - }} // namespace detail::within - -namespace detail { namespace covered_by { - -template -inline bool covered_by_point_geometry(Point const& point, Geometry const& geometry) -{ - return point_in_geometry(point, geometry) >= 0; -} - -}} // namespace detail::covered_by #endif // DOXYGEN_NO_DETAIL }} // namespace boost::geometry diff --git a/include/boost/geometry/algorithms/disjoint.hpp b/include/boost/geometry/algorithms/disjoint.hpp index 33bb31e28..6f026b1f5 100644 --- a/include/boost/geometry/algorithms/disjoint.hpp +++ b/include/boost/geometry/algorithms/disjoint.hpp @@ -33,6 +33,7 @@ #include #include +#include #include #include #include @@ -46,8 +47,6 @@ #include #include -#include - namespace boost { namespace geometry { @@ -71,7 +70,7 @@ struct check_each_ring_for_within template inline void apply(Range const& range) { - if ( detail::within::within_point_geometry(geometry::return_point_on_surface(range), m_geometry) ) + if ( geometry::within(geometry::return_point_on_surface(range), m_geometry) ) { has_within = true; } diff --git a/include/boost/geometry/algorithms/distance.hpp b/include/boost/geometry/algorithms/distance.hpp index 11e3b4c31..8a0d0c830 100644 --- a/include/boost/geometry/algorithms/distance.hpp +++ b/include/boost/geometry/algorithms/distance.hpp @@ -178,7 +178,7 @@ struct point_to_ring PPStrategy, PSStrategy >::apply(point, ring, pp_strategy, ps_strategy), - detail::within::within_point_geometry(point, ring) + geometry::within(point, ring) ); } };