envelope_point.hpp 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. // Boost.Geometry (aka GGL, Generic Geometry Library)
  2. // Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands.
  3. // Copyright (c) 2008-2015 Bruno Lalande, Paris, France.
  4. // Copyright (c) 2009-2015 Mateusz Loskot, London, UK.
  5. // This file was modified by Oracle on 2015, 2016, 2017, 2018.
  6. // Modifications copyright (c) 2015-2018, Oracle and/or its affiliates.
  7. // Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
  8. // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
  9. // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
  10. // Distributed under the Boost Software License, Version 1.0.
  11. // (See accompanying file LICENSE_1_0.txt or copy at
  12. // http://www.boost.org/LICENSE_1_0.txt)
  13. #ifndef BOOST_GEOMETRY_STRATEGIES_CARTESIAN_ENVELOPE_POINT_HPP
  14. #define BOOST_GEOMETRY_STRATEGIES_CARTESIAN_ENVELOPE_POINT_HPP
  15. #include <cstddef>
  16. #include <boost/geometry/core/access.hpp>
  17. #include <boost/geometry/core/cs.hpp>
  18. #include <boost/geometry/core/coordinate_dimension.hpp>
  19. #include <boost/geometry/core/coordinate_system.hpp>
  20. #include <boost/geometry/core/tags.hpp>
  21. #include <boost/geometry/views/detail/indexed_point_view.hpp>
  22. #include <boost/geometry/algorithms/detail/convert_point_to_point.hpp>
  23. #include <boost/geometry/strategies/envelope.hpp>
  24. namespace boost { namespace geometry
  25. {
  26. #ifndef DOXYGEN_NO_DETAIL
  27. namespace detail { namespace envelope
  28. {
  29. template <std::size_t Dimension, std::size_t DimensionCount>
  30. struct envelope_one_point
  31. {
  32. template <std::size_t Index, typename Point, typename Box>
  33. static inline void apply(Point const& point, Box& mbr)
  34. {
  35. detail::indexed_point_view<Box, Index> box_corner(mbr);
  36. detail::conversion::point_to_point
  37. <
  38. Point,
  39. detail::indexed_point_view<Box, Index>,
  40. Dimension,
  41. DimensionCount
  42. >::apply(point, box_corner);
  43. }
  44. template <typename Point, typename Box>
  45. static inline void apply(Point const& point, Box& mbr)
  46. {
  47. apply<min_corner>(point, mbr);
  48. apply<max_corner>(point, mbr);
  49. }
  50. };
  51. }} // namespace detail::envelope
  52. #endif // DOXYGEN_NO_DETAIL
  53. namespace strategy { namespace envelope
  54. {
  55. struct cartesian_point
  56. {
  57. template <typename Point, typename Box>
  58. static inline void apply(Point const& point, Box& mbr)
  59. {
  60. geometry::detail::envelope::envelope_one_point
  61. <
  62. 0, dimension<Point>::value
  63. >::apply(point, mbr);
  64. }
  65. };
  66. #ifndef DOXYGEN_NO_STRATEGY_SPECIALIZATIONS
  67. namespace services
  68. {
  69. template <typename CalculationType>
  70. struct default_strategy<point_tag, cartesian_tag, CalculationType>
  71. {
  72. typedef strategy::envelope::cartesian_point type;
  73. };
  74. }
  75. #endif // DOXYGEN_NO_STRATEGY_SPECIALIZATIONS
  76. }} // namespace strategy::envelope
  77. }} // namespace boost::geometry
  78. #endif // BOOST_GEOMETRY_STRATEGIES_CARTESIAN_ENVELOPE_POINT_HPP