]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/geometry/include/boost/geometry/algorithms/detail/envelope/implementation.hpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / geometry / include / boost / geometry / algorithms / detail / envelope / implementation.hpp
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_IMPLEMENTATION_HPP
20 #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_ENVELOPE_IMPLEMENTATION_HPP
21
22 #include <boost/geometry/core/exterior_ring.hpp>
23 #include <boost/geometry/core/interior_rings.hpp>
24 #include <boost/geometry/core/tags.hpp>
25
26 #include <boost/geometry/algorithms/is_empty.hpp>
27
28 #include <boost/geometry/algorithms/detail/envelope/box.hpp>
29 #include <boost/geometry/algorithms/detail/envelope/linear.hpp>
30 #include <boost/geometry/algorithms/detail/envelope/multipoint.hpp>
31 #include <boost/geometry/algorithms/detail/envelope/point.hpp>
32 #include <boost/geometry/algorithms/detail/envelope/range.hpp>
33 #include <boost/geometry/algorithms/detail/envelope/segment.hpp>
34
35 #include <boost/geometry/algorithms/dispatch/envelope.hpp>
36
37
38 namespace boost { namespace geometry
39 {
40
41 #ifndef DOXYGEN_NO_DETAIL
42 namespace detail { namespace envelope
43 {
44
45
46 struct envelope_polygon
47 {
48 template <typename Polygon, typename Box>
49 static inline void apply(Polygon const& polygon, Box& mbr)
50 {
51 typename ring_return_type<Polygon const>::type ext_ring
52 = exterior_ring(polygon);
53
54 if (geometry::is_empty(ext_ring))
55 {
56 // if the exterior ring is empty, consider the interior rings
57 envelope_multi_range
58 <
59 envelope_range
60 >::apply(interior_rings(polygon), mbr);
61 }
62 else
63 {
64 // otherwise, consider only the exterior ring
65 envelope_range::apply(ext_ring, mbr);
66 }
67 }
68 };
69
70
71 }} // namespace detail::envelope
72 #endif // DOXYGEN_NO_DETAIL
73
74 #ifndef DOXYGEN_NO_DISPATCH
75 namespace dispatch
76 {
77
78
79 template <typename Ring>
80 struct envelope<Ring, ring_tag>
81 : detail::envelope::envelope_range
82 {};
83
84
85 template <typename Polygon>
86 struct envelope<Polygon, polygon_tag>
87 : detail::envelope::envelope_polygon
88 {};
89
90
91 template <typename MultiPolygon>
92 struct envelope<MultiPolygon, multi_polygon_tag>
93 : detail::envelope::envelope_multi_range
94 <
95 detail::envelope::envelope_polygon
96 >
97 {};
98
99
100 } // namespace dispatch
101 #endif // DOXYGEN_NO_DISPATCH
102
103
104 }} // namespace boost::geometry
105
106 #endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_ENVELOPE_IMPLEMENTATION_HPP