File indexing completed on 2025-01-18 09:35:47
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_URM5_HPP
0041 #define BOOST_GEOMETRY_PROJECTIONS_URM5_HPP
0042
0043 #include <boost/geometry/srs/projections/impl/aasincos.hpp>
0044 #include <boost/geometry/srs/projections/impl/base_static.hpp>
0045 #include <boost/geometry/srs/projections/impl/base_dynamic.hpp>
0046 #include <boost/geometry/srs/projections/impl/factory_entry.hpp>
0047 #include <boost/geometry/srs/projections/impl/pj_param.hpp>
0048 #include <boost/geometry/srs/projections/impl/projects.hpp>
0049
0050 namespace boost { namespace geometry
0051 {
0052
0053 namespace projections
0054 {
0055 #ifndef DOXYGEN_NO_DETAIL
0056 namespace detail { namespace urm5
0057 {
0058 template <typename T>
0059 struct par_urm5
0060 {
0061 T m, rmn, q3, n;
0062 };
0063
0064 template <typename T, typename Parameters>
0065 struct base_urm5_spheroid
0066 {
0067 par_urm5<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 t;
0074
0075 t = lp_lat = aasin(this->m_proj_parm.n * sin(lp_lat));
0076 xy_x = this->m_proj_parm.m * lp_lon * cos(lp_lat);
0077 t *= t;
0078 xy_y = lp_lat * (1. + t * this->m_proj_parm.q3) * this->m_proj_parm.rmn;
0079 }
0080
0081 static inline std::string get_name()
0082 {
0083 return "urm5_spheroid";
0084 }
0085
0086 };
0087
0088
0089 template <typename Params, typename Parameters, typename T>
0090 inline void setup_urm5(Params const& params, Parameters& par, par_urm5<T>& proj_parm)
0091 {
0092 T alpha, t;
0093
0094 if (pj_param_f<srs::spar::n>(params, "n", srs::dpar::n, proj_parm.n)) {
0095 if (proj_parm.n <= 0. || proj_parm.n > 1.)
0096 BOOST_THROW_EXCEPTION( projection_exception(error_n_out_of_range) );
0097 } else {
0098 BOOST_THROW_EXCEPTION( projection_exception(error_n_out_of_range) );
0099 }
0100 proj_parm.q3 = pj_get_param_f<T, srs::spar::q>(params, "q", srs::dpar::q) / 3.;
0101 alpha = pj_get_param_r<T, srs::spar::alpha>(params, "alpha", srs::dpar::alpha);
0102 t = proj_parm.n * sin(alpha);
0103 proj_parm.m = cos(alpha) / sqrt(1. - t * t);
0104 proj_parm.rmn = 1. / (proj_parm.m * proj_parm.n);
0105
0106 par.es = 0.;
0107 }
0108
0109 }}
0110 #endif
0111
0112
0113
0114
0115
0116
0117
0118
0119
0120
0121
0122
0123
0124
0125
0126
0127
0128
0129 template <typename T, typename Parameters>
0130 struct urm5_spheroid : public detail::urm5::base_urm5_spheroid<T, Parameters>
0131 {
0132 template <typename Params>
0133 inline urm5_spheroid(Params const& params, Parameters & par)
0134 {
0135 detail::urm5::setup_urm5(params, par, this->m_proj_parm);
0136 }
0137 };
0138
0139 #ifndef DOXYGEN_NO_DETAIL
0140 namespace detail
0141 {
0142
0143
0144 BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_F(srs::spar::proj_urm5, urm5_spheroid)
0145
0146
0147 BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_F(urm5_entry, urm5_spheroid)
0148
0149 BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(urm5_init)
0150 {
0151 BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(urm5, urm5_entry)
0152 }
0153
0154 }
0155 #endif
0156
0157 }
0158
0159 }}
0160
0161 #endif
0162