// 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_CARTESIAN_HPP #define BOOST_GEOMETRY_STRATEGIES_INDEX_CARTESIAN_HPP // TODO: move to strategy directory #include #include #include #include #include namespace boost { namespace geometry { namespace strategies { namespace index { template class cartesian : public relate::cartesian { public: template static auto comparable_distance(Geometry1 const&, Geometry2 const&, std::enable_if_t < util::is_pointlike::value && util::is_pointlike::value > * = nullptr) { //return geometry::strategy::distance::comparable::pythagoras(); return geometry::strategy::distance::pythagoras(); } template static 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) { return geometry::strategy::distance::projected_point < CalculationType, //geometry::strategy::distance::comparable::pythagoras geometry::strategy::distance::pythagoras >(); } template static 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) { //return geometry::strategy::distance::comparable::pythagoras_point_box(); return geometry::strategy::distance::pythagoras_point_box(); } template static 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) { return geometry::strategy::distance::cartesian_segment_box < CalculationType, //geometry::strategy::distance::comparable::pythagoras geometry::strategy::distance::pythagoras >(); } template static auto comparable_distance(Geometry1 const&, Geometry2 const&, std::enable_if_t < util::is_segment::value && util::is_segment::value > * = nullptr) { return strategy::distance::projected_point < CalculationType, //strategy::distance::comparable::pythagoras strategy::distance::pythagoras >(); } }; namespace services { template struct default_strategy { using type = strategies::index::cartesian<>; }; // TEMP - needed in distance until umbrella strategies are supported template struct strategy_converter> { static auto get(strategy::distance::projected_point const& ) { return strategies::index::cartesian(); } }; // TEMP - needed in distance until umbrella strategies are supported template struct strategy_converter> { static auto get(strategy::distance::comparable::pythagoras const&) { return strategies::index::cartesian(); } }; } // namespace services }}}} // namespace boost::geometry::strategy::index #endif // BOOST_GEOMETRY_STRATEGIES_INDEX_CARTESIAN_HPP