]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/boost/geometry/strategies/geographic/distance_vincenty.hpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / boost / geometry / strategies / geographic / distance_vincenty.hpp
1 // Boost.Geometry
2
3 // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
4
5 // This file was modified by Oracle on 2014-2017.
6 // Modifications copyright (c) 2014-2017 Oracle and/or its affiliates.
7
8 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
9
10 // Use, modification and distribution is subject to the Boost Software License,
11 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
12 // http://www.boost.org/LICENSE_1_0.txt)
13
14 #ifndef BOOST_GEOMETRY_STRATEGIES_GEOGRAPHIC_VINCENTY_HPP
15 #define BOOST_GEOMETRY_STRATEGIES_GEOGRAPHIC_VINCENTY_HPP
16
17
18 #include <boost/geometry/strategies/geographic/distance.hpp>
19 #include <boost/geometry/strategies/geographic/parameters.hpp>
20
21
22 namespace boost { namespace geometry
23 {
24
25 namespace strategy { namespace distance
26 {
27
28 /*!
29 \brief Distance calculation formulae on latlong coordinates, after Vincenty, 1975
30 \ingroup distance
31 \tparam Spheroid The reference spheroid model
32 \tparam CalculationType \tparam_calculation
33 \author See
34 - http://www.ngs.noaa.gov/PUBS_LIB/inverse.pdf
35 - http://www.icsm.gov.au/gda/gdav2.3.pdf
36 \author Adapted from various implementations to get it close to the original document
37 - http://www.movable-type.co.uk/scripts/LatLongVincenty.html
38 - http://exogen.case.edu/projects/geopy/source/geopy.distance.html
39 - http://futureboy.homeip.net/fsp/colorize.fsp?fileName=navigation.frink
40
41 */
42 template
43 <
44 typename Spheroid = srs::spheroid<double>,
45 typename CalculationType = void
46 >
47 class vincenty
48 : public strategy::distance::geographic
49 <
50 strategy::vincenty, Spheroid, CalculationType
51 >
52 {
53 typedef strategy::distance::geographic
54 <
55 strategy::vincenty, Spheroid, CalculationType
56 > base_type;
57
58 public:
59 inline vincenty()
60 : base_type()
61 {}
62
63 explicit inline vincenty(Spheroid const& spheroid)
64 : base_type(spheroid)
65 {}
66 };
67
68 #ifndef DOXYGEN_NO_STRATEGY_SPECIALIZATIONS
69 namespace services
70 {
71
72 template <typename Spheroid, typename CalculationType>
73 struct tag<vincenty<Spheroid, CalculationType> >
74 {
75 typedef strategy_tag_distance_point_point type;
76 };
77
78
79 template <typename Spheroid, typename CalculationType, typename P1, typename P2>
80 struct return_type<vincenty<Spheroid, CalculationType>, P1, P2>
81 : vincenty<Spheroid, CalculationType>::template calculation_type<P1, P2>
82 {};
83
84
85 template <typename Spheroid, typename CalculationType>
86 struct comparable_type<vincenty<Spheroid, CalculationType> >
87 {
88 typedef vincenty<Spheroid, CalculationType> type;
89 };
90
91
92 template <typename Spheroid, typename CalculationType>
93 struct get_comparable<vincenty<Spheroid, CalculationType> >
94 {
95 static inline vincenty<Spheroid, CalculationType> apply(vincenty<Spheroid, CalculationType> const& input)
96 {
97 return input;
98 }
99 };
100
101 template <typename Spheroid, typename CalculationType, typename P1, typename P2>
102 struct result_from_distance<vincenty<Spheroid, CalculationType>, P1, P2 >
103 {
104 template <typename T>
105 static inline typename return_type<vincenty<Spheroid, CalculationType>, P1, P2>::type
106 apply(vincenty<Spheroid, CalculationType> const& , T const& value)
107 {
108 return value;
109 }
110 };
111
112
113 } // namespace services
114 #endif // DOXYGEN_NO_STRATEGY_SPECIALIZATIONS
115
116
117 // We might add a vincenty-like strategy also for point-segment distance, but to calculate the projected point is not trivial
118
119
120
121 }} // namespace strategy::distance
122
123
124 }} // namespace boost::geometry
125
126
127 #endif // BOOST_GEOMETRY_STRATEGIES_GEOGRAPHIC_VINCENTY_HPP