1 // Boost.Geometry (aka GGL, Generic Geometry Library)
3 // Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands.
4 // Copyright (c) 2008-2015 Bruno Lalande, Paris, France.
5 // Copyright (c) 2009-2015 Mateusz Loskot, London, UK.
7 // This file was modified by Oracle on 2015-2019.
8 // Modifications copyright (c) 2015-2019, Oracle and/or its affiliates.
10 // Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
11 // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
12 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
14 // Distributed under the Boost Software License, Version 1.0.
15 // (See accompanying file LICENSE_1_0.txt or copy at
16 // http://www.boost.org/LICENSE_1_0.txt)
18 #ifndef BOOST_GEOMETRY_STRATEGIES_CARTESIAN_ENVELOPE_BOX_HPP
19 #define BOOST_GEOMETRY_STRATEGIES_CARTESIAN_ENVELOPE_BOX_HPP
23 #include <boost/geometry/core/access.hpp>
24 #include <boost/geometry/core/coordinate_dimension.hpp>
25 #include <boost/geometry/core/tags.hpp>
27 #include <boost/geometry/views/detail/indexed_point_view.hpp>
29 #include <boost/geometry/algorithms/detail/convert_point_to_point.hpp>
30 #include <boost/geometry/algorithms/detail/normalize.hpp>
31 #include <boost/geometry/algorithms/detail/envelope/transform_units.hpp>
33 #include <boost/geometry/algorithms/dispatch/envelope.hpp>
35 #include <boost/geometry/strategies/cartesian/expand_box.hpp>
37 #include <boost/geometry/strategies/envelope.hpp>
40 namespace boost { namespace geometry
43 #ifndef DOXYGEN_NO_DETAIL
44 namespace detail { namespace envelope
51 std::size_t Dimension,
52 std::size_t DimensionCount
54 struct envelope_indexed_box
56 template <typename BoxIn, typename BoxOut>
57 static inline void apply(BoxIn const& box_in, BoxOut& mbr)
59 detail::indexed_point_view<BoxIn const, Index> box_in_corner(box_in);
60 detail::indexed_point_view<BoxOut, Index> mbr_corner(mbr);
62 detail::conversion::point_to_point
64 detail::indexed_point_view<BoxIn const, Index>,
65 detail::indexed_point_view<BoxOut, Index>,
68 >::apply(box_in_corner, mbr_corner);
73 }} // namespace detail::envelope
74 #endif // DOXYGEN_NO_DETAIL
77 namespace strategy { namespace envelope
83 typedef cartesian_tag cs_tag;
85 typedef strategy::expand::cartesian_box box_expand_strategy_type;
87 static inline box_expand_strategy_type get_box_expand_strategy()
89 return box_expand_strategy_type();
92 template<typename BoxIn, typename BoxOut>
93 static inline void apply(BoxIn const& box_in, BoxOut& mbr)
95 geometry::detail::envelope::envelope_indexed_box
97 min_corner, 0, dimension<BoxIn>::value
98 >::apply(box_in, mbr);
100 geometry::detail::envelope::envelope_indexed_box
102 max_corner, 0, dimension<BoxIn>::value
103 >::apply(box_in, mbr);
108 #ifndef DOXYGEN_NO_STRATEGY_SPECIALIZATIONS
113 template <typename CalculationType>
114 struct default_strategy<box_tag, cartesian_tag, CalculationType>
116 typedef strategy::envelope::cartesian_box type;
121 #endif // DOXYGEN_NO_STRATEGY_SPECIALIZATIONS
124 }} // namespace strategy::envelope
127 }} // namespace boost::geometry
130 #endif // BOOST_GEOMETRY_STRATEGIES_CARTESIAN_ENVELOPE_BOX_HPP