// Boost.Geometry // Copyright (c) 2021, 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_SIMPLIFY_CARTESIAN_HPP #define BOOST_GEOMETRY_STRATEGIES_SIMPLIFY_CARTESIAN_HPP #include #include #include #include #include #include #include #include #include #include namespace boost { namespace geometry { namespace strategies { namespace simplify { template struct cartesian : public strategies::detail::cartesian_base { // TODO: Replace this if calculate_point_order() is used in simplify template static auto area(Geometry const&) { return strategy::area::cartesian(); } // For perimeter() template static auto distance(Geometry1 const&, Geometry2 const&, distance::detail::enable_if_pp_t * = nullptr) { return strategy::distance::pythagoras(); } // For douglas_peucker template static auto distance(Geometry1 const&, Geometry2 const&, distance::detail::enable_if_ps_t * = nullptr) { return strategy::distance::projected_point < CalculationType, strategy::distance::pythagoras >(); } // For equals() template static auto relate(Geometry1 const&, Geometry2 const&, std::enable_if_t < util::is_pointlike::value && util::is_pointlike::value > * = nullptr) { return strategy::within::cartesian_point_point(); } }; namespace services { template struct default_strategy { using type = strategies::simplify::cartesian<>; }; template struct strategy_converter < strategy::simplify::douglas_peucker < P, strategy::distance::projected_point > > { template static auto get(Strategy const& ) { typedef strategies::simplify::cartesian strategy_type; return std::conditional_t < std::is_same < S, typename strategy::distance::services::comparable_type::type >::value, strategies::distance::detail::comparable, strategy_type >(); } }; } // namespace services }} // namespace strategies::simplify }} // namespace boost::geometry #endif // BOOST_GEOMETRY_STRATEGIES_SIMPLIFY_CARTESIAN_HPP