]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/boost/geometry/algorithms/detail/expand/box.hpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / boost / geometry / algorithms / detail / expand / box.hpp
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 // Copyright (c) 2014-2015 Samuel Debionne, Grenoble, France.
7
8 // This file was modified by Oracle on 2015, 2016, 2017.
9 // Modifications copyright (c) 2015-2017, Oracle and/or its affiliates.
10
11 // Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
12 // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
13 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
14
15 // Distributed under the Boost Software License, Version 1.0.
16 // (See accompanying file LICENSE_1_0.txt or copy at
17 // http://www.boost.org/LICENSE_1_0.txt)
18
19 #ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_EXPAND_BOX_HPP
20 #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_EXPAND_BOX_HPP
21
22 #include <cstddef>
23 #include <algorithm>
24
25 #include <boost/mpl/assert.hpp>
26 #include <boost/type_traits/is_same.hpp>
27
28 #include <boost/geometry/core/coordinate_dimension.hpp>
29 #include <boost/geometry/core/tags.hpp>
30
31 #include <boost/geometry/algorithms/detail/envelope/box.hpp>
32 #include <boost/geometry/algorithms/detail/envelope/range_of_boxes.hpp>
33
34 #include <boost/geometry/algorithms/detail/expand/indexed.hpp>
35
36 #include <boost/geometry/algorithms/dispatch/expand.hpp>
37
38
39 namespace boost { namespace geometry
40 {
41
42 #ifndef DOXYGEN_NO_DETAIL
43 namespace detail { namespace expand
44 {
45
46
47 struct box_on_spheroid
48 {
49 template <typename BoxOut, typename BoxIn, typename Strategy>
50 static inline void apply(BoxOut& box_out,
51 BoxIn const& box_in,
52 Strategy const& strategy)
53 {
54 // normalize both boxes and convert box-in to be of type of box-out
55 BoxOut mbrs[2];
56 detail::envelope::envelope_box_on_spheroid::apply(box_in, mbrs[0], strategy);
57 detail::envelope::envelope_box_on_spheroid::apply(box_out, mbrs[1], strategy);
58
59 // compute the envelope of the two boxes
60 detail::envelope::envelope_range_of_boxes::apply(mbrs, box_out, strategy);
61 }
62 };
63
64
65 }} // namespace detail::expand
66 #endif // DOXYGEN_NO_DETAIL
67
68 #ifndef DOXYGEN_NO_DISPATCH
69 namespace dispatch
70 {
71
72
73 // Box + box -> new box containing two input boxes
74 template
75 <
76 typename BoxOut, typename BoxIn,
77 typename CSTagOut, typename CSTag
78 >
79 struct expand
80 <
81 BoxOut, BoxIn,
82 box_tag, box_tag,
83 CSTagOut, CSTag
84 >
85 {
86 BOOST_MPL_ASSERT_MSG((false),
87 NOT_IMPLEMENTED_FOR_THESE_COORDINATE_SYSTEMS,
88 (types<CSTagOut, CSTag>()));
89 };
90
91 template <typename BoxOut, typename BoxIn>
92 struct expand
93 <
94 BoxOut, BoxIn,
95 box_tag, box_tag,
96 cartesian_tag, cartesian_tag
97 > : detail::expand::expand_indexed
98 <
99 0, dimension<BoxIn>::value
100 >
101 {};
102
103 template <typename BoxOut, typename BoxIn>
104 struct expand
105 <
106 BoxOut, BoxIn,
107 box_tag, box_tag,
108 spherical_equatorial_tag, spherical_equatorial_tag
109 > : detail::expand::box_on_spheroid
110 {};
111
112 template <typename BoxOut, typename BoxIn>
113 struct expand
114 <
115 BoxOut, BoxIn,
116 box_tag, box_tag,
117 spherical_polar_tag, spherical_polar_tag
118 > : detail::expand::box_on_spheroid
119 {};
120
121 template <typename BoxOut, typename BoxIn>
122 struct expand
123 <
124 BoxOut, BoxIn,
125 box_tag, box_tag,
126 geographic_tag, geographic_tag
127 > : detail::expand::box_on_spheroid
128 {};
129
130
131 } // namespace dispatch
132 #endif // DOXYGEN_NO_DISPATCH
133
134 }} // namespace boost::geometry
135
136 #endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_EXPAND_INDEXED_HPP