1 // Boost.Geometry (aka GGL, Generic Geometry Library)
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.
8 // This file was modified by Oracle on 2015.
9 // Modifications copyright (c) 2015, Oracle and/or its affiliates.
11 // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
13 // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
14 // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
16 // Distributed under the Boost Software License, Version 1.0.
17 // (See accompanying file LICENSE_1_0.txt or copy at
18 // http://www.boost.org/LICENSE_1_0.txt)
20 #ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_EXPAND_INTERFACE_HPP
21 #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_EXPAND_INTERFACE_HPP
23 #include <boost/variant/apply_visitor.hpp>
24 #include <boost/variant/static_visitor.hpp>
25 #include <boost/variant/variant_fwd.hpp>
27 #include <boost/geometry/geometries/concepts/check.hpp>
29 #include <boost/geometry/algorithms/dispatch/expand.hpp>
32 namespace boost { namespace geometry
36 namespace resolve_variant
39 template <typename Geometry>
42 template <typename Box>
43 static inline void apply(Box& box, Geometry const& geometry)
45 concepts::check<Box>();
46 concepts::check<Geometry const>();
47 concepts::check_concepts_and_equal_dimensions<Box, Geometry const>();
49 dispatch::expand<Box, Geometry>::apply(box, geometry);
53 template <BOOST_VARIANT_ENUM_PARAMS(typename T)>
54 struct expand<boost::variant<BOOST_VARIANT_ENUM_PARAMS(T)> >
56 template <typename Box>
57 struct visitor: boost::static_visitor<void>
61 visitor(Box& box) : m_box(box) {}
63 template <typename Geometry>
64 void operator()(Geometry const& geometry) const
66 return expand<Geometry>::apply(m_box, geometry);
73 boost::variant<BOOST_VARIANT_ENUM_PARAMS(T)> const& geometry)
75 return boost::apply_visitor(visitor<Box>(box), geometry);
79 } // namespace resolve_variant
84 \brief Expands a box using the extend (envelope) of another geometry (box, point)
86 \tparam Box type of the box
87 \tparam Geometry of second geometry, to be expanded with the box
88 \param box box to expand another geometry with, might be changed
89 \param geometry other geometry
91 \param strategy_greater
92 \note Strategy is currently ignored
96 typename Box, typename Geometry,
97 typename StrategyLess, typename StrategyGreater
99 inline void expand(Box& box, Geometry const& geometry,
100 StrategyLess const& strategy_less,
101 StrategyGreater const& strategy_greater)
103 concepts::check_concepts_and_equal_dimensions<Box, Geometry const>();
105 dispatch::expand<Box, Geometry>::apply(box, geometry);
111 \brief Expands a box using the bounding box (envelope) of another geometry (box, point)
113 \tparam Box type of the box
114 \tparam Geometry \tparam_geometry
115 \param box box to be expanded using another geometry, mutable
116 \param geometry \param_geometry geometry which envelope (bounding box) will be added to the box
118 \qbk{[include reference/algorithms/expand.qbk]}
120 template <typename Box, typename Geometry>
121 inline void expand(Box& box, Geometry const& geometry)
123 resolve_variant::expand<Geometry>::apply(box, geometry);
126 }} // namespace boost::geometry
128 #endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_EXPAND_INTERFACE_HPP