// Boost.Geometry // Copyright (c) 2020, Oracle and/or its affiliates. // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Licensed under the Boost Software License version 1.0. // http://www.boost.org/users/license.html #ifndef BOOST_GEOMETRY_STRATEGIES_INDEX_SPHERICAL_HPP #define BOOST_GEOMETRY_STRATEGIES_INDEX_SPHERICAL_HPP // TEMP - move to strategy #include #include #include #include #include #include namespace boost { namespace geometry { namespace strategies { namespace index { #ifndef DOXYGEN_NO_DETAIL namespace detail { template class spherical : public strategies::relate::detail::spherical { using base_t = strategies::relate::detail::spherical; public: template auto comparable_distance(Geometry1 const&, Geometry2 const&, std::enable_if_t < util::is_pointlike::value && util::is_pointlike::value > * = nullptr) const { //return geometry::strategy::distance::comparable::haversine return geometry::strategy::distance::haversine < typename base_t::radius_type, CalculationType >(base_t::radius()); } template auto comparable_distance(Geometry1 const&, Geometry2 const&, std::enable_if_t < (util::is_pointlike::value && util::is_segment::value) || (util::is_segment::value && util::is_pointlike::value) > * = nullptr) const { //return geometry::strategy::distance::comparable::cross_track return geometry::strategy::distance::cross_track < CalculationType, //geometry::strategy::distance::comparable::haversine geometry::strategy::distance::haversine < typename base_t::radius_type, CalculationType > >(base_t::radius()); } template auto comparable_distance(Geometry1 const&, Geometry2 const&, std::enable_if_t < (util::is_pointlike::value && util::is_box::value) || (util::is_box::value && util::is_pointlike::value) > * = nullptr) const { //return geometry::strategy::distance::comparable::cross_track_point_box return geometry::strategy::distance::cross_track_point_box < CalculationType, //geometry::strategy::distance::comparable::haversine geometry::strategy::distance::haversine < typename base_t::radius_type, CalculationType > >(base_t::radius()); } template auto comparable_distance(Geometry1 const&, Geometry2 const&, std::enable_if_t < (util::is_segment::value && util::is_box::value) || (util::is_box::value && util::is_segment::value) > * = nullptr) const { return geometry::strategy::distance::spherical_segment_box < CalculationType, //geometry::strategy::distance::comparable::haversine geometry::strategy::distance::haversine < typename base_t::radius_type, CalculationType > // TODO: >(/*base_t::radius()*/); } template auto comparable_distance(Geometry1 const&, Geometry2 const&, std::enable_if_t < util::is_segment::value && util::is_segment::value > * = nullptr) const { //return geometry::strategy::distance::comparable::cross_track return geometry::strategy::distance::cross_track < CalculationType, //geometry::strategy::distance::comparable::haversine geometry::strategy::distance::haversine < typename base_t::radius_type, CalculationType > >(base_t::radius()); } }; } // namespace detail #endif // DOXYGEN_NO_DETAIL template class spherical : public strategies::index::detail::spherical {}; namespace services { template struct default_strategy { using type = strategies::index::spherical<>; }; template struct default_strategy { using type = strategies::index::spherical<>; }; template struct default_strategy { using type = strategies::index::spherical<>; }; // TEMP - needed in distance until umbrella strategies are supported template struct strategy_converter> { static auto get(strategy::distance::comparable::cross_track const& ) { return strategies::index::spherical(); } }; // TEMP - needed in distance until umbrella strategies are supported template struct strategy_converter> { static auto get(strategy::distance::comparable::haversine const&) { return strategies::index::spherical(); } }; } // namespace services }}}} // namespace boost::geometry::strategy::index #endif // BOOST_GEOMETRY_STRATEGIES_INDEX_SPHERICAL_HPP