comparison DEPENDENCIES/generic/include/boost/geometry/algorithms/expand.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
1 // Boost.Geometry (aka GGL, Generic Geometry Library) 1 // Boost.Geometry (aka GGL, Generic Geometry Library)
2 2
3 // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. 3 // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
4 // Copyright (c) 2008-2012 Bruno Lalande, Paris, France. 4 // Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
5 // Copyright (c) 2009-2012 Mateusz Loskot, London, UK. 5 // Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
6 // Copyright (c) 2014 Samuel Debionne, Grenoble, France.
6 7
7 // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library 8 // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
8 // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. 9 // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
9 10
10 // Use, modification and distribution is subject to the Boost Software License, 11 // Use, modification and distribution is subject to the Boost Software License,
16 17
17 18
18 #include <cstddef> 19 #include <cstddef>
19 20
20 #include <boost/numeric/conversion/cast.hpp> 21 #include <boost/numeric/conversion/cast.hpp>
22
23 #include <boost/variant/apply_visitor.hpp>
24 #include <boost/variant/static_visitor.hpp>
25 #include <boost/variant/variant_fwd.hpp>
21 26
22 #include <boost/geometry/algorithms/not_implemented.hpp> 27 #include <boost/geometry/algorithms/not_implemented.hpp>
23 #include <boost/geometry/core/coordinate_dimension.hpp> 28 #include <boost/geometry/core/coordinate_dimension.hpp>
24 #include <boost/geometry/geometries/concepts/check.hpp> 29 #include <boost/geometry/geometries/concepts/check.hpp>
25 30
247 252
248 } // namespace dispatch 253 } // namespace dispatch
249 #endif // DOXYGEN_NO_DISPATCH 254 #endif // DOXYGEN_NO_DISPATCH
250 255
251 256
257 namespace resolve_variant {
258
259 template <typename Geometry>
260 struct expand
261 {
262 template <typename Box>
263 static inline void apply(Box& box, Geometry const& geometry)
264 {
265 concept::check<Box>();
266 concept::check<Geometry const>();
267 concept::check_concepts_and_equal_dimensions<Box, Geometry const>();
268
269 dispatch::expand<Box, Geometry>::apply(box, geometry);
270 }
271 };
272
273 template <BOOST_VARIANT_ENUM_PARAMS(typename T)>
274 struct expand<boost::variant<BOOST_VARIANT_ENUM_PARAMS(T)> >
275 {
276 template <typename Box>
277 struct visitor: boost::static_visitor<void>
278 {
279 Box& m_box;
280
281 visitor(Box& box) : m_box(box) {}
282
283 template <typename Geometry>
284 void operator()(Geometry const& geometry) const
285 {
286 return expand<Geometry>::apply(m_box, geometry);
287 }
288 };
289
290 template <class Box>
291 static inline void
292 apply(Box& box,
293 boost::variant<BOOST_VARIANT_ENUM_PARAMS(T)> const& geometry)
294 {
295 return boost::apply_visitor(visitor<Box>(box), geometry);
296 }
297 };
298
299 } // namespace resolve_variant
300
301
252 /*** 302 /***
253 *! 303 *!
254 \brief Expands a box using the extend (envelope) of another geometry (box, point) 304 \brief Expands a box using the extend (envelope) of another geometry (box, point)
255 \ingroup expand 305 \ingroup expand
256 \tparam Box type of the box 306 \tparam Box type of the box
288 \qbk{[include reference/algorithms/expand.qbk]} 338 \qbk{[include reference/algorithms/expand.qbk]}
289 */ 339 */
290 template <typename Box, typename Geometry> 340 template <typename Box, typename Geometry>
291 inline void expand(Box& box, Geometry const& geometry) 341 inline void expand(Box& box, Geometry const& geometry)
292 { 342 {
293 concept::check_concepts_and_equal_dimensions<Box, Geometry const>(); 343 resolve_variant::expand<Geometry>::apply(box, geometry);
294
295 dispatch::expand<Box, Geometry>::apply(box, geometry);
296 } 344 }
297 345
298 }} // namespace boost::geometry 346 }} // namespace boost::geometry
299 347
300 #endif // BOOST_GEOMETRY_ALGORITHMS_EXPAND_HPP 348 #endif // BOOST_GEOMETRY_ALGORITHMS_EXPAND_HPP