]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/geometry/include/boost/geometry/algorithms/detail/envelope/interface.hpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / geometry / include / boost / geometry / algorithms / detail / envelope / interface.hpp
CommitLineData
7c673cae
FG
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
7// This file was modified by Oracle on 2015.
8// Modifications copyright (c) 2015, Oracle and/or its affiliates.
9
10// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
11
12// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
13// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
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_ENVELOPE_INTERFACE_HPP
20#define BOOST_GEOMETRY_ALGORITHMS_DETAIL_ENVELOPE_INTERFACE_HPP
21
22#include <boost/variant/apply_visitor.hpp>
23#include <boost/variant/static_visitor.hpp>
24#include <boost/variant/variant_fwd.hpp>
25
26#include <boost/geometry/geometries/concepts/check.hpp>
27
28#include <boost/geometry/algorithms/dispatch/envelope.hpp>
29
30
31namespace boost { namespace geometry
32{
33
34namespace resolve_variant
35{
36
37template <typename Geometry>
38struct envelope
39{
40 template <typename Box>
41 static inline void apply(Geometry const& geometry, Box& box)
42 {
43 concepts::check<Geometry const>();
44 concepts::check<Box>();
45
46 dispatch::envelope<Geometry>::apply(geometry, box);
47 }
48};
49
50template <BOOST_VARIANT_ENUM_PARAMS(typename T)>
51struct envelope<boost::variant<BOOST_VARIANT_ENUM_PARAMS(T)> >
52{
53 template <typename Box>
54 struct visitor: boost::static_visitor<void>
55 {
56 Box& m_box;
57
58 visitor(Box& box): m_box(box) {}
59
60 template <typename Geometry>
61 void operator()(Geometry const& geometry) const
62 {
63 envelope<Geometry>::apply(geometry, m_box);
64 }
65 };
66
67 template <typename Box>
68 static inline void
69 apply(boost::variant<BOOST_VARIANT_ENUM_PARAMS(T)> const& geometry,
70 Box& box)
71 {
72 boost::apply_visitor(visitor<Box>(box), geometry);
73 }
74};
75
76} // namespace resolve_variant
77
78
79/*!
80\brief \brief_calc{envelope}
81\ingroup 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}
87
88\qbk{[include reference/algorithms/envelope.qbk]}
89\qbk{
90[heading Example]
91[envelope] [envelope_output]
92}
93*/
94template<typename Geometry, typename Box>
95inline void envelope(Geometry const& geometry, Box& mbr)
96{
97 resolve_variant::envelope<Geometry>::apply(geometry, mbr);
98}
99
100
101/*!
102\brief \brief_calc{envelope}
103\ingroup 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}
109
110\qbk{[include reference/algorithms/envelope.qbk]}
111\qbk{
112[heading Example]
113[return_envelope] [return_envelope_output]
114}
115*/
116template<typename Box, typename Geometry>
117inline Box return_envelope(Geometry const& geometry)
118{
119 Box mbr;
120 resolve_variant::envelope<Geometry>::apply(geometry, mbr);
121 return mbr;
122}
123
124}} // namespace boost::geometry
125
126#endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_ENVELOPE_INTERFACE_HPP