diff options
Diffstat (limited to 'boost/geometry/srs/projections/proj')
98 files changed, 1901 insertions, 3359 deletions
diff --git a/boost/geometry/srs/projections/proj/aea.hpp b/boost/geometry/srs/projections/proj/aea.hpp index 6deb9a8163..42c2cc9aff 100644 --- a/boost/geometry/srs/projections/proj/aea.hpp +++ b/boost/geometry/srs/projections/proj/aea.hpp @@ -57,19 +57,13 @@ #include <boost/geometry/srs/projections/impl/factory_entry.hpp> #include <boost/geometry/srs/projections/impl/pj_mlfn.hpp> #include <boost/geometry/srs/projections/impl/pj_msfn.hpp> +#include <boost/geometry/srs/projections/impl/pj_param.hpp> #include <boost/geometry/srs/projections/impl/pj_qsfn.hpp> namespace boost { namespace geometry { -namespace srs { namespace par4 -{ - struct aea {}; - struct leac {}; - -}} //namespace srs::par4 - namespace projections { #ifndef DOXYGEN_NO_DETAIL @@ -134,7 +128,7 @@ namespace projections // FORWARD(e_forward) ellipsoid & spheroid // Project coordinates from geographic (lon, lat) to cartesian (x, y) - inline void fwd(T& lp_lon, T& lp_lat, T& xy_x, T& xy_y) const + inline void fwd(T lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const { T rho = this->m_proj_parm.c - (this->m_proj_parm.ellips ? this->m_proj_parm.n * pj_qsfn(sin(lp_lat), this->m_par.e, this->m_par.one_es) @@ -148,7 +142,7 @@ namespace projections // INVERSE(e_inverse) ellipsoid & spheroid // Project coordinates from cartesian (x, y) to geographic (lon, lat) - inline void inv(T& xy_x, T& xy_y, T& lp_lon, T& lp_lat) const + inline void inv(T xy_x, T xy_y, T& lp_lon, T& lp_lat) const { static const T half_pi = detail::half_pi<T>(); @@ -186,7 +180,7 @@ namespace projections }; template <typename Parameters, typename T> - inline void setup(Parameters& par, par_aea<T>& proj_parm) + inline void setup(Parameters const& par, par_aea<T>& proj_parm) { T cosphi, sinphi; int secant; @@ -231,22 +225,36 @@ namespace projections // Albers Equal Area - template <typename Parameters, typename T> - inline void setup_aea(Parameters& par, par_aea<T>& proj_parm) + template <typename Params, typename Parameters, typename T> + inline void setup_aea(Params const& params, Parameters const& par, par_aea<T>& proj_parm) { - proj_parm.phi1 = pj_get_param_r(par.params, "lat_1"); - proj_parm.phi2 = pj_get_param_r(par.params, "lat_2"); + proj_parm.phi1 = 0.0; + proj_parm.phi2 = 0.0; + bool is_phi1_set = pj_param_r<srs::spar::lat_1>(params, "lat_1", srs::dpar::lat_1, proj_parm.phi1); + bool is_phi2_set = pj_param_r<srs::spar::lat_2>(params, "lat_2", srs::dpar::lat_2, proj_parm.phi2); + + // Boost.Geometry specific, set default parameters manually + if (! is_phi1_set || ! is_phi2_set) { + bool const use_defaults = ! pj_get_param_b<srs::spar::no_defs>(params, "no_defs", srs::dpar::no_defs); + if (use_defaults) { + if (!is_phi1_set) + proj_parm.phi1 = 29.5; + if (!is_phi2_set) + proj_parm.phi2 = 45.5; + } + } + setup(par, proj_parm); } // Lambert Equal Area Conic - template <typename Parameters, typename T> - inline void setup_leac(Parameters& par, par_aea<T>& proj_parm) + template <typename Params, typename Parameters, typename T> + inline void setup_leac(Params const& params, Parameters const& par, par_aea<T>& proj_parm) { static const T half_pi = detail::half_pi<T>(); - proj_parm.phi2 = pj_get_param_r(par.params, "lat_1"); - proj_parm.phi1 = pj_get_param_b(par.params, "south") ? -half_pi : half_pi; + proj_parm.phi2 = pj_get_param_r<T, srs::spar::lat_1>(params, "lat_1", srs::dpar::lat_1); + proj_parm.phi1 = pj_get_param_b<srs::spar::south>(params, "south", srs::dpar::south) ? -half_pi : half_pi; setup(par, proj_parm); } @@ -272,9 +280,11 @@ namespace projections template <typename T, typename Parameters> struct aea_ellipsoid : public detail::aea::base_aea_ellipsoid<T, Parameters> { - inline aea_ellipsoid(const Parameters& par) : detail::aea::base_aea_ellipsoid<T, Parameters>(par) + template <typename Params> + inline aea_ellipsoid(Params const& params, Parameters const& par) + : detail::aea::base_aea_ellipsoid<T, Parameters>(par) { - detail::aea::setup_aea(this->m_par, this->m_proj_parm); + detail::aea::setup_aea(params, this->m_par, this->m_proj_parm); } }; @@ -297,9 +307,11 @@ namespace projections template <typename T, typename Parameters> struct leac_ellipsoid : public detail::aea::base_aea_ellipsoid<T, Parameters> { - inline leac_ellipsoid(const Parameters& par) : detail::aea::base_aea_ellipsoid<T, Parameters>(par) + template <typename Params> + inline leac_ellipsoid(Params const& params, Parameters const& par) + : detail::aea::base_aea_ellipsoid<T, Parameters>(par) { - detail::aea::setup_leac(this->m_par, this->m_proj_parm); + detail::aea::setup_leac(params, this->m_par, this->m_proj_parm); } }; @@ -308,35 +320,17 @@ namespace projections { // Static projection - BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::par4::aea, aea_ellipsoid, aea_ellipsoid) - BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::par4::leac, leac_ellipsoid, leac_ellipsoid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_aea, aea_ellipsoid, aea_ellipsoid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_leac, leac_ellipsoid, leac_ellipsoid) // Factory entry(s) - template <typename T, typename Parameters> - class aea_entry : public detail::factory_entry<T, Parameters> - { - public : - virtual base_v<T, Parameters>* create_new(const Parameters& par) const - { - return new base_v_fi<aea_ellipsoid<T, Parameters>, T, Parameters>(par); - } - }; - - template <typename T, typename Parameters> - class leac_entry : public detail::factory_entry<T, Parameters> - { - public : - virtual base_v<T, Parameters>* create_new(const Parameters& par) const - { - return new base_v_fi<leac_ellipsoid<T, Parameters>, T, Parameters>(par); - } - }; + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(aea_entry, aea_ellipsoid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(leac_entry, leac_ellipsoid) - template <typename T, typename Parameters> - inline void aea_init(detail::base_factory<T, Parameters>& factory) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(aea_init) { - factory.add_to_factory("aea", new aea_entry<T, Parameters>); - factory.add_to_factory("leac", new leac_entry<T, Parameters>); + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(aea, aea_entry) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(leac, leac_entry) } } // namespace detail diff --git a/boost/geometry/srs/projections/proj/aeqd.hpp b/boost/geometry/srs/projections/proj/aeqd.hpp index cfc6860797..b45146eac4 100644 --- a/boost/geometry/srs/projections/proj/aeqd.hpp +++ b/boost/geometry/srs/projections/proj/aeqd.hpp @@ -57,20 +57,11 @@ #include <boost/geometry/srs/projections/impl/aasincos.hpp> #include <boost/geometry/srs/projections/impl/pj_mlfn.hpp> -#include <boost/geometry/srs/projections/par4.hpp> - #include <boost/type_traits/is_same.hpp> namespace boost { namespace geometry { -namespace srs { namespace par4 -{ - struct aeqd {}; - //struct aeqd_guam {}; - -}} //namespace srs::par4 - namespace projections { #ifndef DOXYGEN_NO_DETAIL @@ -102,7 +93,7 @@ namespace projections }; template <typename T, typename Par, typename ProjParm> - inline void e_forward(T& lp_lon, T& lp_lat, T& xy_x, T& xy_y, Par const& par, ProjParm const& proj_parm) + inline void e_forward(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y, Par const& par, ProjParm const& proj_parm) { T coslam, cosphi, sinphi, rho; //T azi1, s12; @@ -143,7 +134,7 @@ namespace projections } template <typename T, typename Par, typename ProjParm> - inline void e_inverse(T& xy_x, T& xy_y, T& lp_lon, T& lp_lat, Par const& par, ProjParm const& proj_parm) + inline void e_inverse(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat, Par const& par, ProjParm const& proj_parm) { T c; @@ -175,7 +166,7 @@ namespace projections } template <typename T, typename Par, typename ProjParm> - inline void e_guam_fwd(T& lp_lon, T& lp_lat, T& xy_x, T& xy_y, Par const& par, ProjParm const& proj_parm) + inline void e_guam_fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y, Par const& par, ProjParm const& proj_parm) { T cosphi, sinphi, t; @@ -188,7 +179,7 @@ namespace projections } template <typename T, typename Par, typename ProjParm> - inline void e_guam_inv(T& xy_x, T& xy_y, T& lp_lon, T& lp_lat, Par const& par, ProjParm const& proj_parm) + inline void e_guam_inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat, Par const& par, ProjParm const& proj_parm) { T x2, t = 0.0; int i; @@ -204,7 +195,7 @@ namespace projections } template <typename T, typename Par, typename ProjParm> - inline void s_forward(T& lp_lon, T& lp_lat, T& xy_x, T& xy_y, Par const& /*par*/, ProjParm const& proj_parm) + inline void s_forward(T const& lp_lon, T lp_lat, T& xy_x, T& xy_y, Par const& /*par*/, ProjParm const& proj_parm) { static const T half_pi = detail::half_pi<T>(); @@ -247,7 +238,7 @@ namespace projections } template <typename T, typename Par, typename ProjParm> - inline void s_inverse(T& xy_x, T& xy_y, T& lp_lon, T& lp_lat, Par const& par, ProjParm const& proj_parm) + inline void s_inverse(T xy_x, T xy_y, T& lp_lon, T& lp_lat, Par const& par, ProjParm const& proj_parm) { static const T pi = detail::pi<T>(); static const T half_pi = detail::half_pi<T>(); @@ -287,12 +278,12 @@ namespace projections } // Azimuthal Equidistant - template <typename Parameters, typename T> - inline void setup_aeqd(Parameters& par, par_aeqd<T>& proj_parm, bool is_sphere, bool is_guam) + template <typename Params, typename Parameters, typename T> + inline void setup_aeqd(Params const& params, Parameters& par, par_aeqd<T>& proj_parm, bool is_sphere, bool is_guam) { static const T half_pi = detail::half_pi<T>(); - par.phi0 = pj_get_param_r(par.params, "lat_0"); + par.phi0 = pj_get_param_r<T, srs::spar::lat_0>(params, "lat_0", srs::dpar::lat_0); if (fabs(fabs(par.phi0) - half_pi) < epsilon10) { proj_parm.mode = par.phi0 < 0. ? s_pole : n_pole; proj_parm.sinph0 = par.phi0 < 0. ? -1. : 1.; @@ -347,14 +338,14 @@ namespace projections // FORWARD(e_forward) elliptical // Project coordinates from geographic (lon, lat) to cartesian (x, y) - inline void fwd(T& lp_lon, T& lp_lat, T& xy_x, T& xy_y) const + inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const { e_forward(lp_lon, lp_lat, xy_x, xy_y, this->m_par, this->m_proj_parm); } // INVERSE(e_inverse) elliptical // Project coordinates from cartesian (x, y) to geographic (lon, lat) - inline void inv(T& xy_x, T& xy_y, T& lp_lon, T& lp_lat) const + inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const { e_inverse(xy_x, xy_y, lp_lon, lp_lat, this->m_par, this->m_proj_parm); } @@ -379,14 +370,14 @@ namespace projections // FORWARD(e_guam_fwd) Guam elliptical // Project coordinates from geographic (lon, lat) to cartesian (x, y) - inline void fwd(T& lp_lon, T& lp_lat, T& xy_x, T& xy_y) const + inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const { e_guam_fwd(lp_lon, lp_lat, xy_x, xy_y, this->m_par, this->m_proj_parm); } // INVERSE(e_guam_inv) Guam elliptical // Project coordinates from cartesian (x, y) to geographic (lon, lat) - inline void inv(T& xy_x, T& xy_y, T& lp_lon, T& lp_lat) const + inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const { e_guam_inv(xy_x, xy_y, lp_lon, lp_lat, this->m_par, this->m_proj_parm); } @@ -407,11 +398,11 @@ namespace projections static const bool is_guam = ! boost::is_same < - typename srs::par4::detail::tuples_find_if + typename srs::spar::detail::tuples_find_if < BGParameters, //srs::par4::detail::is_guam - srs::par4::detail::is_param<srs::par4::guam>::pred + srs::spar::detail::is_param<srs::spar::guam>::pred >::type, void >::value; @@ -422,7 +413,7 @@ namespace projections // FORWARD(e_forward or e_guam_fwd) elliptical // Project coordinates from geographic (lon, lat) to cartesian (x, y) - inline void fwd(T& lp_lon, T& lp_lat, T& xy_x, T& xy_y) const + inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const { if (is_guam) e_guam_fwd(lp_lon, lp_lat, xy_x, xy_y, this->m_par, this->m_proj_parm); @@ -432,7 +423,7 @@ namespace projections // INVERSE(e_inverse or e_guam_inv) elliptical // Project coordinates from cartesian (x, y) to geographic (lon, lat) - inline void inv(T& xy_x, T& xy_y, T& lp_lon, T& lp_lat) const + inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const { if (is_guam) e_guam_inv(xy_x, xy_y, lp_lon, lp_lat, this->m_par, this->m_proj_parm); @@ -460,14 +451,14 @@ namespace projections // FORWARD(s_forward) spherical // Project coordinates from geographic (lon, lat) to cartesian (x, y) - inline void fwd(T& lp_lon, T& lp_lat, T& xy_x, T& xy_y) const + inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const { s_forward(lp_lon, lp_lat, xy_x, xy_y, this->m_par, this->m_proj_parm); } // INVERSE(s_inverse) spherical // Project coordinates from cartesian (x, y) to geographic (lon, lat) - inline void inv(T& xy_x, T& xy_y, T& lp_lon, T& lp_lat) const + inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const { s_inverse(xy_x, xy_y, lp_lon, lp_lat, this->m_par, this->m_proj_parm); } @@ -501,9 +492,11 @@ namespace projections template <typename T, typename Parameters> struct aeqd_e : public detail::aeqd::base_aeqd_e<T, Parameters> { - inline aeqd_e(const Parameters& par) : detail::aeqd::base_aeqd_e<T, Parameters>(par) + template <typename Params> + inline aeqd_e(Params const& params, Parameters const& par) + : detail::aeqd::base_aeqd_e<T, Parameters>(par) { - detail::aeqd::setup_aeqd(this->m_par, this->m_proj_parm, false, false); + detail::aeqd::setup_aeqd(params, this->m_par, this->m_proj_parm, false, false); } }; @@ -526,9 +519,11 @@ namespace projections template <typename T, typename Parameters> struct aeqd_e_guam : public detail::aeqd::base_aeqd_e_guam<T, Parameters> { - inline aeqd_e_guam(const Parameters& par) : detail::aeqd::base_aeqd_e_guam<T, Parameters>(par) + template <typename Params> + inline aeqd_e_guam(Params const& params, Parameters const& par) + : detail::aeqd::base_aeqd_e_guam<T, Parameters>(par) { - detail::aeqd::setup_aeqd(this->m_par, this->m_proj_parm, false, true); + detail::aeqd::setup_aeqd(params, this->m_par, this->m_proj_parm, false, true); } }; @@ -548,14 +543,15 @@ namespace projections \par Example \image html ex_aeqd.gif */ - template <typename BGParameters, typename T, typename Parameters> - struct aeqd_e_static : public detail::aeqd::base_aeqd_e_static<BGParameters, T, Parameters> + template <typename SParams, typename T, typename Parameters> + struct aeqd_e_static : public detail::aeqd::base_aeqd_e_static<SParams, T, Parameters> { - inline aeqd_e_static(const Parameters& par) : detail::aeqd::base_aeqd_e_static<BGParameters, T, Parameters>(par) + inline aeqd_e_static(SParams const& params, Parameters const& par) + : detail::aeqd::base_aeqd_e_static<SParams, T, Parameters>(par) { - detail::aeqd::setup_aeqd(this->m_par, this->m_proj_parm, + detail::aeqd::setup_aeqd(params, this->m_par, this->m_proj_parm, false, - detail::aeqd::base_aeqd_e_static<BGParameters, T, Parameters>::is_guam); + detail::aeqd::base_aeqd_e_static<SParams, T, Parameters>::is_guam); } }; @@ -578,9 +574,11 @@ namespace projections template <typename T, typename Parameters> struct aeqd_s : public detail::aeqd::base_aeqd_s<T, Parameters> { - inline aeqd_s(const Parameters& par) : detail::aeqd::base_aeqd_s<T, Parameters>(par) + template <typename Params> + inline aeqd_s(Params const& params, Parameters const& par) + : detail::aeqd::base_aeqd_s<T, Parameters>(par) { - detail::aeqd::setup_aeqd(this->m_par, this->m_proj_parm, true, false); + detail::aeqd::setup_aeqd(params, this->m_par, this->m_proj_parm, true, false); } }; @@ -590,40 +588,32 @@ namespace projections // Static projection template <typename BGP, typename CT, typename P> - struct static_projection_type<srs::par4::aeqd, srs_sphere_tag, BGP, CT, P> + struct static_projection_type<srs::spar::proj_aeqd, srs_sphere_tag, BGP, CT, P> { typedef aeqd_s<CT, P> type; }; template <typename BGP, typename CT, typename P> - struct static_projection_type<srs::par4::aeqd, srs_spheroid_tag, BGP, CT, P> + struct static_projection_type<srs::spar::proj_aeqd, srs_spheroid_tag, BGP, CT, P> { typedef aeqd_e_static<BGP, CT, P> type; }; - //BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::par4::aeqd, aeqd_s, aeqd_e_static) - //BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::par4::aeqd_guam, aeqd_guam, aeqd_guam) - // Factory entry(s) - template <typename T, typename Parameters> - class aeqd_entry : public detail::factory_entry<T, Parameters> + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_BEGIN(aeqd_entry) { - public : - virtual base_v<T, Parameters>* create_new(const Parameters& par) const - { - bool const guam = pj_get_param_b(par.params, "guam"); - - if (par.es && ! guam) - return new base_v_fi<aeqd_e<T, Parameters>, T, Parameters>(par); - else if (par.es && guam) - return new base_v_fi<aeqd_e_guam<T, Parameters>, T, Parameters>(par); - else - return new base_v_fi<aeqd_s<T, Parameters>, T, Parameters>(par); - } - }; + bool const guam = pj_get_param_b<srs::spar::guam>(params, "guam", srs::dpar::guam); + + if (parameters.es && ! guam) + return new base_v_fi<aeqd_e<T, Parameters>, T, Parameters>(params, parameters); + else if (parameters.es && guam) + return new base_v_fi<aeqd_e_guam<T, Parameters>, T, Parameters>(params, parameters); + else + return new base_v_fi<aeqd_s<T, Parameters>, T, Parameters>(params, parameters); + } + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_END - template <typename T, typename Parameters> - inline void aeqd_init(detail::base_factory<T, Parameters>& factory) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(aeqd_init) { - factory.add_to_factory("aeqd", new aeqd_entry<T, Parameters>); + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(aeqd, aeqd_entry) } } // namespace detail diff --git a/boost/geometry/srs/projections/proj/airy.hpp b/boost/geometry/srs/projections/proj/airy.hpp index 1762dec800..235a120d0e 100644 --- a/boost/geometry/srs/projections/proj/airy.hpp +++ b/boost/geometry/srs/projections/proj/airy.hpp @@ -52,18 +52,9 @@ #include <boost/geometry/srs/projections/impl/projects.hpp> #include <boost/geometry/srs/projections/impl/factory_entry.hpp> -#include <boost/geometry/srs/projections/par4.hpp> // airy tag - namespace boost { namespace geometry { -namespace srs { namespace par4 -{ - // already defined in par4.hpp as ellps name - //struct airy {}; - -}} //namespace srs::par4 - namespace projections { #ifndef DOXYGEN_NO_DETAIL @@ -102,7 +93,7 @@ namespace projections // FORWARD(s_forward) spheroid // Project coordinates from geographic (lon, lat) to cartesian (x, y) - inline void fwd(T& lp_lon, T& lp_lat, T& xy_x, T& xy_y) const + inline void fwd(T const& lp_lon, T lp_lat, T& xy_x, T& xy_y) const { static const T half_pi = detail::half_pi<T>(); @@ -158,15 +149,15 @@ namespace projections }; // Airy - template <typename Parameters, typename T> - inline void setup_airy(Parameters& par, par_airy<T>& proj_parm) + template <typename Params, typename Parameters, typename T> + inline void setup_airy(Params const& params, Parameters& par, par_airy<T>& proj_parm) { static const T half_pi = detail::half_pi<T>(); T beta; - proj_parm.no_cut = pj_get_param_b(par.params, "no_cut"); - beta = 0.5 * (half_pi - pj_get_param_r(par.params, "lat_b")); + proj_parm.no_cut = pj_get_param_b<srs::spar::no_cut>(params, "no_cut", srs::dpar::no_cut); + beta = 0.5 * (half_pi - pj_get_param_r<T, srs::spar::lat_b>(params, "lat_b", srs::dpar::lat_b)); if (fabs(beta) < epsilon) proj_parm.Cb = -0.5; else { @@ -216,9 +207,11 @@ namespace projections template <typename T, typename Parameters> struct airy_spheroid : public detail::airy::base_airy_spheroid<T, Parameters> { - inline airy_spheroid(const Parameters& par) : detail::airy::base_airy_spheroid<T, Parameters>(par) + template <typename Params> + inline airy_spheroid(Params const& params, Parameters const& par) + : detail::airy::base_airy_spheroid<T, Parameters>(par) { - detail::airy::setup_airy(this->m_par, this->m_proj_parm); + detail::airy::setup_airy(params, this->m_par, this->m_proj_parm); } }; @@ -227,23 +220,14 @@ namespace projections { // Static projection - BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::par4::airy, airy_spheroid, airy_spheroid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_airy, airy_spheroid, airy_spheroid) // Factory entry(s) - template <typename T, typename Parameters> - class airy_entry : public detail::factory_entry<T, Parameters> - { - public : - virtual base_v<T, Parameters>* create_new(const Parameters& par) const - { - return new base_v_f<airy_spheroid<T, Parameters>, T, Parameters>(par); - } - }; - - template <typename T, typename Parameters> - inline void airy_init(detail::base_factory<T, Parameters>& factory) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_F(airy_entry, airy_spheroid) + + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(airy_init) { - factory.add_to_factory("airy", new airy_entry<T, Parameters>); + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(airy, airy_entry) } } // namespace detail diff --git a/boost/geometry/srs/projections/proj/aitoff.hpp b/boost/geometry/srs/projections/proj/aitoff.hpp index c09618d45e..6d64ea3588 100644 --- a/boost/geometry/srs/projections/proj/aitoff.hpp +++ b/boost/geometry/srs/projections/proj/aitoff.hpp @@ -59,13 +59,6 @@ namespace boost { namespace geometry { -namespace srs { namespace par4 -{ - struct aitoff {}; - struct wintri {}; - -}} //namespace srs::par4 - namespace projections { #ifndef DOXYGEN_NO_DETAIL @@ -96,7 +89,7 @@ namespace projections // FORWARD(s_forward) spheroid // Project coordinates from geographic (lon, lat) to cartesian (x, y) - inline void fwd(T& lp_lon, T& lp_lat, T& xy_x, T& xy_y) const + inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const { T c, d; @@ -133,7 +126,7 @@ namespace projections // INVERSE(s_inverse) sphere // Project coordinates from cartesian (x, y) to geographic (lon, lat) - inline void inv(T& xy_x, T& xy_y, T& lp_lon, T& lp_lat) const + inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const { static const T pi = detail::pi<T>(); static const T two_pi = detail::two_pi<T>(); @@ -224,15 +217,15 @@ namespace projections } // Winkel Tripel - template <typename Parameters, typename T> - inline void setup_wintri(Parameters& par, par_aitoff<T>& proj_parm) + template <typename Params, typename Parameters, typename T> + inline void setup_wintri(Params& params, Parameters& par, par_aitoff<T>& proj_parm) { static const T two_div_pi = detail::two_div_pi<T>(); T phi1; proj_parm.mode = mode_winkel_tripel; - if (pj_param_r(par.params, "lat_1", phi1)) { + if (pj_param_r<srs::spar::lat_1>(params, "lat_1", srs::dpar::lat_1, phi1)) { if ((proj_parm.cosphi1 = cos(phi1)) == 0.) BOOST_THROW_EXCEPTION( projection_exception(error_lat_larger_than_90) ); } else /* 50d28' or phi1=acos(2/pi) */ @@ -258,7 +251,9 @@ namespace projections template <typename T, typename Parameters> struct aitoff_spheroid : public detail::aitoff::base_aitoff_spheroid<T, Parameters> { - inline aitoff_spheroid(const Parameters& par) : detail::aitoff::base_aitoff_spheroid<T, Parameters>(par) + template <typename Params> + inline aitoff_spheroid(Params const& , Parameters const& par) + : detail::aitoff::base_aitoff_spheroid<T, Parameters>(par) { detail::aitoff::setup_aitoff(this->m_par, this->m_proj_parm); } @@ -281,9 +276,11 @@ namespace projections template <typename T, typename Parameters> struct wintri_spheroid : public detail::aitoff::base_aitoff_spheroid<T, Parameters> { - inline wintri_spheroid(const Parameters& par) : detail::aitoff::base_aitoff_spheroid<T, Parameters>(par) + template <typename Params> + inline wintri_spheroid(Params const& params, Parameters const& par) + : detail::aitoff::base_aitoff_spheroid<T, Parameters>(par) { - detail::aitoff::setup_wintri(this->m_par, this->m_proj_parm); + detail::aitoff::setup_wintri(params, this->m_par, this->m_proj_parm); } }; @@ -292,35 +289,17 @@ namespace projections { // Static projection - BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::par4::aitoff, aitoff_spheroid, aitoff_spheroid) - BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::par4::wintri, wintri_spheroid, wintri_spheroid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_aitoff, aitoff_spheroid, aitoff_spheroid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_wintri, wintri_spheroid, wintri_spheroid) // Factory entry(s) - template <typename T, typename Parameters> - class aitoff_entry : public detail::factory_entry<T, Parameters> - { - public : - virtual base_v<T, Parameters>* create_new(const Parameters& par) const - { - return new base_v_fi<aitoff_spheroid<T, Parameters>, T, Parameters>(par); - } - }; - - template <typename T, typename Parameters> - class wintri_entry : public detail::factory_entry<T, Parameters> - { - public : - virtual base_v<T, Parameters>* create_new(const Parameters& par) const - { - return new base_v_fi<wintri_spheroid<T, Parameters>, T, Parameters>(par); - } - }; + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(aitoff_entry, aitoff_spheroid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(wintri_entry, wintri_spheroid) - template <typename T, typename Parameters> - inline void aitoff_init(detail::base_factory<T, Parameters>& factory) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(aitoff_init) { - factory.add_to_factory("aitoff", new aitoff_entry<T, Parameters>); - factory.add_to_factory("wintri", new wintri_entry<T, Parameters>); + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(aitoff, aitoff_entry) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(wintri, wintri_entry) } } // namespace detail diff --git a/boost/geometry/srs/projections/proj/august.hpp b/boost/geometry/srs/projections/proj/august.hpp index a52edc7806..fb55dcb9eb 100644 --- a/boost/geometry/srs/projections/proj/august.hpp +++ b/boost/geometry/srs/projections/proj/august.hpp @@ -48,12 +48,6 @@ namespace boost { namespace geometry { -namespace srs { namespace par4 -{ - struct august {}; - -}} //namespace srs::par4 - namespace projections { #ifndef DOXYGEN_NO_DETAIL @@ -73,7 +67,7 @@ namespace projections // FORWARD(s_forward) spheroid // Project coordinates from geographic (lon, lat) to cartesian (x, y) - inline void fwd(T& lp_lon, T& lp_lat, T& xy_x, T& xy_y) const + inline void fwd(T lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const { static const T M = 1.333333333333333333333333333333333333; @@ -121,7 +115,9 @@ namespace projections template <typename T, typename Parameters> struct august_spheroid : public detail::august::base_august_spheroid<T, Parameters> { - inline august_spheroid(const Parameters& par) : detail::august::base_august_spheroid<T, Parameters>(par) + template <typename Params> + inline august_spheroid(Params const& , Parameters const& par) + : detail::august::base_august_spheroid<T, Parameters>(par) { detail::august::setup_august(this->m_par); } @@ -132,23 +128,14 @@ namespace projections { // Static projection - BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::par4::august, august_spheroid, august_spheroid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_august, august_spheroid, august_spheroid) // Factory entry(s) - template <typename T, typename Parameters> - class august_entry : public detail::factory_entry<T, Parameters> - { - public : - virtual base_v<T, Parameters>* create_new(const Parameters& par) const - { - return new base_v_f<august_spheroid<T, Parameters>, T, Parameters>(par); - } - }; - - template <typename T, typename Parameters> - inline void august_init(detail::base_factory<T, Parameters>& factory) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_F(august_entry, august_spheroid) + + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(august_init) { - factory.add_to_factory("august", new august_entry<T, Parameters>); + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(august, august_entry) } } // namespace detail diff --git a/boost/geometry/srs/projections/proj/bacon.hpp b/boost/geometry/srs/projections/proj/bacon.hpp index d82e30aa1f..17b3c36e0c 100644 --- a/boost/geometry/srs/projections/proj/bacon.hpp +++ b/boost/geometry/srs/projections/proj/bacon.hpp @@ -50,14 +50,6 @@ namespace boost { namespace geometry { -namespace srs { namespace par4 -{ - struct apian {}; - struct ortel {}; - struct bacon {}; - -}} //namespace srs::par4 - namespace projections { #ifndef DOXYGEN_NO_DETAIL @@ -86,7 +78,7 @@ namespace projections // FORWARD(s_forward) spheroid // Project coordinates from geographic (lon, lat) to cartesian (x, y) - inline void fwd(T& lp_lon, T& lp_lat, T& xy_x, T& xy_y) const + inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const { static const T half_pi = detail::half_pi<T>(); static const T half_pi_sqr = detail::half_pi_sqr<T>(); @@ -158,7 +150,9 @@ namespace projections template <typename T, typename Parameters> struct apian_spheroid : public detail::bacon::base_bacon_spheroid<T, Parameters> { - inline apian_spheroid(const Parameters& par) : detail::bacon::base_bacon_spheroid<T, Parameters>(par) + template <typename Params> + inline apian_spheroid(Params const& , Parameters const& par) + : detail::bacon::base_bacon_spheroid<T, Parameters>(par) { detail::bacon::setup_apian(this->m_par, this->m_proj_parm); } @@ -180,7 +174,9 @@ namespace projections template <typename T, typename Parameters> struct ortel_spheroid : public detail::bacon::base_bacon_spheroid<T, Parameters> { - inline ortel_spheroid(const Parameters& par) : detail::bacon::base_bacon_spheroid<T, Parameters>(par) + template <typename Params> + inline ortel_spheroid(Params const& , Parameters const& par) + : detail::bacon::base_bacon_spheroid<T, Parameters>(par) { detail::bacon::setup_ortel(this->m_par, this->m_proj_parm); } @@ -202,7 +198,9 @@ namespace projections template <typename T, typename Parameters> struct bacon_spheroid : public detail::bacon::base_bacon_spheroid<T, Parameters> { - inline bacon_spheroid(const Parameters& par) : detail::bacon::base_bacon_spheroid<T, Parameters>(par) + template <typename Params> + inline bacon_spheroid(Params const& , Parameters const& par) + : detail::bacon::base_bacon_spheroid<T, Parameters>(par) { detail::bacon::setup_bacon(this->m_par, this->m_proj_parm); } @@ -213,47 +211,20 @@ namespace projections { // Static projection - BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::par4::apian, apian_spheroid, apian_spheroid) - BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::par4::bacon, bacon_spheroid, bacon_spheroid) - BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::par4::ortel, ortel_spheroid, ortel_spheroid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_apian, apian_spheroid, apian_spheroid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_bacon, bacon_spheroid, bacon_spheroid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_ortel, ortel_spheroid, ortel_spheroid) // Factory entry(s) - template <typename T, typename Parameters> - class apian_entry : public detail::factory_entry<T, Parameters> - { - public : - virtual base_v<T, Parameters>* create_new(const Parameters& par) const - { - return new base_v_f<apian_spheroid<T, Parameters>, T, Parameters>(par); - } - }; - - template <typename T, typename Parameters> - class ortel_entry : public detail::factory_entry<T, Parameters> - { - public : - virtual base_v<T, Parameters>* create_new(const Parameters& par) const - { - return new base_v_f<ortel_spheroid<T, Parameters>, T, Parameters>(par); - } - }; - - template <typename T, typename Parameters> - class bacon_entry : public detail::factory_entry<T, Parameters> - { - public : - virtual base_v<T, Parameters>* create_new(const Parameters& par) const - { - return new base_v_f<bacon_spheroid<T, Parameters>, T, Parameters>(par); - } - }; + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_F(apian_entry, apian_spheroid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_F(ortel_entry, ortel_spheroid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_F(bacon_entry, bacon_spheroid) - template <typename T, typename Parameters> - inline void bacon_init(detail::base_factory<T, Parameters>& factory) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(bacon_init) { - factory.add_to_factory("apian", new apian_entry<T, Parameters>); - factory.add_to_factory("ortel", new ortel_entry<T, Parameters>); - factory.add_to_factory("bacon", new bacon_entry<T, Parameters>); + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(apian, apian_entry) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(ortel, ortel_entry) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(bacon, bacon_entry) } } // namespace detail diff --git a/boost/geometry/srs/projections/proj/bipc.hpp b/boost/geometry/srs/projections/proj/bipc.hpp index 02af27ff62..647a07ad3f 100644 --- a/boost/geometry/srs/projections/proj/bipc.hpp +++ b/boost/geometry/srs/projections/proj/bipc.hpp @@ -51,12 +51,6 @@ namespace boost { namespace geometry { -namespace srs { namespace par4 -{ - struct bipc {}; - -}} //namespace srs::par4 - namespace projections { #ifndef DOXYGEN_NO_DETAIL @@ -101,7 +95,7 @@ namespace projections // FORWARD(s_forward) spheroid // Project coordinates from geographic (lon, lat) to cartesian (x, y) - inline void fwd(T& lp_lon, T& lp_lat, T& xy_x, T& xy_y) const + inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const { static const T half_pi = detail::half_pi<T>(); static const T pi = detail::pi<T>(); @@ -175,7 +169,7 @@ namespace projections // INVERSE(s_inverse) spheroid // Project coordinates from cartesian (x, y) to geographic (lon, lat) - inline void inv(T& xy_x, T& xy_y, T& lp_lon, T& lp_lat) const + inline void inv(T xy_x, T xy_y, T& lp_lon, T& lp_lat) const { T t, r, rp, rl, al, z, fAz, Az, s, c, Av; int neg, i; @@ -227,10 +221,10 @@ namespace projections }; // Bipolar conic of western hemisphere - template <typename Parameters> - inline void setup_bipc(Parameters& par, par_bipc& proj_parm) + template <typename Params, typename Parameters> + inline void setup_bipc(Params const& params, Parameters& par, par_bipc& proj_parm) { - proj_parm.noskew = pj_get_param_b(par.params, "ns"); + proj_parm.noskew = pj_get_param_b<srs::spar::ns>(params, "ns", srs::dpar::ns); par.es = 0.; } @@ -254,9 +248,11 @@ namespace projections template <typename T, typename Parameters> struct bipc_spheroid : public detail::bipc::base_bipc_spheroid<T, Parameters> { - inline bipc_spheroid(const Parameters& par) : detail::bipc::base_bipc_spheroid<T, Parameters>(par) + template <typename Params> + inline bipc_spheroid(Params const& params, Parameters const& par) + : detail::bipc::base_bipc_spheroid<T, Parameters>(par) { - detail::bipc::setup_bipc(this->m_par, this->m_proj_parm); + detail::bipc::setup_bipc(params, this->m_par, this->m_proj_parm); } }; @@ -265,23 +261,14 @@ namespace projections { // Static projection - BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::par4::bipc, bipc_spheroid, bipc_spheroid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_bipc, bipc_spheroid, bipc_spheroid) // Factory entry(s) - template <typename T, typename Parameters> - class bipc_entry : public detail::factory_entry<T, Parameters> - { - public : - virtual base_v<T, Parameters>* create_new(const Parameters& par) const - { - return new base_v_fi<bipc_spheroid<T, Parameters>, T, Parameters>(par); - } - }; - - template <typename T, typename Parameters> - inline void bipc_init(detail::base_factory<T, Parameters>& factory) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(bipc_entry, bipc_spheroid) + + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(bipc_init) { - factory.add_to_factory("bipc", new bipc_entry<T, Parameters>); + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(bipc, bipc_entry) } } // namespace detail diff --git a/boost/geometry/srs/projections/proj/boggs.hpp b/boost/geometry/srs/projections/proj/boggs.hpp index c3c043faab..a9bf51716f 100644 --- a/boost/geometry/srs/projections/proj/boggs.hpp +++ b/boost/geometry/srs/projections/proj/boggs.hpp @@ -50,12 +50,6 @@ namespace boost { namespace geometry { -namespace srs { namespace par4 -{ - struct boggs {}; - -}} //namespace srs::par4 - namespace projections { #ifndef DOXYGEN_NO_DETAIL @@ -79,7 +73,7 @@ namespace projections // FORWARD(s_forward) spheroid // Project coordinates from geographic (lon, lat) to cartesian (x, y) - inline void fwd(T& lp_lon, T& lp_lat, T& xy_x, T& xy_y) const + inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const { static const T half_pi = detail::half_pi<T>(); static const T pi = detail::pi<T>(); @@ -137,7 +131,9 @@ namespace projections template <typename T, typename Parameters> struct boggs_spheroid : public detail::boggs::base_boggs_spheroid<T, Parameters> { - inline boggs_spheroid(const Parameters& par) : detail::boggs::base_boggs_spheroid<T, Parameters>(par) + template <typename Params> + inline boggs_spheroid(Params const& , Parameters const& par) + : detail::boggs::base_boggs_spheroid<T, Parameters>(par) { detail::boggs::setup_boggs(this->m_par); } @@ -148,23 +144,14 @@ namespace projections { // Static projection - BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::par4::boggs, boggs_spheroid, boggs_spheroid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_boggs, boggs_spheroid, boggs_spheroid) // Factory entry(s) - template <typename T, typename Parameters> - class boggs_entry : public detail::factory_entry<T, Parameters> - { - public : - virtual base_v<T, Parameters>* create_new(const Parameters& par) const - { - return new base_v_f<boggs_spheroid<T, Parameters>, T, Parameters>(par); - } - }; + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_F(boggs_entry, boggs_spheroid) - template <typename T, typename Parameters> - inline void boggs_init(detail::base_factory<T, Parameters>& factory) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(boggs_init) { - factory.add_to_factory("boggs", new boggs_entry<T, Parameters>); + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(boggs, boggs_entry); } } // namespace detail diff --git a/boost/geometry/srs/projections/proj/bonne.hpp b/boost/geometry/srs/projections/proj/bonne.hpp index 3699537721..4016d03229 100644 --- a/boost/geometry/srs/projections/proj/bonne.hpp +++ b/boost/geometry/srs/projections/proj/bonne.hpp @@ -52,12 +52,6 @@ namespace boost { namespace geometry { -namespace srs { namespace par4 -{ - struct bonne {}; - -}} //namespace srs::par4 - namespace projections { #ifndef DOXYGEN_NO_DETAIL @@ -89,7 +83,7 @@ namespace projections // FORWARD(e_forward) ellipsoid // Project coordinates from geographic (lon, lat) to cartesian (x, y) - inline void fwd(T& lp_lon, T& lp_lat, T& xy_x, T& xy_y) const + inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const { T rh, E, c; @@ -101,7 +95,7 @@ namespace projections // INVERSE(e_inverse) ellipsoid // Project coordinates from cartesian (x, y) to geographic (lon, lat) - inline void inv(T& xy_x, T& xy_y, T& lp_lon, T& lp_lat) const + inline void inv(T const& xy_x, T xy_y, T& lp_lon, T& lp_lat) const { static const T half_pi = detail::half_pi<T>(); @@ -139,7 +133,7 @@ namespace projections // FORWARD(s_forward) spheroid // Project coordinates from geographic (lon, lat) to cartesian (x, y) - inline void fwd(T& lp_lon, T& lp_lat, T& xy_x, T& xy_y) const + inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const { T E, rh; @@ -153,7 +147,7 @@ namespace projections // INVERSE(s_inverse) spheroid // Project coordinates from cartesian (x, y) to geographic (lon, lat) - inline void inv(T& xy_x, T& xy_y, T& lp_lon, T& lp_lat) const + inline void inv(T const& xy_x, T xy_y, T& lp_lon, T& lp_lat) const { static const T half_pi = detail::half_pi<T>(); @@ -178,14 +172,14 @@ namespace projections }; // Bonne (Werner lat_1=90) - template <typename Parameters, typename T> - inline void setup_bonne(Parameters& par, par_bonne<T>& proj_parm) + template <typename Params, typename Parameters, typename T> + inline void setup_bonne(Params const& params, Parameters& par, par_bonne<T>& proj_parm) { static const T half_pi = detail::half_pi<T>(); T c; - proj_parm.phi1 = pj_get_param_r(par.params, "lat_1"); + proj_parm.phi1 = pj_get_param_r<T, srs::spar::lat_1>(params, "lat_1", srs::dpar::lat_1); if (fabs(proj_parm.phi1) < epsilon10) BOOST_THROW_EXCEPTION( projection_exception(error_lat1_is_zero) ); @@ -223,9 +217,11 @@ namespace projections template <typename T, typename Parameters> struct bonne_ellipsoid : public detail::bonne::base_bonne_ellipsoid<T, Parameters> { - inline bonne_ellipsoid(const Parameters& par) : detail::bonne::base_bonne_ellipsoid<T, Parameters>(par) + template <typename Params> + inline bonne_ellipsoid(Params const& params, Parameters const& par) + : detail::bonne::base_bonne_ellipsoid<T, Parameters>(par) { - detail::bonne::setup_bonne(this->m_par, this->m_proj_parm); + detail::bonne::setup_bonne(params, this->m_par, this->m_proj_parm); } }; @@ -247,9 +243,11 @@ namespace projections template <typename T, typename Parameters> struct bonne_spheroid : public detail::bonne::base_bonne_spheroid<T, Parameters> { - inline bonne_spheroid(const Parameters& par) : detail::bonne::base_bonne_spheroid<T, Parameters>(par) + template <typename Params> + inline bonne_spheroid(Params const& params, Parameters const& par) + : detail::bonne::base_bonne_spheroid<T, Parameters>(par) { - detail::bonne::setup_bonne(this->m_par, this->m_proj_parm); + detail::bonne::setup_bonne(params, this->m_par, this->m_proj_parm); } }; @@ -258,26 +256,14 @@ namespace projections { // Static projection - BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::par4::bonne, bonne_spheroid, bonne_ellipsoid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_bonne, bonne_spheroid, bonne_ellipsoid) // Factory entry(s) - template <typename T, typename Parameters> - class bonne_entry : public detail::factory_entry<T, Parameters> - { - public : - virtual base_v<T, Parameters>* create_new(const Parameters& par) const - { - if (par.es) - return new base_v_fi<bonne_ellipsoid<T, Parameters>, T, Parameters>(par); - else - return new base_v_fi<bonne_spheroid<T, Parameters>, T, Parameters>(par); - } - }; + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI2(bonne_entry, bonne_spheroid, bonne_ellipsoid) - template <typename T, typename Parameters> - inline void bonne_init(detail::base_factory<T, Parameters>& factory) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(bonne_init) { - factory.add_to_factory("bonne", new bonne_entry<T, Parameters>); + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(bonne, bonne_entry); } } // namespace detail diff --git a/boost/geometry/srs/projections/proj/cass.hpp b/boost/geometry/srs/projections/proj/cass.hpp index e46750cb6f..4f68cd01bb 100644 --- a/boost/geometry/srs/projections/proj/cass.hpp +++ b/boost/geometry/srs/projections/proj/cass.hpp @@ -50,12 +50,6 @@ namespace boost { namespace geometry { -namespace srs { namespace par4 -{ - struct cass {}; - -}} //namespace srs::par4 - namespace projections { #ifndef DOXYGEN_NO_DETAIL @@ -100,7 +94,7 @@ namespace projections // FORWARD(e_forward) ellipsoid // Project coordinates from geographic (lon, lat) to cartesian (x, y) - inline void fwd(T& lp_lon, T& lp_lat, T& xy_x, T& xy_y) const + inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const { static const T C1 = cass::C1<T>(); static const T C2 = cass::C2<T>(); @@ -123,7 +117,7 @@ namespace projections // INVERSE(e_inverse) ellipsoid // Project coordinates from cartesian (x, y) to geographic (lon, lat) - inline void inv(T& xy_x, T& xy_y, T& lp_lon, T& lp_lat) const + inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const { static const T C3 = cass::C3<T>(); static const T C4 = cass::C4<T>(); @@ -165,7 +159,7 @@ namespace projections // FORWARD(s_forward) spheroid // Project coordinates from geographic (lon, lat) to cartesian (x, y) - inline void fwd(T& lp_lon, T& lp_lat, T& xy_x, T& xy_y) const + inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const { xy_x = asin(cos(lp_lat) * sin(lp_lon)); xy_y = atan2(tan(lp_lat) , cos(lp_lon)) - this->m_par.phi0; @@ -173,7 +167,7 @@ namespace projections // INVERSE(s_inverse) spheroid // Project coordinates from cartesian (x, y) to geographic (lon, lat) - inline void inv(T& xy_x, T& xy_y, T& lp_lon, T& lp_lat) const + inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const { T dd = xy_y + this->m_par.phi0; lp_lat = asin(sin(dd) * cos(xy_x)); @@ -217,7 +211,9 @@ namespace projections template <typename T, typename Parameters> struct cass_ellipsoid : public detail::cass::base_cass_ellipsoid<T, Parameters> { - inline cass_ellipsoid(const Parameters& par) : detail::cass::base_cass_ellipsoid<T, Parameters>(par) + template <typename Params> + inline cass_ellipsoid(Params const& , Parameters const& par) + : detail::cass::base_cass_ellipsoid<T, Parameters>(par) { detail::cass::setup_cass(this->m_par, this->m_proj_parm); } @@ -239,7 +235,9 @@ namespace projections template <typename T, typename Parameters> struct cass_spheroid : public detail::cass::base_cass_spheroid<T, Parameters> { - inline cass_spheroid(const Parameters& par) : detail::cass::base_cass_spheroid<T, Parameters>(par) + template <typename Params> + inline cass_spheroid(Params const& , Parameters const& par) + : detail::cass::base_cass_spheroid<T, Parameters>(par) { detail::cass::setup_cass(this->m_par, this->m_proj_parm); } @@ -250,26 +248,14 @@ namespace projections { // Static projection - BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::par4::cass, cass_spheroid, cass_ellipsoid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_cass, cass_spheroid, cass_ellipsoid) // Factory entry(s) - template <typename T, typename Parameters> - class cass_entry : public detail::factory_entry<T, Parameters> - { - public : - virtual base_v<T, Parameters>* create_new(const Parameters& par) const - { - if (par.es) - return new base_v_fi<cass_ellipsoid<T, Parameters>, T, Parameters>(par); - else - return new base_v_fi<cass_spheroid<T, Parameters>, T, Parameters>(par); - } - }; + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI2(cass_entry, cass_spheroid, cass_ellipsoid) - template <typename T, typename Parameters> - inline void cass_init(detail::base_factory<T, Parameters>& factory) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(cass_init) { - factory.add_to_factory("cass", new cass_entry<T, Parameters>); + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(cass, cass_entry); } } // namespace detail diff --git a/boost/geometry/srs/projections/proj/cc.hpp b/boost/geometry/srs/projections/proj/cc.hpp index 78c3ede008..fbc97c7bdb 100644 --- a/boost/geometry/srs/projections/proj/cc.hpp +++ b/boost/geometry/srs/projections/proj/cc.hpp @@ -50,12 +50,6 @@ namespace boost { namespace geometry { -namespace srs { namespace par4 -{ - struct cc {}; - -}} //namespace srs::par4 - namespace projections { #ifndef DOXYGEN_NO_DETAIL @@ -75,7 +69,7 @@ namespace projections // FORWARD(s_forward) spheroid // Project coordinates from geographic (lon, lat) to cartesian (x, y) - inline void fwd(T& lp_lon, T& lp_lat, T& xy_x, T& xy_y) const + inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const { static const T half_pi = detail::half_pi<T>(); @@ -88,7 +82,7 @@ namespace projections // INVERSE(s_inverse) spheroid // Project coordinates from cartesian (x, y) to geographic (lon, lat) - inline void inv(T& xy_x, T& xy_y, T& lp_lon, T& lp_lat) const + inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const { lp_lat = atan(xy_y); lp_lon = xy_x; @@ -126,7 +120,9 @@ namespace projections template <typename T, typename Parameters> struct cc_spheroid : public detail::cc::base_cc_spheroid<T, Parameters> { - inline cc_spheroid(const Parameters& par) : detail::cc::base_cc_spheroid<T, Parameters>(par) + template <typename Params> + inline cc_spheroid(Params const& , Parameters const& par) + : detail::cc::base_cc_spheroid<T, Parameters>(par) { detail::cc::setup_cc(this->m_par); } @@ -137,23 +133,14 @@ namespace projections { // Static projection - BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::par4::cc, cc_spheroid, cc_spheroid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_cc, cc_spheroid, cc_spheroid) // Factory entry(s) - template <typename T, typename Parameters> - class cc_entry : public detail::factory_entry<T, Parameters> - { - public : - virtual base_v<T, Parameters>* create_new(const Parameters& par) const - { - return new base_v_fi<cc_spheroid<T, Parameters>, T, Parameters>(par); - } - }; - - template <typename T, typename Parameters> - inline void cc_init(detail::base_factory<T, Parameters>& factory) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(cc_entry, cc_spheroid) + + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(cc_init) { - factory.add_to_factory("cc", new cc_entry<T, Parameters>); + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(cc, cc_entry); } } // namespace detail diff --git a/boost/geometry/srs/projections/proj/cea.hpp b/boost/geometry/srs/projections/proj/cea.hpp index 2d7ba20d3d..a440ec3f8a 100644 --- a/boost/geometry/srs/projections/proj/cea.hpp +++ b/boost/geometry/srs/projections/proj/cea.hpp @@ -52,12 +52,6 @@ namespace boost { namespace geometry { -namespace srs { namespace par4 -{ - struct cea {}; - -}} //namespace srs::par4 - namespace projections { #ifndef DOXYGEN_NO_DETAIL @@ -86,7 +80,7 @@ namespace projections // FORWARD(e_forward) spheroid // Project coordinates from geographic (lon, lat) to cartesian (x, y) - inline void fwd(T& lp_lon, T& lp_lat, T& xy_x, T& xy_y) const + inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const { xy_x = this->m_par.k0 * lp_lon; xy_y = .5 * pj_qsfn(sin(lp_lat), this->m_par.e, this->m_par.one_es) / this->m_par.k0; @@ -94,7 +88,7 @@ namespace projections // INVERSE(e_inverse) spheroid // Project coordinates from cartesian (x, y) to geographic (lon, lat) - inline void inv(T& xy_x, T& xy_y, T& lp_lon, T& lp_lat) const + inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const { lp_lat = pj_authlat(asin( 2. * xy_y * this->m_par.k0 / this->m_proj_parm.qp), this->m_proj_parm.apa); lp_lon = xy_x / this->m_par.k0; @@ -120,7 +114,7 @@ namespace projections // FORWARD(s_forward) spheroid // Project coordinates from geographic (lon, lat) to cartesian (x, y) - inline void fwd(T& lp_lon, T& lp_lat, T& xy_x, T& xy_y) const + inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const { xy_x = this->m_par.k0 * lp_lon; xy_y = sin(lp_lat) / this->m_par.k0; @@ -128,7 +122,7 @@ namespace projections // INVERSE(s_inverse) spheroid // Project coordinates from cartesian (x, y) to geographic (lon, lat) - inline void inv(T& xy_x, T& xy_y, T& lp_lon, T& lp_lat) const + inline void inv(T const& xy_x, T xy_y, T& lp_lon, T& lp_lat) const { static const T half_pi = detail::half_pi<T>(); @@ -152,12 +146,12 @@ namespace projections }; // Equal Area Cylindrical - template <typename Parameters, typename T> - inline void setup_cea(Parameters& par, par_cea<T>& proj_parm) + template <typename Params, typename Parameters, typename T> + inline void setup_cea(Params const& params, Parameters& par, par_cea<T>& proj_parm) { T t = 0; - if (pj_param_r(par.params, "lat_ts", t)) { + if (pj_param_r<srs::spar::lat_ts>(params, "lat_ts", srs::dpar::lat_ts, t)) { par.k0 = cos(t); if (par.k0 < 0.) { BOOST_THROW_EXCEPTION( projection_exception(error_lat_ts_larger_than_90) ); @@ -194,9 +188,11 @@ namespace projections template <typename T, typename Parameters> struct cea_ellipsoid : public detail::cea::base_cea_ellipsoid<T, Parameters> { - inline cea_ellipsoid(const Parameters& par) : detail::cea::base_cea_ellipsoid<T, Parameters>(par) + template <typename Params> + inline cea_ellipsoid(Params const& params, Parameters const& par) + : detail::cea::base_cea_ellipsoid<T, Parameters>(par) { - detail::cea::setup_cea(this->m_par, this->m_proj_parm); + detail::cea::setup_cea(params, this->m_par, this->m_proj_parm); } }; @@ -218,9 +214,11 @@ namespace projections template <typename T, typename Parameters> struct cea_spheroid : public detail::cea::base_cea_spheroid<T, Parameters> { - inline cea_spheroid(const Parameters& par) : detail::cea::base_cea_spheroid<T, Parameters>(par) + template <typename Params> + inline cea_spheroid(Params const& params, Parameters const& par) + : detail::cea::base_cea_spheroid<T, Parameters>(par) { - detail::cea::setup_cea(this->m_par, this->m_proj_parm); + detail::cea::setup_cea(params, this->m_par, this->m_proj_parm); } }; @@ -229,26 +227,14 @@ namespace projections { // Static projection - BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::par4::cea, cea_spheroid, cea_ellipsoid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_cea, cea_spheroid, cea_ellipsoid) // Factory entry(s) - template <typename T, typename Parameters> - class cea_entry : public detail::factory_entry<T, Parameters> - { - public : - virtual base_v<T, Parameters>* create_new(const Parameters& par) const - { - if (par.es) - return new base_v_fi<cea_ellipsoid<T, Parameters>, T, Parameters>(par); - else - return new base_v_fi<cea_spheroid<T, Parameters>, T, Parameters>(par); - } - }; - - template <typename T, typename Parameters> - inline void cea_init(detail::base_factory<T, Parameters>& factory) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI2(cea_entry, cea_spheroid, cea_ellipsoid) + + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(cea_init) { - factory.add_to_factory("cea", new cea_entry<T, Parameters>); + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(cea, cea_entry); } } // namespace detail diff --git a/boost/geometry/srs/projections/proj/chamb.hpp b/boost/geometry/srs/projections/proj/chamb.hpp index a2bed492c1..1f397b33c4 100644 --- a/boost/geometry/srs/projections/proj/chamb.hpp +++ b/boost/geometry/srs/projections/proj/chamb.hpp @@ -52,12 +52,6 @@ namespace boost { namespace geometry { -namespace srs { namespace par4 -{ - struct chamb {}; - -}} //namespace srs::par4 - namespace projections { #ifndef DOXYGEN_NO_DETAIL @@ -129,7 +123,7 @@ namespace projections // FORWARD(s_forward) spheroid // Project coordinates from geographic (lon, lat) to cartesian (x, y) - inline void fwd(T& lp_lon, T& lp_lat, T& xy_x, T& xy_y) const + inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const { static const T third = detail::third<T>(); @@ -180,20 +174,43 @@ namespace projections }; - // Chamberlin Trimetric - template <typename Parameters, typename T> - inline void setup_chamb(Parameters& par, par_chamb<T>& proj_parm) + template <typename T> + inline T chamb_init_lat(srs::detail::proj4_parameters const& params, int i) { - static const T pi = detail::pi<T>(); - static const std::string lat[3] = {"lat_1", "lat_2", "lat_3"}; + return _pj_get_param_r<T>(params, lat[i]); + } + template <typename T> + inline T chamb_init_lat(srs::dpar::parameters<T> const& params, int i) + { + static const srs::dpar::name_r lat[3] = {srs::dpar::lat_1, srs::dpar::lat_2, srs::dpar::lat_3}; + return _pj_get_param_r<T>(params, lat[i]); + } + + template <typename T> + inline T chamb_init_lon(srs::detail::proj4_parameters const& params, int i) + { static const std::string lon[3] = {"lon_1", "lon_2", "lon_3"}; + return _pj_get_param_r<T>(params, lon[i]); + } + template <typename T> + inline T chamb_init_lon(srs::dpar::parameters<T> const& params, int i) + { + static const srs::dpar::name_r lon[3] = {srs::dpar::lon_1, srs::dpar::lon_2, srs::dpar::lon_3}; + return _pj_get_param_r<T>(params, lon[i]); + } + + // Chamberlin Trimetric + template <typename Params, typename Parameters, typename T> + inline void setup_chamb(Params const& params, Parameters& par, par_chamb<T>& proj_parm) + { + static const T pi = detail::pi<T>(); int i, j; for (i = 0; i < 3; ++i) { /* get control point locations */ - proj_parm.c[i].phi = pj_get_param_r(par.params, lat[i]); - proj_parm.c[i].lam = pj_get_param_r(par.params, lon[i]); + proj_parm.c[i].phi = chamb_init_lat<T>(params, i); + proj_parm.c[i].lam = chamb_init_lon<T>(params, i); proj_parm.c[i].lam = adjlon(proj_parm.c[i].lam - par.lam0); proj_parm.c[i].cosphi = cos(proj_parm.c[i].phi); proj_parm.c[i].sinphi = sin(proj_parm.c[i].phi); @@ -243,9 +260,11 @@ namespace projections template <typename T, typename Parameters> struct chamb_spheroid : public detail::chamb::base_chamb_spheroid<T, Parameters> { - inline chamb_spheroid(const Parameters& par) : detail::chamb::base_chamb_spheroid<T, Parameters>(par) + template <typename Params> + inline chamb_spheroid(Params const& params, Parameters const& par) + : detail::chamb::base_chamb_spheroid<T, Parameters>(par) { - detail::chamb::setup_chamb(this->m_par, this->m_proj_parm); + detail::chamb::setup_chamb(params, this->m_par, this->m_proj_parm); } }; @@ -254,23 +273,14 @@ namespace projections { // Static projection - BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::par4::chamb, chamb_spheroid, chamb_spheroid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_chamb, chamb_spheroid, chamb_spheroid) // Factory entry(s) - template <typename T, typename Parameters> - class chamb_entry : public detail::factory_entry<T, Parameters> - { - public : - virtual base_v<T, Parameters>* create_new(const Parameters& par) const - { - return new base_v_f<chamb_spheroid<T, Parameters>, T, Parameters>(par); - } - }; - - template <typename T, typename Parameters> - inline void chamb_init(detail::base_factory<T, Parameters>& factory) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_F(chamb_entry, chamb_spheroid) + + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(chamb_init) { - factory.add_to_factory("chamb", new chamb_entry<T, Parameters>); + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(chamb, chamb_entry); } } // namespace detail diff --git a/boost/geometry/srs/projections/proj/collg.hpp b/boost/geometry/srs/projections/proj/collg.hpp index 1dc5b3ce48..8cddbf803a 100644 --- a/boost/geometry/srs/projections/proj/collg.hpp +++ b/boost/geometry/srs/projections/proj/collg.hpp @@ -50,12 +50,6 @@ namespace boost { namespace geometry { -namespace srs { namespace par4 -{ - struct collg {}; - -}} //namespace srs::par4 - namespace projections { #ifndef DOXYGEN_NO_DETAIL @@ -77,7 +71,7 @@ namespace projections // FORWARD(s_forward) spheroid // Project coordinates from geographic (lon, lat) to cartesian (x, y) - inline void fwd(T& lp_lon, T& lp_lat, T& xy_x, T& xy_y) const + inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const { if ((xy_y = 1. - sin(lp_lat)) <= 0.) xy_y = 0.; @@ -89,7 +83,7 @@ namespace projections // INVERSE(s_inverse) spheroid // Project coordinates from cartesian (x, y) to geographic (lon, lat) - inline void inv(T& xy_x, T& xy_y, T& lp_lon, T& lp_lat) const + inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const { static T const half_pi = detail::half_pi<T>(); @@ -140,7 +134,9 @@ namespace projections template <typename T, typename Parameters> struct collg_spheroid : public detail::collg::base_collg_spheroid<T, Parameters> { - inline collg_spheroid(const Parameters& par) : detail::collg::base_collg_spheroid<T, Parameters>(par) + template <typename Params> + inline collg_spheroid(Params const& , Parameters const& par) + : detail::collg::base_collg_spheroid<T, Parameters>(par) { detail::collg::setup_collg(this->m_par); } @@ -151,23 +147,14 @@ namespace projections { // Static projection - BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::par4::collg, collg_spheroid, collg_spheroid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_collg, collg_spheroid, collg_spheroid) // Factory entry(s) - template <typename T, typename Parameters> - class collg_entry : public detail::factory_entry<T, Parameters> - { - public : - virtual base_v<T, Parameters>* create_new(const Parameters& par) const - { - return new base_v_fi<collg_spheroid<T, Parameters>, T, Parameters>(par); - } - }; - - template <typename T, typename Parameters> - inline void collg_init(detail::base_factory<T, Parameters>& factory) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(collg_entry, collg_spheroid) + + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(collg_init) { - factory.add_to_factory("collg", new collg_entry<T, Parameters>); + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(collg, collg_entry); } } // namespace detail diff --git a/boost/geometry/srs/projections/proj/crast.hpp b/boost/geometry/srs/projections/proj/crast.hpp index 5f781f8776..fa6fb98a7d 100644 --- a/boost/geometry/srs/projections/proj/crast.hpp +++ b/boost/geometry/srs/projections/proj/crast.hpp @@ -48,12 +48,6 @@ namespace boost { namespace geometry { -namespace srs { namespace par4 -{ - struct crast {}; - -}} //namespace srs::par4 - namespace projections { #ifndef DOXYGEN_NO_DETAIL @@ -77,7 +71,7 @@ namespace projections // FORWARD(s_forward) spheroid // Project coordinates from geographic (lon, lat) to cartesian (x, y) - inline void fwd(T& lp_lon, T& lp_lat, T& xy_x, T& xy_y) const + inline void fwd(T const& lp_lon, T lp_lat, T& xy_x, T& xy_y) const { static const T third = detail::third<T>(); @@ -88,7 +82,7 @@ namespace projections // INVERSE(s_inverse) spheroid // Project coordinates from cartesian (x, y) to geographic (lon, lat) - inline void inv(T& xy_x, T& xy_y, T& lp_lon, T& lp_lat) const + inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const { static const T third = detail::third<T>(); @@ -128,7 +122,9 @@ namespace projections template <typename T, typename Parameters> struct crast_spheroid : public detail::crast::base_crast_spheroid<T, Parameters> { - inline crast_spheroid(const Parameters& par) : detail::crast::base_crast_spheroid<T, Parameters>(par) + template <typename Params> + inline crast_spheroid(Params const& , Parameters const& par) + : detail::crast::base_crast_spheroid<T, Parameters>(par) { detail::crast::setup_crast(this->m_par); } @@ -139,23 +135,14 @@ namespace projections { // Static projection - BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::par4::crast, crast_spheroid, crast_spheroid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_crast, crast_spheroid, crast_spheroid) // Factory entry(s) - template <typename T, typename Parameters> - class crast_entry : public detail::factory_entry<T, Parameters> - { - public : - virtual base_v<T, Parameters>* create_new(const Parameters& par) const - { - return new base_v_fi<crast_spheroid<T, Parameters>, T, Parameters>(par); - } - }; - - template <typename T, typename Parameters> - inline void crast_init(detail::base_factory<T, Parameters>& factory) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(crast_entry, crast_spheroid) + + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(crast_init) { - factory.add_to_factory("crast", new crast_entry<T, Parameters>); + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(crast, crast_entry); } } // namespace detail diff --git a/boost/geometry/srs/projections/proj/denoy.hpp b/boost/geometry/srs/projections/proj/denoy.hpp index 9d54487f6f..0f344751d4 100644 --- a/boost/geometry/srs/projections/proj/denoy.hpp +++ b/boost/geometry/srs/projections/proj/denoy.hpp @@ -48,12 +48,6 @@ namespace boost { namespace geometry { -namespace srs { namespace par4 -{ - struct denoy {}; - -}} //namespace srs::par4 - namespace projections { #ifndef DOXYGEN_NO_DETAIL @@ -82,7 +76,7 @@ namespace projections // FORWARD(s_forward) spheroid // Project coordinates from geographic (lon, lat) to cartesian (x, y) - inline void fwd(T& lp_lon, T& lp_lat, T& xy_x, T& xy_y) const + inline void fwd(T lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const { static const T C1 = denoy::C1<T>(); static const T C3 = denoy::C3<T>(); @@ -127,7 +121,9 @@ namespace projections template <typename T, typename Parameters> struct denoy_spheroid : public detail::denoy::base_denoy_spheroid<T, Parameters> { - inline denoy_spheroid(const Parameters& par) : detail::denoy::base_denoy_spheroid<T, Parameters>(par) + template <typename Params> + inline denoy_spheroid(Params const& , Parameters const& par) + : detail::denoy::base_denoy_spheroid<T, Parameters>(par) { detail::denoy::setup_denoy(this->m_par); } @@ -138,23 +134,14 @@ namespace projections { // Static projection - BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::par4::denoy, denoy_spheroid, denoy_spheroid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_denoy, denoy_spheroid, denoy_spheroid) // Factory entry(s) - template <typename T, typename Parameters> - class denoy_entry : public detail::factory_entry<T, Parameters> - { - public : - virtual base_v<T, Parameters>* create_new(const Parameters& par) const - { - return new base_v_f<denoy_spheroid<T, Parameters>, T, Parameters>(par); - } - }; - - template <typename T, typename Parameters> - inline void denoy_init(detail::base_factory<T, Parameters>& factory) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_F(denoy_entry, denoy_spheroid) + + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(denoy_init) { - factory.add_to_factory("denoy", new denoy_entry<T, Parameters>); + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(denoy, denoy_entry); } } // namespace detail diff --git a/boost/geometry/srs/projections/proj/eck1.hpp b/boost/geometry/srs/projections/proj/eck1.hpp index e5ab6e2449..a551c04211 100644 --- a/boost/geometry/srs/projections/proj/eck1.hpp +++ b/boost/geometry/srs/projections/proj/eck1.hpp @@ -48,12 +48,6 @@ namespace boost { namespace geometry { -namespace srs { namespace par4 -{ - struct eck1 {}; - -}} //namespace srs::par4 - namespace projections { #ifndef DOXYGEN_NO_DETAIL @@ -74,7 +68,7 @@ namespace projections // FORWARD(s_forward) spheroid // Project coordinates from geographic (lon, lat) to cartesian (x, y) - inline void fwd(T& lp_lon, T& lp_lat, T& xy_x, T& xy_y) const + inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const { xy_x = FC * lp_lon * (1. - RP * fabs(lp_lat)); xy_y = FC * lp_lat; @@ -82,7 +76,7 @@ namespace projections // INVERSE(s_inverse) spheroid // Project coordinates from cartesian (x, y) to geographic (lon, lat) - inline void inv(T& xy_x, T& xy_y, T& lp_lon, T& lp_lat) const + inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const { lp_lat = xy_y / FC; lp_lon = xy_x / (FC * (1. - RP * fabs(lp_lat))); @@ -120,7 +114,9 @@ namespace projections template <typename T, typename Parameters> struct eck1_spheroid : public detail::eck1::base_eck1_spheroid<T, Parameters> { - inline eck1_spheroid(const Parameters& par) : detail::eck1::base_eck1_spheroid<T, Parameters>(par) + template <typename Params> + inline eck1_spheroid(Params const& , Parameters const& par) + : detail::eck1::base_eck1_spheroid<T, Parameters>(par) { detail::eck1::setup_eck1(this->m_par); } @@ -131,23 +127,14 @@ namespace projections { // Static projection - BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::par4::eck1, eck1_spheroid, eck1_spheroid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_eck1, eck1_spheroid, eck1_spheroid) // Factory entry(s) - template <typename T, typename Parameters> - class eck1_entry : public detail::factory_entry<T, Parameters> - { - public : - virtual base_v<T, Parameters>* create_new(const Parameters& par) const - { - return new base_v_fi<eck1_spheroid<T, Parameters>, T, Parameters>(par); - } - }; - - template <typename T, typename Parameters> - inline void eck1_init(detail::base_factory<T, Parameters>& factory) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(eck1_entry, eck1_spheroid) + + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(eck1_init) { - factory.add_to_factory("eck1", new eck1_entry<T, Parameters>); + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(eck1, eck1_entry); } } // namespace detail diff --git a/boost/geometry/srs/projections/proj/eck2.hpp b/boost/geometry/srs/projections/proj/eck2.hpp index fd39735d95..c9f8f8d41c 100644 --- a/boost/geometry/srs/projections/proj/eck2.hpp +++ b/boost/geometry/srs/projections/proj/eck2.hpp @@ -50,12 +50,6 @@ namespace boost { namespace geometry { -namespace srs { namespace par4 -{ - struct eck2 {}; - -}} //namespace srs::par4 - namespace projections { #ifndef DOXYGEN_NO_DETAIL @@ -78,7 +72,7 @@ namespace projections // FORWARD(s_forward) spheroid // Project coordinates from geographic (lon, lat) to cartesian (x, y) - inline void fwd(T& lp_lon, T& lp_lat, T& xy_x, T& xy_y) const + inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const { xy_x = FXC * lp_lon * (xy_y = sqrt(4. - 3. * sin(fabs(lp_lat)))); xy_y = FYC * (2. - xy_y); @@ -87,7 +81,7 @@ namespace projections // INVERSE(s_inverse) spheroid // Project coordinates from cartesian (x, y) to geographic (lon, lat) - inline void inv(T& xy_x, T& xy_y, T& lp_lon, T& lp_lat) const + inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const { static const T half_pi = detail::half_pi<T>(); static const T C13 = detail::third<T>(); @@ -137,7 +131,9 @@ namespace projections template <typename T, typename Parameters> struct eck2_spheroid : public detail::eck2::base_eck2_spheroid<T, Parameters> { - inline eck2_spheroid(const Parameters& par) : detail::eck2::base_eck2_spheroid<T, Parameters>(par) + template <typename Params> + inline eck2_spheroid(Params const& , Parameters const& par) + : detail::eck2::base_eck2_spheroid<T, Parameters>(par) { detail::eck2::setup_eck2(this->m_par); } @@ -148,23 +144,14 @@ namespace projections { // Static projection - BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::par4::eck2, eck2_spheroid, eck2_spheroid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_eck2, eck2_spheroid, eck2_spheroid) // Factory entry(s) - template <typename T, typename Parameters> - class eck2_entry : public detail::factory_entry<T, Parameters> - { - public : - virtual base_v<T, Parameters>* create_new(const Parameters& par) const - { - return new base_v_fi<eck2_spheroid<T, Parameters>, T, Parameters>(par); - } - }; - - template <typename T, typename Parameters> - inline void eck2_init(detail::base_factory<T, Parameters>& factory) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(eck2_entry, eck2_spheroid) + + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(eck2_init) { - factory.add_to_factory("eck2", new eck2_entry<T, Parameters>); + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(eck2, eck2_entry); } } // namespace detail diff --git a/boost/geometry/srs/projections/proj/eck3.hpp b/boost/geometry/srs/projections/proj/eck3.hpp index 35933af3fe..65ff88429d 100644 --- a/boost/geometry/srs/projections/proj/eck3.hpp +++ b/boost/geometry/srs/projections/proj/eck3.hpp @@ -51,15 +51,6 @@ namespace boost { namespace geometry { -namespace srs { namespace par4 -{ - struct eck3 {}; // Eckert III - struct putp1 {}; // Putnins P1 - struct wag6 {}; // Wagner VI - struct kav7 {}; // Kavraisky VII - -}} //namespace srs::par4 - namespace projections { #ifndef DOXYGEN_NO_DETAIL @@ -85,7 +76,7 @@ namespace projections // FORWARD(s_forward) spheroid // Project coordinates from geographic (lon, lat) to cartesian (x, y) - inline void fwd(T& lp_lon, T& lp_lat, T& xy_x, T& xy_y) const + inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const { xy_y = this->m_proj_parm.C_y * lp_lat; xy_x = this->m_proj_parm.C_x * lp_lon * (this->m_proj_parm.A + asqrt(1. - this->m_proj_parm.B * lp_lat * lp_lat)); @@ -93,7 +84,7 @@ namespace projections // INVERSE(s_inverse) spheroid // Project coordinates from cartesian (x, y) to geographic (lon, lat) - inline void inv(T& xy_x, T& xy_y, T& lp_lon, T& lp_lat) const + inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const { T denominator; lp_lat = xy_y / this->m_proj_parm.C_y; @@ -187,7 +178,9 @@ namespace projections template <typename T, typename Parameters> struct eck3_spheroid : public detail::eck3::base_eck3_spheroid<T, Parameters> { - inline eck3_spheroid(const Parameters& par) : detail::eck3::base_eck3_spheroid<T, Parameters>(par) + template <typename Params> + inline eck3_spheroid(Params const& , Parameters const& par) + : detail::eck3::base_eck3_spheroid<T, Parameters>(par) { detail::eck3::setup_eck3(this->m_par, this->m_proj_parm); } @@ -208,7 +201,9 @@ namespace projections template <typename T, typename Parameters> struct putp1_spheroid : public detail::eck3::base_eck3_spheroid<T, Parameters> { - inline putp1_spheroid(const Parameters& par) : detail::eck3::base_eck3_spheroid<T, Parameters>(par) + template <typename Params> + inline putp1_spheroid(Params const& , Parameters const& par) + : detail::eck3::base_eck3_spheroid<T, Parameters>(par) { detail::eck3::setup_putp1(this->m_par, this->m_proj_parm); } @@ -229,7 +224,9 @@ namespace projections template <typename T, typename Parameters> struct wag6_spheroid : public detail::eck3::base_eck3_spheroid<T, Parameters> { - inline wag6_spheroid(const Parameters& par) : detail::eck3::base_eck3_spheroid<T, Parameters>(par) + template <typename Params> + inline wag6_spheroid(Params const& , Parameters const& par) + : detail::eck3::base_eck3_spheroid<T, Parameters>(par) { detail::eck3::setup_wag6(this->m_par, this->m_proj_parm); } @@ -250,7 +247,9 @@ namespace projections template <typename T, typename Parameters> struct kav7_spheroid : public detail::eck3::base_eck3_spheroid<T, Parameters> { - inline kav7_spheroid(const Parameters& par) : detail::eck3::base_eck3_spheroid<T, Parameters>(par) + template <typename Params> + inline kav7_spheroid(Params const& , Parameters const& par) + : detail::eck3::base_eck3_spheroid<T, Parameters>(par) { detail::eck3::setup_kav7(this->m_par, this->m_proj_parm); } @@ -261,59 +260,23 @@ namespace projections { // Static projection - BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::par4::eck3, eck3_spheroid, eck3_spheroid) - BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::par4::putp1, putp1_spheroid, putp1_spheroid) - BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::par4::wag6, wag6_spheroid, wag6_spheroid) - BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::par4::kav7, kav7_spheroid, kav7_spheroid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_eck3, eck3_spheroid, eck3_spheroid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_putp1, putp1_spheroid, putp1_spheroid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_wag6, wag6_spheroid, wag6_spheroid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_kav7, kav7_spheroid, kav7_spheroid) // Factory entry(s) - template <typename T, typename Parameters> - class eck3_entry : public detail::factory_entry<T, Parameters> - { - public : - virtual base_v<T, Parameters>* create_new(const Parameters& par) const - { - return new base_v_fi<eck3_spheroid<T, Parameters>, T, Parameters>(par); - } - }; - - template <typename T, typename Parameters> - class putp1_entry : public detail::factory_entry<T, Parameters> - { - public : - virtual base_v<T, Parameters>* create_new(const Parameters& par) const - { - return new base_v_fi<putp1_spheroid<T, Parameters>, T, Parameters>(par); - } - }; - - template <typename T, typename Parameters> - class wag6_entry : public detail::factory_entry<T, Parameters> - { - public : - virtual base_v<T, Parameters>* create_new(const Parameters& par) const - { - return new base_v_fi<wag6_spheroid<T, Parameters>, T, Parameters>(par); - } - }; - - template <typename T, typename Parameters> - class kav7_entry : public detail::factory_entry<T, Parameters> - { - public : - virtual base_v<T, Parameters>* create_new(const Parameters& par) const - { - return new base_v_fi<kav7_spheroid<T, Parameters>, T, Parameters>(par); - } - }; - - template <typename T, typename Parameters> - inline void eck3_init(detail::base_factory<T, Parameters>& factory) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(eck3_entry, eck3_spheroid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(putp1_entry, putp1_spheroid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(wag6_entry, wag6_spheroid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(kav7_entry, kav7_spheroid) + + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(eck3_init) { - factory.add_to_factory("eck3", new eck3_entry<T, Parameters>); - factory.add_to_factory("putp1", new putp1_entry<T, Parameters>); - factory.add_to_factory("wag6", new wag6_entry<T, Parameters>); - factory.add_to_factory("kav7", new kav7_entry<T, Parameters>); + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(eck3, eck3_entry); + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(putp1, putp1_entry); + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(wag6, wag6_entry); + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(kav7, kav7_entry); } } // namespace detail diff --git a/boost/geometry/srs/projections/proj/eck4.hpp b/boost/geometry/srs/projections/proj/eck4.hpp index 7c1fc6178d..0a8a2bcd96 100644 --- a/boost/geometry/srs/projections/proj/eck4.hpp +++ b/boost/geometry/srs/projections/proj/eck4.hpp @@ -49,12 +49,6 @@ namespace boost { namespace geometry { -namespace srs { namespace par4 -{ - struct eck4 {}; // Eckert IV - -}} //namespace srs::par4 - namespace projections { #ifndef DOXYGEN_NO_DETAIL @@ -80,7 +74,7 @@ namespace projections // FORWARD(s_forward) spheroid // Project coordinates from geographic (lon, lat) to cartesian (x, y) - inline void fwd(T& lp_lon, T& lp_lat, T& xy_x, T& xy_y) const + inline void fwd(T const& lp_lon, T lp_lat, T& xy_x, T& xy_y) const { T p, V, s, c; int i; @@ -107,7 +101,7 @@ namespace projections // INVERSE(s_inverse) spheroid // Project coordinates from cartesian (x, y) to geographic (lon, lat) - inline void inv(T& xy_x, T& xy_y, T& lp_lon, T& lp_lat) const + inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const { T c; @@ -148,7 +142,9 @@ namespace projections template <typename T, typename Parameters> struct eck4_spheroid : public detail::eck4::base_eck4_spheroid<T, Parameters> { - inline eck4_spheroid(const Parameters& par) : detail::eck4::base_eck4_spheroid<T, Parameters>(par) + template <typename Params> + inline eck4_spheroid(Params const& , Parameters const& par) + : detail::eck4::base_eck4_spheroid<T, Parameters>(par) { detail::eck4::setup_eck4(this->m_par); } @@ -159,23 +155,14 @@ namespace projections { // Static projection - BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::par4::eck4, eck4_spheroid, eck4_spheroid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_eck4, eck4_spheroid, eck4_spheroid) // Factory entry(s) - template <typename T, typename Parameters> - class eck4_entry : public detail::factory_entry<T, Parameters> - { - public : - virtual base_v<T, Parameters>* create_new(const Parameters& par) const - { - return new base_v_fi<eck4_spheroid<T, Parameters>, T, Parameters>(par); - } - }; - - template <typename T, typename Parameters> - inline void eck4_init(detail::base_factory<T, Parameters>& factory) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(eck4_entry, eck4_spheroid) + + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(eck4_init) { - factory.add_to_factory("eck4", new eck4_entry<T, Parameters>); + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(eck4, eck4_entry); } } // namespace detail diff --git a/boost/geometry/srs/projections/proj/eck5.hpp b/boost/geometry/srs/projections/proj/eck5.hpp index 823de91040..23901b71a3 100644 --- a/boost/geometry/srs/projections/proj/eck5.hpp +++ b/boost/geometry/srs/projections/proj/eck5.hpp @@ -48,12 +48,6 @@ namespace boost { namespace geometry { -namespace srs { namespace par4 -{ - struct eck5 {}; // Eckert V - -}} //namespace srs::par4 - namespace projections { #ifndef DOXYGEN_NO_DETAIL @@ -76,7 +70,7 @@ namespace projections // FORWARD(s_forward) spheroid // Project coordinates from geographic (lon, lat) to cartesian (x, y) - inline void fwd(T& lp_lon, T& lp_lat, T& xy_x, T& xy_y) const + inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const { xy_x = XF * (1. + cos(lp_lat)) * lp_lon; xy_y = YF * lp_lat; @@ -84,7 +78,7 @@ namespace projections // INVERSE(s_inverse) spheroid // Project coordinates from cartesian (x, y) to geographic (lon, lat) - inline void inv(T& xy_x, T& xy_y, T& lp_lon, T& lp_lat) const + inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const { lp_lon = RXF * xy_x / (1. + cos( lp_lat = RYF * xy_y)); } @@ -121,7 +115,9 @@ namespace projections template <typename T, typename Parameters> struct eck5_spheroid : public detail::eck5::base_eck5_spheroid<T, Parameters> { - inline eck5_spheroid(const Parameters& par) : detail::eck5::base_eck5_spheroid<T, Parameters>(par) + template <typename Params> + inline eck5_spheroid(Params const& , Parameters const& par) + : detail::eck5::base_eck5_spheroid<T, Parameters>(par) { detail::eck5::setup_eck5(this->m_par); } @@ -132,23 +128,14 @@ namespace projections { // Static projection - BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::par4::eck5, eck5_spheroid, eck5_spheroid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_eck5, eck5_spheroid, eck5_spheroid) // Factory entry(s) - template <typename T, typename Parameters> - class eck5_entry : public detail::factory_entry<T, Parameters> - { - public : - virtual base_v<T, Parameters>* create_new(const Parameters& par) const - { - return new base_v_fi<eck5_spheroid<T, Parameters>, T, Parameters>(par); - } - }; - - template <typename T, typename Parameters> - inline void eck5_init(detail::base_factory<T, Parameters>& factory) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(eck5_entry, eck5_spheroid) + + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(eck5_init) { - factory.add_to_factory("eck5", new eck5_entry<T, Parameters>); + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(eck5, eck5_entry); } } // namespace detail diff --git a/boost/geometry/srs/projections/proj/eqc.hpp b/boost/geometry/srs/projections/proj/eqc.hpp index 355ab90567..21b655d2db 100644 --- a/boost/geometry/srs/projections/proj/eqc.hpp +++ b/boost/geometry/srs/projections/proj/eqc.hpp @@ -48,12 +48,6 @@ namespace boost { namespace geometry { -namespace srs { namespace par4 -{ - struct eqc {}; // Equidistant Cylindrical (Plate Caree) - -}} //namespace srs::par4 - namespace projections { #ifndef DOXYGEN_NO_DETAIL @@ -78,7 +72,7 @@ namespace projections // FORWARD(s_forward) spheroid // Project coordinates from geographic (lon, lat) to cartesian (x, y) - inline void fwd(T& lp_lon, T& lp_lat, T& xy_x, T& xy_y) const + inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const { xy_x = this->m_proj_parm.rc * lp_lon; xy_y = lp_lat - this->m_par.phi0; @@ -86,7 +80,7 @@ namespace projections // INVERSE(s_inverse) spheroid // Project coordinates from cartesian (x, y) to geographic (lon, lat) - inline void inv(T& xy_x, T& xy_y, T& lp_lon, T& lp_lat) const + inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const { lp_lon = xy_x / this->m_proj_parm.rc; lp_lat = xy_y + this->m_par.phi0; @@ -100,10 +94,11 @@ namespace projections }; // Equidistant Cylindrical (Plate Caree) - template <typename Parameters, typename T> - inline void setup_eqc(Parameters& par, par_eqc<T>& proj_parm) + template <typename Params, typename Parameters, typename T> + inline void setup_eqc(Params const& params, Parameters& par, par_eqc<T>& proj_parm) { - if ((proj_parm.rc = cos(pj_get_param_r(par.params, "lat_ts"))) <= 0.) + proj_parm.rc = cos(pj_get_param_r<T, srs::spar::lat_ts>(params, "lat_ts", srs::dpar::lat_ts)); + if (proj_parm.rc <= 0.) BOOST_THROW_EXCEPTION( projection_exception(error_lat_ts_larger_than_90) ); par.es = 0.; } @@ -129,9 +124,11 @@ namespace projections template <typename T, typename Parameters> struct eqc_spheroid : public detail::eqc::base_eqc_spheroid<T, Parameters> { - inline eqc_spheroid(const Parameters& par) : detail::eqc::base_eqc_spheroid<T, Parameters>(par) + template <typename Params> + inline eqc_spheroid(Params const& params, Parameters const& par) + : detail::eqc::base_eqc_spheroid<T, Parameters>(par) { - detail::eqc::setup_eqc(this->m_par, this->m_proj_parm); + detail::eqc::setup_eqc(params, this->m_par, this->m_proj_parm); } }; @@ -140,23 +137,14 @@ namespace projections { // Static projection - BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::par4::eqc, eqc_spheroid, eqc_spheroid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_eqc, eqc_spheroid, eqc_spheroid) // Factory entry(s) - template <typename T, typename Parameters> - class eqc_entry : public detail::factory_entry<T, Parameters> - { - public : - virtual base_v<T, Parameters>* create_new(const Parameters& par) const - { - return new base_v_fi<eqc_spheroid<T, Parameters>, T, Parameters>(par); - } - }; - - template <typename T, typename Parameters> - inline void eqc_init(detail::base_factory<T, Parameters>& factory) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(eqc_entry, eqc_spheroid) + + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(eqc_init) { - factory.add_to_factory("eqc", new eqc_entry<T, Parameters>); + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(eqc, eqc_entry); } } // namespace detail diff --git a/boost/geometry/srs/projections/proj/eqdc.hpp b/boost/geometry/srs/projections/proj/eqdc.hpp index f0c7597cbd..d5aa8f2e11 100644 --- a/boost/geometry/srs/projections/proj/eqdc.hpp +++ b/boost/geometry/srs/projections/proj/eqdc.hpp @@ -53,12 +53,6 @@ namespace boost { namespace geometry { -namespace srs { namespace par4 -{ - struct eqdc {}; // Equidistant Conic - -}} //namespace srs::par4 - namespace projections { #ifndef DOXYGEN_NO_DETAIL @@ -92,7 +86,7 @@ namespace projections // FORWARD(e_forward) sphere & ellipsoid // Project coordinates from geographic (lon, lat) to cartesian (x, y) - inline void fwd(T& lp_lon, T& lp_lat, T& xy_x, T& xy_y) const + inline void fwd(T lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const { T rho = 0.0; @@ -104,7 +98,7 @@ namespace projections // INVERSE(e_inverse) sphere & ellipsoid // Project coordinates from cartesian (x, y) to geographic (lon, lat) - inline void inv(T& xy_x, T& xy_y, T& lp_lon, T& lp_lat) const + inline void inv(T xy_x, T xy_y, T& lp_lon, T& lp_lat) const { static T const half_pi = detail::half_pi<T>(); @@ -134,14 +128,14 @@ namespace projections }; // Equidistant Conic - template <typename Parameters, typename T> - inline void setup_eqdc(Parameters& par, par_eqdc<T>& proj_parm) + template <typename Params, typename Parameters, typename T> + inline void setup_eqdc(Params const& params, Parameters& par, par_eqdc<T>& proj_parm) { T cosphi, sinphi; int secant; - proj_parm.phi1 = pj_get_param_r(par.params, "lat_1"); - proj_parm.phi2 = pj_get_param_r(par.params, "lat_2"); + proj_parm.phi1 = pj_get_param_r<T, srs::spar::lat_1>(params, "lat_1", srs::dpar::lat_1); + proj_parm.phi2 = pj_get_param_r<T, srs::spar::lat_2>(params, "lat_2", srs::dpar::lat_2); if (fabs(proj_parm.phi1 + proj_parm.phi2) < epsilon10) BOOST_THROW_EXCEPTION( projection_exception(error_conic_lat_equal) ); @@ -195,9 +189,11 @@ namespace projections template <typename T, typename Parameters> struct eqdc_ellipsoid : public detail::eqdc::base_eqdc_ellipsoid<T, Parameters> { - inline eqdc_ellipsoid(const Parameters& par) : detail::eqdc::base_eqdc_ellipsoid<T, Parameters>(par) + template <typename Params> + inline eqdc_ellipsoid(Params const& params, Parameters const& par) + : detail::eqdc::base_eqdc_ellipsoid<T, Parameters>(par) { - detail::eqdc::setup_eqdc(this->m_par, this->m_proj_parm); + detail::eqdc::setup_eqdc(params, this->m_par, this->m_proj_parm); } }; @@ -206,23 +202,14 @@ namespace projections { // Static projection - BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::par4::eqdc, eqdc_ellipsoid, eqdc_ellipsoid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_eqdc, eqdc_ellipsoid, eqdc_ellipsoid) // Factory entry(s) - template <typename T, typename Parameters> - class eqdc_entry : public detail::factory_entry<T, Parameters> - { - public : - virtual base_v<T, Parameters>* create_new(const Parameters& par) const - { - return new base_v_fi<eqdc_ellipsoid<T, Parameters>, T, Parameters>(par); - } - }; - - template <typename T, typename Parameters> - inline void eqdc_init(detail::base_factory<T, Parameters>& factory) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(eqdc_entry, eqdc_ellipsoid) + + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(eqdc_init) { - factory.add_to_factory("eqdc", new eqdc_entry<T, Parameters>); + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(eqdc, eqdc_entry); } } // namespace detail diff --git a/boost/geometry/srs/projections/proj/etmerc.hpp b/boost/geometry/srs/projections/proj/etmerc.hpp index 050aafacca..0bedbf247d 100644 --- a/boost/geometry/srs/projections/proj/etmerc.hpp +++ b/boost/geometry/srs/projections/proj/etmerc.hpp @@ -65,13 +65,6 @@ namespace boost { namespace geometry { -namespace srs { namespace par4 -{ - struct etmerc {}; - struct utm {}; - -}} //namespace srs::par4 - namespace projections { #ifndef DOXYGEN_NO_DETAIL @@ -182,7 +175,7 @@ namespace projections // FORWARD(e_forward) ellipsoid // Project coordinates from geographic (lon, lat) to cartesian (x, y) - inline void fwd(T& lp_lon, T& lp_lat, T& xy_x, T& xy_y) const + inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const { T sin_Cn, cos_Cn, cos_Ce, sin_Ce, dCn, dCe; T Cn = lp_lat, Ce = lp_lon; @@ -211,7 +204,7 @@ namespace projections // INVERSE(e_inverse) ellipsoid // Project coordinates from cartesian (x, y) to geographic (lon, lat) - inline void inv(T& xy_x, T& xy_y, T& lp_lon, T& lp_lat) const + inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const { T sin_Cn, cos_Cn, cos_Ce, sin_Ce, dCn, dCe; T Cn = xy_y, Ce = xy_x; @@ -339,8 +332,8 @@ namespace projections } // Universal Transverse Mercator (UTM) - template <typename Parameters, typename T> - inline void setup_utm(Parameters& par, par_etmerc<T>& proj_parm) + template <typename Params, typename Parameters, typename T> + inline void setup_utm(Params const& params, Parameters& par, par_etmerc<T>& proj_parm) { static const T pi = detail::pi<T>(); @@ -350,9 +343,9 @@ namespace projections BOOST_THROW_EXCEPTION( projection_exception(error_ellipsoid_use_required) ); } - par.y0 = pj_get_param_b(par.params, "south") ? 10000000. : 0.; + par.y0 = pj_get_param_b<srs::spar::south>(params, "south", srs::dpar::south) ? 10000000. : 0.; par.x0 = 500000.; - if (pj_param_i(par.params, "zone", zone)) /* zone input ? */ + if (pj_param_i<srs::spar::zone>(params, "zone", srs::dpar::zone, zone)) /* zone input ? */ { if (zone > 0 && zone <= 60) --zone; @@ -396,7 +389,9 @@ namespace projections template <typename T, typename Parameters> struct etmerc_ellipsoid : public detail::etmerc::base_etmerc_ellipsoid<T, Parameters> { - inline etmerc_ellipsoid(const Parameters& par) : detail::etmerc::base_etmerc_ellipsoid<T, Parameters>(par) + template <typename Params> + inline etmerc_ellipsoid(Params const& , Parameters const& par) + : detail::etmerc::base_etmerc_ellipsoid<T, Parameters>(par) { detail::etmerc::setup_etmerc(this->m_par, this->m_proj_parm); } @@ -420,9 +415,11 @@ namespace projections template <typename T, typename Parameters> struct utm_ellipsoid : public detail::etmerc::base_etmerc_ellipsoid<T, Parameters> { - inline utm_ellipsoid(const Parameters& par) : detail::etmerc::base_etmerc_ellipsoid<T, Parameters>(par) + template <typename Params> + inline utm_ellipsoid(Params const& params, Parameters const& par) + : detail::etmerc::base_etmerc_ellipsoid<T, Parameters>(par) { - detail::etmerc::setup_utm(this->m_par, this->m_proj_parm); + detail::etmerc::setup_utm(params, this->m_par, this->m_proj_parm); } }; @@ -431,35 +428,17 @@ namespace projections { // Static projection - BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::par4::etmerc, etmerc_ellipsoid, etmerc_ellipsoid) - BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::par4::utm, utm_ellipsoid, utm_ellipsoid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_etmerc, etmerc_ellipsoid, etmerc_ellipsoid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_utm, utm_ellipsoid, utm_ellipsoid) // Factory entry(s) - template <typename T, typename Parameters> - class etmerc_entry : public detail::factory_entry<T, Parameters> - { - public : - virtual base_v<T, Parameters>* create_new(const Parameters& par) const - { - return new base_v_fi<etmerc_ellipsoid<T, Parameters>, T, Parameters>(par); - } - }; - - template <typename T, typename Parameters> - class utm_entry : public detail::factory_entry<T, Parameters> - { - public : - virtual base_v<T, Parameters>* create_new(const Parameters& par) const - { - return new base_v_fi<utm_ellipsoid<T, Parameters>, T, Parameters>(par); - } - }; - - template <typename T, typename Parameters> - inline void etmerc_init(detail::base_factory<T, Parameters>& factory) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(etmerc_entry, etmerc_ellipsoid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(utm_entry, utm_ellipsoid) + + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(etmerc_init) { - factory.add_to_factory("etmerc", new etmerc_entry<T, Parameters>); - factory.add_to_factory("utm", new utm_entry<T, Parameters>); + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(etmerc, etmerc_entry); + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(utm, utm_entry); } } // namespace detail diff --git a/boost/geometry/srs/projections/proj/fahey.hpp b/boost/geometry/srs/projections/proj/fahey.hpp index 8438b5dad3..85cc05c930 100644 --- a/boost/geometry/srs/projections/proj/fahey.hpp +++ b/boost/geometry/srs/projections/proj/fahey.hpp @@ -49,12 +49,6 @@ namespace boost { namespace geometry { -namespace srs { namespace par4 -{ - struct fahey {}; // Fahey - -}} //namespace srs::par4 - namespace projections { #ifndef DOXYGEN_NO_DETAIL @@ -74,7 +68,7 @@ namespace projections // FORWARD(s_forward) spheroid // Project coordinates from geographic (lon, lat) to cartesian (x, y) - inline void fwd(T& lp_lon, T& lp_lat, T& xy_x, T& xy_y) const + inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const { xy_x = tan(0.5 * lp_lat); xy_y = 1.819152 * xy_x; @@ -83,7 +77,7 @@ namespace projections // INVERSE(s_inverse) spheroid // Project coordinates from cartesian (x, y) to geographic (lon, lat) - inline void inv(T& xy_x, T& xy_y, T& lp_lon, T& lp_lat) const + inline void inv(T const& xy_x, T xy_y, T& lp_lon, T& lp_lat) const { xy_y /= 1.819152; lp_lat = 2. * atan(xy_y); @@ -123,7 +117,9 @@ namespace projections template <typename T, typename Parameters> struct fahey_spheroid : public detail::fahey::base_fahey_spheroid<T, Parameters> { - inline fahey_spheroid(const Parameters& par) : detail::fahey::base_fahey_spheroid<T, Parameters>(par) + template <typename Params> + inline fahey_spheroid(Params const& , Parameters const& par) + : detail::fahey::base_fahey_spheroid<T, Parameters>(par) { detail::fahey::setup_fahey(this->m_par); } @@ -134,23 +130,14 @@ namespace projections { // Static projection - BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::par4::fahey, fahey_spheroid, fahey_spheroid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_fahey, fahey_spheroid, fahey_spheroid) // Factory entry(s) - template <typename T, typename Parameters> - class fahey_entry : public detail::factory_entry<T, Parameters> - { - public : - virtual base_v<T, Parameters>* create_new(const Parameters& par) const - { - return new base_v_fi<fahey_spheroid<T, Parameters>, T, Parameters>(par); - } - }; - - template <typename T, typename Parameters> - inline void fahey_init(detail::base_factory<T, Parameters>& factory) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(fahey_entry, fahey_spheroid) + + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(fahey_init) { - factory.add_to_factory("fahey", new fahey_entry<T, Parameters>); + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(fahey, fahey_entry); } } // namespace detail diff --git a/boost/geometry/srs/projections/proj/fouc_s.hpp b/boost/geometry/srs/projections/proj/fouc_s.hpp index 580bc1804b..10a252ec27 100644 --- a/boost/geometry/srs/projections/proj/fouc_s.hpp +++ b/boost/geometry/srs/projections/proj/fouc_s.hpp @@ -51,12 +51,6 @@ namespace boost { namespace geometry { -namespace srs { namespace par4 -{ - struct fouc_s {}; // Foucaut Sinusoidal - -}} //namespace srs::par4 - namespace projections { #ifndef DOXYGEN_NO_DETAIL @@ -85,7 +79,7 @@ namespace projections // FORWARD(s_forward) spheroid // Project coordinates from geographic (lon, lat) to cartesian (x, y) - inline void fwd(T& lp_lon, T& lp_lat, T& xy_x, T& xy_y) const + inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const { T t; @@ -96,7 +90,7 @@ namespace projections // INVERSE(s_inverse) spheroid // Project coordinates from cartesian (x, y) to geographic (lon, lat) - inline void inv(T& xy_x, T& xy_y, T& lp_lon, T& lp_lat) const + inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const { static T const half_pi = detail::half_pi<T>(); @@ -127,11 +121,11 @@ namespace projections }; // Foucaut Sinusoidal - template <typename Parameters, typename T> - inline void setup_fouc_s(Parameters& par, par_fouc_s<T>& proj_parm) + template <typename Params, typename Parameters, typename T> + inline void setup_fouc_s(Params const& params, Parameters& par, par_fouc_s<T>& proj_parm) { - proj_parm.n = pj_get_param_f(par.params, "n"); - if (proj_parm.n < 0. || proj_parm.n > 1.) + proj_parm.n = pj_get_param_f<T, srs::spar::n>(params, "n", srs::dpar::n); + if ((proj_parm.n < 0.) || (proj_parm.n > 1.)) BOOST_THROW_EXCEPTION( projection_exception(error_n_out_of_range) ); proj_parm.n1 = 1. - proj_parm.n; @@ -158,9 +152,11 @@ namespace projections template <typename T, typename Parameters> struct fouc_s_spheroid : public detail::fouc_s::base_fouc_s_spheroid<T, Parameters> { - inline fouc_s_spheroid(const Parameters& par) : detail::fouc_s::base_fouc_s_spheroid<T, Parameters>(par) + template <typename Params> + inline fouc_s_spheroid(Params const& params, Parameters const& par) + : detail::fouc_s::base_fouc_s_spheroid<T, Parameters>(par) { - detail::fouc_s::setup_fouc_s(this->m_par, this->m_proj_parm); + detail::fouc_s::setup_fouc_s(params, this->m_par, this->m_proj_parm); } }; @@ -169,23 +165,14 @@ namespace projections { // Static projection - BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::par4::fouc_s, fouc_s_spheroid, fouc_s_spheroid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_fouc_s, fouc_s_spheroid, fouc_s_spheroid) // Factory entry(s) - template <typename T, typename Parameters> - class fouc_s_entry : public detail::factory_entry<T, Parameters> - { - public : - virtual base_v<T, Parameters>* create_new(const Parameters& par) const - { - return new base_v_fi<fouc_s_spheroid<T, Parameters>, T, Parameters>(par); - } - }; - - template <typename T, typename Parameters> - inline void fouc_s_init(detail::base_factory<T, Parameters>& factory) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(fouc_s_entry, fouc_s_spheroid) + + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(fouc_s_init) { - factory.add_to_factory("fouc_s", new fouc_s_entry<T, Parameters>); + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(fouc_s, fouc_s_entry); } } // namespace detail diff --git a/boost/geometry/srs/projections/proj/gall.hpp b/boost/geometry/srs/projections/proj/gall.hpp index 2c35c60985..5d2779945c 100644 --- a/boost/geometry/srs/projections/proj/gall.hpp +++ b/boost/geometry/srs/projections/proj/gall.hpp @@ -48,12 +48,6 @@ namespace boost { namespace geometry { -namespace srs { namespace par4 -{ - struct gall {}; // Gall (Gall Stereographic) - -}} //namespace srs::par4 - namespace projections { #ifndef DOXYGEN_NO_DETAIL @@ -76,7 +70,7 @@ namespace projections // FORWARD(s_forward) spheroid // Project coordinates from geographic (lon, lat) to cartesian (x, y) - inline void fwd(T& lp_lon, T& lp_lat, T& xy_x, T& xy_y) const + inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const { xy_x = XF * lp_lon; xy_y = YF * tan(.5 * lp_lat); @@ -84,7 +78,7 @@ namespace projections // INVERSE(s_inverse) spheroid // Project coordinates from cartesian (x, y) to geographic (lon, lat) - inline void inv(T& xy_x, T& xy_y, T& lp_lon, T& lp_lat) const + inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const { lp_lon = RXF * xy_x; lp_lat = 2. * atan(xy_y * RYF); @@ -122,7 +116,9 @@ namespace projections template <typename T, typename Parameters> struct gall_spheroid : public detail::gall::base_gall_spheroid<T, Parameters> { - inline gall_spheroid(const Parameters& par) : detail::gall::base_gall_spheroid<T, Parameters>(par) + template <typename Params> + inline gall_spheroid(Params const& , Parameters const& par) + : detail::gall::base_gall_spheroid<T, Parameters>(par) { detail::gall::setup_gall(this->m_par); } @@ -133,23 +129,14 @@ namespace projections { // Static projection - BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::par4::gall, gall_spheroid, gall_spheroid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_gall, gall_spheroid, gall_spheroid) // Factory entry(s) - template <typename T, typename Parameters> - class gall_entry : public detail::factory_entry<T, Parameters> - { - public : - virtual base_v<T, Parameters>* create_new(const Parameters& par) const - { - return new base_v_fi<gall_spheroid<T, Parameters>, T, Parameters>(par); - } - }; - - template <typename T, typename Parameters> - inline void gall_init(detail::base_factory<T, Parameters>& factory) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(gall_entry, gall_spheroid) + + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(gall_init) { - factory.add_to_factory("gall", new gall_entry<T, Parameters>); + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(gall, gall_entry); } } // namespace detail diff --git a/boost/geometry/srs/projections/proj/geocent.hpp b/boost/geometry/srs/projections/proj/geocent.hpp index 92fd8e1070..094feca585 100644 --- a/boost/geometry/srs/projections/proj/geocent.hpp +++ b/boost/geometry/srs/projections/proj/geocent.hpp @@ -54,12 +54,6 @@ namespace boost { namespace geometry { -namespace srs { namespace par4 -{ - struct geocent {}; // Geocentric - -}} //namespace srs::par4 - namespace projections { #ifndef DOXYGEN_NO_DETAIL @@ -77,7 +71,7 @@ namespace projections // FORWARD(forward) // Project coordinates from geographic (lon, lat) to cartesian (x, y) - inline void fwd(T& lp_lon, T& lp_lat, T& xy_x, T& xy_y) const + inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const { xy_x = lp_lon; xy_y = lp_lat; @@ -85,7 +79,7 @@ namespace projections // INVERSE(inverse) // Project coordinates from cartesian (x, y) to geographic (lon, lat) - inline void inv(T& xy_x, T& xy_y, T& lp_lon, T& lp_lat) const + inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const { lp_lat = xy_y; lp_lon = xy_x; @@ -122,7 +116,9 @@ namespace projections template <typename T, typename Parameters> struct geocent_other : public detail::geocent::base_geocent_other<T, Parameters> { - inline geocent_other(const Parameters& par) : detail::geocent::base_geocent_other<T, Parameters>(par) + template <typename Params> + inline geocent_other(Params const& , Parameters const& par) + : detail::geocent::base_geocent_other<T, Parameters>(par) { detail::geocent::setup_geocent(this->m_par); } @@ -133,23 +129,14 @@ namespace projections { // Static projection - BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::par4::geocent, geocent_other, geocent_other) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_geocent, geocent_other, geocent_other) // Factory entry(s) - template <typename T, typename Parameters> - class geocent_entry : public detail::factory_entry<T, Parameters> - { - public : - virtual base_v<T, Parameters>* create_new(const Parameters& par) const - { - return new base_v_fi<geocent_other<T, Parameters>, T, Parameters>(par); - } - }; - - template <typename T, typename Parameters> - inline void geocent_init(detail::base_factory<T, Parameters>& factory) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(geocent_entry, geocent_other) + + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(geocent_init) { - factory.add_to_factory("geocent", new geocent_entry<T, Parameters>); + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(geocent, geocent_entry); } } // namespace detail diff --git a/boost/geometry/srs/projections/proj/geos.hpp b/boost/geometry/srs/projections/proj/geos.hpp index 905411f766..f9f2901247 100644 --- a/boost/geometry/srs/projections/proj/geos.hpp +++ b/boost/geometry/srs/projections/proj/geos.hpp @@ -52,16 +52,11 @@ #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/impl/pj_param.hpp> namespace boost { namespace geometry { -namespace srs { namespace par4 -{ - struct geos {}; // Geostationary Satellite View - -}} //namespace srs::par4 - namespace projections { #ifndef DOXYGEN_NO_DETAIL @@ -77,7 +72,7 @@ namespace projections T radius_g; T radius_g_1; T C; - int flip_axis; + bool flip_axis; }; // template class, using CRTP to implement forward/inverse @@ -93,7 +88,7 @@ namespace projections // FORWARD(e_forward) ellipsoid // Project coordinates from geographic (lon, lat) to cartesian (x, y) - inline void fwd(T& lp_lon, T& lp_lat, T& xy_x, T& xy_y) const + inline void fwd(T const& lp_lon, T lp_lat, T& xy_x, T& xy_y) const { T r, Vx, Vy, Vz, tmp; @@ -126,7 +121,7 @@ namespace projections // INVERSE(e_inverse) ellipsoid // Project coordinates from cartesian (x, y) to geographic (lon, lat) - inline void inv(T& xy_x, T& xy_y, T& lp_lon, T& lp_lat) const + inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const { T Vx, Vy, Vz, a, b, det, k; @@ -181,7 +176,7 @@ namespace projections // FORWARD(s_forward) spheroid // Project coordinates from geographic (lon, lat) to cartesian (x, y) - inline void fwd(T& lp_lon, T& lp_lat, T& xy_x, T& xy_y) const + inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const { T Vx, Vy, Vz, tmp; @@ -211,7 +206,7 @@ namespace projections // INVERSE(s_inverse) spheroid // Project coordinates from cartesian (x, y) to geographic (lon, lat) - inline void inv(T& xy_x, T& xy_y, T& lp_lon, T& lp_lat) const + inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const { T Vx, Vy, Vz, a, b, det, k; @@ -250,30 +245,49 @@ namespace projections }; - // Geostationary Satellite View - template <typename Parameters, typename T> - inline void setup_geos(Parameters& par, par_geos<T>& proj_parm) + inline bool geos_flip_axis(srs::detail::proj4_parameters const& params) { - std::string sweep_axis; - - if ((proj_parm.h = pj_get_param_f(par.params, "h")) <= 0.) - BOOST_THROW_EXCEPTION( projection_exception(error_h_less_than_zero) ); - - if (par.phi0 != 0.0) - BOOST_THROW_EXCEPTION( projection_exception(error_unknown_prime_meridian) ); - - sweep_axis = pj_get_param_s(par.params, "sweep"); + std::string sweep_axis = pj_get_param_s(params, "sweep"); if (sweep_axis.empty()) - proj_parm.flip_axis = 0; + return false; else { if (sweep_axis[1] != '\0' || (sweep_axis[0] != 'x' && sweep_axis[0] != 'y')) BOOST_THROW_EXCEPTION( projection_exception(error_invalid_sweep_axis) ); if (sweep_axis[0] == 'x') - proj_parm.flip_axis = 1; + return true; else - proj_parm.flip_axis = 0; + return false; + } + } + + template <typename T> + inline bool geos_flip_axis(srs::dpar::parameters<T> const& params) + { + typename srs::dpar::parameters<T>::const_iterator + it = pj_param_find(params, srs::dpar::sweep); + if (it == params.end()) { + return false; + } else { + srs::dpar::value_sweep s = static_cast<srs::dpar::value_sweep>(it->template get_value<int>()); + return s == srs::dpar::sweep_x; } + } + + // Geostationary Satellite View + template <typename Params, typename Parameters, typename T> + inline void setup_geos(Params const& params, Parameters& par, par_geos<T>& proj_parm) + { + std::string sweep_axis; + + if ((proj_parm.h = pj_get_param_f<T, srs::spar::h>(params, "h", srs::dpar::h)) <= 0.) + BOOST_THROW_EXCEPTION( projection_exception(error_h_less_than_zero) ); + + if (par.phi0 != 0.0) + BOOST_THROW_EXCEPTION( projection_exception(error_unknown_prime_meridian) ); + + + proj_parm.flip_axis = geos_flip_axis(params); proj_parm.radius_g_1 = proj_parm.h / par.a; proj_parm.radius_g = 1. + proj_parm.radius_g_1; @@ -309,9 +323,11 @@ namespace projections template <typename T, typename Parameters> struct geos_ellipsoid : public detail::geos::base_geos_ellipsoid<T, Parameters> { - inline geos_ellipsoid(const Parameters& par) : detail::geos::base_geos_ellipsoid<T, Parameters>(par) + template <typename Params> + inline geos_ellipsoid(Params const& params, Parameters const& par) + : detail::geos::base_geos_ellipsoid<T, Parameters>(par) { - detail::geos::setup_geos(this->m_par, this->m_proj_parm); + detail::geos::setup_geos(params, this->m_par, this->m_proj_parm); } }; @@ -334,9 +350,11 @@ namespace projections template <typename T, typename Parameters> struct geos_spheroid : public detail::geos::base_geos_spheroid<T, Parameters> { - inline geos_spheroid(const Parameters& par) : detail::geos::base_geos_spheroid<T, Parameters>(par) + template <typename Params> + inline geos_spheroid(Params const& params, Parameters const& par) + : detail::geos::base_geos_spheroid<T, Parameters>(par) { - detail::geos::setup_geos(this->m_par, this->m_proj_parm); + detail::geos::setup_geos(params, this->m_par, this->m_proj_parm); } }; @@ -345,26 +363,14 @@ namespace projections { // Static projection - BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::par4::geos, geos_spheroid, geos_ellipsoid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_geos, geos_spheroid, geos_ellipsoid) // Factory entry(s) - template <typename T, typename Parameters> - class geos_entry : public detail::factory_entry<T, Parameters> - { - public : - virtual base_v<T, Parameters>* create_new(const Parameters& par) const - { - if (par.es) - return new base_v_fi<geos_ellipsoid<T, Parameters>, T, Parameters>(par); - else - return new base_v_fi<geos_spheroid<T, Parameters>, T, Parameters>(par); - } - }; - - template <typename T, typename Parameters> - inline void geos_init(detail::base_factory<T, Parameters>& factory) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI2(geos_entry, geos_spheroid, geos_ellipsoid) + + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(geos_init) { - factory.add_to_factory("geos", new geos_entry<T, Parameters>); + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(geos, geos_entry); } } // namespace detail diff --git a/boost/geometry/srs/projections/proj/gins8.hpp b/boost/geometry/srs/projections/proj/gins8.hpp index 5cdc933943..2e9088a2a5 100644 --- a/boost/geometry/srs/projections/proj/gins8.hpp +++ b/boost/geometry/srs/projections/proj/gins8.hpp @@ -48,12 +48,6 @@ namespace boost { namespace geometry { -namespace srs { namespace par4 -{ - struct gins8 {}; // Ginsburg VIII (TsNIIGAiK) - -}} //namespace srs::par4 - namespace projections { #ifndef DOXYGEN_NO_DETAIL @@ -78,7 +72,7 @@ namespace projections // FORWARD(s_forward) spheroid // Project coordinates from geographic (lon, lat) to cartesian (x, y) - inline void fwd(T& lp_lon, T& lp_lat, T& xy_x, T& xy_y) const + inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const { static const T C12 = gins8::C12<T>(); @@ -123,7 +117,9 @@ namespace projections template <typename T, typename Parameters> struct gins8_spheroid : public detail::gins8::base_gins8_spheroid<T, Parameters> { - inline gins8_spheroid(const Parameters& par) : detail::gins8::base_gins8_spheroid<T, Parameters>(par) + template <typename Params> + inline gins8_spheroid(Params const& , Parameters const& par) + : detail::gins8::base_gins8_spheroid<T, Parameters>(par) { detail::gins8::setup_gins8(this->m_par); } @@ -134,23 +130,14 @@ namespace projections { // Static projection - BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::par4::gins8, gins8_spheroid, gins8_spheroid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_gins8, gins8_spheroid, gins8_spheroid) // Factory entry(s) - template <typename T, typename Parameters> - class gins8_entry : public detail::factory_entry<T, Parameters> - { - public : - virtual base_v<T, Parameters>* create_new(const Parameters& par) const - { - return new base_v_f<gins8_spheroid<T, Parameters>, T, Parameters>(par); - } - }; - - template <typename T, typename Parameters> - inline void gins8_init(detail::base_factory<T, Parameters>& factory) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_F(gins8_entry, gins8_spheroid) + + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(gins8_init) { - factory.add_to_factory("gins8", new gins8_entry<T, Parameters>); + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(gins8, gins8_entry); } } // namespace detail diff --git a/boost/geometry/srs/projections/proj/gn_sinu.hpp b/boost/geometry/srs/projections/proj/gn_sinu.hpp index 2a8e82bdc5..b4218cc839 100644 --- a/boost/geometry/srs/projections/proj/gn_sinu.hpp +++ b/boost/geometry/srs/projections/proj/gn_sinu.hpp @@ -52,15 +52,6 @@ namespace boost { namespace geometry { -namespace srs { namespace par4 -{ - struct gn_sinu {}; // General Sinusoidal Series - struct sinu {}; // Sinusoidal (Sanson-Flamsteed) - struct eck6 {}; // Eckert VI - struct mbtfps {}; // McBryde-Thomas Flat-Polar Sinusoidal - -}} //namespace srs::par4 - namespace projections { #ifndef DOXYGEN_NO_DETAIL @@ -93,7 +84,7 @@ namespace projections // FORWARD(e_forward) ellipsoid // Project coordinates from geographic (lon, lat) to cartesian (x, y) - inline void fwd(T& lp_lon, T& lp_lat, T& xy_x, T& xy_y) const + inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const { T s, c; @@ -103,7 +94,7 @@ namespace projections // INVERSE(e_inverse) ellipsoid // Project coordinates from cartesian (x, y) to geographic (lon, lat) - inline void inv(T& xy_x, T& xy_y, T& lp_lon, T& lp_lat) const + inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const { static const T half_pi = detail::half_pi<T>(); @@ -139,7 +130,7 @@ namespace projections // FORWARD(s_forward) sphere // Project coordinates from geographic (lon, lat) to cartesian (x, y) - inline void fwd(T& lp_lon, T& lp_lat, T& xy_x, T& xy_y) const + inline void fwd(T const& lp_lon, T lp_lat, T& xy_x, T& xy_y) const { if (this->m_proj_parm.m == 0.0) lp_lat = this->m_proj_parm.n != 1. ? aasin(this->m_proj_parm.n * sin(lp_lat)): lp_lat; @@ -164,7 +155,7 @@ namespace projections // INVERSE(s_inverse) sphere // Project coordinates from cartesian (x, y) to geographic (lon, lat) - inline void inv(T& xy_x, T& xy_y, T& lp_lon, T& lp_lat) const + inline void inv(T const& xy_x, T xy_y, T& lp_lon, T& lp_lat) const { xy_y /= this->m_proj_parm.C_y; lp_lat = (this->m_proj_parm.m != 0.0) ? aasin((this->m_proj_parm.m * xy_y + sin(xy_y)) / this->m_proj_parm.n) : @@ -189,11 +180,11 @@ namespace projections // General Sinusoidal Series - template <typename Parameters, typename T> - inline void setup_gn_sinu(Parameters& par, par_gn_sinu<T>& proj_parm) + template <typename Params, typename Parameters, typename T> + inline void setup_gn_sinu(Params const& params, Parameters& par, par_gn_sinu<T>& proj_parm) { - if (pj_param_f(par.params, "n", proj_parm.n) - && pj_param_f(par.params, "m", proj_parm.m)) { + if (pj_param_f<srs::spar::n>(params, "n", srs::dpar::n, proj_parm.n) + && pj_param_f<srs::spar::m>(params, "m", srs::dpar::m, proj_parm.m)) { if (proj_parm.n <= 0 || proj_parm.m < 0) BOOST_THROW_EXCEPTION( projection_exception(error_invalid_m_or_n) ); } else @@ -256,9 +247,11 @@ namespace projections template <typename T, typename Parameters> struct gn_sinu_spheroid : public detail::gn_sinu::base_gn_sinu_spheroid<T, Parameters> { - inline gn_sinu_spheroid(const Parameters& par) : detail::gn_sinu::base_gn_sinu_spheroid<T, Parameters>(par) + template <typename Params> + inline gn_sinu_spheroid(Params const& params, Parameters const& par) + : detail::gn_sinu::base_gn_sinu_spheroid<T, Parameters>(par) { - detail::gn_sinu::setup_gn_sinu(this->m_par, this->m_proj_parm); + detail::gn_sinu::setup_gn_sinu(params, this->m_par, this->m_proj_parm); } }; @@ -278,7 +271,9 @@ namespace projections template <typename T, typename Parameters> struct sinu_ellipsoid : public detail::gn_sinu::base_gn_sinu_ellipsoid<T, Parameters> { - inline sinu_ellipsoid(const Parameters& par) : detail::gn_sinu::base_gn_sinu_ellipsoid<T, Parameters>(par) + template <typename Params> + inline sinu_ellipsoid(Params const& , Parameters const& par) + : detail::gn_sinu::base_gn_sinu_ellipsoid<T, Parameters>(par) { detail::gn_sinu::setup_sinu(this->m_par, this->m_proj_parm); } @@ -300,7 +295,9 @@ namespace projections template <typename T, typename Parameters> struct sinu_spheroid : public detail::gn_sinu::base_gn_sinu_spheroid<T, Parameters> { - inline sinu_spheroid(const Parameters& par) : detail::gn_sinu::base_gn_sinu_spheroid<T, Parameters>(par) + template <typename Params> + inline sinu_spheroid(Params const& , Parameters const& par) + : detail::gn_sinu::base_gn_sinu_spheroid<T, Parameters>(par) { detail::gn_sinu::setup_sinu(this->m_par, this->m_proj_parm); } @@ -321,7 +318,9 @@ namespace projections template <typename T, typename Parameters> struct eck6_spheroid : public detail::gn_sinu::base_gn_sinu_spheroid<T, Parameters> { - inline eck6_spheroid(const Parameters& par) : detail::gn_sinu::base_gn_sinu_spheroid<T, Parameters>(par) + template <typename Params> + inline eck6_spheroid(Params const& , Parameters const& par) + : detail::gn_sinu::base_gn_sinu_spheroid<T, Parameters>(par) { detail::gn_sinu::setup_eck6(this->m_par, this->m_proj_parm); } @@ -342,7 +341,9 @@ namespace projections template <typename T, typename Parameters> struct mbtfps_spheroid : public detail::gn_sinu::base_gn_sinu_spheroid<T, Parameters> { - inline mbtfps_spheroid(const Parameters& par) : detail::gn_sinu::base_gn_sinu_spheroid<T, Parameters>(par) + template <typename Params> + inline mbtfps_spheroid(Params const& , Parameters const& par) + : detail::gn_sinu::base_gn_sinu_spheroid<T, Parameters>(par) { detail::gn_sinu::setup_mbtfps(this->m_par, this->m_proj_parm); } @@ -353,62 +354,23 @@ namespace projections { // Static projection - BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::par4::gn_sinu, gn_sinu_spheroid, gn_sinu_spheroid) - BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::par4::sinu, sinu_spheroid, sinu_ellipsoid) - BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::par4::eck6, eck6_spheroid, eck6_spheroid) - BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::par4::mbtfps, mbtfps_spheroid, mbtfps_spheroid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_gn_sinu, gn_sinu_spheroid, gn_sinu_spheroid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_sinu, sinu_spheroid, sinu_ellipsoid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_eck6, eck6_spheroid, eck6_spheroid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_mbtfps, mbtfps_spheroid, mbtfps_spheroid) // Factory entry(s) - template <typename T, typename Parameters> - class gn_sinu_entry : public detail::factory_entry<T, Parameters> - { - public : - virtual base_v<T, Parameters>* create_new(const Parameters& par) const - { - return new base_v_fi<gn_sinu_spheroid<T, Parameters>, T, Parameters>(par); - } - }; - - template <typename T, typename Parameters> - class sinu_entry : public detail::factory_entry<T, Parameters> - { - public : - virtual base_v<T, Parameters>* create_new(const Parameters& par) const - { - if (par.es) - return new base_v_fi<sinu_ellipsoid<T, Parameters>, T, Parameters>(par); - else - return new base_v_fi<sinu_spheroid<T, Parameters>, T, Parameters>(par); - } - }; - - template <typename T, typename Parameters> - class eck6_entry : public detail::factory_entry<T, Parameters> - { - public : - virtual base_v<T, Parameters>* create_new(const Parameters& par) const - { - return new base_v_fi<eck6_spheroid<T, Parameters>, T, Parameters>(par); - } - }; - - template <typename T, typename Parameters> - class mbtfps_entry : public detail::factory_entry<T, Parameters> - { - public : - virtual base_v<T, Parameters>* create_new(const Parameters& par) const - { - return new base_v_fi<mbtfps_spheroid<T, Parameters>, T, Parameters>(par); - } - }; - - template <typename T, typename Parameters> - inline void gn_sinu_init(detail::base_factory<T, Parameters>& factory) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(gn_sinu_entry, gn_sinu_spheroid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI2(sinu_entry, sinu_spheroid, sinu_ellipsoid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(eck6_entry, eck6_spheroid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(mbtfps_entry, mbtfps_spheroid) + + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(gn_sinu_init) { - factory.add_to_factory("gn_sinu", new gn_sinu_entry<T, Parameters>); - factory.add_to_factory("sinu", new sinu_entry<T, Parameters>); - factory.add_to_factory("eck6", new eck6_entry<T, Parameters>); - factory.add_to_factory("mbtfps", new mbtfps_entry<T, Parameters>); + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(gn_sinu, gn_sinu_entry); + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(sinu, sinu_entry); + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(eck6, eck6_entry); + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(mbtfps, mbtfps_entry); } } // namespace detail diff --git a/boost/geometry/srs/projections/proj/gnom.hpp b/boost/geometry/srs/projections/proj/gnom.hpp index 9276391a76..6c9ca3a02c 100644 --- a/boost/geometry/srs/projections/proj/gnom.hpp +++ b/boost/geometry/srs/projections/proj/gnom.hpp @@ -52,12 +52,6 @@ namespace boost { namespace geometry { -namespace srs { namespace par4 -{ - struct gnom {}; - -}} //namespace srs::par4 - namespace projections { #ifndef DOXYGEN_NO_DETAIL @@ -93,7 +87,7 @@ namespace projections // FORWARD(s_forward) spheroid // Project coordinates from geographic (lon, lat) to cartesian (x, y) - inline void fwd(T& lp_lon, T& lp_lat, T& xy_x, T& xy_y) const + inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const { T coslam, cosphi, sinphi; @@ -139,7 +133,7 @@ namespace projections // INVERSE(s_inverse) spheroid // Project coordinates from cartesian (x, y) to geographic (lon, lat) - inline void inv(T& xy_x, T& xy_y, T& lp_lon, T& lp_lat) const + inline void inv(T xy_x, T xy_y, T& lp_lon, T& lp_lat) const { static const T half_pi = detail::half_pi<T>(); @@ -228,7 +222,9 @@ namespace projections template <typename T, typename Parameters> struct gnom_spheroid : public detail::gnom::base_gnom_spheroid<T, Parameters> { - inline gnom_spheroid(const Parameters& par) : detail::gnom::base_gnom_spheroid<T, Parameters>(par) + template <typename Params> + inline gnom_spheroid(Params const& , Parameters const& par) + : detail::gnom::base_gnom_spheroid<T, Parameters>(par) { detail::gnom::setup_gnom(this->m_par, this->m_proj_parm); } @@ -239,23 +235,14 @@ namespace projections { // Static projection - BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::par4::gnom, gnom_spheroid, gnom_spheroid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_gnom, gnom_spheroid, gnom_spheroid) // Factory entry(s) - template <typename T, typename Parameters> - class gnom_entry : public detail::factory_entry<T, Parameters> - { - public : - virtual base_v<T, Parameters>* create_new(const Parameters& par) const - { - return new base_v_fi<gnom_spheroid<T, Parameters>, T, Parameters>(par); - } - }; - - template <typename T, typename Parameters> - inline void gnom_init(detail::base_factory<T, Parameters>& factory) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(gnom_entry, gnom_spheroid) + + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(gnom_init) { - factory.add_to_factory("gnom", new gnom_entry<T, Parameters>); + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(gnom, gnom_entry); } } // namespace detail diff --git a/boost/geometry/srs/projections/proj/goode.hpp b/boost/geometry/srs/projections/proj/goode.hpp index 014c9328cf..b9cc034600 100644 --- a/boost/geometry/srs/projections/proj/goode.hpp +++ b/boost/geometry/srs/projections/proj/goode.hpp @@ -50,12 +50,6 @@ namespace boost { namespace geometry { -namespace srs { namespace par4 -{ - struct goode {}; // Goode Homolosine - -}} //namespace srs::par4 - namespace projections { #ifndef DOXYGEN_NO_DETAIL @@ -72,12 +66,15 @@ namespace projections sinu_spheroid<T, Par> sinu; moll_spheroid<T, Par> moll; - par_goode(Par const& par) : sinu(par), moll(par) {} + template <typename Params> + par_goode(Params const& params, Par const& par) + : sinu(params, par), moll(params, par) + {} }; template <typename T, typename Par> - inline void s_forward(T& lp_lon, T& lp_lat, T& xy_x, T& xy_y, - Par const& par, par_goode<T, Par> const& proj_par) + inline void s_forward(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y, + par_goode<T, Par> const& proj_par) { if (fabs(lp_lat) <= PHI_LIM) proj_par.sinu.fwd(lp_lon, lp_lat, xy_x, xy_y); @@ -88,8 +85,8 @@ namespace projections } template <typename T, typename Par> - inline void s_inverse(T& xy_x, T& xy_y, T& lp_lon, T& lp_lat, - Par const& par, par_goode<T, Par> const& proj_par) + inline void s_inverse(T const& xy_x, T xy_y, T& lp_lon, T& lp_lat, + par_goode<T, Par> const& proj_par) { if (fabs(xy_y) <= PHI_LIM) proj_par.sinu.inv(xy_x, xy_y, lp_lon, lp_lat); @@ -133,23 +130,24 @@ namespace projections { detail::goode::par_goode<T, Parameters> m_proj_parm; - inline goode_spheroid(const Parameters& par) + template <typename Params> + inline goode_spheroid(Params const& params, Parameters const& par) : detail::base_t_fi<goode_spheroid<T, Parameters>, T, Parameters>(*this, par) - , m_proj_parm(setup(this->m_par)) + , m_proj_parm(params, setup(this->m_par)) {} // FORWARD(s_forward) spheroid // Project coordinates from geographic (lon, lat) to cartesian (x, y) - inline void fwd(T& lp_lon, T& lp_lat, T& xy_x, T& xy_y) const + inline void fwd(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, this->m_par, this->m_proj_parm); + detail::goode::s_forward(lp_lon, lp_lat, xy_x, xy_y, this->m_proj_parm); } // INVERSE(s_inverse) spheroid // Project coordinates from cartesian (x, y) to geographic (lon, lat) - inline void inv(T& xy_x, T& xy_y, T& lp_lon, T& lp_lat) const + inline void inv(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, this->m_par, this->m_proj_parm); + detail::goode::s_inverse(xy_x, xy_y, lp_lon, lp_lat, this->m_proj_parm); } static inline std::string get_name() @@ -171,23 +169,14 @@ namespace projections { // Static projection - BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::par4::goode, goode_spheroid, goode_spheroid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_goode, goode_spheroid, goode_spheroid) // Factory entry(s) - template <typename T, typename Parameters> - class goode_entry : public detail::factory_entry<T, Parameters> - { - public : - virtual base_v<T, Parameters>* create_new(const Parameters& par) const - { - return new base_v_fi<goode_spheroid<T, Parameters>, T, Parameters>(par); - } - }; - - template <typename T, typename Parameters> - inline void goode_init(detail::base_factory<T, Parameters>& factory) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(goode_entry, goode_spheroid) + + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(goode_init) { - factory.add_to_factory("goode", new goode_entry<T, Parameters>); + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(goode, goode_entry); } } // namespace detail diff --git a/boost/geometry/srs/projections/proj/gstmerc.hpp b/boost/geometry/srs/projections/proj/gstmerc.hpp index 69751c503c..b53cb9d737 100644 --- a/boost/geometry/srs/projections/proj/gstmerc.hpp +++ b/boost/geometry/srs/projections/proj/gstmerc.hpp @@ -50,12 +50,6 @@ namespace boost { namespace geometry { -namespace srs { namespace par4 -{ - struct gstmerc {}; // Gauss-Schreiber Transverse Mercator (aka Gauss-Laborde Reunion) - -}} //namespace srs::par4 - namespace projections { #ifndef DOXYGEN_NO_DETAIL @@ -86,7 +80,7 @@ namespace projections // FORWARD(s_forward) spheroid // Project coordinates from geographic (lon, lat) to cartesian (x, y) - inline void fwd(T& lp_lon, T& lp_lat, T& xy_x, T& xy_y) const + inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const { T L, Ls, sinLs1, Ls1; @@ -100,7 +94,7 @@ namespace projections // INVERSE(s_inverse) spheroid // Project coordinates from cartesian (x, y) to geographic (lon, lat) - inline void inv(T& xy_x, T& xy_y, T& lp_lon, T& lp_lat) const + inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const { T L, LC, sinC; @@ -155,7 +149,9 @@ namespace projections template <typename T, typename Parameters> struct gstmerc_spheroid : public detail::gstmerc::base_gstmerc_spheroid<T, Parameters> { - inline gstmerc_spheroid(const Parameters& par) : detail::gstmerc::base_gstmerc_spheroid<T, Parameters>(par) + template <typename Params> + inline gstmerc_spheroid(Params const& , Parameters const& par) + : detail::gstmerc::base_gstmerc_spheroid<T, Parameters>(par) { detail::gstmerc::setup_gstmerc(this->m_par, this->m_proj_parm); } @@ -166,23 +162,14 @@ namespace projections { // Static projection - BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::par4::gstmerc, gstmerc_spheroid, gstmerc_spheroid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_gstmerc, gstmerc_spheroid, gstmerc_spheroid) // Factory entry(s) - template <typename T, typename Parameters> - class gstmerc_entry : public detail::factory_entry<T, Parameters> - { - public : - virtual base_v<T, Parameters>* create_new(const Parameters& par) const - { - return new base_v_fi<gstmerc_spheroid<T, Parameters>, T, Parameters>(par); - } - }; - - template <typename T, typename Parameters> - inline void gstmerc_init(detail::base_factory<T, Parameters>& factory) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(gstmerc_entry, gstmerc_spheroid) + + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(gstmerc_init) { - factory.add_to_factory("gstmerc", new gstmerc_entry<T, Parameters>); + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(gstmerc, gstmerc_entry); } } // namespace detail diff --git a/boost/geometry/srs/projections/proj/hammer.hpp b/boost/geometry/srs/projections/proj/hammer.hpp index 9fd5bd34b1..6518fd8245 100644 --- a/boost/geometry/srs/projections/proj/hammer.hpp +++ b/boost/geometry/srs/projections/proj/hammer.hpp @@ -48,12 +48,6 @@ namespace boost { namespace geometry { -namespace srs { namespace par4 -{ - struct hammer {}; // Hammer & Eckert-Greifendorff - -}} //namespace srs::par4 - namespace projections { #ifndef DOXYGEN_NO_DETAIL @@ -81,7 +75,7 @@ namespace projections // FORWARD(s_forward) spheroid // Project coordinates from geographic (lon, lat) to cartesian (x, y) - inline void fwd(T& lp_lon, T& lp_lat, T& xy_x, T& xy_y) const + inline void fwd(T lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const { T cosphi, d; @@ -92,7 +86,7 @@ namespace projections // INVERSE(s_inverse) spheroid // Project coordinates from cartesian (x, y) to geographic (lon, lat) - inline void inv(T& xy_x, T& xy_y, T& lp_lon, T& lp_lat) const + inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const { T z; @@ -115,17 +109,17 @@ namespace projections }; // Hammer & Eckert-Greifendorff - template <typename Parameters, typename T> - inline void setup_hammer(Parameters& par, par_hammer<T>& proj_parm) + template <typename Params, typename Parameters, typename T> + inline void setup_hammer(Params const& params, Parameters& par, par_hammer<T>& proj_parm) { T tmp; - if (pj_param_f(par.params, "W", tmp)) { + if (pj_param_f<srs::spar::w>(params, "W", srs::dpar::w, tmp)) { if ((proj_parm.w = fabs(tmp)) <= 0.) BOOST_THROW_EXCEPTION( projection_exception(error_w_or_m_zero_or_less) ); } else proj_parm.w = .5; - if (pj_param_f(par.params, "M", tmp)) { + if (pj_param_f<srs::spar::m>(params, "M", srs::dpar::m, tmp)) { if ((proj_parm.m = fabs(tmp)) <= 0.) BOOST_THROW_EXCEPTION( projection_exception(error_w_or_m_zero_or_less) ); } else @@ -159,9 +153,11 @@ namespace projections template <typename T, typename Parameters> struct hammer_spheroid : public detail::hammer::base_hammer_spheroid<T, Parameters> { - inline hammer_spheroid(const Parameters& par) : detail::hammer::base_hammer_spheroid<T, Parameters>(par) + template <typename Params> + inline hammer_spheroid(Params const& params, Parameters const& par) + : detail::hammer::base_hammer_spheroid<T, Parameters>(par) { - detail::hammer::setup_hammer(this->m_par, this->m_proj_parm); + detail::hammer::setup_hammer(params, this->m_par, this->m_proj_parm); } }; @@ -170,23 +166,14 @@ namespace projections { // Static projection - BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::par4::hammer, hammer_spheroid, hammer_spheroid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_hammer, hammer_spheroid, hammer_spheroid) // Factory entry(s) - template <typename T, typename Parameters> - class hammer_entry : public detail::factory_entry<T, Parameters> - { - public : - virtual base_v<T, Parameters>* create_new(const Parameters& par) const - { - return new base_v_fi<hammer_spheroid<T, Parameters>, T, Parameters>(par); - } - }; - - template <typename T, typename Parameters> - inline void hammer_init(detail::base_factory<T, Parameters>& factory) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(hammer_entry, hammer_spheroid) + + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(hammer_init) { - factory.add_to_factory("hammer", new hammer_entry<T, Parameters>); + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(hammer, hammer_entry) } } // namespace detail diff --git a/boost/geometry/srs/projections/proj/hatano.hpp b/boost/geometry/srs/projections/proj/hatano.hpp index 8392a2a3ca..f3ae7d07dc 100644 --- a/boost/geometry/srs/projections/proj/hatano.hpp +++ b/boost/geometry/srs/projections/proj/hatano.hpp @@ -50,12 +50,6 @@ namespace boost { namespace geometry { -namespace srs { namespace par4 -{ - struct hatano {}; // Hatano Asymmetrical Equal Area - -}} //namespace srs::par4 - namespace projections { #ifndef DOXYGEN_NO_DETAIL @@ -87,7 +81,7 @@ namespace projections // FORWARD(s_forward) spheroid // Project coordinates from geographic (lon, lat) to cartesian (x, y) - inline void fwd(T& lp_lon, T& lp_lat, T& xy_x, T& xy_y) const + inline void fwd(T const& lp_lon, T lp_lat, T& xy_x, T& xy_y) const { T th1, c; int i; @@ -103,7 +97,7 @@ namespace projections // INVERSE(s_inverse) spheroid // Project coordinates from cartesian (x, y) to geographic (lon, lat) - inline void inv(T& xy_x, T& xy_y, T& lp_lon, T& lp_lat) const + inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const { static T const half_pi = detail::half_pi<T>(); @@ -166,7 +160,9 @@ namespace projections template <typename T, typename Parameters> struct hatano_spheroid : public detail::hatano::base_hatano_spheroid<T, Parameters> { - inline hatano_spheroid(const Parameters& par) : detail::hatano::base_hatano_spheroid<T, Parameters>(par) + template <typename Params> + inline hatano_spheroid(Params const& , Parameters const& par) + : detail::hatano::base_hatano_spheroid<T, Parameters>(par) { detail::hatano::setup_hatano(this->m_par); } @@ -177,23 +173,14 @@ namespace projections { // Static projection - BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::par4::hatano, hatano_spheroid, hatano_spheroid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_hatano, hatano_spheroid, hatano_spheroid) // Factory entry(s) - template <typename T, typename Parameters> - class hatano_entry : public detail::factory_entry<T, Parameters> - { - public : - virtual base_v<T, Parameters>* create_new(const Parameters& par) const - { - return new base_v_fi<hatano_spheroid<T, Parameters>, T, Parameters>(par); - } - }; - - template <typename T, typename Parameters> - inline void hatano_init(detail::base_factory<T, Parameters>& factory) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(hatano_entry, hatano_spheroid) + + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(hatano_init) { - factory.add_to_factory("hatano", new hatano_entry<T, Parameters>); + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(hatano, hatano_entry) } } // namespace detail diff --git a/boost/geometry/srs/projections/proj/healpix.hpp b/boost/geometry/srs/projections/proj/healpix.hpp index 4615448192..414935c040 100644 --- a/boost/geometry/srs/projections/proj/healpix.hpp +++ b/boost/geometry/srs/projections/proj/healpix.hpp @@ -61,13 +61,6 @@ namespace boost { namespace geometry { -namespace srs { namespace par4 -{ - struct healpix {}; // HEALPix - struct rhealpix {}; // rHEALPix - -}} //namespace srs::par4 - namespace projections { #ifndef DOXYGEN_NO_DETAIL @@ -347,7 +340,7 @@ namespace projections * @param ret holds a + b. **/ template <typename T> - inline void vector_add(T a[2], T b[2], T *ret) + inline void vector_add(const T a[2], const T b[2], T ret[2]) { int i; for(i = 0; i < 2; i++) { @@ -359,7 +352,7 @@ namespace projections * @param ret holds a - b. **/ template <typename T> - inline void vector_sub(T a[2], T b[2], T*ret) + inline void vector_sub(const T a[2], const T b[2], T ret[2]) { int i; for(i = 0; i < 2; i++) { @@ -372,7 +365,7 @@ namespace projections * @param ret holds a*b. **/ template <typename T1, typename T2> - inline void dot_product(T1 a[2][2], T2 b[2], T2 *ret) + inline void dot_product(const T1 a[2][2], const T2 b[2], T2 ret[2]) { int i, j; int length = 2; @@ -565,7 +558,7 @@ namespace projections // FORWARD(e_healpix_forward) ellipsoid // Project coordinates from geographic (lon, lat) to cartesian (x, y) - inline void fwd(T& lp_lon, T& lp_lat, T& xy_x, T& xy_y) const + inline void fwd(T const& lp_lon, T lp_lat, T& xy_x, T& xy_y) const { lp_lat = auth_lat(this->params(), m_proj_parm, lp_lat, 0); return healpix_sphere(lp_lon, lp_lat, xy_x, xy_y); @@ -573,7 +566,7 @@ namespace projections // INVERSE(e_healpix_inverse) ellipsoid // Project coordinates from cartesian (x, y) to geographic (lon, lat) - inline void inv(T& xy_x, T& xy_y, T& lp_lon, T& lp_lat) const + inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const { /* Check whether (x, y) lies in the HEALPix image. */ if (in_image(xy_x, xy_y, 0, 0, 0) == 0) { @@ -605,14 +598,14 @@ namespace projections // FORWARD(s_healpix_forward) sphere // Project coordinates from geographic (lon, lat) to cartesian (x, y) - inline void fwd(T& lp_lon, T& lp_lat, T& xy_x, T& xy_y) const + inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const { return healpix_sphere(lp_lon, lp_lat, xy_x, xy_y); } // INVERSE(s_healpix_inverse) sphere // Project coordinates from cartesian (x, y) to geographic (lon, lat) - inline void inv(T& xy_x, T& xy_y, T& lp_lon, T& lp_lat) const + inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const { /* Check whether (x, y) lies in the HEALPix image */ if (in_image(xy_x, xy_y, 0, 0, 0) == 0) { @@ -643,7 +636,7 @@ namespace projections // FORWARD(e_rhealpix_forward) ellipsoid // Project coordinates from geographic (lon, lat) to cartesian (x, y) - inline void fwd(T& lp_lon, T& lp_lat, T& xy_x, T& xy_y) const + inline void fwd(T const& lp_lon, T lp_lat, T& xy_x, T& xy_y) const { lp_lat = auth_lat(this->params(), m_proj_parm, lp_lat, 0); healpix_sphere(lp_lon, lp_lat, xy_x, xy_y); @@ -652,7 +645,7 @@ namespace projections // INVERSE(e_rhealpix_inverse) ellipsoid // Project coordinates from cartesian (x, y) to geographic (lon, lat) - inline void inv(T& xy_x, T& xy_y, T& lp_lon, T& lp_lat) const + inline void inv(T xy_x, T xy_y, T& lp_lon, T& lp_lat) const { /* Check whether (x, y) lies in the rHEALPix image. */ if (in_image(xy_x, xy_y, 1, this->m_proj_parm.north_square, this->m_proj_parm.south_square) == 0) { @@ -685,7 +678,7 @@ namespace projections // FORWARD(s_rhealpix_forward) sphere // Project coordinates from geographic (lon, lat) to cartesian (x, y) - inline void fwd(T& lp_lon, T& lp_lat, T& xy_x, T& xy_y) const + inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const { healpix_sphere(lp_lon, lp_lat, xy_x, xy_y); combine_caps(xy_x, xy_y, this->m_proj_parm.north_square, this->m_proj_parm.south_square, 0); @@ -693,7 +686,7 @@ namespace projections // INVERSE(s_rhealpix_inverse) sphere // Project coordinates from cartesian (x, y) to geographic (lon, lat) - inline void inv(T& xy_x, T& xy_y, T& lp_lon, T& lp_lat) const + inline void inv(T xy_x, T xy_y, T& lp_lon, T& lp_lat) const { /* Check whether (x, y) lies in the rHEALPix image. */ if (in_image(xy_x, xy_y, 1, this->m_proj_parm.north_square, this->m_proj_parm.south_square) == 0) { @@ -726,16 +719,16 @@ namespace projections } // rHEALPix - template <typename Parameters, typename T> - inline void setup_rhealpix(Parameters& par, par_healpix<T>& proj_parm) + template <typename Params, typename Parameters, typename T> + inline void setup_rhealpix(Params const& params, Parameters& par, par_healpix<T>& proj_parm) { - proj_parm.north_square = pj_get_param_i(par.params, "north_square"); - proj_parm.south_square = pj_get_param_i(par.params, "south_square"); + proj_parm.north_square = pj_get_param_i<srs::spar::north_square>(params, "north_square", srs::dpar::north_square); + proj_parm.south_square = pj_get_param_i<srs::spar::south_square>(params, "south_square", srs::dpar::south_square); /* Check for valid north_square and south_square inputs. */ - if (proj_parm.north_square < 0 || proj_parm.north_square > 3) { + if ((proj_parm.north_square < 0) || (proj_parm.north_square > 3)) { BOOST_THROW_EXCEPTION( projection_exception(error_axis) ); } - if (proj_parm.south_square < 0 || proj_parm.south_square > 3) { + if ((proj_parm.south_square < 0) || (proj_parm.south_square > 3)) { BOOST_THROW_EXCEPTION( projection_exception(error_axis) ); } if (par.es != 0.0) { @@ -767,7 +760,9 @@ namespace projections template <typename T, typename Parameters> struct healpix_ellipsoid : public detail::healpix::base_healpix_ellipsoid<T, Parameters> { - inline healpix_ellipsoid(const Parameters& par) : detail::healpix::base_healpix_ellipsoid<T, Parameters>(par) + template <typename Params> + inline healpix_ellipsoid(Params const& , Parameters const& par) + : detail::healpix::base_healpix_ellipsoid<T, Parameters>(par) { detail::healpix::setup_healpix(this->m_par, this->m_proj_parm); } @@ -788,7 +783,9 @@ namespace projections template <typename T, typename Parameters> struct healpix_spheroid : public detail::healpix::base_healpix_spheroid<T, Parameters> { - inline healpix_spheroid(const Parameters& par) : detail::healpix::base_healpix_spheroid<T, Parameters>(par) + template <typename Params> + inline healpix_spheroid(Params const& , Parameters const& par) + : detail::healpix::base_healpix_spheroid<T, Parameters>(par) { detail::healpix::setup_healpix(this->m_par, this->m_proj_parm); } @@ -812,9 +809,11 @@ namespace projections template <typename T, typename Parameters> struct rhealpix_ellipsoid : public detail::healpix::base_rhealpix_ellipsoid<T, Parameters> { - inline rhealpix_ellipsoid(const Parameters& par) : detail::healpix::base_rhealpix_ellipsoid<T, Parameters>(par) + template <typename Params> + inline rhealpix_ellipsoid(Params const& params, Parameters const& par) + : detail::healpix::base_rhealpix_ellipsoid<T, Parameters>(par) { - detail::healpix::setup_rhealpix(this->m_par, this->m_proj_parm); + detail::healpix::setup_rhealpix(params, this->m_par, this->m_proj_parm); } }; @@ -836,9 +835,11 @@ namespace projections template <typename T, typename Parameters> struct rhealpix_spheroid : public detail::healpix::base_rhealpix_spheroid<T, Parameters> { - inline rhealpix_spheroid(const Parameters& par) : detail::healpix::base_rhealpix_spheroid<T, Parameters>(par) + template <typename Params> + inline rhealpix_spheroid(Params const& params, Parameters const& par) + : detail::healpix::base_rhealpix_spheroid<T, Parameters>(par) { - detail::healpix::setup_rhealpix(this->m_par, this->m_proj_parm); + detail::healpix::setup_rhealpix(params, this->m_par, this->m_proj_parm); } }; @@ -847,41 +848,17 @@ namespace projections { // Static projection - BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::par4::healpix, healpix_spheroid, healpix_ellipsoid) - BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::par4::rhealpix, rhealpix_spheroid, rhealpix_ellipsoid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_healpix, healpix_spheroid, healpix_ellipsoid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_rhealpix, rhealpix_spheroid, rhealpix_ellipsoid) // Factory entry(s) - template <typename T, typename Parameters> - class healpix_entry : public detail::factory_entry<T, Parameters> - { - public : - virtual base_v<T, Parameters>* create_new(const Parameters& par) const - { - if (par.es) - return new base_v_fi<healpix_ellipsoid<T, Parameters>, T, Parameters>(par); - else - return new base_v_fi<healpix_spheroid<T, Parameters>, T, Parameters>(par); - } - }; - - template <typename T, typename Parameters> - class rhealpix_entry : public detail::factory_entry<T, Parameters> - { - public : - virtual base_v<T, Parameters>* create_new(const Parameters& par) const - { - if (par.es) - return new base_v_fi<rhealpix_ellipsoid<T, Parameters>, T, Parameters>(par); - else - return new base_v_fi<rhealpix_spheroid<T, Parameters>, T, Parameters>(par); - } - }; - - template <typename T, typename Parameters> - inline void healpix_init(detail::base_factory<T, Parameters>& factory) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI2(healpix_entry, healpix_spheroid, healpix_ellipsoid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI2(rhealpix_entry, rhealpix_spheroid, rhealpix_ellipsoid) + + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(healpix_init) { - factory.add_to_factory("healpix", new healpix_entry<T, Parameters>); - factory.add_to_factory("rhealpix", new rhealpix_entry<T, Parameters>); + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(healpix, healpix_entry) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(rhealpix, rhealpix_entry) } } // namespace detail diff --git a/boost/geometry/srs/projections/proj/igh.hpp b/boost/geometry/srs/projections/proj/igh.hpp index 6661863c91..6403d74123 100644 --- a/boost/geometry/srs/projections/proj/igh.hpp +++ b/boost/geometry/srs/projections/proj/igh.hpp @@ -53,12 +53,6 @@ namespace boost { namespace geometry { -namespace srs { namespace par4 -{ - struct igh {}; // Interrupted Goode Homolosine - -}} //namespace srs::par4 - namespace projections { #ifndef DOXYGEN_NO_DETAIL @@ -105,16 +99,16 @@ namespace projections static const double epsilon = 1.e-10; // allow a little 'slack' on zone edge positions // Converted from #define SETUP(n, proj, x_0, y_0, lon_0) - template <template <typename, typename> class Entry, typename Parameters, typename T> - inline void do_setup(int n, Parameters const& par, par_igh<T, Parameters>& proj_parm, + template <template <typename, typename, typename> class Entry, typename Params, typename Parameters, typename T> + inline void do_setup(int n, Params const& params, Parameters const& par, par_igh<T, Parameters>& proj_parm, T const& x_0, T const& y_0, T const& lon_0) { // NOTE: in the original proj4 these projections are initialized // with zeroed parameters which could be done here as well instead // of initializing with parent projection's parameters. - Entry<T, Parameters> entry; - proj_parm.pj[n-1].reset(entry.create_new(par)); + Entry<Params, T, Parameters> entry; + proj_parm.pj[n-1].reset(entry.create_new(params, par)); proj_parm.pj[n-1]->mutable_params().x0 = x_0; proj_parm.pj[n-1]->mutable_params().y0 = y_0; proj_parm.pj[n-1]->mutable_params().lam0 = lon_0; @@ -133,7 +127,7 @@ namespace projections // FORWARD(s_forward) spheroid // Project coordinates from geographic (lon, lat) to cartesian (x, y) - inline void fwd(T& lp_lon, T& lp_lat, T& xy_x, T& xy_y) const + inline void fwd(T lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const { static const T d4044118 = igh::d4044118<T>(); static const T d20 = igh::d20<T>(); @@ -169,7 +163,7 @@ namespace projections // INVERSE(s_inverse) spheroid // Project coordinates from cartesian (x, y) to geographic (lon, lat) - inline void inv(T& xy_x, T& xy_y, T& lp_lon, T& lp_lat) const + inline void inv(T xy_x, T xy_y, T& lp_lon, T& lp_lat) const { static const T d4044118 = igh::d4044118<T>(); static const T d10 = igh::d10<T>(); @@ -252,8 +246,8 @@ namespace projections }; // Interrupted Goode Homolosine - template <typename T, typename Parameters> - inline void setup_igh(Parameters& par, par_igh<T, Parameters>& proj_parm) + template <typename Params, typename Parameters, typename T> + inline void setup_igh(Params const& params, Parameters& par, par_igh<T, Parameters>& proj_parm) { static const T d0 = 0; static const T d4044118 = igh::d4044118<T>(); @@ -296,15 +290,15 @@ namespace projections par.es = 0.; // sinusoidal zones - do_setup<sinu_entry>(3, par, proj_parm, -d100, d0, -d100); - do_setup<sinu_entry>(4, par, proj_parm, d30, d0, d30); - do_setup<sinu_entry>(5, par, proj_parm, -d160, d0, -d160); - do_setup<sinu_entry>(6, par, proj_parm, -d60, d0, -d60); - do_setup<sinu_entry>(7, par, proj_parm, d20, d0, d20); - do_setup<sinu_entry>(8, par, proj_parm, d140, d0, d140); + do_setup<sinu_entry>(3, params, par, proj_parm, -d100, d0, -d100); + do_setup<sinu_entry>(4, params, par, proj_parm, d30, d0, d30); + do_setup<sinu_entry>(5, params, par, proj_parm, -d160, d0, -d160); + do_setup<sinu_entry>(6, params, par, proj_parm, -d60, d0, -d60); + do_setup<sinu_entry>(7, params, par, proj_parm, d20, d0, d20); + do_setup<sinu_entry>(8, params, par, proj_parm, d140, d0, d140); // mollweide zones - do_setup<moll_entry>(1, par, proj_parm, -d100, d0, -d100); + do_setup<moll_entry>(1, params, par, proj_parm, -d100, d0, -d100); // y0 ? proj_parm.pj[0]->fwd(lp_lam, lp_phi, xy1_x, xy1_y); // zone 1 @@ -315,11 +309,11 @@ namespace projections proj_parm.pj[0]->mutable_params().y0 = proj_parm.dy0; // mollweide zones (cont'd) - do_setup<moll_entry>( 2, par, proj_parm, d30, proj_parm.dy0, d30); - do_setup<moll_entry>( 9, par, proj_parm, -d160, -proj_parm.dy0, -d160); - do_setup<moll_entry>(10, par, proj_parm, -d60, -proj_parm.dy0, -d60); - do_setup<moll_entry>(11, par, proj_parm, d20, -proj_parm.dy0, d20); - do_setup<moll_entry>(12, par, proj_parm, d140, -proj_parm.dy0, d140); + do_setup<moll_entry>( 2, params, par, proj_parm, d30, proj_parm.dy0, d30); + do_setup<moll_entry>( 9, params, par, proj_parm, -d160, -proj_parm.dy0, -d160); + do_setup<moll_entry>(10, params, par, proj_parm, -d60, -proj_parm.dy0, -d60); + do_setup<moll_entry>(11, params, par, proj_parm, d20, -proj_parm.dy0, d20); + do_setup<moll_entry>(12, params, par, proj_parm, d140, -proj_parm.dy0, d140); // Already done before //par.es = 0.; @@ -343,9 +337,11 @@ namespace projections template <typename T, typename Parameters> struct igh_spheroid : public detail::igh::base_igh_spheroid<T, Parameters> { - inline igh_spheroid(const Parameters& par) : detail::igh::base_igh_spheroid<T, Parameters>(par) + template <typename Params> + inline igh_spheroid(Params const& params, Parameters const& par) + : detail::igh::base_igh_spheroid<T, Parameters>(par) { - detail::igh::setup_igh(this->m_par, this->m_proj_parm); + detail::igh::setup_igh(params, this->m_par, this->m_proj_parm); } }; @@ -354,23 +350,14 @@ namespace projections { // Static projection - BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::par4::igh, igh_spheroid, igh_spheroid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_igh, igh_spheroid, igh_spheroid) // Factory entry(s) - template <typename T, typename Parameters> - class igh_entry : public detail::factory_entry<T, Parameters> - { - public : - virtual base_v<T, Parameters>* create_new(const Parameters& par) const - { - return new base_v_fi<igh_spheroid<T, Parameters>, T, Parameters>(par); - } - }; + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(igh_entry, igh_spheroid) - template <typename T, typename Parameters> - inline void igh_init(detail::base_factory<T, Parameters>& factory) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(igh_init) { - factory.add_to_factory("igh", new igh_entry<T, Parameters>); + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(igh, igh_entry) } } // namespace detail diff --git a/boost/geometry/srs/projections/proj/imw_p.hpp b/boost/geometry/srs/projections/proj/imw_p.hpp index 78bd10d63b..f5f662406f 100644 --- a/boost/geometry/srs/projections/proj/imw_p.hpp +++ b/boost/geometry/srs/projections/proj/imw_p.hpp @@ -51,12 +51,6 @@ namespace boost { namespace geometry { -namespace srs { namespace par4 -{ - struct imw_p {}; // International Map of the World Polyconic - -}} //namespace srs::par4 - namespace projections { #ifndef DOXYGEN_NO_DETAIL @@ -84,14 +78,14 @@ namespace projections mode_type mode; }; - template <typename Parameters, typename T> - inline int - phi12(Parameters& par, par_imw_p<T>& proj_parm, T *del, T *sig) + template <typename Params, typename T> + inline int phi12(Params const& params, + par_imw_p<T> & proj_parm, T *del, T *sig) { int err = 0; - if (!pj_param_r(par.params, "lat_1", proj_parm.phi_1) || - !pj_param_r(par.params, "lat_2", proj_parm.phi_2)) { + if (!pj_param_r<srs::spar::lat_1>(params, "lat_1", srs::dpar::lat_1, proj_parm.phi_1) || + !pj_param_r<srs::spar::lat_2>(params, "lat_2", srs::dpar::lat_2, proj_parm.phi_2)) { err = -41; } else { //proj_parm.phi_1 = pj_get_param_r(par.params, "lat_1"); // set above @@ -103,8 +97,10 @@ namespace projections return err; } template <typename Parameters, typename T> - inline point_xy<T> - loc_for(T const& lp_lam, T const& lp_phi, Parameters const& par, par_imw_p<T> const& proj_parm, T *yc) + inline point_xy<T> loc_for(T const& lp_lam, T const& lp_phi, + Parameters const& par, + par_imw_p<T> const& proj_parm, + T *yc) { point_xy<T> xy; @@ -152,8 +148,9 @@ namespace projections return (xy); } template <typename Parameters, typename T> - inline void - xy(Parameters const& par, par_imw_p<T> const& proj_parm, T const& phi, T *x, T *y, T *sp, T *R) + inline void xy(Parameters const& par, par_imw_p<T> const& proj_parm, + T const& phi, + T *x, T *y, T *sp, T *R) { T F; @@ -177,7 +174,7 @@ namespace projections // FORWARD(e_forward) ellipsoid // Project coordinates from geographic (lon, lat) to cartesian (x, y) - inline void fwd(T& lp_lon, T& lp_lat, T& xy_x, T& xy_y) const + inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const { T yc = 0; point_xy<T> xy = loc_for(lp_lon, lp_lat, this->m_par, m_proj_parm, &yc); @@ -186,7 +183,7 @@ namespace projections // INVERSE(e_inverse) ellipsoid // Project coordinates from cartesian (x, y) to geographic (lon, lat) - inline void inv(T& xy_x, T& xy_y, T& lp_lon, T& lp_lat) const + inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const { point_xy<T> t; T yc = 0.0; @@ -217,21 +214,21 @@ namespace projections }; // International Map of the World Polyconic - template <typename Parameters, typename T> - inline void setup_imw_p(Parameters& par, par_imw_p<T>& proj_parm) + template <typename Params, typename Parameters, typename T> + inline void setup_imw_p(Params const& params, Parameters const& par, par_imw_p<T>& proj_parm) { T del, sig, s, t, x1, x2, T2, y1, m1, m2, y2; int err; proj_parm.en = pj_enfn<T>(par.es); - if( (err = phi12(par, proj_parm, &del, &sig)) != 0) + if( (err = phi12(params, proj_parm, &del, &sig)) != 0) BOOST_THROW_EXCEPTION( projection_exception(err) ); if (proj_parm.phi_2 < proj_parm.phi_1) { /* make sure proj_parm.phi_1 most southerly */ del = proj_parm.phi_1; proj_parm.phi_1 = proj_parm.phi_2; proj_parm.phi_2 = del; } - if (pj_param_r(par.params, "lon_1", proj_parm.lam_1)) { + if (pj_param_r<srs::spar::lon_1>(params, "lon_1", srs::dpar::lon_1, proj_parm.lam_1)) { /* empty */ } else { /* use predefined based upon latitude */ sig = fabs(sig * geometry::math::r2d<T>()); @@ -290,9 +287,11 @@ namespace projections template <typename T, typename Parameters> struct imw_p_ellipsoid : public detail::imw_p::base_imw_p_ellipsoid<T, Parameters> { - inline imw_p_ellipsoid(const Parameters& par) : detail::imw_p::base_imw_p_ellipsoid<T, Parameters>(par) + template <typename Params> + inline imw_p_ellipsoid(Params const& params, Parameters const& par) + : detail::imw_p::base_imw_p_ellipsoid<T, Parameters>(par) { - detail::imw_p::setup_imw_p(this->m_par, this->m_proj_parm); + detail::imw_p::setup_imw_p(params, this->m_par, this->m_proj_parm); } }; @@ -301,23 +300,14 @@ namespace projections { // Static projection - BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::par4::imw_p, imw_p_ellipsoid, imw_p_ellipsoid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_imw_p, imw_p_ellipsoid, imw_p_ellipsoid) // Factory entry(s) - template <typename T, typename Parameters> - class imw_p_entry : public detail::factory_entry<T, Parameters> - { - public : - virtual base_v<T, Parameters>* create_new(const Parameters& par) const - { - return new base_v_fi<imw_p_ellipsoid<T, Parameters>, T, Parameters>(par); - } - }; - - template <typename T, typename Parameters> - inline void imw_p_init(detail::base_factory<T, Parameters>& factory) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(imw_p_entry, imw_p_ellipsoid) + + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(imw_p_init) { - factory.add_to_factory("imw_p", new imw_p_entry<T, Parameters>); + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(imw_p, imw_p_entry) } } // namespace detail diff --git a/boost/geometry/srs/projections/proj/isea.hpp b/boost/geometry/srs/projections/proj/isea.hpp index 6ae803b65e..d3f53a7754 100644 --- a/boost/geometry/srs/projections/proj/isea.hpp +++ b/boost/geometry/srs/projections/proj/isea.hpp @@ -46,6 +46,8 @@ #include <sstream> #include <boost/core/ignore_unused.hpp> + +#include <boost/geometry/core/assert.hpp> #include <boost/geometry/util/math.hpp> #include <boost/geometry/srs/projections/impl/base_static.hpp> @@ -56,12 +58,6 @@ namespace boost { namespace geometry { -namespace srs { namespace par4 -{ - struct isea {}; - -}} //namespace srs::par4 - namespace projections { #ifndef DOXYGEN_NO_DETAIL @@ -202,8 +198,8 @@ namespace projections //enum isea_poly { isea_none = 0, isea_icosahedron = 20 }; //enum isea_topology { isea_hexagon=6, isea_triangle=3, isea_diamond=4 }; enum isea_address_form { - isea_addr_geo, isea_addr_q2di, isea_addr_seqnum, - isea_addr_interleave, isea_addr_plane, isea_addr_q2dd, + /*isea_addr_geo,*/ isea_addr_q2di, isea_addr_seqnum, + /*isea_addr_interleave,*/ isea_addr_plane, isea_addr_q2dd, isea_addr_projtri, isea_addr_vertex2dd, isea_addr_hex }; @@ -1074,30 +1070,34 @@ namespace projections out.y += 2.0 * .14433756729740644112; switch (g->output) { - case isea_addr_projtri: - /* nothing to do, already in projected triangle */ - break; - case isea_addr_vertex2dd: - g->quad = isea_ptdd(tri, &out); - break; - case isea_addr_q2dd: - /* Same as above, we just don't print as much */ - g->quad = isea_ptdd(tri, &out); - break; - case isea_addr_q2di: - g->quad = isea_ptdi(g, tri, &out, &coord); - return coord; - break; - case isea_addr_seqnum: - isea_ptdi(g, tri, &out, &coord); - /* disn will set g->serial */ - isea_disn(g, g->quad, &coord); - return coord; - break; - case isea_addr_hex: - isea_hex(g, tri, &out, &coord); - return coord; - break; + case isea_addr_projtri: + /* nothing to do, already in projected triangle */ + break; + case isea_addr_vertex2dd: + g->quad = isea_ptdd(tri, &out); + break; + case isea_addr_q2dd: + /* Same as above, we just don't print as much */ + g->quad = isea_ptdd(tri, &out); + break; + case isea_addr_q2di: + g->quad = isea_ptdi(g, tri, &out, &coord); + return coord; + break; + case isea_addr_seqnum: + isea_ptdi(g, tri, &out, &coord); + /* disn will set g->serial */ + isea_disn(g, g->quad, &coord); + return coord; + break; + case isea_addr_hex: + isea_hex(g, tri, &out, &coord); + return coord; + break; + default: + // isea_addr_plane handled above + BOOST_GEOMETRY_ASSERT(false); + break; } return out; @@ -1125,7 +1125,7 @@ namespace projections // FORWARD(s_forward) // Project coordinates from geographic (lon, lat) to cartesian (x, y) - inline void fwd(T& lp_lon, T& lp_lat, T& xy_x, T& xy_y) const + inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const { isea_pt<T> out; isea_geo<T> in; @@ -1147,19 +1147,11 @@ namespace projections }; - // Icosahedral Snyder Equal Area - template <typename Parameters, typename T> - inline void setup_isea(Parameters& par, par_isea<T>& proj_parm) + template <typename T> + inline void isea_orient_init(srs::detail::proj4_parameters const& params, + par_isea<T>& proj_parm) { - std::string opt; - - isea_grid_init(&proj_parm.dgg); - - proj_parm.dgg.output = isea_addr_plane; - /* proj_parm.dgg.radius = par.a; / * otherwise defaults to 1 */ - /* calling library will scale, I think */ - - opt = pj_get_param_s(par.params, "orient"); + std::string opt = pj_get_param_s(params, "orient"); if (! opt.empty()) { if (opt == std::string("isea")) { isea_orient_isea(&proj_parm.dgg); @@ -1169,46 +1161,104 @@ namespace projections BOOST_THROW_EXCEPTION( projection_exception(error_ellipsoid_use_required) ); } } + } - pj_param_r(par.params, "azi", proj_parm.dgg.o_az); - pj_param_r(par.params, "lon_0", proj_parm.dgg.o_lon); - pj_param_r(par.params, "lat_0", proj_parm.dgg.o_lat); - // TODO: this parameter is set below second time - pj_param_i(par.params, "aperture", proj_parm.dgg.aperture); - // TODO: this parameter is set below second time - pj_param_i(par.params, "resolution", proj_parm.dgg.resolution); - - opt = pj_get_param_s(par.params, "mode"); + template <typename T> + inline void isea_orient_init(srs::dpar::parameters<T> const& params, + par_isea<T>& proj_parm) + { + typename srs::dpar::parameters<T>::const_iterator + it = pj_param_find(params, srs::dpar::orient); + if (it != params.end()) { + srs::dpar::value_orient o = static_cast<srs::dpar::value_orient>(it->template get_value<int>()); + if (o == srs::dpar::orient_isea) { + isea_orient_isea(&proj_parm.dgg); + } else if (o == srs::dpar::orient_pole) { + isea_orient_pole(&proj_parm.dgg); + } else { + BOOST_THROW_EXCEPTION( projection_exception(error_ellipsoid_use_required) ); + } + } + } + + template <typename T> + inline void isea_mode_init(srs::detail::proj4_parameters const& params, + par_isea<T>& proj_parm) + { + std::string opt = pj_get_param_s(params, "mode"); if (! opt.empty()) { if (opt == std::string("plane")) { proj_parm.dgg.output = isea_addr_plane; } else if (opt == std::string("di")) { proj_parm.dgg.output = isea_addr_q2di; - } - else if (opt == std::string("dd")) { + } else if (opt == std::string("dd")) { proj_parm.dgg.output = isea_addr_q2dd; - } - else if (opt == std::string("hex")) { + } else if (opt == std::string("hex")) { proj_parm.dgg.output = isea_addr_hex; + } else { + BOOST_THROW_EXCEPTION( projection_exception(error_ellipsoid_use_required) ); } - else { - /* TODO verify error code. Possibly eliminate magic */ + } + } + + template <typename T> + inline void isea_mode_init(srs::dpar::parameters<T> const& params, + par_isea<T>& proj_parm) + { + typename srs::dpar::parameters<T>::const_iterator + it = pj_param_find(params, srs::dpar::mode); + if (it != params.end()) { + srs::dpar::value_mode m = static_cast<srs::dpar::value_mode>(it->template get_value<int>()); + if (m == srs::dpar::mode_plane) { + proj_parm.dgg.output = isea_addr_plane; + } else if (m == srs::dpar::mode_di) { + proj_parm.dgg.output = isea_addr_q2di; + } else if (m == srs::dpar::mode_dd) { + proj_parm.dgg.output = isea_addr_q2dd; + } else if (m == srs::dpar::mode_hex) { + proj_parm.dgg.output = isea_addr_hex; + } else { BOOST_THROW_EXCEPTION( projection_exception(error_ellipsoid_use_required) ); } } + } + + // Icosahedral Snyder Equal Area + template <typename Params, typename T> + inline void setup_isea(Params const& params, par_isea<T>& proj_parm) + { + std::string opt; + + isea_grid_init(&proj_parm.dgg); + + proj_parm.dgg.output = isea_addr_plane; + /* proj_parm.dgg.radius = par.a; / * otherwise defaults to 1 */ + /* calling library will scale, I think */ + + isea_orient_init(params, proj_parm); + + pj_param_r<srs::spar::azi>(params, "azi", srs::dpar::azi, proj_parm.dgg.o_az); + pj_param_r<srs::spar::lon_0>(params, "lon_0", srs::dpar::lon_0, proj_parm.dgg.o_lon); + pj_param_r<srs::spar::lat_0>(params, "lat_0", srs::dpar::lat_0, proj_parm.dgg.o_lat); + // TODO: this parameter is set below second time + pj_param_i<srs::spar::aperture>(params, "aperture", srs::dpar::aperture, proj_parm.dgg.aperture); + // TODO: this parameter is set below second time + pj_param_i<srs::spar::resolution>(params, "resolution", srs::dpar::resolution, proj_parm.dgg.resolution); + + isea_mode_init(params, proj_parm); // TODO: pj_param_exists -> pj_get_param_b ? - if (pj_param_exists(par.params, "rescale")) { + if (pj_param_exists<srs::spar::rescale>(params, "rescale", srs::dpar::rescale)) { proj_parm.dgg.radius = isea_scale; } - if (pj_param_i(par.params, "resolution", proj_parm.dgg.resolution)) { + if (pj_param_i<srs::spar::resolution>(params, "resolution", srs::dpar::resolution, proj_parm.dgg.resolution)) { /* empty */ } else { proj_parm.dgg.resolution = 4; } - if (pj_param_i(par.params, "aperture", proj_parm.dgg.aperture)) { + if (pj_param_i<srs::spar::aperture>(params, "aperture", srs::dpar::aperture, proj_parm.dgg.aperture)) { /* empty */ } else { proj_parm.dgg.aperture = 3; @@ -1241,9 +1291,11 @@ namespace projections template <typename T, typename Parameters> struct isea_spheroid : public detail::isea::base_isea_spheroid<T, Parameters> { - inline isea_spheroid(const Parameters& par) : detail::isea::base_isea_spheroid<T, Parameters>(par) + template <typename Params> + inline isea_spheroid(Params const& params, Parameters const& par) + : detail::isea::base_isea_spheroid<T, Parameters>(par) { - detail::isea::setup_isea(this->m_par, this->m_proj_parm); + detail::isea::setup_isea(params, this->m_proj_parm); } }; @@ -1252,23 +1304,14 @@ namespace projections { // Static projection - BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::par4::isea, isea_spheroid, isea_spheroid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_isea, isea_spheroid, isea_spheroid) // Factory entry(s) - template <typename T, typename Parameters> - class isea_entry : public detail::factory_entry<T, Parameters> - { - public : - virtual base_v<T, Parameters>* create_new(const Parameters& par) const - { - return new base_v_f<isea_spheroid<T, Parameters>, T, Parameters>(par); - } - }; - - template <typename T, typename Parameters> - inline void isea_init(detail::base_factory<T, Parameters>& factory) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_F(isea_entry, isea_spheroid) + + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(isea_init) { - factory.add_to_factory("isea", new isea_entry<T, Parameters>); + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(isea, isea_entry) } } // namespace detail diff --git a/boost/geometry/srs/projections/proj/krovak.hpp b/boost/geometry/srs/projections/proj/krovak.hpp index a008f181db..5e4d08a844 100644 --- a/boost/geometry/srs/projections/proj/krovak.hpp +++ b/boost/geometry/srs/projections/proj/krovak.hpp @@ -53,12 +53,6 @@ namespace boost { namespace geometry { -namespace srs { namespace par4 -{ - struct krovak {}; // Krovak - -}} //namespace srs::par4 - namespace projections { #ifndef DOXYGEN_NO_DETAIL @@ -119,7 +113,7 @@ namespace projections // FORWARD(e_forward) ellipsoid // Project coordinates from geographic (lon, lat) to cartesian (x, y) - inline void fwd(T& lp_lon, T& lp_lat, T& xy_x, T& xy_y) const + inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const { T gfi, u, deltav, s, d, eps, rho; @@ -143,7 +137,7 @@ namespace projections // INVERSE(e_inverse) ellipsoid // Project coordinates from cartesian (x, y) to geographic (lon, lat) - inline void inv(T& xy_x, T& xy_y, T& lp_lon, T& lp_lat) const + inline void inv(T xy_x, T xy_y, T& lp_lon, T& lp_lat) const { T u, deltav, s, d, eps, rho, fi1, xy0; int i; @@ -194,31 +188,32 @@ namespace projections }; // Krovak - template <typename Parameters, typename T> - inline void setup_krovak(Parameters& par, par_krovak<T>& proj_parm) + template <typename Params, typename Parameters, typename T> + inline void setup_krovak(Params const& params, Parameters& par, par_krovak<T>& proj_parm) { T u0, n0, g; /* we want Bessel as fixed ellipsoid */ par.a = 6377397.155; - par.e = sqrt(par.es = 0.006674372230614); + par.es = 0.006674372230614; + par.e = sqrt(par.es); /* if latitude of projection center is not set, use 49d30'N */ - if (!pj_param_exists(par.params, "lat_0")) + if (!pj_param_exists<srs::spar::lat_0>(params, "lat_0", srs::dpar::lat_0)) par.phi0 = 0.863937979737193; /* if center long is not set use 42d30'E of Ferro - 17d40' for Ferro */ /* that will correspond to using longitudes relative to greenwich */ /* as input and output, instead of lat/long relative to Ferro */ - if (!pj_param_exists(par.params, "lon_0")) + if (!pj_param_exists<srs::spar::lon_0>(params, "lon_0", srs::dpar::lon_0)) par.lam0 = 0.7417649320975901 - 0.308341501185665; /* if scale not set default to 0.9999 */ - if (!pj_param_exists(par.params, "k")) + if (!pj_param_exists<srs::spar::k>(params, "k", srs::dpar::k)) par.k0 = 0.9999; proj_parm.czech = 1; - if( !pj_param_exists(par.params, "czech") ) + if( !pj_param_exists<srs::spar::czech>(params, "czech", srs::dpar::czech) ) proj_parm.czech = -1; /* Set up shared parameters between forward and inverse */ @@ -255,9 +250,11 @@ namespace projections template <typename T, typename Parameters> struct krovak_ellipsoid : public detail::krovak::base_krovak_ellipsoid<T, Parameters> { - inline krovak_ellipsoid(const Parameters& par) : detail::krovak::base_krovak_ellipsoid<T, Parameters>(par) + template <typename Params> + inline krovak_ellipsoid(Params const& params, Parameters const& par) + : detail::krovak::base_krovak_ellipsoid<T, Parameters>(par) { - detail::krovak::setup_krovak(this->m_par, this->m_proj_parm); + detail::krovak::setup_krovak(params, this->m_par, this->m_proj_parm); } }; @@ -266,23 +263,14 @@ namespace projections { // Static projection - BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::par4::krovak, krovak_ellipsoid, krovak_ellipsoid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_krovak, krovak_ellipsoid, krovak_ellipsoid) // Factory entry(s) - template <typename T, typename Parameters> - class krovak_entry : public detail::factory_entry<T, Parameters> - { - public : - virtual base_v<T, Parameters>* create_new(const Parameters& par) const - { - return new base_v_fi<krovak_ellipsoid<T, Parameters>, T, Parameters>(par); - } - }; - - template <typename T, typename Parameters> - inline void krovak_init(detail::base_factory<T, Parameters>& factory) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(krovak_entry, krovak_ellipsoid) + + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(krovak_init) { - factory.add_to_factory("krovak", new krovak_entry<T, Parameters>); + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(krovak, krovak_entry) } } // namespace detail diff --git a/boost/geometry/srs/projections/proj/labrd.hpp b/boost/geometry/srs/projections/proj/labrd.hpp index 32a15e2781..a66d0c63a2 100644 --- a/boost/geometry/srs/projections/proj/labrd.hpp +++ b/boost/geometry/srs/projections/proj/labrd.hpp @@ -48,12 +48,6 @@ namespace boost { namespace geometry { -namespace srs { namespace par4 -{ - struct labrd {}; // Laborde - -}} //namespace srs::par4 - namespace projections { #ifndef DOXYGEN_NO_DETAIL @@ -81,7 +75,7 @@ namespace projections // FORWARD(e_forward) // Project coordinates from geographic (lon, lat) to cartesian (x, y) - inline void fwd(T& lp_lon, T& lp_lat, T& xy_x, T& xy_y) const + inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const { static const T fourth_pi = detail::fourth_pi<T>(); @@ -115,7 +109,7 @@ namespace projections // INVERSE(e_inverse) ellipsoid & spheroid // Project coordinates from cartesian (x, y) to geographic (lon, lat) - inline void inv(T& xy_x, T& xy_y, T& lp_lon, T& lp_lat) const + inline void inv(T xy_x, T xy_y, T& lp_lon, T& lp_lat) const { static const T fourth_pi = detail::fourth_pi<T>(); @@ -174,15 +168,15 @@ namespace projections }; // Laborde - template <typename Parameters, typename T> - inline void setup_labrd(Parameters& par, par_labrd<T>& proj_parm) + template <typename Params, typename Parameters, typename T> + inline void setup_labrd(Params const& params, Parameters& par, par_labrd<T>& proj_parm) { static const T fourth_pi = detail::fourth_pi<T>(); T Az, sinp, R, N, t; - proj_parm.rot = pj_get_param_b(par.params, "no_rot"); - Az = pj_get_param_r(par.params, "azi"); + proj_parm.rot = pj_get_param_b<srs::spar::no_rot>(params, "no_rot", srs::dpar::no_rot); + Az = pj_get_param_r<T, srs::spar::azi>(params, "azi", srs::dpar::azi); sinp = sin(par.phi0); t = 1. - par.es * sinp * sinp; N = 1. / sqrt(t); @@ -223,9 +217,11 @@ namespace projections template <typename T, typename Parameters> struct labrd_ellipsoid : public detail::labrd::base_labrd_ellipsoid<T, Parameters> { - inline labrd_ellipsoid(const Parameters& par) : detail::labrd::base_labrd_ellipsoid<T, Parameters>(par) + template <typename Params> + inline labrd_ellipsoid(Params const& params, Parameters const& par) + : detail::labrd::base_labrd_ellipsoid<T, Parameters>(par) { - detail::labrd::setup_labrd(this->m_par, this->m_proj_parm); + detail::labrd::setup_labrd(params, this->m_par, this->m_proj_parm); } }; @@ -234,23 +230,14 @@ namespace projections { // Static projection - BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::par4::labrd, labrd_ellipsoid, labrd_ellipsoid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_labrd, labrd_ellipsoid, labrd_ellipsoid) // Factory entry(s) - template <typename T, typename Parameters> - class labrd_entry : public detail::factory_entry<T, Parameters> - { - public : - virtual base_v<T, Parameters>* create_new(const Parameters& par) const - { - return new base_v_fi<labrd_ellipsoid<T, Parameters>, T, Parameters>(par); - } - }; - - template <typename T, typename Parameters> - inline void labrd_init(detail::base_factory<T, Parameters>& factory) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(labrd_entry, labrd_ellipsoid) + + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(labrd_init) { - factory.add_to_factory("labrd", new labrd_entry<T, Parameters>); + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(labrd, labrd_entry) } } // namespace detail diff --git a/boost/geometry/srs/projections/proj/laea.hpp b/boost/geometry/srs/projections/proj/laea.hpp index 6d5a948672..9c4560a949 100644 --- a/boost/geometry/srs/projections/proj/laea.hpp +++ b/boost/geometry/srs/projections/proj/laea.hpp @@ -54,12 +54,6 @@ namespace boost { namespace geometry { -namespace srs { namespace par4 -{ - struct laea {}; - -}} //namespace srs::par4 - namespace projections { #ifndef DOXYGEN_NO_DETAIL @@ -102,7 +96,7 @@ namespace projections // FORWARD(e_forward) ellipsoid // Project coordinates from geographic (lon, lat) to cartesian (x, y) - inline void fwd(T& lp_lon, T& lp_lat, T& xy_x, T& xy_y) const + inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const { static const T half_pi = detail::half_pi<T>(); @@ -164,7 +158,7 @@ namespace projections // INVERSE(e_inverse) ellipsoid // Project coordinates from cartesian (x, y) to geographic (lon, lat) - inline void inv(T& xy_x, T& xy_y, T& lp_lon, T& lp_lat) const + inline void inv(T xy_x, T xy_y, T& lp_lon, T& lp_lat) const { T cCe, sCe, q, rho, ab=0.0; @@ -230,7 +224,7 @@ namespace projections // FORWARD(s_forward) spheroid // Project coordinates from geographic (lon, lat) to cartesian (x, y) - inline void fwd(T& lp_lon, T& lp_lat, T& xy_x, T& xy_y) const + inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const { static const T fourth_pi = detail::fourth_pi<T>(); @@ -271,7 +265,7 @@ namespace projections // INVERSE(s_inverse) spheroid // Project coordinates from cartesian (x, y) to geographic (lon, lat) - inline void inv(T& xy_x, T& xy_y, T& lp_lon, T& lp_lat) const + inline void inv(T xy_x, T xy_y, T& lp_lon, T& lp_lat) const { static const T half_pi = detail::half_pi<T>(); @@ -387,7 +381,9 @@ namespace projections template <typename T, typename Parameters> struct laea_ellipsoid : public detail::laea::base_laea_ellipsoid<T, Parameters> { - inline laea_ellipsoid(const Parameters& par) : detail::laea::base_laea_ellipsoid<T, Parameters>(par) + template <typename Params> + inline laea_ellipsoid(Params const& , Parameters const& par) + : detail::laea::base_laea_ellipsoid<T, Parameters>(par) { detail::laea::setup_laea(this->m_par, this->m_proj_parm); } @@ -409,7 +405,9 @@ namespace projections template <typename T, typename Parameters> struct laea_spheroid : public detail::laea::base_laea_spheroid<T, Parameters> { - inline laea_spheroid(const Parameters& par) : detail::laea::base_laea_spheroid<T, Parameters>(par) + template <typename Params> + inline laea_spheroid(Params const& , Parameters const& par) + : detail::laea::base_laea_spheroid<T, Parameters>(par) { detail::laea::setup_laea(this->m_par, this->m_proj_parm); } @@ -420,26 +418,14 @@ namespace projections { // Static projection - BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::par4::laea, laea_spheroid, laea_ellipsoid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_laea, laea_spheroid, laea_ellipsoid) // Factory entry(s) - template <typename T, typename Parameters> - class laea_entry : public detail::factory_entry<T, Parameters> - { - public : - virtual base_v<T, Parameters>* create_new(const Parameters& par) const - { - if (par.es) - return new base_v_fi<laea_ellipsoid<T, Parameters>, T, Parameters>(par); - else - return new base_v_fi<laea_spheroid<T, Parameters>, T, Parameters>(par); - } - }; - - template <typename T, typename Parameters> - inline void laea_init(detail::base_factory<T, Parameters>& factory) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI2(laea_entry, laea_spheroid, laea_ellipsoid) + + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(laea_init) { - factory.add_to_factory("laea", new laea_entry<T, Parameters>); + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(laea, laea_entry) } } // namespace detail diff --git a/boost/geometry/srs/projections/proj/lagrng.hpp b/boost/geometry/srs/projections/proj/lagrng.hpp index 6cedef717f..6f40bb2804 100644 --- a/boost/geometry/srs/projections/proj/lagrng.hpp +++ b/boost/geometry/srs/projections/proj/lagrng.hpp @@ -50,12 +50,6 @@ namespace boost { namespace geometry { -namespace srs { namespace par4 -{ - struct lagrng {}; // Lagrange - -}} //namespace srs::par4 - namespace projections { #ifndef DOXYGEN_NO_DETAIL @@ -85,7 +79,7 @@ namespace projections // FORWARD(s_forward) spheroid // Project coordinates from geographic (lon, lat) to cartesian (x, y) - inline void fwd(T& lp_lon, T& lp_lat, T& xy_x, T& xy_y) const + inline void fwd(T lp_lon, T lp_lat, T& xy_x, T& xy_y) const { static const T half_pi = detail::half_pi<T>(); @@ -113,18 +107,28 @@ namespace projections }; // Lagrange - template <typename Parameters, typename T> - inline void setup_lagrng(Parameters& par, par_lagrng<T>& proj_parm) + template <typename Params, typename Parameters, typename T> + inline void setup_lagrng(Params const& params, Parameters& par, par_lagrng<T>& proj_parm) { T phi1; - proj_parm.rw = pj_get_param_f(par.params, "W"); + proj_parm.rw = 0.0; + bool is_w_set = pj_param_f<srs::spar::w>(params, "W", srs::dpar::w, proj_parm.rw); + + // Boost.Geometry specific, set default parameters manually + if (! is_w_set) { + bool const use_defaults = ! pj_get_param_b<srs::spar::no_defs>(params, "no_defs", srs::dpar::no_defs); + if (use_defaults) { + proj_parm.rw = 2; + } + } + if (proj_parm.rw <= 0) BOOST_THROW_EXCEPTION( projection_exception(error_w_or_m_zero_or_less) ); proj_parm.rw = 1. / proj_parm.rw; proj_parm.hrw = 0.5 * proj_parm.rw; - phi1 = pj_get_param_r(par.params, "lat_1"); + phi1 = pj_get_param_r<T, srs::spar::lat_1>(params, "lat_1", srs::dpar::lat_1); if (fabs(fabs(phi1 = sin(phi1)) - 1.) < tolerance) BOOST_THROW_EXCEPTION( projection_exception(error_lat_larger_than_90) ); @@ -155,9 +159,11 @@ namespace projections template <typename T, typename Parameters> struct lagrng_spheroid : public detail::lagrng::base_lagrng_spheroid<T, Parameters> { - inline lagrng_spheroid(const Parameters& par) : detail::lagrng::base_lagrng_spheroid<T, Parameters>(par) + template <typename Params> + inline lagrng_spheroid(Params const& params, Parameters const& par) + : detail::lagrng::base_lagrng_spheroid<T, Parameters>(par) { - detail::lagrng::setup_lagrng(this->m_par, this->m_proj_parm); + detail::lagrng::setup_lagrng(params, this->m_par, this->m_proj_parm); } }; @@ -166,23 +172,14 @@ namespace projections { // Static projection - BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::par4::lagrng, lagrng_spheroid, lagrng_spheroid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_lagrng, lagrng_spheroid, lagrng_spheroid) // Factory entry(s) - template <typename T, typename Parameters> - class lagrng_entry : public detail::factory_entry<T, Parameters> - { - public : - virtual base_v<T, Parameters>* create_new(const Parameters& par) const - { - return new base_v_f<lagrng_spheroid<T, Parameters>, T, Parameters>(par); - } - }; - - template <typename T, typename Parameters> - inline void lagrng_init(detail::base_factory<T, Parameters>& factory) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_F(lagrng_entry, lagrng_spheroid) + + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(lagrng_init) { - factory.add_to_factory("lagrng", new lagrng_entry<T, Parameters>); + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(lagrng, lagrng_entry); } } // namespace detail diff --git a/boost/geometry/srs/projections/proj/larr.hpp b/boost/geometry/srs/projections/proj/larr.hpp index 84fbafac62..82025019b1 100644 --- a/boost/geometry/srs/projections/proj/larr.hpp +++ b/boost/geometry/srs/projections/proj/larr.hpp @@ -48,12 +48,6 @@ namespace boost { namespace geometry { -namespace srs { namespace par4 -{ - struct larr {}; // Larrivee - -}} //namespace srs::par4 - namespace projections { #ifndef DOXYGEN_NO_DETAIL @@ -71,7 +65,7 @@ namespace projections // FORWARD(s_forward) sphere // Project coordinates from geographic (lon, lat) to cartesian (x, y) - inline void fwd(T& lp_lon, T& lp_lat, T& xy_x, T& xy_y) const + inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const { static const T sixth = detail::sixth<T>(); @@ -112,7 +106,9 @@ namespace projections template <typename T, typename Parameters> struct larr_spheroid : public detail::larr::base_larr_spheroid<T, Parameters> { - inline larr_spheroid(const Parameters& par) : detail::larr::base_larr_spheroid<T, Parameters>(par) + template <typename Params> + inline larr_spheroid(Params const& , Parameters const& par) + : detail::larr::base_larr_spheroid<T, Parameters>(par) { detail::larr::setup_larr(this->m_par); } @@ -123,23 +119,14 @@ namespace projections { // Static projection - BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::par4::larr, larr_spheroid, larr_spheroid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_larr, larr_spheroid, larr_spheroid) // Factory entry(s) - template <typename T, typename Parameters> - class larr_entry : public detail::factory_entry<T, Parameters> - { - public : - virtual base_v<T, Parameters>* create_new(const Parameters& par) const - { - return new base_v_f<larr_spheroid<T, Parameters>, T, Parameters>(par); - } - }; - - template <typename T, typename Parameters> - inline void larr_init(detail::base_factory<T, Parameters>& factory) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_F(larr_entry, larr_spheroid) + + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(larr_init) { - factory.add_to_factory("larr", new larr_entry<T, Parameters>); + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(larr, larr_entry); } } // namespace detail diff --git a/boost/geometry/srs/projections/proj/lask.hpp b/boost/geometry/srs/projections/proj/lask.hpp index 3f06533bf2..ef9c5e38b5 100644 --- a/boost/geometry/srs/projections/proj/lask.hpp +++ b/boost/geometry/srs/projections/proj/lask.hpp @@ -48,12 +48,6 @@ namespace boost { namespace geometry { -namespace srs { namespace par4 -{ - struct lask {}; // Laskowski - -}} //namespace srs::par4 - namespace projections { #ifndef DOXYGEN_NO_DETAIL @@ -82,7 +76,7 @@ namespace projections // FORWARD(s_forward) sphere // Project coordinates from geographic (lon, lat) to cartesian (x, y) - inline void fwd(T& lp_lon, T& lp_lat, T& xy_x, T& xy_y) const + inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const { T l2, p2; @@ -126,7 +120,9 @@ namespace projections template <typename T, typename Parameters> struct lask_spheroid : public detail::lask::base_lask_spheroid<T, Parameters> { - inline lask_spheroid(const Parameters& par) : detail::lask::base_lask_spheroid<T, Parameters>(par) + template <typename Params> + inline lask_spheroid(Params const& , Parameters const& par) + : detail::lask::base_lask_spheroid<T, Parameters>(par) { detail::lask::setup_lask(this->m_par); } @@ -137,23 +133,14 @@ namespace projections { // Static projection - BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::par4::lask, lask_spheroid, lask_spheroid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_lask, lask_spheroid, lask_spheroid) // Factory entry(s) - template <typename T, typename Parameters> - class lask_entry : public detail::factory_entry<T, Parameters> - { - public : - virtual base_v<T, Parameters>* create_new(const Parameters& par) const - { - return new base_v_f<lask_spheroid<T, Parameters>, T, Parameters>(par); - } - }; - - template <typename T, typename Parameters> - inline void lask_init(detail::base_factory<T, Parameters>& factory) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_F(lask_entry, lask_spheroid) + + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(lask_init) { - factory.add_to_factory("lask", new lask_entry<T, Parameters>); + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(lask, lask_entry); } } // namespace detail diff --git a/boost/geometry/srs/projections/proj/latlong.hpp b/boost/geometry/srs/projections/proj/latlong.hpp index 4c2d00a805..a6e8dcdfdc 100644 --- a/boost/geometry/srs/projections/proj/latlong.hpp +++ b/boost/geometry/srs/projections/proj/latlong.hpp @@ -55,15 +55,6 @@ namespace boost { namespace geometry { -namespace srs { namespace par4 -{ - struct lonlat {}; // Lat/long (Geodetic) - struct latlon {}; // Lat/long (Geodetic alias) - struct latlong {}; // Lat/long (Geodetic alias) - struct longlat {}; // Lat/long (Geodetic alias) - -}} //namespace srs::par4 - namespace projections { #ifndef DOXYGEN_NO_DETAIL @@ -83,7 +74,7 @@ namespace projections // FORWARD(forward) // Project coordinates from geographic (lon, lat) to cartesian (x, y) - inline void fwd(T& lp_lon, T& lp_lat, T& xy_x, T& xy_y) const + inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const { // TODO: in the original code a is not used // different mechanism is probably used instead @@ -93,7 +84,7 @@ namespace projections // INVERSE(inverse) // Project coordinates from cartesian (x, y) to geographic (lon, lat) - inline void inv(T& xy_x, T& xy_y, T& lp_lon, T& lp_lat) const + inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const { // TODO: in the original code a is not used // different mechanism is probably used instead @@ -110,24 +101,6 @@ namespace projections // Lat/long (Geodetic) template <typename Parameters> - inline void setup_lonlat(Parameters& par) - { - par.is_latlong = 1; - par.x0 = 0.0; - par.y0 = 0.0; - } - - // Lat/long (Geodetic alias) - template <typename Parameters> - inline void setup_latlon(Parameters& par) - { - par.is_latlong = 1; - par.x0 = 0.0; - par.y0 = 0.0; - } - - // Lat/long (Geodetic alias) - template <typename Parameters> inline void setup_latlong(Parameters& par) { par.is_latlong = 1; @@ -135,15 +108,6 @@ namespace projections par.y0 = 0.0; } - // Lat/long (Geodetic alias) - template <typename Parameters> - inline void setup_longlat(Parameters& par) - { - par.is_latlong = 1; - par.x0 = 0.0; - par.y0 = 0.0; - } - }} // namespace detail::latlong #endif // doxygen @@ -154,129 +118,38 @@ namespace projections \tparam Cartesian xy point type \tparam Parameters parameter type \par Example - \image html ex_lonlat.gif - */ - template <typename T, typename Parameters> - struct lonlat_other : public detail::latlong::base_latlong_other<T, Parameters> - { - inline lonlat_other(const Parameters& par) : detail::latlong::base_latlong_other<T, Parameters>(par) - { - detail::latlong::setup_lonlat(this->m_par); - } - }; - - /*! - \brief Lat/long (Geodetic alias) projection - \ingroup projections - \tparam Geographic latlong point type - \tparam Cartesian xy point type - \tparam Parameters parameter type - \par Example - \image html ex_latlon.gif - */ - template <typename T, typename Parameters> - struct latlon_other : public detail::latlong::base_latlong_other<T, Parameters> - { - inline latlon_other(const Parameters& par) : detail::latlong::base_latlong_other<T, Parameters>(par) - { - detail::latlong::setup_latlon(this->m_par); - } - }; - - /*! - \brief Lat/long (Geodetic alias) projection - \ingroup projections - \tparam Geographic latlong point type - \tparam Cartesian xy point type - \tparam Parameters parameter type - \par Example \image html ex_latlong.gif */ template <typename T, typename Parameters> struct latlong_other : public detail::latlong::base_latlong_other<T, Parameters> { - inline latlong_other(const Parameters& par) : detail::latlong::base_latlong_other<T, Parameters>(par) + template <typename Params> + inline latlong_other(Params const& , Parameters const& par) + : detail::latlong::base_latlong_other<T, Parameters>(par) { detail::latlong::setup_latlong(this->m_par); } }; - /*! - \brief Lat/long (Geodetic alias) projection - \ingroup projections - \tparam Geographic latlong point type - \tparam Cartesian xy point type - \tparam Parameters parameter type - \par Example - \image html ex_longlat.gif - */ - template <typename T, typename Parameters> - struct longlat_other : public detail::latlong::base_latlong_other<T, Parameters> - { - inline longlat_other(const Parameters& par) : detail::latlong::base_latlong_other<T, Parameters>(par) - { - detail::latlong::setup_longlat(this->m_par); - } - }; - #ifndef DOXYGEN_NO_DETAIL namespace detail { // Static projection - BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::par4::lonlat, lonlat_other, lonlat_other) - BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::par4::latlon, latlon_other, latlon_other) - BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::par4::latlong, latlong_other, latlong_other) - BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::par4::longlat, longlat_other, longlat_other) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_lonlat, latlong_other, latlong_other) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_latlon, latlong_other, latlong_other) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_latlong, latlong_other, latlong_other) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_longlat, latlong_other, latlong_other) // Factory entry(s) - template <typename T, typename Parameters> - class lonlat_entry : public detail::factory_entry<T, Parameters> - { - public : - virtual base_v<T, Parameters>* create_new(const Parameters& par) const - { - return new base_v_fi<lonlat_other<T, Parameters>, T, Parameters>(par); - } - }; - - template <typename T, typename Parameters> - class latlon_entry : public detail::factory_entry<T, Parameters> - { - public : - virtual base_v<T, Parameters>* create_new(const Parameters& par) const - { - return new base_v_fi<latlon_other<T, Parameters>, T, Parameters>(par); - } - }; - - template <typename T, typename Parameters> - class latlong_entry : public detail::factory_entry<T, Parameters> - { - public : - virtual base_v<T, Parameters>* create_new(const Parameters& par) const - { - return new base_v_fi<latlong_other<T, Parameters>, T, Parameters>(par); - } - }; - - template <typename T, typename Parameters> - class longlat_entry : public detail::factory_entry<T, Parameters> - { - public : - virtual base_v<T, Parameters>* create_new(const Parameters& par) const - { - return new base_v_fi<longlat_other<T, Parameters>, T, Parameters>(par); - } - }; - - template <typename T, typename Parameters> - inline void latlong_init(detail::base_factory<T, Parameters>& factory) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(latlong_entry, latlong_other) + + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(latlong_init) { - factory.add_to_factory("lonlat", new lonlat_entry<T, Parameters>); - factory.add_to_factory("latlon", new latlon_entry<T, Parameters>); - factory.add_to_factory("latlong", new latlong_entry<T, Parameters>); - factory.add_to_factory("longlat", new longlat_entry<T, Parameters>); + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(lonlat, latlong_entry) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(latlon, latlong_entry) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(latlong, latlong_entry) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(longlat, latlong_entry) } } // namespace detail diff --git a/boost/geometry/srs/projections/proj/lcc.hpp b/boost/geometry/srs/projections/proj/lcc.hpp index f8fdd015ea..1b261cb70b 100644 --- a/boost/geometry/srs/projections/proj/lcc.hpp +++ b/boost/geometry/srs/projections/proj/lcc.hpp @@ -55,12 +55,6 @@ namespace boost { namespace geometry { -namespace srs { namespace par4 -{ - struct lcc {}; // Lambert Conformal Conic - -}} //namespace srs::par4 - namespace projections { #ifndef DOXYGEN_NO_DETAIL @@ -92,7 +86,7 @@ namespace projections // FORWARD(e_forward) ellipsoid & spheroid // Project coordinates from geographic (lon, lat) to cartesian (x, y) - inline void fwd(T& lp_lon, T& lp_lat, T& xy_x, T& xy_y) const + inline void fwd(T lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const { static const T fourth_pi = detail::fourth_pi<T>(); static const T half_pi = detail::half_pi<T>(); @@ -116,7 +110,7 @@ namespace projections // INVERSE(e_inverse) ellipsoid & spheroid // Project coordinates from cartesian (x, y) to geographic (lon, lat) - inline void inv(T& xy_x, T& xy_y, T& lp_lon, T& lp_lat) const + inline void inv(T xy_x, T xy_y, T& lp_lon, T& lp_lat) const { static const T half_pi = detail::half_pi<T>(); @@ -155,8 +149,8 @@ namespace projections }; // Lambert Conformal Conic - template <typename Parameters, typename T> - inline void setup_lcc(Parameters& par, par_lcc<T>& proj_parm) + template <typename Params, typename Parameters, typename T> + inline void setup_lcc(Params const& params, Parameters& par, par_lcc<T>& proj_parm) { static const T fourth_pi = detail::fourth_pi<T>(); static const T half_pi = detail::half_pi<T>(); @@ -164,12 +158,29 @@ namespace projections T cosphi, sinphi; int secant; - proj_parm.phi1 = pj_get_param_r(par.params, "lat_1"); - if (pj_param_r(par.params, "lat_2", proj_parm.phi2)) { - /* empty */ - } else { + proj_parm.phi1 = 0.0; + proj_parm.phi2 = 0.0; + bool is_phi1_set = pj_param_r<srs::spar::lat_1>(params, "lat_1", srs::dpar::lat_1, proj_parm.phi1); + bool is_phi2_set = pj_param_r<srs::spar::lat_2>(params, "lat_2", srs::dpar::lat_2, proj_parm.phi2); + + // Boost.Geometry specific, set default parameters manually + if (! is_phi1_set || ! is_phi2_set) { + bool const use_defaults = ! pj_get_param_b<srs::spar::no_defs>(params, "no_defs", srs::dpar::no_defs); + if (use_defaults) { + if (!is_phi1_set) { + proj_parm.phi1 = 33; + is_phi1_set = true; + } + if (!is_phi2_set) { + proj_parm.phi2 = 45; + is_phi2_set = true; + } + } + } + + if (! is_phi2_set) { proj_parm.phi2 = proj_parm.phi1; - if (!pj_param_exists(par.params, "lat_0")) + if (! pj_param_exists<srs::spar::lat_0>(params, "lat_0", srs::dpar::lat_0)) par.phi0 = proj_parm.phi1; } if (fabs(proj_parm.phi1 + proj_parm.phi2) < epsilon10) @@ -226,9 +237,11 @@ namespace projections template <typename T, typename Parameters> struct lcc_ellipsoid : public detail::lcc::base_lcc_ellipsoid<T, Parameters> { - inline lcc_ellipsoid(const Parameters& par) : detail::lcc::base_lcc_ellipsoid<T, Parameters>(par) + template <typename Params> + inline lcc_ellipsoid(Params const& params, Parameters const& par) + : detail::lcc::base_lcc_ellipsoid<T, Parameters>(par) { - detail::lcc::setup_lcc(this->m_par, this->m_proj_parm); + detail::lcc::setup_lcc(params, this->m_par, this->m_proj_parm); } }; @@ -237,23 +250,14 @@ namespace projections { // Static projection - BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::par4::lcc, lcc_ellipsoid, lcc_ellipsoid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_lcc, lcc_ellipsoid, lcc_ellipsoid) // Factory entry(s) - template <typename T, typename Parameters> - class lcc_entry : public detail::factory_entry<T, Parameters> - { - public : - virtual base_v<T, Parameters>* create_new(const Parameters& par) const - { - return new base_v_fi<lcc_ellipsoid<T, Parameters>, T, Parameters>(par); - } - }; - - template <typename T, typename Parameters> - inline void lcc_init(detail::base_factory<T, Parameters>& factory) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(lcc_entry, lcc_ellipsoid) + + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(lcc_init) { - factory.add_to_factory("lcc", new lcc_entry<T, Parameters>); + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(lcc, lcc_entry); } } // namespace detail diff --git a/boost/geometry/srs/projections/proj/lcca.hpp b/boost/geometry/srs/projections/proj/lcca.hpp index ddbdfdb0d1..090b7f4c2b 100644 --- a/boost/geometry/srs/projections/proj/lcca.hpp +++ b/boost/geometry/srs/projections/proj/lcca.hpp @@ -96,12 +96,6 @@ namespace boost { namespace geometry { -namespace srs { namespace par4 -{ - struct lcca {}; - -}} //namespace srs::par4 - namespace projections { #ifndef DOXYGEN_NO_DETAIL @@ -144,7 +138,7 @@ namespace projections // FORWARD(e_forward) ellipsoid // Project coordinates from geographic (lon, lat) to cartesian (x, y) - inline void fwd(T& lp_lon, T& lp_lat, T& xy_x, T& xy_y) const + inline void fwd(T lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const { T S, r, dr; @@ -157,7 +151,7 @@ namespace projections // INVERSE(e_inverse) ellipsoid & spheroid // Project coordinates from cartesian (x, y) to geographic (lon, lat) - inline void inv(T& xy_x, T& xy_y, T& lp_lon, T& lp_lat) const + inline void inv(T xy_x, T xy_y, T& lp_lon, T& lp_lat) const { T theta, dr, S, dif; int i; @@ -228,7 +222,9 @@ namespace projections template <typename T, typename Parameters> struct lcca_ellipsoid : public detail::lcca::base_lcca_ellipsoid<T, Parameters> { - inline lcca_ellipsoid(const Parameters& par) : detail::lcca::base_lcca_ellipsoid<T, Parameters>(par) + template <typename Params> + inline lcca_ellipsoid(Params const& , Parameters const& par) + : detail::lcca::base_lcca_ellipsoid<T, Parameters>(par) { detail::lcca::setup_lcca(this->m_par, this->m_proj_parm); } @@ -239,23 +235,14 @@ namespace projections { // Static projection - BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::par4::lcca, lcca_ellipsoid, lcca_ellipsoid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_lcca, lcca_ellipsoid, lcca_ellipsoid) // Factory entry(s) - template <typename T, typename Parameters> - class lcca_entry : public detail::factory_entry<T, Parameters> - { - public : - virtual base_v<T, Parameters>* create_new(const Parameters& par) const - { - return new base_v_fi<lcca_ellipsoid<T, Parameters>, T, Parameters>(par); - } - }; - - template <typename T, typename Parameters> - inline void lcca_init(detail::base_factory<T, Parameters>& factory) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(lcca_entry, lcca_ellipsoid) + + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(lcca_init) { - factory.add_to_factory("lcca", new lcca_entry<T, Parameters>); + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(lcca, lcca_entry) } } // namespace detail diff --git a/boost/geometry/srs/projections/proj/loxim.hpp b/boost/geometry/srs/projections/proj/loxim.hpp index badac3c765..3736a11cf2 100644 --- a/boost/geometry/srs/projections/proj/loxim.hpp +++ b/boost/geometry/srs/projections/proj/loxim.hpp @@ -50,12 +50,6 @@ namespace boost { namespace geometry { -namespace srs { namespace par4 -{ - struct loxim {}; // Loximuthal - -}} //namespace srs::par4 - namespace projections { #ifndef DOXYGEN_NO_DETAIL @@ -84,7 +78,7 @@ namespace projections // FORWARD(s_forward) spheroid // Project coordinates from geographic (lon, lat) to cartesian (x, y) - inline void fwd(T& lp_lon, T& lp_lat, T& xy_x, T& xy_y) const + inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const { static const T fourth_pi = detail::fourth_pi<T>(); static const T half_pi = detail::half_pi<T>(); @@ -103,7 +97,7 @@ namespace projections // INVERSE(s_inverse) spheroid // Project coordinates from cartesian (x, y) to geographic (lon, lat) - inline void inv(T& xy_x, T& xy_y, T& lp_lon, T& lp_lat) const + inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const { static const T fourth_pi = detail::fourth_pi<T>(); static const T half_pi = detail::half_pi<T>(); @@ -128,12 +122,12 @@ namespace projections }; // Loximuthal - template <typename Parameters, typename T> - inline void setup_loxim(Parameters& par, par_loxim<T>& proj_parm) + template <typename Params, typename Parameters, typename T> + inline void setup_loxim(Params const& params, Parameters& par, par_loxim<T>& proj_parm) { static const T fourth_pi = detail::fourth_pi<T>(); - proj_parm.phi1 = pj_get_param_r(par.params, "lat_1"); + proj_parm.phi1 = pj_get_param_r<T, srs::spar::lat_1>(params, "lat_1", srs::dpar::lat_1); proj_parm.cosphi1 = cos(proj_parm.phi1); if (proj_parm.cosphi1 < epsilon) BOOST_THROW_EXCEPTION( projection_exception(error_lat_larger_than_90) ); @@ -163,9 +157,11 @@ namespace projections template <typename T, typename Parameters> struct loxim_spheroid : public detail::loxim::base_loxim_spheroid<T, Parameters> { - inline loxim_spheroid(const Parameters& par) : detail::loxim::base_loxim_spheroid<T, Parameters>(par) + template <typename Params> + inline loxim_spheroid(Params const& params, Parameters const& par) + : detail::loxim::base_loxim_spheroid<T, Parameters>(par) { - detail::loxim::setup_loxim(this->m_par, this->m_proj_parm); + detail::loxim::setup_loxim(params, this->m_par, this->m_proj_parm); } }; @@ -174,23 +170,14 @@ namespace projections { // Static projection - BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::par4::loxim, loxim_spheroid, loxim_spheroid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_loxim, loxim_spheroid, loxim_spheroid) // Factory entry(s) - template <typename T, typename Parameters> - class loxim_entry : public detail::factory_entry<T, Parameters> - { - public : - virtual base_v<T, Parameters>* create_new(const Parameters& par) const - { - return new base_v_fi<loxim_spheroid<T, Parameters>, T, Parameters>(par); - } - }; - - template <typename T, typename Parameters> - inline void loxim_init(detail::base_factory<T, Parameters>& factory) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(loxim_entry, loxim_spheroid) + + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(loxim_init) { - factory.add_to_factory("loxim", new loxim_entry<T, Parameters>); + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(loxim, loxim_entry) } } // namespace detail diff --git a/boost/geometry/srs/projections/proj/lsat.hpp b/boost/geometry/srs/projections/proj/lsat.hpp index 6ed729f75c..65dbe97f6d 100644 --- a/boost/geometry/srs/projections/proj/lsat.hpp +++ b/boost/geometry/srs/projections/proj/lsat.hpp @@ -51,12 +51,6 @@ namespace boost { namespace geometry { -namespace srs { namespace par4 -{ - struct lsat {}; // Space oblique for LANDSAT - -}} //namespace srs::par4 - namespace projections { #ifndef DOXYGEN_NO_DETAIL @@ -111,7 +105,7 @@ namespace projections // FORWARD(e_forward) ellipsoid // Project coordinates from geographic (lon, lat) to cartesian (x, y) - inline void fwd(T& lp_lon, T& lp_lat, T& xy_x, T& xy_y) const + inline void fwd(T const& lp_lon, T lp_lat, T& xy_x, T& xy_y) const { static const T fourth_pi = detail::fourth_pi<T>(); static const T half_pi = detail::half_pi<T>(); @@ -180,7 +174,7 @@ namespace projections // INVERSE(e_inverse) ellipsoid // Project coordinates from cartesian (x, y) to geographic (lon, lat) - inline void inv(T& xy_x, T& xy_y, T& lp_lon, T& lp_lat) const + inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const { static const T fourth_pi = detail::fourth_pi<T>(); static const T half_pi = detail::half_pi<T>(); @@ -233,8 +227,8 @@ namespace projections }; // Space oblique for LANDSAT - template <typename Parameters, typename T> - inline void setup_lsat(Parameters& par, par_lsat<T>& proj_parm) + template <typename Params, typename Parameters, typename T> + inline void setup_lsat(Params const& params, Parameters& par, par_lsat<T>& proj_parm) { static T const d2r = geometry::math::d2r<T>(); static T const pi = detail::pi<T>(); @@ -243,11 +237,11 @@ namespace projections int land, path; T lam, alf, esc, ess; - land = pj_get_param_i(par.params, "lsat"); + land = pj_get_param_i<srs::spar::lsat>(params, "lsat", srs::dpar::lsat); if (land <= 0 || land > 5) BOOST_THROW_EXCEPTION( projection_exception(error_lsat_not_in_range) ); - path = pj_get_param_i(par.params, "path"); + path = pj_get_param_i<srs::spar::path>(params, "path", srs::dpar::path); if (path <= 0 || path > (land <= 3 ? 251 : 233)) BOOST_THROW_EXCEPTION( projection_exception(error_path_not_in_range) ); @@ -311,9 +305,11 @@ namespace projections template <typename T, typename Parameters> struct lsat_ellipsoid : public detail::lsat::base_lsat_ellipsoid<T, Parameters> { - inline lsat_ellipsoid(const Parameters& par) : detail::lsat::base_lsat_ellipsoid<T, Parameters>(par) + template <typename Params> + inline lsat_ellipsoid(Params const& params, Parameters const& par) + : detail::lsat::base_lsat_ellipsoid<T, Parameters>(par) { - detail::lsat::setup_lsat(this->m_par, this->m_proj_parm); + detail::lsat::setup_lsat(params, this->m_par, this->m_proj_parm); } }; @@ -322,23 +318,14 @@ namespace projections { // Static projection - BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::par4::lsat, lsat_ellipsoid, lsat_ellipsoid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_lsat, lsat_ellipsoid, lsat_ellipsoid) // Factory entry(s) - template <typename T, typename Parameters> - class lsat_entry : public detail::factory_entry<T, Parameters> - { - public : - virtual base_v<T, Parameters>* create_new(const Parameters& par) const - { - return new base_v_fi<lsat_ellipsoid<T, Parameters>, T, Parameters>(par); - } - }; - - template <typename T, typename Parameters> - inline void lsat_init(detail::base_factory<T, Parameters>& factory) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(lsat_entry, lsat_ellipsoid) + + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(lsat_init) { - factory.add_to_factory("lsat", new lsat_entry<T, Parameters>); + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(lsat, lsat_entry) } } // namespace detail diff --git a/boost/geometry/srs/projections/proj/mbt_fps.hpp b/boost/geometry/srs/projections/proj/mbt_fps.hpp index 130590f8e5..25b59887e5 100644 --- a/boost/geometry/srs/projections/proj/mbt_fps.hpp +++ b/boost/geometry/srs/projections/proj/mbt_fps.hpp @@ -49,12 +49,6 @@ namespace boost { namespace geometry { -namespace srs { namespace par4 -{ - struct mbt_fps {}; // McBryde-Thomas Flat-Pole Sine (No. 2) - -}} //namespace srs::par4 - namespace projections { #ifndef DOXYGEN_NO_DETAIL @@ -84,7 +78,7 @@ namespace projections // FORWARD(s_forward) spheroid // Project coordinates from geographic (lon, lat) to cartesian (x, y) - inline void fwd(T& lp_lon, T& lp_lat, T& xy_x, T& xy_y) const + inline void fwd(T const& lp_lon, T lp_lat, T& xy_x, T& xy_y) const { static const T C1_2 = mbt_fps::C1_2<T>(); @@ -106,7 +100,7 @@ namespace projections // INVERSE(s_inverse) spheroid // Project coordinates from cartesian (x, y) to geographic (lon, lat) - inline void inv(T& xy_x, T& xy_y, T& lp_lon, T& lp_lat) const + inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const { T t; @@ -147,7 +141,9 @@ namespace projections template <typename T, typename Parameters> struct mbt_fps_spheroid : public detail::mbt_fps::base_mbt_fps_spheroid<T, Parameters> { - inline mbt_fps_spheroid(const Parameters& par) : detail::mbt_fps::base_mbt_fps_spheroid<T, Parameters>(par) + template <typename Params> + inline mbt_fps_spheroid(Params const& , Parameters const& par) + : detail::mbt_fps::base_mbt_fps_spheroid<T, Parameters>(par) { detail::mbt_fps::setup_mbt_fps(this->m_par); } @@ -158,23 +154,14 @@ namespace projections { // Static projection - BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::par4::mbt_fps, mbt_fps_spheroid, mbt_fps_spheroid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_mbt_fps, mbt_fps_spheroid, mbt_fps_spheroid) // Factory entry(s) - template <typename T, typename Parameters> - class mbt_fps_entry : public detail::factory_entry<T, Parameters> - { - public : - virtual base_v<T, Parameters>* create_new(const Parameters& par) const - { - return new base_v_fi<mbt_fps_spheroid<T, Parameters>, T, Parameters>(par); - } - }; - - template <typename T, typename Parameters> - inline void mbt_fps_init(detail::base_factory<T, Parameters>& factory) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(mbt_fps_entry, mbt_fps_spheroid) + + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(mbt_fps_init) { - factory.add_to_factory("mbt_fps", new mbt_fps_entry<T, Parameters>); + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(mbt_fps, mbt_fps_entry) } } // namespace detail diff --git a/boost/geometry/srs/projections/proj/mbtfpp.hpp b/boost/geometry/srs/projections/proj/mbtfpp.hpp index cd09fdf181..87e4d2ffad 100644 --- a/boost/geometry/srs/projections/proj/mbtfpp.hpp +++ b/boost/geometry/srs/projections/proj/mbtfpp.hpp @@ -50,12 +50,6 @@ namespace boost { namespace geometry { -namespace srs { namespace par4 -{ - struct mbtfpp {}; // McBride-Thomas Flat-Polar Parabolic - -}} //namespace srs::par4 - namespace projections { #ifndef DOXYGEN_NO_DETAIL @@ -80,7 +74,7 @@ namespace projections // FORWARD(s_forward) spheroid // Project coordinates from geographic (lon, lat) to cartesian (x, y) - inline void fwd(T& lp_lon, T& lp_lat, T& xy_x, T& xy_y) const + inline void fwd(T const& lp_lon, T lp_lat, T& xy_x, T& xy_y) const { static const T C23 = detail::two_thirds<T>(); static const T C13 = detail::third<T>(); @@ -92,7 +86,7 @@ namespace projections // INVERSE(s_inverse) spheroid // Project coordinates from cartesian (x, y) to geographic (lon, lat) - inline void inv(T& xy_x, T& xy_y, T& lp_lon, T& lp_lat) const + inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const { static const T half_pi = detail::half_pi<T>(); static const T C23 = detail::two_thirds<T>(); @@ -150,7 +144,9 @@ namespace projections template <typename T, typename Parameters> struct mbtfpp_spheroid : public detail::mbtfpp::base_mbtfpp_spheroid<T, Parameters> { - inline mbtfpp_spheroid(const Parameters& par) : detail::mbtfpp::base_mbtfpp_spheroid<T, Parameters>(par) + template <typename Params> + inline mbtfpp_spheroid(Params const& , Parameters const& par) + : detail::mbtfpp::base_mbtfpp_spheroid<T, Parameters>(par) { detail::mbtfpp::setup_mbtfpp(this->m_par); } @@ -161,23 +157,14 @@ namespace projections { // Static projection - BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::par4::mbtfpp, mbtfpp_spheroid, mbtfpp_spheroid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_mbtfpp, mbtfpp_spheroid, mbtfpp_spheroid) // Factory entry(s) - template <typename T, typename Parameters> - class mbtfpp_entry : public detail::factory_entry<T, Parameters> - { - public : - virtual base_v<T, Parameters>* create_new(const Parameters& par) const - { - return new base_v_fi<mbtfpp_spheroid<T, Parameters>, T, Parameters>(par); - } - }; - - template <typename T, typename Parameters> - inline void mbtfpp_init(detail::base_factory<T, Parameters>& factory) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(mbtfpp_entry, mbtfpp_spheroid) + + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(mbtfpp_init) { - factory.add_to_factory("mbtfpp", new mbtfpp_entry<T, Parameters>); + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(mbtfpp, mbtfpp_entry) } } // namespace detail diff --git a/boost/geometry/srs/projections/proj/mbtfpq.hpp b/boost/geometry/srs/projections/proj/mbtfpq.hpp index 4d7858c020..d806a8b98d 100644 --- a/boost/geometry/srs/projections/proj/mbtfpq.hpp +++ b/boost/geometry/srs/projections/proj/mbtfpq.hpp @@ -50,12 +50,6 @@ namespace boost { namespace geometry { -namespace srs { namespace par4 -{ - struct mbtfpq {}; // McBryde-Thomas Flat-Polar Quartic - -}} //namespace srs::par4 - namespace projections { #ifndef DOXYGEN_NO_DETAIL @@ -83,7 +77,7 @@ namespace projections // FORWARD(s_forward) spheroid // Project coordinates from geographic (lon, lat) to cartesian (x, y) - inline void fwd(T& lp_lon, T& lp_lat, T& xy_x, T& xy_y) const + inline void fwd(T const& lp_lon, T lp_lat, T& xy_x, T& xy_y) const { T th1, c; int i; @@ -100,7 +94,7 @@ namespace projections // INVERSE(s_inverse) spheroid // Project coordinates from cartesian (x, y) to geographic (lon, lat) - inline void inv(T& xy_x, T& xy_y, T& lp_lon, T& lp_lat) const + inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const { static const T pi = detail::pi<T>(); static const T half_pi = detail::half_pi<T>(); @@ -161,7 +155,9 @@ namespace projections template <typename T, typename Parameters> struct mbtfpq_spheroid : public detail::mbtfpq::base_mbtfpq_spheroid<T, Parameters> { - inline mbtfpq_spheroid(const Parameters& par) : detail::mbtfpq::base_mbtfpq_spheroid<T, Parameters>(par) + template <typename Params> + inline mbtfpq_spheroid(Params const& , Parameters const& par) + : detail::mbtfpq::base_mbtfpq_spheroid<T, Parameters>(par) { detail::mbtfpq::setup_mbtfpq(this->m_par); } @@ -172,23 +168,14 @@ namespace projections { // Static projection - BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::par4::mbtfpq, mbtfpq_spheroid, mbtfpq_spheroid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_mbtfpq, mbtfpq_spheroid, mbtfpq_spheroid) // Factory entry(s) - template <typename T, typename Parameters> - class mbtfpq_entry : public detail::factory_entry<T, Parameters> - { - public : - virtual base_v<T, Parameters>* create_new(const Parameters& par) const - { - return new base_v_fi<mbtfpq_spheroid<T, Parameters>, T, Parameters>(par); - } - }; - - template <typename T, typename Parameters> - inline void mbtfpq_init(detail::base_factory<T, Parameters>& factory) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(mbtfpq_entry, mbtfpq_spheroid) + + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(mbtfpq_init) { - factory.add_to_factory("mbtfpq", new mbtfpq_entry<T, Parameters>); + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(mbtfpq, mbtfpq_entry) } } // namespace detail diff --git a/boost/geometry/srs/projections/proj/merc.hpp b/boost/geometry/srs/projections/proj/merc.hpp index 74449f64c8..e2fba50720 100644 --- a/boost/geometry/srs/projections/proj/merc.hpp +++ b/boost/geometry/srs/projections/proj/merc.hpp @@ -53,12 +53,6 @@ namespace boost { namespace geometry { -namespace srs { namespace par4 -{ - struct merc {}; // Mercator - -}} //namespace srs::par4 - namespace projections { #ifndef DOXYGEN_NO_DETAIL @@ -78,7 +72,7 @@ namespace projections // FORWARD(e_forward) ellipsoid // Project coordinates from geographic (lon, lat) to cartesian (x, y) - inline void fwd(T& lp_lon, T& lp_lat, T& xy_x, T& xy_y) const + inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const { static const T half_pi = detail::half_pi<T>(); @@ -91,7 +85,7 @@ namespace projections // INVERSE(e_inverse) ellipsoid // Project coordinates from cartesian (x, y) to geographic (lon, lat) - inline void inv(T& xy_x, T& xy_y, T& lp_lon, T& lp_lat) const + inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const { if ((lp_lat = pj_phi2(exp(- xy_y / this->m_par.k0), this->m_par.e)) == HUGE_VAL) { BOOST_THROW_EXCEPTION( projection_exception(error_tolerance_condition) ); @@ -117,7 +111,7 @@ namespace projections // FORWARD(s_forward) spheroid // Project coordinates from geographic (lon, lat) to cartesian (x, y) - inline void fwd(T& lp_lon, T& lp_lat, T& xy_x, T& xy_y) const + inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const { static const T half_pi = detail::half_pi<T>(); static const T fourth_pi = detail::fourth_pi<T>(); @@ -131,7 +125,7 @@ namespace projections // INVERSE(s_inverse) spheroid // Project coordinates from cartesian (x, y) to geographic (lon, lat) - inline void inv(T& xy_x, T& xy_y, T& lp_lon, T& lp_lat) const + inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const { static const T half_pi = detail::half_pi<T>(); @@ -147,8 +141,8 @@ namespace projections }; // Mercator - template <typename Parameters> - inline void setup_merc(Parameters& par) + template <typename Params, typename Parameters> + inline void setup_merc(Params const& params, Parameters& par) { typedef typename Parameters::type calc_t; static const calc_t half_pi = detail::half_pi<calc_t>(); @@ -156,7 +150,7 @@ namespace projections calc_t phits=0.0; int is_phits; - if( (is_phits = pj_param_r(par.params, "lat_ts", phits)) ) { + if( (is_phits = pj_param_r<srs::spar::lat_ts>(params, "lat_ts", srs::dpar::lat_ts, phits)) ) { phits = fabs(phits); if (phits >= half_pi) BOOST_THROW_EXCEPTION( projection_exception(error_lat_ts_larger_than_90) ); @@ -191,9 +185,11 @@ namespace projections template <typename T, typename Parameters> struct merc_ellipsoid : public detail::merc::base_merc_ellipsoid<T, Parameters> { - inline merc_ellipsoid(const Parameters& par) : detail::merc::base_merc_ellipsoid<T, Parameters>(par) + template <typename Params> + inline merc_ellipsoid(Params const& params, Parameters const& par) + : detail::merc::base_merc_ellipsoid<T, Parameters>(par) { - detail::merc::setup_merc(this->m_par); + detail::merc::setup_merc(params, this->m_par); } }; @@ -215,9 +211,11 @@ namespace projections template <typename T, typename Parameters> struct merc_spheroid : public detail::merc::base_merc_spheroid<T, Parameters> { - inline merc_spheroid(const Parameters& par) : detail::merc::base_merc_spheroid<T, Parameters>(par) + template <typename Params> + inline merc_spheroid(Params const& params, Parameters const& par) + : detail::merc::base_merc_spheroid<T, Parameters>(par) { - detail::merc::setup_merc(this->m_par); + detail::merc::setup_merc(params, this->m_par); } }; @@ -226,26 +224,14 @@ namespace projections { // Static projection - BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::par4::merc, merc_spheroid, merc_ellipsoid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_merc, merc_spheroid, merc_ellipsoid) // Factory entry(s) - template <typename T, typename Parameters> - class merc_entry : public detail::factory_entry<T, Parameters> - { - public : - virtual base_v<T, Parameters>* create_new(const Parameters& par) const - { - if (par.es) - return new base_v_fi<merc_ellipsoid<T, Parameters>, T, Parameters>(par); - else - return new base_v_fi<merc_spheroid<T, Parameters>, T, Parameters>(par); - } - }; - - template <typename T, typename Parameters> - inline void merc_init(detail::base_factory<T, Parameters>& factory) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI2(merc_entry, merc_spheroid, merc_ellipsoid) + + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(merc_init) { - factory.add_to_factory("merc", new merc_entry<T, Parameters>); + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(merc, merc_entry) } } // namespace detail diff --git a/boost/geometry/srs/projections/proj/mill.hpp b/boost/geometry/srs/projections/proj/mill.hpp index 9c73f1b21c..6fa47eb0dd 100644 --- a/boost/geometry/srs/projections/proj/mill.hpp +++ b/boost/geometry/srs/projections/proj/mill.hpp @@ -48,12 +48,6 @@ namespace boost { namespace geometry { -namespace srs { namespace par4 -{ - struct mill {}; // Miller Cylindrical - -}} //namespace srs::par4 - namespace projections { #ifndef DOXYGEN_NO_DETAIL @@ -70,7 +64,7 @@ namespace projections // FORWARD(s_forward) spheroid // Project coordinates from geographic (lon, lat) to cartesian (x, y) - inline void fwd(T& lp_lon, T& lp_lat, T& xy_x, T& xy_y) const + inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const { static const T fourth_pi = detail::fourth_pi<T>(); @@ -80,7 +74,7 @@ namespace projections // INVERSE(s_inverse) spheroid // Project coordinates from cartesian (x, y) to geographic (lon, lat) - inline void inv(T& xy_x, T& xy_y, T& lp_lon, T& lp_lat) const + inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const { static const T fourth_pi = detail::fourth_pi<T>(); @@ -120,7 +114,9 @@ namespace projections template <typename T, typename Parameters> struct mill_spheroid : public detail::mill::base_mill_spheroid<T, Parameters> { - inline mill_spheroid(const Parameters& par) : detail::mill::base_mill_spheroid<T, Parameters>(par) + template <typename Params> + inline mill_spheroid(Params const& , Parameters const& par) + : detail::mill::base_mill_spheroid<T, Parameters>(par) { detail::mill::setup_mill(this->m_par); } @@ -131,25 +127,16 @@ namespace projections { // Static projection - BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::par4::mill, mill_spheroid, mill_spheroid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_mill, mill_spheroid, mill_spheroid) // Factory entry(s) - template <typename T, typename Parameters> - class mill_entry : public detail::factory_entry<T, Parameters> - { - public : - virtual base_v<T, Parameters>* create_new(const Parameters& par) const - { - return new base_v_fi<mill_spheroid<T, Parameters>, T, Parameters>(par); - } - }; + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(mill_entry, mill_spheroid) - template <typename T, typename Parameters> - inline void mill_init(detail::base_factory<T, Parameters>& factory) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(mill_init) { - factory.add_to_factory("mill", new mill_entry<T, Parameters>); + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(mill, mill_entry) } - + } // namespace detail #endif // doxygen diff --git a/boost/geometry/srs/projections/proj/mod_ster.hpp b/boost/geometry/srs/projections/proj/mod_ster.hpp index ca33adcdbd..ade151dc89 100644 --- a/boost/geometry/srs/projections/proj/mod_ster.hpp +++ b/boost/geometry/srs/projections/proj/mod_ster.hpp @@ -53,16 +53,6 @@ namespace boost { namespace geometry { -namespace srs { namespace par4 -{ - struct mil_os {}; // Miller Oblated Stereographic - struct lee_os {}; // Lee Oblated Stereographic - struct gs48 {}; // Mod. Stereographic of 48 U.S. - struct alsk {}; // Mod. Stereographic of Alaska - struct gs50 {}; // Mod. Stereographic of 50 U.S. - -}} //namespace srs::par4 - namespace projections { #ifndef DOXYGEN_NO_DETAIL @@ -94,7 +84,7 @@ namespace projections // FORWARD(e_forward) ellipsoid // Project coordinates from geographic (lon, lat) to cartesian (x, y) - inline void fwd(T& lp_lon, T& lp_lat, T& xy_x, T& xy_y) const + inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const { static const T half_pi = detail::half_pi<T>(); @@ -118,7 +108,7 @@ namespace projections // INVERSE(e_inverse) ellipsoid // Project coordinates from cartesian (x, y) to geographic (lon, lat) - inline void inv(T& xy_x, T& xy_y, T& lp_lon, T& lp_lat) const + inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const { static const T half_pi = detail::half_pi<T>(); @@ -366,7 +356,9 @@ namespace projections template <typename T, typename Parameters> struct mil_os_ellipsoid : public detail::mod_ster::base_mod_ster_ellipsoid<T, Parameters> { - inline mil_os_ellipsoid(const Parameters& par) : detail::mod_ster::base_mod_ster_ellipsoid<T, Parameters>(par) + template <typename Params> + inline mil_os_ellipsoid(Params const& , Parameters const& par) + : detail::mod_ster::base_mod_ster_ellipsoid<T, Parameters>(par) { detail::mod_ster::setup_mil_os(this->m_par, this->m_proj_parm); } @@ -386,7 +378,9 @@ namespace projections template <typename T, typename Parameters> struct lee_os_ellipsoid : public detail::mod_ster::base_mod_ster_ellipsoid<T, Parameters> { - inline lee_os_ellipsoid(const Parameters& par) : detail::mod_ster::base_mod_ster_ellipsoid<T, Parameters>(par) + template <typename Params> + inline lee_os_ellipsoid(Params const& , Parameters const& par) + : detail::mod_ster::base_mod_ster_ellipsoid<T, Parameters>(par) { detail::mod_ster::setup_lee_os(this->m_par, this->m_proj_parm); } @@ -406,7 +400,9 @@ namespace projections template <typename T, typename Parameters> struct gs48_ellipsoid : public detail::mod_ster::base_mod_ster_ellipsoid<T, Parameters> { - inline gs48_ellipsoid(const Parameters& par) : detail::mod_ster::base_mod_ster_ellipsoid<T, Parameters>(par) + template <typename Params> + inline gs48_ellipsoid(Params const& , Parameters const& par) + : detail::mod_ster::base_mod_ster_ellipsoid<T, Parameters>(par) { detail::mod_ster::setup_gs48(this->m_par, this->m_proj_parm); } @@ -426,7 +422,9 @@ namespace projections template <typename T, typename Parameters> struct alsk_ellipsoid : public detail::mod_ster::base_mod_ster_ellipsoid<T, Parameters> { - inline alsk_ellipsoid(const Parameters& par) : detail::mod_ster::base_mod_ster_ellipsoid<T, Parameters>(par) + template <typename Params> + inline alsk_ellipsoid(Params const& , Parameters const& par) + : detail::mod_ster::base_mod_ster_ellipsoid<T, Parameters>(par) { detail::mod_ster::setup_alsk(this->m_par, this->m_proj_parm); } @@ -446,7 +444,9 @@ namespace projections template <typename T, typename Parameters> struct gs50_ellipsoid : public detail::mod_ster::base_mod_ster_ellipsoid<T, Parameters> { - inline gs50_ellipsoid(const Parameters& par) : detail::mod_ster::base_mod_ster_ellipsoid<T, Parameters>(par) + template <typename Params> + inline gs50_ellipsoid(Params const& , Parameters const& par) + : detail::mod_ster::base_mod_ster_ellipsoid<T, Parameters>(par) { detail::mod_ster::setup_gs50(this->m_par, this->m_proj_parm); } @@ -457,71 +457,26 @@ namespace projections { // Static projection - BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::par4::mil_os, mil_os_ellipsoid, mil_os_ellipsoid) - BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::par4::lee_os, lee_os_ellipsoid, lee_os_ellipsoid) - BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::par4::gs48, gs48_ellipsoid, gs48_ellipsoid) - BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::par4::alsk, alsk_ellipsoid, alsk_ellipsoid) - BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::par4::gs50, gs50_ellipsoid, gs50_ellipsoid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_mil_os, mil_os_ellipsoid, mil_os_ellipsoid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_lee_os, lee_os_ellipsoid, lee_os_ellipsoid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_gs48, gs48_ellipsoid, gs48_ellipsoid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_alsk, alsk_ellipsoid, alsk_ellipsoid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_gs50, gs50_ellipsoid, gs50_ellipsoid) // Factory entry(s) - template <typename T, typename Parameters> - class mil_os_entry : public detail::factory_entry<T, Parameters> - { - public : - virtual base_v<T, Parameters>* create_new(const Parameters& par) const - { - return new base_v_fi<mil_os_ellipsoid<T, Parameters>, T, Parameters>(par); - } - }; - - template <typename T, typename Parameters> - class lee_os_entry : public detail::factory_entry<T, Parameters> - { - public : - virtual base_v<T, Parameters>* create_new(const Parameters& par) const - { - return new base_v_fi<lee_os_ellipsoid<T, Parameters>, T, Parameters>(par); - } - }; - - template <typename T, typename Parameters> - class gs48_entry : public detail::factory_entry<T, Parameters> - { - public : - virtual base_v<T, Parameters>* create_new(const Parameters& par) const - { - return new base_v_fi<gs48_ellipsoid<T, Parameters>, T, Parameters>(par); - } - }; - - template <typename T, typename Parameters> - class alsk_entry : public detail::factory_entry<T, Parameters> - { - public : - virtual base_v<T, Parameters>* create_new(const Parameters& par) const - { - return new base_v_fi<alsk_ellipsoid<T, Parameters>, T, Parameters>(par); - } - }; - - template <typename T, typename Parameters> - class gs50_entry : public detail::factory_entry<T, Parameters> - { - public : - virtual base_v<T, Parameters>* create_new(const Parameters& par) const - { - return new base_v_fi<gs50_ellipsoid<T, Parameters>, T, Parameters>(par); - } - }; - - template <typename T, typename Parameters> - inline void mod_ster_init(detail::base_factory<T, Parameters>& factory) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(mil_os_entry, mil_os_ellipsoid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(lee_os_entry, lee_os_ellipsoid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(gs48_entry, gs48_ellipsoid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(alsk_entry, alsk_ellipsoid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(gs50_entry, gs50_ellipsoid) + + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(mod_ster_init) { - factory.add_to_factory("mil_os", new mil_os_entry<T, Parameters>); - factory.add_to_factory("lee_os", new lee_os_entry<T, Parameters>); - factory.add_to_factory("gs48", new gs48_entry<T, Parameters>); - factory.add_to_factory("alsk", new alsk_entry<T, Parameters>); - factory.add_to_factory("gs50", new gs50_entry<T, Parameters>); + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(mil_os, mil_os_entry) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(lee_os, lee_os_entry) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(gs48, gs48_entry) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(alsk, alsk_entry) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(gs50, gs50_entry) } } // namespace detail diff --git a/boost/geometry/srs/projections/proj/moll.hpp b/boost/geometry/srs/projections/proj/moll.hpp index deceb3401e..b62175a866 100644 --- a/boost/geometry/srs/projections/proj/moll.hpp +++ b/boost/geometry/srs/projections/proj/moll.hpp @@ -51,14 +51,6 @@ namespace boost { namespace geometry { -namespace srs { namespace par4 -{ - struct moll {}; // Mollweide - struct wag4 {}; // Wagner IV - struct wag5 {}; // Wagner V - -}} //namespace srs::par4 - namespace projections { #ifndef DOXYGEN_NO_DETAIL @@ -87,7 +79,7 @@ namespace projections // FORWARD(s_forward) spheroid // Project coordinates from geographic (lon, lat) to cartesian (x, y) - inline void fwd(T& lp_lon, T& lp_lat, T& xy_x, T& xy_y) const + inline void fwd(T const& lp_lon, T lp_lat, T& xy_x, T& xy_y) const { static const T half_pi = detail::half_pi<T>(); @@ -111,7 +103,7 @@ namespace projections // INVERSE(s_inverse) spheroid // Project coordinates from cartesian (x, y) to geographic (lon, lat) - inline void inv(T& xy_x, T& xy_y, T& lp_lon, T& lp_lat) const + inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const { static const T pi = detail::pi<T>(); @@ -189,7 +181,9 @@ namespace projections template <typename T, typename Parameters> struct moll_spheroid : public detail::moll::base_moll_spheroid<T, Parameters> { - inline moll_spheroid(const Parameters& par) : detail::moll::base_moll_spheroid<T, Parameters>(par) + template <typename Params> + inline moll_spheroid(Params const& , Parameters const& par) + : detail::moll::base_moll_spheroid<T, Parameters>(par) { detail::moll::setup_moll(this->m_par, this->m_proj_parm); } @@ -210,7 +204,9 @@ namespace projections template <typename T, typename Parameters> struct wag4_spheroid : public detail::moll::base_moll_spheroid<T, Parameters> { - inline wag4_spheroid(const Parameters& par) : detail::moll::base_moll_spheroid<T, Parameters>(par) + template <typename Params> + inline wag4_spheroid(Params const& , Parameters const& par) + : detail::moll::base_moll_spheroid<T, Parameters>(par) { detail::moll::setup_wag4(this->m_par, this->m_proj_parm); } @@ -231,7 +227,9 @@ namespace projections template <typename T, typename Parameters> struct wag5_spheroid : public detail::moll::base_moll_spheroid<T, Parameters> { - inline wag5_spheroid(const Parameters& par) : detail::moll::base_moll_spheroid<T, Parameters>(par) + template <typename Params> + inline wag5_spheroid(Params const& , Parameters const& par) + : detail::moll::base_moll_spheroid<T, Parameters>(par) { detail::moll::setup_wag5(this->m_par, this->m_proj_parm); } @@ -242,47 +240,20 @@ namespace projections { // Static projection - BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::par4::moll, moll_spheroid, moll_spheroid) - BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::par4::wag4, wag4_spheroid, wag4_spheroid) - BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::par4::wag5, wag5_spheroid, wag5_spheroid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_moll, moll_spheroid, moll_spheroid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_wag4, wag4_spheroid, wag4_spheroid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_wag5, wag5_spheroid, wag5_spheroid) // Factory entry(s) - template <typename T, typename Parameters> - class moll_entry : public detail::factory_entry<T, Parameters> - { - public : - virtual base_v<T, Parameters>* create_new(const Parameters& par) const - { - return new base_v_fi<moll_spheroid<T, Parameters>, T, Parameters>(par); - } - }; - - template <typename T, typename Parameters> - class wag4_entry : public detail::factory_entry<T, Parameters> - { - public : - virtual base_v<T, Parameters>* create_new(const Parameters& par) const - { - return new base_v_fi<wag4_spheroid<T, Parameters>, T, Parameters>(par); - } - }; - - template <typename T, typename Parameters> - class wag5_entry : public detail::factory_entry<T, Parameters> - { - public : - virtual base_v<T, Parameters>* create_new(const Parameters& par) const - { - return new base_v_fi<wag5_spheroid<T, Parameters>, T, Parameters>(par); - } - }; - - template <typename T, typename Parameters> - inline void moll_init(detail::base_factory<T, Parameters>& factory) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(moll_entry, moll_spheroid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(wag4_entry, wag4_spheroid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(wag5_entry, wag5_spheroid) + + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(moll_init) { - factory.add_to_factory("moll", new moll_entry<T, Parameters>); - factory.add_to_factory("wag4", new wag4_entry<T, Parameters>); - factory.add_to_factory("wag5", new wag5_entry<T, Parameters>); + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(moll, moll_entry); + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(wag4, wag4_entry); + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(wag5, wag5_entry); } } // namespace detail diff --git a/boost/geometry/srs/projections/proj/natearth.hpp b/boost/geometry/srs/projections/proj/natearth.hpp index 47da25b9e2..6c9935b0ef 100644 --- a/boost/geometry/srs/projections/proj/natearth.hpp +++ b/boost/geometry/srs/projections/proj/natearth.hpp @@ -61,12 +61,6 @@ namespace boost { namespace geometry { -namespace srs { namespace par4 -{ - struct natearth {}; // Natural Earth - -}} //namespace srs::par4 - namespace projections { #ifndef DOXYGEN_NO_DETAIL @@ -107,7 +101,7 @@ namespace projections // FORWARD(s_forward) spheroid // Project coordinates from geographic (lon, lat) to cartesian (x, y) - inline void fwd(T& lp_lon, T& lp_lat, T& xy_x, T& xy_y) const + inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const { T phi2, phi4; @@ -119,7 +113,7 @@ namespace projections // INVERSE(s_inverse) spheroid // Project coordinates from cartesian (x, y) to geographic (lon, lat) - inline void inv(T& xy_x, T& xy_y, T& lp_lon, T& lp_lat) const + inline void inv(T const& xy_x, T xy_y, T& lp_lon, T& lp_lat) const { static const T max_y = natearth::max_y<T>(); @@ -186,7 +180,9 @@ namespace projections template <typename T, typename Parameters> struct natearth_spheroid : public detail::natearth::base_natearth_spheroid<T, Parameters> { - inline natearth_spheroid(const Parameters& par) : detail::natearth::base_natearth_spheroid<T, Parameters>(par) + template <typename Params> + inline natearth_spheroid(Params const& , Parameters const& par) + : detail::natearth::base_natearth_spheroid<T, Parameters>(par) { detail::natearth::setup_natearth(this->m_par); } @@ -197,23 +193,14 @@ namespace projections { // Static projection - BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::par4::natearth, natearth_spheroid, natearth_spheroid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_natearth, natearth_spheroid, natearth_spheroid) // Factory entry(s) - template <typename T, typename Parameters> - class natearth_entry : public detail::factory_entry<T, Parameters> - { - public : - virtual base_v<T, Parameters>* create_new(const Parameters& par) const - { - return new base_v_fi<natearth_spheroid<T, Parameters>, T, Parameters>(par); - } - }; + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(natearth_entry, natearth_spheroid) - template <typename T, typename Parameters> - inline void natearth_init(detail::base_factory<T, Parameters>& factory) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(natearth_init) { - factory.add_to_factory("natearth", new natearth_entry<T, Parameters>); + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(natearth, natearth_entry) } } // namespace detail diff --git a/boost/geometry/srs/projections/proj/nell.hpp b/boost/geometry/srs/projections/proj/nell.hpp index fcb0e18b17..c8a10f7beb 100644 --- a/boost/geometry/srs/projections/proj/nell.hpp +++ b/boost/geometry/srs/projections/proj/nell.hpp @@ -49,12 +49,6 @@ namespace boost { namespace geometry { -namespace srs { namespace par4 -{ - struct nell {}; // Nell - -}} //namespace srs::par4 - namespace projections { #ifndef DOXYGEN_NO_DETAIL @@ -75,7 +69,7 @@ namespace projections // FORWARD(s_forward) spheroid // Project coordinates from geographic (lon, lat) to cartesian (x, y) - inline void fwd(T& lp_lon, T& lp_lat, T& xy_x, T& xy_y) const + inline void fwd(T const& lp_lon, T lp_lat, T& xy_x, T& xy_y) const { T k, V; int i; @@ -95,7 +89,7 @@ namespace projections // INVERSE(s_inverse) spheroid // Project coordinates from cartesian (x, y) to geographic (lon, lat) - inline void inv(T& xy_x, T& xy_y, T& lp_lon, T& lp_lat) const + inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const { lp_lon = 2. * xy_x / (1. + cos(xy_y)); lp_lat = aasin(0.5 * (xy_y + sin(xy_y))); @@ -133,7 +127,9 @@ namespace projections template <typename T, typename Parameters> struct nell_spheroid : public detail::nell::base_nell_spheroid<T, Parameters> { - inline nell_spheroid(const Parameters& par) : detail::nell::base_nell_spheroid<T, Parameters>(par) + template <typename Params> + inline nell_spheroid(Params const& , Parameters const& par) + : detail::nell::base_nell_spheroid<T, Parameters>(par) { detail::nell::setup_nell(this->m_par); } @@ -144,23 +140,14 @@ namespace projections { // Static projection - BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::par4::nell, nell_spheroid, nell_spheroid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_nell, nell_spheroid, nell_spheroid) // Factory entry(s) - template <typename T, typename Parameters> - class nell_entry : public detail::factory_entry<T, Parameters> - { - public : - virtual base_v<T, Parameters>* create_new(const Parameters& par) const - { - return new base_v_fi<nell_spheroid<T, Parameters>, T, Parameters>(par); - } - }; + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(nell_entry, nell_spheroid) - template <typename T, typename Parameters> - inline void nell_init(detail::base_factory<T, Parameters>& factory) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(nell_init) { - factory.add_to_factory("nell", new nell_entry<T, Parameters>); + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(nell, nell_entry) } } // namespace detail diff --git a/boost/geometry/srs/projections/proj/nell_h.hpp b/boost/geometry/srs/projections/proj/nell_h.hpp index 73f0018ac6..2e0e05738a 100644 --- a/boost/geometry/srs/projections/proj/nell_h.hpp +++ b/boost/geometry/srs/projections/proj/nell_h.hpp @@ -50,12 +50,6 @@ namespace boost { namespace geometry { -namespace srs { namespace par4 -{ - struct nell_h {}; // Nell-Hammer - -}} //namespace srs::par4 - namespace projections { #ifndef DOXYGEN_NO_DETAIL @@ -76,7 +70,7 @@ namespace projections // FORWARD(s_forward) spheroid // Project coordinates from geographic (lon, lat) to cartesian (x, y) - inline void fwd(T& lp_lon, T& lp_lat, T& xy_x, T& xy_y) const + inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const { xy_x = 0.5 * lp_lon * (1. + cos(lp_lat)); xy_y = 2.0 * (lp_lat - tan(0.5 *lp_lat)); @@ -84,7 +78,7 @@ namespace projections // INVERSE(s_inverse) spheroid // Project coordinates from cartesian (x, y) to geographic (lon, lat) - inline void inv(T& xy_x, T& xy_y, T& lp_lon, T& lp_lat) const + inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const { static const T half_pi = detail::half_pi<T>(); @@ -137,7 +131,9 @@ namespace projections template <typename T, typename Parameters> struct nell_h_spheroid : public detail::nell_h::base_nell_h_spheroid<T, Parameters> { - inline nell_h_spheroid(const Parameters& par) : detail::nell_h::base_nell_h_spheroid<T, Parameters>(par) + template <typename Params> + inline nell_h_spheroid(Params const& , Parameters const& par) + : detail::nell_h::base_nell_h_spheroid<T, Parameters>(par) { detail::nell_h::setup_nell_h(this->m_par); } @@ -148,23 +144,14 @@ namespace projections { // Static projection - BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::par4::nell_h, nell_h_spheroid, nell_h_spheroid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_nell_h, nell_h_spheroid, nell_h_spheroid) // Factory entry(s) - template <typename T, typename Parameters> - class nell_h_entry : public detail::factory_entry<T, Parameters> - { - public : - virtual base_v<T, Parameters>* create_new(const Parameters& par) const - { - return new base_v_fi<nell_h_spheroid<T, Parameters>, T, Parameters>(par); - } - }; + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(nell_h_entry, nell_h_spheroid) - template <typename T, typename Parameters> - inline void nell_h_init(detail::base_factory<T, Parameters>& factory) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(nell_h_init) { - factory.add_to_factory("nell_h", new nell_h_entry<T, Parameters>); + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(nell_h, nell_h_entry) } } // namespace detail diff --git a/boost/geometry/srs/projections/proj/nocol.hpp b/boost/geometry/srs/projections/proj/nocol.hpp index 01e428c6d4..924ec86efd 100644 --- a/boost/geometry/srs/projections/proj/nocol.hpp +++ b/boost/geometry/srs/projections/proj/nocol.hpp @@ -50,12 +50,6 @@ namespace boost { namespace geometry { -namespace srs { namespace par4 -{ - struct nicol {}; // Nicolosi Globular - -}} //namespace srs::par4 - namespace projections { #ifndef DOXYGEN_NO_DETAIL @@ -75,7 +69,7 @@ namespace projections // FORWARD(s_forward) spheroid // Project coordinates from geographic (lon, lat) to cartesian (x, y) - inline void fwd(T& lp_lon, T& lp_lat, T& xy_x, T& xy_y) const + inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const { static const T half_pi = detail::half_pi<T>(); @@ -143,7 +137,9 @@ namespace projections template <typename T, typename Parameters> struct nicol_spheroid : public detail::nocol::base_nocol_spheroid<T, Parameters> { - inline nicol_spheroid(const Parameters& par) : detail::nocol::base_nocol_spheroid<T, Parameters>(par) + template <typename Params> + inline nicol_spheroid(Params const& , Parameters const& par) + : detail::nocol::base_nocol_spheroid<T, Parameters>(par) { detail::nocol::setup_nicol(this->m_par); } @@ -154,23 +150,14 @@ namespace projections { // Static projection - BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::par4::nicol, nicol_spheroid, nicol_spheroid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_nicol, nicol_spheroid, nicol_spheroid) // Factory entry(s) - template <typename T, typename Parameters> - class nicol_entry : public detail::factory_entry<T, Parameters> - { - public : - virtual base_v<T, Parameters>* create_new(const Parameters& par) const - { - return new base_v_f<nicol_spheroid<T, Parameters>, T, Parameters>(par); - } - }; + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_F(nicol_entry, nicol_spheroid) - template <typename T, typename Parameters> - inline void nocol_init(detail::base_factory<T, Parameters>& factory) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(nocol_init) { - factory.add_to_factory("nicol", new nicol_entry<T, Parameters>); + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(nicol, nicol_entry) } } // namespace detail diff --git a/boost/geometry/srs/projections/proj/nsper.hpp b/boost/geometry/srs/projections/proj/nsper.hpp index 2910ee6203..89dc6a8a15 100644 --- a/boost/geometry/srs/projections/proj/nsper.hpp +++ b/boost/geometry/srs/projections/proj/nsper.hpp @@ -52,13 +52,6 @@ namespace boost { namespace geometry { -namespace srs { namespace par4 -{ - struct nsper {}; // Near-sided perspective - struct tpers {}; // Tilted perspective - -}} //namespace srs::par4 - namespace projections { #ifndef DOXYGEN_NO_DETAIL @@ -105,7 +98,7 @@ namespace projections // FORWARD(s_forward) spheroid // Project coordinates from geographic (lon, lat) to cartesian (x, y) - inline void fwd(T& lp_lon, T& lp_lat, T& xy_x, T& xy_y) const + inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const { T coslam, cosphi, sinphi; @@ -158,7 +151,7 @@ namespace projections // INVERSE(s_inverse) spheroid // Project coordinates from cartesian (x, y) to geographic (lon, lat) - inline void inv(T& xy_x, T& xy_y, T& lp_lon, T& lp_lat) const + inline void inv(T xy_x, T xy_y, T& lp_lon, T& lp_lat) const { T rh, cosz, sinz; @@ -211,10 +204,11 @@ namespace projections }; - template <typename Parameters, typename T> - inline void setup(Parameters& par, par_nsper<T>& proj_parm) + template <typename Params, typename Parameters, typename T> + inline void setup(Params const& params, Parameters& par, par_nsper<T>& proj_parm) { - if ((proj_parm.height = pj_get_param_f(par.params, "h")) <= 0.) + proj_parm.height = pj_get_param_f<T, srs::spar::h>(params, "h", srs::dpar::h); + if (proj_parm.height <= 0.) BOOST_THROW_EXCEPTION( projection_exception(error_h_less_than_zero) ); if (fabs(fabs(par.phi0) - geometry::math::half_pi<T>()) < epsilon10) @@ -236,27 +230,25 @@ namespace projections // Near-sided perspective - template <typename Parameters, typename T> - inline void setup_nsper(Parameters& par, par_nsper<T>& proj_parm) + template <typename Params, typename Parameters, typename T> + inline void setup_nsper(Params const& params, Parameters& par, par_nsper<T>& proj_parm) { proj_parm.tilt = 0; - setup(par, proj_parm); + setup(params, par, proj_parm); } // Tilted perspective - template <typename Parameters, typename T> - inline void setup_tpers(Parameters& par, par_nsper<T>& proj_parm) + template <typename Params, typename Parameters, typename T> + inline void setup_tpers(Params const& params, Parameters& par, par_nsper<T>& proj_parm) { - T omega, gamma; - - omega = pj_get_param_r(par.params, "tilt"); - gamma = pj_get_param_r(par.params, "azi"); + T const omega = pj_get_param_r<T, srs::spar::tilt>(params, "tilt", srs::dpar::tilt); + T const gamma = pj_get_param_r<T, srs::spar::azi>(params, "azi", srs::dpar::azi); proj_parm.tilt = 1; proj_parm.cg = cos(gamma); proj_parm.sg = sin(gamma); proj_parm.cw = cos(omega); proj_parm.sw = sin(omega); - setup(par, proj_parm); + setup(params, par, proj_parm); } }} // namespace detail::nsper @@ -279,9 +271,11 @@ namespace projections template <typename T, typename Parameters> struct nsper_spheroid : public detail::nsper::base_nsper_spheroid<T, Parameters> { - inline nsper_spheroid(const Parameters& par) : detail::nsper::base_nsper_spheroid<T, Parameters>(par) + template <typename Params> + inline nsper_spheroid(Params const& params, Parameters const& par) + : detail::nsper::base_nsper_spheroid<T, Parameters>(par) { - detail::nsper::setup_nsper(this->m_par, this->m_proj_parm); + detail::nsper::setup_nsper(params, this->m_par, this->m_proj_parm); } }; @@ -304,9 +298,11 @@ namespace projections template <typename T, typename Parameters> struct tpers_spheroid : public detail::nsper::base_nsper_spheroid<T, Parameters> { - inline tpers_spheroid(const Parameters& par) : detail::nsper::base_nsper_spheroid<T, Parameters>(par) + template <typename Params> + inline tpers_spheroid(Params const& params, Parameters const& par) + : detail::nsper::base_nsper_spheroid<T, Parameters>(par) { - detail::nsper::setup_tpers(this->m_par, this->m_proj_parm); + detail::nsper::setup_tpers(params, this->m_par, this->m_proj_parm); } }; @@ -315,35 +311,17 @@ namespace projections { // Static projection - BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::par4::nsper, nsper_spheroid, nsper_spheroid) - BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::par4::tpers, tpers_spheroid, tpers_spheroid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_nsper, nsper_spheroid, nsper_spheroid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_tpers, tpers_spheroid, tpers_spheroid) // Factory entry(s) - template <typename T, typename Parameters> - class nsper_entry : public detail::factory_entry<T, Parameters> - { - public : - virtual base_v<T, Parameters>* create_new(const Parameters& par) const - { - return new base_v_fi<nsper_spheroid<T, Parameters>, T, Parameters>(par); - } - }; - - template <typename T, typename Parameters> - class tpers_entry : public detail::factory_entry<T, Parameters> - { - public : - virtual base_v<T, Parameters>* create_new(const Parameters& par) const - { - return new base_v_fi<tpers_spheroid<T, Parameters>, T, Parameters>(par); - } - }; + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(nsper_entry, nsper_spheroid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(tpers_entry, tpers_spheroid) - template <typename T, typename Parameters> - inline void nsper_init(detail::base_factory<T, Parameters>& factory) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(nsper_init) { - factory.add_to_factory("nsper", new nsper_entry<T, Parameters>); - factory.add_to_factory("tpers", new tpers_entry<T, Parameters>); + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(nsper, nsper_entry) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(tpers, tpers_entry) } } // namespace detail diff --git a/boost/geometry/srs/projections/proj/nzmg.hpp b/boost/geometry/srs/projections/proj/nzmg.hpp index 2806e1a2d2..858685f74f 100644 --- a/boost/geometry/srs/projections/proj/nzmg.hpp +++ b/boost/geometry/srs/projections/proj/nzmg.hpp @@ -56,12 +56,6 @@ namespace boost { namespace geometry { -namespace srs { namespace par4 -{ - struct nzmg {}; // New Zealand Map Grid - -}} //namespace srs::par4 - namespace projections { #ifndef DOXYGEN_NO_DETAIL @@ -119,7 +113,7 @@ namespace projections // FORWARD(e_forward) ellipsoid // Project coordinates from geographic (lon, lat) to cartesian (x, y) - inline void fwd(T& lp_lon, T& lp_lat, T& xy_x, T& xy_y) const + inline void fwd(T const& lp_lon, T lp_lat, T& xy_x, T& xy_y) const { static const T rad_to_sec5 = nzmg::rad_to_sec5<T>(); @@ -139,7 +133,7 @@ namespace projections // INVERSE(e_inverse) ellipsoid // Project coordinates from cartesian (x, y) to geographic (lon, lat) - inline void inv(T& xy_x, T& xy_y, T& lp_lon, T& lp_lat) const + inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const { static const T sec5_to_rad = nzmg::sec5_to_rad<T>(); @@ -184,7 +178,8 @@ namespace projections static const calc_t d2r = geometry::math::d2r<calc_t>(); /* force to International major axis */ - par.ra = 1. / (par.a = 6378388.0); + par.a = 6378388.0; + par.ra = 1. / par.a; par.lam0 = 173. * d2r; par.phi0 = -41. * d2r; par.x0 = 2510000.; @@ -208,7 +203,9 @@ namespace projections template <typename T, typename Parameters> struct nzmg_ellipsoid : public detail::nzmg::base_nzmg_ellipsoid<T, Parameters> { - inline nzmg_ellipsoid(const Parameters& par) : detail::nzmg::base_nzmg_ellipsoid<T, Parameters>(par) + template <typename Params> + inline nzmg_ellipsoid(Params const& , Parameters const& par) + : detail::nzmg::base_nzmg_ellipsoid<T, Parameters>(par) { detail::nzmg::setup_nzmg(this->m_par); } @@ -219,23 +216,14 @@ namespace projections { // Static projection - BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::par4::nzmg, nzmg_ellipsoid, nzmg_ellipsoid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_nzmg, nzmg_ellipsoid, nzmg_ellipsoid) // Factory entry(s) - template <typename T, typename Parameters> - class nzmg_entry : public detail::factory_entry<T, Parameters> - { - public : - virtual base_v<T, Parameters>* create_new(const Parameters& par) const - { - return new base_v_fi<nzmg_ellipsoid<T, Parameters>, T, Parameters>(par); - } - }; + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(nzmg_entry, nzmg_ellipsoid) - template <typename T, typename Parameters> - inline void nzmg_init(detail::base_factory<T, Parameters>& factory) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(nzmg_init) { - factory.add_to_factory("nzmg", new nzmg_entry<T, Parameters>); + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(nzmg, nzmg_entry) } } // namespace detail diff --git a/boost/geometry/srs/projections/proj/ob_tran.hpp b/boost/geometry/srs/projections/proj/ob_tran.hpp index dd6df24def..f5709228f5 100644 --- a/boost/geometry/srs/projections/proj/ob_tran.hpp +++ b/boost/geometry/srs/projections/proj/ob_tran.hpp @@ -43,23 +43,16 @@ #include <boost/geometry/util/math.hpp> #include <boost/shared_ptr.hpp> +#include <boost/geometry/srs/projections/impl/aasincos.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/impl/aasincos.hpp> +#include <boost/geometry/srs/projections/impl/pj_ell_set.hpp> +#include <boost/geometry/srs/projections/impl/projects.hpp> namespace boost { namespace geometry { -namespace srs { namespace par4 -{ - //struct ob_tran_oblique {}; - //struct ob_tran_transverse {}; - struct ob_tran {}; // General Oblique Transformation - -}} //namespace srs::par4 - namespace projections { #ifndef DOXYGEN_NO_DETAIL @@ -67,8 +60,14 @@ namespace projections // fwd declaration needed below template <typename T> - inline detail::base_v<T, parameters<T> >* - create_new(parameters<T> const& parameters); + inline detail::base_v<T, projections::parameters<T> >* + create_new(srs::detail::proj4_parameters const& params, + projections::parameters<T> const& parameters); + + template <typename T> + inline detail::base_v<T, projections::parameters<T> >* + create_new(srs::dpar::parameters<T> const& params, + projections::parameters<T> const& parameters); } // namespace detail @@ -78,23 +77,88 @@ namespace projections static const double tolerance = 1e-10; template <typename Parameters> - inline Parameters o_proj_parameters(Parameters const& par) + inline Parameters o_proj_parameters(srs::detail::proj4_parameters const& params, + Parameters const& par) + { + /* copy existing header into new */ + Parameters pj = par; + + /* get name of projection to be translated */ + pj.id = pj_get_param_s(params, "o_proj"); + if (pj.id.is_unknown()) + BOOST_THROW_EXCEPTION( projection_exception(error_no_rotation_proj) ); + + /* avoid endless recursion */ + if( pj.id.name == "ob_tran") + BOOST_THROW_EXCEPTION( projection_exception(error_failed_to_find_proj) ); + + // Commented out for consistency with Proj4 >= 5.0.0 + /* force spherical earth */ + //pj.one_es = pj.rone_es = 1.; + //pj.es = pj.e = 0.; + + return pj; + } + + template <typename T, typename Parameters> + inline Parameters o_proj_parameters(srs::dpar::parameters<T> const& params, + Parameters const& par) { /* copy existing header into new */ Parameters pj = par; /* get name of projection to be translated */ - pj.name = pj_get_param_s(par.params, "o_proj"); - if (pj.name.empty()) + typename srs::dpar::parameters<T>::const_iterator + it = pj_param_find(params, srs::dpar::o_proj); + if (it != params.end()) + pj.id = static_cast<srs::dpar::value_proj>(it->template get_value<int>()); + else BOOST_THROW_EXCEPTION( projection_exception(error_no_rotation_proj) ); /* avoid endless recursion */ - if( pj.name == "ob_tran") + if( pj.id.id == srs::dpar::proj_ob_tran) BOOST_THROW_EXCEPTION( projection_exception(error_failed_to_find_proj) ); + // Commented out for consistency with Proj4 >= 5.0.0 /* force spherical earth */ - pj.one_es = pj.rone_es = 1.; - pj.es = pj.e = 0.; + //pj.one_es = pj.rone_es = 1.; + //pj.es = pj.e = 0.; + + return pj; + } + + template <BOOST_GEOMETRY_PROJECTIONS_DETAIL_TYPENAME_PX, typename Parameters> + inline Parameters o_proj_parameters(srs::spar::parameters<BOOST_GEOMETRY_PROJECTIONS_DETAIL_PX> const& params, + Parameters const& par) + { + /* copy existing header into new */ + Parameters pj = par; + + /* get name of projection to be translated */ + typedef srs::spar::parameters<BOOST_GEOMETRY_PROJECTIONS_DETAIL_PX> params_type; + typedef typename srs::spar::detail::tuples_find_if + < + params_type, + srs::spar::detail::is_param_t<srs::spar::o_proj>::pred + >::type o_proj_type; + + static const bool is_found = srs::spar::detail::tuples_is_found<o_proj_type>::value; + BOOST_MPL_ASSERT_MSG((is_found), NO_ROTATION_PROJ, (params_type)); + + typedef typename o_proj_type::type proj_type; + static const bool is_specialized = srs::spar::detail::proj_traits<proj_type>::is_specialized; + BOOST_MPL_ASSERT_MSG((is_specialized), NO_ROTATION_PROJ, (params_type)); + + pj.id = srs::spar::detail::proj_traits<proj_type>::id; + + /* avoid endless recursion */ + static const bool is_non_resursive = ! boost::is_same<proj_type, srs::spar::proj_ob_tran>::value; + BOOST_MPL_ASSERT_MSG((is_non_resursive), INVALID_O_PROJ_PARAMETER, (params_type)); + + // Commented out for consistency with Proj4 >= 5.0.0 + /* force spherical earth */ + //pj.one_es = pj.rone_es = 1.; + //pj.es = pj.e = 0.; return pj; } @@ -102,19 +166,20 @@ namespace projections template <typename T, typename Parameters> struct par_ob_tran { - par_ob_tran(Parameters const& par) - : link(projections::detail::create_new(o_proj_parameters(par))) + template <typename Params> + par_ob_tran(Params const& params, Parameters const& par) + : link(projections::detail::create_new(params, o_proj_parameters(params, par))) { if (! link.get()) BOOST_THROW_EXCEPTION( projection_exception(error_unknown_projection_id) ); } - inline void fwd(T& lp_lon, T& lp_lat, T& xy_x, T& xy_y) const + inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const { link->fwd(lp_lon, lp_lat, xy_x, xy_y); } - inline void inv(T& xy_x, T& xy_y, T& lp_lon, T& lp_lat) const + inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const { link->inv(xy_x, xy_y, lp_lon, lp_lat); } @@ -128,34 +193,36 @@ namespace projections struct par_ob_tran_static { // this metafunction handles static error handling - typedef typename srs::par4::detail::pick_o_proj_tag + typedef typename srs::spar::detail::pick_o_proj_tag < StaticParameters >::type o_proj_tag; /* avoid endless recursion */ - static const bool is_o_proj_not_ob_tran = ! boost::is_same<o_proj_tag, srs::par4::ob_tran>::value; + static const bool is_o_proj_not_ob_tran = ! boost::is_same<o_proj_tag, srs::spar::proj_ob_tran>::value; BOOST_MPL_ASSERT_MSG((is_o_proj_not_ob_tran), INVALID_O_PROJ_PARAMETER, (StaticParameters)); typedef typename projections::detail::static_projection_type < o_proj_tag, - srs_sphere_tag, // force spherical + // Commented out for consistency with Proj4 >= 5.0.0 + //srs_sphere_tag, // force spherical + typename projections::detail::static_srs_tag<StaticParameters>::type, StaticParameters, T, Parameters >::type projection_type; - par_ob_tran_static(Parameters const& par) - : link(o_proj_parameters(par)) + par_ob_tran_static(StaticParameters const& params, Parameters const& par) + : link(params, o_proj_parameters(params, par)) {} - inline void fwd(T& lp_lon, T& lp_lat, T& xy_x, T& xy_y) const + inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const { link.fwd(lp_lon, lp_lat, xy_x, xy_y); } - inline void inv(T& xy_x, T& xy_y, T& lp_lon, T& lp_lat) const + inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const { link.inv(xy_x, xy_y, lp_lon, lp_lat); } @@ -166,7 +233,7 @@ namespace projections }; template <typename T, typename Par> - inline void o_forward(T& lp_lon, T& lp_lat, T& xy_x, T& xy_y, Par const& proj_parm) + inline void o_forward(T lp_lon, T lp_lat, T& xy_x, T& xy_y, Par const& proj_parm) { T coslam, sinphi, cosphi; @@ -181,7 +248,7 @@ namespace projections } template <typename T, typename Par> - inline void o_inverse(T& xy_x, T& xy_y, T& lp_lon, T& lp_lat, Par const& proj_parm) + inline void o_inverse(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat, Par const& proj_parm) { T coslam, sinphi, cosphi; @@ -197,7 +264,7 @@ namespace projections } template <typename T, typename Par> - inline void t_forward(T& lp_lon, T& lp_lat, T& xy_x, T& xy_y, Par const& proj_parm) + inline void t_forward(T lp_lon, T lp_lat, T& xy_x, T& xy_y, Par const& proj_parm) { T cosphi, coslam; @@ -210,7 +277,7 @@ namespace projections } template <typename T, typename Par> - inline void t_inverse(T& xy_x, T& xy_y, T& lp_lon, T& lp_lat, Par const& proj_parm) + inline void t_inverse(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat, Par const& proj_parm) { T cosphi, t; @@ -224,22 +291,23 @@ namespace projections } // General Oblique Transformation - template <typename T, typename Parameters, typename ProjParameters> - inline T setup_ob_tran(Parameters & par, ProjParameters& proj_parm) + template <typename T, typename Params, typename Parameters, typename ProjParameters> + inline T setup_ob_tran(Params const& params, Parameters & par, ProjParameters& proj_parm) { static const T half_pi = detail::half_pi<T>(); T phip, alpha; - par.es = 0.; /* force to spherical */ + // Commented out for consistency with Proj4 >= 5.0.0 + //par.es = 0.; /* force to spherical */ // proj_parm.link should be created at this point - if (pj_param_r(par.params, "o_alpha", alpha)) { + if (pj_param_r<srs::spar::o_alpha>(params, "o_alpha", srs::dpar::o_alpha, alpha)) { T lamc, phic; - lamc = pj_get_param_r(par.params, "o_lon_c"); - phic = pj_get_param_r(par.params, "o_lat_c"); + lamc = pj_get_param_r<T, srs::spar::o_lon_c>(params, "o_lon_c", srs::dpar::o_lon_c); + phic = pj_get_param_r<T, srs::spar::o_lon_c>(params, "o_lat_c", srs::dpar::o_lat_c); //alpha = pj_get_param_r(par.params, "o_alpha"); if (fabs(fabs(phic) - half_pi) <= tolerance) @@ -247,16 +315,16 @@ namespace projections proj_parm.lamp = lamc + aatan2(-cos(alpha), -sin(alpha) * sin(phic)); phip = aasin(cos(phic) * sin(alpha)); - } else if (pj_param_r(par.params, "o_lat_p", phip)) { /* specified new pole */ - proj_parm.lamp = pj_get_param_r(par.params, "o_lon_p"); + } else if (pj_param_r<srs::spar::o_lat_p>(params, "o_lat_p", srs::dpar::o_lat_p, phip)) { /* specified new pole */ + proj_parm.lamp = pj_get_param_r<T, srs::spar::o_lon_p>(params, "o_lon_p", srs::dpar::o_lon_p); //phip = pj_param_r(par.params, "o_lat_p"); } else { /* specified new "equator" points */ T lam1, lam2, phi1, phi2, con; - lam1 = pj_get_param_r(par.params, "o_lon_1"); - phi1 = pj_get_param_r(par.params, "o_lat_1"); - lam2 = pj_get_param_r(par.params, "o_lon_2"); - phi2 = pj_get_param_r(par.params, "o_lat_2"); + lam1 = pj_get_param_r<T, srs::spar::o_lon_1>(params, "o_lon_1", srs::dpar::o_lon_1); + phi1 = pj_get_param_r<T, srs::spar::o_lat_1>(params, "o_lat_1", srs::dpar::o_lat_1); + lam2 = pj_get_param_r<T, srs::spar::o_lon_2>(params, "o_lon_2", srs::dpar::o_lon_2); + phi2 = pj_get_param_r<T, srs::spar::o_lat_2>(params, "o_lat_2", srs::dpar::o_lat_2); if (fabs(phi1 - phi2) <= tolerance || (con = fabs(phi1)) <= tolerance || fabs(con - half_pi) <= tolerance || fabs(fabs(phi2) - half_pi) <= tolerance) BOOST_THROW_EXCEPTION( projection_exception(error_lat_1_or_2_zero_or_90) ); @@ -302,14 +370,14 @@ namespace projections // FORWARD(o_forward) spheroid // Project coordinates from geographic (lon, lat) to cartesian (x, y) - inline void fwd(T& lp_lon, T& lp_lat, T& xy_x, T& xy_y) const + inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const { o_forward(lp_lon, lp_lat, xy_x, xy_y, this->m_proj_parm); } // INVERSE(o_inverse) spheroid // Project coordinates from cartesian (x, y) to geographic (lon, lat) - inline void inv(T& xy_x, T& xy_y, T& lp_lon, T& lp_lat) const + inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const { o_inverse(xy_x, xy_y, lp_lon, lp_lat, this->m_proj_parm); } @@ -339,14 +407,14 @@ namespace projections // FORWARD(t_forward) spheroid // Project coordinates from geographic (lon, lat) to cartesian (x, y) - inline void fwd(T& lp_lon, T& lp_lat, T& xy_x, T& xy_y) const + inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const { t_forward(lp_lon, lp_lat, xy_x, xy_y, this->m_proj_parm); } // INVERSE(t_inverse) spheroid // Project coordinates from cartesian (x, y) to geographic (lon, lat) - inline void inv(T& xy_x, T& xy_y, T& lp_lon, T& lp_lat) const + inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const { t_inverse(xy_x, xy_y, lp_lon, lp_lat, this->m_proj_parm); } @@ -366,14 +434,14 @@ namespace projections par_ob_tran_static<StaticParameters, T, Parameters> m_proj_parm; bool m_is_oblique; - inline base_ob_tran_static(Parameters const& par) + inline base_ob_tran_static(StaticParameters const& params, Parameters const& par) : base_t_fi<base_ob_tran_static<StaticParameters, T, Parameters>, T, Parameters>(*this, par) - , m_proj_parm(par) + , m_proj_parm(params, par) {} // FORWARD(o_forward) spheroid // Project coordinates from geographic (lon, lat) to cartesian (x, y) - inline void fwd(T& lp_lon, T& lp_lat, T& xy_x, T& xy_y) const + inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const { if (m_is_oblique) { o_forward(lp_lon, lp_lat, xy_x, xy_y, this->m_proj_parm); @@ -384,7 +452,7 @@ namespace projections // INVERSE(o_inverse) spheroid // Project coordinates from cartesian (x, y) to geographic (lon, lat) - inline void inv(T& xy_x, T& xy_y, T& lp_lon, T& lp_lat) const + inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const { if (m_is_oblique) { o_inverse(xy_x, xy_y, lp_lon, lp_lat, this->m_proj_parm); @@ -505,10 +573,10 @@ namespace projections template <typename StaticParameters, typename T, typename Parameters> struct ob_tran_static : public detail::ob_tran::base_ob_tran_static<StaticParameters, T, Parameters> { - inline ob_tran_static(const Parameters& par) - : detail::ob_tran::base_ob_tran_static<StaticParameters, T, Parameters>(par) + inline ob_tran_static(StaticParameters const& params, Parameters const& par) + : detail::ob_tran::base_ob_tran_static<StaticParameters, T, Parameters>(params, par) { - T phip = detail::ob_tran::setup_ob_tran<T>(this->m_par, this->m_proj_parm); + T phip = detail::ob_tran::setup_ob_tran<T>(params, this->m_par, this->m_proj_parm); this->m_is_oblique = fabs(phip) > detail::ob_tran::tolerance; } }; @@ -518,39 +586,34 @@ namespace projections { // Static projection - template <typename BGP, typename CT, typename P> - struct static_projection_type<srs::par4::ob_tran, srs_sphere_tag, BGP, CT, P> + template <typename SP, typename CT, typename P> + struct static_projection_type<srs::spar::proj_ob_tran, srs_sphere_tag, SP, CT, P> { - typedef ob_tran_static<BGP, CT, P> type; + typedef ob_tran_static<SP, CT, P> type; }; - template <typename BGP, typename CT, typename P> - struct static_projection_type<srs::par4::ob_tran, srs_spheroid_tag, BGP, CT, P> + template <typename SP, typename CT, typename P> + struct static_projection_type<srs::spar::proj_ob_tran, srs_spheroid_tag, SP, CT, P> { - typedef ob_tran_static<BGP, CT, P> type; + typedef ob_tran_static<SP, CT, P> type; }; // Factory entry(s) - template <typename T, typename Parameters> - class ob_tran_entry : public detail::factory_entry<T, Parameters> + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_BEGIN(ob_tran_entry) { - public : - virtual base_v<T, Parameters>* create_new(const Parameters& par) const - { - Parameters params = par; - detail::ob_tran::par_ob_tran<T, Parameters> proj_parm(params); - T phip = detail::ob_tran::setup_ob_tran<T>(params, proj_parm); - - if (fabs(phip) > detail::ob_tran::tolerance) - return new base_v_fi<ob_tran_oblique<T, Parameters>, T, Parameters>(params, proj_parm); - else - return new base_v_fi<ob_tran_transverse<T, Parameters>, T, Parameters>(params, proj_parm); - } - }; + Parameters parameters_copy = parameters; + detail::ob_tran::par_ob_tran<T, Parameters> proj_parm(params, parameters_copy); + T phip = detail::ob_tran::setup_ob_tran<T>(params, parameters_copy, proj_parm); + + if (fabs(phip) > detail::ob_tran::tolerance) + return new base_v_fi<ob_tran_oblique<T, Parameters>, T, Parameters>(parameters_copy, proj_parm); + else + return new base_v_fi<ob_tran_transverse<T, Parameters>, T, Parameters>(parameters_copy, proj_parm); + } + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_END - template <typename T, typename Parameters> - inline void ob_tran_init(detail::base_factory<T, Parameters>& factory) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(ob_tran_init) { - factory.add_to_factory("ob_tran", new ob_tran_entry<T, Parameters>); + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(ob_tran, ob_tran_entry) } } // namespace detail diff --git a/boost/geometry/srs/projections/proj/ocea.hpp b/boost/geometry/srs/projections/proj/ocea.hpp index f8dd4c4ed1..af8be1ca08 100644 --- a/boost/geometry/srs/projections/proj/ocea.hpp +++ b/boost/geometry/srs/projections/proj/ocea.hpp @@ -50,12 +50,6 @@ namespace boost { namespace geometry { -namespace srs { namespace par4 -{ - struct ocea {}; // Oblique Cylindrical Equal Area - -}} //namespace srs::par4 - namespace projections { #ifndef DOXYGEN_NO_DETAIL @@ -85,7 +79,7 @@ namespace projections // FORWARD(s_forward) spheroid // Project coordinates from geographic (lon, lat) to cartesian (x, y) - inline void fwd(T& lp_lon, T& lp_lat, T& xy_x, T& xy_y) const + inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const { static const T pi = detail::pi<T>(); @@ -102,7 +96,7 @@ namespace projections // INVERSE(s_inverse) spheroid // Project coordinates from cartesian (x, y) to geographic (lon, lat) - inline void inv(T& xy_x, T& xy_y, T& lp_lon, T& lp_lat) const + inline void inv(T xy_x, T xy_y, T& lp_lon, T& lp_lat) const { T t, s; @@ -122,8 +116,8 @@ namespace projections }; // Oblique Cylindrical Equal Area - template <typename Parameters, typename T> - inline void setup_ocea(Parameters& par, par_ocea<T>& proj_parm) + template <typename Params, typename Parameters, typename T> + inline void setup_ocea(Params const& params, Parameters& par, par_ocea<T>& proj_parm) { static const T half_pi = detail::half_pi<T>(); @@ -132,10 +126,10 @@ namespace projections proj_parm.rok = 1. / par.k0; proj_parm.rtk = par.k0; /*If the keyword "alpha" is found in the sentence then use 1point+1azimuth*/ - if ( pj_param_r(par.params, "alpha", alpha)) { + if ( pj_param_r<srs::spar::alpha>(params, "alpha", srs::dpar::alpha, alpha)) { /*Define Pole of oblique transformation from 1 point & 1 azimuth*/ //alpha = pj_get_param_r(par.params, "alpha"); // set above - lonz = pj_get_param_r(par.params, "lonc"); + lonz = pj_get_param_r<T, srs::spar::lonc>(params, "lonc", srs::dpar::lonc); /*Equation 9-8 page 80 (http://pubs.usgs.gov/pp/1395/report.pdf)*/ proj_parm.singam = atan(-cos(alpha)/(-sin(phi_0) * sin(alpha))) + lonz; /*Equation 9-7 page 80 (http://pubs.usgs.gov/pp/1395/report.pdf)*/ @@ -143,10 +137,10 @@ namespace projections /*If the keyword "alpha" is NOT found in the sentence then use 2points*/ } else { /*Define Pole of oblique transformation from 2 points*/ - phi_1 = pj_get_param_r(par.params, "lat_1"); - phi_2 = pj_get_param_r(par.params, "lat_2"); - lam_1 = pj_get_param_r(par.params, "lon_1"); - lam_2 = pj_get_param_r(par.params, "lon_2"); + phi_1 = pj_get_param_r<T, srs::spar::lat_1>(params, "lat_1", srs::dpar::lat_1); + phi_2 = pj_get_param_r<T, srs::spar::lat_2>(params, "lat_2", srs::dpar::lat_2); + lam_1 = pj_get_param_r<T, srs::spar::lon_1>(params, "lon_1", srs::dpar::lon_1); + lam_2 = pj_get_param_r<T, srs::spar::lon_2>(params, "lon_2", srs::dpar::lon_2); /*Equation 9-1 page 80 (http://pubs.usgs.gov/pp/1395/report.pdf)*/ proj_parm.singam = atan2(cos(phi_1) * sin(phi_2) * cos(lam_1) - sin(phi_1) * cos(phi_2) * cos(lam_2), @@ -193,9 +187,11 @@ namespace projections template <typename T, typename Parameters> struct ocea_spheroid : public detail::ocea::base_ocea_spheroid<T, Parameters> { - inline ocea_spheroid(const Parameters& par) : detail::ocea::base_ocea_spheroid<T, Parameters>(par) + template <typename Params> + inline ocea_spheroid(Params const& params, Parameters const& par) + : detail::ocea::base_ocea_spheroid<T, Parameters>(par) { - detail::ocea::setup_ocea(this->m_par, this->m_proj_parm); + detail::ocea::setup_ocea(params, this->m_par, this->m_proj_parm); } }; @@ -204,23 +200,14 @@ namespace projections { // Static projection - BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::par4::ocea, ocea_spheroid, ocea_spheroid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_ocea, ocea_spheroid, ocea_spheroid) // Factory entry(s) - template <typename T, typename Parameters> - class ocea_entry : public detail::factory_entry<T, Parameters> - { - public : - virtual base_v<T, Parameters>* create_new(const Parameters& par) const - { - return new base_v_fi<ocea_spheroid<T, Parameters>, T, Parameters>(par); - } - }; + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(ocea_entry, ocea_spheroid) - template <typename T, typename Parameters> - inline void ocea_init(detail::base_factory<T, Parameters>& factory) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(ocea_init) { - factory.add_to_factory("ocea", new ocea_entry<T, Parameters>); + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(ocea, ocea_entry) } } // namespace detail diff --git a/boost/geometry/srs/projections/proj/oea.hpp b/boost/geometry/srs/projections/proj/oea.hpp index 24840ea1d6..f78037d2cb 100644 --- a/boost/geometry/srs/projections/proj/oea.hpp +++ b/boost/geometry/srs/projections/proj/oea.hpp @@ -51,12 +51,6 @@ namespace boost { namespace geometry { -namespace srs { namespace par4 -{ - struct oea {}; // Oblated Equal Area - -}} //namespace srs::par4 - namespace projections { #ifndef DOXYGEN_NO_DETAIL @@ -84,7 +78,7 @@ namespace projections // FORWARD(s_forward) sphere // Project coordinates from geographic (lon, lat) to cartesian (x, y) - inline void fwd(T& lp_lon, T& lp_lat, T& xy_x, T& xy_y) const + inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const { T Az, M, N, cp, sp, cl, shz; @@ -101,7 +95,7 @@ namespace projections // INVERSE(s_inverse) sphere // Project coordinates from cartesian (x, y) to geographic (lon, lat) - inline void inv(T& xy_x, T& xy_y, T& lp_lon, T& lp_lat) const + inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const { T N, M, xp, yp, z, Az, cz, sz, cAz; @@ -126,14 +120,14 @@ namespace projections }; // Oblated Equal Area - template <typename Parameters, typename T> - inline void setup_oea(Parameters& par, par_oea<T>& proj_parm) + template <typename Params, typename Parameters, typename T> + inline void setup_oea(Params const& params, Parameters& par, par_oea<T>& proj_parm) { - if (((proj_parm.n = pj_get_param_f(par.params, "n")) <= 0.) || - ((proj_parm.m = pj_get_param_f(par.params, "m")) <= 0.)) { + if (((proj_parm.n = pj_get_param_f<T, srs::spar::n>(params, "n", srs::dpar::n)) <= 0.) || + ((proj_parm.m = pj_get_param_f<T, srs::spar::m>(params, "m", srs::dpar::m)) <= 0.)) { BOOST_THROW_EXCEPTION( projection_exception(error_invalid_m_or_n) ); } else { - proj_parm.theta = pj_get_param_r(par.params, "theta"); + proj_parm.theta = pj_get_param_r<T, srs::spar::theta>(params, "theta", srs::dpar::theta); proj_parm.sp0 = sin(par.phi0); proj_parm.cp0 = cos(par.phi0); proj_parm.rn = 1./ proj_parm.n; @@ -168,9 +162,11 @@ namespace projections template <typename T, typename Parameters> struct oea_spheroid : public detail::oea::base_oea_spheroid<T, Parameters> { - inline oea_spheroid(const Parameters& par) : detail::oea::base_oea_spheroid<T, Parameters>(par) + template <typename Params> + inline oea_spheroid(Params const& params, Parameters const& par) + : detail::oea::base_oea_spheroid<T, Parameters>(par) { - detail::oea::setup_oea(this->m_par, this->m_proj_parm); + detail::oea::setup_oea(params, this->m_par, this->m_proj_parm); } }; @@ -179,23 +175,14 @@ namespace projections { // Static projection - BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::par4::oea, oea_spheroid, oea_spheroid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_oea, oea_spheroid, oea_spheroid) // Factory entry(s) - template <typename T, typename Parameters> - class oea_entry : public detail::factory_entry<T, Parameters> - { - public : - virtual base_v<T, Parameters>* create_new(const Parameters& par) const - { - return new base_v_fi<oea_spheroid<T, Parameters>, T, Parameters>(par); - } - }; + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(oea_entry, oea_spheroid) - template <typename T, typename Parameters> - inline void oea_init(detail::base_factory<T, Parameters>& factory) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(oea_init) { - factory.add_to_factory("oea", new oea_entry<T, Parameters>); + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(oea, oea_entry) } } // namespace detail diff --git a/boost/geometry/srs/projections/proj/omerc.hpp b/boost/geometry/srs/projections/proj/omerc.hpp index a4448d182d..1e041e2ac0 100644 --- a/boost/geometry/srs/projections/proj/omerc.hpp +++ b/boost/geometry/srs/projections/proj/omerc.hpp @@ -54,12 +54,6 @@ namespace boost { namespace geometry { -namespace srs { namespace par4 -{ - struct omerc {}; // Oblique Mercator - -}} //namespace srs::par4 - namespace projections { #ifndef DOXYGEN_NO_DETAIL @@ -89,7 +83,7 @@ namespace projections // FORWARD(e_forward) ellipsoid // Project coordinates from geographic (lon, lat) to cartesian (x, y) - inline void fwd(T& lp_lon, T& lp_lat, T& xy_x, T& xy_y) const + inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const { static const T half_pi = detail::half_pi<T>(); @@ -128,7 +122,7 @@ namespace projections // INVERSE(e_inverse) ellipsoid // Project coordinates from cartesian (x, y) to geographic (lon, lat) - inline void inv(T& xy_x, T& xy_y, T& lp_lon, T& lp_lat) const + inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const { static const T half_pi = detail::half_pi<T>(); @@ -167,8 +161,8 @@ namespace projections }; // Oblique Mercator - template <typename Parameters, typename T> - inline void setup_omerc(Parameters& par, par_omerc<T>& proj_parm) + template <typename Params, typename Parameters, typename T> + inline void setup_omerc(Params const& params, Parameters& par, par_omerc<T>& proj_parm) { static const T fourth_pi = detail::fourth_pi<T>(); static const T half_pi = detail::half_pi<T>(); @@ -179,11 +173,11 @@ namespace projections gamma0, lamc=0, lam1=0, lam2=0, phi1=0, phi2=0, alpha_c=0; int alp, gam, no_off = 0; - proj_parm.no_rot = pj_get_param_b(par.params, "no_rot"); - alp = pj_param_r(par.params, "alpha", alpha_c); - gam = pj_param_r(par.params, "gamma", gamma); + proj_parm.no_rot = pj_get_param_b<srs::spar::no_rot>(params, "no_rot", srs::dpar::no_rot); + alp = pj_param_r<srs::spar::alpha>(params, "alpha", srs::dpar::alpha, alpha_c); + gam = pj_param_r<srs::spar::gamma>(params, "gamma", srs::dpar::gamma, gamma); if (alp || gam) { - lamc = pj_get_param_r(par.params, "lonc"); + lamc = pj_get_param_r<T, srs::spar::lonc>(params, "lonc", srs::dpar::lonc); // NOTE: This is not needed in Boost.Geometry //no_off = // /* For libproj4 compatability */ @@ -197,10 +191,10 @@ namespace projections // pj_get_param_s(par.params, "no_off"); //} } else { - lam1 = pj_get_param_r(par.params, "lon_1"); - phi1 = pj_get_param_r(par.params, "lat_1"); - lam2 = pj_get_param_r(par.params, "lon_2"); - phi2 = pj_get_param_r(par.params, "lat_2"); + lam1 = pj_get_param_r<T, srs::spar::lon_1>(params, "lon_1", srs::dpar::lon_1); + phi1 = pj_get_param_r<T, srs::spar::lat_1>(params, "lat_1", srs::dpar::lat_1); + lam2 = pj_get_param_r<T, srs::spar::lon_2>(params, "lon_2", srs::dpar::lon_2); + phi2 = pj_get_param_r<T, srs::spar::lat_2>(params, "lat_2", srs::dpar::lat_2); if (fabs(phi1 - phi2) <= tolerance || (con = fabs(phi1)) <= tolerance || fabs(con - half_pi) <= tolerance || @@ -305,9 +299,11 @@ namespace projections template <typename T, typename Parameters> struct omerc_ellipsoid : public detail::omerc::base_omerc_ellipsoid<T, Parameters> { - inline omerc_ellipsoid(const Parameters& par) : detail::omerc::base_omerc_ellipsoid<T, Parameters>(par) + template <typename Params> + inline omerc_ellipsoid(Params const& params, Parameters const& par) + : detail::omerc::base_omerc_ellipsoid<T, Parameters>(par) { - detail::omerc::setup_omerc(this->m_par, this->m_proj_parm); + detail::omerc::setup_omerc(params, this->m_par, this->m_proj_parm); } }; @@ -316,23 +312,14 @@ namespace projections { // Static projection - BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::par4::omerc, omerc_ellipsoid, omerc_ellipsoid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_omerc, omerc_ellipsoid, omerc_ellipsoid) // Factory entry(s) - template <typename T, typename Parameters> - class omerc_entry : public detail::factory_entry<T, Parameters> - { - public : - virtual base_v<T, Parameters>* create_new(const Parameters& par) const - { - return new base_v_fi<omerc_ellipsoid<T, Parameters>, T, Parameters>(par); - } - }; + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(omerc_entry, omerc_ellipsoid) - template <typename T, typename Parameters> - inline void omerc_init(detail::base_factory<T, Parameters>& factory) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(omerc_init) { - factory.add_to_factory("omerc", new omerc_entry<T, Parameters>); + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(omerc, omerc_entry) } } // namespace detail diff --git a/boost/geometry/srs/projections/proj/ortho.hpp b/boost/geometry/srs/projections/proj/ortho.hpp index 370af50f70..3196554480 100644 --- a/boost/geometry/srs/projections/proj/ortho.hpp +++ b/boost/geometry/srs/projections/proj/ortho.hpp @@ -52,12 +52,6 @@ namespace boost { namespace geometry { -namespace srs { namespace par4 -{ - struct ortho {}; // Orthographic - -}} //namespace srs::par4 - namespace projections { #ifndef DOXYGEN_NO_DETAIL @@ -94,7 +88,7 @@ namespace projections // FORWARD(s_forward) spheroid // Project coordinates from geographic (lon, lat) to cartesian (x, y) - inline void fwd(T& lp_lon, T& lp_lat, T& xy_x, T& xy_y) const + inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const { static const T half_pi = detail::half_pi<T>(); @@ -131,7 +125,7 @@ namespace projections // INVERSE(s_inverse) spheroid // Project coordinates from cartesian (x, y) to geographic (lon, lat) - inline void inv(T& xy_x, T& xy_y, T& lp_lon, T& lp_lat) const + inline void inv(T xy_x, T xy_y, T& lp_lon, T& lp_lat) const { static const T half_pi = detail::half_pi<T>(); @@ -218,7 +212,9 @@ namespace projections template <typename T, typename Parameters> struct ortho_spheroid : public detail::ortho::base_ortho_spheroid<T, Parameters> { - inline ortho_spheroid(const Parameters& par) : detail::ortho::base_ortho_spheroid<T, Parameters>(par) + template <typename Params> + inline ortho_spheroid(Params const& , Parameters const& par) + : detail::ortho::base_ortho_spheroid<T, Parameters>(par) { detail::ortho::setup_ortho(this->m_par, this->m_proj_parm); } @@ -229,23 +225,14 @@ namespace projections { // Static projection - BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::par4::ortho, ortho_spheroid, ortho_spheroid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_ortho, ortho_spheroid, ortho_spheroid) // Factory entry(s) - template <typename T, typename Parameters> - class ortho_entry : public detail::factory_entry<T, Parameters> - { - public : - virtual base_v<T, Parameters>* create_new(const Parameters& par) const - { - return new base_v_fi<ortho_spheroid<T, Parameters>, T, Parameters>(par); - } - }; + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(ortho_entry, ortho_spheroid) - template <typename T, typename Parameters> - inline void ortho_init(detail::base_factory<T, Parameters>& factory) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(ortho_init) { - factory.add_to_factory("ortho", new ortho_entry<T, Parameters>); + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(ortho, ortho_entry) } } // namespace detail diff --git a/boost/geometry/srs/projections/proj/poly.hpp b/boost/geometry/srs/projections/proj/poly.hpp index 95da13f0d7..d0fab653f3 100644 --- a/boost/geometry/srs/projections/proj/poly.hpp +++ b/boost/geometry/srs/projections/proj/poly.hpp @@ -50,12 +50,6 @@ namespace boost { namespace geometry { -namespace srs { namespace par4 -{ - struct poly {}; // Polyconic (American) - -}} //namespace srs::par4 - namespace projections { #ifndef DOXYGEN_NO_DETAIL @@ -88,7 +82,7 @@ namespace projections // FORWARD(e_forward) ellipsoid // Project coordinates from geographic (lon, lat) to cartesian (x, y) - inline void fwd(T& lp_lon, T& lp_lat, T& xy_x, T& xy_y) const + inline void fwd(T lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const { T ms, sp, cp; @@ -105,7 +99,7 @@ namespace projections // INVERSE(e_inverse) ellipsoid // Project coordinates from cartesian (x, y) to geographic (lon, lat) - inline void inv(T& xy_x, T& xy_y, T& lp_lon, T& lp_lat) const + inline void inv(T const& xy_x, T xy_y, T& lp_lon, T& lp_lat) const { xy_y += this->m_proj_parm.ml0; if (fabs(xy_y) <= tolerance) { @@ -161,7 +155,7 @@ namespace projections // FORWARD(s_forward) spheroid // Project coordinates from geographic (lon, lat) to cartesian (x, y) - inline void fwd(T& lp_lon, T& lp_lat, T& xy_x, T& xy_y) const + inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const { T cot, E; @@ -177,7 +171,7 @@ namespace projections // INVERSE(s_inverse) spheroid // Project coordinates from cartesian (x, y) to geographic (lon, lat) - inline void inv(T& xy_x, T& xy_y, T& lp_lon, T& lp_lat) const + inline void inv(T const& xy_x, T xy_y, T& lp_lon, T& lp_lat) const { T B, dphi, tp; int i; @@ -240,7 +234,9 @@ namespace projections template <typename T, typename Parameters> struct poly_ellipsoid : public detail::poly::base_poly_ellipsoid<T, Parameters> { - inline poly_ellipsoid(const Parameters& par) : detail::poly::base_poly_ellipsoid<T, Parameters>(par) + template <typename Params> + inline poly_ellipsoid(Params const& , Parameters const& par) + : detail::poly::base_poly_ellipsoid<T, Parameters>(par) { detail::poly::setup_poly(this->m_par, this->m_proj_parm); } @@ -262,7 +258,9 @@ namespace projections template <typename T, typename Parameters> struct poly_spheroid : public detail::poly::base_poly_spheroid<T, Parameters> { - inline poly_spheroid(const Parameters& par) : detail::poly::base_poly_spheroid<T, Parameters>(par) + template <typename Params> + inline poly_spheroid(Params const& , Parameters const& par) + : detail::poly::base_poly_spheroid<T, Parameters>(par) { detail::poly::setup_poly(this->m_par, this->m_proj_parm); } @@ -273,26 +271,14 @@ namespace projections { // Static projection - BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::par4::poly, poly_spheroid, poly_ellipsoid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_poly, poly_spheroid, poly_ellipsoid) // Factory entry(s) - template <typename T, typename Parameters> - class poly_entry : public detail::factory_entry<T, Parameters> - { - public : - virtual base_v<T, Parameters>* create_new(const Parameters& par) const - { - if (par.es) - return new base_v_fi<poly_ellipsoid<T, Parameters>, T, Parameters>(par); - else - return new base_v_fi<poly_spheroid<T, Parameters>, T, Parameters>(par); - } - }; + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI2(poly_entry, poly_spheroid, poly_ellipsoid) - template <typename T, typename Parameters> - inline void poly_init(detail::base_factory<T, Parameters>& factory) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(poly_init) { - factory.add_to_factory("poly", new poly_entry<T, Parameters>); + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(poly, poly_entry) } } // namespace detail diff --git a/boost/geometry/srs/projections/proj/putp2.hpp b/boost/geometry/srs/projections/proj/putp2.hpp index 181afe5086..104a74702a 100644 --- a/boost/geometry/srs/projections/proj/putp2.hpp +++ b/boost/geometry/srs/projections/proj/putp2.hpp @@ -49,12 +49,6 @@ namespace boost { namespace geometry { -namespace srs { namespace par4 -{ - struct putp2 {}; // Putnins P2 - -}} //namespace srs::par4 - namespace projections { #ifndef DOXYGEN_NO_DETAIL @@ -80,7 +74,7 @@ namespace projections // FORWARD(s_forward) spheroid // Project coordinates from geographic (lon, lat) to cartesian (x, y) - inline void fwd(T& lp_lon, T& lp_lat, T& xy_x, T& xy_y) const + inline void fwd(T const& lp_lon, T lp_lat, T& xy_x, T& xy_y) const { static const T third_pi = detail::third_pi<T>(); @@ -106,7 +100,7 @@ namespace projections // INVERSE(s_inverse) spheroid // Project coordinates from cartesian (x, y) to geographic (lon, lat) - inline void inv(T& xy_x, T& xy_y, T& lp_lon, T& lp_lat) const + inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const { T c; @@ -147,7 +141,9 @@ namespace projections template <typename T, typename Parameters> struct putp2_spheroid : public detail::putp2::base_putp2_spheroid<T, Parameters> { - inline putp2_spheroid(const Parameters& par) : detail::putp2::base_putp2_spheroid<T, Parameters>(par) + template <typename Params> + inline putp2_spheroid(Params const& , Parameters const& par) + : detail::putp2::base_putp2_spheroid<T, Parameters>(par) { detail::putp2::setup_putp2(this->m_par); } @@ -158,23 +154,14 @@ namespace projections { // Static projection - BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::par4::putp2, putp2_spheroid, putp2_spheroid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_putp2, putp2_spheroid, putp2_spheroid) // Factory entry(s) - template <typename T, typename Parameters> - class putp2_entry : public detail::factory_entry<T, Parameters> - { - public : - virtual base_v<T, Parameters>* create_new(const Parameters& par) const - { - return new base_v_fi<putp2_spheroid<T, Parameters>, T, Parameters>(par); - } - }; + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(putp2_entry, putp2_spheroid) - template <typename T, typename Parameters> - inline void putp2_init(detail::base_factory<T, Parameters>& factory) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(putp2_init) { - factory.add_to_factory("putp2", new putp2_entry<T, Parameters>); + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(putp2, putp2_entry) } } // namespace detail diff --git a/boost/geometry/srs/projections/proj/putp3.hpp b/boost/geometry/srs/projections/proj/putp3.hpp index aac6d04f2d..3f6fceb0f1 100644 --- a/boost/geometry/srs/projections/proj/putp3.hpp +++ b/boost/geometry/srs/projections/proj/putp3.hpp @@ -48,13 +48,6 @@ namespace boost { namespace geometry { -namespace srs { namespace par4 -{ - struct putp3 {}; // Putnins P3 - struct putp3p {}; // Putnins P3' - -}} //namespace srs::par4 - namespace projections { #ifndef DOXYGEN_NO_DETAIL @@ -83,7 +76,7 @@ namespace projections // FORWARD(s_forward) spheroid // Project coordinates from geographic (lon, lat) to cartesian (x, y) - inline void fwd(T& lp_lon, T& lp_lat, T& xy_x, T& xy_y) const + inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const { xy_x = C * lp_lon * (1. - this->m_proj_parm.A * lp_lat * lp_lat); xy_y = C * lp_lat; @@ -91,7 +84,7 @@ namespace projections // INVERSE(s_inverse) spheroid // Project coordinates from cartesian (x, y) to geographic (lon, lat) - inline void inv(T& xy_x, T& xy_y, T& lp_lon, T& lp_lat) const + inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const { lp_lat = xy_y / C; lp_lon = xy_x / (C * (1. - this->m_proj_parm.A * lp_lat * lp_lat)); @@ -141,7 +134,9 @@ namespace projections template <typename T, typename Parameters> struct putp3_spheroid : public detail::putp3::base_putp3_spheroid<T, Parameters> { - inline putp3_spheroid(const Parameters& par) : detail::putp3::base_putp3_spheroid<T, Parameters>(par) + template <typename Params> + inline putp3_spheroid(Params const& , Parameters const& par) + : detail::putp3::base_putp3_spheroid<T, Parameters>(par) { detail::putp3::setup_putp3(this->m_par, this->m_proj_parm); } @@ -162,7 +157,9 @@ namespace projections template <typename T, typename Parameters> struct putp3p_spheroid : public detail::putp3::base_putp3_spheroid<T, Parameters> { - inline putp3p_spheroid(const Parameters& par) : detail::putp3::base_putp3_spheroid<T, Parameters>(par) + template <typename Params> + inline putp3p_spheroid(Params const& , Parameters const& par) + : detail::putp3::base_putp3_spheroid<T, Parameters>(par) { detail::putp3::setup_putp3p(this->m_par, this->m_proj_parm); } @@ -173,35 +170,17 @@ namespace projections { // Static projection - BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::par4::putp3, putp3_spheroid, putp3_spheroid) - BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::par4::putp3p, putp3p_spheroid, putp3p_spheroid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_putp3, putp3_spheroid, putp3_spheroid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_putp3p, putp3p_spheroid, putp3p_spheroid) // Factory entry(s) - template <typename T, typename Parameters> - class putp3_entry : public detail::factory_entry<T, Parameters> - { - public : - virtual base_v<T, Parameters>* create_new(const Parameters& par) const - { - return new base_v_fi<putp3_spheroid<T, Parameters>, T, Parameters>(par); - } - }; - - template <typename T, typename Parameters> - class putp3p_entry : public detail::factory_entry<T, Parameters> - { - public : - virtual base_v<T, Parameters>* create_new(const Parameters& par) const - { - return new base_v_fi<putp3p_spheroid<T, Parameters>, T, Parameters>(par); - } - }; + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(putp3_entry, putp3_spheroid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(putp3p_entry, putp3p_spheroid) - template <typename T, typename Parameters> - inline void putp3_init(detail::base_factory<T, Parameters>& factory) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(putp3_init) { - factory.add_to_factory("putp3", new putp3_entry<T, Parameters>); - factory.add_to_factory("putp3p", new putp3p_entry<T, Parameters>); + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(putp3, putp3_entry) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(putp3p, putp3p_entry) } } // namespace detail diff --git a/boost/geometry/srs/projections/proj/putp4p.hpp b/boost/geometry/srs/projections/proj/putp4p.hpp index 899278eba8..bf408b8d94 100644 --- a/boost/geometry/srs/projections/proj/putp4p.hpp +++ b/boost/geometry/srs/projections/proj/putp4p.hpp @@ -49,13 +49,6 @@ namespace boost { namespace geometry { -namespace srs { namespace par4 -{ - struct putp4p {}; // Putnins P4' - struct weren {}; // Werenskiold I - -}} //namespace srs::par4 - namespace projections { #ifndef DOXYGEN_NO_DETAIL @@ -80,7 +73,7 @@ namespace projections // FORWARD(s_forward) spheroid // Project coordinates from geographic (lon, lat) to cartesian (x, y) - inline void fwd(T& lp_lon, T& lp_lat, T& xy_x, T& xy_y) const + inline void fwd(T const& lp_lon, T lp_lat, T& xy_x, T& xy_y) const { static T const third = detail::third<T>(); @@ -92,7 +85,7 @@ namespace projections // INVERSE(s_inverse) spheroid // Project coordinates from cartesian (x, y) to geographic (lon, lat) - inline void inv(T& xy_x, T& xy_y, T& lp_lon, T& lp_lat) const + inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const { lp_lat = aasin(xy_y / this->m_proj_parm.C_y); lp_lon = xy_x * cos(lp_lat) / this->m_proj_parm.C_x; @@ -147,7 +140,9 @@ namespace projections template <typename T, typename Parameters> struct putp4p_spheroid : public detail::putp4p::base_putp4p_spheroid<T, Parameters> { - inline putp4p_spheroid(const Parameters& par) : detail::putp4p::base_putp4p_spheroid<T, Parameters>(par) + template <typename Params> + inline putp4p_spheroid(Params const& , Parameters const& par) + : detail::putp4p::base_putp4p_spheroid<T, Parameters>(par) { detail::putp4p::setup_putp4p(this->m_par, this->m_proj_parm); } @@ -168,7 +163,9 @@ namespace projections template <typename T, typename Parameters> struct weren_spheroid : public detail::putp4p::base_putp4p_spheroid<T, Parameters> { - inline weren_spheroid(const Parameters& par) : detail::putp4p::base_putp4p_spheroid<T, Parameters>(par) + template <typename Params> + inline weren_spheroid(Params const& , Parameters const& par) + : detail::putp4p::base_putp4p_spheroid<T, Parameters>(par) { detail::putp4p::setup_weren(this->m_par, this->m_proj_parm); } @@ -179,35 +176,17 @@ namespace projections { // Static projection - BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::par4::putp4p, putp4p_spheroid, putp4p_spheroid) - BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::par4::weren, weren_spheroid, weren_spheroid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_putp4p, putp4p_spheroid, putp4p_spheroid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_weren, weren_spheroid, weren_spheroid) // Factory entry(s) - template <typename T, typename Parameters> - class putp4p_entry : public detail::factory_entry<T, Parameters> - { - public : - virtual base_v<T, Parameters>* create_new(const Parameters& par) const - { - return new base_v_fi<putp4p_spheroid<T, Parameters>, T, Parameters>(par); - } - }; - - template <typename T, typename Parameters> - class weren_entry : public detail::factory_entry<T, Parameters> - { - public : - virtual base_v<T, Parameters>* create_new(const Parameters& par) const - { - return new base_v_fi<weren_spheroid<T, Parameters>, T, Parameters>(par); - } - }; + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(putp4p_entry, putp4p_spheroid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(weren_entry, weren_spheroid) - template <typename T, typename Parameters> - inline void putp4p_init(detail::base_factory<T, Parameters>& factory) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(putp4p_init) { - factory.add_to_factory("putp4p", new putp4p_entry<T, Parameters>); - factory.add_to_factory("weren", new weren_entry<T, Parameters>); + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(putp4p, putp4p_entry) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(weren, weren_entry) } } // namespace detail diff --git a/boost/geometry/srs/projections/proj/putp5.hpp b/boost/geometry/srs/projections/proj/putp5.hpp index de308a8948..bdddd8553c 100644 --- a/boost/geometry/srs/projections/proj/putp5.hpp +++ b/boost/geometry/srs/projections/proj/putp5.hpp @@ -48,13 +48,6 @@ namespace boost { namespace geometry { -namespace srs { namespace par4 -{ - struct putp5 {}; // Putnins P5 - struct putp5p {}; // Putnins P5' - -}} //namespace srs::par4 - namespace projections { #ifndef DOXYGEN_NO_DETAIL @@ -83,7 +76,7 @@ namespace projections // FORWARD(s_forward) spheroid // Project coordinates from geographic (lon, lat) to cartesian (x, y) - inline void fwd(T& lp_lon, T& lp_lat, T& xy_x, T& xy_y) const + inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const { xy_x = C * lp_lon * (this->m_proj_parm.A - this->m_proj_parm.B * sqrt(1. + D * lp_lat * lp_lat)); xy_y = C * lp_lat; @@ -91,7 +84,7 @@ namespace projections // INVERSE(s_inverse) spheroid // Project coordinates from cartesian (x, y) to geographic (lon, lat) - inline void inv(T& xy_x, T& xy_y, T& lp_lon, T& lp_lat) const + inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const { lp_lat = xy_y / C; lp_lon = xy_x / (C * (this->m_proj_parm.A - this->m_proj_parm.B * sqrt(1. + D * lp_lat * lp_lat))); @@ -143,7 +136,9 @@ namespace projections template <typename T, typename Parameters> struct putp5_spheroid : public detail::putp5::base_putp5_spheroid<T, Parameters> { - inline putp5_spheroid(const Parameters& par) : detail::putp5::base_putp5_spheroid<T, Parameters>(par) + template <typename Params> + inline putp5_spheroid(Params const& , Parameters const& par) + : detail::putp5::base_putp5_spheroid<T, Parameters>(par) { detail::putp5::setup_putp5(this->m_par, this->m_proj_parm); } @@ -164,7 +159,9 @@ namespace projections template <typename T, typename Parameters> struct putp5p_spheroid : public detail::putp5::base_putp5_spheroid<T, Parameters> { - inline putp5p_spheroid(const Parameters& par) : detail::putp5::base_putp5_spheroid<T, Parameters>(par) + template <typename Params> + inline putp5p_spheroid(Params const& , Parameters const& par) + : detail::putp5::base_putp5_spheroid<T, Parameters>(par) { detail::putp5::setup_putp5p(this->m_par, this->m_proj_parm); } @@ -175,35 +172,17 @@ namespace projections { // Static projection - BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::par4::putp5, putp5_spheroid, putp5_spheroid) - BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::par4::putp5p, putp5p_spheroid, putp5p_spheroid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_putp5, putp5_spheroid, putp5_spheroid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_putp5p, putp5p_spheroid, putp5p_spheroid) // Factory entry(s) - template <typename T, typename Parameters> - class putp5_entry : public detail::factory_entry<T, Parameters> - { - public : - virtual base_v<T, Parameters>* create_new(const Parameters& par) const - { - return new base_v_fi<putp5_spheroid<T, Parameters>, T, Parameters>(par); - } - }; - - template <typename T, typename Parameters> - class putp5p_entry : public detail::factory_entry<T, Parameters> - { - public : - virtual base_v<T, Parameters>* create_new(const Parameters& par) const - { - return new base_v_fi<putp5p_spheroid<T, Parameters>, T, Parameters>(par); - } - }; + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(putp5_entry, putp5_spheroid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(putp5p_entry, putp5p_spheroid) - template <typename T, typename Parameters> - inline void putp5_init(detail::base_factory<T, Parameters>& factory) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(putp5_init) { - factory.add_to_factory("putp5", new putp5_entry<T, Parameters>); - factory.add_to_factory("putp5p", new putp5p_entry<T, Parameters>); + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(putp5, putp5_entry) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(putp5p, putp5p_entry) } } // namespace detail diff --git a/boost/geometry/srs/projections/proj/putp6.hpp b/boost/geometry/srs/projections/proj/putp6.hpp index 19ca6cc76d..97d69e45ea 100644 --- a/boost/geometry/srs/projections/proj/putp6.hpp +++ b/boost/geometry/srs/projections/proj/putp6.hpp @@ -49,13 +49,6 @@ namespace boost { namespace geometry { -namespace srs { namespace par4 -{ - struct putp6 {}; // Putnins P6 - struct putp6p {}; // Putnins P6' - -}} //namespace srs::par4 - namespace projections { #ifndef DOXYGEN_NO_DETAIL @@ -85,7 +78,7 @@ namespace projections // FORWARD(s_forward) spheroid // Project coordinates from geographic (lon, lat) to cartesian (x, y) - inline void fwd(T& lp_lon, T& lp_lat, T& xy_x, T& xy_y) const + inline void fwd(T const& lp_lon, T lp_lat, T& xy_x, T& xy_y) const { T p, r, V; int i; @@ -107,7 +100,7 @@ namespace projections // INVERSE(s_inverse) spheroid // Project coordinates from cartesian (x, y) to geographic (lon, lat) - inline void inv(T& xy_x, T& xy_y, T& lp_lon, T& lp_lat) const + inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const { T r; @@ -169,7 +162,9 @@ namespace projections template <typename T, typename Parameters> struct putp6_spheroid : public detail::putp6::base_putp6_spheroid<T, Parameters> { - inline putp6_spheroid(const Parameters& par) : detail::putp6::base_putp6_spheroid<T, Parameters>(par) + template <typename Params> + inline putp6_spheroid(Params const& , Parameters const& par) + : detail::putp6::base_putp6_spheroid<T, Parameters>(par) { detail::putp6::setup_putp6(this->m_par, this->m_proj_parm); } @@ -190,7 +185,9 @@ namespace projections template <typename T, typename Parameters> struct putp6p_spheroid : public detail::putp6::base_putp6_spheroid<T, Parameters> { - inline putp6p_spheroid(const Parameters& par) : detail::putp6::base_putp6_spheroid<T, Parameters>(par) + template <typename Params> + inline putp6p_spheroid(Params const& , Parameters const& par) + : detail::putp6::base_putp6_spheroid<T, Parameters>(par) { detail::putp6::setup_putp6p(this->m_par, this->m_proj_parm); } @@ -201,35 +198,17 @@ namespace projections { // Static projection - BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::par4::putp6, putp6_spheroid, putp6_spheroid) - BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::par4::putp6p, putp6p_spheroid, putp6p_spheroid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_putp6, putp6_spheroid, putp6_spheroid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_putp6p, putp6p_spheroid, putp6p_spheroid) // Factory entry(s) - template <typename T, typename Parameters> - class putp6_entry : public detail::factory_entry<T, Parameters> - { - public : - virtual base_v<T, Parameters>* create_new(const Parameters& par) const - { - return new base_v_fi<putp6_spheroid<T, Parameters>, T, Parameters>(par); - } - }; - - template <typename T, typename Parameters> - class putp6p_entry : public detail::factory_entry<T, Parameters> - { - public : - virtual base_v<T, Parameters>* create_new(const Parameters& par) const - { - return new base_v_fi<putp6p_spheroid<T, Parameters>, T, Parameters>(par); - } - }; + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(putp6_entry, putp6_spheroid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(putp6p_entry, putp6p_spheroid) - template <typename T, typename Parameters> - inline void putp6_init(detail::base_factory<T, Parameters>& factory) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(putp6_init) { - factory.add_to_factory("putp6", new putp6_entry<T, Parameters>); - factory.add_to_factory("putp6p", new putp6p_entry<T, Parameters>); + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(putp6, putp6_entry) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(putp6p, putp6p_entry) } } // namespace detail diff --git a/boost/geometry/srs/projections/proj/qsc.hpp b/boost/geometry/srs/projections/proj/qsc.hpp index bb31849049..e4a1ff9530 100644 --- a/boost/geometry/srs/projections/proj/qsc.hpp +++ b/boost/geometry/srs/projections/proj/qsc.hpp @@ -88,12 +88,6 @@ namespace boost { namespace geometry { -namespace srs { namespace par4 -{ - struct qsc {}; // Quadrilateralized Spherical Cube - -}} //namespace srs::par4 - namespace projections { #ifndef DOXYGEN_NO_DETAIL @@ -193,7 +187,7 @@ namespace projections // FORWARD(e_forward) // Project coordinates from geographic (lon, lat) to cartesian (x, y) - inline void fwd(T& lp_lon, T& lp_lat, T& xy_x, T& xy_y) const + inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const { static const T fourth_pi = detail::fourth_pi<T>(); static const T half_pi = detail::half_pi<T>(); @@ -314,7 +308,7 @@ namespace projections // INVERSE(e_inverse) // Project coordinates from cartesian (x, y) to geographic (lon, lat) - inline void inv(T& xy_x, T& xy_y, T& lp_lon, T& lp_lat) const + inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const { static const T half_pi = detail::half_pi<T>(); static const T pi = detail::pi<T>(); @@ -509,7 +503,9 @@ namespace projections template <typename T, typename Parameters> struct qsc_ellipsoid : public detail::qsc::base_qsc_ellipsoid<T, Parameters> { - inline qsc_ellipsoid(const Parameters& par) : detail::qsc::base_qsc_ellipsoid<T, Parameters>(par) + template <typename Params> + inline qsc_ellipsoid(Params const& , Parameters const& par) + : detail::qsc::base_qsc_ellipsoid<T, Parameters>(par) { detail::qsc::setup_qsc(this->m_par, this->m_proj_parm); } @@ -520,23 +516,14 @@ namespace projections { // Static projection - BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::par4::qsc, qsc_ellipsoid, qsc_ellipsoid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_qsc, qsc_ellipsoid, qsc_ellipsoid) // Factory entry(s) - template <typename T, typename Parameters> - class qsc_entry : public detail::factory_entry<T, Parameters> - { - public : - virtual base_v<T, Parameters>* create_new(const Parameters& par) const - { - return new base_v_fi<qsc_ellipsoid<T, Parameters>, T, Parameters>(par); - } - }; + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(qsc_entry, qsc_ellipsoid) - template <typename T, typename Parameters> - inline void qsc_init(detail::base_factory<T, Parameters>& factory) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(qsc_init) { - factory.add_to_factory("qsc", new qsc_entry<T, Parameters>); + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(qsc, qsc_entry) } } // namespace detail diff --git a/boost/geometry/srs/projections/proj/robin.hpp b/boost/geometry/srs/projections/proj/robin.hpp index f5ec97be51..bf8a704ea7 100644 --- a/boost/geometry/srs/projections/proj/robin.hpp +++ b/boost/geometry/srs/projections/proj/robin.hpp @@ -51,12 +51,6 @@ namespace boost { namespace geometry { -namespace srs { namespace par4 -{ - struct robin {}; // Robinson - -}} //namespace srs::par4 - namespace projections { #ifndef DOXYGEN_NO_DETAIL @@ -157,7 +151,7 @@ namespace projections // FORWARD(s_forward) spheroid // Project coordinates from geographic (lon, lat) to cartesian (x, y) - inline void fwd(T& lp_lon, T& lp_lat, T& xy_x, T& xy_y) const + inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const { int i; T dphi; @@ -175,7 +169,7 @@ namespace projections // INVERSE(s_inverse) spheroid // Project coordinates from cartesian (x, y) to geographic (lon, lat) - inline void inv(T& xy_x, T& xy_y, T& lp_lon, T& lp_lat) const + inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const { static const T half_pi = detail::half_pi<T>(); const coefs<T> * coefs_x = robin::coefs_x<T>(); @@ -256,7 +250,9 @@ namespace projections template <typename T, typename Parameters> struct robin_spheroid : public detail::robin::base_robin_spheroid<T, Parameters> { - inline robin_spheroid(const Parameters& par) : detail::robin::base_robin_spheroid<T, Parameters>(par) + template <typename Params> + inline robin_spheroid(Params const& , Parameters const& par) + : detail::robin::base_robin_spheroid<T, Parameters>(par) { detail::robin::setup_robin(this->m_par); } @@ -267,23 +263,14 @@ namespace projections { // Static projection - BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::par4::robin, robin_spheroid, robin_spheroid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_robin, robin_spheroid, robin_spheroid) // Factory entry(s) - template <typename T, typename Parameters> - class robin_entry : public detail::factory_entry<T, Parameters> - { - public : - virtual base_v<T, Parameters>* create_new(const Parameters& par) const - { - return new base_v_fi<robin_spheroid<T, Parameters>, T, Parameters>(par); - } - }; + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(robin_entry, robin_spheroid) - template <typename T, typename Parameters> - inline void robin_init(detail::base_factory<T, Parameters>& factory) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(robin_init) { - factory.add_to_factory("robin", new robin_entry<T, Parameters>); + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(robin, robin_entry) } } // namespace detail diff --git a/boost/geometry/srs/projections/proj/rouss.hpp b/boost/geometry/srs/projections/proj/rouss.hpp index 1cbc795e9d..01693c5a77 100644 --- a/boost/geometry/srs/projections/proj/rouss.hpp +++ b/boost/geometry/srs/projections/proj/rouss.hpp @@ -51,12 +51,6 @@ namespace boost { namespace geometry { -namespace srs { namespace par4 -{ - struct rouss {}; // Roussilhe Stereographic - -}} //namespace srs::par4 - namespace projections { #ifndef DOXYGEN_NO_DETAIL @@ -86,7 +80,7 @@ namespace projections // FORWARD(e_forward) ellipsoid // Project coordinates from geographic (lon, lat) to cartesian (x, y) - inline void fwd(T& lp_lon, T& lp_lat, T& xy_x, T& xy_y) const + inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const { T s, al, cp, sp, al2, s2; @@ -105,7 +99,7 @@ namespace projections // INVERSE(e_inverse) ellipsoid // Project coordinates from cartesian (x, y) to geographic (lon, lat) - inline void inv(T& xy_x, T& xy_y, T& lp_lon, T& lp_lat) const + inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const { T s, al, x = xy_x / this->m_par.k0, y = xy_y / this->m_par.k0, x2, y2; @@ -196,7 +190,9 @@ namespace projections template <typename T, typename Parameters> struct rouss_ellipsoid : public detail::rouss::base_rouss_ellipsoid<T, Parameters> { - inline rouss_ellipsoid(const Parameters& par) : detail::rouss::base_rouss_ellipsoid<T, Parameters>(par) + template <typename Params> + inline rouss_ellipsoid(Params const& , Parameters const& par) + : detail::rouss::base_rouss_ellipsoid<T, Parameters>(par) { detail::rouss::setup_rouss(this->m_par, this->m_proj_parm); } @@ -207,23 +203,14 @@ namespace projections { // Static projection - BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::par4::rouss, rouss_ellipsoid, rouss_ellipsoid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_rouss, rouss_ellipsoid, rouss_ellipsoid) // Factory entry(s) - template <typename T, typename Parameters> - class rouss_entry : public detail::factory_entry<T, Parameters> - { - public : - virtual base_v<T, Parameters>* create_new(const Parameters& par) const - { - return new base_v_fi<rouss_ellipsoid<T, Parameters>, T, Parameters>(par); - } - }; + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(rouss_entry, rouss_ellipsoid) - template <typename T, typename Parameters> - inline void rouss_init(detail::base_factory<T, Parameters>& factory) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(rouss_init) { - factory.add_to_factory("rouss", new rouss_entry<T, Parameters>); + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(rouss, rouss_entry) } } // namespace detail diff --git a/boost/geometry/srs/projections/proj/rpoly.hpp b/boost/geometry/srs/projections/proj/rpoly.hpp index b2146426bd..87a5d482ba 100644 --- a/boost/geometry/srs/projections/proj/rpoly.hpp +++ b/boost/geometry/srs/projections/proj/rpoly.hpp @@ -48,12 +48,6 @@ namespace boost { namespace geometry { -namespace srs { namespace par4 -{ - struct rpoly {}; // Rectangular Polyconic - -}} //namespace srs::par4 - namespace projections { #ifndef DOXYGEN_NO_DETAIL @@ -84,7 +78,7 @@ namespace projections // FORWARD(s_forward) spheroid // Project coordinates from geographic (lon, lat) to cartesian (x, y) - inline void fwd(T& lp_lon, T& lp_lat, T& xy_x, T& xy_y) const + inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const { T fa; @@ -110,10 +104,12 @@ namespace projections }; // Rectangular Polyconic - template <typename Parameters, typename T> - inline void setup_rpoly(Parameters& par, par_rpoly<T>& proj_parm) + template <typename Params, typename Parameters, typename T> + inline void setup_rpoly(Params const& params, Parameters& par, par_rpoly<T>& proj_parm) { - if ((proj_parm.mode = (proj_parm.phi1 = fabs(pj_get_param_r(par.params, "lat_ts"))) > epsilon)) { + proj_parm.phi1 = fabs(pj_get_param_r<T, srs::spar::lat_ts>(params, "lat_ts", srs::dpar::lat_ts)); + if ((proj_parm.mode = (proj_parm.phi1 > epsilon))) + { proj_parm.fxb = 0.5 * sin(proj_parm.phi1); proj_parm.fxa = 0.5 / proj_parm.fxb; } @@ -141,9 +137,11 @@ namespace projections template <typename T, typename Parameters> struct rpoly_spheroid : public detail::rpoly::base_rpoly_spheroid<T, Parameters> { - inline rpoly_spheroid(const Parameters& par) : detail::rpoly::base_rpoly_spheroid<T, Parameters>(par) + template <typename Params> + inline rpoly_spheroid(Params const& params, Parameters const& par) + : detail::rpoly::base_rpoly_spheroid<T, Parameters>(par) { - detail::rpoly::setup_rpoly(this->m_par, this->m_proj_parm); + detail::rpoly::setup_rpoly(params, this->m_par, this->m_proj_parm); } }; @@ -152,23 +150,14 @@ namespace projections { // Static projection - BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::par4::rpoly, rpoly_spheroid, rpoly_spheroid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_rpoly, rpoly_spheroid, rpoly_spheroid) // Factory entry(s) - template <typename T, typename Parameters> - class rpoly_entry : public detail::factory_entry<T, Parameters> - { - public : - virtual base_v<T, Parameters>* create_new(const Parameters& par) const - { - return new base_v_f<rpoly_spheroid<T, Parameters>, T, Parameters>(par); - } - }; + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_F(rpoly_entry, rpoly_spheroid) - template <typename T, typename Parameters> - inline void rpoly_init(detail::base_factory<T, Parameters>& factory) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(rpoly_init) { - factory.add_to_factory("rpoly", new rpoly_entry<T, Parameters>); + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(rpoly, rpoly_entry) } } // namespace detail diff --git a/boost/geometry/srs/projections/proj/sconics.hpp b/boost/geometry/srs/projections/proj/sconics.hpp index b1119d622a..5499f1a7c0 100644 --- a/boost/geometry/srs/projections/proj/sconics.hpp +++ b/boost/geometry/srs/projections/proj/sconics.hpp @@ -52,18 +52,6 @@ namespace boost { namespace geometry { -namespace srs { namespace par4 -{ - struct euler {}; // Euler - struct murd1 {}; // Murdoch I - struct murd2 {}; // Murdoch II - struct murd3 {}; // Murdoch III - struct pconic {}; // Perspective Conic - struct tissot {}; // Tissot - struct vitk1 {}; // Vitkovsky I - -}} //namespace srs::par4 - namespace projections { #ifndef DOXYGEN_NO_DETAIL @@ -94,14 +82,14 @@ namespace projections }; /* get common factors for simple conics */ - template <typename Parameters, typename T> - inline int phi12(Parameters& par, par_sconics<T>& proj_parm, T *del) + template <typename Params, typename T> + inline int phi12(Params const& params, par_sconics<T>& proj_parm, T *del) { T p1, p2; int err = 0; - if (!pj_param_r(par.params, "lat_1", p1) || - !pj_param_r(par.params, "lat_2", p2)) { + if (!pj_param_r<srs::spar::lat_1>(params, "lat_1", srs::dpar::lat_1, p1) || + !pj_param_r<srs::spar::lat_2>(params, "lat_2", srs::dpar::lat_2, p2)) { err = -41; } else { //p1 = pj_get_param_r(par.params, "lat_1"); // set above @@ -126,7 +114,7 @@ namespace projections // FORWARD(s_forward) spheroid // Project coordinates from geographic (lon, lat) to cartesian (x, y) - inline void fwd(T& lp_lon, T& lp_lat, T& xy_x, T& xy_y) const + inline void fwd(T lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const { T rho; @@ -147,7 +135,7 @@ namespace projections // INVERSE(s_inverse) ellipsoid & spheroid // Project coordinates from cartesian (x, y) to geographic (lon, lat) - inline void inv(T& xy_x, T& xy_y, T& lp_lon, T& lp_lat) const + inline void inv(T xy_x, T xy_y, T& lp_lon, T& lp_lat) const { T rho; @@ -179,8 +167,8 @@ namespace projections }; - template <typename Parameters, typename T> - inline void setup(Parameters& par, par_sconics<T>& proj_parm, proj_type type) + template <typename Params, typename Parameters, typename T> + inline void setup(Params const& params, Parameters& par, par_sconics<T>& proj_parm, proj_type type) { static const T half_pi = detail::half_pi<T>(); @@ -189,7 +177,7 @@ namespace projections proj_parm.type = type; - err = phi12(par, proj_parm, &del); + err = phi12(params, proj_parm, &del); if(err) BOOST_THROW_EXCEPTION( projection_exception(err) ); @@ -241,52 +229,52 @@ namespace projections // Euler - template <typename Parameters, typename T> - inline void setup_euler(Parameters& par, par_sconics<T>& proj_parm) + template <typename Params, typename Parameters, typename T> + inline void setup_euler(Params const& params, Parameters& par, par_sconics<T>& proj_parm) { - setup(par, proj_parm, proj_euler); + setup(params, par, proj_parm, proj_euler); } // Tissot - template <typename Parameters, typename T> - inline void setup_tissot(Parameters& par, par_sconics<T>& proj_parm) + template <typename Params, typename Parameters, typename T> + inline void setup_tissot(Params const& params, Parameters& par, par_sconics<T>& proj_parm) { - setup(par, proj_parm, proj_tissot); + setup(params, par, proj_parm, proj_tissot); } // Murdoch I - template <typename Parameters, typename T> - inline void setup_murd1(Parameters& par, par_sconics<T>& proj_parm) + template <typename Params, typename Parameters, typename T> + inline void setup_murd1(Params const& params, Parameters& par, par_sconics<T>& proj_parm) { - setup(par, proj_parm, proj_murd1); + setup(params, par, proj_parm, proj_murd1); } // Murdoch II - template <typename Parameters, typename T> - inline void setup_murd2(Parameters& par, par_sconics<T>& proj_parm) + template <typename Params, typename Parameters, typename T> + inline void setup_murd2(Params const& params, Parameters& par, par_sconics<T>& proj_parm) { - setup(par, proj_parm, proj_murd2); + setup(params, par, proj_parm, proj_murd2); } // Murdoch III - template <typename Parameters, typename T> - inline void setup_murd3(Parameters& par, par_sconics<T>& proj_parm) + template <typename Params, typename Parameters, typename T> + inline void setup_murd3(Params const& params, Parameters& par, par_sconics<T>& proj_parm) { - setup(par, proj_parm, proj_murd3); + setup(params, par, proj_parm, proj_murd3); } // Perspective Conic - template <typename Parameters, typename T> - inline void setup_pconic(Parameters& par, par_sconics<T>& proj_parm) + template <typename Params, typename Parameters, typename T> + inline void setup_pconic(Params const& params, Parameters& par, par_sconics<T>& proj_parm) { - setup(par, proj_parm, proj_pconic); + setup(params, par, proj_parm, proj_pconic); } // Vitkovsky I - template <typename Parameters, typename T> - inline void setup_vitk1(Parameters& par, par_sconics<T>& proj_parm) + template <typename Params, typename Parameters, typename T> + inline void setup_vitk1(Params const& params, Parameters& par, par_sconics<T>& proj_parm) { - setup(par, proj_parm, proj_vitk1); + setup(params, par, proj_parm, proj_vitk1); } }} // namespace detail::sconics @@ -310,9 +298,11 @@ namespace projections template <typename T, typename Parameters> struct tissot_spheroid : public detail::sconics::base_sconics_spheroid<T, Parameters> { - inline tissot_spheroid(const Parameters& par) : detail::sconics::base_sconics_spheroid<T, Parameters>(par) + template <typename Params> + inline tissot_spheroid(Params const& params, const Parameters& par) + : detail::sconics::base_sconics_spheroid<T, Parameters>(par) { - detail::sconics::setup_tissot(this->m_par, this->m_proj_parm); + detail::sconics::setup_tissot(params, this->m_par, this->m_proj_parm); } }; @@ -334,9 +324,11 @@ namespace projections template <typename T, typename Parameters> struct murd1_spheroid : public detail::sconics::base_sconics_spheroid<T, Parameters> { - inline murd1_spheroid(const Parameters& par) : detail::sconics::base_sconics_spheroid<T, Parameters>(par) + template <typename Params> + inline murd1_spheroid(Params const& params, const Parameters& par) + : detail::sconics::base_sconics_spheroid<T, Parameters>(par) { - detail::sconics::setup_murd1(this->m_par, this->m_proj_parm); + detail::sconics::setup_murd1(params, this->m_par, this->m_proj_parm); } }; @@ -358,9 +350,11 @@ namespace projections template <typename T, typename Parameters> struct murd2_spheroid : public detail::sconics::base_sconics_spheroid<T, Parameters> { - inline murd2_spheroid(const Parameters& par) : detail::sconics::base_sconics_spheroid<T, Parameters>(par) + template <typename Params> + inline murd2_spheroid(Params const& params, const Parameters& par) + : detail::sconics::base_sconics_spheroid<T, Parameters>(par) { - detail::sconics::setup_murd2(this->m_par, this->m_proj_parm); + detail::sconics::setup_murd2(params, this->m_par, this->m_proj_parm); } }; @@ -382,9 +376,11 @@ namespace projections template <typename T, typename Parameters> struct murd3_spheroid : public detail::sconics::base_sconics_spheroid<T, Parameters> { - inline murd3_spheroid(const Parameters& par) : detail::sconics::base_sconics_spheroid<T, Parameters>(par) + template <typename Params> + inline murd3_spheroid(Params const& params, const Parameters& par) + : detail::sconics::base_sconics_spheroid<T, Parameters>(par) { - detail::sconics::setup_murd3(this->m_par, this->m_proj_parm); + detail::sconics::setup_murd3(params, this->m_par, this->m_proj_parm); } }; @@ -406,9 +402,11 @@ namespace projections template <typename T, typename Parameters> struct euler_spheroid : public detail::sconics::base_sconics_spheroid<T, Parameters> { - inline euler_spheroid(const Parameters& par) : detail::sconics::base_sconics_spheroid<T, Parameters>(par) + template <typename Params> + inline euler_spheroid(Params const& params, const Parameters& par) + : detail::sconics::base_sconics_spheroid<T, Parameters>(par) { - detail::sconics::setup_euler(this->m_par, this->m_proj_parm); + detail::sconics::setup_euler(params, this->m_par, this->m_proj_parm); } }; @@ -430,9 +428,11 @@ namespace projections template <typename T, typename Parameters> struct pconic_spheroid : public detail::sconics::base_sconics_spheroid<T, Parameters> { - inline pconic_spheroid(const Parameters& par) : detail::sconics::base_sconics_spheroid<T, Parameters>(par) + template <typename Params> + inline pconic_spheroid(Params const& params, const Parameters& par) + : detail::sconics::base_sconics_spheroid<T, Parameters>(par) { - detail::sconics::setup_pconic(this->m_par, this->m_proj_parm); + detail::sconics::setup_pconic(params, this->m_par, this->m_proj_parm); } }; @@ -454,9 +454,11 @@ namespace projections template <typename T, typename Parameters> struct vitk1_spheroid : public detail::sconics::base_sconics_spheroid<T, Parameters> { - inline vitk1_spheroid(const Parameters& par) : detail::sconics::base_sconics_spheroid<T, Parameters>(par) + template <typename Params> + inline vitk1_spheroid(Params const& params, const Parameters& par) + : detail::sconics::base_sconics_spheroid<T, Parameters>(par) { - detail::sconics::setup_vitk1(this->m_par, this->m_proj_parm); + detail::sconics::setup_vitk1(params, this->m_par, this->m_proj_parm); } }; @@ -465,95 +467,32 @@ namespace projections { // Static projection - BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::par4::euler, euler_spheroid, euler_spheroid) - BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::par4::murd1, murd1_spheroid, murd1_spheroid) - BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::par4::murd2, murd2_spheroid, murd2_spheroid) - BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::par4::murd3, murd3_spheroid, murd3_spheroid) - BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::par4::pconic, pconic_spheroid, pconic_spheroid) - BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::par4::tissot, tissot_spheroid, tissot_spheroid) - BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::par4::vitk1, vitk1_spheroid, vitk1_spheroid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_euler, euler_spheroid, euler_spheroid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_murd1, murd1_spheroid, murd1_spheroid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_murd2, murd2_spheroid, murd2_spheroid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_murd3, murd3_spheroid, murd3_spheroid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_pconic, pconic_spheroid, pconic_spheroid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_tissot, tissot_spheroid, tissot_spheroid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_vitk1, vitk1_spheroid, vitk1_spheroid) // Factory entry(s) - template <typename T, typename Parameters> - class tissot_entry : public detail::factory_entry<T, Parameters> - { - public : - virtual base_v<T, Parameters>* create_new(const Parameters& par) const - { - return new base_v_fi<tissot_spheroid<T, Parameters>, T, Parameters>(par); - } - }; - - template <typename T, typename Parameters> - class murd1_entry : public detail::factory_entry<T, Parameters> - { - public : - virtual base_v<T, Parameters>* create_new(const Parameters& par) const - { - return new base_v_fi<murd1_spheroid<T, Parameters>, T, Parameters>(par); - } - }; - - template <typename T, typename Parameters> - class murd2_entry : public detail::factory_entry<T, Parameters> - { - public : - virtual base_v<T, Parameters>* create_new(const Parameters& par) const - { - return new base_v_fi<murd2_spheroid<T, Parameters>, T, Parameters>(par); - } - }; - - template <typename T, typename Parameters> - class murd3_entry : public detail::factory_entry<T, Parameters> - { - public : - virtual base_v<T, Parameters>* create_new(const Parameters& par) const - { - return new base_v_fi<murd3_spheroid<T, Parameters>, T, Parameters>(par); - } - }; - - template <typename T, typename Parameters> - class euler_entry : public detail::factory_entry<T, Parameters> - { - public : - virtual base_v<T, Parameters>* create_new(const Parameters& par) const - { - return new base_v_fi<euler_spheroid<T, Parameters>, T, Parameters>(par); - } - }; - - template <typename T, typename Parameters> - class pconic_entry : public detail::factory_entry<T, Parameters> - { - public : - virtual base_v<T, Parameters>* create_new(const Parameters& par) const - { - return new base_v_fi<pconic_spheroid<T, Parameters>, T, Parameters>(par); - } - }; - - template <typename T, typename Parameters> - class vitk1_entry : public detail::factory_entry<T, Parameters> - { - public : - virtual base_v<T, Parameters>* create_new(const Parameters& par) const - { - return new base_v_fi<vitk1_spheroid<T, Parameters>, T, Parameters>(par); - } - }; - - template <typename T, typename Parameters> - inline void sconics_init(detail::base_factory<T, Parameters>& factory) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(euler_entry, euler_spheroid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(murd1_entry, murd1_spheroid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(murd2_entry, murd2_spheroid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(murd3_entry, murd3_spheroid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(pconic_entry, pconic_spheroid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(tissot_entry, tissot_spheroid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(vitk1_entry, vitk1_spheroid) + + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(sconics_init) { - factory.add_to_factory("tissot", new tissot_entry<T, Parameters>); - factory.add_to_factory("murd1", new murd1_entry<T, Parameters>); - factory.add_to_factory("murd2", new murd2_entry<T, Parameters>); - factory.add_to_factory("murd3", new murd3_entry<T, Parameters>); - factory.add_to_factory("euler", new euler_entry<T, Parameters>); - factory.add_to_factory("pconic", new pconic_entry<T, Parameters>); - factory.add_to_factory("vitk1", new vitk1_entry<T, Parameters>); + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(euler, euler_entry) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(murd1, murd1_entry) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(murd2, murd2_entry) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(murd3, murd3_entry) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(pconic, pconic_entry) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(tissot, tissot_entry) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(vitk1, vitk1_entry) } } // namespace detail diff --git a/boost/geometry/srs/projections/proj/somerc.hpp b/boost/geometry/srs/projections/proj/somerc.hpp index 548ebe5275..e27ac3018b 100644 --- a/boost/geometry/srs/projections/proj/somerc.hpp +++ b/boost/geometry/srs/projections/proj/somerc.hpp @@ -51,12 +51,6 @@ namespace boost { namespace geometry { -namespace srs { namespace par4 -{ - struct somerc {}; // Swiss. Obl. Mercator - -}} //namespace srs::par4 - namespace projections { #ifndef DOXYGEN_NO_DETAIL @@ -84,7 +78,7 @@ namespace projections // FORWARD(e_forward) // Project coordinates from geographic (lon, lat) to cartesian (x, y) - inline void fwd(T& lp_lon, T& lp_lat, T& xy_x, T& xy_y) const + inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const { static const T fourth_pi = detail::fourth_pi<T>(); static const T half_pi = detail::half_pi<T>(); @@ -105,7 +99,7 @@ namespace projections // INVERSE(e_inverse) ellipsoid & spheroid // Project coordinates from cartesian (x, y) to geographic (lon, lat) - inline void inv(T& xy_x, T& xy_y, T& lp_lon, T& lp_lat) const + inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const { static const T fourth_pi = detail::fourth_pi<T>(); @@ -182,7 +176,9 @@ namespace projections template <typename T, typename Parameters> struct somerc_ellipsoid : public detail::somerc::base_somerc_ellipsoid<T, Parameters> { - inline somerc_ellipsoid(const Parameters& par) : detail::somerc::base_somerc_ellipsoid<T, Parameters>(par) + template <typename Params> + inline somerc_ellipsoid(Params const& , Parameters const& par) + : detail::somerc::base_somerc_ellipsoid<T, Parameters>(par) { detail::somerc::setup_somerc(this->m_par, this->m_proj_parm); } @@ -193,23 +189,14 @@ namespace projections { // Static projection - BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::par4::somerc, somerc_ellipsoid, somerc_ellipsoid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_somerc, somerc_ellipsoid, somerc_ellipsoid) // Factory entry(s) - template <typename T, typename Parameters> - class somerc_entry : public detail::factory_entry<T, Parameters> - { - public : - virtual base_v<T, Parameters>* create_new(const Parameters& par) const - { - return new base_v_fi<somerc_ellipsoid<T, Parameters>, T, Parameters>(par); - } - }; - - template <typename T, typename Parameters> - inline void somerc_init(detail::base_factory<T, Parameters>& factory) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(somerc_entry, somerc_ellipsoid) + + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(somerc_init) { - factory.add_to_factory("somerc", new somerc_entry<T, Parameters>); + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(somerc, somerc_entry) } } // namespace detail diff --git a/boost/geometry/srs/projections/proj/stere.hpp b/boost/geometry/srs/projections/proj/stere.hpp index ea8af31149..7b287383f1 100644 --- a/boost/geometry/srs/projections/proj/stere.hpp +++ b/boost/geometry/srs/projections/proj/stere.hpp @@ -53,13 +53,6 @@ namespace boost { namespace geometry { -namespace srs { namespace par4 -{ - struct stere {}; // Stereographic - struct ups {}; // Universal Polar Stereographic - -}} //namespace srs::par4 - namespace projections { #ifndef DOXYGEN_NO_DETAIL @@ -110,7 +103,7 @@ namespace projections // FORWARD(e_forward) ellipsoid // Project coordinates from geographic (lon, lat) to cartesian (x, y) - inline void fwd(T& lp_lon, T& lp_lat, T& xy_x, T& xy_y) const + inline void fwd(T const& lp_lon, T lp_lat, T& xy_x, T& xy_y) const { static const T half_pi = detail::half_pi<T>(); @@ -159,7 +152,7 @@ namespace projections // INVERSE(e_inverse) ellipsoid // Project coordinates from cartesian (x, y) to geographic (lon, lat) - inline void inv(T& xy_x, T& xy_y, T& lp_lon, T& lp_lat) const + inline void inv(T xy_x, T xy_y, T& lp_lon, T& lp_lat) const { static const T half_pi = detail::half_pi<T>(); @@ -225,7 +218,7 @@ namespace projections // FORWARD(s_forward) spheroid // Project coordinates from geographic (lon, lat) to cartesian (x, y) - inline void fwd(T& lp_lon, T& lp_lat, T& xy_x, T& xy_y) const + inline void fwd(T const& lp_lon, T lp_lat, T& xy_x, T& xy_y) const { static const T fourth_pi = detail::fourth_pi<T>(); static const T half_pi = detail::half_pi<T>(); @@ -266,7 +259,7 @@ namespace projections // INVERSE(s_inverse) spheroid // Project coordinates from cartesian (x, y) to geographic (lon, lat) - inline void inv(T& xy_x, T& xy_y, T& lp_lon, T& lp_lat) const + inline void inv(T const& xy_x, T xy_y, T& lp_lon, T& lp_lat) const { T c, rh, sinc, cosc; @@ -372,25 +365,25 @@ namespace projections // Stereographic - template <typename Parameters, typename T> - inline void setup_stere(Parameters& par, par_stere<T>& proj_parm) + template <typename Params, typename Parameters, typename T> + inline void setup_stere(Params const& params, Parameters& par, par_stere<T>& proj_parm) { static const T half_pi = detail::half_pi<T>(); - if (! pj_param_r(par.params, "lat_ts", proj_parm.phits)) + if (! pj_param_r<srs::spar::lat_ts>(params, "lat_ts", srs::dpar::lat_ts, proj_parm.phits)) proj_parm.phits = half_pi; setup(par, proj_parm); } // Universal Polar Stereographic - template <typename Parameters, typename T> - inline void setup_ups(Parameters& par, par_stere<T>& proj_parm) + template <typename Params, typename Parameters, typename T> + inline void setup_ups(Params const& params, Parameters& par, par_stere<T>& proj_parm) { static const T half_pi = detail::half_pi<T>(); /* International Ellipsoid */ - par.phi0 = pj_get_param_b(par.params, "south") ? -half_pi: half_pi; + par.phi0 = pj_get_param_b<srs::spar::south>(params, "south", srs::dpar::south) ? -half_pi: half_pi; if (par.es == 0.0) { BOOST_THROW_EXCEPTION( projection_exception(error_ellipsoid_use_required) ); } @@ -424,9 +417,11 @@ namespace projections template <typename T, typename Parameters> struct stere_ellipsoid : public detail::stere::base_stere_ellipsoid<T, Parameters> { - inline stere_ellipsoid(const Parameters& par) : detail::stere::base_stere_ellipsoid<T, Parameters>(par) + template <typename Params> + inline stere_ellipsoid(Params const& params, const Parameters& par) + : detail::stere::base_stere_ellipsoid<T, Parameters>(par) { - detail::stere::setup_stere(this->m_par, this->m_proj_parm); + detail::stere::setup_stere(params, this->m_par, this->m_proj_parm); } }; @@ -448,9 +443,11 @@ namespace projections template <typename T, typename Parameters> struct stere_spheroid : public detail::stere::base_stere_spheroid<T, Parameters> { - inline stere_spheroid(const Parameters& par) : detail::stere::base_stere_spheroid<T, Parameters>(par) + template <typename Params> + inline stere_spheroid(Params const& params, const Parameters& par) + : detail::stere::base_stere_spheroid<T, Parameters>(par) { - detail::stere::setup_stere(this->m_par, this->m_proj_parm); + detail::stere::setup_stere(params, this->m_par, this->m_proj_parm); } }; @@ -472,9 +469,11 @@ namespace projections template <typename T, typename Parameters> struct ups_ellipsoid : public detail::stere::base_stere_ellipsoid<T, Parameters> { - inline ups_ellipsoid(const Parameters& par) : detail::stere::base_stere_ellipsoid<T, Parameters>(par) + template <typename Params> + inline ups_ellipsoid(Params const& params, const Parameters& par) + : detail::stere::base_stere_ellipsoid<T, Parameters>(par) { - detail::stere::setup_ups(this->m_par, this->m_proj_parm); + detail::stere::setup_ups(params, this->m_par, this->m_proj_parm); } }; @@ -496,9 +495,11 @@ namespace projections template <typename T, typename Parameters> struct ups_spheroid : public detail::stere::base_stere_spheroid<T, Parameters> { - inline ups_spheroid(const Parameters& par) : detail::stere::base_stere_spheroid<T, Parameters>(par) + template <typename Params> + inline ups_spheroid(Params const& params, const Parameters& par) + : detail::stere::base_stere_spheroid<T, Parameters>(par) { - detail::stere::setup_ups(this->m_par, this->m_proj_parm); + detail::stere::setup_ups(params, this->m_par, this->m_proj_parm); } }; @@ -507,41 +508,17 @@ namespace projections { // Static projection - BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::par4::stere, stere_spheroid, stere_ellipsoid) - BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::par4::ups, ups_spheroid, ups_ellipsoid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_stere, stere_spheroid, stere_ellipsoid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_ups, ups_spheroid, ups_ellipsoid) // Factory entry(s) - template <typename T, typename Parameters> - class stere_entry : public detail::factory_entry<T, Parameters> - { - public : - virtual base_v<T, Parameters>* create_new(const Parameters& par) const - { - if (par.es) - return new base_v_fi<stere_ellipsoid<T, Parameters>, T, Parameters>(par); - else - return new base_v_fi<stere_spheroid<T, Parameters>, T, Parameters>(par); - } - }; - - template <typename T, typename Parameters> - class ups_entry : public detail::factory_entry<T, Parameters> - { - public : - virtual base_v<T, Parameters>* create_new(const Parameters& par) const - { - if (par.es) - return new base_v_fi<ups_ellipsoid<T, Parameters>, T, Parameters>(par); - else - return new base_v_fi<ups_spheroid<T, Parameters>, T, Parameters>(par); - } - }; - - template <typename T, typename Parameters> - inline void stere_init(detail::base_factory<T, Parameters>& factory) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI2(stere_entry, stere_spheroid, stere_ellipsoid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI2(ups_entry, ups_spheroid, ups_ellipsoid) + + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(stere_init) { - factory.add_to_factory("stere", new stere_entry<T, Parameters>); - factory.add_to_factory("ups", new ups_entry<T, Parameters>); + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(stere, stere_entry) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(ups, ups_entry) } } // namespace detail diff --git a/boost/geometry/srs/projections/proj/sterea.hpp b/boost/geometry/srs/projections/proj/sterea.hpp index 055be84e98..514fb03a37 100644 --- a/boost/geometry/srs/projections/proj/sterea.hpp +++ b/boost/geometry/srs/projections/proj/sterea.hpp @@ -54,12 +54,6 @@ namespace boost { namespace geometry { -namespace srs { namespace par4 -{ - struct sterea {}; // Oblique Stereographic Alternative - -}} //namespace srs::par4 - namespace projections { #ifndef DOXYGEN_NO_DETAIL @@ -88,7 +82,7 @@ namespace projections // FORWARD(e_forward) ellipsoid // Project coordinates from geographic (lon, lat) to cartesian (x, y) - inline void fwd(T& lp_lon, T& lp_lat, T& xy_x, T& xy_y) const + inline void fwd(T lp_lon, T lp_lat, T& xy_x, T& xy_y) const { T cosc, sinc, cosl_, k; @@ -103,7 +97,7 @@ namespace projections // INVERSE(e_inverse) ellipsoid // Project coordinates from cartesian (x, y) to geographic (lon, lat) - inline void inv(T& xy_x, T& xy_y, T& lp_lon, T& lp_lat) const + inline void inv(T xy_x, T xy_y, T& lp_lon, T& lp_lat) const { T rho, c, sinc, cosc; @@ -161,7 +155,9 @@ namespace projections template <typename T, typename Parameters> struct sterea_ellipsoid : public detail::sterea::base_sterea_ellipsoid<T, Parameters> { - inline sterea_ellipsoid(const Parameters& par) : detail::sterea::base_sterea_ellipsoid<T, Parameters>(par) + template <typename Params> + inline sterea_ellipsoid(Params const& , Parameters const& par) + : detail::sterea::base_sterea_ellipsoid<T, Parameters>(par) { detail::sterea::setup_sterea(this->m_par, this->m_proj_parm); } @@ -172,23 +168,14 @@ namespace projections { // Static projection - BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::par4::sterea, sterea_ellipsoid, sterea_ellipsoid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_sterea, sterea_ellipsoid, sterea_ellipsoid) // Factory entry(s) - template <typename T, typename Parameters> - class sterea_entry : public detail::factory_entry<T, Parameters> - { - public : - virtual base_v<T, Parameters>* create_new(const Parameters& par) const - { - return new base_v_fi<sterea_ellipsoid<T, Parameters>, T, Parameters>(par); - } - }; - - template <typename T, typename Parameters> - inline void sterea_init(detail::base_factory<T, Parameters>& factory) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(sterea_entry, sterea_ellipsoid) + + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(sterea_init) { - factory.add_to_factory("sterea", new sterea_entry<T, Parameters>); + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(sterea, sterea_entry) } } // namespace detail diff --git a/boost/geometry/srs/projections/proj/sts.hpp b/boost/geometry/srs/projections/proj/sts.hpp index 73bef01626..cdb73fbcc7 100644 --- a/boost/geometry/srs/projections/proj/sts.hpp +++ b/boost/geometry/srs/projections/proj/sts.hpp @@ -49,15 +49,6 @@ namespace boost { namespace geometry { -namespace srs { namespace par4 -{ - struct kav5 {}; // Kavraisky V - struct qua_aut {}; // Quartic Authalic - struct fouc {}; // Foucaut - struct mbt_s {}; // McBryde-Thomas Flat-Polar Sine (No. 1) - -}} //namespace srs::par4 - namespace projections { #ifndef DOXYGEN_NO_DETAIL @@ -83,7 +74,7 @@ namespace projections // FORWARD(s_forward) spheroid // Project coordinates from geographic (lon, lat) to cartesian (x, y) - inline void fwd(T& lp_lon, T& lp_lat, T& xy_x, T& xy_y) const + inline void fwd(T const& lp_lon, T lp_lat, T& xy_x, T& xy_y) const { T c; @@ -102,7 +93,7 @@ namespace projections // INVERSE(s_inverse) spheroid // Project coordinates from cartesian (x, y) to geographic (lon, lat) - inline void inv(T& xy_x, T& xy_y, T& lp_lon, T& lp_lat) const + inline void inv(T const& xy_x, T xy_y, T& lp_lon, T& lp_lat) const { T c; @@ -180,7 +171,9 @@ namespace projections template <typename T, typename Parameters> struct kav5_spheroid : public detail::sts::base_sts_spheroid<T, Parameters> { - inline kav5_spheroid(const Parameters& par) : detail::sts::base_sts_spheroid<T, Parameters>(par) + template <typename Params> + inline kav5_spheroid(Params const& , Parameters const& par) + : detail::sts::base_sts_spheroid<T, Parameters>(par) { detail::sts::setup_kav5(this->m_par, this->m_proj_parm); } @@ -201,7 +194,9 @@ namespace projections template <typename T, typename Parameters> struct qua_aut_spheroid : public detail::sts::base_sts_spheroid<T, Parameters> { - inline qua_aut_spheroid(const Parameters& par) : detail::sts::base_sts_spheroid<T, Parameters>(par) + template <typename Params> + inline qua_aut_spheroid(Params const& , Parameters const& par) + : detail::sts::base_sts_spheroid<T, Parameters>(par) { detail::sts::setup_qua_aut(this->m_par, this->m_proj_parm); } @@ -222,7 +217,9 @@ namespace projections template <typename T, typename Parameters> struct mbt_s_spheroid : public detail::sts::base_sts_spheroid<T, Parameters> { - inline mbt_s_spheroid(const Parameters& par) : detail::sts::base_sts_spheroid<T, Parameters>(par) + template <typename Params> + inline mbt_s_spheroid(Params const& , Parameters const& par) + : detail::sts::base_sts_spheroid<T, Parameters>(par) { detail::sts::setup_mbt_s(this->m_par, this->m_proj_parm); } @@ -243,7 +240,9 @@ namespace projections template <typename T, typename Parameters> struct fouc_spheroid : public detail::sts::base_sts_spheroid<T, Parameters> { - inline fouc_spheroid(const Parameters& par) : detail::sts::base_sts_spheroid<T, Parameters>(par) + template <typename Params> + inline fouc_spheroid(Params const& , Parameters const& par) + : detail::sts::base_sts_spheroid<T, Parameters>(par) { detail::sts::setup_fouc(this->m_par, this->m_proj_parm); } @@ -254,59 +253,23 @@ namespace projections { // Static projection - BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::par4::kav5, kav5_spheroid, kav5_spheroid) - BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::par4::qua_aut, qua_aut_spheroid, qua_aut_spheroid) - BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::par4::mbt_s, mbt_s_spheroid, mbt_s_spheroid) - BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::par4::fouc, fouc_spheroid, fouc_spheroid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_kav5, kav5_spheroid, kav5_spheroid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_qua_aut, qua_aut_spheroid, qua_aut_spheroid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_mbt_s, mbt_s_spheroid, mbt_s_spheroid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_fouc, fouc_spheroid, fouc_spheroid) // Factory entry(s) - template <typename T, typename Parameters> - class kav5_entry : public detail::factory_entry<T, Parameters> - { - public : - virtual base_v<T, Parameters>* create_new(const Parameters& par) const - { - return new base_v_fi<kav5_spheroid<T, Parameters>, T, Parameters>(par); - } - }; - - template <typename T, typename Parameters> - class qua_aut_entry : public detail::factory_entry<T, Parameters> - { - public : - virtual base_v<T, Parameters>* create_new(const Parameters& par) const - { - return new base_v_fi<qua_aut_spheroid<T, Parameters>, T, Parameters>(par); - } - }; - - template <typename T, typename Parameters> - class mbt_s_entry : public detail::factory_entry<T, Parameters> - { - public : - virtual base_v<T, Parameters>* create_new(const Parameters& par) const - { - return new base_v_fi<mbt_s_spheroid<T, Parameters>, T, Parameters>(par); - } - }; - - template <typename T, typename Parameters> - class fouc_entry : public detail::factory_entry<T, Parameters> - { - public : - virtual base_v<T, Parameters>* create_new(const Parameters& par) const - { - return new base_v_fi<fouc_spheroid<T, Parameters>, T, Parameters>(par); - } - }; - - template <typename T, typename Parameters> - inline void sts_init(detail::base_factory<T, Parameters>& factory) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(kav5_entry, kav5_spheroid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(qua_aut_entry, qua_aut_spheroid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(mbt_s_entry, mbt_s_spheroid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(fouc_entry, fouc_spheroid) + + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(sts_init) { - factory.add_to_factory("kav5", new kav5_entry<T, Parameters>); - factory.add_to_factory("qua_aut", new qua_aut_entry<T, Parameters>); - factory.add_to_factory("mbt_s", new mbt_s_entry<T, Parameters>); - factory.add_to_factory("fouc", new fouc_entry<T, Parameters>); + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(kav5, kav5_entry) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(qua_aut, qua_aut_entry) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(mbt_s, mbt_s_entry) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(fouc, fouc_entry) } } // namespace detail diff --git a/boost/geometry/srs/projections/proj/tcc.hpp b/boost/geometry/srs/projections/proj/tcc.hpp index 34e386f91c..84c092bdf7 100644 --- a/boost/geometry/srs/projections/proj/tcc.hpp +++ b/boost/geometry/srs/projections/proj/tcc.hpp @@ -48,12 +48,6 @@ namespace boost { namespace geometry { -namespace srs { namespace par4 -{ - struct tcc {}; // Transverse Central Cylindrical - -}} //namespace srs::par4 - namespace projections { #ifndef DOXYGEN_NO_DETAIL @@ -73,7 +67,7 @@ namespace projections // FORWARD(s_forward) spheroid // Project coordinates from geographic (lon, lat) to cartesian (x, y) - inline void fwd(T& lp_lon, T& lp_lat, T& xy_x, T& xy_y) const + inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const { T b, bt; @@ -118,7 +112,9 @@ namespace projections template <typename T, typename Parameters> struct tcc_spheroid : public detail::tcc::base_tcc_spheroid<T, Parameters> { - inline tcc_spheroid(const Parameters& par) : detail::tcc::base_tcc_spheroid<T, Parameters>(par) + template <typename Params> + inline tcc_spheroid(Params const& , Parameters const& par) + : detail::tcc::base_tcc_spheroid<T, Parameters>(par) { detail::tcc::setup_tcc(this->m_par); } @@ -129,23 +125,14 @@ namespace projections { // Static projection - BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::par4::tcc, tcc_spheroid, tcc_spheroid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_tcc, tcc_spheroid, tcc_spheroid) // Factory entry(s) - template <typename T, typename Parameters> - class tcc_entry : public detail::factory_entry<T, Parameters> - { - public : - virtual base_v<T, Parameters>* create_new(const Parameters& par) const - { - return new base_v_f<tcc_spheroid<T, Parameters>, T, Parameters>(par); - } - }; - - template <typename T, typename Parameters> - inline void tcc_init(detail::base_factory<T, Parameters>& factory) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_F(tcc_entry, tcc_spheroid) + + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(tcc_init) { - factory.add_to_factory("tcc", new tcc_entry<T, Parameters>); + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(tcc, tcc_entry) } } // namespace detail diff --git a/boost/geometry/srs/projections/proj/tcea.hpp b/boost/geometry/srs/projections/proj/tcea.hpp index 3eafcc262a..44a04f3260 100644 --- a/boost/geometry/srs/projections/proj/tcea.hpp +++ b/boost/geometry/srs/projections/proj/tcea.hpp @@ -48,12 +48,6 @@ namespace boost { namespace geometry { -namespace srs { namespace par4 -{ - struct tcea {}; // Transverse Cylindrical Equal Area - -}} //namespace srs::par4 - namespace projections { #ifndef DOXYGEN_NO_DETAIL @@ -70,7 +64,7 @@ namespace projections // FORWARD(s_forward) spheroid // Project coordinates from geographic (lon, lat) to cartesian (x, y) - inline void fwd(T& lp_lon, T& lp_lat, T& xy_x, T& xy_y) const + inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const { xy_x = cos(lp_lat) * sin(lp_lon) / this->m_par.k0; xy_y = this->m_par.k0 * (atan2(tan(lp_lat), cos(lp_lon)) - this->m_par.phi0); @@ -78,7 +72,7 @@ namespace projections // INVERSE(s_inverse) spheroid // Project coordinates from cartesian (x, y) to geographic (lon, lat) - inline void inv(T& xy_x, T& xy_y, T& lp_lon, T& lp_lat) const + inline void inv(T xy_x, T xy_y, T& lp_lon, T& lp_lat) const { T t; @@ -121,7 +115,9 @@ namespace projections template <typename T, typename Parameters> struct tcea_spheroid : public detail::tcea::base_tcea_spheroid<T, Parameters> { - inline tcea_spheroid(const Parameters& par) : detail::tcea::base_tcea_spheroid<T, Parameters>(par) + template <typename Params> + inline tcea_spheroid(Params const& , Parameters const& par) + : detail::tcea::base_tcea_spheroid<T, Parameters>(par) { detail::tcea::setup_tcea(this->m_par); } @@ -132,23 +128,14 @@ namespace projections { // Static projection - BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::par4::tcea, tcea_spheroid, tcea_spheroid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_tcea, tcea_spheroid, tcea_spheroid) // Factory entry(s) - template <typename T, typename Parameters> - class tcea_entry : public detail::factory_entry<T, Parameters> - { - public : - virtual base_v<T, Parameters>* create_new(const Parameters& par) const - { - return new base_v_fi<tcea_spheroid<T, Parameters>, T, Parameters>(par); - } - }; - - template <typename T, typename Parameters> - inline void tcea_init(detail::base_factory<T, Parameters>& factory) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(tcea_entry, tcea_spheroid) + + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(tcea_init) { - factory.add_to_factory("tcea", new tcea_entry<T, Parameters>); + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(tcea, tcea_entry) } } // namespace detail diff --git a/boost/geometry/srs/projections/proj/tmerc.hpp b/boost/geometry/srs/projections/proj/tmerc.hpp index 7c976f82d5..b8dc51cba0 100644 --- a/boost/geometry/srs/projections/proj/tmerc.hpp +++ b/boost/geometry/srs/projections/proj/tmerc.hpp @@ -53,12 +53,6 @@ namespace boost { namespace geometry { -namespace srs { namespace par4 -{ - struct tmerc {}; // Transverse Mercator - -}} //namespace srs::par4 - namespace projections { #ifndef DOXYGEN_NO_DETAIL @@ -105,7 +99,7 @@ namespace projections // FORWARD(e_forward) ellipse // Project coordinates from geographic (lon, lat) to cartesian (x, y) - inline void fwd(T& lp_lon, T& lp_lat, T& xy_x, T& xy_y) const + inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const { static const T half_pi = detail::half_pi<T>(); static const T FC1 = tmerc::FC1<T>(); @@ -157,7 +151,7 @@ namespace projections // INVERSE(e_inverse) ellipsoid // Project coordinates from cartesian (x, y) to geographic (lon, lat) - inline void inv(T& xy_x, T& xy_y, T& lp_lon, T& lp_lat) const + inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const { static const T half_pi = detail::half_pi<T>(); static const T FC1 = tmerc::FC1<T>(); @@ -218,7 +212,7 @@ namespace projections // FORWARD(s_forward) sphere // Project coordinates from geographic (lon, lat) to cartesian (x, y) - inline void fwd(T& lp_lon, T& lp_lat, T& xy_x, T& xy_y) const + inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const { static const T half_pi = detail::half_pi<T>(); @@ -262,7 +256,7 @@ namespace projections // INVERSE(s_inverse) sphere // Project coordinates from cartesian (x, y) to geographic (lon, lat) - inline void inv(T& xy_x, T& xy_y, T& lp_lon, T& lp_lat) const + inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const { T h, g; @@ -316,7 +310,9 @@ namespace projections template <typename T, typename Parameters> struct tmerc_ellipsoid : public detail::tmerc::base_tmerc_ellipsoid<T, Parameters> { - inline tmerc_ellipsoid(const Parameters& par) : detail::tmerc::base_tmerc_ellipsoid<T, Parameters>(par) + template <typename Params> + inline tmerc_ellipsoid(Params const&, Parameters const& par) + : detail::tmerc::base_tmerc_ellipsoid<T, Parameters>(par) { detail::tmerc::setup(this->m_par, this->m_proj_parm); } @@ -338,7 +334,9 @@ namespace projections template <typename T, typename Parameters> struct tmerc_spheroid : public detail::tmerc::base_tmerc_spheroid<T, Parameters> { - inline tmerc_spheroid(const Parameters& par) : detail::tmerc::base_tmerc_spheroid<T, Parameters>(par) + template <typename Params> + inline tmerc_spheroid(Params const&, Parameters const& par) + : detail::tmerc::base_tmerc_spheroid<T, Parameters>(par) { detail::tmerc::setup(this->m_par, this->m_proj_parm); } @@ -349,26 +347,14 @@ namespace projections { // Static projection - BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::par4::tmerc, tmerc_spheroid, tmerc_ellipsoid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_tmerc, tmerc_spheroid, tmerc_ellipsoid) // Factory entry(s) - dynamic projection - template <typename T, typename Parameters> - class tmerc_entry : public detail::factory_entry<T, Parameters> - { - public : - virtual base_v<T, Parameters>* create_new(const Parameters& par) const - { - if (par.es) - return new base_v_fi<tmerc_ellipsoid<T, Parameters>, T, Parameters>(par); - else - return new base_v_fi<tmerc_spheroid<T, Parameters>, T, Parameters>(par); - } - }; - - template <typename T, typename Parameters> - inline void tmerc_init(detail::base_factory<T, Parameters>& factory) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI2(tmerc_entry, tmerc_spheroid, tmerc_ellipsoid) + + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(tmerc_init) { - factory.add_to_factory("tmerc", new tmerc_entry<T, Parameters>); + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(tmerc, tmerc_entry) } } // namespace detail diff --git a/boost/geometry/srs/projections/proj/tpeqd.hpp b/boost/geometry/srs/projections/proj/tpeqd.hpp index 1e8447076a..9b9687fae3 100644 --- a/boost/geometry/srs/projections/proj/tpeqd.hpp +++ b/boost/geometry/srs/projections/proj/tpeqd.hpp @@ -52,12 +52,6 @@ namespace boost { namespace geometry { -namespace srs { namespace par4 -{ - struct tpeqd {}; // Two Point Equidistant - -}} //namespace srs::par4 - namespace projections { #ifndef DOXYGEN_NO_DETAIL @@ -83,7 +77,7 @@ namespace projections // FORWARD(s_forward) sphere // Project coordinates from geographic (lon, lat) to cartesian (x, y) - inline void fwd(T& lp_lon, T& lp_lat, T& xy_x, T& xy_y) const + inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const { T t, z1, z2, dl1, dl2, sp, cp; @@ -103,7 +97,7 @@ namespace projections // INVERSE(s_inverse) sphere // Project coordinates from cartesian (x, y) to geographic (lon, lat) - inline void inv(T& xy_x, T& xy_y, T& lp_lon, T& lp_lat) const + inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const { T cz1, cz2, s, d, cp, sp; @@ -130,16 +124,16 @@ namespace projections }; // Two Point Equidistant - template <typename Parameters, typename T> - inline void setup_tpeqd(Parameters& par, par_tpeqd<T>& proj_parm) + template <typename Params, typename Parameters, typename T> + inline void setup_tpeqd(Params const& params, Parameters& par, par_tpeqd<T>& proj_parm) { T lam_1, lam_2, phi_1, phi_2, A12, pp; /* get control point locations */ - phi_1 = pj_get_param_r(par.params, "lat_1"); - lam_1 = pj_get_param_r(par.params, "lon_1"); - phi_2 = pj_get_param_r(par.params, "lat_2"); - lam_2 = pj_get_param_r(par.params, "lon_2"); + phi_1 = pj_get_param_r<T, srs::spar::lat_1>(params, "lat_1", srs::dpar::lat_1); + lam_1 = pj_get_param_r<T, srs::spar::lon_1>(params, "lon_1", srs::dpar::lon_1); + phi_2 = pj_get_param_r<T, srs::spar::lat_2>(params, "lat_2", srs::dpar::lat_2); + lam_2 = pj_get_param_r<T, srs::spar::lon_2>(params, "lon_2", srs::dpar::lon_2); if (phi_1 == phi_2 && lam_1 == lam_2) BOOST_THROW_EXCEPTION( projection_exception(error_control_point_no_dist) ); @@ -194,9 +188,11 @@ namespace projections template <typename T, typename Parameters> struct tpeqd_spheroid : public detail::tpeqd::base_tpeqd_spheroid<T, Parameters> { - inline tpeqd_spheroid(const Parameters& par) : detail::tpeqd::base_tpeqd_spheroid<T, Parameters>(par) + template <typename Params> + inline tpeqd_spheroid(Params const& params, Parameters const& par) + : detail::tpeqd::base_tpeqd_spheroid<T, Parameters>(par) { - detail::tpeqd::setup_tpeqd(this->m_par, this->m_proj_parm); + detail::tpeqd::setup_tpeqd(params, this->m_par, this->m_proj_parm); } }; @@ -205,23 +201,14 @@ namespace projections { // Static projection - BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::par4::tpeqd, tpeqd_spheroid, tpeqd_spheroid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_tpeqd, tpeqd_spheroid, tpeqd_spheroid) // Factory entry(s) - template <typename T, typename Parameters> - class tpeqd_entry : public detail::factory_entry<T, Parameters> - { - public : - virtual base_v<T, Parameters>* create_new(const Parameters& par) const - { - return new base_v_fi<tpeqd_spheroid<T, Parameters>, T, Parameters>(par); - } - }; - - template <typename T, typename Parameters> - inline void tpeqd_init(detail::base_factory<T, Parameters>& factory) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(tpeqd_entry, tpeqd_spheroid) + + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(tpeqd_init) { - factory.add_to_factory("tpeqd", new tpeqd_entry<T, Parameters>); + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(tpeqd, tpeqd_entry) } } // namespace detail diff --git a/boost/geometry/srs/projections/proj/urm5.hpp b/boost/geometry/srs/projections/proj/urm5.hpp index bdda5fc400..4cec4cdd1e 100644 --- a/boost/geometry/srs/projections/proj/urm5.hpp +++ b/boost/geometry/srs/projections/proj/urm5.hpp @@ -49,12 +49,6 @@ namespace boost { namespace geometry { -namespace srs { namespace par4 -{ - struct urm5 {}; // Urmaev V - -}} //namespace srs::par4 - namespace projections { #ifndef DOXYGEN_NO_DETAIL @@ -79,7 +73,7 @@ namespace projections // FORWARD(s_forward) spheroid // Project coordinates from geographic (lon, lat) to cartesian (x, y) - inline void fwd(T& lp_lon, T& lp_lat, T& xy_x, T& xy_y) const + inline void fwd(T const& lp_lon, T lp_lat, T& xy_x, T& xy_y) const { T t; @@ -97,19 +91,19 @@ namespace projections }; // Urmaev V - template <typename Parameters, typename T> - inline void setup_urm5(Parameters& par, par_urm5<T>& proj_parm) + template <typename Params, typename Parameters, typename T> + inline void setup_urm5(Params const& params, Parameters& par, par_urm5<T>& proj_parm) { T alpha, t; - if (pj_param_f(par.params, "n", proj_parm.n)) { + if (pj_param_f<srs::spar::n>(params, "n", srs::dpar::n, proj_parm.n)) { if (proj_parm.n <= 0. || proj_parm.n > 1.) BOOST_THROW_EXCEPTION( projection_exception(error_n_out_of_range) ); } else { BOOST_THROW_EXCEPTION( projection_exception(error_n_out_of_range) ); } - proj_parm.q3 = pj_get_param_f(par.params, "q") / 3.; - alpha = pj_get_param_r(par.params, "alpha"); + proj_parm.q3 = pj_get_param_f<T, srs::spar::q>(params, "q", srs::dpar::q) / 3.; + alpha = pj_get_param_r<T, srs::spar::alpha>(params, "alpha", srs::dpar::alpha); t = proj_parm.n * sin(alpha); proj_parm.m = cos(alpha) / sqrt(1. - t * t); proj_parm.rmn = 1. / (proj_parm.m * proj_parm.n); @@ -140,9 +134,11 @@ namespace projections template <typename T, typename Parameters> struct urm5_spheroid : public detail::urm5::base_urm5_spheroid<T, Parameters> { - inline urm5_spheroid(const Parameters& par) : detail::urm5::base_urm5_spheroid<T, Parameters>(par) + template <typename Params> + inline urm5_spheroid(Params const& params, Parameters const& par) + : detail::urm5::base_urm5_spheroid<T, Parameters>(par) { - detail::urm5::setup_urm5(this->m_par, this->m_proj_parm); + detail::urm5::setup_urm5(params, this->m_par, this->m_proj_parm); } }; @@ -151,23 +147,14 @@ namespace projections { // Static projection - BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::par4::urm5, urm5_spheroid, urm5_spheroid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_urm5, urm5_spheroid, urm5_spheroid) // Factory entry(s) - template <typename T, typename Parameters> - class urm5_entry : public detail::factory_entry<T, Parameters> - { - public : - virtual base_v<T, Parameters>* create_new(const Parameters& par) const - { - return new base_v_f<urm5_spheroid<T, Parameters>, T, Parameters>(par); - } - }; - - template <typename T, typename Parameters> - inline void urm5_init(detail::base_factory<T, Parameters>& factory) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_F(urm5_entry, urm5_spheroid) + + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(urm5_init) { - factory.add_to_factory("urm5", new urm5_entry<T, Parameters>); + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(urm5, urm5_entry) } } // namespace detail diff --git a/boost/geometry/srs/projections/proj/urmfps.hpp b/boost/geometry/srs/projections/proj/urmfps.hpp index d4b303ba37..aa7982758a 100644 --- a/boost/geometry/srs/projections/proj/urmfps.hpp +++ b/boost/geometry/srs/projections/proj/urmfps.hpp @@ -49,13 +49,6 @@ namespace boost { namespace geometry { -namespace srs { namespace par4 -{ - struct urmfps {}; // Urmaev Flat-Polar Sinusoidal - struct wag1 {}; // Wagner I (Kavraisky VI) - -}} //namespace srs::par4 - namespace projections { #ifndef DOXYGEN_NO_DETAIL @@ -84,7 +77,7 @@ namespace projections // FORWARD(s_forward) sphere // Project coordinates from geographic (lon, lat) to cartesian (x, y) - inline void fwd(T& lp_lon, T& lp_lat, T& xy_x, T& xy_y) const + inline void fwd(T const& lp_lon, T lp_lat, T& xy_x, T& xy_y) const { lp_lat = aasin(this->m_proj_parm.n * sin(lp_lat)); xy_x = C_x * lp_lon * cos(lp_lat); @@ -93,7 +86,7 @@ namespace projections // INVERSE(s_inverse) sphere // Project coordinates from cartesian (x, y) to geographic (lon, lat) - inline void inv(T& xy_x, T& xy_y, T& lp_lon, T& lp_lat) const + inline void inv(T const& xy_x, T xy_y, T& lp_lon, T& lp_lat) const { xy_y /= this->m_proj_parm.C_y; lp_lat = aasin(sin(xy_y) / this->m_proj_parm.n); @@ -116,10 +109,10 @@ namespace projections // Urmaev Flat-Polar Sinusoidal - template <typename Parameters, typename T> - inline void setup_urmfps(Parameters& par, par_urmfps<T>& proj_parm) + template <typename Params, typename Parameters, typename T> + inline void setup_urmfps(Params const& params, Parameters& par, par_urmfps<T>& proj_parm) { - if (pj_param_f(par.params, "n", proj_parm.n)) { + if (pj_param_f<srs::spar::n>(params, "n", srs::dpar::n, proj_parm.n)) { if (proj_parm.n <= 0. || proj_parm.n > 1.) BOOST_THROW_EXCEPTION( projection_exception(error_n_out_of_range) ); } else @@ -156,9 +149,11 @@ namespace projections template <typename T, typename Parameters> struct urmfps_spheroid : public detail::urmfps::base_urmfps_spheroid<T, Parameters> { - inline urmfps_spheroid(const Parameters& par) : detail::urmfps::base_urmfps_spheroid<T, Parameters>(par) + template <typename Params> + inline urmfps_spheroid(Params const& params, Parameters const& par) + : detail::urmfps::base_urmfps_spheroid<T, Parameters>(par) { - detail::urmfps::setup_urmfps(this->m_par, this->m_proj_parm); + detail::urmfps::setup_urmfps(params, this->m_par, this->m_proj_parm); } }; @@ -177,7 +172,9 @@ namespace projections template <typename T, typename Parameters> struct wag1_spheroid : public detail::urmfps::base_urmfps_spheroid<T, Parameters> { - inline wag1_spheroid(const Parameters& par) : detail::urmfps::base_urmfps_spheroid<T, Parameters>(par) + template <typename Params> + inline wag1_spheroid(Params const& , Parameters const& par) + : detail::urmfps::base_urmfps_spheroid<T, Parameters>(par) { detail::urmfps::setup_wag1(this->m_par, this->m_proj_parm); } @@ -188,35 +185,17 @@ namespace projections { // Static projection - BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::par4::urmfps, urmfps_spheroid, urmfps_spheroid) - BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::par4::wag1, wag1_spheroid, wag1_spheroid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_urmfps, urmfps_spheroid, urmfps_spheroid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_wag1, wag1_spheroid, wag1_spheroid) // Factory entry(s) - template <typename T, typename Parameters> - class urmfps_entry : public detail::factory_entry<T, Parameters> - { - public : - virtual base_v<T, Parameters>* create_new(const Parameters& par) const - { - return new base_v_fi<urmfps_spheroid<T, Parameters>, T, Parameters>(par); - } - }; - - template <typename T, typename Parameters> - class wag1_entry : public detail::factory_entry<T, Parameters> - { - public : - virtual base_v<T, Parameters>* create_new(const Parameters& par) const - { - return new base_v_fi<wag1_spheroid<T, Parameters>, T, Parameters>(par); - } - }; - - template <typename T, typename Parameters> - inline void urmfps_init(detail::base_factory<T, Parameters>& factory) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(urmfps_entry, urmfps_spheroid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(wag1_entry, wag1_spheroid) + + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(urmfps_init) { - factory.add_to_factory("urmfps", new urmfps_entry<T, Parameters>); - factory.add_to_factory("wag1", new wag1_entry<T, Parameters>); + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(urmfps, urmfps_entry) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(wag1, wag1_entry) } } // namespace detail diff --git a/boost/geometry/srs/projections/proj/vandg.hpp b/boost/geometry/srs/projections/proj/vandg.hpp index 4124ca2354..08ca85a080 100644 --- a/boost/geometry/srs/projections/proj/vandg.hpp +++ b/boost/geometry/srs/projections/proj/vandg.hpp @@ -50,12 +50,6 @@ namespace boost { namespace geometry { -namespace srs { namespace par4 -{ - struct vandg {}; - -}} //namespace srs::par4 - namespace projections { #ifndef DOXYGEN_NO_DETAIL @@ -84,7 +78,7 @@ namespace projections // FORWARD(s_forward) spheroid // Project coordinates from geographic (lon, lat) to cartesian (x, y) - inline void fwd(T& lp_lon, T& lp_lat, T& xy_x, T& xy_y) const + inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const { static const T half_pi = detail::half_pi<T>(); static const T pi = detail::pi<T>(); @@ -129,7 +123,7 @@ namespace projections // INVERSE(s_inverse) spheroid // Project coordinates from cartesian (x, y) to geographic (lon, lat) - inline void inv(T& xy_x, T& xy_y, T& lp_lon, T& lp_lat) const + inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const { static const T half_pi = detail::half_pi<T>(); static const T pi = detail::pi<T>(); @@ -206,7 +200,9 @@ namespace projections template <typename T, typename Parameters> struct vandg_spheroid : public detail::vandg::base_vandg_spheroid<T, Parameters> { - inline vandg_spheroid(const Parameters& par) : detail::vandg::base_vandg_spheroid<T, Parameters>(par) + template <typename Params> + inline vandg_spheroid(Params const& , Parameters const& par) + : detail::vandg::base_vandg_spheroid<T, Parameters>(par) { detail::vandg::setup_vandg(this->m_par); } @@ -217,23 +213,14 @@ namespace projections { // Static projection - BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::par4::vandg, vandg_spheroid, vandg_spheroid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_vandg, vandg_spheroid, vandg_spheroid) // Factory entry(s) - template <typename T, typename Parameters> - class vandg_entry : public detail::factory_entry<T, Parameters> - { - public : - virtual base_v<T, Parameters>* create_new(const Parameters& par) const - { - return new base_v_fi<vandg_spheroid<T, Parameters>, T, Parameters>(par); - } - }; - - template <typename T, typename Parameters> - inline void vandg_init(detail::base_factory<T, Parameters>& factory) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(vandg_entry, vandg_spheroid) + + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(vandg_init) { - factory.add_to_factory("vandg", new vandg_entry<T, Parameters>); + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(vandg, vandg_entry) } } // namespace detail diff --git a/boost/geometry/srs/projections/proj/vandg2.hpp b/boost/geometry/srs/projections/proj/vandg2.hpp index a1af0302a7..dc9b45cded 100644 --- a/boost/geometry/srs/projections/proj/vandg2.hpp +++ b/boost/geometry/srs/projections/proj/vandg2.hpp @@ -50,13 +50,6 @@ namespace boost { namespace geometry { -namespace srs { namespace par4 -{ - struct vandg2 {}; // van der Grinten II - struct vandg3 {}; // van der Grinten III - -}} //namespace srs::par4 - namespace projections { #ifndef DOXYGEN_NO_DETAIL @@ -83,7 +76,7 @@ namespace projections // FORWARD(s_forward) spheroid // Project coordinates from geographic (lon, lat) to cartesian (x, y) - inline void fwd(T& lp_lon, T& lp_lat, T& xy_x, T& xy_y) const + inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const { static const T pi = detail::pi<T>(); static const T two_div_pi = detail::two_div_pi<T>(); @@ -123,8 +116,7 @@ namespace projections }; // van der Grinten II - template <typename Parameters> - inline void setup_vandg2(Parameters& /*par*/, par_vandg2& proj_parm) + inline void setup_vandg2(par_vandg2& proj_parm) { proj_parm.vdg3 = false; } @@ -156,9 +148,11 @@ namespace projections template <typename T, typename Parameters> struct vandg2_spheroid : public detail::vandg2::base_vandg2_spheroid<T, Parameters> { - inline vandg2_spheroid(const Parameters& par) : detail::vandg2::base_vandg2_spheroid<T, Parameters>(par) + template <typename Params> + inline vandg2_spheroid(Params const& , Parameters const& par) + : detail::vandg2::base_vandg2_spheroid<T, Parameters>(par) { - detail::vandg2::setup_vandg2(this->m_par, this->m_proj_parm); + detail::vandg2::setup_vandg2(this->m_proj_parm); } }; @@ -178,7 +172,9 @@ namespace projections template <typename T, typename Parameters> struct vandg3_spheroid : public detail::vandg2::base_vandg2_spheroid<T, Parameters> { - inline vandg3_spheroid(const Parameters& par) : detail::vandg2::base_vandg2_spheroid<T, Parameters>(par) + template <typename Params> + inline vandg3_spheroid(Params const& , Parameters const& par) + : detail::vandg2::base_vandg2_spheroid<T, Parameters>(par) { detail::vandg2::setup_vandg3(this->m_par, this->m_proj_parm); } @@ -189,35 +185,17 @@ namespace projections { // Static projection - BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::par4::vandg2, vandg2_spheroid, vandg2_spheroid) - BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::par4::vandg3, vandg3_spheroid, vandg3_spheroid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_vandg2, vandg2_spheroid, vandg2_spheroid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_vandg3, vandg3_spheroid, vandg3_spheroid) // Factory entry(s) - template <typename T, typename Parameters> - class vandg2_entry : public detail::factory_entry<T, Parameters> - { - public : - virtual base_v<T, Parameters>* create_new(const Parameters& par) const - { - return new base_v_f<vandg2_spheroid<T, Parameters>, T, Parameters>(par); - } - }; - - template <typename T, typename Parameters> - class vandg3_entry : public detail::factory_entry<T, Parameters> - { - public : - virtual base_v<T, Parameters>* create_new(const Parameters& par) const - { - return new base_v_f<vandg3_spheroid<T, Parameters>, T, Parameters>(par); - } - }; - - template <typename T, typename Parameters> - inline void vandg2_init(detail::base_factory<T, Parameters>& factory) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_F(vandg2_entry, vandg2_spheroid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_F(vandg3_entry, vandg3_spheroid) + + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(vandg2_init) { - factory.add_to_factory("vandg2", new vandg2_entry<T, Parameters>); - factory.add_to_factory("vandg3", new vandg3_entry<T, Parameters>); + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(vandg2, vandg2_entry) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(vandg3, vandg3_entry) } } // namespace detail diff --git a/boost/geometry/srs/projections/proj/vandg4.hpp b/boost/geometry/srs/projections/proj/vandg4.hpp index 35f1dafdb0..4dce98a787 100644 --- a/boost/geometry/srs/projections/proj/vandg4.hpp +++ b/boost/geometry/srs/projections/proj/vandg4.hpp @@ -50,12 +50,6 @@ namespace boost { namespace geometry { -namespace srs { namespace par4 -{ - struct vandg4 {}; // van der Grinten IV - -}} //namespace srs::par4 - namespace projections { #ifndef DOXYGEN_NO_DETAIL @@ -75,7 +69,7 @@ namespace projections // FORWARD(s_forward) spheroid // Project coordinates from geographic (lon, lat) to cartesian (x, y) - inline void fwd(T& lp_lon, T& lp_lat, T& xy_x, T& xy_y) const + inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const { static const T half_pi = detail::half_pi<T>(); static const T two_div_pi = detail::two_div_pi<T>(); @@ -146,7 +140,9 @@ namespace projections template <typename T, typename Parameters> struct vandg4_spheroid : public detail::vandg4::base_vandg4_spheroid<T, Parameters> { - inline vandg4_spheroid(const Parameters& par) : detail::vandg4::base_vandg4_spheroid<T, Parameters>(par) + template <typename Params> + inline vandg4_spheroid(Params const& , Parameters const& par) + : detail::vandg4::base_vandg4_spheroid<T, Parameters>(par) { detail::vandg4::setup_vandg4(this->m_par); } @@ -157,23 +153,14 @@ namespace projections { // Static projection - BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::par4::vandg4, vandg4_spheroid, vandg4_spheroid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_vandg4, vandg4_spheroid, vandg4_spheroid) // Factory entry(s) - template <typename T, typename Parameters> - class vandg4_entry : public detail::factory_entry<T, Parameters> - { - public : - virtual base_v<T, Parameters>* create_new(const Parameters& par) const - { - return new base_v_f<vandg4_spheroid<T, Parameters>, T, Parameters>(par); - } - }; - - template <typename T, typename Parameters> - inline void vandg4_init(detail::base_factory<T, Parameters>& factory) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_F(vandg4_entry, vandg4_spheroid) + + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(vandg4_init) { - factory.add_to_factory("vandg4", new vandg4_entry<T, Parameters>); + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(vandg4, vandg4_entry) } } // namespace detail diff --git a/boost/geometry/srs/projections/proj/wag2.hpp b/boost/geometry/srs/projections/proj/wag2.hpp index c598936e08..3c3c5ac128 100644 --- a/boost/geometry/srs/projections/proj/wag2.hpp +++ b/boost/geometry/srs/projections/proj/wag2.hpp @@ -49,12 +49,6 @@ namespace boost { namespace geometry { -namespace srs { namespace par4 -{ - struct wag2 {}; // Wagner II - -}} //namespace srs::par4 - namespace projections { #ifndef DOXYGEN_NO_DETAIL @@ -77,7 +71,7 @@ namespace projections // FORWARD(s_forward) spheroid // Project coordinates from geographic (lon, lat) to cartesian (x, y) - inline void fwd(T& lp_lon, T& lp_lat, T& xy_x, T& xy_y) const + inline void fwd(T const& lp_lon, T lp_lat, T& xy_x, T& xy_y) const { lp_lat = aasin(C_p1 * sin(C_p2 * lp_lat)); xy_x = C_x * lp_lon * cos(lp_lat); @@ -86,7 +80,7 @@ namespace projections // INVERSE(s_inverse) spheroid // Project coordinates from cartesian (x, y) to geographic (lon, lat) - inline void inv(T& xy_x, T& xy_y, T& lp_lon, T& lp_lat) const + inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const { lp_lat = xy_y / C_y; lp_lon = xy_x / (C_x * cos(lp_lat)); @@ -125,7 +119,9 @@ namespace projections template <typename T, typename Parameters> struct wag2_spheroid : public detail::wag2::base_wag2_spheroid<T, Parameters> { - inline wag2_spheroid(const Parameters& par) : detail::wag2::base_wag2_spheroid<T, Parameters>(par) + template <typename Params> + inline wag2_spheroid(Params const& , Parameters const& par) + : detail::wag2::base_wag2_spheroid<T, Parameters>(par) { detail::wag2::setup_wag2(this->m_par); } @@ -136,23 +132,14 @@ namespace projections { // Static projection - BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::par4::wag2, wag2_spheroid, wag2_spheroid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_wag2, wag2_spheroid, wag2_spheroid) // Factory entry(s) - template <typename T, typename Parameters> - class wag2_entry : public detail::factory_entry<T, Parameters> - { - public : - virtual base_v<T, Parameters>* create_new(const Parameters& par) const - { - return new base_v_fi<wag2_spheroid<T, Parameters>, T, Parameters>(par); - } - }; - - template <typename T, typename Parameters> - inline void wag2_init(detail::base_factory<T, Parameters>& factory) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(wag2_entry, wag2_spheroid) + + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(wag2_init) { - factory.add_to_factory("wag2", new wag2_entry<T, Parameters>); + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(wag2, wag2_entry) } } // namespace detail diff --git a/boost/geometry/srs/projections/proj/wag3.hpp b/boost/geometry/srs/projections/proj/wag3.hpp index 05edf18ec8..825ead3533 100644 --- a/boost/geometry/srs/projections/proj/wag3.hpp +++ b/boost/geometry/srs/projections/proj/wag3.hpp @@ -48,12 +48,6 @@ namespace boost { namespace geometry { -namespace srs { namespace par4 -{ - struct wag3 {}; // Wagner III - -}} //namespace srs::par4 - namespace projections { #ifndef DOXYGEN_NO_DETAIL @@ -78,7 +72,7 @@ namespace projections // FORWARD(s_forward) spheroid // Project coordinates from geographic (lon, lat) to cartesian (x, y) - inline void fwd(T& lp_lon, T& lp_lat, T& xy_x, T& xy_y) const + inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const { static const T two_thirds = detail::two_thirds<T>(); @@ -88,7 +82,7 @@ namespace projections // INVERSE(s_inverse) spheroid // Project coordinates from cartesian (x, y) to geographic (lon, lat) - inline void inv(T& xy_x, T& xy_y, T& lp_lon, T& lp_lat) const + inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const { static const T two_thirds = detail::two_thirds<T>(); @@ -104,12 +98,10 @@ namespace projections }; // Wagner III - template <typename Parameters, typename T> - inline void setup_wag3(Parameters& par, par_wag3<T>& proj_parm) + template <typename Params, typename Parameters, typename T> + inline void setup_wag3(Params const& params, Parameters& par, par_wag3<T>& proj_parm) { - T ts; - - ts = pj_get_param_r(par.params, "lat_ts"); + T const ts = pj_get_param_r<T, srs::spar::lat_ts>(params, "lat_ts", srs::dpar::lat_ts); proj_parm.C_x = cos(ts) / cos(2.*ts/3.); par.es = 0.; } @@ -134,9 +126,11 @@ namespace projections template <typename T, typename Parameters> struct wag3_spheroid : public detail::wag3::base_wag3_spheroid<T, Parameters> { - inline wag3_spheroid(const Parameters& par) : detail::wag3::base_wag3_spheroid<T, Parameters>(par) + template <typename Params> + inline wag3_spheroid(Params const& params, Parameters const& par) + : detail::wag3::base_wag3_spheroid<T, Parameters>(par) { - detail::wag3::setup_wag3(this->m_par, this->m_proj_parm); + detail::wag3::setup_wag3(params, this->m_par, this->m_proj_parm); } }; @@ -145,23 +139,14 @@ namespace projections { // Static projection - BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::par4::wag3, wag3_spheroid, wag3_spheroid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_wag3, wag3_spheroid, wag3_spheroid) // Factory entry(s) - template <typename T, typename Parameters> - class wag3_entry : public detail::factory_entry<T, Parameters> - { - public : - virtual base_v<T, Parameters>* create_new(const Parameters& par) const - { - return new base_v_fi<wag3_spheroid<T, Parameters>, T, Parameters>(par); - } - }; - - template <typename T, typename Parameters> - inline void wag3_init(detail::base_factory<T, Parameters>& factory) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(wag3_entry, wag3_spheroid) + + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(wag3_init) { - factory.add_to_factory("wag3", new wag3_entry<T, Parameters>); + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(wag3, wag3_entry) } } // namespace detail diff --git a/boost/geometry/srs/projections/proj/wag7.hpp b/boost/geometry/srs/projections/proj/wag7.hpp index 4604dc6eab..9e2f3a58bf 100644 --- a/boost/geometry/srs/projections/proj/wag7.hpp +++ b/boost/geometry/srs/projections/proj/wag7.hpp @@ -48,12 +48,6 @@ namespace boost { namespace geometry { -namespace srs { namespace par4 -{ - struct wag7 {}; // Wagner VII - -}} //namespace srs::par4 - namespace projections { #ifndef DOXYGEN_NO_DETAIL @@ -71,7 +65,7 @@ namespace projections // FORWARD(s_forward) sphere // Project coordinates from geographic (lon, lat) to cartesian (x, y) - inline void fwd(T& lp_lon, T& lp_lat, T& xy_x, T& xy_y) const + inline void fwd(T lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const { T theta, ct, D; @@ -114,7 +108,9 @@ namespace projections template <typename T, typename Parameters> struct wag7_spheroid : public detail::wag7::base_wag7_spheroid<T, Parameters> { - inline wag7_spheroid(const Parameters& par) : detail::wag7::base_wag7_spheroid<T, Parameters>(par) + template <typename Params> + inline wag7_spheroid(Params const& , Parameters const& par) + : detail::wag7::base_wag7_spheroid<T, Parameters>(par) { detail::wag7::setup_wag7(this->m_par); } @@ -125,23 +121,14 @@ namespace projections { // Static projection - BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::par4::wag7, wag7_spheroid, wag7_spheroid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_wag7, wag7_spheroid, wag7_spheroid) // Factory entry(s) - template <typename T, typename Parameters> - class wag7_entry : public detail::factory_entry<T, Parameters> - { - public : - virtual base_v<T, Parameters>* create_new(const Parameters& par) const - { - return new base_v_f<wag7_spheroid<T, Parameters>, T, Parameters>(par); - } - }; - - template <typename T, typename Parameters> - inline void wag7_init(detail::base_factory<T, Parameters>& factory) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_F(wag7_entry, wag7_spheroid) + + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(wag7_init) { - factory.add_to_factory("wag7", new wag7_entry<T, Parameters>); + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(wag7, wag7_entry) } } // namespace detail diff --git a/boost/geometry/srs/projections/proj/wink1.hpp b/boost/geometry/srs/projections/proj/wink1.hpp index 5fdd739629..b920daa97f 100644 --- a/boost/geometry/srs/projections/proj/wink1.hpp +++ b/boost/geometry/srs/projections/proj/wink1.hpp @@ -48,12 +48,6 @@ namespace boost { namespace geometry { -namespace srs { namespace par4 -{ - struct wink1 {}; // Winkel I - -}} //namespace srs::par4 - namespace projections { #ifndef DOXYGEN_NO_DETAIL @@ -79,7 +73,7 @@ namespace projections // FORWARD(s_forward) spheroid // Project coordinates from geographic (lon, lat) to cartesian (x, y) - inline void fwd(T& lp_lon, T& lp_lat, T& xy_x, T& xy_y) const + inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const { xy_x = .5 * lp_lon * (this->m_proj_parm.cosphi1 + cos(lp_lat)); xy_y = lp_lat; @@ -87,7 +81,7 @@ namespace projections // INVERSE(s_inverse) spheroid // Project coordinates from cartesian (x, y) to geographic (lon, lat) - inline void inv(T& xy_x, T& xy_y, T& lp_lon, T& lp_lat) const + inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const { lp_lat = xy_y; lp_lon = 2. * xy_x / (this->m_proj_parm.cosphi1 + cos(lp_lat)); @@ -101,10 +95,10 @@ namespace projections }; // Winkel I - template <typename Parameters, typename T> - inline void setup_wink1(Parameters& par, par_wink1<T>& proj_parm) + template <typename Params, typename Parameters, typename T> + inline void setup_wink1(Params const& params, Parameters& par, par_wink1<T>& proj_parm) { - proj_parm.cosphi1 = cos(pj_get_param_r(par.params, "lat_ts")); + proj_parm.cosphi1 = cos(pj_get_param_r<T, srs::spar::lat_ts>(params, "lat_ts", srs::dpar::lat_ts)); par.es = 0.; } @@ -128,9 +122,11 @@ namespace projections template <typename T, typename Parameters> struct wink1_spheroid : public detail::wink1::base_wink1_spheroid<T, Parameters> { - inline wink1_spheroid(const Parameters& par) : detail::wink1::base_wink1_spheroid<T, Parameters>(par) + template <typename Params> + inline wink1_spheroid(Params const& params, Parameters const& par) + : detail::wink1::base_wink1_spheroid<T, Parameters>(par) { - detail::wink1::setup_wink1(this->m_par, this->m_proj_parm); + detail::wink1::setup_wink1(params, this->m_par, this->m_proj_parm); } }; @@ -139,23 +135,14 @@ namespace projections { // Static projection - BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::par4::wink1, wink1_spheroid, wink1_spheroid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_wink1, wink1_spheroid, wink1_spheroid) // Factory entry(s) - template <typename T, typename Parameters> - class wink1_entry : public detail::factory_entry<T, Parameters> - { - public : - virtual base_v<T, Parameters>* create_new(const Parameters& par) const - { - return new base_v_fi<wink1_spheroid<T, Parameters>, T, Parameters>(par); - } - }; - - template <typename T, typename Parameters> - inline void wink1_init(detail::base_factory<T, Parameters>& factory) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(wink1_entry, wink1_spheroid) + + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(wink1_init) { - factory.add_to_factory("wink1", new wink1_entry<T, Parameters>); + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(wink1, wink1_entry) } } // namespace detail diff --git a/boost/geometry/srs/projections/proj/wink2.hpp b/boost/geometry/srs/projections/proj/wink2.hpp index ba6fb70bf1..06f0770365 100644 --- a/boost/geometry/srs/projections/proj/wink2.hpp +++ b/boost/geometry/srs/projections/proj/wink2.hpp @@ -50,12 +50,6 @@ namespace boost { namespace geometry { -namespace srs { namespace par4 -{ - struct wink2 {}; // Winkel II - -}} //namespace srs::par4 - namespace projections { #ifndef DOXYGEN_NO_DETAIL @@ -84,7 +78,7 @@ namespace projections // FORWARD(s_forward) spheroid // Project coordinates from geographic (lon, lat) to cartesian (x, y) - inline void fwd(T& lp_lon, T& lp_lat, T& xy_x, T& xy_y) const + inline void fwd(T const& lp_lon, T lp_lat, T& xy_x, T& xy_y) const { static const T pi = detail::pi<T>(); static const T half_pi = detail::half_pi<T>(); @@ -119,10 +113,10 @@ namespace projections }; // Winkel II - template <typename Parameters, typename T> - inline void setup_wink2(Parameters& par, par_wink2<T>& proj_parm) + template <typename Params, typename Parameters, typename T> + inline void setup_wink2(Params const& params, Parameters& par, par_wink2<T>& proj_parm) { - proj_parm.cosphi1 = cos(pj_get_param_r(par.params, "lat_1")); + proj_parm.cosphi1 = cos(pj_get_param_r<T, srs::spar::lat_1>(params, "lat_1", srs::dpar::lat_1)); par.es = 0.; } @@ -147,9 +141,11 @@ namespace projections template <typename T, typename Parameters> struct wink2_spheroid : public detail::wink2::base_wink2_spheroid<T, Parameters> { - inline wink2_spheroid(const Parameters& par) : detail::wink2::base_wink2_spheroid<T, Parameters>(par) + template <typename Params> + inline wink2_spheroid(Params const& params, Parameters const& par) + : detail::wink2::base_wink2_spheroid<T, Parameters>(par) { - detail::wink2::setup_wink2(this->m_par, this->m_proj_parm); + detail::wink2::setup_wink2(params, this->m_par, this->m_proj_parm); } }; @@ -158,25 +154,16 @@ namespace projections { // Static projection - BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::par4::wink2, wink2_spheroid, wink2_spheroid) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_wink2, wink2_spheroid, wink2_spheroid) // Factory entry(s) - template <typename T, typename Parameters> - class wink2_entry : public detail::factory_entry<T, Parameters> - { - public : - virtual base_v<T, Parameters>* create_new(const Parameters& par) const - { - return new base_v_f<wink2_spheroid<T, Parameters>, T, Parameters>(par); - } - }; - - template <typename T, typename Parameters> - inline void wink2_init(detail::base_factory<T, Parameters>& factory) + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_F(wink2_entry, wink2_spheroid) + + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(wink2_init) { - factory.add_to_factory("wink2", new wink2_entry<T, Parameters>); + BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(wink2, wink2_entry) } - + } // namespace detail #endif // doxygen |