]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/boost/geometry/strategies/geographic/distance_cross_track_point_box.hpp
update sources to ceph Nautilus 14.2.1
[ceph.git] / ceph / src / boost / boost / geometry / strategies / geographic / distance_cross_track_point_box.hpp
CommitLineData
11fdf7f2
TL
1// Boost.Geometry (aka GGL, Generic Geometry Library)
2
3// Copyright (c) 2017-2018, 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_DISTANCE_CROSS_TRACK_POINT_BOX_HPP
13#define BOOST_GEOMETRY_STRATEGIES_GEOGRAPHIC_DISTANCE_CROSS_TRACK_POINT_BOX_HPP
14
15#include <boost/config.hpp>
16#include <boost/concept_check.hpp>
17#include <boost/mpl/if.hpp>
18#include <boost/type_traits/is_void.hpp>
19
20#include <boost/geometry/core/access.hpp>
21#include <boost/geometry/core/assert.hpp>
22#include <boost/geometry/core/point_type.hpp>
23#include <boost/geometry/core/radian_access.hpp>
24#include <boost/geometry/core/tags.hpp>
25
26#include <boost/geometry/strategies/distance.hpp>
27#include <boost/geometry/strategies/concepts/distance_concept.hpp>
28#include <boost/geometry/strategies/spherical/distance_cross_track.hpp>
29#include <boost/geometry/strategies/geographic/distance_cross_track.hpp>
30#include <boost/geometry/strategies/spherical/distance_cross_track_point_box.hpp>
31
32#include <boost/geometry/util/math.hpp>
33#include <boost/geometry/algorithms/detail/assign_box_corners.hpp>
34
35
36namespace boost { namespace geometry
37{
38
39namespace strategy { namespace distance
40{
41
42
43/*!
44\brief Strategy functor for distance point to box calculation
45\ingroup strategies
46\details Class which calculates the distance of a point to a box, for
47points and boxes on a sphere or globe
48\tparam CalculationType \tparam_calculation
49\tparam Strategy underlying point-segment distance strategy, defaults
50to cross track
51\qbk{
52[heading See also]
53[link geometry.reference.algorithms.distance.distance_3_with_strategy distance (with strategy)]
54}
55*/
56template
57<
58 typename FormulaPolicy = strategy::andoyer,
59 typename Spheroid = srs::spheroid<double>,
60 typename CalculationType = void
61>
62class geographic_cross_track_point_box
63{
64public:
65 typedef geographic_cross_track<FormulaPolicy, Spheroid, CalculationType> Strategy;
66
67 template <typename Point, typename Box>
68 struct return_type
69 : services::return_type<Strategy, Point, typename point_type<Box>::type>
70 {};
71
72 inline geographic_cross_track_point_box()
73 {}
74
75 template <typename Point, typename Box>
76 inline typename return_type<Point, Box>::type
77 apply(Point const& point, Box const& box) const
78 {
79/*
80#if !defined(BOOST_MSVC)
81 BOOST_CONCEPT_ASSERT
82 (
83 (concepts::PointSegmentDistanceStrategy
84 <
85 Strategy, Point, typename point_type<Box>::type
86 >)
87 );
88#endif
89*/
90
91 typedef typename return_type<Point, Box>::type return_type;
92
93 return details::cross_track_point_box_generic
94 <return_type>::apply(point, box, Strategy());
95 }
96};
97
98
99
100#ifndef DOXYGEN_NO_STRATEGY_SPECIALIZATIONS
101namespace services
102{
103
104template <typename Strategy, typename Spheroid, typename CalculationType>
105struct tag<geographic_cross_track_point_box<Strategy, Spheroid, CalculationType> >
106{
107 typedef strategy_tag_distance_point_box type;
108};
109
110
111template <typename Strategy, typename Spheroid, typename CalculationType, typename P, typename Box>
112struct return_type<geographic_cross_track_point_box<Strategy, Spheroid, CalculationType>, P, Box>
113 : geographic_cross_track_point_box
114 <
115 Strategy, Spheroid, CalculationType
116 >::template return_type<P, Box>
117{};
118
119template <typename Strategy, typename Spheroid, typename P, typename Box>
120struct return_type<geographic_cross_track_point_box<Strategy, Spheroid>, P, Box>
121 : geographic_cross_track_point_box
122 <
123 Strategy, Spheroid
124 >::template return_type<P, Box>
125{};
126
127template <typename Strategy, typename P, typename Box>
128struct return_type<geographic_cross_track_point_box<Strategy>, P, Box>
129 : geographic_cross_track_point_box
130 <
131 Strategy
132 >::template return_type<P, Box>
133{};
134
135template <typename Strategy, typename Spheroid, typename CalculationType>
136struct comparable_type<geographic_cross_track_point_box<Strategy, Spheroid, CalculationType> >
137{
138 typedef geographic_cross_track_point_box
139 <
140 Strategy, Spheroid, CalculationType
141 > type;
142};
143
144
145template <typename Strategy, typename Spheroid, typename CalculationType>
146struct get_comparable<geographic_cross_track_point_box<Strategy, Spheroid, CalculationType> >
147{
148 typedef geographic_cross_track_point_box<Strategy, Spheroid, CalculationType> this_strategy;
149 typedef typename comparable_type<this_strategy>::type comparable_type;
150
151public:
152 static inline comparable_type apply(this_strategy const&)
153 {
154 return comparable_type();
155 }
156};
157
158
159template <typename Strategy, typename Spheroid, typename CalculationType, typename P, typename Box>
160struct result_from_distance
161 <
162 geographic_cross_track_point_box<Strategy, Spheroid, CalculationType>, P, Box
163 >
164{
165private:
166 typedef geographic_cross_track_point_box<Strategy, Spheroid, CalculationType> this_strategy;
167
168 typedef typename this_strategy::template return_type
169 <
170 P, Box
171 >::type return_type;
172
173public:
174 template <typename T>
175 static inline return_type apply(this_strategy const& strategy,
176 T const& distance)
177 {
178 result_from_distance
179 <
180 Strategy, P, typename point_type<Box>::type
181 >::apply(strategy, distance);
182 }
183};
184
185template <typename Point, typename Box>
186struct default_strategy
187 <
188 point_tag, box_tag, Point, Box,
189 geographic_tag, geographic_tag
190 >
191{
192 typedef geographic_cross_track_point_box<> type;
193};
194
195template <typename Box, typename Point>
196struct default_strategy
197 <
198 box_tag, point_tag, Box, Point,
199 geographic_tag, geographic_tag
200 >
201{
202 typedef typename default_strategy
203 <
204 point_tag, box_tag, Point, Box,
205 geographic_tag, geographic_tag
206 >::type type;
207};
208
209} // namespace services
210#endif // DOXYGEN_NO_STRATEGY_SPECIALIZATIONS
211
212
213}} // namespace strategy::distance
214
215
216}} // namespace boost::geometry
217
218#endif // BOOST_GEOMETRY_STRATEGIES_GEOGRAPHIC_DISTANCE_CROSS_TRACK_POINT_BOX_HPP