Mercurial > hg > vamp-build-and-test
comparison DEPENDENCIES/generic/include/boost/geometry/algorithms/envelope.hpp @ 101:c530137014c0
Update Boost headers (1.58.0)
author | Chris Cannam |
---|---|
date | Mon, 07 Sep 2015 11:12:49 +0100 |
parents | 2665513ce2d3 |
children |
comparison
equal
deleted
inserted
replaced
100:793467b5e61c | 101:c530137014c0 |
---|---|
12 // http://www.boost.org/LICENSE_1_0.txt) | 12 // http://www.boost.org/LICENSE_1_0.txt) |
13 | 13 |
14 #ifndef BOOST_GEOMETRY_ALGORITHMS_ENVELOPE_HPP | 14 #ifndef BOOST_GEOMETRY_ALGORITHMS_ENVELOPE_HPP |
15 #define BOOST_GEOMETRY_ALGORITHMS_ENVELOPE_HPP | 15 #define BOOST_GEOMETRY_ALGORITHMS_ENVELOPE_HPP |
16 | 16 |
17 #include <vector> | |
18 | |
19 #include <boost/numeric/conversion/cast.hpp> | |
17 #include <boost/range.hpp> | 20 #include <boost/range.hpp> |
18 | 21 |
19 #include <boost/numeric/conversion/cast.hpp> | 22 #include <boost/variant/apply_visitor.hpp> |
23 #include <boost/variant/static_visitor.hpp> | |
24 #include <boost/variant/variant_fwd.hpp> | |
20 | 25 |
21 #include <boost/geometry/algorithms/assign.hpp> | 26 #include <boost/geometry/algorithms/assign.hpp> |
22 #include <boost/geometry/algorithms/expand.hpp> | 27 #include <boost/geometry/algorithms/expand.hpp> |
23 #include <boost/geometry/algorithms/not_implemented.hpp> | 28 #include <boost/geometry/algorithms/not_implemented.hpp> |
24 #include <boost/geometry/core/cs.hpp> | 29 #include <boost/geometry/core/cs.hpp> |
25 #include <boost/geometry/core/exterior_ring.hpp> | 30 #include <boost/geometry/core/exterior_ring.hpp> |
31 #include <boost/geometry/core/point_type.hpp> | |
32 #include <boost/geometry/core/tags.hpp> | |
33 | |
26 #include <boost/geometry/geometries/concepts/check.hpp> | 34 #include <boost/geometry/geometries/concepts/check.hpp> |
27 | 35 |
28 | 36 |
29 namespace boost { namespace geometry | 37 namespace boost { namespace geometry |
30 { | 38 { |
71 { | 79 { |
72 assign_inverse(mbr); | 80 assign_inverse(mbr); |
73 envelope_range_additional(range, mbr); | 81 envelope_range_additional(range, mbr); |
74 } | 82 } |
75 }; | 83 }; |
84 | |
85 | |
86 struct envelope_multi_linestring | |
87 { | |
88 template<typename MultiLinestring, typename Box> | |
89 static inline void apply(MultiLinestring const& mp, Box& mbr) | |
90 { | |
91 assign_inverse(mbr); | |
92 for (typename boost::range_iterator<MultiLinestring const>::type | |
93 it = mp.begin(); | |
94 it != mp.end(); | |
95 ++it) | |
96 { | |
97 envelope_range_additional(*it, mbr); | |
98 } | |
99 } | |
100 }; | |
101 | |
102 | |
103 // version for multi_polygon: outer ring's of all polygons | |
104 struct envelope_multi_polygon | |
105 { | |
106 template<typename MultiPolygon, typename Box> | |
107 static inline void apply(MultiPolygon const& mp, Box& mbr) | |
108 { | |
109 assign_inverse(mbr); | |
110 for (typename boost::range_const_iterator<MultiPolygon>::type | |
111 it = mp.begin(); | |
112 it != mp.end(); | |
113 ++it) | |
114 { | |
115 envelope_range_additional(exterior_ring(*it), mbr); | |
116 } | |
117 } | |
118 }; | |
119 | |
76 | 120 |
77 }} // namespace detail::envelope | 121 }} // namespace detail::envelope |
78 #endif // DOXYGEN_NO_DETAIL | 122 #endif // DOXYGEN_NO_DETAIL |
79 | 123 |
80 #ifndef DOXYGEN_NO_DISPATCH | 124 #ifndef DOXYGEN_NO_DISPATCH |
133 } | 177 } |
134 | 178 |
135 }; | 179 }; |
136 | 180 |
137 | 181 |
182 template <typename Multi> | |
183 struct envelope<Multi, multi_point_tag> | |
184 : detail::envelope::envelope_range | |
185 {}; | |
186 | |
187 | |
188 template <typename Multi> | |
189 struct envelope<Multi, multi_linestring_tag> | |
190 : detail::envelope::envelope_multi_linestring | |
191 {}; | |
192 | |
193 | |
194 template <typename Multi> | |
195 struct envelope<Multi, multi_polygon_tag> | |
196 : detail::envelope::envelope_multi_polygon | |
197 {}; | |
198 | |
199 | |
138 } // namespace dispatch | 200 } // namespace dispatch |
139 #endif | 201 #endif |
202 | |
203 | |
204 namespace resolve_variant { | |
205 | |
206 template <typename Geometry> | |
207 struct envelope | |
208 { | |
209 template <typename Box> | |
210 static inline void apply(Geometry const& geometry, Box& box) | |
211 { | |
212 concept::check<Geometry const>(); | |
213 concept::check<Box>(); | |
214 | |
215 dispatch::envelope<Geometry>::apply(geometry, box); | |
216 } | |
217 }; | |
218 | |
219 template <BOOST_VARIANT_ENUM_PARAMS(typename T)> | |
220 struct envelope<boost::variant<BOOST_VARIANT_ENUM_PARAMS(T)> > | |
221 { | |
222 template <typename Box> | |
223 struct visitor: boost::static_visitor<void> | |
224 { | |
225 Box& m_box; | |
226 | |
227 visitor(Box& box): m_box(box) {} | |
228 | |
229 template <typename Geometry> | |
230 void operator()(Geometry const& geometry) const | |
231 { | |
232 envelope<Geometry>::apply(geometry, m_box); | |
233 } | |
234 }; | |
235 | |
236 template <typename Box> | |
237 static inline void | |
238 apply(boost::variant<BOOST_VARIANT_ENUM_PARAMS(T)> const& geometry, | |
239 Box& box) | |
240 { | |
241 boost::apply_visitor(visitor<Box>(box), geometry); | |
242 } | |
243 }; | |
244 | |
245 } // namespace resolve_variant | |
140 | 246 |
141 | 247 |
142 /*! | 248 /*! |
143 \brief \brief_calc{envelope} | 249 \brief \brief_calc{envelope} |
144 \ingroup envelope | 250 \ingroup envelope |
155 } | 261 } |
156 */ | 262 */ |
157 template<typename Geometry, typename Box> | 263 template<typename Geometry, typename Box> |
158 inline void envelope(Geometry const& geometry, Box& mbr) | 264 inline void envelope(Geometry const& geometry, Box& mbr) |
159 { | 265 { |
160 concept::check<Geometry const>(); | 266 resolve_variant::envelope<Geometry>::apply(geometry, mbr); |
161 concept::check<Box>(); | |
162 | |
163 dispatch::envelope<Geometry>::apply(geometry, mbr); | |
164 } | 267 } |
165 | 268 |
166 | 269 |
167 /*! | 270 /*! |
168 \brief \brief_calc{envelope} | 271 \brief \brief_calc{envelope} |
180 } | 283 } |
181 */ | 284 */ |
182 template<typename Box, typename Geometry> | 285 template<typename Box, typename Geometry> |
183 inline Box return_envelope(Geometry const& geometry) | 286 inline Box return_envelope(Geometry const& geometry) |
184 { | 287 { |
185 concept::check<Geometry const>(); | |
186 concept::check<Box>(); | |
187 | |
188 Box mbr; | 288 Box mbr; |
189 dispatch::envelope<Geometry>::apply(geometry, mbr); | 289 resolve_variant::envelope<Geometry>::apply(geometry, mbr); |
190 return mbr; | 290 return mbr; |
191 } | 291 } |
192 | 292 |
193 }} // namespace boost::geometry | 293 }} // namespace boost::geometry |
194 | 294 |