cartesian.hpp 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. // Boost.Geometry
  2. // Copyright (c) 2021, Oracle and/or its affiliates.
  3. // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
  4. // Licensed under the Boost Software License version 1.0.
  5. // http://www.boost.org/users/license.html
  6. #ifndef BOOST_GEOMETRY_STRATEGIES_LINE_INTERPOLATE_CARTESIAN_HPP
  7. #define BOOST_GEOMETRY_STRATEGIES_LINE_INTERPOLATE_CARTESIAN_HPP
  8. #include <boost/geometry/strategies/cartesian/distance_pythagoras.hpp>
  9. #include <boost/geometry/strategies/cartesian/line_interpolate.hpp>
  10. #include <boost/geometry/strategies/detail.hpp>
  11. #include <boost/geometry/strategies/distance/detail.hpp>
  12. #include <boost/geometry/strategies/line_interpolate/services.hpp>
  13. #include <boost/geometry/util/type_traits.hpp>
  14. namespace boost { namespace geometry
  15. {
  16. namespace strategies { namespace line_interpolate
  17. {
  18. template <typename CalculationType = void>
  19. struct cartesian
  20. : public strategies::detail::cartesian_base
  21. {
  22. template <typename Geometry1, typename Geometry2>
  23. static auto distance(Geometry1 const&, Geometry2 const&,
  24. distance::detail::enable_if_pp_t<Geometry1, Geometry2> * = nullptr)
  25. {
  26. return strategy::distance::pythagoras<CalculationType>();
  27. }
  28. template <typename Geometry>
  29. static auto line_interpolate(Geometry const&)
  30. {
  31. return strategy::line_interpolate::cartesian<CalculationType>();
  32. }
  33. };
  34. namespace services
  35. {
  36. template <typename Geometry>
  37. struct default_strategy<Geometry, cartesian_tag>
  38. {
  39. using type = strategies::line_interpolate::cartesian<>;
  40. };
  41. template <typename CT, typename DS>
  42. struct strategy_converter<strategy::line_interpolate::cartesian<CT, DS> >
  43. {
  44. static auto get(strategy::line_interpolate::cartesian<CT, DS> const&)
  45. {
  46. return strategies::line_interpolate::cartesian<CT>();
  47. }
  48. };
  49. } // namespace services
  50. }} // namespace strategies::line_interpolate
  51. }} // namespace boost::geometry
  52. #endif // BOOST_GEOMETRY_STRATEGIES_LINE_INTERPOLATE_CARTESIAN_HPP