File indexing completed on 2025-01-18 09:35:42
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_GSTMERC_HPP
0041 #define BOOST_GEOMETRY_PROJECTIONS_GSTMERC_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/pj_phi2.hpp>
0048 #include <boost/geometry/srs/projections/impl/pj_tsfn.hpp>
0049
0050 namespace boost { namespace geometry
0051 {
0052
0053 namespace projections
0054 {
0055 #ifndef DOXYGEN_NO_DETAIL
0056 namespace detail { namespace gstmerc
0057 {
0058 template <typename T>
0059 struct par_gstmerc
0060 {
0061 T lamc;
0062 T phic;
0063 T c;
0064 T n1;
0065 T n2;
0066 T XS;
0067 T YS;
0068 };
0069
0070 template <typename T, typename Parameters>
0071 struct base_gstmerc_spheroid
0072 {
0073 par_gstmerc<T> m_proj_parm;
0074
0075
0076
0077 inline void fwd(Parameters const& par, T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
0078 {
0079 T L, Ls, sinLs1, Ls1;
0080
0081 L= this->m_proj_parm.n1*lp_lon;
0082 Ls= this->m_proj_parm.c+this->m_proj_parm.n1*log(pj_tsfn(-1.0*lp_lat,-1.0*sin(lp_lat), par.e));
0083 sinLs1= sin(L)/cosh(Ls);
0084 Ls1= log(pj_tsfn(-1.0*asin(sinLs1),0.0,0.0));
0085 xy_x= (this->m_proj_parm.XS + this->m_proj_parm.n2*Ls1) * par.ra;
0086 xy_y= (this->m_proj_parm.YS + this->m_proj_parm.n2*atan(sinh(Ls)/cos(L))) * par.ra;
0087 }
0088
0089
0090
0091 inline void inv(Parameters const& par, T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
0092 {
0093 T L, LC, sinC;
0094
0095 L= atan(sinh((xy_x * par.a - this->m_proj_parm.XS)/this->m_proj_parm.n2)/cos((xy_y * par.a - this->m_proj_parm.YS)/this->m_proj_parm.n2));
0096 sinC= sin((xy_y * par.a - this->m_proj_parm.YS)/this->m_proj_parm.n2)/cosh((xy_x * par.a - this->m_proj_parm.XS)/this->m_proj_parm.n2);
0097 LC= log(pj_tsfn(-1.0*asin(sinC),0.0,0.0));
0098 lp_lon= L/this->m_proj_parm.n1;
0099 lp_lat= -1.0*pj_phi2(exp((LC-this->m_proj_parm.c)/this->m_proj_parm.n1), par.e);
0100 }
0101
0102 static inline std::string get_name()
0103 {
0104 return "gstmerc_spheroid";
0105 }
0106
0107 };
0108
0109
0110 template <typename Parameters, typename T>
0111 inline void setup_gstmerc(Parameters const& par, par_gstmerc<T>& proj_parm)
0112 {
0113 proj_parm.lamc= par.lam0;
0114 proj_parm.n1= sqrt(T(1)+par.es*math::pow(cos(par.phi0),4)/(T(1)-par.es));
0115 proj_parm.phic= asin(sin(par.phi0)/proj_parm.n1);
0116 proj_parm.c= log(pj_tsfn(-1.0*proj_parm.phic,0.0,0.0))
0117 - proj_parm.n1*log(pj_tsfn(-1.0*par.phi0,-1.0*sin(par.phi0),par.e));
0118 proj_parm.n2= par.k0*par.a*sqrt(1.0-par.es)/(1.0-par.es*sin(par.phi0)*sin(par.phi0));
0119 proj_parm.XS= 0;
0120 proj_parm.YS= -1.0*proj_parm.n2*proj_parm.phic;
0121 }
0122
0123 }}
0124 #endif
0125
0126
0127
0128
0129
0130
0131
0132
0133
0134
0135
0136
0137
0138
0139
0140
0141
0142
0143 template <typename T, typename Parameters>
0144 struct gstmerc_spheroid : public detail::gstmerc::base_gstmerc_spheroid<T, Parameters>
0145 {
0146 template <typename Params>
0147 inline gstmerc_spheroid(Params const& , Parameters const& par)
0148 {
0149 detail::gstmerc::setup_gstmerc(par, this->m_proj_parm);
0150 }
0151 };
0152
0153 #ifndef DOXYGEN_NO_DETAIL
0154 namespace detail
0155 {
0156
0157
0158 BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_FI(srs::spar::proj_gstmerc, gstmerc_spheroid)
0159
0160
0161 BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(gstmerc_entry, gstmerc_spheroid)
0162
0163 BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(gstmerc_init)
0164 {
0165 BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(gstmerc, gstmerc_entry);
0166 }
0167
0168 }
0169 #endif
0170
0171 }
0172
0173 }}
0174
0175 #endif
0176