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.
7 // This file was modified by Oracle on 2015.
8 // Modifications copyright (c) 2015, Oracle and/or its affiliates.
10 // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
12 // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
13 // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
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)
19 #ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_ENVELOPE_INTERFACE_HPP
20 #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_ENVELOPE_INTERFACE_HPP
22 #include <boost/variant/apply_visitor.hpp>
23 #include <boost/variant/static_visitor.hpp>
24 #include <boost/variant/variant_fwd.hpp>
26 #include <boost/geometry/geometries/concepts/check.hpp>
28 #include <boost/geometry/algorithms/dispatch/envelope.hpp>
31 namespace boost { namespace geometry
34 namespace resolve_variant
37 template <typename Geometry>
40 template <typename Box>
41 static inline void apply(Geometry const& geometry, Box& box)
43 concepts::check<Geometry const>();
44 concepts::check<Box>();
46 dispatch::envelope<Geometry>::apply(geometry, box);
50 template <BOOST_VARIANT_ENUM_PARAMS(typename T)>
51 struct envelope<boost::variant<BOOST_VARIANT_ENUM_PARAMS(T)> >
53 template <typename Box>
54 struct visitor: boost::static_visitor<void>
58 visitor(Box& box): m_box(box) {}
60 template <typename Geometry>
61 void operator()(Geometry const& geometry) const
63 envelope<Geometry>::apply(geometry, m_box);
67 template <typename Box>
69 apply(boost::variant<BOOST_VARIANT_ENUM_PARAMS(T)> const& geometry,
72 boost::apply_visitor(visitor<Box>(box), geometry);
76 } // namespace resolve_variant
80 \brief \brief_calc{envelope}
82 \details \details_calc{envelope,\det_envelope}.
83 \tparam Geometry \tparam_geometry
84 \tparam Box \tparam_box
85 \param geometry \param_geometry
86 \param mbr \param_box \param_set{envelope}
88 \qbk{[include reference/algorithms/envelope.qbk]}
91 [envelope] [envelope_output]
94 template<typename Geometry, typename Box>
95 inline void envelope(Geometry const& geometry, Box& mbr)
97 resolve_variant::envelope<Geometry>::apply(geometry, mbr);
102 \brief \brief_calc{envelope}
104 \details \details_calc{return_envelope,\det_envelope}. \details_return{envelope}
105 \tparam Box \tparam_box
106 \tparam Geometry \tparam_geometry
107 \param geometry \param_geometry
108 \return \return_calc{envelope}
110 \qbk{[include reference/algorithms/envelope.qbk]}
113 [return_envelope] [return_envelope_output]
116 template<typename Box, typename Geometry>
117 inline Box return_envelope(Geometry const& geometry)
120 resolve_variant::envelope<Geometry>::apply(geometry, mbr);
124 }} // namespace boost::geometry
126 #endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_ENVELOPE_INTERFACE_HPP