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_GOODE_HPP
0041 #define BOOST_GEOMETRY_PROJECTIONS_GOODE_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/proj/gn_sinu.hpp>
0048 #include <boost/geometry/srs/projections/proj/moll.hpp>
0049
0050 namespace boost { namespace geometry
0051 {
0052
0053 namespace projections
0054 {
0055 #ifndef DOXYGEN_NO_DETAIL
0056 namespace detail { namespace goode
0057 {
0058
0059 static const double Y_COR = 0.05280;
0060 static const double PHI_LIM = .71093078197902358062;
0061
0062
0063
0064
0065 template <typename T, typename Par>
0066 struct par_goode
0067 {
0068 sinu_spheroid<T, Par> sinu;
0069 moll_spheroid<T, Par> moll;
0070
0071
0072
0073
0074
0075
0076
0077
0078 template <typename Params>
0079 par_goode(Params const& params, Par & par)
0080 : sinu(params, par)
0081 , moll(params, par)
0082 {}
0083 };
0084
0085 template <typename T, typename Par>
0086 inline void s_forward(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y,
0087 Par const& par, par_goode<T, Par> const& proj_par)
0088 {
0089 if (fabs(lp_lat) <= PHI_LIM)
0090 proj_par.sinu.fwd(par, lp_lon, lp_lat, xy_x, xy_y);
0091 else {
0092 proj_par.moll.fwd(par, lp_lon, lp_lat, xy_x, xy_y);
0093 xy_y -= lp_lat >= 0.0 ? Y_COR : -Y_COR;
0094 }
0095 }
0096
0097 template <typename T, typename Par>
0098 inline void s_inverse(T const& xy_x, T xy_y, T& lp_lon, T& lp_lat,
0099 Par const& par, par_goode<T, Par> const& proj_par)
0100 {
0101 if (fabs(xy_y) <= PHI_LIM)
0102 proj_par.sinu.inv(par, xy_x, xy_y, lp_lon, lp_lat);
0103 else {
0104 xy_y += xy_y >= 0.0 ? Y_COR : -Y_COR;
0105 proj_par.moll.inv(par, xy_x, xy_y, lp_lon, lp_lat);
0106 }
0107 }
0108
0109
0110 template <typename Par>
0111 inline Par& setup_goode(Par& par)
0112 {
0113 par.es = 0.;
0114
0115
0116
0117
0118
0119
0120
0121
0122 return par;
0123 }
0124
0125 }}
0126 #endif
0127
0128
0129
0130
0131
0132
0133
0134
0135
0136
0137
0138
0139
0140 template <typename T, typename Parameters>
0141 struct goode_spheroid
0142 {
0143 detail::goode::par_goode<T, Parameters> m_proj_parm;
0144
0145 template <typename Params>
0146 inline goode_spheroid(Params const& params, Parameters & par)
0147 : m_proj_parm(params, detail::goode::setup_goode(par))
0148 {}
0149
0150
0151
0152 inline void fwd(Parameters const& par, T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
0153 {
0154 detail::goode::s_forward(lp_lon, lp_lat, xy_x, xy_y, par, this->m_proj_parm);
0155 }
0156
0157
0158
0159 inline void inv(Parameters const& par, T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
0160 {
0161 detail::goode::s_inverse(xy_x, xy_y, lp_lon, lp_lat, par, this->m_proj_parm);
0162 }
0163
0164 static inline std::string get_name()
0165 {
0166 return "goode_spheroid";
0167 }
0168 };
0169
0170 #ifndef DOXYGEN_NO_DETAIL
0171 namespace detail
0172 {
0173
0174
0175 BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_FI(srs::spar::proj_goode, goode_spheroid)
0176
0177
0178 BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(goode_entry, goode_spheroid)
0179
0180 BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(goode_init)
0181 {
0182 BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(goode, goode_entry);
0183 }
0184
0185 }
0186 #endif
0187
0188 }
0189
0190 }}
0191
0192 #endif
0193