]>
Commit | Line | Data |
---|---|---|
20effc67 TL |
1 | // Boost.Geometry (aka GGL, Generic Geometry Library) |
2 | ||
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. | |
6 | ||
7 | // This file was modified by Oracle on 2015-2020. | |
8 | // Modifications copyright (c) 2015-2020, Oracle and/or its affiliates. | |
9 | ||
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 | |
13 | ||
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) | |
17 | ||
18 | #ifndef BOOST_GEOMETRY_STRATEGY_CARTESIAN_ENVELOPE_BOX_HPP | |
19 | #define BOOST_GEOMETRY_STRATEGY_CARTESIAN_ENVELOPE_BOX_HPP | |
20 | ||
21 | #include <cstddef> | |
22 | ||
23 | #include <boost/geometry/core/access.hpp> | |
24 | #include <boost/geometry/core/coordinate_dimension.hpp> | |
25 | #include <boost/geometry/core/tags.hpp> | |
26 | ||
27 | #include <boost/geometry/views/detail/indexed_point_view.hpp> | |
28 | ||
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> | |
32 | ||
33 | #include <boost/geometry/algorithms/dispatch/envelope.hpp> | |
34 | ||
35 | #include <boost/geometry/strategy/cartesian/expand_box.hpp> | |
36 | ||
37 | #include <boost/geometry/strategy/envelope.hpp> | |
38 | ||
39 | ||
40 | namespace boost { namespace geometry | |
41 | { | |
42 | ||
43 | #ifndef DOXYGEN_NO_DETAIL | |
44 | namespace detail { namespace envelope | |
45 | { | |
46 | ||
47 | ||
48 | template | |
49 | < | |
50 | std::size_t Index, | |
51 | std::size_t Dimension, | |
52 | std::size_t DimensionCount | |
53 | > | |
54 | struct envelope_indexed_box | |
55 | { | |
56 | template <typename BoxIn, typename BoxOut> | |
57 | static inline void apply(BoxIn const& box_in, BoxOut& mbr) | |
58 | { | |
59 | detail::indexed_point_view<BoxIn const, Index> box_in_corner(box_in); | |
60 | detail::indexed_point_view<BoxOut, Index> mbr_corner(mbr); | |
61 | ||
62 | detail::conversion::point_to_point | |
63 | < | |
64 | detail::indexed_point_view<BoxIn const, Index>, | |
65 | detail::indexed_point_view<BoxOut, Index>, | |
66 | Dimension, | |
67 | DimensionCount | |
68 | >::apply(box_in_corner, mbr_corner); | |
69 | } | |
70 | }; | |
71 | ||
72 | ||
73 | }} // namespace detail::envelope | |
74 | #endif // DOXYGEN_NO_DETAIL | |
75 | ||
76 | ||
77 | namespace strategy { namespace envelope | |
78 | { | |
79 | ||
80 | ||
81 | struct cartesian_box | |
82 | { | |
83 | typedef cartesian_tag cs_tag; | |
84 | ||
85 | template<typename BoxIn, typename BoxOut> | |
86 | static inline void apply(BoxIn const& box_in, BoxOut& mbr) | |
87 | { | |
88 | geometry::detail::envelope::envelope_indexed_box | |
89 | < | |
90 | min_corner, 0, dimension<BoxIn>::value | |
91 | >::apply(box_in, mbr); | |
92 | ||
93 | geometry::detail::envelope::envelope_indexed_box | |
94 | < | |
95 | max_corner, 0, dimension<BoxIn>::value | |
96 | >::apply(box_in, mbr); | |
97 | } | |
98 | }; | |
99 | ||
100 | ||
101 | #ifndef DOXYGEN_NO_STRATEGY_SPECIALIZATIONS | |
102 | ||
103 | namespace services | |
104 | { | |
105 | ||
106 | template <typename CalculationType> | |
107 | struct default_strategy<box_tag, cartesian_tag, CalculationType> | |
108 | { | |
109 | typedef strategy::envelope::cartesian_box type; | |
110 | }; | |
111 | ||
112 | } | |
113 | ||
114 | #endif // DOXYGEN_NO_STRATEGY_SPECIALIZATIONS | |
115 | ||
116 | ||
117 | }} // namespace strategy::envelope | |
118 | ||
119 | ||
120 | }} // namespace boost::geometry | |
121 | ||
122 | ||
123 | #endif // BOOST_GEOMETRY_STRATEGY_CARTESIAN_ENVELOPE_BOX_HPP |