Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:36:46

0001 // Boost.Geometry
0002 
0003 // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
0004 
0005 // This file was modified by Oracle on 2014-2017.
0006 // Modifications copyright (c) 2014-2017 Oracle and/or its affiliates.
0007 
0008 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
0009 
0010 // Use, modification and distribution is subject to the Boost Software License,
0011 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
0012 // http://www.boost.org/LICENSE_1_0.txt)
0013 
0014 #ifndef BOOST_GEOMETRY_STRATEGIES_GEOGRAPHIC_VINCENTY_HPP
0015 #define BOOST_GEOMETRY_STRATEGIES_GEOGRAPHIC_VINCENTY_HPP
0016 
0017 
0018 #include <boost/geometry/strategies/geographic/distance.hpp>
0019 #include <boost/geometry/strategies/geographic/parameters.hpp>
0020 
0021 
0022 namespace boost { namespace geometry
0023 {
0024 
0025 namespace strategy { namespace distance
0026 {
0027 
0028 /*!
0029 \brief Distance calculation formulae on latlong coordinates, after Vincenty, 1975
0030 \ingroup distance
0031 \tparam Spheroid The reference spheroid model
0032 \tparam CalculationType \tparam_calculation
0033 \author See
0034     - http://www.ngs.noaa.gov/PUBS_LIB/inverse.pdf
0035     - http://www.icsm.gov.au/gda/gdav2.3.pdf
0036 \author Adapted from various implementations to get it close to the original document
0037     - http://www.movable-type.co.uk/scripts/LatLongVincenty.html
0038     - http://exogen.case.edu/projects/geopy/source/geopy.distance.html
0039     - http://futureboy.homeip.net/fsp/colorize.fsp?fileName=navigation.frink
0040 
0041 */
0042 template
0043 <
0044     typename Spheroid = srs::spheroid<double>,
0045     typename CalculationType = void
0046 >
0047 class vincenty
0048     : public strategy::distance::geographic
0049         <
0050             strategy::vincenty, Spheroid, CalculationType
0051         >
0052 {
0053     typedef strategy::distance::geographic
0054         <
0055             strategy::vincenty, Spheroid, CalculationType
0056         > base_type;
0057 
0058 public:
0059     inline vincenty()
0060         : base_type()
0061     {}
0062 
0063     explicit inline vincenty(Spheroid const& spheroid)
0064         : base_type(spheroid)
0065     {}
0066 };
0067 
0068 #ifndef DOXYGEN_NO_STRATEGY_SPECIALIZATIONS
0069 namespace services
0070 {
0071 
0072 template <typename Spheroid, typename CalculationType>
0073 struct tag<vincenty<Spheroid, CalculationType> >
0074 {
0075     typedef strategy_tag_distance_point_point type;
0076 };
0077 
0078 
0079 template <typename Spheroid, typename CalculationType, typename P1, typename P2>
0080 struct return_type<vincenty<Spheroid, CalculationType>, P1, P2>
0081     : vincenty<Spheroid, CalculationType>::template calculation_type<P1, P2>
0082 {};
0083 
0084 
0085 template <typename Spheroid, typename CalculationType>
0086 struct comparable_type<vincenty<Spheroid, CalculationType> >
0087 {
0088     typedef vincenty<Spheroid, CalculationType> type;
0089 };
0090 
0091 
0092 template <typename Spheroid, typename CalculationType>
0093 struct get_comparable<vincenty<Spheroid, CalculationType> >
0094 {
0095     static inline vincenty<Spheroid, CalculationType> apply(vincenty<Spheroid, CalculationType> const& input)
0096     {
0097         return input;
0098     }
0099 };
0100 
0101 template <typename Spheroid, typename CalculationType, typename P1, typename P2>
0102 struct result_from_distance<vincenty<Spheroid, CalculationType>, P1, P2 >
0103 {
0104     template <typename T>
0105     static inline typename return_type<vincenty<Spheroid, CalculationType>, P1, P2>::type
0106         apply(vincenty<Spheroid, CalculationType> const& , T const& value)
0107     {
0108         return value;
0109     }
0110 };
0111 
0112 
0113 } // namespace services
0114 #endif // DOXYGEN_NO_STRATEGY_SPECIALIZATIONS
0115 
0116 
0117 // We might add a vincenty-like strategy also for point-segment distance, but to calculate the projected point is not trivial
0118 
0119 
0120 
0121 }} // namespace strategy::distance
0122 
0123 
0124 }} // namespace boost::geometry
0125 
0126 
0127 #endif // BOOST_GEOMETRY_STRATEGIES_GEOGRAPHIC_VINCENTY_HPP