]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/boost/geometry/algorithms/detail/envelope/segment.hpp
import quincy beta 17.1.0
[ceph.git] / ceph / src / boost / boost / geometry / algorithms / detail / envelope / segment.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-2020.
8 // Modifications copyright (c) 2015-2020, Oracle and/or its affiliates.
9
10 // Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
11 // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
12 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
13
14 // Distributed under the Boost Software License, Version 1.0.
15 // (See accompanying file LICENSE_1_0.txt or copy at
16 // http://www.boost.org/LICENSE_1_0.txt)
17
18 #ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_ENVELOPE_SEGMENT_HPP
19 #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_ENVELOPE_SEGMENT_HPP
20
21 #include <cstddef>
22
23 #include <boost/geometry/core/tags.hpp>
24
25 #include <boost/geometry/algorithms/detail/assign_indexed_point.hpp>
26 #include <boost/geometry/algorithms/dispatch/envelope.hpp>
27
28 // TEMP
29 #include <boost/geometry/strategies/detail.hpp>
30
31 namespace boost { namespace geometry
32 {
33
34 #ifndef DOXYGEN_NO_DETAIL
35 namespace detail { namespace envelope
36 {
37
38 // TEMP
39 template
40 <
41 typename Strategy,
42 bool IsUmbrella = strategies::detail::is_umbrella_strategy<Strategy>::value
43 >
44 struct envelope_segment_call_strategy
45 {
46 template <typename Point, typename Segment, typename Box>
47 static inline void apply(Point const& p1, Point const& p2,
48 Segment const& segment, Box& mbr,
49 Strategy const& strategy)
50 {
51 strategy.envelope(segment, mbr).apply(p1, p2, mbr);
52 }
53 };
54
55 template <typename Strategy>
56 struct envelope_segment_call_strategy<Strategy, false>
57 {
58 template <typename Point, typename Segment, typename Box>
59 static inline void apply(Point const& p1, Point const& p2,
60 Segment const&, Box& mbr,
61 Strategy const& strategy)
62 {
63 strategy.apply(p1, p2, mbr);
64 }
65 };
66
67 struct envelope_segment
68 {
69 template <typename Segment, typename Box, typename Strategy>
70 static inline void apply(Segment const& segment, Box& mbr,
71 Strategy const& strategy)
72 {
73 typename point_type<Segment>::type p[2];
74 detail::assign_point_from_index<0>(segment, p[0]);
75 detail::assign_point_from_index<1>(segment, p[1]);
76
77 // TEMP - expand calls this and Umbrella strategies are not yet supported there
78 envelope_segment_call_strategy<Strategy>::apply(p[0], p[1], segment, mbr, strategy);
79 }
80 };
81
82 }} // namespace detail::envelope
83 #endif // DOXYGEN_NO_DETAIL
84
85
86 #ifndef DOXYGEN_NO_DISPATCH
87 namespace dispatch
88 {
89
90
91 template <typename Segment>
92 struct envelope<Segment, segment_tag>
93 {
94 template <typename Box, typename Strategy>
95 static inline void apply(Segment const& segment,
96 Box& mbr,
97 Strategy const& strategy)
98 {
99 detail::envelope::envelope_segment
100 /*<
101 dimension<Segment>::value
102 >*/::apply(segment, mbr, strategy);
103 }
104 };
105
106 } // namespace dispatch
107 #endif // DOXYGEN_NO_DISPATCH
108
109 }} // namespace boost::geometry
110
111 #endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_ENVELOPE_SEGMENT_HPP