123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193 |
- #ifndef BOOST_GEOMETRY_PROJECTIONS_GOODE_HPP
- #define BOOST_GEOMETRY_PROJECTIONS_GOODE_HPP
- #include <boost/geometry/srs/projections/impl/base_static.hpp>
- #include <boost/geometry/srs/projections/impl/base_dynamic.hpp>
- #include <boost/geometry/srs/projections/impl/projects.hpp>
- #include <boost/geometry/srs/projections/impl/factory_entry.hpp>
- #include <boost/geometry/srs/projections/proj/gn_sinu.hpp>
- #include <boost/geometry/srs/projections/proj/moll.hpp>
- namespace boost { namespace geometry
- {
- namespace projections
- {
- #ifndef DOXYGEN_NO_DETAIL
- namespace detail { namespace goode
- {
- static const double Y_COR = 0.05280;
- static const double PHI_LIM = .71093078197902358062;
-
-
- template <typename T, typename Par>
- struct par_goode
- {
- sinu_spheroid<T, Par> sinu;
- moll_spheroid<T, Par> moll;
-
-
-
-
-
-
- template <typename Params>
- par_goode(Params const& params, Par & par)
- : sinu(params, par)
- , moll(params, par)
- {}
- };
- template <typename T, typename Par>
- inline void s_forward(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y,
- Par const& par, par_goode<T, Par> const& proj_par)
- {
- if (fabs(lp_lat) <= PHI_LIM)
- proj_par.sinu.fwd(par, lp_lon, lp_lat, xy_x, xy_y);
- else {
- proj_par.moll.fwd(par, lp_lon, lp_lat, xy_x, xy_y);
- xy_y -= lp_lat >= 0.0 ? Y_COR : -Y_COR;
- }
- }
- template <typename T, typename Par>
- inline void s_inverse(T const& xy_x, T xy_y, T& lp_lon, T& lp_lat,
- Par const& par, par_goode<T, Par> const& proj_par)
- {
- if (fabs(xy_y) <= PHI_LIM)
- proj_par.sinu.inv(par, xy_x, xy_y, lp_lon, lp_lat);
- else {
- xy_y += xy_y >= 0.0 ? Y_COR : -Y_COR;
- proj_par.moll.inv(par, xy_x, xy_y, lp_lon, lp_lat);
- }
- }
-
- template <typename Par>
- inline Par& setup_goode(Par& par)
- {
- par.es = 0.;
-
-
-
-
-
- return par;
- }
- }}
- #endif
-
- template <typename T, typename Parameters>
- struct goode_spheroid
- {
- detail::goode::par_goode<T, Parameters> m_proj_parm;
- template <typename Params>
- inline goode_spheroid(Params const& params, Parameters & par)
- : m_proj_parm(params, detail::goode::setup_goode(par))
- {}
-
-
- inline void fwd(Parameters const& par, T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
- {
- detail::goode::s_forward(lp_lon, lp_lat, xy_x, xy_y, par, this->m_proj_parm);
- }
-
-
- inline void inv(Parameters const& par, T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
- {
- detail::goode::s_inverse(xy_x, xy_y, lp_lon, lp_lat, par, this->m_proj_parm);
- }
- static inline std::string get_name()
- {
- return "goode_spheroid";
- }
- };
- #ifndef DOXYGEN_NO_DETAIL
- namespace detail
- {
-
- BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_FI(srs::spar::proj_goode, goode_spheroid)
-
- BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(goode_entry, goode_spheroid)
- BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(goode_init)
- {
- BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(goode, goode_entry);
- }
- }
- #endif
- }
- }}
- #endif
|