Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // Boost.Geometry
0002 
0003 // Copyright (c) 2021, Oracle and/or its affiliates.
0004 
0005 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
0006 
0007 // Licensed under the Boost Software License version 1.0.
0008 // http://www.boost.org/users/license.html
0009 
0010 #ifndef BOOST_GEOMETRY_STRATEGIES_DISCRETE_DISTANCE_GEOGRAPHIC_HPP
0011 #define BOOST_GEOMETRY_STRATEGIES_DISCRETE_DISTANCE_GEOGRAPHIC_HPP
0012 
0013 
0014 #include <boost/geometry/strategies/detail.hpp>
0015 #include <boost/geometry/strategies/discrete_distance/services.hpp>
0016 #include <boost/geometry/strategies/distance/comparable.hpp>
0017 #include <boost/geometry/strategies/distance/detail.hpp>
0018 
0019 #include <boost/geometry/strategies/geographic/distance.hpp>
0020 // TODO - for backwards compatibility, remove?
0021 #include <boost/geometry/strategies/geographic/distance_andoyer.hpp>
0022 #include <boost/geometry/strategies/geographic/distance_thomas.hpp>
0023 #include <boost/geometry/strategies/geographic/distance_vincenty.hpp>
0024 
0025 
0026 namespace boost { namespace geometry
0027 {
0028 
0029 namespace strategies { namespace discrete_distance
0030 {
0031 
0032 template
0033 <
0034     typename FormulaPolicy = strategy::andoyer,
0035     typename Spheroid = srs::spheroid<double>,
0036     typename CalculationType = void
0037 >
0038 class geographic
0039     : public strategies::detail::geographic_base<Spheroid>
0040 {
0041     using base_t = strategies::detail::geographic_base<Spheroid>;
0042 
0043 public:
0044     geographic() = default;
0045 
0046     explicit geographic(Spheroid const& spheroid)
0047         : base_t(spheroid)
0048     {}
0049 
0050     template <typename Geometry1, typename Geometry2>
0051     auto distance(Geometry1 const&, Geometry2 const&,
0052                   distance::detail::enable_if_pp_t<Geometry1, Geometry2> * = nullptr) const
0053     {
0054         return strategy::distance::geographic
0055                 <
0056                     FormulaPolicy, Spheroid, CalculationType
0057                 >(base_t::m_spheroid);
0058     }
0059 };
0060 
0061 
0062 namespace services
0063 {
0064 
0065 template <typename Geometry1, typename Geometry2>
0066 struct default_strategy<Geometry1, Geometry2, geographic_tag, geographic_tag>
0067 {
0068     using type = strategies::discrete_distance::geographic<>;
0069 };
0070 
0071 
0072 template <typename FP, typename S, typename CT>
0073 struct strategy_converter<strategy::distance::geographic<FP, S, CT> >
0074 {
0075     static auto get(strategy::distance::geographic<FP, S, CT> const& s)
0076     {
0077         return strategies::discrete_distance::geographic<FP, S, CT>(s.model());
0078     }
0079 };
0080 // TODO - for backwards compatibility, remove?
0081 template <typename S, typename CT>
0082 struct strategy_converter<strategy::distance::andoyer<S, CT> >
0083 {
0084     static auto get(strategy::distance::andoyer<S, CT> const& s)
0085     {
0086         return strategies::discrete_distance::geographic<strategy::andoyer, S, CT>(s.model());
0087     }
0088 };
0089 // TODO - for backwards compatibility, remove?
0090 template <typename S, typename CT>
0091 struct strategy_converter<strategy::distance::thomas<S, CT> >
0092 {
0093     static auto get(strategy::distance::thomas<S, CT> const& s)
0094     {
0095         return strategies::discrete_distance::geographic<strategy::thomas, S, CT>(s.model());
0096     }
0097 };
0098 // TODO - for backwards compatibility, remove?
0099 template <typename S, typename CT>
0100 struct strategy_converter<strategy::distance::vincenty<S, CT> >
0101 {
0102     static auto get(strategy::distance::vincenty<S, CT> const& s)
0103     {
0104         return strategies::discrete_distance::geographic<strategy::vincenty, S, CT>(s.model());
0105     }
0106 };
0107 
0108 
0109 } // namespace services
0110 
0111 }} // namespace strategies::discrete_distance
0112 
0113 }} // namespace boost::geometry
0114 
0115 #endif // BOOST_GEOMETRY_STRATEGIES_DISCRETE_DISTANCE_GEOGRAPHIC_HPP