cartesian.hpp 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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_AREA_CARTESIAN_HPP
  7. #define BOOST_GEOMETRY_STRATEGIES_AREA_CARTESIAN_HPP
  8. #include <boost/geometry/strategy/cartesian/area.hpp>
  9. #include <boost/geometry/strategy/cartesian/area_box.hpp>
  10. #include <boost/geometry/strategies/area/services.hpp>
  11. #include <boost/geometry/strategies/detail.hpp>
  12. namespace boost { namespace geometry
  13. {
  14. namespace strategies { namespace area
  15. {
  16. template <typename CalculationType = void>
  17. struct cartesian : strategies::detail::cartesian_base
  18. {
  19. template <typename Geometry>
  20. static auto area(Geometry const&,
  21. std::enable_if_t<! util::is_box<Geometry>::value> * = nullptr)
  22. {
  23. return strategy::area::cartesian<CalculationType>();
  24. }
  25. template <typename Geometry>
  26. static auto area(Geometry const&,
  27. std::enable_if_t<util::is_box<Geometry>::value> * = nullptr)
  28. {
  29. return strategy::area::cartesian_box<CalculationType>();
  30. }
  31. };
  32. namespace services
  33. {
  34. template <typename Geometry>
  35. struct default_strategy<Geometry, cartesian_tag>
  36. {
  37. using type = strategies::area::cartesian<>;
  38. };
  39. template <typename CT>
  40. struct strategy_converter<strategy::area::cartesian<CT> >
  41. {
  42. static auto get(strategy::area::cartesian<CT> const&)
  43. {
  44. return strategies::area::cartesian<CT>();
  45. }
  46. };
  47. } // namespace services
  48. }} // namespace strategies::area
  49. }} // namespace boost::geometry
  50. #endif // BOOST_GEOMETRY_STRATEGIES_AREA_CARTESIAN_HPP