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_URMFPS_HPP
0041 #define BOOST_GEOMETRY_PROJECTIONS_URMFPS_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 urmfps
0057 {
0058
0059 static const double C_x = 0.8773826753;
0060 static const double Cy = 1.139753528477;
0061
0062 template <typename T>
0063 struct par_urmfps
0064 {
0065 T n, C_y;
0066 };
0067
0068 template <typename T, typename Parameters>
0069 struct base_urmfps_spheroid
0070 {
0071 par_urmfps<T> m_proj_parm;
0072
0073
0074
0075 inline void fwd(Parameters const& , T const& lp_lon, T lp_lat, T& xy_x, T& xy_y) const
0076 {
0077 lp_lat = aasin(this->m_proj_parm.n * sin(lp_lat));
0078 xy_x = C_x * lp_lon * cos(lp_lat);
0079 xy_y = this->m_proj_parm.C_y * lp_lat;
0080 }
0081
0082
0083
0084 inline void inv(Parameters const& , T const& xy_x, T xy_y, T& lp_lon, T& lp_lat) const
0085 {
0086 xy_y /= this->m_proj_parm.C_y;
0087 lp_lat = aasin(sin(xy_y) / this->m_proj_parm.n);
0088 lp_lon = xy_x / (C_x * cos(xy_y));
0089 }
0090
0091 static inline std::string get_name()
0092 {
0093 return "urmfps_spheroid";
0094 }
0095
0096 };
0097
0098 template <typename Parameters, typename T>
0099 inline void setup(Parameters& par, par_urmfps<T>& proj_parm)
0100 {
0101 proj_parm.C_y = Cy / proj_parm.n;
0102 par.es = 0.;
0103 }
0104
0105
0106
0107 template <typename Params, typename Parameters, typename T>
0108 inline void setup_urmfps(Params const& params, Parameters& par, par_urmfps<T>& proj_parm)
0109 {
0110 if (pj_param_f<srs::spar::n>(params, "n", srs::dpar::n, proj_parm.n)) {
0111 if (proj_parm.n <= 0. || proj_parm.n > 1.)
0112 BOOST_THROW_EXCEPTION( projection_exception(error_n_out_of_range) );
0113 } else
0114 BOOST_THROW_EXCEPTION( projection_exception(error_n_out_of_range) );
0115
0116 setup(par, proj_parm);
0117 }
0118
0119
0120 template <typename Parameters, typename T>
0121 inline void setup_wag1(Parameters& par, par_urmfps<T>& proj_parm)
0122 {
0123 proj_parm.n = 0.8660254037844386467637231707;
0124 setup(par, proj_parm);
0125 }
0126
0127 }}
0128 #endif
0129
0130
0131
0132
0133
0134
0135
0136
0137
0138
0139
0140
0141
0142
0143
0144 template <typename T, typename Parameters>
0145 struct urmfps_spheroid : public detail::urmfps::base_urmfps_spheroid<T, Parameters>
0146 {
0147 template <typename Params>
0148 inline urmfps_spheroid(Params const& params, Parameters & par)
0149 {
0150 detail::urmfps::setup_urmfps(params, par, this->m_proj_parm);
0151 }
0152 };
0153
0154
0155
0156
0157
0158
0159
0160
0161
0162
0163
0164
0165
0166 template <typename T, typename Parameters>
0167 struct wag1_spheroid : public detail::urmfps::base_urmfps_spheroid<T, Parameters>
0168 {
0169 template <typename Params>
0170 inline wag1_spheroid(Params const& , Parameters & par)
0171 {
0172 detail::urmfps::setup_wag1(par, this->m_proj_parm);
0173 }
0174 };
0175
0176 #ifndef DOXYGEN_NO_DETAIL
0177 namespace detail
0178 {
0179
0180
0181 BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_FI(srs::spar::proj_urmfps, urmfps_spheroid)
0182 BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_FI(srs::spar::proj_wag1, wag1_spheroid)
0183
0184
0185 BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(urmfps_entry, urmfps_spheroid)
0186 BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(wag1_entry, wag1_spheroid)
0187
0188 BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(urmfps_init)
0189 {
0190 BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(urmfps, urmfps_entry)
0191 BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(wag1, wag1_entry)
0192 }
0193
0194 }
0195 #endif
0196
0197 }
0198
0199 }}
0200
0201 #endif
0202