]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/boost/geometry/strategies/geographic/disjoint_segment_box.hpp
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / boost / boost / geometry / strategies / geographic / disjoint_segment_box.hpp
1 // Boost.Geometry
2
3 // Copyright (c) 2017-2019 Oracle and/or its affiliates.
4
5 // Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
6 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
7
8 // Use, modification and distribution is subject to the Boost Software License,
9 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
10 // http://www.boost.org/LICENSE_1_0.txt)
11
12 #ifndef BOOST_GEOMETRY_STRATEGIES_GEOGRAPHIC_DISJOINT_SEGMENT_BOX_HPP
13 #define BOOST_GEOMETRY_STRATEGIES_GEOGRAPHIC_DISJOINT_SEGMENT_BOX_HPP
14
15
16 #include <cstddef>
17 #include <utility>
18
19 #include <boost/numeric/conversion/cast.hpp>
20
21 #include <boost/geometry/util/math.hpp>
22 #include <boost/geometry/util/calculation_type.hpp>
23
24 #include <boost/geometry/core/access.hpp>
25 #include <boost/geometry/core/tags.hpp>
26 #include <boost/geometry/core/coordinate_dimension.hpp>
27 #include <boost/geometry/core/point_type.hpp>
28
29 #include <boost/geometry/algorithms/detail/assign_indexed_point.hpp>
30 #include <boost/geometry/algorithms/detail/disjoint/segment_box.hpp>
31
32 #include <boost/geometry/srs/spheroid.hpp>
33
34 // TODO: spherical_point_box currently defined in the same file as cartesian
35 #include <boost/geometry/strategies/cartesian/point_in_box.hpp>
36 #include <boost/geometry/strategies/disjoint.hpp>
37 #include <boost/geometry/strategies/geographic/azimuth.hpp>
38 #include <boost/geometry/strategies/geographic/parameters.hpp>
39 #include <boost/geometry/strategies/normalize.hpp>
40 #include <boost/geometry/strategies/spherical/disjoint_box_box.hpp>
41
42
43 namespace boost { namespace geometry { namespace strategy { namespace disjoint
44 {
45
46 // NOTE: This may be temporary place for this or corresponding strategy
47 // It seems to be more appropriate to implement the opposite of it
48 // e.g. intersection::segment_box because in disjoint() algorithm
49 // other strategies that are used are intersection and covered_by strategies.
50 template
51 <
52 typename FormulaPolicy = strategy::andoyer,
53 typename Spheroid = srs::spheroid<double>,
54 typename CalculationType = void
55 >
56 struct segment_box_geographic
57 {
58 public:
59 typedef Spheroid model_type;
60
61 inline segment_box_geographic()
62 : m_spheroid()
63 {}
64
65 explicit inline segment_box_geographic(Spheroid const& spheroid)
66 : m_spheroid(spheroid)
67 {}
68
69 typedef covered_by::spherical_point_box disjoint_point_box_strategy_type;
70
71 static inline disjoint_point_box_strategy_type get_disjoint_point_box_strategy()
72 {
73 return disjoint_point_box_strategy_type();
74 }
75
76 template <typename Segment, typename Box>
77 inline bool apply(Segment const& segment, Box const& box) const
78 {
79 geometry::strategy::azimuth::geographic
80 <
81 FormulaPolicy,
82 Spheroid,
83 CalculationType
84 > azimuth_geographic(m_spheroid);
85
86 return geometry::detail::disjoint::disjoint_segment_box_sphere_or_spheroid
87 <
88 geographic_tag
89 >::apply(segment, box,
90 azimuth_geographic,
91 strategy::normalize::spherical_point(),
92 strategy::covered_by::spherical_point_box(),
93 strategy::disjoint::spherical_box_box());
94 }
95
96 Spheroid const& model() const
97 {
98 return m_spheroid;
99 }
100
101 private:
102 Spheroid m_spheroid;
103 };
104
105
106 #ifndef DOXYGEN_NO_STRATEGY_SPECIALIZATIONS
107
108
109 namespace services
110 {
111
112 template <typename Linear, typename Box, typename LinearTag>
113 struct default_strategy<Linear, Box, LinearTag, box_tag, 1, 2,
114 geographic_tag, geographic_tag>
115 {
116 typedef segment_box_geographic<> type;
117 };
118
119 template <typename Box, typename Linear, typename LinearTag>
120 struct default_strategy<Box, Linear, box_tag, LinearTag, 2, 1,
121 geographic_tag, geographic_tag>
122 {
123 typedef segment_box_geographic<> type;
124 };
125
126
127 } // namespace services
128
129
130 #endif // DOXYGEN_NO_STRATEGY_SPECIALIZATIONS
131
132
133 }}}} // namespace boost::geometry::strategy::disjoint
134
135
136 #endif // BOOST_GEOMETRY_STRATEGIES_GEOGRAPHIC_DISJOINT_SEGMENT_BOX_HPP