]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/geometry/include/boost/geometry/index/detail/algorithms/bounds.hpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / geometry / include / boost / geometry / index / detail / algorithms / bounds.hpp
CommitLineData
7c673cae
FG
1// Boost.Geometry Index
2//
3// n-dimensional bounds
4//
5// Copyright (c) 2011-2014 Adam Wulkiewicz, Lodz, Poland.
6//
7// Use, modification and distribution is subject to the Boost Software License,
8// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
9// http://www.boost.org/LICENSE_1_0.txt)
10
11#ifndef BOOST_GEOMETRY_INDEX_DETAIL_ALGORITHMS_BOUNDS_HPP
12#define BOOST_GEOMETRY_INDEX_DETAIL_ALGORITHMS_BOUNDS_HPP
13
14#include <boost/geometry/index/detail/bounded_view.hpp>
15
16namespace boost { namespace geometry { namespace index { namespace detail {
17
18namespace dispatch {
19
20template <typename Geometry,
21 typename Bounds,
22 typename TagGeometry = typename geometry::tag<Geometry>::type,
23 typename TagBounds = typename geometry::tag<Bounds>::type>
24struct bounds
25{
26 static inline void apply(Geometry const& g, Bounds & b)
27 {
28 geometry::convert(g, b);
29 }
30};
31
32template <typename Geometry, typename Bounds>
33struct bounds<Geometry, Bounds, segment_tag, box_tag>
34{
35 static inline void apply(Geometry const& g, Bounds & b)
36 {
37 index::detail::bounded_view<Geometry, Bounds> v(g);
38 geometry::convert(v, b);
39 }
40};
41
42} // namespace dispatch
43
44template <typename Geometry, typename Bounds>
45inline void bounds(Geometry const& g, Bounds & b)
46{
47 concepts::check_concepts_and_equal_dimensions<Geometry const, Bounds>();
48 dispatch::bounds<Geometry, Bounds>::apply(g, b);
49}
50
51namespace dispatch {
52
53template <typename Geometry,
54 typename TagGeometry = typename geometry::tag<Geometry>::type>
55struct return_ref_or_bounds
56{
57 typedef Geometry const& result_type;
58
59 static inline result_type apply(Geometry const& g)
60 {
61 return g;
62 }
63};
64
65template <typename Geometry>
66struct return_ref_or_bounds<Geometry, segment_tag>
67{
68 typedef typename point_type<Geometry>::type point_type;
69 typedef geometry::model::box<point_type> bounds_type;
70 typedef index::detail::bounded_view<Geometry, bounds_type> result_type;
71
72 static inline result_type apply(Geometry const& g)
73 {
74 return result_type(g);
75 }
76};
77
78} // namespace dispatch
79
80template <typename Geometry>
81inline
82typename dispatch::return_ref_or_bounds<Geometry>::result_type
83return_ref_or_bounds(Geometry const& g)
84{
85 return dispatch::return_ref_or_bounds<Geometry>::apply(g);
86}
87
88}}}} // namespace boost::geometry::index::detail
89
90#endif // BOOST_GEOMETRY_INDEX_DETAIL_ALGORITHMS_BOUNDS_HPP