File indexing completed on 2025-07-14 08:33:08
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #ifndef BOOST_GEOMETRY_STRATEGIES_DETAIL_HPP
0011 #define BOOST_GEOMETRY_STRATEGIES_DETAIL_HPP
0012
0013
0014 #include <boost/geometry/core/cs.hpp>
0015 #include <boost/geometry/strategies/geographic/parameters.hpp>
0016 #include <boost/geometry/strategies/spherical/get_radius.hpp>
0017 #include <boost/geometry/srs/sphere.hpp>
0018 #include <boost/geometry/srs/spheroid.hpp>
0019 #include <boost/geometry/util/type_traits.hpp>
0020
0021
0022 namespace boost { namespace geometry
0023 {
0024
0025
0026 namespace strategies
0027 {
0028
0029
0030 #ifndef DOXYGEN_NO_DETAIL
0031 namespace detail
0032 {
0033
0034
0035 struct umbrella_strategy {};
0036
0037
0038 struct not_implemented {};
0039
0040
0041 template <typename Strategy>
0042 struct is_umbrella_strategy
0043 {
0044 static const bool value = std::is_base_of<umbrella_strategy, Strategy>::value;
0045 };
0046
0047
0048 struct cartesian_base : umbrella_strategy
0049 {
0050 typedef cartesian_tag cs_tag;
0051 };
0052
0053 template <typename RadiusTypeOrSphere>
0054 class spherical_base : umbrella_strategy
0055 {
0056 protected:
0057 typedef typename strategy_detail::get_radius
0058 <
0059 RadiusTypeOrSphere
0060 >::type radius_type;
0061
0062 public:
0063 typedef spherical_tag cs_tag;
0064
0065 spherical_base()
0066 : m_radius(1.0)
0067 {}
0068
0069 template <typename RadiusOrSphere>
0070 explicit spherical_base(RadiusOrSphere const& radius_or_sphere)
0071 : m_radius(strategy_detail::get_radius
0072 <
0073 RadiusOrSphere
0074 >::apply(radius_or_sphere))
0075 {}
0076
0077 srs::sphere<radius_type> model() const
0078 {
0079 return srs::sphere<radius_type>(m_radius);
0080 }
0081
0082 protected:
0083 radius_type const& radius() const
0084 {
0085 return m_radius;
0086 }
0087
0088 radius_type m_radius;
0089 };
0090
0091 template <>
0092 class spherical_base<void> : umbrella_strategy
0093 {
0094 protected:
0095 typedef double radius_type;
0096
0097 public:
0098 typedef spherical_tag cs_tag;
0099
0100 srs::sphere<radius_type> model() const
0101 {
0102 return srs::sphere<radius_type>(1.0);
0103 }
0104
0105 protected:
0106 radius_type radius() const
0107 {
0108 return 1.0;
0109 }
0110 };
0111
0112 template <typename Spheroid>
0113 class geographic_base : umbrella_strategy
0114 {
0115 public:
0116 typedef geographic_tag cs_tag;
0117
0118 geographic_base()
0119 : m_spheroid()
0120 {}
0121
0122 explicit geographic_base(Spheroid const& spheroid)
0123 : m_spheroid(spheroid)
0124 {}
0125
0126 Spheroid model() const
0127 {
0128 return m_spheroid;
0129 }
0130
0131 protected:
0132 Spheroid m_spheroid;
0133 };
0134
0135
0136 }
0137 #endif
0138
0139
0140 }
0141
0142
0143 }}
0144
0145 #endif