File indexing completed on 2025-01-18 09:35:40
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 #ifndef BOOST_GEOMETRY_PROJECTIONS_COL_URBAN_HPP
0039 #define BOOST_GEOMETRY_PROJECTIONS_COL_URBAN_HPP
0040
0041 #include <boost/geometry/util/math.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/pj_param.hpp>
0046 #include <boost/geometry/srs/projections/impl/projects.hpp>
0047 #include <boost/geometry/srs/projections/impl/factory_entry.hpp>
0048
0049 namespace boost { namespace geometry
0050 {
0051
0052 namespace projections
0053 {
0054 #ifndef DOXYGEN_NO_DETAIL
0055 namespace detail { namespace col_urban
0056 {
0057 template <typename T>
0058 struct par_col_urban
0059 {
0060 T h0;
0061 T rho0;
0062 T A;
0063 T B;
0064 T C;
0065 T D;
0066 };
0067
0068 template <typename T, typename Parameters>
0069 struct base_col_urban_spheroid
0070 {
0071 par_col_urban<T> m_proj_parm;
0072
0073
0074
0075 inline void fwd(Parameters const& par, T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
0076 {
0077 const T cosphi = cos(lp_lat);
0078 const T sinphi = sin(lp_lat);
0079 const T nu = 1. / sqrt(1 - par.es * sinphi * sinphi);
0080 const T lam_nu_cosphi = lp_lon * nu * cosphi;
0081 xy_x = this->m_proj_parm.A * lam_nu_cosphi;
0082 const T sinphi_m = sin(0.5 * (lp_lat + par.phi0));
0083 const T rho_m = (1 - par.es) / pow(1 - par.es * sinphi_m * sinphi_m, 1.5);
0084 const T G = 1 + this->m_proj_parm.h0 / rho_m;
0085 xy_y = G * this->m_proj_parm.rho0 * ((lp_lat - par.phi0) + this->m_proj_parm.B * lam_nu_cosphi * lam_nu_cosphi);
0086 }
0087
0088
0089
0090 inline void inv(Parameters const& par, T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
0091 {
0092 lp_lat = par.phi0 + xy_y / this->m_proj_parm.D - this->m_proj_parm.B * (xy_x / this->m_proj_parm.C) * (xy_x / this->m_proj_parm.C);
0093 const double sinphi = sin(lp_lat);
0094 const double nu = 1. / sqrt(1 - par.es * sinphi * sinphi);
0095 lp_lon = xy_x / (this->m_proj_parm.C * nu * cos(lp_lat));
0096
0097 }
0098
0099 static inline std::string get_name()
0100 {
0101 return "col_urban_spheroid";
0102 }
0103
0104 };
0105
0106
0107 template <typename Params, typename Parameters, typename T>
0108 inline void setup(Params const& params, Parameters const& par, par_col_urban<T>& proj_parm)
0109 {
0110 T h0_unscaled;
0111 if ( !pj_param_f<srs::spar::h_0>(params, "h_0", srs::dpar::h_0, h0_unscaled) ){
0112 h0_unscaled = T(0);
0113 }
0114 proj_parm.h0 = h0_unscaled / par.a;
0115 const T sinphi0 = sin(par.phi0);
0116 const T nu0 = 1. / sqrt(1 - par.es * sinphi0 * sinphi0);
0117 proj_parm.A = 1 + proj_parm.h0 / nu0;
0118 proj_parm.rho0 = (1 - par.es) / pow(1 - par.es * sinphi0 * sinphi0, 1.5);
0119 proj_parm.B = tan(par.phi0) / (2 * proj_parm.rho0 * nu0);
0120 proj_parm.C = 1 + proj_parm.h0;
0121 proj_parm.D = proj_parm.rho0 * (1 + proj_parm.h0 / (1 - par.es));
0122 }
0123
0124 }}
0125 #endif
0126
0127
0128
0129
0130
0131
0132
0133
0134 template <typename T, typename Parameters>
0135 struct col_urban_spheroid : public detail::col_urban::base_col_urban_spheroid<T, Parameters>
0136 {
0137 template <typename Params>
0138 inline col_urban_spheroid(Params const& params, Parameters & par)
0139 {
0140 detail::col_urban::setup(params, par, this->m_proj_parm);
0141 }
0142 };
0143
0144 #ifndef DOXYGEN_NO_DETAIL
0145 namespace detail
0146 {
0147
0148
0149 BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_FI(srs::spar::proj_col_urban, col_urban_spheroid)
0150
0151
0152 BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(col_urban_entry, col_urban_spheroid)
0153
0154 BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(col_urban_init)
0155 {
0156 BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(col_urban, col_urban_entry);
0157 }
0158
0159 }
0160 #endif
0161
0162 }
0163
0164 }}
0165
0166 #endif