cartesian.hpp 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. // Boost.Geometry
  2. // Copyright (c) 2020, 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_EXPAND_CARTESIAN_HPP
  7. #define BOOST_GEOMETRY_STRATEGIES_EXPAND_CARTESIAN_HPP
  8. #include <type_traits>
  9. #include <boost/geometry/strategy/cartesian/expand_box.hpp>
  10. #include <boost/geometry/strategy/cartesian/expand_point.hpp>
  11. #include <boost/geometry/strategy/cartesian/expand_segment.hpp>
  12. #include <boost/geometry/strategies/detail.hpp>
  13. #include <boost/geometry/strategies/expand/services.hpp>
  14. namespace boost { namespace geometry
  15. {
  16. namespace strategies { namespace expand
  17. {
  18. template <typename CalculationType = void>
  19. struct cartesian
  20. : strategies::detail::cartesian_base
  21. {
  22. template <typename Box, typename Geometry>
  23. static auto expand(Box const&, Geometry const&,
  24. typename util::enable_if_point_t<Geometry> * = nullptr)
  25. {
  26. return strategy::expand::cartesian_point();
  27. }
  28. template <typename Box, typename Geometry>
  29. static auto expand(Box const&, Geometry const&,
  30. typename util::enable_if_box_t<Geometry> * = nullptr)
  31. {
  32. return strategy::expand::cartesian_box();
  33. }
  34. template <typename Box, typename Geometry>
  35. static auto expand(Box const&, Geometry const&,
  36. typename util::enable_if_segment_t<Geometry> * = nullptr)
  37. {
  38. return strategy::expand::cartesian_segment();
  39. }
  40. };
  41. namespace services
  42. {
  43. template <typename Box, typename Geometry>
  44. struct default_strategy<Box, Geometry, cartesian_tag>
  45. {
  46. using type = strategies::expand::cartesian<>;
  47. };
  48. template <>
  49. struct strategy_converter<strategy::expand::cartesian_point>
  50. {
  51. static auto get(strategy::expand::cartesian_point const& )
  52. {
  53. return strategies::expand::cartesian<>();
  54. }
  55. };
  56. template <>
  57. struct strategy_converter<strategy::expand::cartesian_box>
  58. {
  59. static auto get(strategy::expand::cartesian_box const& )
  60. {
  61. return strategies::expand::cartesian<>();
  62. }
  63. };
  64. template <>
  65. struct strategy_converter<strategy::expand::cartesian_segment>
  66. {
  67. static auto get(strategy::expand::cartesian_segment const&)
  68. {
  69. return strategies::expand::cartesian<>();
  70. }
  71. };
  72. } // namespace services
  73. }} // namespace strategies::envelope
  74. }} // namespace boost::geometry
  75. #endif // BOOST_GEOMETRY_STRATEGIES_EXPAND_CARTESIAN_HPP