area_box.hpp 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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_STRATEGY_CARTESIAN_AREA_BOX_HPP
  7. #define BOOST_GEOMETRY_STRATEGY_CARTESIAN_AREA_BOX_HPP
  8. #include <boost/geometry/core/access.hpp>
  9. #include <boost/geometry/strategy/area.hpp>
  10. namespace boost { namespace geometry
  11. {
  12. namespace strategy { namespace area
  13. {
  14. template
  15. <
  16. typename CalculationType = void
  17. >
  18. class cartesian_box
  19. {
  20. public:
  21. template <typename Box>
  22. struct result_type
  23. : strategy::area::detail::result_type
  24. <
  25. Box,
  26. CalculationType
  27. >
  28. {};
  29. template <typename Box>
  30. static inline auto apply(Box const& box)
  31. {
  32. typedef typename result_type<Box>::type return_type;
  33. return return_type(get<max_corner, 0>(box) - get<min_corner, 0>(box))
  34. * return_type(get<max_corner, 1>(box) - get<min_corner, 1>(box));
  35. }
  36. };
  37. }} // namespace strategy::area
  38. }} // namespace boost::geometry
  39. #endif // BOOST_GEOMETRY_STRATEGY_CARTESIAN_AREA_BOX_HPP