// 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_RELATE_SPHERICAL_HPP #define BOOST_GEOMETRY_STRATEGIES_RELATE_SPHERICAL_HPP // TEMP - move to strategy #include #include #include #include #include #include #include #include #include #include #include namespace boost { namespace geometry { namespace strategies { namespace relate { #ifndef DOXYGEN_NO_DETAIL namespace detail { template class spherical : public strategies::envelope::detail::spherical { using base_t = strategies::envelope::detail::spherical; public: // area template auto area(Geometry const&) const { return strategy::area::spherical < typename base_t::radius_type, CalculationType >(base_t::radius()); } // covered_by template static auto covered_by(Geometry1 const&, Geometry2 const&, std::enable_if_t < util::is_pointlike::value && util::is_box::value > * = nullptr) { return strategy::covered_by::spherical_point_box(); } template static auto covered_by(Geometry1 const&, Geometry2 const&, std::enable_if_t < util::is_box::value && util::is_box::value > * = nullptr) { return strategy::covered_by::spherical_box_box(); } // disjoint template static auto disjoint(Geometry1 const&, Geometry2 const&, std::enable_if_t < util::is_box::value && util::is_box::value > * = nullptr) { return strategy::disjoint::spherical_box_box(); } template static auto disjoint(Geometry1 const&, Geometry2 const&, std::enable_if_t < util::is_segment::value && util::is_box::value > * = nullptr) { // NOTE: Inconsistent name. return strategy::disjoint::segment_box_spherical(); } // relate template static auto relate(Geometry1 const&, Geometry2 const&, std::enable_if_t < util::is_pointlike::value && util::is_pointlike::value > * = nullptr) { return strategy::within::spherical_point_point(); } template static auto relate(Geometry1 const&, Geometry2 const&, std::enable_if_t < util::is_pointlike::value && ( util::is_linear::value || util::is_polygonal::value ) > * = nullptr) { return strategy::within::spherical_winding(); } //template static auto relate(/*Geometry1 const&, Geometry2 const&, std::enable_if_t < ( util::is_linear::value || util::is_polygonal::value ) && ( util::is_linear::value || util::is_polygonal::value ) > * = nullptr*/) { return strategy::intersection::spherical_segments(); } // side static auto side() { return strategy::side::spherical_side_formula(); } // within template static auto within(Geometry1 const&, Geometry2 const&, std::enable_if_t < util::is_pointlike::value && util::is_box::value > * = nullptr) { return strategy::within::spherical_point_box(); } template static auto within(Geometry1 const&, Geometry2 const&, std::enable_if_t < util::is_box::value && util::is_box::value > * = nullptr) { return strategy::within::spherical_box_box(); } }; } // namespace detail #endif // DOXYGEN_NO_DETAIL template class spherical : public strategies::relate::detail::spherical {}; namespace services { template struct default_strategy { using type = strategies::relate::spherical<>; }; template struct default_strategy { using type = strategies::relate::spherical<>; }; template struct default_strategy { using type = strategies::relate::spherical<>; }; template <> struct strategy_converter { static auto get(strategy::within::spherical_point_point const& ) { return strategies::relate::spherical<>(); } }; template <> struct strategy_converter { static auto get(strategy::within::spherical_point_box const&) { return strategies::relate::spherical<>(); } }; template <> struct strategy_converter { static auto get(strategy::covered_by::spherical_point_box const&) { return strategies::relate::spherical<>(); } }; template <> struct strategy_converter { static auto get(strategy::covered_by::spherical_box_box const&) { return strategies::relate::spherical<>(); } }; template <> struct strategy_converter { static auto get(strategy::disjoint::spherical_box_box const&) { return strategies::relate::spherical<>(); } }; template <> struct strategy_converter { static auto get(strategy::disjoint::segment_box_spherical const&) { return strategies::relate::spherical<>(); } }; template <> struct strategy_converter { static auto get(strategy::within::spherical_box_box const&) { return strategies::relate::spherical<>(); } }; template struct strategy_converter> { static auto get(strategy::within::spherical_winding const& ) { return strategies::relate::spherical(); } }; template struct strategy_converter> { static auto get(strategy::intersection::spherical_segments const& ) { return strategies::relate::spherical(); } }; template struct strategy_converter> { struct altered_strategy : strategies::relate::spherical { template static auto covered_by(Geometry1 const&, Geometry2 const&, std::enable_if_t < util::is_pointlike::value && util::is_box::value > * = nullptr) { return strategy::covered_by::spherical_point_box_by_side(); } template static auto within(Geometry1 const&, Geometry2 const&, std::enable_if_t < util::is_pointlike::value && util::is_box::value > * = nullptr) { return strategy::within::spherical_point_box_by_side(); } }; static auto get(strategy::covered_by::spherical_point_box_by_side const&) { return altered_strategy(); } static auto get(strategy::within::spherical_point_box_by_side const&) { return altered_strategy(); } }; template struct strategy_converter> : strategy_converter> {}; // TEMP used in distance segment/box template struct strategy_converter> { static auto get(strategy::side::spherical_side_formula const& ) { return strategies::relate::spherical(); } }; } // namespace services }} // namespace strategies::relate }} // namespace boost::geometry #endif // BOOST_GEOMETRY_STRATEGIES_RELATE_SPHERICAL_HPP