File indexing completed on 2025-01-18 09:35:46
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040 #ifndef BOOST_GEOMETRY_PROJECTIONS_STS_HPP
0041 #define BOOST_GEOMETRY_PROJECTIONS_STS_HPP
0042
0043 #include <boost/geometry/srs/projections/impl/base_static.hpp>
0044 #include <boost/geometry/srs/projections/impl/base_dynamic.hpp>
0045 #include <boost/geometry/srs/projections/impl/projects.hpp>
0046 #include <boost/geometry/srs/projections/impl/factory_entry.hpp>
0047 #include <boost/geometry/srs/projections/impl/aasincos.hpp>
0048
0049 namespace boost { namespace geometry
0050 {
0051
0052 namespace projections
0053 {
0054 #ifndef DOXYGEN_NO_DETAIL
0055 namespace detail { namespace sts
0056 {
0057 template <typename T>
0058 struct par_sts
0059 {
0060 T C_x, C_y, C_p;
0061 bool tan_mode;
0062 };
0063
0064 template <typename T, typename Parameters>
0065 struct base_sts_spheroid
0066 {
0067 par_sts<T> m_proj_parm;
0068
0069
0070
0071 inline void fwd(Parameters const& , T const& lp_lon, T lp_lat, T& xy_x, T& xy_y) const
0072 {
0073 T c;
0074
0075 xy_x = this->m_proj_parm.C_x * lp_lon * cos(lp_lat);
0076 xy_y = this->m_proj_parm.C_y;
0077 lp_lat *= this->m_proj_parm.C_p;
0078 c = cos(lp_lat);
0079 if (this->m_proj_parm.tan_mode) {
0080 xy_x *= c * c;
0081 xy_y *= tan(lp_lat);
0082 } else {
0083 xy_x /= c;
0084 xy_y *= sin(lp_lat);
0085 }
0086 }
0087
0088
0089
0090 inline void inv(Parameters const& , T const& xy_x, T xy_y, T& lp_lon, T& lp_lat) const
0091 {
0092 T c;
0093
0094 xy_y /= this->m_proj_parm.C_y;
0095 c = cos(lp_lat = this->m_proj_parm.tan_mode ? atan(xy_y) : aasin(xy_y));
0096 lp_lat /= this->m_proj_parm.C_p;
0097 lp_lon = xy_x / (this->m_proj_parm.C_x * cos(lp_lat));
0098 if (this->m_proj_parm.tan_mode)
0099 lp_lon /= c * c;
0100 else
0101 lp_lon *= c;
0102 }
0103
0104 static inline std::string get_name()
0105 {
0106 return "sts_spheroid";
0107 }
0108
0109 };
0110
0111 template <typename Parameters, typename T>
0112 inline void setup(Parameters& par, par_sts<T>& proj_parm, T const& p, T const& q, bool mode)
0113 {
0114 par.es = 0.;
0115 proj_parm.C_x = q / p;
0116 proj_parm.C_y = p;
0117 proj_parm.C_p = 1/ q;
0118 proj_parm.tan_mode = mode;
0119 }
0120
0121
0122
0123 template <typename Parameters, typename T>
0124 inline void setup_fouc(Parameters& par, par_sts<T>& proj_parm)
0125 {
0126 setup(par, proj_parm, 2., 2., true);
0127 }
0128
0129
0130 template <typename Parameters, typename T>
0131 inline void setup_kav5(Parameters& par, par_sts<T>& proj_parm)
0132 {
0133 setup(par, proj_parm, 1.50488, 1.35439, false);
0134 }
0135
0136
0137 template <typename Parameters, typename T>
0138 inline void setup_qua_aut(Parameters& par, par_sts<T>& proj_parm)
0139 {
0140 setup(par, proj_parm, 2., 2., false);
0141 }
0142
0143
0144 template <typename Parameters, typename T>
0145 inline void setup_mbt_s(Parameters& par, par_sts<T>& proj_parm)
0146 {
0147 setup(par, proj_parm, 1.48875, 1.36509, false);
0148 }
0149
0150 }}
0151 #endif
0152
0153
0154
0155
0156
0157
0158
0159
0160
0161
0162
0163
0164
0165 template <typename T, typename Parameters>
0166 struct kav5_spheroid : public detail::sts::base_sts_spheroid<T, Parameters>
0167 {
0168 template <typename Params>
0169 inline kav5_spheroid(Params const& , Parameters & par)
0170 {
0171 detail::sts::setup_kav5(par, this->m_proj_parm);
0172 }
0173 };
0174
0175
0176
0177
0178
0179
0180
0181
0182
0183
0184
0185
0186
0187 template <typename T, typename Parameters>
0188 struct qua_aut_spheroid : public detail::sts::base_sts_spheroid<T, Parameters>
0189 {
0190 template <typename Params>
0191 inline qua_aut_spheroid(Params const& , Parameters & par)
0192 {
0193 detail::sts::setup_qua_aut(par, this->m_proj_parm);
0194 }
0195 };
0196
0197
0198
0199
0200
0201
0202
0203
0204
0205
0206
0207
0208
0209 template <typename T, typename Parameters>
0210 struct mbt_s_spheroid : public detail::sts::base_sts_spheroid<T, Parameters>
0211 {
0212 template <typename Params>
0213 inline mbt_s_spheroid(Params const& , Parameters & par)
0214 {
0215 detail::sts::setup_mbt_s(par, this->m_proj_parm);
0216 }
0217 };
0218
0219
0220
0221
0222
0223
0224
0225
0226
0227
0228
0229
0230
0231 template <typename T, typename Parameters>
0232 struct fouc_spheroid : public detail::sts::base_sts_spheroid<T, Parameters>
0233 {
0234 template <typename Params>
0235 inline fouc_spheroid(Params const& , Parameters & par)
0236 {
0237 detail::sts::setup_fouc(par, this->m_proj_parm);
0238 }
0239 };
0240
0241 #ifndef DOXYGEN_NO_DETAIL
0242 namespace detail
0243 {
0244
0245
0246 BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_FI(srs::spar::proj_kav5, kav5_spheroid)
0247 BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_FI(srs::spar::proj_qua_aut, qua_aut_spheroid)
0248 BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_FI(srs::spar::proj_mbt_s, mbt_s_spheroid)
0249 BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_FI(srs::spar::proj_fouc, fouc_spheroid)
0250
0251
0252 BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(kav5_entry, kav5_spheroid)
0253 BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(qua_aut_entry, qua_aut_spheroid)
0254 BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(mbt_s_entry, mbt_s_spheroid)
0255 BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(fouc_entry, fouc_spheroid)
0256
0257 BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(sts_init)
0258 {
0259 BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(kav5, kav5_entry)
0260 BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(qua_aut, qua_aut_entry)
0261 BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(mbt_s, mbt_s_entry)
0262 BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(fouc, fouc_entry)
0263 }
0264
0265 }
0266 #endif
0267
0268 }
0269
0270 }}
0271
0272 #endif
0273