File indexing completed on 2025-01-18 09:36:48
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #ifndef BOOST_GEOMETRY_STRATEGIES_SIMPLIFY_GEOGRAPHIC_HPP
0011 #define BOOST_GEOMETRY_STRATEGIES_SIMPLIFY_GEOGRAPHIC_HPP
0012
0013
0014 #include <boost/geometry/strategies/detail.hpp>
0015 #include <boost/geometry/strategies/distance/detail.hpp>
0016 #include <boost/geometry/strategies/simplify/services.hpp>
0017
0018 #include <boost/geometry/strategies/agnostic/simplify_douglas_peucker.hpp>
0019 #include <boost/geometry/strategies/geographic/distance_cross_track.hpp>
0020 #include <boost/geometry/strategies/spherical/point_in_point.hpp>
0021
0022 #include <boost/geometry/strategy/geographic/area.hpp>
0023
0024
0025 namespace boost { namespace geometry
0026 {
0027
0028 namespace strategies { namespace simplify
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
0050 template <typename Geometry>
0051 auto area(Geometry const&) const
0052 {
0053 return strategy::area::geographic
0054 <
0055 FormulaPolicy,
0056 strategy::default_order<FormulaPolicy>::value,
0057 Spheroid,
0058 CalculationType
0059 >(base_t::m_spheroid);
0060 }
0061
0062
0063 template <typename Geometry1, typename Geometry2>
0064 auto distance(Geometry1 const&, Geometry2 const&,
0065 distance::detail::enable_if_pp_t<Geometry1, Geometry2> * = nullptr) const
0066 {
0067 return strategy::distance::geographic
0068 <
0069 FormulaPolicy, Spheroid, CalculationType
0070 >(base_t::m_spheroid);
0071 }
0072
0073
0074 template <typename Geometry1, typename Geometry2>
0075 auto distance(Geometry1 const&, Geometry2 const&,
0076 distance::detail::enable_if_ps_t<Geometry1, Geometry2> * = nullptr) const
0077 {
0078 return strategy::distance::geographic_cross_track
0079 <
0080 FormulaPolicy, Spheroid, CalculationType
0081 >(base_t::m_spheroid);
0082 }
0083
0084
0085 template <typename Geometry1, typename Geometry2>
0086 static auto relate(Geometry1 const&, Geometry2 const&,
0087 std::enable_if_t
0088 <
0089 util::is_pointlike<Geometry1>::value
0090 && util::is_pointlike<Geometry2>::value
0091 > * = nullptr)
0092 {
0093 return strategy::within::spherical_point_point();
0094 }
0095 };
0096
0097
0098 namespace services
0099 {
0100
0101 template <typename Geometry>
0102 struct default_strategy<Geometry, geographic_tag>
0103 {
0104 using type = strategies::simplify::geographic<>;
0105 };
0106
0107
0108 template <typename P, typename FP, typename S, typename CT>
0109 struct strategy_converter
0110 <
0111 strategy::simplify::douglas_peucker
0112 <
0113 P,
0114 strategy::distance::geographic_cross_track<FP, S, CT>
0115 >
0116 >
0117 {
0118 template <typename Strategy>
0119 static auto get(Strategy const& )
0120 {
0121 return strategies::simplify::geographic<FP, S, CT>();
0122 }
0123 };
0124
0125
0126 }
0127
0128 }}
0129
0130 }}
0131
0132 #endif