]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/boost/geometry/algorithms/detail/expand/segment.hpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / boost / geometry / algorithms / detail / expand / segment.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_SEGMENT_HPP
20 #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_EXPAND_SEGMENT_HPP
21
22 #include <boost/mpl/assert.hpp>
23 #include <boost/type_traits/is_same.hpp>
24
25 #include <boost/geometry/core/coordinate_dimension.hpp>
26 #include <boost/geometry/core/tags.hpp>
27
28 #include <boost/geometry/algorithms/detail/envelope/box.hpp>
29 #include <boost/geometry/algorithms/detail/envelope/range_of_boxes.hpp>
30 #include <boost/geometry/algorithms/detail/envelope/segment.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 struct segment
45 {
46 template <typename Box, typename Segment, typename Strategy>
47 static inline void apply(Box& box,
48 Segment const& segment,
49 Strategy const& strategy)
50 {
51 Box mbrs[2];
52
53 // compute the envelope of the segment
54 typename point_type<Segment>::type p[2];
55 detail::assign_point_from_index<0>(segment, p[0]);
56 detail::assign_point_from_index<1>(segment, p[1]);
57 detail::envelope::envelope_segment
58 <
59 dimension<Segment>::value
60 >::apply(p[0], p[1], mbrs[0], strategy);
61
62 // normalize the box
63 detail::envelope::envelope_box_on_spheroid::apply(box, mbrs[1], strategy);
64
65 // compute the envelope of the two boxes
66 detail::envelope::envelope_range_of_boxes::apply(mbrs, box, strategy);
67 }
68 };
69
70
71 }} // namespace detail::expand
72 #endif // DOXYGEN_NO_DETAIL
73
74 #ifndef DOXYGEN_NO_DISPATCH
75 namespace dispatch
76 {
77
78 template
79 <
80 typename Box, typename Segment,
81 typename CSTagOut, typename CSTag
82 >
83 struct expand
84 <
85 Box, Segment,
86 box_tag, segment_tag,
87 CSTagOut, CSTag
88 >
89 {
90 BOOST_MPL_ASSERT_MSG((false),
91 NOT_IMPLEMENTED_FOR_THESE_COORDINATE_SYSTEMS,
92 (types<CSTagOut, CSTag>()));
93 };
94
95 template
96 <
97 typename Box, typename Segment
98 >
99 struct expand
100 <
101 Box, Segment,
102 box_tag, segment_tag,
103 cartesian_tag, cartesian_tag
104 > : detail::expand::expand_indexed
105 <
106 0, dimension<Segment>::value
107 >
108 {};
109
110 template <typename Box, typename Segment>
111 struct expand
112 <
113 Box, Segment,
114 box_tag, segment_tag,
115 spherical_polar_tag, spherical_polar_tag
116 > : detail::expand::segment
117 {};
118
119 template <typename Box, typename Segment>
120 struct expand
121 <
122 Box, Segment,
123 box_tag, segment_tag,
124 spherical_equatorial_tag, spherical_equatorial_tag
125 > : detail::expand::segment
126 {};
127
128 template <typename Box, typename Segment>
129 struct expand
130 <
131 Box, Segment,
132 box_tag, segment_tag,
133 geographic_tag, geographic_tag
134 > : detail::expand::segment
135 {};
136
137 } // namespace dispatch
138 #endif // DOXYGEN_NO_DISPATCH
139
140 }} // namespace boost::geometry
141
142
143 #endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_EXPAND_SEGMENT_HPP