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