File indexing completed on 2025-01-18 09:36:47
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #ifndef BOOST_GEOMETRY_STRATEGIES_LENGTH_GEOGRAPHIC_HPP
0011 #define BOOST_GEOMETRY_STRATEGIES_LENGTH_GEOGRAPHIC_HPP
0012
0013
0014 #include <boost/geometry/strategies/detail.hpp>
0015 #include <boost/geometry/strategies/distance/detail.hpp>
0016 #include <boost/geometry/strategies/length/services.hpp>
0017
0018 #include <boost/geometry/strategies/geographic/distance.hpp>
0019
0020 #include <boost/geometry/strategies/geographic/distance_andoyer.hpp>
0021 #include <boost/geometry/strategies/geographic/distance_thomas.hpp>
0022 #include <boost/geometry/strategies/geographic/distance_vincenty.hpp>
0023
0024
0025 namespace boost { namespace geometry
0026 {
0027
0028 namespace strategies { namespace length
0029 {
0030
0031 template
0032 <
0033 typename FormulaPolicy = strategy::andoyer,
0034 typename Spheroid = srs::spheroid<double>,
0035 typename CalculationType = void
0036 >
0037 class geographic
0038 : public strategies::detail::geographic_base<Spheroid>
0039 {
0040 using base_t = strategies::detail::geographic_base<Spheroid>;
0041
0042 public:
0043 geographic() = default;
0044
0045 explicit geographic(Spheroid const& spheroid)
0046 : base_t(spheroid)
0047 {}
0048
0049 template <typename Geometry1, typename Geometry2>
0050 auto distance(Geometry1 const&, Geometry2 const&,
0051 distance::detail::enable_if_pp_t<Geometry1, Geometry2> * = nullptr) const
0052 {
0053 return strategy::distance::geographic
0054 <
0055 FormulaPolicy, Spheroid, CalculationType
0056 >(base_t::m_spheroid);
0057 }
0058 };
0059
0060
0061 namespace services
0062 {
0063
0064 template <typename Geometry>
0065 struct default_strategy<Geometry, geographic_tag>
0066 {
0067 using type = strategies::length::geographic<>;
0068 };
0069
0070
0071 template <typename FP, typename S, typename CT>
0072 struct strategy_converter<strategy::distance::geographic<FP, S, CT> >
0073 {
0074 static auto get(strategy::distance::geographic<FP, S, CT> const& s)
0075 {
0076 return strategies::length::geographic<FP, S, CT>(s.model());
0077 }
0078 };
0079
0080 template <typename S, typename CT>
0081 struct strategy_converter<strategy::distance::andoyer<S, CT> >
0082 {
0083 static auto get(strategy::distance::andoyer<S, CT> const& s)
0084 {
0085 return strategies::length::geographic<strategy::andoyer, S, CT>(s.model());
0086 }
0087 };
0088
0089 template <typename S, typename CT>
0090 struct strategy_converter<strategy::distance::thomas<S, CT> >
0091 {
0092 static auto get(strategy::distance::thomas<S, CT> const& s)
0093 {
0094 return strategies::length::geographic<strategy::thomas, S, CT>(s.model());
0095 }
0096 };
0097
0098 template <typename S, typename CT>
0099 struct strategy_converter<strategy::distance::vincenty<S, CT> >
0100 {
0101 static auto get(strategy::distance::vincenty<S, CT> const& s)
0102 {
0103 return strategies::length::geographic<strategy::vincenty, S, CT>(s.model());
0104 }
0105 };
0106
0107
0108 }
0109
0110 }}
0111
0112 }}
0113
0114 #endif