File indexing completed on 2025-01-18 09:36:46
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #ifndef BOOST_GEOMETRY_STRATEGIES_GEOGRAPHIC_LINE_INTERPOLATE_HPP
0012 #define BOOST_GEOMETRY_STRATEGIES_GEOGRAPHIC_LINE_INTERPOLATE_HPP
0013
0014 #include <boost/geometry/core/assert.hpp>
0015 #include <boost/geometry/core/coordinate_dimension.hpp>
0016 #include <boost/geometry/core/coordinate_type.hpp>
0017 #include <boost/geometry/core/radian_access.hpp>
0018 #include <boost/geometry/srs/spheroid.hpp>
0019 #include <boost/geometry/strategies/line_interpolate.hpp>
0020 #include <boost/geometry/strategies/geographic/parameters.hpp>
0021 #include <boost/geometry/util/select_calculation_type.hpp>
0022
0023
0024 namespace boost { namespace geometry
0025 {
0026
0027 namespace strategy { namespace line_interpolate
0028 {
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044 template
0045 <
0046 typename FormulaPolicy = strategy::andoyer,
0047 typename Spheroid = srs::spheroid<double>,
0048 typename CalculationType = void
0049 >
0050 class geographic
0051 {
0052 public:
0053 geographic() = default;
0054
0055 explicit geographic(Spheroid const& spheroid)
0056 : m_spheroid(spheroid)
0057 {}
0058
0059 template <typename Point, typename Fraction, typename Distance>
0060 inline void apply(Point const& p0,
0061 Point const& p1,
0062 Fraction const& fraction,
0063 Point & p,
0064 Distance const& distance) const
0065 {
0066 typedef typename select_calculation_type_alt
0067 <
0068 CalculationType,
0069 Point
0070 >::type calc_t;
0071
0072 typedef typename FormulaPolicy::template inverse
0073 <calc_t, false, true, false, false, false> inverse_t;
0074
0075 calc_t azimuth = inverse_t::apply(get_as_radian<0>(p0), get_as_radian<1>(p0),
0076 get_as_radian<0>(p1), get_as_radian<1>(p1),
0077 m_spheroid).azimuth;
0078
0079 typedef typename FormulaPolicy::template direct
0080 <calc_t, true, false, false, false> direct_t;
0081
0082 typename direct_t::result_type
0083 dir_r = direct_t::apply(get_as_radian<0>(p0), get_as_radian<1>(p0),
0084 distance * fraction, azimuth,
0085 m_spheroid);
0086
0087 set_from_radian<0>(p, dir_r.lon2);
0088 set_from_radian<1>(p, dir_r.lat2);
0089 }
0090
0091 inline Spheroid model() const
0092 {
0093 return m_spheroid;
0094 }
0095
0096 private:
0097 Spheroid m_spheroid;
0098 };
0099
0100
0101 #ifndef DOXYGEN_NO_STRATEGY_SPECIALIZATIONS
0102 namespace services
0103 {
0104
0105 template <>
0106 struct default_strategy<geographic_tag>
0107 {
0108 typedef strategy::line_interpolate::geographic<> type;
0109 };
0110
0111
0112 }
0113 #endif
0114
0115
0116 }}
0117
0118
0119 }}
0120
0121 #endif