update boost

This commit is contained in:
2023-11-24 12:56:13 -06:00
parent cfc99971af
commit 19d727037a
9260 changed files with 849256 additions and 299957 deletions

View File

@@ -2,8 +2,8 @@
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2017, 2018.
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
// This file was modified by Oracle on 2017, 2018, 2019.
// Modifications copyright (c) 2017-2019, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
// Use, modification and distribution is subject to the Boost Software License,
@@ -88,7 +88,7 @@ namespace projections
T phi1;
T phi2;
detail::en<T> en;
int ellips;
bool ellips;
};
/* determine latitude angle phi-1 */
@@ -115,23 +115,17 @@ namespace projections
return( i ? Phi : HUGE_VAL );
}
// template class, using CRTP to implement forward/inverse
template <typename T, typename Parameters>
struct base_aea_ellipsoid
: public base_t_fi<base_aea_ellipsoid<T, Parameters>, T, Parameters>
{
par_aea<T> m_proj_parm;
inline base_aea_ellipsoid(const Parameters& par)
: base_t_fi<base_aea_ellipsoid<T, Parameters>, T, Parameters>(*this, par)
{}
// FORWARD(e_forward) ellipsoid & spheroid
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
inline void fwd(T lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
inline void fwd(Parameters const& par, 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)
? this->m_proj_parm.n * pj_qsfn(sin(lp_lat), par.e, par.one_es)
: this->m_proj_parm.n2 * sin(lp_lat));
if (rho < 0.)
BOOST_THROW_EXCEPTION( projection_exception(error_tolerance_condition) );
@@ -142,7 +136,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(Parameters const& par, T xy_x, T xy_y, T& lp_lon, T& lp_lat) const
{
static const T half_pi = detail::half_pi<T>();
@@ -157,7 +151,7 @@ namespace projections
if (this->m_proj_parm.ellips) {
lp_lat = (this->m_proj_parm.c - lp_lat * lp_lat) / this->m_proj_parm.n;
if (fabs(this->m_proj_parm.ec - fabs(lp_lat)) > tolerance7) {
if ((lp_lat = phi1_(lp_lat, this->m_par.e, this->m_par.one_es)) == HUGE_VAL)
if ((lp_lat = phi1_(lp_lat, par.e, par.one_es)) == HUGE_VAL)
BOOST_THROW_EXCEPTION( projection_exception(error_tolerance_condition) );
} else
lp_lat = lp_lat < 0. ? -half_pi : half_pi;
@@ -180,7 +174,7 @@ namespace projections
};
template <typename Parameters, typename T>
inline void setup(Parameters const& par, par_aea<T>& proj_parm)
inline void setup(Parameters const& par, par_aea<T>& proj_parm)
{
T cosphi, sinphi;
int secant;
@@ -282,9 +276,8 @@ namespace projections
{
template <typename Params>
inline aea_ellipsoid(Params const& params, Parameters const& par)
: detail::aea::base_aea_ellipsoid<T, Parameters>(par)
{
detail::aea::setup_aea(params, this->m_par, this->m_proj_parm);
detail::aea::setup_aea(params, par, this->m_proj_parm);
}
};
@@ -309,9 +302,8 @@ namespace projections
{
template <typename Params>
inline leac_ellipsoid(Params const& params, Parameters const& par)
: detail::aea::base_aea_ellipsoid<T, Parameters>(par)
{
detail::aea::setup_leac(params, this->m_par, this->m_proj_parm);
detail::aea::setup_leac(params, par, this->m_proj_parm);
}
};
@@ -320,8 +312,8 @@ namespace projections
{
// Static projection
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)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_FI(srs::spar::proj_aea, aea_ellipsoid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_FI(srs::spar::proj_leac, leac_ellipsoid)
// Factory entry(s)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(aea_entry, aea_ellipsoid)

View File

@@ -2,8 +2,8 @@
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2017, 2018.
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
// This file was modified by Oracle on 2017-2020.
// Modifications copyright (c) 2017-2020, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
// Use, modification and distribution is subject to the Boost Software License,
@@ -44,6 +44,9 @@
#ifndef BOOST_GEOMETRY_PROJECTIONS_AEQD_HPP
#define BOOST_GEOMETRY_PROJECTIONS_AEQD_HPP
#include <type_traits>
#include <boost/config.hpp>
#include <boost/geometry/formulas/vincenty_direct.hpp>
@@ -61,7 +64,6 @@
#include <boost/math/special_functions/hypot.hpp>
#include <boost/type_traits/is_same.hpp>
namespace boost { namespace geometry
{
@@ -88,12 +90,12 @@ namespace projections
T cosph0;
detail::en<T> en;
T M1;
T N1;
//T N1;
T Mp;
T He;
T G;
//T He;
//T G;
T b;
mode_type mode;
srs::spheroid<T> spheroid;
};
template <typename T, typename Par, typename ProjParm>
@@ -129,7 +131,7 @@ namespace projections
formula::vincenty_inverse
<
T, true, true
>::apply(par.lam0, par.phi0, lp_lon + par.lam0, lp_lat, proj_parm.spheroid);
>::apply(par.lam0, par.phi0, lp_lon + par.lam0, lp_lat, srs::spheroid<T>(par.a, proj_parm.b));
//azi1 = inv.azimuth; s12 = inv.distance;
xy_x = inv.distance * sin(inv.azimuth) / par.a;
xy_y = inv.distance * cos(inv.azimuth) / par.a;
@@ -158,7 +160,7 @@ namespace projections
formula::vincenty_direct
<
T, true
>::apply(par.lam0, par.phi0, s12, azi1, proj_parm.spheroid);
>::apply(par.lam0, par.phi0, s12, azi1, srs::spheroid<T>(par.a, proj_parm.b));
lp_lat = dir.lat2;
lp_lon = dir.lon2;
lp_lon -= par.lam0;
@@ -202,7 +204,7 @@ namespace projections
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>();
T coslam, cosphi, sinphi;
sinphi = sin(lp_lat);
@@ -246,7 +248,7 @@ namespace projections
{
static const T pi = detail::pi<T>();
static const T half_pi = detail::half_pi<T>();
T cosc, c_rh, sinc;
if ((c_rh = boost::math::hypot(xy_x, xy_y)) > pi) {
@@ -317,41 +319,34 @@ namespace projections
break;
case equit:
case obliq:
proj_parm.N1 = 1. / sqrt(1. - par.es * proj_parm.sinph0 * proj_parm.sinph0);
proj_parm.G = proj_parm.sinph0 * (proj_parm.He = par.e / sqrt(par.one_es));
proj_parm.He *= proj_parm.cosph0;
//proj_parm.N1 = 1. / sqrt(1. - par.es * proj_parm.sinph0 * proj_parm.sinph0);
//proj_parm.G = proj_parm.sinph0 * (proj_parm.He = par.e / sqrt(par.one_es));
//proj_parm.He *= proj_parm.cosph0;
break;
}
// Boost.Geometry specific, in proj4 geodesic is initialized at the beginning
T const b = math::sqrt(math::sqr(par.a) * (1. - par.es));
proj_parm.spheroid = srs::spheroid<T>(par.a, b);
proj_parm.b = math::sqrt(math::sqr(par.a) * (1. - par.es));
}
}
}
// template class, using CRTP to implement forward/inverse
template <typename T, typename Parameters>
struct base_aeqd_e
: public base_t_fi<base_aeqd_e<T, Parameters>, T, Parameters>
{
par_aeqd<T> m_proj_parm;
inline base_aeqd_e(const Parameters& par)
: base_t_fi<base_aeqd_e<T, Parameters>, T, Parameters>(*this, par)
{}
// FORWARD(e_forward) elliptical
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
inline void fwd(Parameters const& par, 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);
e_forward(lp_lon, lp_lat, xy_x, xy_y, par, this->m_proj_parm);
}
// INVERSE(e_inverse) elliptical
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
inline void inv(Parameters const& par, 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);
e_inverse(xy_x, xy_y, lp_lon, lp_lat, par, this->m_proj_parm);
}
static inline std::string get_name()
@@ -361,29 +356,23 @@ namespace projections
};
// template class, using CRTP to implement forward/inverse
template <typename T, typename Parameters>
struct base_aeqd_e_guam
: public base_t_fi<base_aeqd_e_guam<T, Parameters>, T, Parameters>
{
par_aeqd<T> m_proj_parm;
inline base_aeqd_e_guam(const Parameters& par)
: base_t_fi<base_aeqd_e_guam<T, Parameters>, T, Parameters>(*this, par)
{}
// FORWARD(e_guam_fwd) Guam elliptical
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
inline void fwd(Parameters const& par, 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);
e_guam_fwd(lp_lon, lp_lat, xy_x, xy_y, 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 const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
inline void inv(Parameters const& par, 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);
e_guam_inv(xy_x, xy_y, lp_lon, lp_lat, par, this->m_proj_parm);
}
static inline std::string get_name()
@@ -393,78 +382,23 @@ namespace projections
};
// template class, using CRTP to implement forward/inverse
template <typename BGParameters, typename T, typename Parameters>
struct base_aeqd_e_static
: public base_t_fi<base_aeqd_e_static<BGParameters, T, Parameters>, T, Parameters>
{
par_aeqd<T> m_proj_parm;
static const bool is_guam = ! boost::is_same
<
typename srs::spar::detail::tuples_find_if
<
BGParameters,
//srs::par4::detail::is_guam
srs::spar::detail::is_param<srs::spar::guam>::pred
>::type,
void
>::value;
inline base_aeqd_e_static(const Parameters& par)
: base_t_fi<base_aeqd_e_static<BGParameters, T, Parameters>, T, Parameters>(*this, par)
{}
// FORWARD(e_forward or e_guam_fwd) elliptical
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
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);
else
e_forward(lp_lon, lp_lat, xy_x, xy_y, this->m_par, this->m_proj_parm);
}
// INVERSE(e_inverse or e_guam_inv) elliptical
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
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);
else
e_inverse(xy_x, xy_y, lp_lon, lp_lat, this->m_par, this->m_proj_parm);
}
static inline std::string get_name()
{
return "aeqd_e_static";
}
};
// template class, using CRTP to implement forward/inverse
template <typename T, typename Parameters>
struct base_aeqd_s
: public base_t_fi<base_aeqd_s<T, Parameters>, T, Parameters>
{
par_aeqd<T> m_proj_parm;
inline base_aeqd_s(const Parameters& par)
: base_t_fi<base_aeqd_s<T, Parameters>, T, Parameters>(*this, par)
{}
// FORWARD(s_forward) spherical
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
inline void fwd(Parameters const& par, 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);
s_forward(lp_lon, lp_lat, xy_x, xy_y, par, this->m_proj_parm);
}
// INVERSE(s_inverse) spherical
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
inline void inv(Parameters const& par, 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);
s_inverse(xy_x, xy_y, lp_lon, lp_lat, par, this->m_proj_parm);
}
static inline std::string get_name()
@@ -497,10 +431,9 @@ namespace projections
struct aeqd_e : public detail::aeqd::base_aeqd_e<T, Parameters>
{
template <typename Params>
inline aeqd_e(Params const& params, Parameters const& par)
: detail::aeqd::base_aeqd_e<T, Parameters>(par)
inline aeqd_e(Params const& params, Parameters & par)
{
detail::aeqd::setup_aeqd(params, this->m_par, this->m_proj_parm, false, false);
detail::aeqd::setup_aeqd(params, par, this->m_proj_parm, false, false);
}
};
@@ -524,38 +457,9 @@ namespace projections
struct aeqd_e_guam : public detail::aeqd::base_aeqd_e_guam<T, Parameters>
{
template <typename Params>
inline aeqd_e_guam(Params const& params, Parameters const& par)
: detail::aeqd::base_aeqd_e_guam<T, Parameters>(par)
inline aeqd_e_guam(Params const& params, Parameters & par)
{
detail::aeqd::setup_aeqd(params, this->m_par, this->m_proj_parm, false, true);
}
};
/*!
\brief Azimuthal Equidistant projection
\ingroup projections
\tparam Geographic latlong point type
\tparam Cartesian xy point type
\tparam Parameters parameter type
\par Projection characteristics
- Azimuthal
- Spheroid
- Ellipsoid
\par Projection parameters
- lat_0: Latitude of origin (degrees)
- guam (boolean)
\par Example
\image html ex_aeqd.gif
*/
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(SParams const& params, Parameters const& par)
: detail::aeqd::base_aeqd_e_static<SParams, T, Parameters>(par)
{
detail::aeqd::setup_aeqd(params, this->m_par, this->m_proj_parm,
false,
detail::aeqd::base_aeqd_e_static<SParams, T, Parameters>::is_guam);
detail::aeqd::setup_aeqd(params, par, this->m_proj_parm, false, true);
}
};
@@ -579,10 +483,9 @@ namespace projections
struct aeqd_s : public detail::aeqd::base_aeqd_s<T, Parameters>
{
template <typename Params>
inline aeqd_s(Params const& params, Parameters const& par)
: detail::aeqd::base_aeqd_s<T, Parameters>(par)
inline aeqd_s(Params const& params, Parameters & par)
{
detail::aeqd::setup_aeqd(params, this->m_par, this->m_proj_parm, true, false);
detail::aeqd::setup_aeqd(params, par, this->m_proj_parm, true, false);
}
};
@@ -594,12 +497,29 @@ namespace projections
template <typename BGP, typename CT, typename P>
struct static_projection_type<srs::spar::proj_aeqd, srs_sphere_tag, BGP, CT, P>
{
typedef aeqd_s<CT, P> type;
typedef static_wrapper_fi<aeqd_s<CT, P>, P> type;
};
template <typename BGP, typename CT, typename P>
struct static_projection_type<srs::spar::proj_aeqd, srs_spheroid_tag, BGP, CT, P>
{
typedef aeqd_e_static<BGP, CT, P> type;
typedef static_wrapper_fi
<
std::conditional_t
<
std::is_void
<
typename geometry::tuples::find_if
<
BGP,
//srs::par4::detail::is_guam
srs::spar::detail::is_param<srs::spar::guam>::pred
>::type
>::value,
aeqd_e<CT, P>,
aeqd_e_guam<CT, P>
>
, P
> type;
};
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_BEGIN(aeqd_entry)
@@ -607,11 +527,11 @@ namespace projections
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);
return new dynamic_wrapper_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);
return new dynamic_wrapper_fi<aeqd_e_guam<T, Parameters>, T, Parameters>(params, parameters);
else
return new base_v_fi<aeqd_s<T, Parameters>, T, Parameters>(params, parameters);
return new dynamic_wrapper_fi<aeqd_s<T, Parameters>, T, Parameters>(params, parameters);
}
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_END

View File

@@ -2,8 +2,8 @@
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2017, 2018.
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
// This file was modified by Oracle on 2017, 2018, 2019.
// Modifications copyright (c) 2017-2019, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
// Use, modification and distribution is subject to the Boost Software License,
@@ -78,23 +78,17 @@ namespace projections
T cosph0;
T Cb;
mode_type mode;
int no_cut; /* do not cut at hemisphere limit */
bool no_cut; /* do not cut at hemisphere limit */
};
// template class, using CRTP to implement forward/inverse
template <typename T, typename Parameters>
struct base_airy_spheroid
: public base_t_f<base_airy_spheroid<T, Parameters>, T, Parameters>
{
par_airy<T> m_proj_parm;
inline base_airy_spheroid(const Parameters& par)
: base_t_f<base_airy_spheroid<T, Parameters>, T, Parameters>(*this, par)
{}
// FORWARD(s_forward) spheroid
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
inline void fwd(T const& lp_lon, T lp_lat, T& xy_x, T& xy_y) const
inline void fwd(Parameters const& , T const& lp_lon, T lp_lat, T& xy_x, T& xy_y) const
{
static const T half_pi = detail::half_pi<T>();
@@ -209,10 +203,9 @@ namespace projections
struct airy_spheroid : public detail::airy::base_airy_spheroid<T, Parameters>
{
template <typename Params>
inline airy_spheroid(Params const& params, Parameters const& par)
: detail::airy::base_airy_spheroid<T, Parameters>(par)
inline airy_spheroid(Params const& params, Parameters & par)
{
detail::airy::setup_airy(params, this->m_par, this->m_proj_parm);
detail::airy::setup_airy(params, par, this->m_proj_parm);
}
};
@@ -221,11 +214,11 @@ namespace projections
{
// Static projection
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_airy, airy_spheroid, airy_spheroid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_F(srs::spar::proj_airy, airy_spheroid)
// Factory entry(s)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_F(airy_entry, airy_spheroid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(airy_init)
{
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(airy, airy_entry)

View File

@@ -2,8 +2,8 @@
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2017, 2018.
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
// This file was modified by Oracle on 2017, 2018, 2019.
// Modifications copyright (c) 2017-2019, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
// Use, modification and distribution is subject to the Boost Software License,
@@ -77,20 +77,14 @@ namespace projections
mode_type mode;
};
// template class, using CRTP to implement forward/inverse
template <typename T, typename Parameters>
struct base_aitoff_spheroid
: public base_t_fi<base_aitoff_spheroid<T, Parameters>, T, Parameters>
{
par_aitoff<T> m_proj_parm;
inline base_aitoff_spheroid(const Parameters& par)
: base_t_fi<base_aitoff_spheroid<T, Parameters>, T, Parameters>(*this, par)
{}
// FORWARD(s_forward) spheroid
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
inline void fwd(Parameters const& , T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
{
T c, d;
@@ -127,7 +121,7 @@ namespace projections
// INVERSE(s_inverse) sphere
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
inline void inv(Parameters const& , 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>();
@@ -253,10 +247,9 @@ namespace projections
struct aitoff_spheroid : public detail::aitoff::base_aitoff_spheroid<T, Parameters>
{
template <typename Params>
inline aitoff_spheroid(Params const& , Parameters const& par)
: detail::aitoff::base_aitoff_spheroid<T, Parameters>(par)
inline aitoff_spheroid(Params const& , Parameters & par)
{
detail::aitoff::setup_aitoff(this->m_par, this->m_proj_parm);
detail::aitoff::setup_aitoff(par, this->m_proj_parm);
}
};
@@ -278,10 +271,9 @@ namespace projections
struct wintri_spheroid : public detail::aitoff::base_aitoff_spheroid<T, Parameters>
{
template <typename Params>
inline wintri_spheroid(Params const& params, Parameters const& par)
: detail::aitoff::base_aitoff_spheroid<T, Parameters>(par)
inline wintri_spheroid(Params const& params, Parameters & par)
{
detail::aitoff::setup_wintri(params, this->m_par, this->m_proj_parm);
detail::aitoff::setup_wintri(params, par, this->m_proj_parm);
}
};
@@ -290,8 +282,8 @@ namespace projections
{
// Static projection
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)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_FI(srs::spar::proj_aitoff, aitoff_spheroid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_FI(srs::spar::proj_wintri, wintri_spheroid)
// Factory entry(s)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(aitoff_entry, aitoff_spheroid)

View File

@@ -2,8 +2,8 @@
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2017, 2018.
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
// This file was modified by Oracle on 2017, 2018, 2019.
// Modifications copyright (c) 2017-2019, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
// Use, modification and distribution is subject to the Boost Software License,
@@ -56,18 +56,12 @@ namespace projections
//static const double M = 1.333333333333333;
// template class, using CRTP to implement forward/inverse
template <typename T, typename Parameters>
struct base_august_spheroid
: public base_t_f<base_august_spheroid<T, Parameters>, T, Parameters>
{
inline base_august_spheroid(const Parameters& par)
: base_t_f<base_august_spheroid<T, Parameters>, T, Parameters>(*this, par)
{}
// FORWARD(s_forward) spheroid
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
inline void fwd(T lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
inline void fwd(Parameters const& , T lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
{
static const T M = 1.333333333333333333333333333333333333;
@@ -116,10 +110,9 @@ namespace projections
struct august_spheroid : public detail::august::base_august_spheroid<T, Parameters>
{
template <typename Params>
inline august_spheroid(Params const& , Parameters const& par)
: detail::august::base_august_spheroid<T, Parameters>(par)
inline august_spheroid(Params const& , Parameters & par)
{
detail::august::setup_august(this->m_par);
detail::august::setup_august(par);
}
};
@@ -128,11 +121,11 @@ namespace projections
{
// Static projection
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_august, august_spheroid, august_spheroid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_F(srs::spar::proj_august, august_spheroid)
// Factory entry(s)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_F(august_entry, august_spheroid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(august_init)
{
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(august, august_entry)

View File

@@ -2,8 +2,8 @@
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2017, 2018.
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
// This file was modified by Oracle on 2017, 2018, 2019.
// Modifications copyright (c) 2017-2019, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
// Use, modification and distribution is subject to the Boost Software License,
@@ -61,24 +61,18 @@ namespace projections
struct par_bacon
{
int bacn;
int ortl;
bool bacn;
bool ortl;
};
// template class, using CRTP to implement forward/inverse
template <typename T, typename Parameters>
struct base_bacon_spheroid
: public base_t_f<base_bacon_spheroid<T, Parameters>, T, Parameters>
{
par_bacon m_proj_parm;
inline base_bacon_spheroid(const Parameters& par)
: base_t_f<base_bacon_spheroid<T, Parameters>, T, Parameters>(*this, par)
{}
// FORWARD(s_forward) spheroid
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
inline void fwd(Parameters const& , 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>();
@@ -109,7 +103,7 @@ namespace projections
template <typename Parameters>
inline void setup_apian(Parameters& par, par_bacon& proj_parm)
{
proj_parm.bacn = proj_parm.ortl = 0;
proj_parm.bacn = proj_parm.ortl = false;
par.es = 0.;
}
@@ -117,8 +111,8 @@ namespace projections
template <typename Parameters>
inline void setup_ortel(Parameters& par, par_bacon& proj_parm)
{
proj_parm.bacn = 0;
proj_parm.ortl = 1;
proj_parm.bacn = false;
proj_parm.ortl = true;
par.es = 0.;
}
@@ -126,8 +120,8 @@ namespace projections
template <typename Parameters>
inline void setup_bacon(Parameters& par, par_bacon& proj_parm)
{
proj_parm.bacn = 1;
proj_parm.ortl = 0;
proj_parm.bacn = true;
proj_parm.ortl = false;
par.es = 0.;
}
@@ -151,10 +145,9 @@ namespace projections
struct apian_spheroid : public detail::bacon::base_bacon_spheroid<T, Parameters>
{
template <typename Params>
inline apian_spheroid(Params const& , Parameters const& par)
: detail::bacon::base_bacon_spheroid<T, Parameters>(par)
inline apian_spheroid(Params const& , Parameters & par)
{
detail::bacon::setup_apian(this->m_par, this->m_proj_parm);
detail::bacon::setup_apian(par, this->m_proj_parm);
}
};
@@ -175,10 +168,9 @@ namespace projections
struct ortel_spheroid : public detail::bacon::base_bacon_spheroid<T, Parameters>
{
template <typename Params>
inline ortel_spheroid(Params const& , Parameters const& par)
: detail::bacon::base_bacon_spheroid<T, Parameters>(par)
inline ortel_spheroid(Params const& , Parameters & par)
{
detail::bacon::setup_ortel(this->m_par, this->m_proj_parm);
detail::bacon::setup_ortel(par, this->m_proj_parm);
}
};
@@ -199,10 +191,9 @@ namespace projections
struct bacon_spheroid : public detail::bacon::base_bacon_spheroid<T, Parameters>
{
template <typename Params>
inline bacon_spheroid(Params const& , Parameters const& par)
: detail::bacon::base_bacon_spheroid<T, Parameters>(par)
inline bacon_spheroid(Params const& , Parameters & par)
{
detail::bacon::setup_bacon(this->m_par, this->m_proj_parm);
detail::bacon::setup_bacon(par, this->m_proj_parm);
}
};
@@ -211,9 +202,9 @@ namespace projections
{
// Static projection
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)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_F(srs::spar::proj_apian, apian_spheroid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_F(srs::spar::proj_bacon, bacon_spheroid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_F(srs::spar::proj_ortel, ortel_spheroid)
// Factory entry(s)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_F(apian_entry, apian_spheroid)

View File

@@ -2,8 +2,8 @@
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2017, 2018.
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
// This file was modified by Oracle on 2017, 2018, 2019.
// Modifications copyright (c) 2017-2019, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
// Use, modification and distribution is subject to the Boost Software License,
@@ -81,23 +81,17 @@ namespace projections
struct par_bipc
{
int noskew;
bool noskew;
};
// template class, using CRTP to implement forward/inverse
template <typename T, typename Parameters>
struct base_bipc_spheroid
: public base_t_fi<base_bipc_spheroid<T, Parameters>, T, Parameters>
{
par_bipc m_proj_parm;
inline base_bipc_spheroid(const Parameters& par)
: base_t_fi<base_bipc_spheroid<T, Parameters>, T, Parameters>(*this, par)
{}
// FORWARD(s_forward) spheroid
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
inline void fwd(Parameters const& , 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>();
@@ -171,7 +165,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(Parameters const& , 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;
@@ -251,10 +245,9 @@ namespace projections
struct bipc_spheroid : public detail::bipc::base_bipc_spheroid<T, Parameters>
{
template <typename Params>
inline bipc_spheroid(Params const& params, Parameters const& par)
: detail::bipc::base_bipc_spheroid<T, Parameters>(par)
inline bipc_spheroid(Params const& params, Parameters & par)
{
detail::bipc::setup_bipc(params, this->m_par, this->m_proj_parm);
detail::bipc::setup_bipc(params, par, this->m_proj_parm);
}
};
@@ -263,11 +256,11 @@ namespace projections
{
// Static projection
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_bipc, bipc_spheroid, bipc_spheroid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_FI(srs::spar::proj_bipc, bipc_spheroid)
// Factory entry(s)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(bipc_entry, bipc_spheroid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(bipc_init)
{
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(bipc, bipc_entry)

View File

@@ -2,8 +2,8 @@
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2017, 2018.
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
// This file was modified by Oracle on 2017, 2018, 2019.
// Modifications copyright (c) 2017-2019, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
// Use, modification and distribution is subject to the Boost Software License,
@@ -62,18 +62,12 @@ namespace projections
static const double FXC2 = 1.11072;
static const double FYC = 0.49931;
// template class, using CRTP to implement forward/inverse
template <typename T, typename Parameters>
struct base_boggs_spheroid
: public base_t_f<base_boggs_spheroid<T, Parameters>, T, Parameters>
{
inline base_boggs_spheroid(const Parameters& par)
: base_t_f<base_boggs_spheroid<T, Parameters>, T, Parameters>(*this, par)
{}
// FORWARD(s_forward) spheroid
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
inline void fwd(Parameters const& , 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>();
@@ -132,10 +126,9 @@ namespace projections
struct boggs_spheroid : public detail::boggs::base_boggs_spheroid<T, Parameters>
{
template <typename Params>
inline boggs_spheroid(Params const& , Parameters const& par)
: detail::boggs::base_boggs_spheroid<T, Parameters>(par)
inline boggs_spheroid(Params const& , Parameters & par)
{
detail::boggs::setup_boggs(this->m_par);
detail::boggs::setup_boggs(par);
}
};
@@ -144,7 +137,7 @@ namespace projections
{
// Static projection
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_boggs, boggs_spheroid, boggs_spheroid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_F(srs::spar::proj_boggs, boggs_spheroid)
// Factory entry(s)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_F(boggs_entry, boggs_spheroid)

View File

@@ -2,8 +2,8 @@
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2017, 2018.
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
// This file was modified by Oracle on 2017, 2018, 2019.
// Modifications copyright (c) 2017-2019, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
// Use, modification and distribution is subject to the Boost Software License,
@@ -72,43 +72,37 @@ namespace projections
detail::en<T> en;
};
// template class, using CRTP to implement forward/inverse
template <typename T, typename Parameters>
struct base_bonne_ellipsoid
: public base_t_fi<base_bonne_ellipsoid<T, Parameters>, T, Parameters>
{
par_bonne<T> m_proj_parm;
inline base_bonne_ellipsoid(const Parameters& par)
: base_t_fi<base_bonne_ellipsoid<T, Parameters>, T, Parameters>(*this, par)
{}
// FORWARD(e_forward) ellipsoid
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
inline void fwd(Parameters const& par, T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
{
T rh, E, c;
rh = this->m_proj_parm.am1 + this->m_proj_parm.m1 - pj_mlfn(lp_lat, E = sin(lp_lat), c = cos(lp_lat), this->m_proj_parm.en);
E = c * lp_lon / (rh * sqrt(1. - this->m_par.es * E * E));
E = c * lp_lon / (rh * sqrt(1. - par.es * E * E));
xy_x = rh * sin(E);
xy_y = this->m_proj_parm.am1 - rh * cos(E);
}
// INVERSE(e_inverse) ellipsoid
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
inline void inv(T const& xy_x, T xy_y, T& lp_lon, T& lp_lat) const
inline void inv(Parameters const& par, T const& xy_x, T xy_y, T& lp_lon, T& lp_lat) const
{
static const T half_pi = detail::half_pi<T>();
T s, rh;
rh = boost::math::hypot(xy_x, xy_y = this->m_proj_parm.am1 - xy_y);
lp_lat = pj_inv_mlfn(this->m_proj_parm.am1 + this->m_proj_parm.m1 - rh, this->m_par.es, this->m_proj_parm.en);
lp_lat = pj_inv_mlfn(this->m_proj_parm.am1 + this->m_proj_parm.m1 - rh, par.es, this->m_proj_parm.en);
if ((s = fabs(lp_lat)) < half_pi) {
s = sin(lp_lat);
lp_lon = rh * atan2(xy_x, xy_y) *
sqrt(1. - this->m_par.es * s * s) / cos(lp_lat);
sqrt(1. - par.es * s * s) / cos(lp_lat);
} else if (fabs(s - half_pi) <= epsilon10)
lp_lon = 0.;
else
@@ -122,20 +116,14 @@ namespace projections
};
// template class, using CRTP to implement forward/inverse
template <typename T, typename Parameters>
struct base_bonne_spheroid
: public base_t_fi<base_bonne_spheroid<T, Parameters>, T, Parameters>
{
par_bonne<T> m_proj_parm;
inline base_bonne_spheroid(const Parameters& par)
: base_t_fi<base_bonne_spheroid<T, Parameters>, T, Parameters>(*this, par)
{}
// FORWARD(s_forward) spheroid
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
inline void fwd(Parameters const& , T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
{
T E, rh;
@@ -149,7 +137,7 @@ namespace projections
// INVERSE(s_inverse) spheroid
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
inline void inv(T const& xy_x, T xy_y, T& lp_lon, T& lp_lat) const
inline void inv(Parameters const& , T const& xy_x, T xy_y, T& lp_lon, T& lp_lat) const
{
static const T half_pi = detail::half_pi<T>();
@@ -175,7 +163,7 @@ namespace projections
// Bonne (Werner lat_1=90)
template <typename Params, typename Parameters, typename T>
inline void setup_bonne(Params const& params, Parameters& par, par_bonne<T>& proj_parm)
inline void setup_bonne(Params const& params, Parameters const& par, par_bonne<T>& proj_parm)
{
static const T half_pi = detail::half_pi<T>();
@@ -221,9 +209,8 @@ namespace projections
{
template <typename Params>
inline bonne_ellipsoid(Params const& params, Parameters const& par)
: detail::bonne::base_bonne_ellipsoid<T, Parameters>(par)
{
detail::bonne::setup_bonne(params, this->m_par, this->m_proj_parm);
detail::bonne::setup_bonne(params, par, this->m_proj_parm);
}
};
@@ -247,9 +234,8 @@ namespace projections
{
template <typename Params>
inline bonne_spheroid(Params const& params, Parameters const& par)
: detail::bonne::base_bonne_spheroid<T, Parameters>(par)
{
detail::bonne::setup_bonne(params, this->m_par, this->m_proj_parm);
detail::bonne::setup_bonne(params, par, this->m_proj_parm);
}
};
@@ -258,7 +244,7 @@ namespace projections
{
// Static projection
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_bonne, bonne_spheroid, bonne_ellipsoid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_FI2(srs::spar::proj_bonne, bonne_spheroid, bonne_ellipsoid)
// Factory entry(s)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI2(bonne_entry, bonne_spheroid, bonne_ellipsoid)

View File

@@ -2,8 +2,9 @@
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2017, 2018.
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
// This file was modified by Oracle on 2017, 2018, 2019, 2022.
// Modifications copyright (c) 2017-2022, Oracle and/or its affiliates.
// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
// Use, modification and distribution is subject to the Boost Software License,
@@ -15,7 +16,7 @@
// PROJ4 is maintained by Frank Warmerdam
// PROJ4 is converted to Boost.Geometry by Barend Gehrels
// Last updated version of proj: 5.0.0
// Last updated version of proj: 9.0.0
// Original copyright notice:
@@ -44,8 +45,9 @@
#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_generic_inverse.hpp>
#include <boost/geometry/srs/projections/impl/pj_mlfn.hpp>
#include <boost/geometry/srs/projections/impl/pj_param.hpp>
namespace boost { namespace geometry
{
@@ -79,45 +81,48 @@ namespace projections
{
T m0;
detail::en<T> en;
bool hyperbolic;
};
// template class, using CRTP to implement forward/inverse
template <typename T, typename Parameters>
struct base_cass_ellipsoid
: public base_t_fi<base_cass_ellipsoid<T, Parameters>, T, Parameters>
{
par_cass<T> m_proj_parm;
inline base_cass_ellipsoid(const Parameters& par)
: base_t_fi<base_cass_ellipsoid<T, Parameters>, T, Parameters>(*this, par)
{}
// FORWARD(e_forward) ellipsoid
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
inline void fwd(Parameters const& par, 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>();
static const T C3 = cass::C3<T>();
static T const C1 = cass::C1<T>();
static T const C2 = cass::C2<T>();
static T const C3 = cass::C3<T>();
T n = sin(lp_lat);
T sinlplat = sin(lp_lat);
T c = cos(lp_lat);
xy_y = pj_mlfn(lp_lat, n, c, this->m_proj_parm.en);
n = 1./sqrt(1. - this->m_par.es * n * n);
xy_y = pj_mlfn(lp_lat, sinlplat, c, this->m_proj_parm.en);
T n_square = 1./(1. - par.es * sinlplat * sinlplat);
T n = sqrt(n_square);
T tn = tan(lp_lat);
T t = tn * tn;
T a1 = lp_lon * c;
c *= this->m_par.es * c / (1 - this->m_par.es);
c *= par.es * c / (1 - par.es);
T a2 = a1 * a1;
xy_x = n * a1 * (1. - a2 * t *
(C1 - (8. - t + 8. * c) * a2 * C2));
xy_y -= this->m_proj_parm.m0 - n * tn * a2 *
(.5 + (5. - t + 6. * c) * a2 * C3);
if ( this->m_proj_parm.hyperbolic )
{
T const rho = n_square * (1. - par.es) * n;
xy_y -= xy_y * xy_y * xy_y / (6 * rho * n);
}
}
// INVERSE(e_inverse) ellipsoid
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
inline void inv(Parameters const& par, 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>();
@@ -125,18 +130,25 @@ namespace projections
T ph1;
ph1 = pj_inv_mlfn(this->m_proj_parm.m0 + xy_y, this->m_par.es, this->m_proj_parm.en);
ph1 = pj_inv_mlfn(this->m_proj_parm.m0 + xy_y, par.es, this->m_proj_parm.en);
T tn = tan(ph1); T t = tn * tn;
T n = sin(ph1);
T r = 1. / (1. - this->m_par.es * n * n);
T r = 1. / (1. - par.es * n * n);
n = sqrt(r);
r *= (1. - this->m_par.es) * n;
r *= (1. - par.es) * n;
T dd = xy_x / n;
T d2 = dd * dd;
lp_lat = ph1 - (n * tn / r) * d2 *
(.5 - (1. + 3. * t) * d2 * C3);
lp_lon = dd * (1. + t * d2 *
(-C4 + (1. + 3. * t) * d2 * C5)) / cos(ph1);
if ( this->m_proj_parm.hyperbolic )
{
// EPSG guidance note 7-2 suggests a custom approximation for the
// 'Vanua Levu 1915 / Vanua Levu Grid' case, but better use the
// generic inversion method
pj_generic_inverse_2d(xy_x, xy_y, par, this, lp_lat, lp_lon);
}
}
static inline std::string get_name()
@@ -146,30 +158,26 @@ namespace projections
};
// template class, using CRTP to implement forward/inverse
template <typename T, typename Parameters>
struct base_cass_spheroid
: public base_t_fi<base_cass_spheroid<T, Parameters>, T, Parameters>
{
par_cass<T> m_proj_parm;
inline base_cass_spheroid(const Parameters& par)
: base_t_fi<base_cass_spheroid<T, Parameters>, T, Parameters>(*this, par)
{}
// FORWARD(s_forward) spheroid
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
inline void fwd(Parameters const& par, 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;
xy_y = atan2(tan(lp_lat) , cos(lp_lon)) - par.phi0;
}
// INVERSE(s_inverse) spheroid
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
inline void inv(Parameters const& par, T const& xy_x, T const& xy_y,
T& lp_lon, T& lp_lat) const
{
T dd = xy_y + this->m_par.phi0;
T dd = xy_y + par.phi0;
lp_lat = asin(sin(dd) * cos(xy_x));
lp_lon = atan2(tan(xy_x), cos(dd));
}
@@ -182,14 +190,18 @@ namespace projections
};
// Cassini
template <typename Parameters, typename T>
inline void setup_cass(Parameters& par, par_cass<T>& proj_parm)
template <typename Params, typename Parameters, typename T>
inline void setup_cass(Params const& params, Parameters& par, par_cass<T>& proj_parm)
{
if (par.es) {
proj_parm.en = pj_enfn<T>(par.es);
proj_parm.m0 = pj_mlfn(par.phi0, sin(par.phi0), cos(par.phi0), proj_parm.en);
} else {
}
proj_parm.hyperbolic = false;
if (pj_param_exists<srs::spar::hyperbolic>(params, "hyperbolic", srs::dpar::hyperbolic))
proj_parm.hyperbolic = true;
}
}} // namespace detail::cass
@@ -212,10 +224,9 @@ namespace projections
struct cass_ellipsoid : public detail::cass::base_cass_ellipsoid<T, Parameters>
{
template <typename Params>
inline cass_ellipsoid(Params const& , Parameters const& par)
: detail::cass::base_cass_ellipsoid<T, Parameters>(par)
inline cass_ellipsoid(Params const& params, Parameters const& par)
{
detail::cass::setup_cass(this->m_par, this->m_proj_parm);
detail::cass::setup_cass(params, par, this->m_proj_parm);
}
};
@@ -236,10 +247,9 @@ namespace projections
struct cass_spheroid : public detail::cass::base_cass_spheroid<T, Parameters>
{
template <typename Params>
inline cass_spheroid(Params const& , Parameters const& par)
: detail::cass::base_cass_spheroid<T, Parameters>(par)
inline cass_spheroid(Params const& params, Parameters const& par)
{
detail::cass::setup_cass(this->m_par, this->m_proj_parm);
detail::cass::setup_cass(params, par, this->m_proj_parm);
}
};
@@ -248,7 +258,8 @@ namespace projections
{
// Static projection
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_cass, cass_spheroid, cass_ellipsoid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_FI2(srs::spar::proj_cass, cass_spheroid,
cass_ellipsoid)
// Factory entry(s)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI2(cass_entry, cass_spheroid, cass_ellipsoid)

View File

@@ -2,8 +2,8 @@
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2017, 2018.
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
// This file was modified by Oracle on 2017, 2018, 2019.
// Modifications copyright (c) 2017-2019, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
// Use, modification and distribution is subject to the Boost Software License,
@@ -57,19 +57,13 @@ namespace projections
{
static const double epsilon10 = 1.e-10;
// template class, using CRTP to implement forward/inverse
template <typename T, typename Parameters>
struct base_cc_spheroid
: public base_t_fi<base_cc_spheroid<T, Parameters>, T, Parameters>
{
inline base_cc_spheroid(const Parameters& par)
: base_t_fi<base_cc_spheroid<T, Parameters>, T, Parameters>(*this, par)
{}
// FORWARD(s_forward) spheroid
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
inline void fwd(Parameters const& , T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
{
static const T half_pi = detail::half_pi<T>();
@@ -82,7 +76,7 @@ namespace projections
// INVERSE(s_inverse) spheroid
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
inline void inv(Parameters const& , T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
{
lp_lat = atan(xy_y);
lp_lon = xy_x;
@@ -121,10 +115,9 @@ namespace projections
struct cc_spheroid : public detail::cc::base_cc_spheroid<T, Parameters>
{
template <typename Params>
inline cc_spheroid(Params const& , Parameters const& par)
: detail::cc::base_cc_spheroid<T, Parameters>(par)
inline cc_spheroid(Params const& , Parameters & par)
{
detail::cc::setup_cc(this->m_par);
detail::cc::setup_cc(par);
}
};
@@ -133,11 +126,11 @@ namespace projections
{
// Static projection
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_cc, cc_spheroid, cc_spheroid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_FI(srs::spar::proj_cc, cc_spheroid)
// Factory entry(s)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(cc_entry, cc_spheroid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(cc_init)
{
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(cc, cc_entry);

View File

@@ -2,8 +2,8 @@
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2017, 2018.
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
// This file was modified by Oracle on 2017, 2018, 2019.
// Modifications copyright (c) 2017-2019, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
// Use, modification and distribution is subject to the Boost Software License,
@@ -68,31 +68,25 @@ namespace projections
detail::apa<T> apa;
};
// template class, using CRTP to implement forward/inverse
template <typename T, typename Parameters>
struct base_cea_ellipsoid
: public base_t_fi<base_cea_ellipsoid<T, Parameters>, T, Parameters>
{
par_cea<T> m_proj_parm;
inline base_cea_ellipsoid(const Parameters& par)
: base_t_fi<base_cea_ellipsoid<T, Parameters>, T, Parameters>(*this, par)
{}
// FORWARD(e_forward) spheroid
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
inline void fwd(Parameters const& par, 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;
xy_x = par.k0 * lp_lon;
xy_y = .5 * pj_qsfn(sin(lp_lat), par.e, par.one_es) / par.k0;
}
// INVERSE(e_inverse) spheroid
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
inline void inv(Parameters const& par, 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;
lp_lat = pj_authlat(asin( 2. * xy_y * par.k0 / this->m_proj_parm.qp), this->m_proj_parm.apa);
lp_lon = xy_x / par.k0;
}
static inline std::string get_name()
@@ -102,39 +96,33 @@ namespace projections
};
// template class, using CRTP to implement forward/inverse
template <typename T, typename Parameters>
struct base_cea_spheroid
: public base_t_fi<base_cea_spheroid<T, Parameters>, T, Parameters>
{
par_cea<T> m_proj_parm;
inline base_cea_spheroid(const Parameters& par)
: base_t_fi<base_cea_spheroid<T, Parameters>, T, Parameters>(*this, par)
{}
// FORWARD(s_forward) spheroid
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
inline void fwd(Parameters const& par, 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;
xy_x = par.k0 * lp_lon;
xy_y = sin(lp_lat) / par.k0;
}
// INVERSE(s_inverse) spheroid
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
inline void inv(T const& xy_x, T xy_y, T& lp_lon, T& lp_lat) const
inline void inv(Parameters const& par, T const& xy_x, T xy_y, T& lp_lon, T& lp_lat) const
{
static const T half_pi = detail::half_pi<T>();
T t;
if ((t = fabs(xy_y *= this->m_par.k0)) - epsilon <= 1.) {
if ((t = fabs(xy_y *= par.k0)) - epsilon <= 1.) {
if (t >= 1.)
lp_lat = xy_y < 0. ? -half_pi : half_pi;
else
lp_lat = asin(xy_y);
lp_lon = xy_x / this->m_par.k0;
lp_lon = xy_x / par.k0;
} else
BOOST_THROW_EXCEPTION( projection_exception(error_tolerance_condition) );
}
@@ -164,7 +152,7 @@ namespace projections
par.e = sqrt(par.es);
proj_parm.apa = pj_authset<T>(par.es);
proj_parm.qp = pj_qsfn(1., par.e, par.one_es);
proj_parm.qp = pj_qsfn(T(1), par.e, par.one_es);
}
}
@@ -190,10 +178,9 @@ namespace projections
struct cea_ellipsoid : public detail::cea::base_cea_ellipsoid<T, Parameters>
{
template <typename Params>
inline cea_ellipsoid(Params const& params, Parameters const& par)
: detail::cea::base_cea_ellipsoid<T, Parameters>(par)
inline cea_ellipsoid(Params const& params, Parameters & par)
{
detail::cea::setup_cea(params, this->m_par, this->m_proj_parm);
detail::cea::setup_cea(params, par, this->m_proj_parm);
}
};
@@ -216,10 +203,9 @@ namespace projections
struct cea_spheroid : public detail::cea::base_cea_spheroid<T, Parameters>
{
template <typename Params>
inline cea_spheroid(Params const& params, Parameters const& par)
: detail::cea::base_cea_spheroid<T, Parameters>(par)
inline cea_spheroid(Params const& params, Parameters & par)
{
detail::cea::setup_cea(params, this->m_par, this->m_proj_parm);
detail::cea::setup_cea(params, par, this->m_proj_parm);
}
};
@@ -228,11 +214,11 @@ namespace projections
{
// Static projection
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_cea, cea_spheroid, cea_ellipsoid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_FI2(srs::spar::proj_cea, cea_spheroid, cea_ellipsoid)
// Factory entry(s)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI2(cea_entry, cea_spheroid, cea_ellipsoid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(cea_init)
{
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(cea, cea_entry);

View File

@@ -2,8 +2,8 @@
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2017, 2018.
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
// This file was modified by Oracle on 2017, 2018, 2019.
// Modifications copyright (c) 2017-2019, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
// Use, modification and distribution is subject to the Boost Software License,
@@ -112,20 +112,14 @@ namespace projections
return aacos(.5 * (b * b + c * c - a * a) / (b * c));
}
// template class, using CRTP to implement forward/inverse
template <typename T, typename Parameters>
struct base_chamb_spheroid
: public base_t_f<base_chamb_spheroid<T, Parameters>, T, Parameters>
{
par_chamb<T> m_proj_parm;
inline base_chamb_spheroid(const Parameters& par)
: base_t_f<base_chamb_spheroid<T, Parameters>, T, Parameters>(*this, par)
{}
// FORWARD(s_forward) spheroid
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
inline void fwd(Parameters const& , T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
{
static const T third = detail::third<T>();
@@ -263,10 +257,9 @@ namespace projections
struct chamb_spheroid : public detail::chamb::base_chamb_spheroid<T, Parameters>
{
template <typename Params>
inline chamb_spheroid(Params const& params, Parameters const& par)
: detail::chamb::base_chamb_spheroid<T, Parameters>(par)
inline chamb_spheroid(Params const& params, Parameters & par)
{
detail::chamb::setup_chamb(params, this->m_par, this->m_proj_parm);
detail::chamb::setup_chamb(params, par, this->m_proj_parm);
}
};
@@ -275,11 +268,11 @@ namespace projections
{
// Static projection
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_chamb, chamb_spheroid, chamb_spheroid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_F(srs::spar::proj_chamb, chamb_spheroid)
// Factory entry(s)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_F(chamb_entry, chamb_spheroid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(chamb_init)
{
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(chamb, chamb_entry);

View File

@@ -0,0 +1,166 @@
// Boost.Geometry - gis-projections (based on PROJ4)
// Copyright (c) 2022, Oracle and/or its affiliates.
// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle.
// Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// This file is converted from PROJ4, http://trac.osgeo.org/proj
// PROJ4 is originally written by Gerald Evenden (then of the USGS)
// PROJ4 is maintained by Frank Warmerdam
// PROJ4 is converted to Boost.Geometry by Barend Gehrels
// Last updated version of proj: 9.0.0
// Original copyright notice:
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
#ifndef BOOST_GEOMETRY_PROJECTIONS_COL_URBAN_HPP
#define BOOST_GEOMETRY_PROJECTIONS_COL_URBAN_HPP
#include <boost/geometry/util/math.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/pj_param.hpp>
#include <boost/geometry/srs/projections/impl/projects.hpp>
#include <boost/geometry/srs/projections/impl/factory_entry.hpp>
namespace boost { namespace geometry
{
namespace projections
{
#ifndef DOXYGEN_NO_DETAIL
namespace detail { namespace col_urban
{
template <typename T>
struct par_col_urban
{
T h0; // height of projection origin, divided by semi-major axis (a)
T rho0; // adimensional value, contrary to Guidance note 7.2
T A;
T B; // adimensional value, contrary to Guidance note 7.2
T C;
T D; // adimensional value, contrary to Guidance note 7.2
};
template <typename T, typename Parameters>
struct base_col_urban_spheroid
{
par_col_urban<T> m_proj_parm;
// FORWARD(s_forward) spheroid
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
inline void fwd(Parameters const& par, T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
{
const T cosphi = cos(lp_lat);
const T sinphi = sin(lp_lat);
const T nu = 1. / sqrt(1 - par.es * sinphi * sinphi);
const T lam_nu_cosphi = lp_lon * nu * cosphi;
xy_x = this->m_proj_parm.A * lam_nu_cosphi;
const T sinphi_m = sin(0.5 * (lp_lat + par.phi0));
const T rho_m = (1 - par.es) / pow(1 - par.es * sinphi_m * sinphi_m, 1.5);
const T G = 1 + this->m_proj_parm.h0 / rho_m;
xy_y = G * this->m_proj_parm.rho0 * ((lp_lat - par.phi0) + this->m_proj_parm.B * lam_nu_cosphi * lam_nu_cosphi);
}
// INVERSE(s_inverse) spheroid
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
inline void inv(Parameters const& par, T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
{
lp_lat = par.phi0 + xy_y / this->m_proj_parm.D - this->m_proj_parm.B * (xy_x / this->m_proj_parm.C) * (xy_x / this->m_proj_parm.C);
const double sinphi = sin(lp_lat);
const double nu = 1. / sqrt(1 - par.es * sinphi * sinphi);
lp_lon = xy_x / (this->m_proj_parm.C * nu * cos(lp_lat));
}
static inline std::string get_name()
{
return "col_urban_spheroid";
}
};
// Colombia Urban
template <typename Params, typename Parameters, typename T>
inline void setup(Params const& params, Parameters const& par, par_col_urban<T>& proj_parm)
{
T h0_unscaled;
if ( !pj_param_f<srs::spar::h_0>(params, "h_0", srs::dpar::h_0, h0_unscaled) ){
h0_unscaled = T(0);
}
proj_parm.h0 = h0_unscaled / par.a;
const T sinphi0 = sin(par.phi0);
const T nu0 = 1. / sqrt(1 - par.es * sinphi0 * sinphi0);
proj_parm.A = 1 + proj_parm.h0 / nu0;
proj_parm.rho0 = (1 - par.es) / pow(1 - par.es * sinphi0 * sinphi0, 1.5);
proj_parm.B = tan(par.phi0) / (2 * proj_parm.rho0 * nu0);
proj_parm.C = 1 + proj_parm.h0;
proj_parm.D = proj_parm.rho0 * (1 + proj_parm.h0 / (1 - par.es));
}
}} // namespace col_urban
#endif // doxygen
/*!
\brief Colombia Urban
\ingroup projections
\tparam Geographic latlong point type
\tparam Cartesian xy point type
\tparam Parameters parameter type
*/
template <typename T, typename Parameters>
struct col_urban_spheroid : public detail::col_urban::base_col_urban_spheroid<T, Parameters>
{
template <typename Params>
inline col_urban_spheroid(Params const& params, Parameters & par)
{
detail::col_urban::setup(params, par, this->m_proj_parm);
}
};
#ifndef DOXYGEN_NO_DETAIL
namespace detail
{
// Static projection
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_FI(srs::spar::proj_col_urban, col_urban_spheroid)
// Factory entry(s)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(col_urban_entry, col_urban_spheroid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(col_urban_init)
{
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(col_urban, col_urban_entry);
}
} // namespace detail
#endif // doxygen
} // namespace projections
}} // namespace boost::geometry
#endif // BOOST_GEOMETRY_PROJECTIONS_COL_URBAN_HPP

View File

@@ -2,8 +2,8 @@
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2017, 2018.
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
// This file was modified by Oracle on 2017, 2018, 2019.
// Modifications copyright (c) 2017-2019, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
// Use, modification and distribution is subject to the Boost Software License,
@@ -60,18 +60,12 @@ namespace projections
static const double FYC = 1.77245385090551602729;
static const double one_plus_eps = 1.0000001;
// template class, using CRTP to implement forward/inverse
template <typename T, typename Parameters>
struct base_collg_spheroid
: public base_t_fi<base_collg_spheroid<T, Parameters>, T, Parameters>
{
inline base_collg_spheroid(const Parameters& par)
: base_t_fi<base_collg_spheroid<T, Parameters>, T, Parameters>(*this, par)
{}
// FORWARD(s_forward) spheroid
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
inline void fwd(Parameters const& , 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.;
@@ -83,7 +77,7 @@ namespace projections
// INVERSE(s_inverse) spheroid
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
inline void inv(Parameters const& , T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
{
static T const half_pi = detail::half_pi<T>();
@@ -135,10 +129,9 @@ namespace projections
struct collg_spheroid : public detail::collg::base_collg_spheroid<T, Parameters>
{
template <typename Params>
inline collg_spheroid(Params const& , Parameters const& par)
: detail::collg::base_collg_spheroid<T, Parameters>(par)
inline collg_spheroid(Params const& , Parameters & par)
{
detail::collg::setup_collg(this->m_par);
detail::collg::setup_collg(par);
}
};
@@ -147,11 +140,11 @@ namespace projections
{
// Static projection
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_collg, collg_spheroid, collg_spheroid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_FI(srs::spar::proj_collg, collg_spheroid)
// Factory entry(s)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(collg_entry, collg_spheroid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(collg_init)
{
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(collg, collg_entry);

View File

@@ -2,8 +2,8 @@
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2017, 2018.
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
// This file was modified by Oracle on 2017, 2018, 2019.
// Modifications copyright (c) 2017-2019, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
// Use, modification and distribution is subject to the Boost Software License,
@@ -60,18 +60,12 @@ namespace projections
static const double RYM = 0.32573500793527994772;
//static const double third = 0.333333333333333333;
// template class, using CRTP to implement forward/inverse
template <typename T, typename Parameters>
struct base_crast_spheroid
: public base_t_fi<base_crast_spheroid<T, Parameters>, T, Parameters>
{
inline base_crast_spheroid(const Parameters& par)
: base_t_fi<base_crast_spheroid<T, Parameters>, T, Parameters>(*this, par)
{}
// FORWARD(s_forward) spheroid
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
inline void fwd(T const& lp_lon, T lp_lat, T& xy_x, T& xy_y) const
inline void fwd(Parameters const& , T const& lp_lon, T lp_lat, T& xy_x, T& xy_y) const
{
static const T third = detail::third<T>();
@@ -82,7 +76,7 @@ namespace projections
// INVERSE(s_inverse) spheroid
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
inline void inv(Parameters const& , T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
{
static const T third = detail::third<T>();
@@ -123,10 +117,9 @@ namespace projections
struct crast_spheroid : public detail::crast::base_crast_spheroid<T, Parameters>
{
template <typename Params>
inline crast_spheroid(Params const& , Parameters const& par)
: detail::crast::base_crast_spheroid<T, Parameters>(par)
inline crast_spheroid(Params const& , Parameters & par)
{
detail::crast::setup_crast(this->m_par);
detail::crast::setup_crast(par);
}
};
@@ -135,11 +128,11 @@ namespace projections
{
// Static projection
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_crast, crast_spheroid, crast_spheroid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_FI(srs::spar::proj_crast, crast_spheroid)
// Factory entry(s)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(crast_entry, crast_spheroid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(crast_init)
{
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(crast, crast_entry);

View File

@@ -2,8 +2,8 @@
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2017, 2018.
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
// This file was modified by Oracle on 2017, 2018, 2019.
// Modifications copyright (c) 2017-2019, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
// Use, modification and distribution is subject to the Boost Software License,
@@ -65,18 +65,12 @@ namespace projections
template <typename T>
inline T C3() { return 0.0016666666666666666666666666666; }
// template class, using CRTP to implement forward/inverse
template <typename T, typename Parameters>
struct base_denoy_spheroid
: public base_t_f<base_denoy_spheroid<T, Parameters>, T, Parameters>
{
inline base_denoy_spheroid(const Parameters& par)
: base_t_f<base_denoy_spheroid<T, Parameters>, T, Parameters>(*this, par)
{}
// FORWARD(s_forward) spheroid
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
inline void fwd(T lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
inline void fwd(Parameters const& , 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>();
@@ -122,10 +116,9 @@ namespace projections
struct denoy_spheroid : public detail::denoy::base_denoy_spheroid<T, Parameters>
{
template <typename Params>
inline denoy_spheroid(Params const& , Parameters const& par)
: detail::denoy::base_denoy_spheroid<T, Parameters>(par)
inline denoy_spheroid(Params const& , Parameters & par)
{
detail::denoy::setup_denoy(this->m_par);
detail::denoy::setup_denoy(par);
}
};
@@ -134,11 +127,11 @@ namespace projections
{
// Static projection
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_denoy, denoy_spheroid, denoy_spheroid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_F(srs::spar::proj_denoy, denoy_spheroid)
// Factory entry(s)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_F(denoy_entry, denoy_spheroid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(denoy_init)
{
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(denoy, denoy_entry);

View File

@@ -2,8 +2,8 @@
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2017, 2018.
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
// This file was modified by Oracle on 2017, 2018, 2019.
// Modifications copyright (c) 2017-2019, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
// Use, modification and distribution is subject to the Boost Software License,
@@ -57,18 +57,12 @@ namespace projections
static const double FC = .92131773192356127802;
static const double RP = .31830988618379067154;
// template class, using CRTP to implement forward/inverse
template <typename T, typename Parameters>
struct base_eck1_spheroid
: public base_t_fi<base_eck1_spheroid<T, Parameters>, T, Parameters>
{
inline base_eck1_spheroid(const Parameters& par)
: base_t_fi<base_eck1_spheroid<T, Parameters>, T, Parameters>(*this, par)
{}
// FORWARD(s_forward) spheroid
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
inline void fwd(Parameters const& , 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;
@@ -76,7 +70,7 @@ namespace projections
// INVERSE(s_inverse) spheroid
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
inline void inv(Parameters const& , 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)));
@@ -115,10 +109,9 @@ namespace projections
struct eck1_spheroid : public detail::eck1::base_eck1_spheroid<T, Parameters>
{
template <typename Params>
inline eck1_spheroid(Params const& , Parameters const& par)
: detail::eck1::base_eck1_spheroid<T, Parameters>(par)
inline eck1_spheroid(Params const& , Parameters & par)
{
detail::eck1::setup_eck1(this->m_par);
detail::eck1::setup_eck1(par);
}
};
@@ -127,11 +120,11 @@ namespace projections
{
// Static projection
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_eck1, eck1_spheroid, eck1_spheroid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_FI(srs::spar::proj_eck1, eck1_spheroid)
// Factory entry(s)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(eck1_entry, eck1_spheroid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(eck1_init)
{
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(eck1, eck1_entry);

View File

@@ -2,8 +2,8 @@
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2017, 2018.
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
// This file was modified by Oracle on 2017, 2018, 2019.
// Modifications copyright (c) 2017-2019, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
// Use, modification and distribution is subject to the Boost Software License,
@@ -61,18 +61,12 @@ namespace projections
//static const double C13 = 0.33333333333333333333;
static const double one_plus_eps = 1.0000001;
// template class, using CRTP to implement forward/inverse
template <typename T, typename Parameters>
struct base_eck2_spheroid
: public base_t_fi<base_eck2_spheroid<T, Parameters>, T, Parameters>
{
inline base_eck2_spheroid(const Parameters& par)
: base_t_fi<base_eck2_spheroid<T, Parameters>, T, Parameters>(*this, par)
{}
// FORWARD(s_forward) spheroid
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
inline void fwd(Parameters const& , 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);
@@ -81,7 +75,7 @@ namespace projections
// INVERSE(s_inverse) spheroid
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
inline void inv(Parameters const& , 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>();
@@ -132,10 +126,9 @@ namespace projections
struct eck2_spheroid : public detail::eck2::base_eck2_spheroid<T, Parameters>
{
template <typename Params>
inline eck2_spheroid(Params const& , Parameters const& par)
: detail::eck2::base_eck2_spheroid<T, Parameters>(par)
inline eck2_spheroid(Params const& , Parameters & par)
{
detail::eck2::setup_eck2(this->m_par);
detail::eck2::setup_eck2(par);
}
};
@@ -144,11 +137,11 @@ namespace projections
{
// Static projection
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_eck2, eck2_spheroid, eck2_spheroid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_FI(srs::spar::proj_eck2, eck2_spheroid)
// Factory entry(s)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(eck2_entry, eck2_spheroid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(eck2_init)
{
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(eck2, eck2_entry);

View File

@@ -2,8 +2,8 @@
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2017, 2018.
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
// This file was modified by Oracle on 2017, 2018, 2019.
// Modifications copyright (c) 2017-2019, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
// Use, modification and distribution is subject to the Boost Software License,
@@ -63,20 +63,14 @@ namespace projections
T C_x, C_y, A, B;
};
// template class, using CRTP to implement forward/inverse
template <typename T, typename Parameters>
struct base_eck3_spheroid
: public base_t_fi<base_eck3_spheroid<T, Parameters>, T, Parameters>
{
par_eck3<T> m_proj_parm;
inline base_eck3_spheroid(const Parameters& par)
: base_t_fi<base_eck3_spheroid<T, Parameters>, T, Parameters>(*this, par)
{}
// FORWARD(s_forward) spheroid
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
inline void fwd(Parameters const& , 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));
@@ -84,7 +78,7 @@ namespace projections
// INVERSE(s_inverse) spheroid
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
inline void inv(Parameters const& , 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;
@@ -179,10 +173,9 @@ namespace projections
struct eck3_spheroid : public detail::eck3::base_eck3_spheroid<T, Parameters>
{
template <typename Params>
inline eck3_spheroid(Params const& , Parameters const& par)
: detail::eck3::base_eck3_spheroid<T, Parameters>(par)
inline eck3_spheroid(Params const& , Parameters & par)
{
detail::eck3::setup_eck3(this->m_par, this->m_proj_parm);
detail::eck3::setup_eck3(par, this->m_proj_parm);
}
};
@@ -202,10 +195,9 @@ namespace projections
struct putp1_spheroid : public detail::eck3::base_eck3_spheroid<T, Parameters>
{
template <typename Params>
inline putp1_spheroid(Params const& , Parameters const& par)
: detail::eck3::base_eck3_spheroid<T, Parameters>(par)
inline putp1_spheroid(Params const& , Parameters & par)
{
detail::eck3::setup_putp1(this->m_par, this->m_proj_parm);
detail::eck3::setup_putp1(par, this->m_proj_parm);
}
};
@@ -225,10 +217,9 @@ namespace projections
struct wag6_spheroid : public detail::eck3::base_eck3_spheroid<T, Parameters>
{
template <typename Params>
inline wag6_spheroid(Params const& , Parameters const& par)
: detail::eck3::base_eck3_spheroid<T, Parameters>(par)
inline wag6_spheroid(Params const& , Parameters & par)
{
detail::eck3::setup_wag6(this->m_par, this->m_proj_parm);
detail::eck3::setup_wag6(par, this->m_proj_parm);
}
};
@@ -248,10 +239,9 @@ namespace projections
struct kav7_spheroid : public detail::eck3::base_eck3_spheroid<T, Parameters>
{
template <typename Params>
inline kav7_spheroid(Params const& , Parameters const& par)
: detail::eck3::base_eck3_spheroid<T, Parameters>(par)
inline kav7_spheroid(Params const& , Parameters & par)
{
detail::eck3::setup_kav7(this->m_par, this->m_proj_parm);
detail::eck3::setup_kav7(par, this->m_proj_parm);
}
};
@@ -260,17 +250,17 @@ namespace projections
{
// Static projection
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)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_FI(srs::spar::proj_eck3, eck3_spheroid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_FI(srs::spar::proj_putp1, putp1_spheroid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_FI(srs::spar::proj_wag6, wag6_spheroid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_FI(srs::spar::proj_kav7, kav7_spheroid)
// Factory entry(s)
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)
{
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(eck3, eck3_entry);

View File

@@ -2,8 +2,8 @@
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2017, 2018.
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
// This file was modified by Oracle on 2017, 2018, 2019.
// Modifications copyright (c) 2017-2019, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
// Use, modification and distribution is subject to the Boost Software License,
@@ -63,18 +63,12 @@ namespace projections
static const double epsilon = 1e-7;
static const int n_iter = 6;
// template class, using CRTP to implement forward/inverse
template <typename T, typename Parameters>
struct base_eck4_spheroid
: public base_t_fi<base_eck4_spheroid<T, Parameters>, T, Parameters>
{
inline base_eck4_spheroid(const Parameters& par)
: base_t_fi<base_eck4_spheroid<T, Parameters>, T, Parameters>(*this, par)
{}
// FORWARD(s_forward) spheroid
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
inline void fwd(T const& lp_lon, T lp_lat, T& xy_x, T& xy_y) const
inline void fwd(Parameters const& , T const& lp_lon, T lp_lat, T& xy_x, T& xy_y) const
{
T p, V, s, c;
int i;
@@ -101,7 +95,7 @@ namespace projections
// INVERSE(s_inverse) spheroid
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
inline void inv(Parameters const& , T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
{
T c;
@@ -143,10 +137,9 @@ namespace projections
struct eck4_spheroid : public detail::eck4::base_eck4_spheroid<T, Parameters>
{
template <typename Params>
inline eck4_spheroid(Params const& , Parameters const& par)
: detail::eck4::base_eck4_spheroid<T, Parameters>(par)
inline eck4_spheroid(Params const& , Parameters & par)
{
detail::eck4::setup_eck4(this->m_par);
detail::eck4::setup_eck4(par);
}
};
@@ -155,11 +148,11 @@ namespace projections
{
// Static projection
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_eck4, eck4_spheroid, eck4_spheroid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_FI(srs::spar::proj_eck4, eck4_spheroid)
// Factory entry(s)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(eck4_entry, eck4_spheroid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(eck4_init)
{
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(eck4, eck4_entry);

View File

@@ -2,8 +2,8 @@
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2017, 2018.
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
// This file was modified by Oracle on 2017, 2018, 2019.
// Modifications copyright (c) 2017-2019, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
// Use, modification and distribution is subject to the Boost Software License,
@@ -59,18 +59,12 @@ namespace projections
static const double YF = 0.88202554344910296438;
static const double RYF = 1.13375401361911319568;
// template class, using CRTP to implement forward/inverse
template <typename T, typename Parameters>
struct base_eck5_spheroid
: public base_t_fi<base_eck5_spheroid<T, Parameters>, T, Parameters>
{
inline base_eck5_spheroid(const Parameters& par)
: base_t_fi<base_eck5_spheroid<T, Parameters>, T, Parameters>(*this, par)
{}
// FORWARD(s_forward) spheroid
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
inline void fwd(Parameters const& , 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;
@@ -78,7 +72,7 @@ namespace projections
// INVERSE(s_inverse) spheroid
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
inline void inv(Parameters const& , 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));
}
@@ -116,10 +110,9 @@ namespace projections
struct eck5_spheroid : public detail::eck5::base_eck5_spheroid<T, Parameters>
{
template <typename Params>
inline eck5_spheroid(Params const& , Parameters const& par)
: detail::eck5::base_eck5_spheroid<T, Parameters>(par)
inline eck5_spheroid(Params const& , Parameters & par)
{
detail::eck5::setup_eck5(this->m_par);
detail::eck5::setup_eck5(par);
}
};
@@ -128,11 +121,11 @@ namespace projections
{
// Static projection
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_eck5, eck5_spheroid, eck5_spheroid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_FI(srs::spar::proj_eck5, eck5_spheroid)
// Factory entry(s)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(eck5_entry, eck5_spheroid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(eck5_init)
{
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(eck5, eck5_entry);

View File

@@ -2,8 +2,8 @@
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2017, 2018.
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
// This file was modified by Oracle on 2017, 2018, 2019.
// Modifications copyright (c) 2017-2019, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
// Use, modification and distribution is subject to the Boost Software License,
@@ -60,31 +60,25 @@ namespace projections
T rc;
};
// template class, using CRTP to implement forward/inverse
template <typename T, typename Parameters>
struct base_eqc_spheroid
: public base_t_fi<base_eqc_spheroid<T, Parameters>, T, Parameters>
{
par_eqc<T> m_proj_parm;
inline base_eqc_spheroid(const Parameters& par)
: base_t_fi<base_eqc_spheroid<T, Parameters>, T, Parameters>(*this, par)
{}
// FORWARD(s_forward) spheroid
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
inline void fwd(Parameters const& par, 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;
xy_y = lp_lat - par.phi0;
}
// INVERSE(s_inverse) spheroid
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
inline void inv(Parameters const& par, 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;
lp_lat = xy_y + par.phi0;
}
static inline std::string get_name()
@@ -126,10 +120,9 @@ namespace projections
struct eqc_spheroid : public detail::eqc::base_eqc_spheroid<T, Parameters>
{
template <typename Params>
inline eqc_spheroid(Params const& params, Parameters const& par)
: detail::eqc::base_eqc_spheroid<T, Parameters>(par)
inline eqc_spheroid(Params const& params, Parameters & par)
{
detail::eqc::setup_eqc(params, this->m_par, this->m_proj_parm);
detail::eqc::setup_eqc(params, par, this->m_proj_parm);
}
};
@@ -138,11 +131,11 @@ namespace projections
{
// Static projection
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_eqc, eqc_spheroid, eqc_spheroid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_FI(srs::spar::proj_eqc, eqc_spheroid)
// Factory entry(s)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(eqc_entry, eqc_spheroid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(eqc_init)
{
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(eqc, eqc_entry);

View File

@@ -2,8 +2,8 @@
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2017, 2018.
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
// This file was modified by Oracle on 2017, 2018, 2019.
// Modifications copyright (c) 2017-2019, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
// Use, modification and distribution is subject to the Boost Software License,
@@ -75,20 +75,14 @@ namespace projections
bool ellips;
};
// template class, using CRTP to implement forward/inverse
template <typename T, typename Parameters>
struct base_eqdc_ellipsoid
: public base_t_fi<base_eqdc_ellipsoid<T, Parameters>, T, Parameters>
{
par_eqdc<T> m_proj_parm;
inline base_eqdc_ellipsoid(const Parameters& par)
: base_t_fi<base_eqdc_ellipsoid<T, Parameters>, T, Parameters>(*this, par)
{}
// FORWARD(e_forward) sphere & ellipsoid
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
inline void fwd(T lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
inline void fwd(Parameters const& , T lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
{
T rho = 0.0;
@@ -100,7 +94,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(Parameters const& par, T xy_x, T xy_y, T& lp_lon, T& lp_lat) const
{
static T const half_pi = detail::half_pi<T>();
@@ -114,7 +108,7 @@ namespace projections
}
lp_lat = this->m_proj_parm.c - rho;
if (this->m_proj_parm.ellips)
lp_lat = pj_inv_mlfn(lp_lat, this->m_par.es, this->m_proj_parm.en);
lp_lat = pj_inv_mlfn(lp_lat, par.es, this->m_proj_parm.en);
lp_lon = atan2(xy_x, xy_y) / this->m_proj_parm.n;
} else {
lp_lon = 0.;
@@ -193,9 +187,8 @@ namespace projections
{
template <typename Params>
inline eqdc_ellipsoid(Params const& params, Parameters const& par)
: detail::eqdc::base_eqdc_ellipsoid<T, Parameters>(par)
{
detail::eqdc::setup_eqdc(params, this->m_par, this->m_proj_parm);
detail::eqdc::setup_eqdc(params, par, this->m_proj_parm);
}
};
@@ -204,11 +197,11 @@ namespace projections
{
// Static projection
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_eqdc, eqdc_ellipsoid, eqdc_ellipsoid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_FI(srs::spar::proj_eqdc, eqdc_ellipsoid)
// Factory entry(s)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(eqdc_entry, eqdc_ellipsoid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(eqdc_init)
{
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(eqdc, eqdc_entry);

View File

@@ -2,8 +2,8 @@
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2017, 2018.
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
// This file was modified by Oracle on 2017, 2018, 2019.
// Modifications copyright (c) 2017-2019, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
// Use, modification and distribution is subject to the Boost Software License,
@@ -163,20 +163,14 @@ namespace projections
return(sin(arg_r)*hr);
}
// template class, using CRTP to implement forward/inverse
template <typename T, typename Parameters>
struct base_etmerc_ellipsoid
: public base_t_fi<base_etmerc_ellipsoid<T, Parameters>, T, Parameters>
{
par_etmerc<T> m_proj_parm;
inline base_etmerc_ellipsoid(const Parameters& par)
: base_t_fi<base_etmerc_ellipsoid<T, Parameters>, T, Parameters>(*this, par)
{}
// FORWARD(e_forward) ellipsoid
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
inline void fwd(Parameters const& , 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;
@@ -205,7 +199,7 @@ namespace projections
// INVERSE(e_inverse) ellipsoid
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
inline void inv(Parameters const& , 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;
@@ -391,10 +385,9 @@ namespace projections
struct etmerc_ellipsoid : public detail::etmerc::base_etmerc_ellipsoid<T, Parameters>
{
template <typename Params>
inline etmerc_ellipsoid(Params const& , Parameters const& par)
: detail::etmerc::base_etmerc_ellipsoid<T, Parameters>(par)
inline etmerc_ellipsoid(Params const& , Parameters & par)
{
detail::etmerc::setup_etmerc(this->m_par, this->m_proj_parm);
detail::etmerc::setup_etmerc(par, this->m_proj_parm);
}
};
@@ -417,10 +410,9 @@ namespace projections
struct utm_ellipsoid : public detail::etmerc::base_etmerc_ellipsoid<T, Parameters>
{
template <typename Params>
inline utm_ellipsoid(Params const& params, Parameters const& par)
: detail::etmerc::base_etmerc_ellipsoid<T, Parameters>(par)
inline utm_ellipsoid(Params const& params, Parameters & par)
{
detail::etmerc::setup_utm(params, this->m_par, this->m_proj_parm);
detail::etmerc::setup_utm(params, par, this->m_proj_parm);
}
};
@@ -429,13 +421,13 @@ namespace projections
{
// Static projection
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)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_FI(srs::spar::proj_etmerc, etmerc_ellipsoid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_FI(srs::spar::proj_utm, utm_ellipsoid)
// Factory entry(s)
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)
{
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(etmerc, etmerc_entry);

View File

@@ -2,8 +2,8 @@
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2017, 2018.
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
// This file was modified by Oracle on 2017, 2018, 2019.
// Modifications copyright (c) 2017-2019, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
// Use, modification and distribution is subject to the Boost Software License,
@@ -57,18 +57,12 @@ namespace projections
static const double tolerance = 1e-6;
// template class, using CRTP to implement forward/inverse
template <typename T, typename Parameters>
struct base_fahey_spheroid
: public base_t_fi<base_fahey_spheroid<T, Parameters>, T, Parameters>
{
inline base_fahey_spheroid(const Parameters& par)
: base_t_fi<base_fahey_spheroid<T, Parameters>, T, Parameters>(*this, par)
{}
// FORWARD(s_forward) spheroid
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
inline void fwd(Parameters const& , 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;
@@ -77,7 +71,7 @@ namespace projections
// INVERSE(s_inverse) spheroid
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
inline void inv(T const& xy_x, T xy_y, T& lp_lon, T& lp_lat) const
inline void inv(Parameters const& , T const& xy_x, T xy_y, T& lp_lon, T& lp_lat) const
{
xy_y /= 1.819152;
lp_lat = 2. * atan(xy_y);
@@ -118,10 +112,9 @@ namespace projections
struct fahey_spheroid : public detail::fahey::base_fahey_spheroid<T, Parameters>
{
template <typename Params>
inline fahey_spheroid(Params const& , Parameters const& par)
: detail::fahey::base_fahey_spheroid<T, Parameters>(par)
inline fahey_spheroid(Params const& , Parameters & par)
{
detail::fahey::setup_fahey(this->m_par);
detail::fahey::setup_fahey(par);
}
};
@@ -130,11 +123,11 @@ namespace projections
{
// Static projection
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_fahey, fahey_spheroid, fahey_spheroid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_FI(srs::spar::proj_fahey, fahey_spheroid)
// Factory entry(s)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(fahey_entry, fahey_spheroid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(fahey_init)
{
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(fahey, fahey_entry);

View File

@@ -2,8 +2,8 @@
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2017, 2018.
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
// This file was modified by Oracle on 2017, 2018, 2019.
// Modifications copyright (c) 2017-2019, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
// Use, modification and distribution is subject to the Boost Software License,
@@ -67,20 +67,14 @@ namespace projections
T n, n1;
};
// template class, using CRTP to implement forward/inverse
template <typename T, typename Parameters>
struct base_fouc_s_spheroid
: public base_t_fi<base_fouc_s_spheroid<T, Parameters>, T, Parameters>
{
par_fouc_s<T> m_proj_parm;
inline base_fouc_s_spheroid(const Parameters& par)
: base_t_fi<base_fouc_s_spheroid<T, Parameters>, T, Parameters>(*this, par)
{}
// FORWARD(s_forward) spheroid
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
inline void fwd(Parameters const& , T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
{
T t;
@@ -91,7 +85,7 @@ namespace projections
// INVERSE(s_inverse) spheroid
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
inline void inv(Parameters const& , T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
{
static T const half_pi = detail::half_pi<T>();
@@ -154,10 +148,9 @@ namespace projections
struct fouc_s_spheroid : public detail::fouc_s::base_fouc_s_spheroid<T, Parameters>
{
template <typename Params>
inline fouc_s_spheroid(Params const& params, Parameters const& par)
: detail::fouc_s::base_fouc_s_spheroid<T, Parameters>(par)
inline fouc_s_spheroid(Params const& params, Parameters & par)
{
detail::fouc_s::setup_fouc_s(params, this->m_par, this->m_proj_parm);
detail::fouc_s::setup_fouc_s(params, par, this->m_proj_parm);
}
};
@@ -166,11 +159,11 @@ namespace projections
{
// Static projection
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_fouc_s, fouc_s_spheroid, fouc_s_spheroid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_FI(srs::spar::proj_fouc_s, fouc_s_spheroid)
// Factory entry(s)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(fouc_s_entry, fouc_s_spheroid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(fouc_s_init)
{
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(fouc_s, fouc_s_entry);

View File

@@ -2,8 +2,8 @@
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2017, 2018.
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
// This file was modified by Oracle on 2017, 2018, 2019.
// Modifications copyright (c) 2017-2019, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
// Use, modification and distribution is subject to the Boost Software License,
@@ -59,18 +59,12 @@ namespace projections
static const double RYF = 0.58578643762690495119;
static const double RXF = 1.41421356237309504880;
// template class, using CRTP to implement forward/inverse
template <typename T, typename Parameters>
struct base_gall_spheroid
: public base_t_fi<base_gall_spheroid<T, Parameters>, T, Parameters>
{
inline base_gall_spheroid(const Parameters& par)
: base_t_fi<base_gall_spheroid<T, Parameters>, T, Parameters>(*this, par)
{}
// FORWARD(s_forward) spheroid
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
inline void fwd(Parameters const& , 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);
@@ -78,7 +72,7 @@ namespace projections
// INVERSE(s_inverse) spheroid
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
inline void inv(Parameters const& , 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);
@@ -117,10 +111,9 @@ namespace projections
struct gall_spheroid : public detail::gall::base_gall_spheroid<T, Parameters>
{
template <typename Params>
inline gall_spheroid(Params const& , Parameters const& par)
: detail::gall::base_gall_spheroid<T, Parameters>(par)
inline gall_spheroid(Params const& , Parameters & par)
{
detail::gall::setup_gall(this->m_par);
detail::gall::setup_gall(par);
}
};
@@ -129,11 +122,11 @@ namespace projections
{
// Static projection
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_gall, gall_spheroid, gall_spheroid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_FI(srs::spar::proj_gall, gall_spheroid)
// Factory entry(s)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(gall_entry, gall_spheroid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(gall_init)
{
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(gall, gall_entry);

View File

@@ -2,8 +2,8 @@
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2017, 2018.
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
// This file was modified by Oracle on 2017, 2018, 2019.
// Modifications copyright (c) 2017-2019, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
// Use, modification and distribution is subject to the Boost Software License,
@@ -60,18 +60,12 @@ namespace projections
namespace detail { namespace geocent
{
// template class, using CRTP to implement forward/inverse
template <typename T, typename Parameters>
struct base_geocent_other
: public base_t_fi<base_geocent_other<T, Parameters>, T, Parameters>
{
inline base_geocent_other(const Parameters& par)
: base_t_fi<base_geocent_other<T, Parameters>, T, Parameters>(*this, par)
{}
// FORWARD(forward)
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
inline void fwd(Parameters const& , T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
{
xy_x = lp_lon;
xy_y = lp_lat;
@@ -79,7 +73,7 @@ namespace projections
// INVERSE(inverse)
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
inline void inv(Parameters const& , T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
{
lp_lat = xy_y;
lp_lon = xy_x;
@@ -96,7 +90,7 @@ namespace projections
template <typename Parameters>
inline void setup_geocent(Parameters& par)
{
par.is_geocent = 1;
par.is_geocent = true;
par.x0 = 0.0;
par.y0 = 0.0;
}
@@ -117,10 +111,9 @@ namespace projections
struct geocent_other : public detail::geocent::base_geocent_other<T, Parameters>
{
template <typename Params>
inline geocent_other(Params const& , Parameters const& par)
: detail::geocent::base_geocent_other<T, Parameters>(par)
inline geocent_other(Params const& , Parameters & par)
{
detail::geocent::setup_geocent(this->m_par);
detail::geocent::setup_geocent(par);
}
};
@@ -129,11 +122,11 @@ namespace projections
{
// Static projection
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_geocent, geocent_other, geocent_other)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_FI(srs::spar::proj_geocent, geocent_other)
// Factory entry(s)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(geocent_entry, geocent_other)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(geocent_init)
{
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(geocent, geocent_entry);

View File

@@ -2,8 +2,8 @@
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2017, 2018.
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
// This file was modified by Oracle on 2017, 2018, 2019.
// Modifications copyright (c) 2017-2019, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
// Use, modification and distribution is subject to the Boost Software License,
@@ -75,26 +75,20 @@ namespace projections
bool flip_axis;
};
// template class, using CRTP to implement forward/inverse
template <typename T, typename Parameters>
struct base_geos_ellipsoid
: public base_t_fi<base_geos_ellipsoid<T, Parameters>, T, Parameters>
{
par_geos<T> m_proj_parm;
inline base_geos_ellipsoid(const Parameters& par)
: base_t_fi<base_geos_ellipsoid<T, Parameters>, T, Parameters>(*this, par)
{}
// FORWARD(e_forward) ellipsoid
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
inline void fwd(T const& lp_lon, T lp_lat, T& xy_x, T& xy_y) const
inline void fwd(Parameters const& , T const& lp_lon, T lp_lat, T& xy_x, T& xy_y) const
{
T r, Vx, Vy, Vz, tmp;
/* Calculation of geocentric latitude. */
lp_lat = atan (this->m_proj_parm.radius_p2 * tan (lp_lat));
/* Calculation of the three components of the vector from satellite to
** position on earth surface (lon,lat).*/
r = (this->m_proj_parm.radius_p) / boost::math::hypot(this->m_proj_parm.radius_p * cos (lp_lat), sin (lp_lat));
@@ -121,13 +115,13 @@ namespace projections
// INVERSE(e_inverse) ellipsoid
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
inline void inv(Parameters const& , T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
{
T Vx, Vy, Vz, a, b, det, k;
/* Setting three components of vector from satellite to position.*/
Vx = -1.0;
if(this->m_proj_parm.flip_axis) {
Vz = tan (xy_y / this->m_proj_parm.radius_g_1);
Vy = tan (xy_x / this->m_proj_parm.radius_g_1) * boost::math::hypot(1.0, Vz);
@@ -163,20 +157,14 @@ namespace projections
};
// template class, using CRTP to implement forward/inverse
template <typename T, typename Parameters>
struct base_geos_spheroid
: public base_t_fi<base_geos_spheroid<T, Parameters>, T, Parameters>
{
par_geos<T> m_proj_parm;
inline base_geos_spheroid(const Parameters& par)
: base_t_fi<base_geos_spheroid<T, Parameters>, T, Parameters>(*this, par)
{}
// FORWARD(s_forward) spheroid
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
inline void fwd(Parameters const& , T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
{
T Vx, Vy, Vz, tmp;
@@ -206,7 +194,7 @@ namespace projections
// INVERSE(s_inverse) spheroid
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
inline void inv(Parameters const& , T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
{
T Vx, Vy, Vz, a, b, det, k;
@@ -219,7 +207,7 @@ namespace projections
Vy = tan (xy_x / (this->m_proj_parm.radius_g - 1.0));
Vz = tan (xy_y / (this->m_proj_parm.radius_g - 1.0)) * sqrt (1.0 + Vy * Vy);
}
/* Calculation of terms in cubic equation and determinant.*/
a = Vy * Vy + Vz * Vz + Vx * Vx;
b = 2 * this->m_proj_parm.radius_g * Vx;
@@ -286,7 +274,7 @@ namespace projections
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;
@@ -325,9 +313,8 @@ namespace projections
{
template <typename Params>
inline geos_ellipsoid(Params const& params, Parameters const& par)
: detail::geos::base_geos_ellipsoid<T, Parameters>(par)
{
detail::geos::setup_geos(params, this->m_par, this->m_proj_parm);
detail::geos::setup_geos(params, par, this->m_proj_parm);
}
};
@@ -352,9 +339,8 @@ namespace projections
{
template <typename Params>
inline geos_spheroid(Params const& params, Parameters const& par)
: detail::geos::base_geos_spheroid<T, Parameters>(par)
{
detail::geos::setup_geos(params, this->m_par, this->m_proj_parm);
detail::geos::setup_geos(params, par, this->m_proj_parm);
}
};
@@ -363,11 +349,11 @@ namespace projections
{
// Static projection
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_geos, geos_spheroid, geos_ellipsoid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_FI2(srs::spar::proj_geos, geos_spheroid, geos_ellipsoid)
// Factory entry(s)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI2(geos_entry, geos_spheroid, geos_ellipsoid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(geos_init)
{
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(geos, geos_entry);

View File

@@ -2,8 +2,8 @@
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2017, 2018.
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
// This file was modified by Oracle on 2017, 2018, 2019.
// Modifications copyright (c) 2017-2019, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
// Use, modification and distribution is subject to the Boost Software License,
@@ -61,18 +61,12 @@ namespace projections
template <typename T>
inline T C12() { return 0.083333333333333333333333333333333333; }
// template class, using CRTP to implement forward/inverse
template <typename T, typename Parameters>
struct base_gins8_spheroid
: public base_t_f<base_gins8_spheroid<T, Parameters>, T, Parameters>
{
inline base_gins8_spheroid(const Parameters& par)
: base_t_f<base_gins8_spheroid<T, Parameters>, T, Parameters>(*this, par)
{}
// FORWARD(s_forward) spheroid
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
inline void fwd(Parameters const& , T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
{
static const T C12 = gins8::C12<T>();
@@ -118,10 +112,9 @@ namespace projections
struct gins8_spheroid : public detail::gins8::base_gins8_spheroid<T, Parameters>
{
template <typename Params>
inline gins8_spheroid(Params const& , Parameters const& par)
: detail::gins8::base_gins8_spheroid<T, Parameters>(par)
inline gins8_spheroid(Params const& , Parameters & par)
{
detail::gins8::setup_gins8(this->m_par);
detail::gins8::setup_gins8(par);
}
};
@@ -130,11 +123,11 @@ namespace projections
{
// Static projection
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_gins8, gins8_spheroid, gins8_spheroid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_F(srs::spar::proj_gins8, gins8_spheroid)
// Factory entry(s)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_F(gins8_entry, gins8_spheroid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(gins8_init)
{
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(gins8, gins8_entry);

View File

@@ -2,8 +2,8 @@
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2017, 2018.
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
// This file was modified by Oracle on 2017, 2018, 2019.
// Modifications copyright (c) 2017-2019, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
// Use, modification and distribution is subject to the Boost Software License,
@@ -64,46 +64,45 @@ namespace projections
static const double loop_tol = 1e-7;
template <typename T>
struct par_gn_sinu
struct par_gn_sinu_e
{
detail::en<T> en;
T m, n, C_x, C_y;
};
template <typename T>
struct par_gn_sinu_s
{
T m, n, C_x, C_y;
};
/* Ellipsoidal Sinusoidal only */
// template class, using CRTP to implement forward/inverse
template <typename T, typename Parameters>
struct base_gn_sinu_ellipsoid
: public base_t_fi<base_gn_sinu_ellipsoid<T, Parameters>, T, Parameters>
{
par_gn_sinu<T> m_proj_parm;
inline base_gn_sinu_ellipsoid(const Parameters& par)
: base_t_fi<base_gn_sinu_ellipsoid<T, Parameters>, T, Parameters>(*this, par)
{}
par_gn_sinu_e<T> m_proj_parm;
// FORWARD(e_forward) ellipsoid
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
inline void fwd(Parameters const& par, T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
{
T s, c;
xy_y = pj_mlfn(lp_lat, s = sin(lp_lat), c = cos(lp_lat), this->m_proj_parm.en);
xy_x = lp_lon * c / sqrt(1. - this->m_par.es * s * s);
xy_x = lp_lon * c / sqrt(1. - par.es * s * s);
}
// INVERSE(e_inverse) ellipsoid
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
inline void inv(Parameters const& par, T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
{
static const T half_pi = detail::half_pi<T>();
T s;
if ((s = fabs(lp_lat = pj_inv_mlfn(xy_y, this->m_par.es, this->m_proj_parm.en))) < half_pi) {
if ((s = fabs(lp_lat = pj_inv_mlfn(xy_y, par.es, this->m_proj_parm.en))) < half_pi) {
s = sin(lp_lat);
lp_lon = xy_x * sqrt(1. - this->m_par.es * s * s) / cos(lp_lat);
lp_lon = xy_x * sqrt(1. - par.es * s * s) / cos(lp_lat);
} else if ((s - epsilon10) < half_pi)
lp_lon = 0.;
else
@@ -118,20 +117,14 @@ namespace projections
};
// template class, using CRTP to implement forward/inverse
template <typename T, typename Parameters>
struct base_gn_sinu_spheroid
: public base_t_fi<base_gn_sinu_spheroid<T, Parameters>, T, Parameters>
{
par_gn_sinu<T> m_proj_parm;
inline base_gn_sinu_spheroid(const Parameters& par)
: base_t_fi<base_gn_sinu_spheroid<T, Parameters>, T, Parameters>(*this, par)
{}
par_gn_sinu_s<T> m_proj_parm;
// FORWARD(s_forward) sphere
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
inline void fwd(T const& lp_lon, T lp_lat, T& xy_x, T& xy_y) const
inline void fwd(Parameters const& , 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;
@@ -156,7 +149,7 @@ namespace projections
// INVERSE(s_inverse) sphere
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
inline void inv(T const& xy_x, T xy_y, T& lp_lon, T& lp_lat) const
inline void inv(Parameters const& , 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) :
@@ -172,7 +165,7 @@ namespace projections
};
template <typename Parameters, typename T>
inline void setup(Parameters& par, par_gn_sinu<T>& proj_parm)
inline void setup(Parameters& par, par_gn_sinu_s<T>& proj_parm)
{
par.es = 0;
@@ -182,7 +175,7 @@ namespace projections
// General Sinusoidal Series
template <typename Params, typename Parameters, typename T>
inline void setup_gn_sinu(Params const& params, Parameters& par, par_gn_sinu<T>& proj_parm)
inline void setup_gn_sinu(Params const& params, Parameters& par, par_gn_sinu_s<T>& proj_parm)
{
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)) {
@@ -196,22 +189,23 @@ namespace projections
// Sinusoidal (Sanson-Flamsteed)
template <typename Parameters, typename T>
inline void setup_sinu(Parameters& par, par_gn_sinu<T>& proj_parm)
inline void setup_sinu(Parameters const& par, par_gn_sinu_e<T>& proj_parm)
{
proj_parm.en = pj_enfn<T>(par.es);
}
if (par.es != 0.0) {
/* empty */
} else {
proj_parm.n = 1.;
proj_parm.m = 0.;
setup(par, proj_parm);
}
// Sinusoidal (Sanson-Flamsteed)
template <typename Parameters, typename T>
inline void setup_sinu(Parameters& par, par_gn_sinu_s<T>& proj_parm)
{
proj_parm.n = 1.;
proj_parm.m = 0.;
setup(par, proj_parm);
}
// Eckert VI
template <typename Parameters, typename T>
inline void setup_eck6(Parameters& par, par_gn_sinu<T>& proj_parm)
inline void setup_eck6(Parameters& par, par_gn_sinu_s<T>& proj_parm)
{
proj_parm.m = 1.;
proj_parm.n = 2.570796326794896619231321691;
@@ -220,7 +214,7 @@ namespace projections
// McBryde-Thomas Flat-Polar Sinusoidal
template <typename Parameters, typename T>
inline void setup_mbtfps(Parameters& par, par_gn_sinu<T>& proj_parm)
inline void setup_mbtfps(Parameters& par, par_gn_sinu_s<T>& proj_parm)
{
proj_parm.m = 0.5;
proj_parm.n = 1.785398163397448309615660845;
@@ -249,10 +243,9 @@ namespace projections
struct gn_sinu_spheroid : public detail::gn_sinu::base_gn_sinu_spheroid<T, Parameters>
{
template <typename Params>
inline gn_sinu_spheroid(Params const& params, Parameters const& par)
: detail::gn_sinu::base_gn_sinu_spheroid<T, Parameters>(par)
inline gn_sinu_spheroid(Params const& params, Parameters & par)
{
detail::gn_sinu::setup_gn_sinu(params, this->m_par, this->m_proj_parm);
detail::gn_sinu::setup_gn_sinu(params, par, this->m_proj_parm);
}
};
@@ -273,10 +266,9 @@ namespace projections
struct sinu_ellipsoid : public detail::gn_sinu::base_gn_sinu_ellipsoid<T, Parameters>
{
template <typename Params>
inline sinu_ellipsoid(Params const& , Parameters const& par)
: detail::gn_sinu::base_gn_sinu_ellipsoid<T, Parameters>(par)
inline sinu_ellipsoid(Params const& , Parameters & par)
{
detail::gn_sinu::setup_sinu(this->m_par, this->m_proj_parm);
detail::gn_sinu::setup_sinu(par, this->m_proj_parm);
}
};
@@ -297,10 +289,9 @@ namespace projections
struct sinu_spheroid : public detail::gn_sinu::base_gn_sinu_spheroid<T, Parameters>
{
template <typename Params>
inline sinu_spheroid(Params const& , Parameters const& par)
: detail::gn_sinu::base_gn_sinu_spheroid<T, Parameters>(par)
inline sinu_spheroid(Params const& , Parameters & par)
{
detail::gn_sinu::setup_sinu(this->m_par, this->m_proj_parm);
detail::gn_sinu::setup_sinu(par, this->m_proj_parm);
}
};
@@ -320,10 +311,9 @@ namespace projections
struct eck6_spheroid : public detail::gn_sinu::base_gn_sinu_spheroid<T, Parameters>
{
template <typename Params>
inline eck6_spheroid(Params const& , Parameters const& par)
: detail::gn_sinu::base_gn_sinu_spheroid<T, Parameters>(par)
inline eck6_spheroid(Params const& , Parameters & par)
{
detail::gn_sinu::setup_eck6(this->m_par, this->m_proj_parm);
detail::gn_sinu::setup_eck6(par, this->m_proj_parm);
}
};
@@ -343,10 +333,9 @@ namespace projections
struct mbtfps_spheroid : public detail::gn_sinu::base_gn_sinu_spheroid<T, Parameters>
{
template <typename Params>
inline mbtfps_spheroid(Params const& , Parameters const& par)
: detail::gn_sinu::base_gn_sinu_spheroid<T, Parameters>(par)
inline mbtfps_spheroid(Params const& , Parameters & par)
{
detail::gn_sinu::setup_mbtfps(this->m_par, this->m_proj_parm);
detail::gn_sinu::setup_mbtfps(par, this->m_proj_parm);
}
};
@@ -355,17 +344,17 @@ namespace projections
{
// Static projection
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)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_FI(srs::spar::proj_gn_sinu, gn_sinu_spheroid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_FI2(srs::spar::proj_sinu, sinu_spheroid, sinu_ellipsoid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_FI(srs::spar::proj_eck6, eck6_spheroid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_FI(srs::spar::proj_mbtfps, mbtfps_spheroid)
// Factory entry(s)
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)
{
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(gn_sinu, gn_sinu_entry);

View File

@@ -2,8 +2,8 @@
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2017, 2018.
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
// This file was modified by Oracle on 2017, 2018, 2019.
// Modifications copyright (c) 2017-2019, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
// Use, modification and distribution is subject to the Boost Software License,
@@ -74,20 +74,14 @@ namespace projections
mode_type mode;
};
// template class, using CRTP to implement forward/inverse
template <typename T, typename Parameters>
struct base_gnom_spheroid
: public base_t_fi<base_gnom_spheroid<T, Parameters>, T, Parameters>
{
par_gnom<T> m_proj_parm;
inline base_gnom_spheroid(const Parameters& par)
: base_t_fi<base_gnom_spheroid<T, Parameters>, T, Parameters>(*this, par)
{}
// FORWARD(s_forward) spheroid
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
inline void fwd(Parameters const& , T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
{
T coslam, cosphi, sinphi;
@@ -133,7 +127,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(Parameters const& par, T xy_x, T xy_y, T& lp_lon, T& lp_lat) const
{
static const T half_pi = detail::half_pi<T>();
@@ -144,7 +138,7 @@ namespace projections
cosz = sqrt(1. - sinz * sinz);
if (fabs(rh) <= epsilon10) {
lp_lat = this->m_par.phi0;
lp_lat = par.phi0;
lp_lon = 0.;
} else {
switch (this->m_proj_parm.mode) {
@@ -223,10 +217,9 @@ namespace projections
struct gnom_spheroid : public detail::gnom::base_gnom_spheroid<T, Parameters>
{
template <typename Params>
inline gnom_spheroid(Params const& , Parameters const& par)
: detail::gnom::base_gnom_spheroid<T, Parameters>(par)
inline gnom_spheroid(Params const& , Parameters & par)
{
detail::gnom::setup_gnom(this->m_par, this->m_proj_parm);
detail::gnom::setup_gnom(par, this->m_proj_parm);
}
};
@@ -235,11 +228,11 @@ namespace projections
{
// Static projection
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_gnom, gnom_spheroid, gnom_spheroid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_FI(srs::spar::proj_gnom, gnom_spheroid)
// Factory entry(s)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(gnom_entry, gnom_spheroid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(gnom_init)
{
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(gnom, gnom_entry);

View File

@@ -2,8 +2,8 @@
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2017, 2018.
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
// This file was modified by Oracle on 2017, 2018, 2019.
// Modifications copyright (c) 2017-2019, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
// Use, modification and distribution is subject to the Boost Software License,
@@ -59,46 +59,56 @@ namespace projections
static const double Y_COR = 0.05280;
static const double PHI_LIM = .71093078197902358062;
// TODO: consider storing references to Parameters instead of copies
// TODO: It would be possible to further decrease the size of par_goode
// because spherical sinu and moll has constant parameters.
template <typename T, typename Par>
struct par_goode
{
sinu_spheroid<T, Par> sinu;
moll_spheroid<T, Par> moll;
// NOTE: It is ok to share parameters between projections because
// the only member that is modified in the constructors of
// spherical sinu and moll projections is es = 0 which is set
// below in setup_goode() anyway.
// Moreover in these projections parameters are not used
// in fwd() nor inv().
template <typename Params>
par_goode(Params const& params, Par const& par)
: sinu(params, par), moll(params, par)
par_goode(Params const& params, Par & par)
: sinu(params, par)
, moll(params, par)
{}
};
template <typename T, typename Par>
inline void s_forward(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y,
par_goode<T, Par> const& proj_par)
Par const& par, 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);
proj_par.sinu.fwd(par, lp_lon, lp_lat, xy_x, xy_y);
else {
proj_par.moll.fwd(lp_lon, lp_lat, xy_x, xy_y);
proj_par.moll.fwd(par, lp_lon, lp_lat, xy_x, xy_y);
xy_y -= lp_lat >= 0.0 ? Y_COR : -Y_COR;
}
}
template <typename T, typename Par>
inline void s_inverse(T const& xy_x, T xy_y, T& lp_lon, T& lp_lat,
par_goode<T, Par> const& proj_par)
Par const& par, 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);
proj_par.sinu.inv(par, xy_x, xy_y, lp_lon, lp_lat);
else {
xy_y += xy_y >= 0.0 ? Y_COR : -Y_COR;
proj_par.moll.inv(xy_x, xy_y, lp_lon, lp_lat);
proj_par.moll.inv(par, xy_x, xy_y, lp_lon, lp_lat);
}
}
// Goode Homolosine
template <typename Par>
inline void setup_goode(Par& par)
inline Par& setup_goode(Par& par)
{
par.es = 0.;
@@ -108,6 +118,8 @@ namespace projections
//proj_par.sinu.m_par.es = 0.;
//detail::gn_sinu::setup_sinu(proj_par.sinu.m_par, proj_par.sinu.m_proj_parm);
return par;
}
}} // namespace detail::goode
@@ -126,42 +138,33 @@ namespace projections
\image html ex_goode.gif
*/
template <typename T, typename Parameters>
struct goode_spheroid : public detail::base_t_fi<goode_spheroid<T, Parameters>, T, Parameters>
struct goode_spheroid
{
detail::goode::par_goode<T, Parameters> m_proj_parm;
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(params, setup(this->m_par))
inline goode_spheroid(Params const& params, Parameters & par)
: m_proj_parm(params, detail::goode::setup_goode(par))
{}
// FORWARD(s_forward) spheroid
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
inline void fwd(Parameters const& par, T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
{
detail::goode::s_forward(lp_lon, lp_lat, xy_x, xy_y, this->m_proj_parm);
detail::goode::s_forward(lp_lon, lp_lat, xy_x, xy_y, par, this->m_proj_parm);
}
// INVERSE(s_inverse) spheroid
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
inline void inv(Parameters const& par, T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
{
detail::goode::s_inverse(xy_x, xy_y, lp_lon, lp_lat, this->m_proj_parm);
detail::goode::s_inverse(xy_x, xy_y, lp_lon, lp_lat, par, this->m_proj_parm);
}
static inline std::string get_name()
{
return "goode_spheroid";
}
private:
static Parameters& setup(Parameters& par)
{
detail::goode::setup_goode(par);
return par;
}
};
#ifndef DOXYGEN_NO_DETAIL
@@ -169,11 +172,11 @@ namespace projections
{
// Static projection
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_goode, goode_spheroid, goode_spheroid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_FI(srs::spar::proj_goode, goode_spheroid)
// Factory entry(s)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(goode_entry, goode_spheroid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(goode_init)
{
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(goode, goode_entry);

View File

@@ -2,8 +2,8 @@
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2017, 2018.
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
// This file was modified by Oracle on 2017, 2018, 2019.
// Modifications copyright (c) 2017-2019, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
// Use, modification and distribution is subject to the Boost Software License,
@@ -67,42 +67,36 @@ namespace projections
T YS;
};
// template class, using CRTP to implement forward/inverse
template <typename T, typename Parameters>
struct base_gstmerc_spheroid
: public base_t_fi<base_gstmerc_spheroid<T, Parameters>, T, Parameters>
{
par_gstmerc<T> m_proj_parm;
inline base_gstmerc_spheroid(const Parameters& par)
: base_t_fi<base_gstmerc_spheroid<T, Parameters>, T, Parameters>(*this, par)
{}
// FORWARD(s_forward) spheroid
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
inline void fwd(Parameters const& par, T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
{
T L, Ls, sinLs1, Ls1;
L= this->m_proj_parm.n1*lp_lon;
Ls= this->m_proj_parm.c+this->m_proj_parm.n1*log(pj_tsfn(-1.0*lp_lat,-1.0*sin(lp_lat),this->m_par.e));
Ls= this->m_proj_parm.c+this->m_proj_parm.n1*log(pj_tsfn(-1.0*lp_lat,-1.0*sin(lp_lat), par.e));
sinLs1= sin(L)/cosh(Ls);
Ls1= log(pj_tsfn(-1.0*asin(sinLs1),0.0,0.0));
xy_x= (this->m_proj_parm.XS + this->m_proj_parm.n2*Ls1)*this->m_par.ra;
xy_y= (this->m_proj_parm.YS + this->m_proj_parm.n2*atan(sinh(Ls)/cos(L)))*this->m_par.ra;
xy_x= (this->m_proj_parm.XS + this->m_proj_parm.n2*Ls1) * par.ra;
xy_y= (this->m_proj_parm.YS + this->m_proj_parm.n2*atan(sinh(Ls)/cos(L))) * par.ra;
}
// INVERSE(s_inverse) spheroid
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
inline void inv(Parameters const& par, T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
{
T L, LC, sinC;
L= atan(sinh((xy_x*this->m_par.a - this->m_proj_parm.XS)/this->m_proj_parm.n2)/cos((xy_y*this->m_par.a - this->m_proj_parm.YS)/this->m_proj_parm.n2));
sinC= sin((xy_y*this->m_par.a - this->m_proj_parm.YS)/this->m_proj_parm.n2)/cosh((xy_x*this->m_par.a - this->m_proj_parm.XS)/this->m_proj_parm.n2);
L= atan(sinh((xy_x * par.a - this->m_proj_parm.XS)/this->m_proj_parm.n2)/cos((xy_y * par.a - this->m_proj_parm.YS)/this->m_proj_parm.n2));
sinC= sin((xy_y * par.a - this->m_proj_parm.YS)/this->m_proj_parm.n2)/cosh((xy_x * par.a - this->m_proj_parm.XS)/this->m_proj_parm.n2);
LC= log(pj_tsfn(-1.0*asin(sinC),0.0,0.0));
lp_lon= L/this->m_proj_parm.n1;
lp_lat= -1.0*pj_phi2(exp((LC-this->m_proj_parm.c)/this->m_proj_parm.n1),this->m_par.e);
lp_lat= -1.0*pj_phi2(exp((LC-this->m_proj_parm.c)/this->m_proj_parm.n1), par.e);
}
static inline std::string get_name()
@@ -114,7 +108,7 @@ namespace projections
// Gauss-Schreiber Transverse Mercator (aka Gauss-Laborde Reunion)
template <typename Parameters, typename T>
inline void setup_gstmerc(Parameters& par, par_gstmerc<T>& proj_parm)
inline void setup_gstmerc(Parameters const& par, par_gstmerc<T>& proj_parm)
{
proj_parm.lamc= par.lam0;
proj_parm.n1= sqrt(T(1)+par.es*math::pow(cos(par.phi0),4)/(T(1)-par.es));
@@ -151,9 +145,8 @@ namespace projections
{
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);
detail::gstmerc::setup_gstmerc(par, this->m_proj_parm);
}
};
@@ -162,11 +155,11 @@ namespace projections
{
// Static projection
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_gstmerc, gstmerc_spheroid, gstmerc_spheroid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_FI(srs::spar::proj_gstmerc, gstmerc_spheroid)
// Factory entry(s)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(gstmerc_entry, gstmerc_spheroid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(gstmerc_init)
{
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(gstmerc, gstmerc_entry);

View File

@@ -2,8 +2,8 @@
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2017, 2018.
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
// This file was modified by Oracle on 2017, 2018, 2019.
// Modifications copyright (c) 2017-2019, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
// Use, modification and distribution is subject to the Boost Software License,
@@ -63,20 +63,14 @@ namespace projections
T m, rm;
};
// template class, using CRTP to implement forward/inverse
template <typename T, typename Parameters>
struct base_hammer_spheroid
: public base_t_fi<base_hammer_spheroid<T, Parameters>, T, Parameters>
{
par_hammer<T> m_proj_parm;
inline base_hammer_spheroid(const Parameters& par)
: base_t_fi<base_hammer_spheroid<T, Parameters>, T, Parameters>(*this, par)
{}
// FORWARD(s_forward) spheroid
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
inline void fwd(T lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
inline void fwd(Parameters const& , T lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
{
T cosphi, d;
@@ -87,7 +81,7 @@ namespace projections
// INVERSE(s_inverse) spheroid
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
inline void inv(Parameters const& , T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
{
T z;
@@ -155,10 +149,9 @@ namespace projections
struct hammer_spheroid : public detail::hammer::base_hammer_spheroid<T, Parameters>
{
template <typename Params>
inline hammer_spheroid(Params const& params, Parameters const& par)
: detail::hammer::base_hammer_spheroid<T, Parameters>(par)
inline hammer_spheroid(Params const& params, Parameters & par)
{
detail::hammer::setup_hammer(params, this->m_par, this->m_proj_parm);
detail::hammer::setup_hammer(params, par, this->m_proj_parm);
}
};
@@ -167,11 +160,11 @@ namespace projections
{
// Static projection
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_hammer, hammer_spheroid, hammer_spheroid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_FI(srs::spar::proj_hammer, hammer_spheroid)
// Factory entry(s)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(hammer_entry, hammer_spheroid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(hammer_init)
{
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(hammer, hammer_entry)

View File

@@ -2,8 +2,8 @@
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2017, 2018.
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
// This file was modified by Oracle on 2017, 2018, 2019.
// Modifications copyright (c) 2017-2019, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
// Use, modification and distribution is subject to the Boost Software License,
@@ -70,18 +70,12 @@ namespace projections
static const double FXC = 0.85;
static const double RXC = 1.17647058823529411764;
// template class, using CRTP to implement forward/inverse
template <typename T, typename Parameters>
struct base_hatano_spheroid
: public base_t_fi<base_hatano_spheroid<T, Parameters>, T, Parameters>
{
inline base_hatano_spheroid(const Parameters& par)
: base_t_fi<base_hatano_spheroid<T, Parameters>, T, Parameters>(*this, par)
{}
// FORWARD(s_forward) spheroid
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
inline void fwd(T const& lp_lon, T lp_lat, T& xy_x, T& xy_y) const
inline void fwd(Parameters const& , T const& lp_lon, T lp_lat, T& xy_x, T& xy_y) const
{
T th1, c;
int i;
@@ -97,7 +91,7 @@ namespace projections
// INVERSE(s_inverse) spheroid
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
inline void inv(Parameters const& , T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
{
static T const half_pi = detail::half_pi<T>();
@@ -161,10 +155,9 @@ namespace projections
struct hatano_spheroid : public detail::hatano::base_hatano_spheroid<T, Parameters>
{
template <typename Params>
inline hatano_spheroid(Params const& , Parameters const& par)
: detail::hatano::base_hatano_spheroid<T, Parameters>(par)
inline hatano_spheroid(Params const& , Parameters & par)
{
detail::hatano::setup_hatano(this->m_par);
detail::hatano::setup_hatano(par);
}
};
@@ -173,11 +166,11 @@ namespace projections
{
// Static projection
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_hatano, hatano_spheroid, hatano_spheroid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_FI(srs::spar::proj_hatano, hatano_spheroid)
// Factory entry(s)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(hatano_entry, hatano_spheroid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(hatano_init)
{
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(hatano, hatano_entry)

View File

@@ -2,8 +2,8 @@
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2017, 2018.
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
// This file was modified by Oracle on 2017, 2018, 2019.
// Modifications copyright (c) 2017-2019, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
// Use, modification and distribution is subject to the Boost Software License,
@@ -74,17 +74,17 @@ namespace projections
template <typename T>
struct par_healpix
{
int north_square;
int south_square;
T qp;
detail::apa<T> apa;
int north_square;
int south_square;
};
template <typename T>
struct cap_map
{
int cn; /* An integer 0--3 indicating the position of the polar cap. */
T x, y; /* Coordinates of the pole point (point of most extreme latitude on the polar caps). */
int cn; /* An integer 0--3 indicating the position of the polar cap. */
enum region_type {north, south, equatorial} region;
};
template <typename T>
@@ -276,7 +276,7 @@ namespace projections
**/
template <typename T>
inline void healpix_sphere(T const& lp_lam, T const& lp_phi, T& xy_x, T& xy_y)
{
{
static const T pi = detail::pi<T>();
static const T half_pi = detail::half_pi<T>();
static const T fourth_pi = detail::fourth_pi<T>();
@@ -307,7 +307,7 @@ namespace projections
**/
template <typename T>
inline void healpix_sphere_inverse(T const& xy_x, T const& xy_y, T& lp_lam, T& lp_phi)
{
{
static const T pi = detail::pi<T>();
static const T half_pi = detail::half_pi<T>();
static const T fourth_pi = detail::fourth_pi<T>();
@@ -546,28 +546,22 @@ namespace projections
xy_y = vector[1];
}
// template class, using CRTP to implement forward/inverse
template <typename T, typename Parameters>
struct base_healpix_ellipsoid
: public base_t_fi<base_healpix_ellipsoid<T, Parameters>, T, Parameters>
{
par_healpix<T> m_proj_parm;
inline base_healpix_ellipsoid(const Parameters& par)
: base_t_fi<base_healpix_ellipsoid<T, Parameters>, T, Parameters>(*this, par)
{}
// FORWARD(e_healpix_forward) ellipsoid
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
inline void fwd(T const& lp_lon, T lp_lat, T& xy_x, T& xy_y) const
inline void fwd(Parameters const& par, 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);
lp_lat = auth_lat(par, m_proj_parm, lp_lat, 0);
return healpix_sphere(lp_lon, lp_lat, xy_x, xy_y);
}
// INVERSE(e_healpix_inverse) ellipsoid
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
inline void inv(Parameters const& par, 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) {
@@ -576,7 +570,7 @@ namespace projections
BOOST_THROW_EXCEPTION( projection_exception(error_invalid_x_or_y) );
}
healpix_sphere_inverse(xy_x, xy_y, lp_lon, lp_lat);
lp_lat = auth_lat(this->params(), m_proj_parm, lp_lat, 1);
lp_lat = auth_lat(par, m_proj_parm, lp_lat, 1);
}
static inline std::string get_name()
@@ -586,27 +580,21 @@ namespace projections
};
// template class, using CRTP to implement forward/inverse
template <typename T, typename Parameters>
struct base_healpix_spheroid
: public base_t_fi<base_healpix_spheroid<T, Parameters>, T, Parameters>
{
par_healpix<T> m_proj_parm;
inline base_healpix_spheroid(const Parameters& par)
: base_t_fi<base_healpix_spheroid<T, Parameters>, T, Parameters>(*this, par)
{}
// FORWARD(s_healpix_forward) sphere
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
inline void fwd(Parameters const& , 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 const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
inline void inv(Parameters const& , 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) {
@@ -624,29 +612,23 @@ namespace projections
};
// template class, using CRTP to implement forward/inverse
template <typename T, typename Parameters>
struct base_rhealpix_ellipsoid
: public base_t_fi<base_rhealpix_ellipsoid<T, Parameters>, T, Parameters>
{
par_healpix<T> m_proj_parm;
inline base_rhealpix_ellipsoid(const Parameters& par)
: base_t_fi<base_rhealpix_ellipsoid<T, Parameters>, T, Parameters>(*this, par)
{}
// FORWARD(e_rhealpix_forward) ellipsoid
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
inline void fwd(T const& lp_lon, T lp_lat, T& xy_x, T& xy_y) const
inline void fwd(Parameters const& par, 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);
lp_lat = auth_lat(par, m_proj_parm, lp_lat, 0);
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);
}
// 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(Parameters const& par, 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) {
@@ -656,7 +638,7 @@ namespace projections
}
combine_caps(xy_x, xy_y, this->m_proj_parm.north_square, this->m_proj_parm.south_square, 1);
healpix_sphere_inverse(xy_x, xy_y, lp_lon, lp_lat);
lp_lat = auth_lat(this->params(), m_proj_parm, lp_lat, 1);
lp_lat = auth_lat(par, m_proj_parm, lp_lat, 1);
}
static inline std::string get_name()
@@ -666,20 +648,14 @@ namespace projections
};
// template class, using CRTP to implement forward/inverse
template <typename T, typename Parameters>
struct base_rhealpix_spheroid
: public base_t_fi<base_rhealpix_spheroid<T, Parameters>, T, Parameters>
{
par_healpix<T> m_proj_parm;
inline base_rhealpix_spheroid(const Parameters& par)
: base_t_fi<base_rhealpix_spheroid<T, Parameters>, T, Parameters>(*this, par)
{}
// FORWARD(s_rhealpix_forward) sphere
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
inline void fwd(Parameters const& , 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);
@@ -687,7 +663,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(Parameters const& , 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) {
@@ -762,10 +738,9 @@ namespace projections
struct healpix_ellipsoid : public detail::healpix::base_healpix_ellipsoid<T, Parameters>
{
template <typename Params>
inline healpix_ellipsoid(Params const& , Parameters const& par)
: detail::healpix::base_healpix_ellipsoid<T, Parameters>(par)
inline healpix_ellipsoid(Params const& , Parameters & par)
{
detail::healpix::setup_healpix(this->m_par, this->m_proj_parm);
detail::healpix::setup_healpix(par, this->m_proj_parm);
}
};
@@ -785,10 +760,9 @@ namespace projections
struct healpix_spheroid : public detail::healpix::base_healpix_spheroid<T, Parameters>
{
template <typename Params>
inline healpix_spheroid(Params const& , Parameters const& par)
: detail::healpix::base_healpix_spheroid<T, Parameters>(par)
inline healpix_spheroid(Params const& , Parameters & par)
{
detail::healpix::setup_healpix(this->m_par, this->m_proj_parm);
detail::healpix::setup_healpix(par, this->m_proj_parm);
}
};
@@ -811,10 +785,9 @@ namespace projections
struct rhealpix_ellipsoid : public detail::healpix::base_rhealpix_ellipsoid<T, Parameters>
{
template <typename Params>
inline rhealpix_ellipsoid(Params const& params, Parameters const& par)
: detail::healpix::base_rhealpix_ellipsoid<T, Parameters>(par)
inline rhealpix_ellipsoid(Params const& params, Parameters & par)
{
detail::healpix::setup_rhealpix(params, this->m_par, this->m_proj_parm);
detail::healpix::setup_rhealpix(params, par, this->m_proj_parm);
}
};
@@ -837,10 +810,9 @@ namespace projections
struct rhealpix_spheroid : public detail::healpix::base_rhealpix_spheroid<T, Parameters>
{
template <typename Params>
inline rhealpix_spheroid(Params const& params, Parameters const& par)
: detail::healpix::base_rhealpix_spheroid<T, Parameters>(par)
inline rhealpix_spheroid(Params const& params, Parameters & par)
{
detail::healpix::setup_rhealpix(params, this->m_par, this->m_proj_parm);
detail::healpix::setup_rhealpix(params, par, this->m_proj_parm);
}
};
@@ -849,13 +821,13 @@ namespace projections
{
// Static projection
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)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_FI2(srs::spar::proj_healpix, healpix_spheroid, healpix_ellipsoid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_FI2(srs::spar::proj_rhealpix, rhealpix_spheroid, rhealpix_ellipsoid)
// Factory entry(s)
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)
{
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(healpix, healpix_entry)

View File

@@ -1,9 +1,10 @@
// Boost.Geometry - gis-projections (based on PROJ4)
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2023 Adam Wulkiewicz, Lodz, Poland.
// This file was modified by Oracle on 2017, 2018.
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
// This file was modified by Oracle on 2017-2021.
// Modifications copyright (c) 2017-2021, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
// Use, modification and distribution is subject to the Boost Software License,
@@ -40,9 +41,6 @@
#ifndef BOOST_GEOMETRY_PROJECTIONS_IGH_HPP
#define BOOST_GEOMETRY_PROJECTIONS_IGH_HPP
#include <boost/geometry/util/math.hpp>
#include <boost/shared_ptr.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>
@@ -50,6 +48,8 @@
#include <boost/geometry/srs/projections/proj/gn_sinu.hpp>
#include <boost/geometry/srs/projections/proj/moll.hpp>
#include <boost/geometry/util/math.hpp>
namespace boost { namespace geometry
{
@@ -58,13 +58,69 @@ namespace projections
#ifndef DOXYGEN_NO_DETAIL
namespace detail { namespace igh
{
// TODO: consider replacing dynamically created projections
// with member objects
template <typename T>
struct par_igh_zone
{
T x0;
T y0;
T lam0;
};
// NOTE: x0, y0, lam0 are not used in moll nor sinu projections
// so it is a waste of memory to keep 12 copies of projections
// with parameters as in the original Proj4.
// TODO: It would be possible to further decrease the size of par_igh
// because spherical sinu and moll has constant parameters.
// TODO: Furthermore there is no need to store par_igh_zone parameters
// since they are constant for zones. In both fwd() and inv() there are
// parts of code dependent on specific zones (if statements) anyway
// so these parameters could be hardcoded there instead of stored.
template <typename T, typename Parameters>
struct par_igh
{
boost::shared_ptr<base_v<T, Parameters> > pj[12];
moll_spheroid<T, Parameters> moll;
sinu_spheroid<T, Parameters> sinu;
par_igh_zone<T> zones[12];
T dy0;
// NOTE: The constructors of moll and sinu projections sets
// par.es = 0
template <typename Params>
inline par_igh(Params const& params, Parameters & par)
: moll(params, par)
, sinu(params, par)
{}
inline void fwd(int zone, Parameters const& par, T const& lp_lon, T const& lp_lat, T & xy_x, T & xy_y) const
{
if (zone <= 2 || zone >= 9) // 1, 2, 9, 10, 11, 12
moll.fwd(par, lp_lon, lp_lat, xy_x, xy_y);
else // 3, 4, 5, 6, 7, 8
sinu.fwd(par, lp_lon, lp_lat, xy_x, xy_y);
}
inline void inv(int zone, Parameters const& par, T const& xy_x, T const& xy_y, T & lp_lon, T & lp_lat) const
{
if (zone <= 2 || zone >= 9) // 1, 2, 9, 10, 11, 12
moll.inv(par, xy_x, xy_y, lp_lon, lp_lat);
else // 3, 4, 5, 6, 7, 8
sinu.inv(par, xy_x, xy_y, lp_lon, lp_lat);
}
inline void set_zone(int zone, T const& x_0, T const& y_0, T const& lon_0)
{
zones[zone - 1].x0 = x_0;
zones[zone - 1].y0 = y_0;
zones[zone - 1].lam0 = lon_0;
}
inline par_igh_zone<T> const& get_zone(int zone) const
{
return zones[zone - 1];
}
};
/* 40d 44' 11.8" [degrees] */
@@ -98,36 +154,19 @@ 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, 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<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;
}
// template class, using CRTP to implement forward/inverse
template <typename T, typename Parameters>
struct base_igh_spheroid
: public base_t_fi<base_igh_spheroid<T, Parameters>, T, Parameters>
{
par_igh<T, Parameters> m_proj_parm;
inline base_igh_spheroid(const Parameters& par)
: base_t_fi<base_igh_spheroid<T, Parameters>, T, Parameters>(*this, par)
template <typename Params>
inline base_igh_spheroid(Params const& params, Parameters & par)
: m_proj_parm(params, par)
{}
// FORWARD(s_forward) spheroid
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
inline void fwd(T lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
inline void fwd(Parameters const& par, 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>();
@@ -155,15 +194,15 @@ namespace projections
else z = 12; // 12
}
lp_lon -= this->m_proj_parm.pj[z-1]->params().lam0;
this->m_proj_parm.pj[z-1]->fwd(lp_lon, lp_lat, xy_x, xy_y);
xy_x += this->m_proj_parm.pj[z-1]->params().x0;
xy_y += this->m_proj_parm.pj[z-1]->params().y0;
lp_lon -= this->m_proj_parm.get_zone(z).lam0;
this->m_proj_parm.fwd(z, par, lp_lon, lp_lat, xy_x, xy_y);
xy_x += this->m_proj_parm.get_zone(z).x0;
xy_y += this->m_proj_parm.get_zone(z).y0;
}
// 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(Parameters const& par, 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>();
@@ -178,7 +217,7 @@ namespace projections
static const T d180 = igh::d180<T>();
static const T c2 = 2.0;
const T y90 = this->m_proj_parm.dy0 + sqrt(c2); // lt=90 corresponds to y=y0+sqrt(2.0)
int z = 0;
@@ -205,10 +244,10 @@ namespace projections
{
int ok = 0;
xy_x -= this->m_proj_parm.pj[z-1]->params().x0;
xy_y -= this->m_proj_parm.pj[z-1]->params().y0;
this->m_proj_parm.pj[z-1]->inv(xy_x, xy_y, lp_lon, lp_lat);
lp_lon += this->m_proj_parm.pj[z-1]->params().lam0;
xy_x -= this->m_proj_parm.get_zone(z).x0;
xy_y -= this->m_proj_parm.get_zone(z).y0;
this->m_proj_parm.inv(z, par, xy_x, xy_y, lp_lon, lp_lat);
lp_lon += this->m_proj_parm.get_zone(z).lam0;
switch (z) {
case 1: ok = (lp_lon >= -d180-epsilon && lp_lon <= -d40+epsilon) ||
@@ -247,7 +286,7 @@ namespace projections
// Interrupted Goode Homolosine
template <typename Params, typename Parameters, typename T>
inline void setup_igh(Params const& params, Parameters& par, par_igh<T, Parameters>& proj_parm)
inline void setup_igh(Params const& , Parameters& par, par_igh<T, Parameters>& proj_parm)
{
static const T d0 = 0;
static const T d4044118 = igh::d4044118<T>();
@@ -277,45 +316,42 @@ namespace projections
+-------+--------+-----------+-----------+
-180 -100 -20 80 180
*/
T lp_lam = 0, lp_phi = d4044118;
T xy1_x, xy1_y;
T xy3_x, xy3_y;
// IMPORTANT: Force spherical sinu projection
// This is required because unlike in the original proj4 here
// parameters are used to initialize underlying projections.
// In the original code zeroed parameters are passed which
// could be done here as well though.
par.es = 0.;
// sinusoidal zones
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);
proj_parm.set_zone(3, -d100, d0, -d100);
proj_parm.set_zone(4, d30, d0, d30);
proj_parm.set_zone(5, -d160, d0, -d160);
proj_parm.set_zone(6, -d60, d0, -d60);
proj_parm.set_zone(7, d20, d0, d20);
proj_parm.set_zone(8, d140, d0, d140);
// mollweide zones
do_setup<moll_entry>(1, params, par, proj_parm, -d100, d0, -d100);
proj_parm.set_zone(1, -d100, d0, -d100);
// NOTE: x0, y0, lam0 are not used in moll nor sinu fwd
// so the order of initialization doesn't matter that much.
// But keep the original one from Proj4.
// y0 ?
proj_parm.pj[0]->fwd(lp_lam, lp_phi, xy1_x, xy1_y); // zone 1
proj_parm.pj[2]->fwd(lp_lam, lp_phi, xy3_x, xy3_y); // zone 3
proj_parm.fwd(1, par, lp_lam, lp_phi, xy1_x, xy1_y); // zone 1
proj_parm.fwd(3, par, lp_lam, lp_phi, xy3_x, xy3_y); // zone 3
// y0 + xy1_y = xy3_y for lt = 40d44'11.8"
proj_parm.dy0 = xy3_y - xy1_y;
proj_parm.pj[0]->mutable_params().y0 = proj_parm.dy0;
proj_parm.zones[0].y0 = proj_parm.dy0; // zone 1
// mollweide zones (cont'd)
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);
proj_parm.set_zone(2, d30, proj_parm.dy0, d30);
proj_parm.set_zone(9, -d160, -proj_parm.dy0, -d160);
proj_parm.set_zone(10, -d60, -proj_parm.dy0, -d60);
proj_parm.set_zone(11, d20, -proj_parm.dy0, d20);
proj_parm.set_zone(12, d140, -proj_parm.dy0, d140);
// Already done before
// NOTE: Already done before in sinu and moll constructor
//par.es = 0.;
}
@@ -338,10 +374,10 @@ namespace projections
struct igh_spheroid : public detail::igh::base_igh_spheroid<T, Parameters>
{
template <typename Params>
inline igh_spheroid(Params const& params, Parameters const& par)
: detail::igh::base_igh_spheroid<T, Parameters>(par)
inline igh_spheroid(Params const& params, Parameters & par)
: detail::igh::base_igh_spheroid<T, Parameters>(params, par)
{
detail::igh::setup_igh(params, this->m_par, this->m_proj_parm);
detail::igh::setup_igh(params, par, this->m_proj_parm);
}
};
@@ -350,7 +386,7 @@ namespace projections
{
// Static projection
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_igh, igh_spheroid, igh_spheroid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_FI(srs::spar::proj_igh, igh_spheroid)
// Factory entry(s)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(igh_entry, igh_spheroid)

View File

@@ -2,8 +2,8 @@
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2017, 2018.
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
// This file was modified by Oracle on 2017, 2018, 2019.
// Modifications copyright (c) 2017-2019, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
// Use, modification and distribution is subject to the Boost Software License,
@@ -162,29 +162,23 @@ namespace projections
*x = *R * sin(F);
}
// template class, using CRTP to implement forward/inverse
template <typename T, typename Parameters>
struct base_imw_p_ellipsoid
: public base_t_fi<base_imw_p_ellipsoid<T, Parameters>, T, Parameters>
{
par_imw_p<T> m_proj_parm;
inline base_imw_p_ellipsoid(const Parameters& par)
: base_t_fi<base_imw_p_ellipsoid<T, Parameters>, T, Parameters>(*this, par)
{}
// FORWARD(e_forward) ellipsoid
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
inline void fwd(Parameters const& par, 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);
point_xy<T> xy = loc_for(lp_lon, lp_lat, par, m_proj_parm, &yc);
xy_x = xy.x; xy_y = xy.y;
}
// INVERSE(e_inverse) ellipsoid
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
inline void inv(Parameters const& par, T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
{
point_xy<T> t;
T yc = 0.0;
@@ -194,7 +188,7 @@ namespace projections
lp_lat = this->m_proj_parm.phi_2;
lp_lon = xy_x / cos(lp_lat);
do {
t = loc_for(lp_lon, lp_lat, this->m_par, m_proj_parm, &yc);
t = loc_for(lp_lon, lp_lat, par, m_proj_parm, &yc);
lp_lat = ((lp_lat - this->m_proj_parm.phi_1) * (xy_y - yc) / (t.y - yc)) + this->m_proj_parm.phi_1;
lp_lon = lp_lon * xy_x / t.x;
i++;
@@ -290,9 +284,8 @@ namespace projections
{
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(params, this->m_par, this->m_proj_parm);
detail::imw_p::setup_imw_p(params, par, this->m_proj_parm);
}
};
@@ -301,11 +294,11 @@ namespace projections
{
// Static projection
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_imw_p, imw_p_ellipsoid, imw_p_ellipsoid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_FI(srs::spar::proj_imw_p, imw_p_ellipsoid)
// Factory entry(s)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(imw_p_entry, imw_p_ellipsoid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(imw_p_init)
{
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(imw_p, imw_p_entry)

View File

@@ -2,8 +2,8 @@
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2017, 2018.
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
// This file was modified by Oracle on 2017, 2018, 2019.
// Modifications copyright (c) 2017-2019, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
// Use, modification and distribution is subject to the Boost Software License,
@@ -207,17 +207,17 @@ namespace projections
template <typename T>
struct isea_dgg {
//isea_poly polyhedron; /* ignored, icosahedron */
T o_lat, o_lon, o_az; /* orientation, radians */
int pole; /* true if standard snyder */
//isea_topology topology; /* ignored, hexagon */
T radius; /* radius of the earth in meters, ignored 1.0 */
unsigned long serial;
//int pole; /* true if standard snyder */
int aperture; /* valid values depend on partitioning method */
int resolution;
T radius; /* radius of the earth in meters, ignored 1.0 */
isea_address_form output; /* an isea_address_form */
int triangle; /* triangle of last transformed point */
int quad; /* quad of last transformed point */
unsigned long serial;
//isea_poly polyhedron; /* ignored, icosahedron */
//isea_topology topology; /* ignored, hexagon */
isea_address_form output; /* an isea_address_form */
};
template <typename T>
@@ -232,9 +232,9 @@ namespace projections
template <typename T>
struct isea_address {
T x,y; /* or i,j or lon,lat depending on type */
int type; /* enum isea_address_form */
int number;
T x,y; /* or i,j or lon,lat depending on type */
};
/* ENDINC */
@@ -266,7 +266,7 @@ namespace projections
};
return result;
}
template <typename T>
inline const isea_geo<T> * vertex()
{
@@ -1114,20 +1114,14 @@ namespace projections
isea_dgg<T> dgg;
};
// template class, using CRTP to implement forward/inverse
template <typename T, typename Parameters>
struct base_isea_spheroid
: public base_t_f<base_isea_spheroid<T, Parameters>, T, Parameters>
{
par_isea<T> m_proj_parm;
inline base_isea_spheroid(const Parameters& par)
: base_t_f<base_isea_spheroid<T, Parameters>, T, Parameters>(*this, par)
{}
// FORWARD(s_forward)
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
inline void fwd(Parameters const& , T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
{
isea_pt<T> out;
isea_geo<T> in;
@@ -1246,7 +1240,7 @@ namespace projections
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 ?
@@ -1294,8 +1288,7 @@ namespace projections
struct isea_spheroid : public detail::isea::base_isea_spheroid<T, Parameters>
{
template <typename Params>
inline isea_spheroid(Params const& params, Parameters const& par)
: detail::isea::base_isea_spheroid<T, Parameters>(par)
inline isea_spheroid(Params const& params, Parameters const& )
{
detail::isea::setup_isea(params, this->m_proj_parm);
}
@@ -1306,11 +1299,11 @@ namespace projections
{
// Static projection
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_isea, isea_spheroid, isea_spheroid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_F(srs::spar::proj_isea, isea_spheroid)
// Factory entry(s)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_F(isea_entry, isea_spheroid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(isea_init)
{
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(isea, isea_entry)

View File

@@ -2,8 +2,9 @@
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2017, 2018.
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
// This file was modified by Oracle on 2017, 2018, 2019, 2022.
// Modifications copyright (c) 2017-2022, Oracle and/or its affiliates.
// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
// Use, modification and distribution is subject to the Boost Software License,
@@ -101,24 +102,18 @@ namespace projections
**/
// template class, using CRTP to implement forward/inverse
template <typename T, typename Parameters>
struct base_krovak_ellipsoid
: public base_t_fi<base_krovak_ellipsoid<T, Parameters>, T, Parameters>
{
par_krovak<T> m_proj_parm;
inline base_krovak_ellipsoid(const Parameters& par)
: base_t_fi<base_krovak_ellipsoid<T, Parameters>, T, Parameters>(*this, par)
{}
// FORWARD(e_forward) ellipsoid
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
inline void fwd(Parameters const& par, T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
{
T gfi, u, deltav, s, d, eps, rho;
gfi = math::pow( (T(1) + this->m_par.e * sin(lp_lat)) / (T(1) - this->m_par.e * sin(lp_lat)), this->m_proj_parm.alpha * this->m_par.e / T(2));
gfi = math::pow( (T(1) + par.e * sin(lp_lat)) / (T(1) - par.e * sin(lp_lat)), this->m_proj_parm.alpha * par.e / T(2));
u = 2. * (atan(this->m_proj_parm.k * math::pow( tan(lp_lat / T(2) + S45), this->m_proj_parm.alpha) / gfi)-S45);
deltav = -lp_lon * this->m_proj_parm.alpha;
@@ -134,19 +129,17 @@ namespace projections
xy_y *= this->m_proj_parm.czech;
xy_x *= this->m_proj_parm.czech;
if (this->m_proj_parm.czech == 1) std::swap(xy_x, xy_y);
}
// 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(Parameters const& par, T xy_x, T xy_y, T& lp_lon, T& lp_lat) const
{
T u, deltav, s, d, eps, rho, fi1, xy0;
T u, deltav, s, d, eps, rho, fi1;
int i;
// TODO: replace with std::swap()
xy0 = xy_x;
xy_x = xy_y;
xy_y = xy0;
if (this->m_proj_parm.czech == -1) std::swap(xy_x, xy_y);
xy_x *= this->m_proj_parm.czech;
xy_y *= this->m_proj_parm.czech;
@@ -160,7 +153,7 @@ namespace projections
u = asin(cos(this->m_proj_parm.ad) * sin(s) - sin(this->m_proj_parm.ad) * cos(s) * cos(d));
deltav = asin(cos(s) * sin(d) / cos(u));
lp_lon = this->m_par.lam0 - deltav / this->m_proj_parm.alpha;
lp_lon = par.lam0 - deltav / this->m_proj_parm.alpha;
/* ITERATION FOR lp_lat */
fi1 = u;
@@ -168,7 +161,7 @@ namespace projections
for (i = max_iter; i ; --i) {
lp_lat = T(2) * ( atan( math::pow( this->m_proj_parm.k, T(-1) / this->m_proj_parm.alpha) *
math::pow( tan(u / T(2) + S45) , T(1) / this->m_proj_parm.alpha) *
math::pow( (T(1) + this->m_par.e * sin(fi1)) / (T(1) - this->m_par.e * sin(fi1)) , this->m_par.e / T(2))
math::pow( (T(1) + par.e * sin(fi1)) / (T(1) - par.e * sin(fi1)) , par.e / T(2))
) - S45);
if (fabs(fi1 - lp_lat) < epsilon)
@@ -178,7 +171,7 @@ namespace projections
if( i == 0 )
BOOST_THROW_EXCEPTION( projection_exception(error_non_convergent) );
lp_lon -= this->m_par.lam0;
lp_lon -= par.lam0;
}
static inline std::string get_name()
@@ -252,10 +245,9 @@ namespace projections
struct krovak_ellipsoid : public detail::krovak::base_krovak_ellipsoid<T, Parameters>
{
template <typename Params>
inline krovak_ellipsoid(Params const& params, Parameters const& par)
: detail::krovak::base_krovak_ellipsoid<T, Parameters>(par)
inline krovak_ellipsoid(Params const& params, Parameters & par)
{
detail::krovak::setup_krovak(params, this->m_par, this->m_proj_parm);
detail::krovak::setup_krovak(params, par, this->m_proj_parm);
}
};
@@ -264,11 +256,11 @@ namespace projections
{
// Static projection
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_krovak, krovak_ellipsoid, krovak_ellipsoid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_FI(srs::spar::proj_krovak, krovak_ellipsoid)
// Factory entry(s)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(krovak_entry, krovak_ellipsoid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(krovak_init)
{
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(krovak, krovak_entry)

View File

@@ -2,8 +2,8 @@
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2017, 2018.
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
// This file was modified by Oracle on 2017, 2018, 2019.
// Modifications copyright (c) 2017-2019, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
// Use, modification and distribution is subject to the Boost Software License,
@@ -59,24 +59,17 @@ namespace projections
template <typename T>
struct par_labrd
{
T Az, kRg, p0s, A, C, Ca, Cb, Cc, Cd;
int rot;
T Az, kRg, p0s, A, C, Ca, Cb, Cc, Cd;
};
// template class, using CRTP to implement forward/inverse
template <typename T, typename Parameters>
struct base_labrd_ellipsoid
: public base_t_fi<base_labrd_ellipsoid<T, Parameters>, T, Parameters>
{
par_labrd<T> m_proj_parm;
inline base_labrd_ellipsoid(const Parameters& par)
: base_t_fi<base_labrd_ellipsoid<T, Parameters>, T, Parameters>(*this, par)
{}
// FORWARD(e_forward)
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
inline void fwd(Parameters const& par, T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
{
static const T fourth_pi = detail::fourth_pi<T>();
@@ -84,8 +77,8 @@ namespace projections
T I1, I2, I3, I4, I5, I6, x2, y2, t;
V1 = this->m_proj_parm.A * log( tan(fourth_pi + .5 * lp_lat) );
t = this->m_par.e * sin(lp_lat);
V2 = .5 * this->m_par.e * this->m_proj_parm.A * log ((1. + t)/(1. - t));
t = par.e * sin(lp_lat);
V2 = .5 * par.e * this->m_proj_parm.A * log ((1. + t)/(1. - t));
ps = 2. * (atan(exp(V1 - V2 + this->m_proj_parm.C)) - fourth_pi);
I1 = ps - this->m_proj_parm.p0s;
cosps = cos(ps); cosps2 = cosps * cosps;
@@ -110,7 +103,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(Parameters const& par, T xy_x, T xy_y, T& lp_lon, T& lp_lat) const
{
static const T fourth_pi = detail::fourth_pi<T>();
@@ -130,25 +123,25 @@ namespace projections
xy_x += - this->m_proj_parm.Ca * V1 - this->m_proj_parm.Cb * V2 + this->m_proj_parm.Cc * V3 + this->m_proj_parm.Cd * V4;
xy_y += this->m_proj_parm.Cb * V1 - this->m_proj_parm.Ca * V2 - this->m_proj_parm.Cd * V3 + this->m_proj_parm.Cc * V4;
ps = this->m_proj_parm.p0s + xy_y / this->m_proj_parm.kRg;
pe = ps + this->m_par.phi0 - this->m_proj_parm.p0s;
pe = ps + par.phi0 - this->m_proj_parm.p0s;
for ( i = 20; i; --i) {
V1 = this->m_proj_parm.A * log(tan(fourth_pi + .5 * pe));
tpe = this->m_par.e * sin(pe);
V2 = .5 * this->m_par.e * this->m_proj_parm.A * log((1. + tpe)/(1. - tpe));
tpe = par.e * sin(pe);
V2 = .5 * par.e * this->m_proj_parm.A * log((1. + tpe)/(1. - tpe));
t = ps - 2. * (atan(exp(V1 - V2 + this->m_proj_parm.C)) - fourth_pi);
pe += t;
if (fabs(t) < epsilon)
break;
}
t = this->m_par.e * sin(pe);
t = par.e * sin(pe);
t = 1. - t * t;
Re = this->m_par.one_es / ( t * sqrt(t) );
Re = par.one_es / ( t * sqrt(t) );
t = tan(ps);
t2 = t * t;
s = this->m_proj_parm.kRg * this->m_proj_parm.kRg;
d = Re * this->m_par.k0 * this->m_proj_parm.kRg;
d = Re * par.k0 * this->m_proj_parm.kRg;
I7 = t / (2. * d);
I8 = t * (5. + 3. * t2) / (24. * d * s);
d = cos(ps) * this->m_proj_parm.kRg * this->m_proj_parm.A;
@@ -170,13 +163,12 @@ namespace projections
// Laborde
template <typename Params, typename Parameters, typename T>
inline void setup_labrd(Params const& params, Parameters& par, par_labrd<T>& proj_parm)
inline void setup_labrd(Params const& params, Parameters const& 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<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;
@@ -220,9 +212,8 @@ namespace projections
{
template <typename Params>
inline labrd_ellipsoid(Params const& params, Parameters const& par)
: detail::labrd::base_labrd_ellipsoid<T, Parameters>(par)
{
detail::labrd::setup_labrd(params, this->m_par, this->m_proj_parm);
detail::labrd::setup_labrd(params, par, this->m_proj_parm);
}
};
@@ -231,11 +222,11 @@ namespace projections
{
// Static projection
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_labrd, labrd_ellipsoid, labrd_ellipsoid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_FI(srs::spar::proj_labrd, labrd_ellipsoid)
// Factory entry(s)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(labrd_entry, labrd_ellipsoid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(labrd_init)
{
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(labrd, labrd_entry)

View File

@@ -2,8 +2,8 @@
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2017, 2018.
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
// This file was modified by Oracle on 2017, 2018, 2019.
// Modifications copyright (c) 2017-2019, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
// Use, modification and distribution is subject to the Boost Software License,
@@ -83,20 +83,14 @@ namespace projections
mode_type mode;
};
// template class, using CRTP to implement forward/inverse
template <typename T, typename Parameters>
struct base_laea_ellipsoid
: public base_t_fi<base_laea_ellipsoid<T, Parameters>, T, Parameters>
{
par_laea<T> m_proj_parm;
inline base_laea_ellipsoid(const Parameters& par)
: base_t_fi<base_laea_ellipsoid<T, Parameters>, T, Parameters>(*this, par)
{}
// FORWARD(e_forward) ellipsoid
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
inline void fwd(Parameters const& par, T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
{
static const T half_pi = detail::half_pi<T>();
@@ -105,7 +99,7 @@ namespace projections
coslam = cos(lp_lon);
sinlam = sin(lp_lon);
sinphi = sin(lp_lat);
q = pj_qsfn(sinphi, this->m_par.e, this->m_par.one_es);
q = pj_qsfn(sinphi, par.e, par.one_es);
if (this->m_proj_parm.mode == obliq || this->m_proj_parm.mode == equit) {
sinb = q / this->m_proj_parm.qp;
@@ -158,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(Parameters const& par, T xy_x, T xy_y, T& lp_lon, T& lp_lat) const
{
T cCe, sCe, q, rho, ab=0.0;
@@ -170,7 +164,7 @@ namespace projections
rho = boost::math::hypot(xy_x, xy_y);
if (rho < epsilon10) {
lp_lon = 0.;
lp_lat = this->m_par.phi0;
lp_lat = par.phi0;
return;
}
sCe = 2. * asin(.5 * rho / this->m_proj_parm.rq);
@@ -192,7 +186,7 @@ namespace projections
q = (xy_x * xy_x + xy_y * xy_y);
if (q == 0.0) {
lp_lon = 0.;
lp_lat = this->m_par.phi0;
lp_lat = par.phi0;
return;
}
ab = 1. - q / this->m_proj_parm.qp;
@@ -211,20 +205,14 @@ namespace projections
};
// template class, using CRTP to implement forward/inverse
template <typename T, typename Parameters>
struct base_laea_spheroid
: public base_t_fi<base_laea_spheroid<T, Parameters>, T, Parameters>
{
par_laea<T> m_proj_parm;
inline base_laea_spheroid(const Parameters& par)
: base_t_fi<base_laea_spheroid<T, Parameters>, T, Parameters>(*this, par)
{}
// FORWARD(s_forward) spheroid
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
inline void fwd(Parameters const& par, T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
{
static const T fourth_pi = detail::fourth_pi<T>();
@@ -252,7 +240,7 @@ namespace projections
coslam = -coslam;
BOOST_FALLTHROUGH;
case s_pole:
if (fabs(lp_lat + this->m_par.phi0) < epsilon10) {
if (fabs(lp_lat + par.phi0) < epsilon10) {
BOOST_THROW_EXCEPTION( projection_exception(error_tolerance_condition) );
}
xy_y = fourth_pi - lp_lat * .5;
@@ -265,7 +253,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(Parameters const& par, T xy_x, T xy_y, T& lp_lon, T& lp_lat) const
{
static const T half_pi = detail::half_pi<T>();
@@ -287,7 +275,7 @@ namespace projections
xy_y = cosz * rh;
break;
case obliq:
lp_lat = fabs(rh) <= epsilon10 ? this->m_par.phi0 :
lp_lat = fabs(rh) <= epsilon10 ? par.phi0 :
asin(cosz * this->m_proj_parm.sinb1 + xy_y * sinz * this->m_proj_parm.cosb1 / rh);
xy_x *= sinz * this->m_proj_parm.cosb1;
xy_y = (cosz - sin(lp_lat) * this->m_proj_parm.sinb1) * rh;
@@ -329,7 +317,7 @@ namespace projections
if (par.es != 0.0) {
double sinphi;
par.e = sqrt(par.es);
par.e = sqrt(par.es); // TODO : Isn't it already set?
proj_parm.qp = pj_qsfn(1., par.e, par.one_es);
proj_parm.mmf = .5 / (1. - par.es);
proj_parm.apa = pj_authset<T>(par.es);
@@ -382,10 +370,9 @@ namespace projections
struct laea_ellipsoid : public detail::laea::base_laea_ellipsoid<T, Parameters>
{
template <typename Params>
inline laea_ellipsoid(Params const& , Parameters const& par)
: detail::laea::base_laea_ellipsoid<T, Parameters>(par)
inline laea_ellipsoid(Params const& , Parameters & par)
{
detail::laea::setup_laea(this->m_par, this->m_proj_parm);
detail::laea::setup_laea(par, this->m_proj_parm);
}
};
@@ -406,10 +393,9 @@ namespace projections
struct laea_spheroid : public detail::laea::base_laea_spheroid<T, Parameters>
{
template <typename Params>
inline laea_spheroid(Params const& , Parameters const& par)
: detail::laea::base_laea_spheroid<T, Parameters>(par)
inline laea_spheroid(Params const& , Parameters & par)
{
detail::laea::setup_laea(this->m_par, this->m_proj_parm);
detail::laea::setup_laea(par, this->m_proj_parm);
}
};
@@ -418,11 +404,11 @@ namespace projections
{
// Static projection
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_laea, laea_spheroid, laea_ellipsoid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_FI2(srs::spar::proj_laea, laea_spheroid, laea_ellipsoid)
// Factory entry(s)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI2(laea_entry, laea_spheroid, laea_ellipsoid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(laea_init)
{
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(laea, laea_entry)

View File

@@ -2,8 +2,8 @@
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2017, 2018.
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
// This file was modified by Oracle on 2017, 2018, 2019.
// Modifications copyright (c) 2017-2019, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
// Use, modification and distribution is subject to the Boost Software License,
@@ -67,20 +67,14 @@ namespace projections
T hrw;
};
// template class, using CRTP to implement forward/inverse
template <typename T, typename Parameters>
struct base_lagrng_spheroid
: public base_t_f<base_lagrng_spheroid<T, Parameters>, T, Parameters>
{
par_lagrng<T> m_proj_parm;
inline base_lagrng_spheroid(const Parameters& par)
: base_t_f<base_lagrng_spheroid<T, Parameters>, T, Parameters>(*this, 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(Parameters const& , T lp_lon, T lp_lat, T& xy_x, T& xy_y) const
{
static const T half_pi = detail::half_pi<T>();
@@ -115,7 +109,7 @@ namespace projections
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);
@@ -161,10 +155,9 @@ namespace projections
struct lagrng_spheroid : public detail::lagrng::base_lagrng_spheroid<T, Parameters>
{
template <typename Params>
inline lagrng_spheroid(Params const& params, Parameters const& par)
: detail::lagrng::base_lagrng_spheroid<T, Parameters>(par)
inline lagrng_spheroid(Params const& params, Parameters & par)
{
detail::lagrng::setup_lagrng(params, this->m_par, this->m_proj_parm);
detail::lagrng::setup_lagrng(params, par, this->m_proj_parm);
}
};
@@ -173,11 +166,11 @@ namespace projections
{
// Static projection
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_lagrng, lagrng_spheroid, lagrng_spheroid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_F(srs::spar::proj_lagrng, lagrng_spheroid)
// Factory entry(s)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_F(lagrng_entry, lagrng_spheroid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(lagrng_init)
{
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(lagrng, lagrng_entry);

View File

@@ -2,8 +2,8 @@
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2017, 2018.
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
// This file was modified by Oracle on 2017, 2018, 2019.
// Modifications copyright (c) 2017-2019, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
// Use, modification and distribution is subject to the Boost Software License,
@@ -54,18 +54,12 @@ namespace projections
namespace detail { namespace larr
{
// template class, using CRTP to implement forward/inverse
template <typename T, typename Parameters>
struct base_larr_spheroid
: public base_t_f<base_larr_spheroid<T, Parameters>, T, Parameters>
{
inline base_larr_spheroid(const Parameters& par)
: base_t_f<base_larr_spheroid<T, Parameters>, T, Parameters>(*this, par)
{}
// FORWARD(s_forward) sphere
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
inline void fwd(Parameters const& , T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
{
static const T sixth = detail::sixth<T>();
@@ -107,10 +101,9 @@ namespace projections
struct larr_spheroid : public detail::larr::base_larr_spheroid<T, Parameters>
{
template <typename Params>
inline larr_spheroid(Params const& , Parameters const& par)
: detail::larr::base_larr_spheroid<T, Parameters>(par)
inline larr_spheroid(Params const& , Parameters & par)
{
detail::larr::setup_larr(this->m_par);
detail::larr::setup_larr(par);
}
};
@@ -119,11 +112,11 @@ namespace projections
{
// Static projection
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_larr, larr_spheroid, larr_spheroid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_F(srs::spar::proj_larr, larr_spheroid)
// Factory entry(s)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_F(larr_entry, larr_spheroid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(larr_init)
{
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(larr, larr_entry);

View File

@@ -2,8 +2,8 @@
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2017, 2018.
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
// This file was modified by Oracle on 2017, 2018, 2019.
// Modifications copyright (c) 2017-2019, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
// Use, modification and distribution is subject to the Boost Software License,
@@ -65,18 +65,12 @@ namespace projections
static const double b23 = -0.0285500;
static const double b05 = -0.0491032;
// template class, using CRTP to implement forward/inverse
template <typename T, typename Parameters>
struct base_lask_spheroid
: public base_t_f<base_lask_spheroid<T, Parameters>, T, Parameters>
{
inline base_lask_spheroid(const Parameters& par)
: base_t_f<base_lask_spheroid<T, Parameters>, T, Parameters>(*this, par)
{}
// FORWARD(s_forward) sphere
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
inline void fwd(Parameters const& , T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
{
T l2, p2;
@@ -121,10 +115,9 @@ namespace projections
struct lask_spheroid : public detail::lask::base_lask_spheroid<T, Parameters>
{
template <typename Params>
inline lask_spheroid(Params const& , Parameters const& par)
: detail::lask::base_lask_spheroid<T, Parameters>(par)
inline lask_spheroid(Params const& , Parameters & par)
{
detail::lask::setup_lask(this->m_par);
detail::lask::setup_lask(par);
}
};
@@ -133,11 +126,11 @@ namespace projections
{
// Static projection
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_lask, lask_spheroid, lask_spheroid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_F(srs::spar::proj_lask, lask_spheroid)
// Factory entry(s)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_F(lask_entry, lask_spheroid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(lask_init)
{
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(lask, lask_entry);

View File

@@ -2,8 +2,8 @@
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2017, 2018.
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
// This file was modified by Oracle on 2017, 2018, 2019.
// Modifications copyright (c) 2017-2019, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
// Use, modification and distribution is subject to the Boost Software License,
@@ -63,33 +63,27 @@ namespace projections
/* very loosely based upon DMA code by Bradford W. Drew */
// template class, using CRTP to implement forward/inverse
template <typename T, typename Parameters>
struct base_latlong_other
: public base_t_fi<base_latlong_other<T, Parameters>, T, Parameters>
{
inline base_latlong_other(const Parameters& par)
: base_t_fi<base_latlong_other<T, Parameters>, T, Parameters>(*this, par)
{}
// FORWARD(forward)
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
inline void fwd(Parameters const& par, 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
xy_x = lp_lon / this->m_par.a;
xy_y = lp_lat / this->m_par.a;
xy_x = lp_lon / par.a;
xy_y = lp_lat / par.a;
}
// INVERSE(inverse)
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
inline void inv(Parameters const& par, 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
lp_lat = xy_y * this->m_par.a;
lp_lon = xy_x * this->m_par.a;
lp_lat = xy_y * par.a;
lp_lon = xy_x * par.a;
}
static inline std::string get_name()
@@ -124,10 +118,9 @@ namespace projections
struct latlong_other : public detail::latlong::base_latlong_other<T, Parameters>
{
template <typename Params>
inline latlong_other(Params const& , Parameters const& par)
: detail::latlong::base_latlong_other<T, Parameters>(par)
inline latlong_other(Params const& , Parameters & par)
{
detail::latlong::setup_latlong(this->m_par);
detail::latlong::setup_latlong(par);
}
};
@@ -136,14 +129,14 @@ namespace projections
{
// Static projection
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)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_FI(srs::spar::proj_lonlat, latlong_other)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_FI(srs::spar::proj_latlon, latlong_other)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_FI(srs::spar::proj_latlong, latlong_other)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_FI(srs::spar::proj_longlat, latlong_other)
// Factory entry(s)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(latlong_entry, latlong_other)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(latlong_init)
{
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(lonlat, latlong_entry)

View File

@@ -2,8 +2,8 @@
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2017, 2018.
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
// This file was modified by Oracle on 2017, 2018, 2019.
// Modifications copyright (c) 2017-2019, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
// Use, modification and distribution is subject to the Boost Software License,
@@ -66,28 +66,22 @@ namespace projections
template <typename T>
struct par_lcc
{
T phi1;
T phi2;
T n;
T rho0;
T c;
int ellips;
T phi1;
T phi2;
T n;
T rho0;
T c;
bool ellips;
};
// template class, using CRTP to implement forward/inverse
template <typename T, typename Parameters>
struct base_lcc_ellipsoid
: public base_t_fi<base_lcc_ellipsoid<T, Parameters>, T, Parameters>
{
par_lcc<T> m_proj_parm;
inline base_lcc_ellipsoid(const Parameters& par)
: base_t_fi<base_lcc_ellipsoid<T, Parameters>, T, Parameters>(*this, par)
{}
// FORWARD(e_forward) ellipsoid & spheroid
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
inline void fwd(T lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
inline void fwd(Parameters const& par, 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>();
@@ -101,24 +95,24 @@ namespace projections
rho = 0.;
} else {
rho = this->m_proj_parm.c * (this->m_proj_parm.ellips
? math::pow(pj_tsfn(lp_lat, sin(lp_lat), this->m_par.e), this->m_proj_parm.n)
? math::pow(pj_tsfn(lp_lat, sin(lp_lat), par.e), this->m_proj_parm.n)
: math::pow(tan(fourth_pi + T(0.5) * lp_lat), -this->m_proj_parm.n));
}
lp_lon *= this->m_proj_parm.n;
xy_x = this->m_par.k0 * (rho * sin( lp_lon) );
xy_y = this->m_par.k0 * (this->m_proj_parm.rho0 - rho * cos(lp_lon) );
xy_x = par.k0 * (rho * sin( lp_lon) );
xy_y = par.k0 * (this->m_proj_parm.rho0 - rho * cos(lp_lon) );
}
// 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(Parameters const& par, T xy_x, T xy_y, T& lp_lon, T& lp_lat) const
{
static const T half_pi = detail::half_pi<T>();
T rho;
xy_x /= this->m_par.k0;
xy_y /= this->m_par.k0;
xy_x /= par.k0;
xy_y /= par.k0;
xy_y = this->m_proj_parm.rho0 - xy_y;
rho = boost::math::hypot(xy_x, xy_y);
@@ -129,7 +123,7 @@ namespace projections
xy_y = -xy_y;
}
if (this->m_proj_parm.ellips) {
lp_lat = pj_phi2(math::pow(rho / this->m_proj_parm.c, T(1)/this->m_proj_parm.n), this->m_par.e);
lp_lat = pj_phi2(math::pow(rho / this->m_proj_parm.c, T(1)/this->m_proj_parm.n), par.e);
if (lp_lat == HUGE_VAL) {
BOOST_THROW_EXCEPTION( projection_exception(error_tolerance_condition) );
}
@@ -193,7 +187,7 @@ namespace projections
if( (proj_parm.ellips = (par.es != 0.)) ) {
double ml1, m1;
par.e = sqrt(par.es);
par.e = sqrt(par.es); // TODO: Isn't it already set?
m1 = pj_msfn(sinphi, cosphi, par.es);
ml1 = pj_tsfn(proj_parm.phi1, sinphi, par.e);
if (secant) { /* secant cone */
@@ -239,10 +233,9 @@ namespace projections
struct lcc_ellipsoid : public detail::lcc::base_lcc_ellipsoid<T, Parameters>
{
template <typename Params>
inline lcc_ellipsoid(Params const& params, Parameters const& par)
: detail::lcc::base_lcc_ellipsoid<T, Parameters>(par)
inline lcc_ellipsoid(Params const& params, Parameters & par)
{
detail::lcc::setup_lcc(params, this->m_par, this->m_proj_parm);
detail::lcc::setup_lcc(params, par, this->m_proj_parm);
}
};
@@ -251,11 +244,11 @@ namespace projections
{
// Static projection
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_lcc, lcc_ellipsoid, lcc_ellipsoid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_FI(srs::spar::proj_lcc, lcc_ellipsoid)
// Factory entry(s)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(lcc_entry, lcc_ellipsoid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(lcc_init)
{
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(lcc, lcc_entry);

View File

@@ -2,8 +2,8 @@
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2017, 2018.
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
// This file was modified by Oracle on 2017, 2018, 2019.
// Modifications copyright (c) 2017-2019, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
// Use, modification and distribution is subject to the Boost Software License,
@@ -125,39 +125,33 @@ namespace projections
return(1. + 3.* S * S * C);
}
// template class, using CRTP to implement forward/inverse
template <typename T, typename Parameters>
struct base_lcca_ellipsoid
: public base_t_fi<base_lcca_ellipsoid<T, Parameters>, T, Parameters>
{
par_lcca<T> m_proj_parm;
inline base_lcca_ellipsoid(const Parameters& par)
: base_t_fi<base_lcca_ellipsoid<T, Parameters>, T, Parameters>(*this, par)
{}
// FORWARD(e_forward) ellipsoid
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
inline void fwd(T lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
inline void fwd(Parameters const& par, T lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
{
T S, r, dr;
S = pj_mlfn(lp_lat, sin(lp_lat), cos(lp_lat), this->m_proj_parm.en) - this->m_proj_parm.M0;
dr = fS(S, this->m_proj_parm.C);
r = this->m_proj_parm.r0 - dr;
xy_x = this->m_par.k0 * (r * sin( lp_lon *= this->m_proj_parm.l ) );
xy_y = this->m_par.k0 * (this->m_proj_parm.r0 - r * cos(lp_lon) );
xy_x = par.k0 * (r * sin( lp_lon *= this->m_proj_parm.l ) );
xy_y = par.k0 * (this->m_proj_parm.r0 - r * cos(lp_lon) );
}
// 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(Parameters const& par, T xy_x, T xy_y, T& lp_lon, T& lp_lat) const
{
T theta, dr, S, dif;
int i;
xy_x /= this->m_par.k0;
xy_y /= this->m_par.k0;
xy_x /= par.k0;
xy_y /= par.k0;
theta = atan2(xy_x , this->m_proj_parm.r0 - xy_y);
dr = xy_y - xy_x * tan(0.5 * theta);
lp_lon = theta / this->m_proj_parm.l;
@@ -169,7 +163,7 @@ namespace projections
if (!i) {
BOOST_THROW_EXCEPTION( projection_exception(error_tolerance_condition) );
}
lp_lat = pj_inv_mlfn(S + this->m_proj_parm.M0, this->m_par.es, this->m_proj_parm.en);
lp_lat = pj_inv_mlfn(S + this->m_proj_parm.M0, par.es, this->m_proj_parm.en);
}
static inline std::string get_name()
@@ -181,12 +175,12 @@ namespace projections
// Lambert Conformal Conic Alternative
template <typename Parameters, typename T>
inline void setup_lcca(Parameters& par, par_lcca<T>& proj_parm)
inline void setup_lcca(Parameters const& par, par_lcca<T>& proj_parm)
{
T s2p0, N0, R0, tan0;
proj_parm.en = pj_enfn<T>(par.es);
if (par.phi0 == 0.) {
BOOST_THROW_EXCEPTION( projection_exception(error_lat_0_is_zero) );
}
@@ -224,9 +218,8 @@ namespace projections
{
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);
detail::lcca::setup_lcca(par, this->m_proj_parm);
}
};
@@ -235,11 +228,11 @@ namespace projections
{
// Static projection
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_lcca, lcca_ellipsoid, lcca_ellipsoid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_FI(srs::spar::proj_lcca, lcca_ellipsoid)
// Factory entry(s)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(lcca_entry, lcca_ellipsoid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(lcca_init)
{
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(lcca, lcca_entry)

View File

@@ -2,8 +2,8 @@
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2017, 2018.
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
// This file was modified by Oracle on 2017, 2018, 2019.
// Modifications copyright (c) 2017-2019, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
// Use, modification and distribution is subject to the Boost Software License,
@@ -66,20 +66,14 @@ namespace projections
T tanphi1;
};
// template class, using CRTP to implement forward/inverse
template <typename T, typename Parameters>
struct base_loxim_spheroid
: public base_t_fi<base_loxim_spheroid<T, Parameters>, T, Parameters>
{
par_loxim<T> m_proj_parm;
inline base_loxim_spheroid(const Parameters& par)
: base_t_fi<base_loxim_spheroid<T, Parameters>, T, Parameters>(*this, par)
{}
// FORWARD(s_forward) spheroid
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
inline void fwd(Parameters const& , 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>();
@@ -98,7 +92,7 @@ namespace projections
// INVERSE(s_inverse) spheroid
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
inline void inv(Parameters const&, 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>();
@@ -159,10 +153,9 @@ namespace projections
struct loxim_spheroid : public detail::loxim::base_loxim_spheroid<T, Parameters>
{
template <typename Params>
inline loxim_spheroid(Params const& params, Parameters const& par)
: detail::loxim::base_loxim_spheroid<T, Parameters>(par)
inline loxim_spheroid(Params const& params, Parameters & par)
{
detail::loxim::setup_loxim(params, this->m_par, this->m_proj_parm);
detail::loxim::setup_loxim(params, par, this->m_proj_parm);
}
};
@@ -171,11 +164,11 @@ namespace projections
{
// Static projection
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_loxim, loxim_spheroid, loxim_spheroid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_FI(srs::spar::proj_loxim, loxim_spheroid)
// Factory entry(s)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(loxim_entry, loxim_spheroid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(loxim_init)
{
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(loxim, loxim_entry)

View File

@@ -2,8 +2,8 @@
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2017, 2018.
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
// This file was modified by Oracle on 2017, 2018, 2019.
// Modifications copyright (c) 2017-2019, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
// Use, modification and distribution is subject to the Boost Software License,
@@ -93,20 +93,14 @@ namespace projections
proj_parm.c3 += fc * cos(lam * 3.);
}
// template class, using CRTP to implement forward/inverse
template <typename T, typename Parameters>
struct base_lsat_ellipsoid
: public base_t_fi<base_lsat_ellipsoid<T, Parameters>, T, Parameters>
{
par_lsat<T> m_proj_parm;
inline base_lsat_ellipsoid(const Parameters& par)
: base_t_fi<base_lsat_ellipsoid<T, Parameters>, T, Parameters>(*this, par)
{}
// FORWARD(e_forward) ellipsoid
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
inline void fwd(T const& lp_lon, T lp_lat, T& xy_x, T& xy_y) const
inline void fwd(Parameters const& par, 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>();
@@ -143,7 +137,7 @@ namespace projections
c = cos(lamt);
if (fabs(c) < tolerance)
lamt -= tolerance;
xlam = (this->m_par.one_es * tanphi * this->m_proj_parm.sa + sin(lamt) * this->m_proj_parm.ca) / c;
xlam = (par.one_es * tanphi * this->m_proj_parm.sa + sin(lamt) * this->m_proj_parm.ca) / c;
lamdp = atan(xlam) + fac;
if (fabs(fabs(sav) - fabs(lamdp)) < tolerance)
break;
@@ -158,8 +152,8 @@ namespace projections
}
if (l) {
sp = sin(lp_lat);
phidp = aasin((this->m_par.one_es * this->m_proj_parm.ca * sp - this->m_proj_parm.sa * cos(lp_lat) *
sin(lamt)) / sqrt(1. - this->m_par.es * sp * sp));
phidp = aasin((par.one_es * this->m_proj_parm.ca * sp - this->m_proj_parm.sa * cos(lp_lat) *
sin(lamt)) / sqrt(1. - par.es * sp * sp));
tanph = log(tan(fourth_pi + .5 * phidp));
sd = sin(lamdp);
sdsq = sd * sd;
@@ -175,7 +169,7 @@ namespace projections
// INVERSE(e_inverse) ellipsoid
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
inline void inv(Parameters const& par, 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>();
@@ -205,7 +199,7 @@ namespace projections
lamdp -= tolerance;
spp = sin(phidp);
sppsq = spp * spp;
lamt = atan(((1. - sppsq * this->m_par.rone_es) * tan(lamdp) *
lamt = atan(((1. - sppsq * par.rone_es) * tan(lamdp) *
this->m_proj_parm.ca - spp * this->m_proj_parm.sa * sqrt((1. + this->m_proj_parm.q * dd) * (
1. - sppsq) - sppsq * this->m_proj_parm.u) / cos(lamdp)) / (1. - sppsq
* (1. + this->m_proj_parm.u)));
@@ -214,10 +208,10 @@ namespace projections
lamt -= half_pi * (1. - scl) * sl;
lp_lon = lamt - this->m_proj_parm.p22 * lamdp;
if (fabs(this->m_proj_parm.sa) < tolerance)
lp_lat = aasin(spp / sqrt(this->m_par.one_es * this->m_par.one_es + this->m_par.es * sppsq));
lp_lat = aasin(spp / sqrt(par.one_es * par.one_es + par.es * sppsq));
else
lp_lat = atan((tan(lamdp) * cos(lamt) - this->m_proj_parm.ca * sin(lamt)) /
(this->m_par.one_es * this->m_proj_parm.sa));
(par.one_es * this->m_proj_parm.sa));
}
static inline std::string get_name()
@@ -307,10 +301,9 @@ namespace projections
struct lsat_ellipsoid : public detail::lsat::base_lsat_ellipsoid<T, Parameters>
{
template <typename Params>
inline lsat_ellipsoid(Params const& params, Parameters const& par)
: detail::lsat::base_lsat_ellipsoid<T, Parameters>(par)
inline lsat_ellipsoid(Params const& params, Parameters & par)
{
detail::lsat::setup_lsat(params, this->m_par, this->m_proj_parm);
detail::lsat::setup_lsat(params, par, this->m_proj_parm);
}
};
@@ -319,11 +312,11 @@ namespace projections
{
// Static projection
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_lsat, lsat_ellipsoid, lsat_ellipsoid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_FI(srs::spar::proj_lsat, lsat_ellipsoid)
// Factory entry(s)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(lsat_entry, lsat_ellipsoid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(lsat_init)
{
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(lsat, lsat_entry)

View File

@@ -2,8 +2,8 @@
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2017, 2018.
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
// This file was modified by Oracle on 2017, 2018, 2019.
// Modifications copyright (c) 2017-2019, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
// Use, modification and distribution is subject to the Boost Software License,
@@ -67,18 +67,12 @@ namespace projections
template <typename T>
inline T C1_2() { return detail::third<T>(); }
// template class, using CRTP to implement forward/inverse
template <typename T, typename Parameters>
struct base_mbt_fps_spheroid
: public base_t_fi<base_mbt_fps_spheroid<T, Parameters>, T, Parameters>
{
inline base_mbt_fps_spheroid(const Parameters& par)
: base_t_fi<base_mbt_fps_spheroid<T, Parameters>, T, Parameters>(*this, par)
{}
// FORWARD(s_forward) spheroid
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
inline void fwd(T const& lp_lon, T lp_lat, T& xy_x, T& xy_y) const
inline void fwd(Parameters const& , T const& lp_lon, T lp_lat, T& xy_x, T& xy_y) const
{
static const T C1_2 = mbt_fps::C1_2<T>();
@@ -100,7 +94,7 @@ namespace projections
// INVERSE(s_inverse) spheroid
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
inline void inv(Parameters const&, T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
{
T t;
@@ -142,10 +136,9 @@ namespace projections
struct mbt_fps_spheroid : public detail::mbt_fps::base_mbt_fps_spheroid<T, Parameters>
{
template <typename Params>
inline mbt_fps_spheroid(Params const& , Parameters const& par)
: detail::mbt_fps::base_mbt_fps_spheroid<T, Parameters>(par)
inline mbt_fps_spheroid(Params const& , Parameters & par)
{
detail::mbt_fps::setup_mbt_fps(this->m_par);
detail::mbt_fps::setup_mbt_fps(par);
}
};
@@ -154,11 +147,11 @@ namespace projections
{
// Static projection
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_mbt_fps, mbt_fps_spheroid, mbt_fps_spheroid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_FI(srs::spar::proj_mbt_fps, mbt_fps_spheroid)
// Factory entry(s)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(mbt_fps_entry, mbt_fps_spheroid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(mbt_fps_init)
{
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(mbt_fps, mbt_fps_entry)

View File

@@ -2,8 +2,8 @@
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2017, 2018.
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
// This file was modified by Oracle on 2017, 2018, 2019.
// Modifications copyright (c) 2017-2019, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
// Use, modification and distribution is subject to the Boost Software License,
@@ -63,18 +63,12 @@ namespace projections
//static const double C13 = .33333333333333333333;
static const double one_plus_eps = 1.0000001;
// template class, using CRTP to implement forward/inverse
template <typename T, typename Parameters>
struct base_mbtfpp_spheroid
: public base_t_fi<base_mbtfpp_spheroid<T, Parameters>, T, Parameters>
{
inline base_mbtfpp_spheroid(const Parameters& par)
: base_t_fi<base_mbtfpp_spheroid<T, Parameters>, T, Parameters>(*this, par)
{}
// FORWARD(s_forward) spheroid
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
inline void fwd(T const& lp_lon, T lp_lat, T& xy_x, T& xy_y) const
inline void fwd(Parameters const& , 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>();
@@ -86,7 +80,7 @@ namespace projections
// INVERSE(s_inverse) spheroid
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
inline void inv(Parameters const& , 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>();
@@ -145,10 +139,9 @@ namespace projections
struct mbtfpp_spheroid : public detail::mbtfpp::base_mbtfpp_spheroid<T, Parameters>
{
template <typename Params>
inline mbtfpp_spheroid(Params const& , Parameters const& par)
: detail::mbtfpp::base_mbtfpp_spheroid<T, Parameters>(par)
inline mbtfpp_spheroid(Params const& , Parameters & par)
{
detail::mbtfpp::setup_mbtfpp(this->m_par);
detail::mbtfpp::setup_mbtfpp(par);
}
};
@@ -157,11 +150,11 @@ namespace projections
{
// Static projection
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_mbtfpp, mbtfpp_spheroid, mbtfpp_spheroid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_FI(srs::spar::proj_mbtfpp, mbtfpp_spheroid)
// Factory entry(s)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(mbtfpp_entry, mbtfpp_spheroid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(mbtfpp_init)
{
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(mbtfpp, mbtfpp_entry)

View File

@@ -2,8 +2,8 @@
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2017, 2018.
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
// This file was modified by Oracle on 2017, 2018, 2019.
// Modifications copyright (c) 2017-2019, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
// Use, modification and distribution is subject to the Boost Software License,
@@ -66,18 +66,12 @@ namespace projections
static const double FXC = 0.31245971410378249250;
static const double RXC = 3.20041258076506210122;
// template class, using CRTP to implement forward/inverse
template <typename T, typename Parameters>
struct base_mbtfpq_spheroid
: public base_t_fi<base_mbtfpq_spheroid<T, Parameters>, T, Parameters>
{
inline base_mbtfpq_spheroid(const Parameters& par)
: base_t_fi<base_mbtfpq_spheroid<T, Parameters>, T, Parameters>(*this, par)
{}
// FORWARD(s_forward) spheroid
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
inline void fwd(T const& lp_lon, T lp_lat, T& xy_x, T& xy_y) const
inline void fwd(Parameters const& , T const& lp_lon, T lp_lat, T& xy_x, T& xy_y) const
{
T th1, c;
int i;
@@ -94,7 +88,7 @@ namespace projections
// INVERSE(s_inverse) spheroid
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
inline void inv(Parameters const& , 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>();
@@ -156,10 +150,9 @@ namespace projections
struct mbtfpq_spheroid : public detail::mbtfpq::base_mbtfpq_spheroid<T, Parameters>
{
template <typename Params>
inline mbtfpq_spheroid(Params const& , Parameters const& par)
: detail::mbtfpq::base_mbtfpq_spheroid<T, Parameters>(par)
inline mbtfpq_spheroid(Params const& , Parameters & par)
{
detail::mbtfpq::setup_mbtfpq(this->m_par);
detail::mbtfpq::setup_mbtfpq(par);
}
};
@@ -168,11 +161,11 @@ namespace projections
{
// Static projection
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_mbtfpq, mbtfpq_spheroid, mbtfpq_spheroid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_FI(srs::spar::proj_mbtfpq, mbtfpq_spheroid)
// Factory entry(s)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(mbtfpq_entry, mbtfpq_spheroid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(mbtfpq_init)
{
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(mbtfpq, mbtfpq_entry)

View File

@@ -2,8 +2,9 @@
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2017, 2018.
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
// This file was modified by Oracle on 2017, 2018, 2019, 2022.
// Modifications copyright (c) 2017-2022, Oracle and/or its affiliates.
// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
// Use, modification and distribution is subject to the Boost Software License,
@@ -62,36 +63,30 @@ namespace projections
static const double epsilon10 = 1.e-10;
// template class, using CRTP to implement forward/inverse
template <typename T, typename Parameters>
struct base_merc_ellipsoid
: public base_t_fi<base_merc_ellipsoid<T, Parameters>, T, Parameters>
{
inline base_merc_ellipsoid(const Parameters& par)
: base_t_fi<base_merc_ellipsoid<T, Parameters>, T, Parameters>(*this, par)
{}
// FORWARD(e_forward) ellipsoid
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
inline void fwd(Parameters const& par, T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
{
static const T half_pi = detail::half_pi<T>();
if (fabs(fabs(lp_lat) - half_pi) <= epsilon10) {
BOOST_THROW_EXCEPTION( projection_exception(error_tolerance_condition) );
}
xy_x = this->m_par.k0 * lp_lon;
xy_y = - this->m_par.k0 * log(pj_tsfn(lp_lat, sin(lp_lat), this->m_par.e));
xy_x = par.k0 * lp_lon;
xy_y = - par.k0 * log(pj_tsfn(lp_lat, sin(lp_lat), par.e));
}
// INVERSE(e_inverse) ellipsoid
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
inline void inv(Parameters const& par, 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) {
if ((lp_lat = pj_phi2(exp(- xy_y / par.k0), par.e)) == HUGE_VAL) {
BOOST_THROW_EXCEPTION( projection_exception(error_tolerance_condition) );
}
lp_lon = xy_x / this->m_par.k0;
lp_lon = xy_x / par.k0;
}
static inline std::string get_name()
@@ -101,18 +96,12 @@ namespace projections
};
// template class, using CRTP to implement forward/inverse
template <typename T, typename Parameters>
struct base_merc_spheroid
: public base_t_fi<base_merc_spheroid<T, Parameters>, T, Parameters>
{
inline base_merc_spheroid(const Parameters& par)
: base_t_fi<base_merc_spheroid<T, Parameters>, T, Parameters>(*this, par)
{}
// FORWARD(s_forward) spheroid
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
inline void fwd(Parameters const& par, 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>();
@@ -120,18 +109,18 @@ namespace projections
if (fabs(fabs(lp_lat) - half_pi) <= epsilon10) {
BOOST_THROW_EXCEPTION( projection_exception(error_tolerance_condition) );
}
xy_x = this->m_par.k0 * lp_lon;
xy_y = this->m_par.k0 * log(tan(fourth_pi + .5 * lp_lat));
xy_x = par.k0 * lp_lon;
xy_y = par.k0 * log(tan(fourth_pi + .5 * lp_lat));
}
// INVERSE(s_inverse) spheroid
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
inline void inv(Parameters const& par, T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
{
static const T half_pi = detail::half_pi<T>();
lp_lat = half_pi - 2. * atan(exp(-xy_y / this->m_par.k0));
lp_lon = xy_x / this->m_par.k0;
lp_lat = half_pi - 2. * atan(exp(-xy_y / par.k0));
lp_lon = xy_x / par.k0;
}
static inline std::string get_name()
@@ -187,10 +176,9 @@ namespace projections
struct merc_ellipsoid : public detail::merc::base_merc_ellipsoid<T, Parameters>
{
template <typename Params>
inline merc_ellipsoid(Params const& params, Parameters const& par)
: detail::merc::base_merc_ellipsoid<T, Parameters>(par)
inline merc_ellipsoid(Params const& params, Parameters & par)
{
detail::merc::setup_merc(params, this->m_par);
detail::merc::setup_merc(params, par);
}
};
@@ -213,10 +201,30 @@ namespace projections
struct merc_spheroid : public detail::merc::base_merc_spheroid<T, Parameters>
{
template <typename Params>
inline merc_spheroid(Params const& params, Parameters const& par)
: detail::merc::base_merc_spheroid<T, Parameters>(par)
inline merc_spheroid(Params const& params, Parameters & par)
{
detail::merc::setup_merc(params, this->m_par);
detail::merc::setup_merc(params, par);
}
};
/*!
\brief Web Mercator projection
\ingroup projections
\tparam Geographic latlong point type
\tparam Cartesian xy point type
\tparam Parameters parameter type
\par Projection characteristics
- Cylindrical
- Spheroid
- Ellipsoid
*/
template <typename T, typename Parameters>
struct webmerc_spheroid : public detail::merc::base_merc_spheroid<T, Parameters>
{
template <typename Params>
inline webmerc_spheroid(Params const&, Parameters & par)
{
par.k0 = 1;
}
};
@@ -225,14 +233,20 @@ namespace projections
{
// Static projection
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_merc, merc_spheroid, merc_ellipsoid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_FI2(srs::spar::proj_merc, merc_spheroid,
merc_ellipsoid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_FI(srs::spar::proj_webmerc,
webmerc_spheroid)
// Factory entry(s)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI2(merc_entry, merc_spheroid, merc_ellipsoid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI2(merc_entry, merc_spheroid,
merc_ellipsoid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(webmerc_entry, webmerc_spheroid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(merc_init)
{
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(merc, merc_entry)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(webmerc, webmerc_entry)
}
} // namespace detail
@@ -243,4 +257,3 @@ namespace projections
}} // namespace boost::geometry
#endif // BOOST_GEOMETRY_PROJECTIONS_MERC_HPP

View File

@@ -2,8 +2,8 @@
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2017, 2018.
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
// This file was modified by Oracle on 2017, 2018, 2019.
// Modifications copyright (c) 2017-2019, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
// Use, modification and distribution is subject to the Boost Software License,
@@ -53,18 +53,12 @@ namespace projections
#ifndef DOXYGEN_NO_DETAIL
namespace detail { namespace mill
{
// template class, using CRTP to implement forward/inverse
template <typename T, typename Parameters>
struct base_mill_spheroid
: public base_t_fi<base_mill_spheroid<T, Parameters>, T, Parameters>
{
inline base_mill_spheroid(const Parameters& par)
: base_t_fi<base_mill_spheroid<T, Parameters>, T, Parameters>(*this, par)
{}
// FORWARD(s_forward) spheroid
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
inline void fwd(Parameters const& , T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
{
static const T fourth_pi = detail::fourth_pi<T>();
@@ -74,7 +68,7 @@ namespace projections
// INVERSE(s_inverse) spheroid
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
inline void inv(Parameters const& , T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
{
static const T fourth_pi = detail::fourth_pi<T>();
@@ -115,10 +109,9 @@ namespace projections
struct mill_spheroid : public detail::mill::base_mill_spheroid<T, Parameters>
{
template <typename Params>
inline mill_spheroid(Params const& , Parameters const& par)
: detail::mill::base_mill_spheroid<T, Parameters>(par)
inline mill_spheroid(Params const& , Parameters & par)
{
detail::mill::setup_mill(this->m_par);
detail::mill::setup_mill(par);
}
};
@@ -127,7 +120,7 @@ namespace projections
{
// Static projection
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_mill, mill_spheroid, mill_spheroid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_FI(srs::spar::proj_mill, mill_spheroid)
// Factory entry(s)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(mill_entry, mill_spheroid)
@@ -136,7 +129,7 @@ namespace projections
{
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(mill, mill_entry)
}
} // namespace detail
#endif // doxygen

View File

@@ -2,8 +2,8 @@
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2017, 2018.
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
// This file was modified by Oracle on 2017, 2018, 2019.
// Modifications copyright (c) 2017-2019, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
// Use, modification and distribution is subject to the Boost Software License,
@@ -64,27 +64,21 @@ namespace projections
template <typename T>
struct par_mod_ster
{
pj_complex<T> *zcoeff;
T cchio, schio;
int n;
T cchio, schio;
pj_complex<T>* zcoeff;
int n;
};
/* based upon Snyder and Linck, USGS-NMD */
// template class, using CRTP to implement forward/inverse
template <typename T, typename Parameters>
struct base_mod_ster_ellipsoid
: public base_t_fi<base_mod_ster_ellipsoid<T, Parameters>, T, Parameters>
{
par_mod_ster<T> m_proj_parm;
inline base_mod_ster_ellipsoid(const Parameters& par)
: base_t_fi<base_mod_ster_ellipsoid<T, Parameters>, T, Parameters>(*this, par)
{}
// FORWARD(e_forward) ellipsoid
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
inline void fwd(Parameters const& par, T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
{
static const T half_pi = detail::half_pi<T>();
@@ -93,9 +87,9 @@ namespace projections
sinlon = sin(lp_lon);
coslon = cos(lp_lon);
esphi = this->m_par.e * sin(lp_lat);
esphi = par.e * sin(lp_lat);
chi = 2. * atan(tan((half_pi + lp_lat) * .5) *
math::pow((T(1) - esphi) / (T(1) + esphi), this->m_par.e * T(0.5))) - half_pi;
math::pow((T(1) - esphi) / (T(1) + esphi), par.e * T(0.5))) - half_pi;
schi = sin(chi);
cchi = cos(chi);
s = 2. / (1. + this->m_proj_parm.schio * schi + this->m_proj_parm.cchio * cchi * coslon);
@@ -108,7 +102,7 @@ namespace projections
// INVERSE(e_inverse) ellipsoid
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
inline void inv(Parameters const& par, T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
{
static const T half_pi = detail::half_pi<T>();
@@ -135,21 +129,21 @@ namespace projections
z = 2. * atan(.5 * rh);
sinz = sin(z);
cosz = cos(z);
lp_lon = this->m_par.lam0;
lp_lon = par.lam0;
if (fabs(rh) <= epsilon) {
/* if we end up here input coordinates were (0,0).
* pj_inv() adds P->lam0 to lp.lam, this way we are
* sure to get the correct offset */
lp_lon = 0.0;
lp_lat = this->m_par.phi0;
lp_lat = par.phi0;
return;
}
chi = aasin(cosz * this->m_proj_parm.schio + p.i * sinz * this->m_proj_parm.cchio / rh);
phi = chi;
for (nn = 20; nn ;--nn) {
esphi = this->m_par.e * sin(phi);
esphi = par.e * sin(phi);
dphi = 2. * atan(tan((half_pi + chi) * .5) *
math::pow((T(1) + esphi) / (T(1) - esphi), this->m_par.e * T(0.5))) - half_pi - phi;
math::pow((T(1) + esphi) / (T(1) - esphi), par.e * T(0.5))) - half_pi - phi;
phi += dphi;
if (fabs(dphi) <= epsilon)
break;
@@ -357,10 +351,9 @@ namespace projections
struct mil_os_ellipsoid : public detail::mod_ster::base_mod_ster_ellipsoid<T, Parameters>
{
template <typename Params>
inline mil_os_ellipsoid(Params const& , Parameters const& par)
: detail::mod_ster::base_mod_ster_ellipsoid<T, Parameters>(par)
inline mil_os_ellipsoid(Params const& , Parameters & par)
{
detail::mod_ster::setup_mil_os(this->m_par, this->m_proj_parm);
detail::mod_ster::setup_mil_os(par, this->m_proj_parm);
}
};
@@ -379,10 +372,9 @@ namespace projections
struct lee_os_ellipsoid : public detail::mod_ster::base_mod_ster_ellipsoid<T, Parameters>
{
template <typename Params>
inline lee_os_ellipsoid(Params const& , Parameters const& par)
: detail::mod_ster::base_mod_ster_ellipsoid<T, Parameters>(par)
inline lee_os_ellipsoid(Params const& , Parameters & par)
{
detail::mod_ster::setup_lee_os(this->m_par, this->m_proj_parm);
detail::mod_ster::setup_lee_os(par, this->m_proj_parm);
}
};
@@ -401,10 +393,9 @@ namespace projections
struct gs48_ellipsoid : public detail::mod_ster::base_mod_ster_ellipsoid<T, Parameters>
{
template <typename Params>
inline gs48_ellipsoid(Params const& , Parameters const& par)
: detail::mod_ster::base_mod_ster_ellipsoid<T, Parameters>(par)
inline gs48_ellipsoid(Params const& , Parameters & par)
{
detail::mod_ster::setup_gs48(this->m_par, this->m_proj_parm);
detail::mod_ster::setup_gs48(par, this->m_proj_parm);
}
};
@@ -423,10 +414,9 @@ namespace projections
struct alsk_ellipsoid : public detail::mod_ster::base_mod_ster_ellipsoid<T, Parameters>
{
template <typename Params>
inline alsk_ellipsoid(Params const& , Parameters const& par)
: detail::mod_ster::base_mod_ster_ellipsoid<T, Parameters>(par)
inline alsk_ellipsoid(Params const& , Parameters & par)
{
detail::mod_ster::setup_alsk(this->m_par, this->m_proj_parm);
detail::mod_ster::setup_alsk(par, this->m_proj_parm);
}
};
@@ -445,10 +435,9 @@ namespace projections
struct gs50_ellipsoid : public detail::mod_ster::base_mod_ster_ellipsoid<T, Parameters>
{
template <typename Params>
inline gs50_ellipsoid(Params const& , Parameters const& par)
: detail::mod_ster::base_mod_ster_ellipsoid<T, Parameters>(par)
inline gs50_ellipsoid(Params const& , Parameters & par)
{
detail::mod_ster::setup_gs50(this->m_par, this->m_proj_parm);
detail::mod_ster::setup_gs50(par, this->m_proj_parm);
}
};
@@ -457,11 +446,11 @@ namespace projections
{
// Static projection
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)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_FI(srs::spar::proj_mil_os, mil_os_ellipsoid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_FI(srs::spar::proj_lee_os, lee_os_ellipsoid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_FI(srs::spar::proj_gs48, gs48_ellipsoid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_FI(srs::spar::proj_alsk, alsk_ellipsoid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_FI(srs::spar::proj_gs50, gs50_ellipsoid)
// Factory entry(s)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(mil_os_entry, mil_os_ellipsoid)
@@ -469,7 +458,7 @@ namespace projections
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)
{
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(mil_os, mil_os_entry)

View File

@@ -2,8 +2,8 @@
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2017, 2018.
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
// This file was modified by Oracle on 2017, 2018, 2019.
// Modifications copyright (c) 2017-2019, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
// Use, modification and distribution is subject to the Boost Software License,
@@ -66,20 +66,14 @@ namespace projections
T C_x, C_y, C_p;
};
// template class, using CRTP to implement forward/inverse
template <typename T, typename Parameters>
struct base_moll_spheroid
: public base_t_fi<base_moll_spheroid<T, Parameters>, T, Parameters>
{
par_moll<T> m_proj_parm;
inline base_moll_spheroid(const Parameters& par)
: base_t_fi<base_moll_spheroid<T, Parameters>, T, Parameters>(*this, par)
{}
// FORWARD(s_forward) spheroid
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
inline void fwd(T const& lp_lon, T lp_lat, T& xy_x, T& xy_y) const
inline void fwd(Parameters const& , T const& lp_lon, T lp_lat, T& xy_x, T& xy_y) const
{
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 const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
inline void inv(Parameters const& , T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
{
static const T pi = detail::pi<T>();
@@ -125,7 +119,7 @@ namespace projections
};
template <typename Parameters, typename T>
inline void setup(Parameters& par, par_moll<T>& proj_parm, T const& p)
inline void setup(Parameters& par, par_moll<T>& proj_parm, T const& p)
{
T r, sp, p2 = p + p;
@@ -182,10 +176,9 @@ namespace projections
struct moll_spheroid : public detail::moll::base_moll_spheroid<T, Parameters>
{
template <typename Params>
inline moll_spheroid(Params const& , Parameters const& par)
: detail::moll::base_moll_spheroid<T, Parameters>(par)
inline moll_spheroid(Params const& , Parameters & par)
{
detail::moll::setup_moll(this->m_par, this->m_proj_parm);
detail::moll::setup_moll(par, this->m_proj_parm);
}
};
@@ -205,10 +198,9 @@ namespace projections
struct wag4_spheroid : public detail::moll::base_moll_spheroid<T, Parameters>
{
template <typename Params>
inline wag4_spheroid(Params const& , Parameters const& par)
: detail::moll::base_moll_spheroid<T, Parameters>(par)
inline wag4_spheroid(Params const& , Parameters & par)
{
detail::moll::setup_wag4(this->m_par, this->m_proj_parm);
detail::moll::setup_wag4(par, this->m_proj_parm);
}
};
@@ -228,10 +220,9 @@ namespace projections
struct wag5_spheroid : public detail::moll::base_moll_spheroid<T, Parameters>
{
template <typename Params>
inline wag5_spheroid(Params const& , Parameters const& par)
: detail::moll::base_moll_spheroid<T, Parameters>(par)
inline wag5_spheroid(Params const& , Parameters & par)
{
detail::moll::setup_wag5(this->m_par, this->m_proj_parm);
detail::moll::setup_wag5(par, this->m_proj_parm);
}
};
@@ -240,15 +231,15 @@ namespace projections
{
// Static projection
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)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_FI(srs::spar::proj_moll, moll_spheroid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_FI(srs::spar::proj_wag4, wag4_spheroid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_FI(srs::spar::proj_wag5, wag5_spheroid)
// Factory entry(s)
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)
{
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(moll, moll_entry);

View File

@@ -2,8 +2,8 @@
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2017, 2018.
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
// This file was modified by Oracle on 2017, 2018, 2019.
// Modifications copyright (c) 2017-2019, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
// Use, modification and distribution is subject to the Boost Software License,
@@ -90,18 +90,12 @@ namespace projections
/* Not sure at all of the appropriate number for max_iter... */
static const int max_iter = 100;
// template class, using CRTP to implement forward/inverse
template <typename T, typename Parameters>
struct base_natearth_spheroid
: public base_t_fi<base_natearth_spheroid<T, Parameters>, T, Parameters>
{
inline base_natearth_spheroid(const Parameters& par)
: base_t_fi<base_natearth_spheroid<T, Parameters>, T, Parameters>(*this, par)
{}
// FORWARD(s_forward) spheroid
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
inline void fwd(Parameters const& , T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
{
T phi2, phi4;
@@ -113,7 +107,7 @@ namespace projections
// INVERSE(s_inverse) spheroid
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
inline void inv(T const& xy_x, T xy_y, T& lp_lon, T& lp_lat) const
inline void inv(Parameters const& , T const& xy_x, T xy_y, T& lp_lon, T& lp_lat) const
{
static const T max_y = natearth::max_y<T>();
@@ -181,10 +175,9 @@ namespace projections
struct natearth_spheroid : public detail::natearth::base_natearth_spheroid<T, Parameters>
{
template <typename Params>
inline natearth_spheroid(Params const& , Parameters const& par)
: detail::natearth::base_natearth_spheroid<T, Parameters>(par)
inline natearth_spheroid(Params const& , Parameters & par)
{
detail::natearth::setup_natearth(this->m_par);
detail::natearth::setup_natearth(par);
}
};
@@ -193,7 +186,7 @@ namespace projections
{
// Static projection
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_natearth, natearth_spheroid, natearth_spheroid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_FI(srs::spar::proj_natearth, natearth_spheroid)
// Factory entry(s)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(natearth_entry, natearth_spheroid)

View File

@@ -2,8 +2,8 @@
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2017, 2018.
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
// This file was modified by Oracle on 2017, 2018, 2019.
// Modifications copyright (c) 2017-2019, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
// Use, modification and distribution is subject to the Boost Software License,
@@ -58,18 +58,12 @@ namespace projections
static const int max_iter = 10;
static const double loop_tol = 1e-7;
// template class, using CRTP to implement forward/inverse
template <typename T, typename Parameters>
struct base_nell_spheroid
: public base_t_fi<base_nell_spheroid<T, Parameters>, T, Parameters>
{
inline base_nell_spheroid(const Parameters& par)
: base_t_fi<base_nell_spheroid<T, Parameters>, T, Parameters>(*this, par)
{}
// FORWARD(s_forward) spheroid
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
inline void fwd(T const& lp_lon, T lp_lat, T& xy_x, T& xy_y) const
inline void fwd(Parameters const& , T const& lp_lon, T lp_lat, T& xy_x, T& xy_y) const
{
T k, V;
int i;
@@ -89,7 +83,7 @@ namespace projections
// INVERSE(s_inverse) spheroid
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
inline void inv(Parameters const& , 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)));
@@ -128,10 +122,9 @@ namespace projections
struct nell_spheroid : public detail::nell::base_nell_spheroid<T, Parameters>
{
template <typename Params>
inline nell_spheroid(Params const& , Parameters const& par)
: detail::nell::base_nell_spheroid<T, Parameters>(par)
inline nell_spheroid(Params const& , Parameters & par)
{
detail::nell::setup_nell(this->m_par);
detail::nell::setup_nell(par);
}
};
@@ -140,7 +133,7 @@ namespace projections
{
// Static projection
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_nell, nell_spheroid, nell_spheroid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_FI(srs::spar::proj_nell, nell_spheroid)
// Factory entry(s)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(nell_entry, nell_spheroid)

View File

@@ -2,8 +2,8 @@
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2017, 2018.
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
// This file was modified by Oracle on 2017, 2018, 2019.
// Modifications copyright (c) 2017-2019, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
// Use, modification and distribution is subject to the Boost Software License,
@@ -59,18 +59,12 @@ namespace projections
static const int n_iter = 9;
static const double epsilon = 1e-7;
// template class, using CRTP to implement forward/inverse
template <typename T, typename Parameters>
struct base_nell_h_spheroid
: public base_t_fi<base_nell_h_spheroid<T, Parameters>, T, Parameters>
{
inline base_nell_h_spheroid(const Parameters& par)
: base_t_fi<base_nell_h_spheroid<T, Parameters>, T, Parameters>(*this, par)
{}
// FORWARD(s_forward) spheroid
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
inline void fwd(Parameters const& , 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));
@@ -78,7 +72,7 @@ namespace projections
// INVERSE(s_inverse) spheroid
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
inline void inv(Parameters const& , T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
{
static const T half_pi = detail::half_pi<T>();
@@ -132,10 +126,9 @@ namespace projections
struct nell_h_spheroid : public detail::nell_h::base_nell_h_spheroid<T, Parameters>
{
template <typename Params>
inline nell_h_spheroid(Params const& , Parameters const& par)
: detail::nell_h::base_nell_h_spheroid<T, Parameters>(par)
inline nell_h_spheroid(Params const& , Parameters & par)
{
detail::nell_h::setup_nell_h(this->m_par);
detail::nell_h::setup_nell_h(par);
}
};
@@ -144,7 +137,7 @@ namespace projections
{
// Static projection
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_nell_h, nell_h_spheroid, nell_h_spheroid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_FI(srs::spar::proj_nell_h, nell_h_spheroid)
// Factory entry(s)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(nell_h_entry, nell_h_spheroid)

View File

@@ -2,8 +2,8 @@
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2017, 2018.
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
// This file was modified by Oracle on 2017, 2018, 2019.
// Modifications copyright (c) 2017-2019, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
// Use, modification and distribution is subject to the Boost Software License,
@@ -58,18 +58,12 @@ namespace projections
static const double epsilon = 1e-10;
// template class, using CRTP to implement forward/inverse
template <typename T, typename Parameters>
struct base_nocol_spheroid
: public base_t_f<base_nocol_spheroid<T, Parameters>, T, Parameters>
{
inline base_nocol_spheroid(const Parameters& par)
: base_t_f<base_nocol_spheroid<T, Parameters>, T, Parameters>(*this, par)
{}
// FORWARD(s_forward) spheroid
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
inline void fwd(Parameters const& , T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
{
static const T half_pi = detail::half_pi<T>();
@@ -138,10 +132,9 @@ namespace projections
struct nicol_spheroid : public detail::nocol::base_nocol_spheroid<T, Parameters>
{
template <typename Params>
inline nicol_spheroid(Params const& , Parameters const& par)
: detail::nocol::base_nocol_spheroid<T, Parameters>(par)
inline nicol_spheroid(Params const& , Parameters & par)
{
detail::nocol::setup_nicol(this->m_par);
detail::nocol::setup_nicol(par);
}
};
@@ -150,7 +143,7 @@ namespace projections
{
// Static projection
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_nicol, nicol_spheroid, nicol_spheroid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_F(srs::spar::proj_nicol, nicol_spheroid)
// Factory entry(s)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_F(nicol_entry, nicol_spheroid)

View File

@@ -2,8 +2,8 @@
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2017, 2018.
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
// This file was modified by Oracle on 2017, 2018, 2019.
// Modifications copyright (c) 2017-2019, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
// Use, modification and distribution is subject to the Boost Software License,
@@ -85,23 +85,17 @@ namespace projections
T sw;
T cw;
mode_type mode;
int tilt;
bool tilt;
};
// template class, using CRTP to implement forward/inverse
template <typename T, typename Parameters>
struct base_nsper_spheroid
: public base_t_fi<base_nsper_spheroid<T, Parameters>, T, Parameters>
{
par_nsper<T> m_proj_parm;
inline base_nsper_spheroid(const Parameters& par)
: base_t_fi<base_nsper_spheroid<T, Parameters>, T, Parameters>(*this, par)
{}
// FORWARD(s_forward) spheroid
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
inline void fwd(Parameters const& , T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
{
T coslam, cosphi, sinphi;
@@ -154,7 +148,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(Parameters const& par, T xy_x, T xy_y, T& lp_lon, T& lp_lat) const
{
T rh, cosz, sinz;
@@ -175,7 +169,7 @@ namespace projections
cosz = sqrt(1. - sinz * sinz);
if (fabs(rh) <= epsilon10) {
lp_lon = 0.;
lp_lat = this->m_par.phi0;
lp_lat = par.phi0;
} else {
switch (this->m_proj_parm.mode) {
case obliq:
@@ -208,7 +202,7 @@ namespace projections
};
template <typename Params, typename Parameters, typename T>
inline void setup(Params const& params, Parameters& par, par_nsper<T>& proj_parm)
inline void setup(Params const& params, Parameters& par, par_nsper<T>& proj_parm)
{
proj_parm.height = pj_get_param_f<T, srs::spar::h>(params, "h", srs::dpar::h);
if (proj_parm.height <= 0.)
@@ -236,7 +230,7 @@ namespace projections
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;
proj_parm.tilt = false;
setup(params, par, proj_parm);
}
@@ -247,7 +241,7 @@ namespace projections
{
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.tilt = true;
proj_parm.cg = cos(gamma); proj_parm.sg = sin(gamma);
proj_parm.cw = cos(omega); proj_parm.sw = sin(omega);
@@ -275,10 +269,9 @@ namespace projections
struct nsper_spheroid : public detail::nsper::base_nsper_spheroid<T, Parameters>
{
template <typename Params>
inline nsper_spheroid(Params const& params, Parameters const& par)
: detail::nsper::base_nsper_spheroid<T, Parameters>(par)
inline nsper_spheroid(Params const& params, Parameters & par)
{
detail::nsper::setup_nsper(params, this->m_par, this->m_proj_parm);
detail::nsper::setup_nsper(params, par, this->m_proj_parm);
}
};
@@ -302,10 +295,9 @@ namespace projections
struct tpers_spheroid : public detail::nsper::base_nsper_spheroid<T, Parameters>
{
template <typename Params>
inline tpers_spheroid(Params const& params, Parameters const& par)
: detail::nsper::base_nsper_spheroid<T, Parameters>(par)
inline tpers_spheroid(Params const& params, Parameters & par)
{
detail::nsper::setup_tpers(params, this->m_par, this->m_proj_parm);
detail::nsper::setup_tpers(params, par, this->m_proj_parm);
}
};
@@ -314,8 +306,8 @@ namespace projections
{
// Static projection
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)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_F(srs::spar::proj_nsper, nsper_spheroid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_F(srs::spar::proj_tpers, tpers_spheroid)
// Factory entry(s)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(nsper_entry, nsper_spheroid)

View File

@@ -2,8 +2,8 @@
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2017, 2018.
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
// This file was modified by Oracle on 2017, 2018, 2019.
// Modifications copyright (c) 2017-2019, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
// Use, modification and distribution is subject to the Boost Software License,
@@ -102,18 +102,12 @@ namespace projections
return result;
}
// template class, using CRTP to implement forward/inverse
template <typename T, typename Parameters>
struct base_nzmg_ellipsoid
: public base_t_fi<base_nzmg_ellipsoid<T, Parameters>, T, Parameters>
{
inline base_nzmg_ellipsoid(const Parameters& par)
: base_t_fi<base_nzmg_ellipsoid<T, Parameters>, T, Parameters>(*this, par)
{}
// FORWARD(e_forward) ellipsoid
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
inline void fwd(T const& lp_lon, T lp_lat, T& xy_x, T& xy_y) const
inline void fwd(Parameters const& par, 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>();
@@ -121,7 +115,7 @@ namespace projections
const T * C;
int i;
lp_lat = (lp_lat - this->m_par.phi0) * rad_to_sec5;
lp_lat = (lp_lat - par.phi0) * rad_to_sec5;
for (p.r = *(C = tpsi<T>() + (i = Ntpsi)); i ; --i)
p.r = *--C + lp_lat * p.r;
p.r *= lp_lat;
@@ -133,7 +127,7 @@ namespace projections
// INVERSE(e_inverse) ellipsoid
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
inline void inv(Parameters const& par, 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>();
@@ -158,7 +152,7 @@ namespace projections
lp_lon = p.i;
for (lp_lat = *(C = tphi<T>() + (i = Ntphi)); i ; --i)
lp_lat = *--C + p.r * lp_lat;
lp_lat = this->m_par.phi0 + p.r * lp_lat * sec5_to_rad;
lp_lat = par.phi0 + p.r * lp_lat * sec5_to_rad;
} else
lp_lon = lp_lat = HUGE_VAL;
}
@@ -204,10 +198,9 @@ namespace projections
struct nzmg_ellipsoid : public detail::nzmg::base_nzmg_ellipsoid<T, Parameters>
{
template <typename Params>
inline nzmg_ellipsoid(Params const& , Parameters const& par)
: detail::nzmg::base_nzmg_ellipsoid<T, Parameters>(par)
inline nzmg_ellipsoid(Params const& , Parameters & par)
{
detail::nzmg::setup_nzmg(this->m_par);
detail::nzmg::setup_nzmg(par);
}
};
@@ -216,7 +209,7 @@ namespace projections
{
// Static projection
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_nzmg, nzmg_ellipsoid, nzmg_ellipsoid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_FI(srs::spar::proj_nzmg, nzmg_ellipsoid)
// Factory entry(s)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(nzmg_entry, nzmg_ellipsoid)

View File

@@ -1,9 +1,10 @@
// Boost.Geometry - gis-projections (based on PROJ4)
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2023 Adam Wulkiewicz, Lodz, Poland.
// This file was modified by Oracle on 2017, 2018, 2019.
// Modifications copyright (c) 2017-2019, Oracle and/or its affiliates.
// This file was modified by Oracle on 2017-2020.
// Modifications copyright (c) 2017-2020, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
// Use, modification and distribution is subject to the Boost Software License,
@@ -40,15 +41,17 @@
#ifndef BOOST_GEOMETRY_PROJECTIONS_OB_TRAN_HPP
#define BOOST_GEOMETRY_PROJECTIONS_OB_TRAN_HPP
#include <boost/geometry/util/math.hpp>
#include <boost/shared_ptr.hpp>
#include <memory>
#include <type_traits>
#include <boost/geometry/core/static_assert.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/factory_entry.hpp>
#include <boost/geometry/srs/projections/impl/pj_ell_set.hpp>
#include <boost/geometry/srs/projections/impl/projects.hpp>
#include <boost/geometry/util/math.hpp>
namespace boost { namespace geometry
{
@@ -57,15 +60,15 @@ namespace projections
{
#ifndef DOXYGEN_NO_DETAIL
namespace detail {
// fwd declaration needed below
template <typename T>
inline detail::base_v<T, projections::parameters<T> >*
inline detail::dynamic_wrapper_b<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> >*
inline detail::dynamic_wrapper_b<T, projections::parameters<T> >*
create_new(srs::dpar::parameters<T> const& params,
projections::parameters<T> const& parameters);
@@ -127,33 +130,39 @@ namespace projections
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*/,
template <typename ...Ps, typename Parameters>
inline Parameters o_proj_parameters(srs::spar::parameters<Ps...> 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
typedef srs::spar::parameters<Ps...> params_type;
typedef typename geometry::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));
static const bool is_found = geometry::tuples::is_found<o_proj_type>::value;
BOOST_GEOMETRY_STATIC_ASSERT((is_found),
"Rotation projection not specified.",
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));
BOOST_GEOMETRY_STATIC_ASSERT((is_specialized),
"Rotation projection not specified.",
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));
static const bool is_non_resursive = ! std::is_same<proj_type, srs::spar::proj_ob_tran>::value;
BOOST_GEOMETRY_STATIC_ASSERT((is_non_resursive),
"o_proj parameter can not be set to ob_tran projection.",
params_type);
// Commented out for consistency with Proj4 >= 5.0.0
/* force spherical earth */
@@ -163,6 +172,11 @@ namespace projections
return pj;
}
// TODO: It's possible that the original Parameters could be used
// instead of a copy in link.
// But it's not possible with the current implementation of
// dynamic_wrapper_b always storing params
template <typename T, typename Parameters>
struct par_ob_tran
{
@@ -176,15 +190,15 @@ namespace projections
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);
link->fwd(link->params(), lp_lon, lp_lat, xy_x, xy_y);
}
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);
link->inv(link->params(), xy_x, xy_y, lp_lon, lp_lat);
}
boost::shared_ptr<base_v<T, Parameters> > link;
std::shared_ptr<dynamic_wrapper_b<T, Parameters> > link;
T lamp;
T cphip, sphip;
};
@@ -199,8 +213,10 @@ namespace projections
>::type o_proj_tag;
/* avoid endless recursion */
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));
static const bool is_o_proj_not_ob_tran = ! std::is_same<o_proj_tag, srs::spar::proj_ob_tran>::value;
BOOST_GEOMETRY_STATIC_ASSERT((is_o_proj_not_ob_tran),
"o_proj parameter can not be set to ob_tran projection.",
StaticParameters);
typedef typename projections::detail::static_projection_type
<
@@ -219,12 +235,12 @@ namespace projections
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);
link.fwd(link.params(), lp_lon, lp_lat, xy_x, xy_y);
}
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);
link.inv(link.params(), xy_x, xy_y, lp_lon, lp_lat);
}
projection_type link;
@@ -236,7 +252,7 @@ namespace projections
inline void o_forward(T lp_lon, T lp_lat, T& xy_x, T& xy_y, Par const& proj_parm)
{
T coslam, sinphi, cosphi;
coslam = cos(lp_lon);
sinphi = sin(lp_lat);
cosphi = cos(lp_lat);
@@ -309,7 +325,7 @@ namespace projections
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)
BOOST_THROW_EXCEPTION( projection_exception(error_lat_0_or_alpha_eq_90) );
@@ -352,33 +368,28 @@ namespace projections
return phip;
}
// template class, using CRTP to implement forward/inverse
template <typename T, typename Parameters>
struct base_ob_tran_oblique
: public base_t_fi<base_ob_tran_oblique<T, Parameters>, T, Parameters>
{
par_ob_tran<T, Parameters> m_proj_parm;
inline base_ob_tran_oblique(Parameters const& par,
par_ob_tran<T, Parameters> const& proj_parm)
: base_t_fi
<
base_ob_tran_oblique<T, Parameters>, T, Parameters
>(*this, par)
, m_proj_parm(proj_parm)
inline base_ob_tran_oblique(par_ob_tran<T, Parameters> const& proj_parm)
: m_proj_parm(proj_parm)
{}
// FORWARD(o_forward) spheroid
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
inline void fwd(Parameters const& , T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
{
// NOTE: Parameters ignored, m_proj_parm.link has a copy
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 const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
inline void inv(Parameters const& , T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
{
// NOTE: Parameters ignored, m_proj_parm.link has a copy
o_inverse(xy_x, xy_y, lp_lon, lp_lat, this->m_proj_parm);
}
@@ -389,33 +400,28 @@ namespace projections
};
// template class, using CRTP to implement forward/inverse
template <typename T, typename Parameters>
struct base_ob_tran_transverse
: public base_t_fi<base_ob_tran_transverse<T, Parameters>, T, Parameters>
{
par_ob_tran<T, Parameters> m_proj_parm;
inline base_ob_tran_transverse(Parameters const& par,
par_ob_tran<T, Parameters> const& proj_parm)
: base_t_fi
<
base_ob_tran_transverse<T, Parameters>, T, Parameters
>(*this, par)
, m_proj_parm(proj_parm)
inline base_ob_tran_transverse(par_ob_tran<T, Parameters> const& proj_parm)
: m_proj_parm(proj_parm)
{}
// FORWARD(t_forward) spheroid
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
inline void fwd(Parameters const& , T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
{
// NOTE: Parameters ignored, m_proj_parm.link has a copy
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 const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
inline void inv(Parameters const& , T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
{
// NOTE: Parameters ignored, m_proj_parm.link has a copy
t_inverse(xy_x, xy_y, lp_lon, lp_lat, this->m_proj_parm);
}
@@ -426,23 +432,21 @@ namespace projections
};
// template class, using CRTP to implement forward/inverse
template <typename StaticParameters, typename T, typename Parameters>
struct base_ob_tran_static
: public base_t_fi<base_ob_tran_static<StaticParameters, T, Parameters>, T, Parameters>
{
par_ob_tran_static<StaticParameters, T, Parameters> m_proj_parm;
bool m_is_oblique;
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(params, par)
: m_proj_parm(params, par)
{}
// FORWARD(o_forward) spheroid
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
inline void fwd(Parameters const& , T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
{
// NOTE: Parameters ignored, m_proj_parm.link has a copy
if (m_is_oblique) {
o_forward(lp_lon, lp_lat, xy_x, xy_y, this->m_proj_parm);
} else {
@@ -452,8 +456,9 @@ namespace projections
// INVERSE(o_inverse) spheroid
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
inline void inv(Parameters const& , T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
{
// NOTE: Parameters ignored, m_proj_parm.link has a copy
if (m_is_oblique) {
o_inverse(xy_x, xy_y, lp_lon, lp_lat, this->m_proj_parm);
} else {
@@ -499,9 +504,10 @@ namespace projections
template <typename T, typename Parameters>
struct ob_tran_oblique : public detail::ob_tran::base_ob_tran_oblique<T, Parameters>
{
inline ob_tran_oblique(Parameters const& par,
template <typename Params>
inline ob_tran_oblique(Params const& , Parameters const& ,
detail::ob_tran::par_ob_tran<T, Parameters> const& proj_parm)
: detail::ob_tran::base_ob_tran_oblique<T, Parameters>(par, proj_parm)
: detail::ob_tran::base_ob_tran_oblique<T, Parameters>(proj_parm)
{
// already done
//detail::ob_tran::setup_ob_tran(this->m_par, this->m_proj_parm);
@@ -536,9 +542,10 @@ namespace projections
template <typename T, typename Parameters>
struct ob_tran_transverse : public detail::ob_tran::base_ob_tran_transverse<T, Parameters>
{
inline ob_tran_transverse(Parameters const& par,
template <typename Params>
inline ob_tran_transverse(Params const& , Parameters const& ,
detail::ob_tran::par_ob_tran<T, Parameters> const& proj_parm)
: detail::ob_tran::base_ob_tran_transverse<T, Parameters>(par, proj_parm)
: detail::ob_tran::base_ob_tran_transverse<T, Parameters>(proj_parm)
{
// already done
//detail::ob_tran::setup_ob_tran(this->m_par, this->m_proj_parm);
@@ -576,7 +583,7 @@ namespace projections
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>(params, this->m_par, this->m_proj_parm);
T phip = detail::ob_tran::setup_ob_tran<T>(params, par, this->m_proj_parm);
this->m_is_oblique = fabs(phip) > detail::ob_tran::tolerance;
}
};
@@ -589,12 +596,12 @@ namespace projections
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<SP, CT, P> type;
typedef static_wrapper_fi<ob_tran_static<SP, CT, P>, P> type;
};
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<SP, CT, P> type;
typedef static_wrapper_fi<ob_tran_static<SP, CT, P>, P> type;
};
// Factory entry(s)
@@ -605,9 +612,9 @@ namespace projections
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);
return new dynamic_wrapper_fi<ob_tran_oblique<T, Parameters>, T, Parameters>(params, parameters_copy, proj_parm);
else
return new base_v_fi<ob_tran_transverse<T, Parameters>, T, Parameters>(parameters_copy, proj_parm);
return new dynamic_wrapper_fi<ob_tran_transverse<T, Parameters>, T, Parameters>(params, parameters_copy, proj_parm);
}
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_END

View File

@@ -2,8 +2,8 @@
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2017, 2018.
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
// This file was modified by Oracle on 2017, 2018, 2019.
// Modifications copyright (c) 2017-2019, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
// Use, modification and distribution is subject to the Boost Software License,
@@ -67,20 +67,14 @@ namespace projections
T cosgam;
};
// template class, using CRTP to implement forward/inverse
template <typename T, typename Parameters>
struct base_ocea_spheroid
: public base_t_fi<base_ocea_spheroid<T, Parameters>, T, Parameters>
{
par_ocea<T> m_proj_parm;
inline base_ocea_spheroid(const Parameters& par)
: base_t_fi<base_ocea_spheroid<T, Parameters>,
T, Parameters>(*this, par) {}
// FORWARD(s_forward) spheroid
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
inline void fwd(Parameters const& , T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
{
static const T pi = detail::pi<T>();
@@ -97,7 +91,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(Parameters const& , T xy_x, T xy_y, T& lp_lon, T& lp_lat) const
{
T t, s;
@@ -189,10 +183,9 @@ namespace projections
struct ocea_spheroid : public detail::ocea::base_ocea_spheroid<T, Parameters>
{
template <typename Params>
inline ocea_spheroid(Params const& params, Parameters const& par)
: detail::ocea::base_ocea_spheroid<T, Parameters>(par)
inline ocea_spheroid(Params const& params, Parameters & par)
{
detail::ocea::setup_ocea(params, this->m_par, this->m_proj_parm);
detail::ocea::setup_ocea(params, par, this->m_proj_parm);
}
};
@@ -201,7 +194,7 @@ namespace projections
{
// Static projection
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_ocea, ocea_spheroid, ocea_spheroid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_FI(srs::spar::proj_ocea, ocea_spheroid)
// Factory entry(s)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(ocea_entry, ocea_spheroid)

View File

@@ -2,8 +2,8 @@
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2017, 2018.
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
// This file was modified by Oracle on 2017, 2018, 2019.
// Modifications copyright (c) 2017-2019, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
// Use, modification and distribution is subject to the Boost Software License,
@@ -66,20 +66,14 @@ namespace projections
T cp0, sp0;
};
// template class, using CRTP to implement forward/inverse
template <typename T, typename Parameters>
struct base_oea_spheroid
: public base_t_fi<base_oea_spheroid<T, Parameters>, T, Parameters>
{
par_oea<T> m_proj_parm;
inline base_oea_spheroid(const Parameters& par)
: base_t_fi<base_oea_spheroid<T, Parameters>, T, Parameters>(*this, par)
{}
// FORWARD(s_forward) sphere
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
inline void fwd(Parameters const& , T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
{
T Az, M, N, cp, sp, cl, shz;
@@ -96,7 +90,7 @@ namespace projections
// INVERSE(s_inverse) sphere
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
inline void inv(Parameters const& , 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;
@@ -164,10 +158,9 @@ namespace projections
struct oea_spheroid : public detail::oea::base_oea_spheroid<T, Parameters>
{
template <typename Params>
inline oea_spheroid(Params const& params, Parameters const& par)
: detail::oea::base_oea_spheroid<T, Parameters>(par)
inline oea_spheroid(Params const& params, Parameters & par)
{
detail::oea::setup_oea(params, this->m_par, this->m_proj_parm);
detail::oea::setup_oea(params, par, this->m_proj_parm);
}
};
@@ -176,7 +169,7 @@ namespace projections
{
// Static projection
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_oea, oea_spheroid, oea_spheroid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_FI(srs::spar::proj_oea, oea_spheroid)
// Factory entry(s)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(oea_entry, oea_spheroid)

View File

@@ -2,8 +2,9 @@
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2017, 2018.
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
// This file was modified by Oracle on 2017, 2018, 2019, 2022.
// Modifications copyright (c) 2017-2022, Oracle and/or its affiliates.
// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
// Use, modification and distribution is subject to the Boost Software License,
@@ -63,35 +64,31 @@ namespace projections
template <typename T>
struct par_omerc
{
T A, B, E, AB, ArB, BrA, rB, singam, cosgam, sinrot, cosrot;
T v_pole_n, v_pole_s, u_0;
int no_rot;
T A, B, E, AB, ArB, BrA, rB, singam, cosgam, sinrot, cosrot;
T v_pole_n, v_pole_s, u_0;
bool no_rot;
};
static const double tolerance = 1.e-7;
static const double epsilon = 1.e-10;
// template class, using CRTP to implement forward/inverse
template <typename T, typename Parameters>
struct base_omerc_ellipsoid
: public base_t_fi<base_omerc_ellipsoid<T, Parameters>, T, Parameters>
{
par_omerc<T> m_proj_parm;
inline base_omerc_ellipsoid(const Parameters& par)
: base_t_fi<base_omerc_ellipsoid<T, Parameters>, T, Parameters>(*this, par)
{}
// FORWARD(e_forward) ellipsoid
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
inline void fwd(Parameters const& par, T const& lp_lon, T const& lp_lat, T& xy_x,
T& xy_y) const
{
static const T half_pi = detail::half_pi<T>();
T s, t, U, V, W, temp, u, v;
if (fabs(fabs(lp_lat) - half_pi) > epsilon) {
W = this->m_proj_parm.E / math::pow(pj_tsfn(lp_lat, sin(lp_lat), this->m_par.e), this->m_proj_parm.B);
W = this->m_proj_parm.E / math::pow(pj_tsfn(lp_lat, sin(lp_lat), par.e),
this->m_proj_parm.B);
temp = 1. / W;
s = .5 * (W - temp);
t = .5 * (W + temp);
@@ -105,7 +102,8 @@ namespace projections
if(fabs(temp) < tolerance) {
u = this->m_proj_parm.A * lp_lon;
} else {
u = this->m_proj_parm.ArB * atan2((s * this->m_proj_parm.cosgam + V * this->m_proj_parm.singam), temp);
u = this->m_proj_parm.ArB * atan2((s * this->m_proj_parm.cosgam
+ V * this->m_proj_parm.singam), temp);
}
} else {
v = lp_lat > 0 ? this->m_proj_parm.v_pole_n : this->m_proj_parm.v_pole_s;
@@ -123,7 +121,8 @@ namespace projections
// INVERSE(e_inverse) ellipsoid
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
inline void inv(Parameters const& par, T const& xy_x, T const& xy_y, T& lp_lon,
T& lp_lat) const
{
static const T half_pi = detail::half_pi<T>();
@@ -134,7 +133,8 @@ namespace projections
u = xy_x;
} else {
v = xy_x * this->m_proj_parm.cosrot - xy_y * this->m_proj_parm.sinrot;
u = xy_y * this->m_proj_parm.cosrot + xy_x * this->m_proj_parm.sinrot + this->m_proj_parm.u_0;
u = xy_y * this->m_proj_parm.cosrot + xy_x * this->m_proj_parm.sinrot
+ this->m_proj_parm.u_0;
}
Qp = exp(- this->m_proj_parm.BrA * v);
Sp = .5 * (Qp - 1. / Qp);
@@ -146,7 +146,8 @@ namespace projections
lp_lat = Up < 0. ? -half_pi : half_pi;
} else {
lp_lat = this->m_proj_parm.E / sqrt((1. + Up) / (1. - Up));
if ((lp_lat = pj_phi2(math::pow(lp_lat, T(1) / this->m_proj_parm.B), this->m_par.e)) == HUGE_VAL) {
if ((lp_lat = pj_phi2(math::pow(lp_lat, T(1) / this->m_proj_parm.B), par.e))
== HUGE_VAL) {
BOOST_THROW_EXCEPTION( projection_exception(error_tolerance_condition) );
}
lp_lon = - this->m_proj_parm.rB * atan2((Sp * this->m_proj_parm.cosgam -
@@ -163,7 +164,7 @@ namespace projections
// Oblique Mercator
template <typename Params, typename Parameters, typename T>
inline void setup_omerc(Params const& params, Parameters& par, par_omerc<T>& proj_parm)
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>();
@@ -174,23 +175,14 @@ 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<srs::spar::no_rot>(params, "no_rot", srs::dpar::no_rot);
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<T, srs::spar::lonc>(params, "lonc", srs::dpar::lonc);
// NOTE: This is not needed in Boost.Geometry
//no_off =
// /* For libproj4 compatability */
// pj_param_exists(par.params, "no_off")
// /* for backward compatibility */
// || pj_param_exists(par.params, "no_uoff");
//if( no_off )
//{
// /* Mark the parameter as used, so that the pj_get_def() return them */
// pj_get_param_s(par.params, "no_uoff");
// pj_get_param_s(par.params, "no_off");
//}
// NOTE: This is needed for Hotline Oblique Mercator variant A projection
no_off = pj_get_param_b<srs::spar::no_off>(params, "no_off", srs::dpar::no_off);
} else {
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);
@@ -287,13 +279,14 @@ namespace projections
- no_rot: No rotation
- alpha: Alpha (degrees)
- gamma: Gamma (degrees)
- no_off: Only for compatibility with libproj, proj4 (string)
- no_off: Do not offset origin to center of projection
(useful for Hotline Oblique Mercator variant A).
- lonc: Longitude (only used if alpha (or gamma) is specified) (degrees)
- lon_1 (degrees)
- lat_1: Latitude of first standard parallel (degrees)
- lon_2 (degrees)
- lat_2: Latitude of second standard parallel (degrees)
- no_uoff (string)
- no_uoff: deprecated (string)
\par Example
\image html ex_omerc.gif
*/
@@ -301,10 +294,9 @@ namespace projections
struct omerc_ellipsoid : public detail::omerc::base_omerc_ellipsoid<T, Parameters>
{
template <typename Params>
inline omerc_ellipsoid(Params const& params, Parameters const& par)
: detail::omerc::base_omerc_ellipsoid<T, Parameters>(par)
inline omerc_ellipsoid(Params const& params, Parameters & par)
{
detail::omerc::setup_omerc(params, this->m_par, this->m_proj_parm);
detail::omerc::setup_omerc(params, par, this->m_proj_parm);
}
};
@@ -313,7 +305,7 @@ namespace projections
{
// Static projection
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_omerc, omerc_ellipsoid, omerc_ellipsoid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_FI(srs::spar::proj_omerc, omerc_ellipsoid)
// Factory entry(s)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(omerc_entry, omerc_ellipsoid)

View File

@@ -2,8 +2,8 @@
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2017, 2018.
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
// This file was modified by Oracle on 2017, 2018, 2019.
// Modifications copyright (c) 2017-2019, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
// Use, modification and distribution is subject to the Boost Software License,
@@ -75,20 +75,14 @@ namespace projections
static const double epsilon10 = 1.e-10;
// template class, using CRTP to implement forward/inverse
template <typename T, typename Parameters>
struct base_ortho_spheroid
: public base_t_fi<base_ortho_spheroid<T, Parameters>, T, Parameters>
{
par_ortho<T> m_proj_parm;
inline base_ortho_spheroid(const Parameters& par)
: base_t_fi<base_ortho_spheroid<T, Parameters>, T, Parameters>(*this, par)
{}
// FORWARD(s_forward) spheroid
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
inline void fwd(Parameters const& par, T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
{
static const T half_pi = detail::half_pi<T>();
@@ -114,7 +108,7 @@ namespace projections
coslam = - coslam;
BOOST_FALLTHROUGH;
case s_pole:
if (fabs(lp_lat - this->m_par.phi0) - epsilon10 > half_pi) {
if (fabs(lp_lat - par.phi0) - epsilon10 > half_pi) {
BOOST_THROW_EXCEPTION( projection_exception(error_tolerance_condition) );
}
xy_y = cosphi * coslam;
@@ -125,7 +119,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(Parameters const& par, T 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
}
cosc = sqrt(1. - sinc * sinc); /* in this range OK */
if (fabs(rh) <= epsilon10) {
lp_lat = this->m_par.phi0;
lp_lat = par.phi0;
lp_lon = 0.0;
} else {
switch (this->m_proj_parm.mode) {
@@ -213,10 +207,9 @@ namespace projections
struct ortho_spheroid : public detail::ortho::base_ortho_spheroid<T, Parameters>
{
template <typename Params>
inline ortho_spheroid(Params const& , Parameters const& par)
: detail::ortho::base_ortho_spheroid<T, Parameters>(par)
inline ortho_spheroid(Params const& , Parameters & par)
{
detail::ortho::setup_ortho(this->m_par, this->m_proj_parm);
detail::ortho::setup_ortho(par, this->m_proj_parm);
}
};
@@ -225,7 +218,7 @@ namespace projections
{
// Static projection
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_ortho, ortho_spheroid, ortho_spheroid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_FI(srs::spar::proj_ortho, ortho_spheroid)
// Factory entry(s)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(ortho_entry, ortho_spheroid)

View File

@@ -2,8 +2,8 @@
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2017, 2018.
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
// This file was modified by Oracle on 2017, 2018, 2019.
// Modifications copyright (c) 2017-2019, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
// Use, modification and distribution is subject to the Boost Software License,
@@ -69,20 +69,14 @@ namespace projections
detail::en<T> en;
};
// template class, using CRTP to implement forward/inverse
template <typename T, typename Parameters>
struct base_poly_ellipsoid
: public base_t_fi<base_poly_ellipsoid<T, Parameters>, T, Parameters>
{
par_poly<T> m_proj_parm;
inline base_poly_ellipsoid(const Parameters& par)
: base_t_fi<base_poly_ellipsoid<T, Parameters>, T, Parameters>(*this, par)
{}
// FORWARD(e_forward) ellipsoid
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
inline void fwd(T lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
inline void fwd(Parameters const& par, T lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
{
T ms, sp, cp;
@@ -91,7 +85,7 @@ namespace projections
xy_y = -this->m_proj_parm.ml0;
} else {
sp = sin(lp_lat);
ms = fabs(cp = cos(lp_lat)) > tolerance ? pj_msfn(sp, cp, this->m_par.es) / sp : 0.;
ms = fabs(cp = cos(lp_lat)) > tolerance ? pj_msfn(sp, cp, par.es) / sp : 0.;
xy_x = ms * sin(lp_lon *= sp);
xy_y = (pj_mlfn(lp_lat, sp, cp, this->m_proj_parm.en) - this->m_proj_parm.ml0) + ms * (1. - cos(lp_lon));
}
@@ -99,7 +93,7 @@ namespace projections
// INVERSE(e_inverse) ellipsoid
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
inline void inv(T const& xy_x, T xy_y, T& lp_lon, T& lp_lat) const
inline void inv(Parameters const& par, 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) {
@@ -116,13 +110,13 @@ namespace projections
if (fabs(cp) < i_tolerance) {
BOOST_THROW_EXCEPTION( projection_exception(error_tolerance_condition) );
}
c = sp * (mlp = sqrt(1. - this->m_par.es * sp * sp)) / cp;
c = sp * (mlp = sqrt(1. - par.es * sp * sp)) / cp;
ml = pj_mlfn(lp_lat, sp, cp, this->m_proj_parm.en);
mlb = ml * ml + r;
mlp = this->m_par.one_es / (mlp * mlp * mlp);
mlp = par.one_es / (mlp * mlp * mlp);
lp_lat += ( dPhi =
( ml + ml + c * mlb - 2. * xy_y * (c * ml + 1.) ) / (
this->m_par.es * s2ph * (mlb - 2. * xy_y * ml) / c +
par.es * s2ph * (mlb - 2. * xy_y * ml) / c +
2.* (xy_y - ml) * (c * mlp - 1. / s2ph) - mlp - mlp ));
if (fabs(dPhi) <= i_tolerance)
break;
@@ -131,7 +125,7 @@ namespace projections
BOOST_THROW_EXCEPTION( projection_exception(error_tolerance_condition) );
}
c = sin(lp_lat);
lp_lon = asin(xy_x * tan(lp_lat) * sqrt(1. - this->m_par.es * c * c)) / sin(lp_lat);
lp_lon = asin(xy_x * tan(lp_lat) * sqrt(1. - par.es * c * c)) / sin(lp_lat);
}
}
@@ -142,20 +136,14 @@ namespace projections
};
// template class, using CRTP to implement forward/inverse
template <typename T, typename Parameters>
struct base_poly_spheroid
: public base_t_fi<base_poly_spheroid<T, Parameters>, T, Parameters>
{
par_poly<T> m_proj_parm;
inline base_poly_spheroid(const Parameters& par)
: base_t_fi<base_poly_spheroid<T, Parameters>, T, Parameters>(*this, par)
{}
// FORWARD(s_forward) spheroid
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
inline void fwd(Parameters const& par, T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
{
T cot, E;
@@ -165,18 +153,18 @@ namespace projections
} else {
cot = 1. / tan(lp_lat);
xy_x = sin(E = lp_lon * sin(lp_lat)) * cot;
xy_y = lp_lat - this->m_par.phi0 + cot * (1. - cos(E));
xy_y = lp_lat - par.phi0 + cot * (1. - cos(E));
}
}
// INVERSE(s_inverse) spheroid
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
inline void inv(T const& xy_x, T xy_y, T& lp_lon, T& lp_lat) const
inline void inv(Parameters const& par, T const& xy_x, T xy_y, T& lp_lon, T& lp_lat) const
{
T B, dphi, tp;
int i;
if (fabs(xy_y = this->m_par.phi0 + xy_y) <= tolerance) {
if (fabs(xy_y = par.phi0 + xy_y) <= tolerance) {
lp_lon = xy_x;
lp_lat = 0.;
} else {
@@ -205,7 +193,7 @@ namespace projections
// Polyconic (American)
template <typename Parameters, typename T>
inline void setup_poly(Parameters& par, par_poly<T>& proj_parm)
inline void setup_poly(Parameters const& par, par_poly<T>& proj_parm)
{
if (par.es != 0.0) {
proj_parm.en = pj_enfn<T>(par.es);
@@ -236,9 +224,8 @@ namespace projections
{
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);
detail::poly::setup_poly(par, this->m_proj_parm);
}
};
@@ -260,9 +247,8 @@ namespace projections
{
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);
detail::poly::setup_poly(par, this->m_proj_parm);
}
};
@@ -271,7 +257,7 @@ namespace projections
{
// Static projection
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_poly, poly_spheroid, poly_ellipsoid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_FI2(srs::spar::proj_poly, poly_spheroid, poly_ellipsoid)
// Factory entry(s)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI2(poly_entry, poly_spheroid, poly_ellipsoid)

View File

@@ -2,8 +2,8 @@
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2017, 2018.
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
// This file was modified by Oracle on 2017, 2018, 2019.
// Modifications copyright (c) 2017-2019, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
// Use, modification and distribution is subject to the Boost Software License,
@@ -62,19 +62,12 @@ namespace projections
static const int n_iter = 10;
//static const double third_pi = 1.0471975511965977;
// template class, using CRTP to implement forward/inverse
template <typename T, typename Parameters>
struct base_putp2_spheroid
: public base_t_fi<base_putp2_spheroid<T, Parameters>, T, Parameters>
{
inline base_putp2_spheroid(const Parameters& par)
: base_t_fi<base_putp2_spheroid<T, Parameters>, T, Parameters>(*this, par)
{}
// FORWARD(s_forward) spheroid
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
inline void fwd(T const& lp_lon, T lp_lat, T& xy_x, T& xy_y) const
inline void fwd(Parameters const& , T const& lp_lon, T lp_lat, T& xy_x, T& xy_y) const
{
static const T third_pi = detail::third_pi<T>();
@@ -100,7 +93,7 @@ namespace projections
// INVERSE(s_inverse) spheroid
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
inline void inv(Parameters const& , T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
{
T c;
@@ -142,10 +135,9 @@ namespace projections
struct putp2_spheroid : public detail::putp2::base_putp2_spheroid<T, Parameters>
{
template <typename Params>
inline putp2_spheroid(Params const& , Parameters const& par)
: detail::putp2::base_putp2_spheroid<T, Parameters>(par)
inline putp2_spheroid(Params const& , Parameters & par)
{
detail::putp2::setup_putp2(this->m_par);
detail::putp2::setup_putp2(par);
}
};
@@ -154,7 +146,7 @@ namespace projections
{
// Static projection
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_putp2, putp2_spheroid, putp2_spheroid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_FI(srs::spar::proj_putp2, putp2_spheroid)
// Factory entry(s)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(putp2_entry, putp2_spheroid)

View File

@@ -2,8 +2,8 @@
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2017, 2018.
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
// This file was modified by Oracle on 2017, 2018, 2019.
// Modifications copyright (c) 2017-2019, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
// Use, modification and distribution is subject to the Boost Software License,
@@ -63,20 +63,14 @@ namespace projections
T A;
};
// template class, using CRTP to implement forward/inverse
template <typename T, typename Parameters>
struct base_putp3_spheroid
: public base_t_fi<base_putp3_spheroid<T, Parameters>, T, Parameters>
{
par_putp3<T> m_proj_parm;
inline base_putp3_spheroid(const Parameters& par)
: base_t_fi<base_putp3_spheroid<T, Parameters>,
T, Parameters>(*this, par) {}
// FORWARD(s_forward) spheroid
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
inline void fwd(Parameters const& , 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;
@@ -84,7 +78,7 @@ namespace projections
// INVERSE(s_inverse) spheroid
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
inline void inv(Parameters const& , 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));
@@ -103,7 +97,7 @@ namespace projections
inline void setup_putp3(Parameters& par, par_putp3<T>& proj_parm)
{
proj_parm.A = 4. * RPISQ;
par.es = 0.;
}
@@ -112,7 +106,7 @@ namespace projections
inline void setup_putp3p(Parameters& par, par_putp3<T>& proj_parm)
{
proj_parm.A = 2. * RPISQ;
par.es = 0.;
}
@@ -135,10 +129,9 @@ namespace projections
struct putp3_spheroid : public detail::putp3::base_putp3_spheroid<T, Parameters>
{
template <typename Params>
inline putp3_spheroid(Params const& , Parameters const& par)
: detail::putp3::base_putp3_spheroid<T, Parameters>(par)
inline putp3_spheroid(Params const& , Parameters & par)
{
detail::putp3::setup_putp3(this->m_par, this->m_proj_parm);
detail::putp3::setup_putp3(par, this->m_proj_parm);
}
};
@@ -158,10 +151,9 @@ namespace projections
struct putp3p_spheroid : public detail::putp3::base_putp3_spheroid<T, Parameters>
{
template <typename Params>
inline putp3p_spheroid(Params const& , Parameters const& par)
: detail::putp3::base_putp3_spheroid<T, Parameters>(par)
inline putp3p_spheroid(Params const& , Parameters & par)
{
detail::putp3::setup_putp3p(this->m_par, this->m_proj_parm);
detail::putp3::setup_putp3p(par, this->m_proj_parm);
}
};
@@ -170,8 +162,8 @@ namespace projections
{
// Static projection
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)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_FI(srs::spar::proj_putp3, putp3_spheroid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_FI(srs::spar::proj_putp3p, putp3p_spheroid)
// Factory entry(s)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(putp3_entry, putp3_spheroid)

View File

@@ -2,8 +2,8 @@
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2017, 2018.
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
// This file was modified by Oracle on 2017, 2018, 2019.
// Modifications copyright (c) 2017-2019, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
// Use, modification and distribution is subject to the Boost Software License,
@@ -60,20 +60,14 @@ namespace projections
T C_x, C_y;
};
// template class, using CRTP to implement forward/inverse
template <typename T, typename Parameters>
struct base_putp4p_spheroid
: public base_t_fi<base_putp4p_spheroid<T, Parameters>, T, Parameters>
{
par_putp4p<T> m_proj_parm;
inline base_putp4p_spheroid(const Parameters& par)
: base_t_fi<base_putp4p_spheroid<T, Parameters>,
T, Parameters>(*this, par) {}
// FORWARD(s_forward) spheroid
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
inline void fwd(T const& lp_lon, T lp_lat, T& xy_x, T& xy_y) const
inline void fwd(Parameters const& , T const& lp_lon, T lp_lat, T& xy_x, T& xy_y) const
{
static T const third = detail::third<T>();
@@ -85,7 +79,7 @@ namespace projections
// INVERSE(s_inverse) spheroid
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
inline void inv(Parameters const& , 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;
@@ -108,7 +102,7 @@ namespace projections
{
proj_parm.C_x = 0.874038744;
proj_parm.C_y = 3.883251825;
par.es = 0.;
}
@@ -118,7 +112,7 @@ namespace projections
{
proj_parm.C_x = 1.;
proj_parm.C_y = 4.442882938;
par.es = 0.;
}
@@ -141,10 +135,9 @@ namespace projections
struct putp4p_spheroid : public detail::putp4p::base_putp4p_spheroid<T, Parameters>
{
template <typename Params>
inline putp4p_spheroid(Params const& , Parameters const& par)
: detail::putp4p::base_putp4p_spheroid<T, Parameters>(par)
inline putp4p_spheroid(Params const& , Parameters & par)
{
detail::putp4p::setup_putp4p(this->m_par, this->m_proj_parm);
detail::putp4p::setup_putp4p(par, this->m_proj_parm);
}
};
@@ -164,10 +157,9 @@ namespace projections
struct weren_spheroid : public detail::putp4p::base_putp4p_spheroid<T, Parameters>
{
template <typename Params>
inline weren_spheroid(Params const& , Parameters const& par)
: detail::putp4p::base_putp4p_spheroid<T, Parameters>(par)
inline weren_spheroid(Params const& , Parameters & par)
{
detail::putp4p::setup_weren(this->m_par, this->m_proj_parm);
detail::putp4p::setup_weren(par, this->m_proj_parm);
}
};
@@ -176,8 +168,8 @@ namespace projections
{
// Static projection
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)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_FI(srs::spar::proj_putp4p, putp4p_spheroid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_FI(srs::spar::proj_weren, weren_spheroid)
// Factory entry(s)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(putp4p_entry, putp4p_spheroid)

View File

@@ -2,8 +2,8 @@
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2017, 2018.
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
// This file was modified by Oracle on 2017, 2018, 2019.
// Modifications copyright (c) 2017-2019, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
// Use, modification and distribution is subject to the Boost Software License,
@@ -63,20 +63,14 @@ namespace projections
T A, B;
};
// template class, using CRTP to implement forward/inverse
template <typename T, typename Parameters>
struct base_putp5_spheroid
: public base_t_fi<base_putp5_spheroid<T, Parameters>, T, Parameters>
{
par_putp5<T> m_proj_parm;
inline base_putp5_spheroid(const Parameters& par)
: base_t_fi<base_putp5_spheroid<T, Parameters>, T, Parameters>(*this, par)
{}
// FORWARD(s_forward) spheroid
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
inline void fwd(Parameters const& , 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;
@@ -84,7 +78,7 @@ namespace projections
// INVERSE(s_inverse) spheroid
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
inline void inv(Parameters const& , 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)));
@@ -96,7 +90,7 @@ namespace projections
}
};
// Putnins P5
template <typename Parameters, typename T>
@@ -104,7 +98,7 @@ namespace projections
{
proj_parm.A = 2.;
proj_parm.B = 1.;
par.es = 0.;
}
@@ -114,7 +108,7 @@ namespace projections
{
proj_parm.A = 1.5;
proj_parm.B = 0.5;
par.es = 0.;
}
@@ -137,10 +131,9 @@ namespace projections
struct putp5_spheroid : public detail::putp5::base_putp5_spheroid<T, Parameters>
{
template <typename Params>
inline putp5_spheroid(Params const& , Parameters const& par)
: detail::putp5::base_putp5_spheroid<T, Parameters>(par)
inline putp5_spheroid(Params const& , Parameters & par)
{
detail::putp5::setup_putp5(this->m_par, this->m_proj_parm);
detail::putp5::setup_putp5(par, this->m_proj_parm);
}
};
@@ -160,10 +153,9 @@ namespace projections
struct putp5p_spheroid : public detail::putp5::base_putp5_spheroid<T, Parameters>
{
template <typename Params>
inline putp5p_spheroid(Params const& , Parameters const& par)
: detail::putp5::base_putp5_spheroid<T, Parameters>(par)
inline putp5p_spheroid(Params const& , Parameters & par)
{
detail::putp5::setup_putp5p(this->m_par, this->m_proj_parm);
detail::putp5::setup_putp5p(par, this->m_proj_parm);
}
};
@@ -172,8 +164,8 @@ namespace projections
{
// Static projection
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)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_FI(srs::spar::proj_putp5, putp5_spheroid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_FI(srs::spar::proj_putp5p, putp5p_spheroid)
// Factory entry(s)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(putp5_entry, putp5_spheroid)

View File

@@ -2,8 +2,8 @@
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2017, 2018.
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
// This file was modified by Oracle on 2017, 2018, 2019.
// Modifications copyright (c) 2017-2019, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
// Use, modification and distribution is subject to the Boost Software License,
@@ -65,20 +65,14 @@ namespace projections
T C_x, C_y, A, B, D;
};
// template class, using CRTP to implement forward/inverse
template <typename T, typename Parameters>
struct base_putp6_spheroid
: public base_t_fi<base_putp6_spheroid<T, Parameters>, T, Parameters>
{
par_putp6<T> m_proj_parm;
inline base_putp6_spheroid(const Parameters& par)
: base_t_fi<base_putp6_spheroid<T, Parameters>, T, Parameters>(*this, par)
{}
// FORWARD(s_forward) spheroid
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
inline void fwd(T const& lp_lon, T lp_lat, T& xy_x, T& xy_y) const
inline void fwd(Parameters const& , T const& lp_lon, T lp_lat, T& xy_x, T& xy_y) const
{
T p, r, V;
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 const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
inline void inv(Parameters const& , T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
{
T r;
@@ -116,7 +110,7 @@ namespace projections
}
};
// Putnins P6
template <typename Parameters, typename T>
@@ -127,7 +121,7 @@ namespace projections
proj_parm.A = 4.;
proj_parm.B = 2.1471437182129378784;
proj_parm.D = 2.;
par.es = 0.;
}
@@ -140,7 +134,7 @@ namespace projections
proj_parm.A = 6.;
proj_parm.B = 5.61125;
proj_parm.D = 3.;
par.es = 0.;
}
@@ -163,10 +157,9 @@ namespace projections
struct putp6_spheroid : public detail::putp6::base_putp6_spheroid<T, Parameters>
{
template <typename Params>
inline putp6_spheroid(Params const& , Parameters const& par)
: detail::putp6::base_putp6_spheroid<T, Parameters>(par)
inline putp6_spheroid(Params const& , Parameters & par)
{
detail::putp6::setup_putp6(this->m_par, this->m_proj_parm);
detail::putp6::setup_putp6(par, this->m_proj_parm);
}
};
@@ -186,10 +179,9 @@ namespace projections
struct putp6p_spheroid : public detail::putp6::base_putp6_spheroid<T, Parameters>
{
template <typename Params>
inline putp6p_spheroid(Params const& , Parameters const& par)
: detail::putp6::base_putp6_spheroid<T, Parameters>(par)
inline putp6p_spheroid(Params const& , Parameters & par)
{
detail::putp6::setup_putp6p(this->m_par, this->m_proj_parm);
detail::putp6::setup_putp6p(par, this->m_proj_parm);
}
};
@@ -198,8 +190,8 @@ namespace projections
{
// Static projection
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)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_FI(srs::spar::proj_putp6, putp6_spheroid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_FI(srs::spar::proj_putp6p, putp6p_spheroid)
// Factory entry(s)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(putp6_entry, putp6_spheroid)

View File

@@ -2,8 +2,8 @@
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2017, 2018.
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
// This file was modified by Oracle on 2017, 2018, 2019.
// Modifications copyright (c) 2017-2019, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
// Use, modification and distribution is subject to the Boost Software License,
@@ -107,11 +107,11 @@ namespace projections
template <typename T>
struct par_qsc
{
face_type face;
T a_squared;
T b;
T one_minus_f;
T one_minus_f_squared;
face_type face;
};
static const double epsilon10 = 1.e-10;
@@ -174,20 +174,14 @@ namespace projections
/* Forward projection, ellipsoid */
// template class, using CRTP to implement forward/inverse
template <typename T, typename Parameters>
struct base_qsc_ellipsoid
: public base_t_fi<base_qsc_ellipsoid<T, Parameters>, T, Parameters>
{
par_qsc<T> m_proj_parm;
inline base_qsc_ellipsoid(const Parameters& par)
: base_t_fi<base_qsc_ellipsoid<T, Parameters>, T, Parameters>(*this, par)
{}
// FORWARD(e_forward)
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
inline void fwd(Parameters const& par, 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>();
@@ -195,13 +189,13 @@ namespace projections
T lat, lon;
T theta, phi;
T t, mu; /* nu; */
T t, mu; /* nu; */
area_type area;
/* Convert the geodetic latitude to a geocentric latitude.
* This corresponds to the shift from the ellipsoid to the sphere
* described in [LK12]. */
if (this->m_par.es != 0.0) {
if (par.es != 0.0) {
lat = atan(this->m_proj_parm.one_minus_f_squared * tan(lp_lat));
} else {
lat = lp_lat;
@@ -308,7 +302,7 @@ namespace projections
// INVERSE(e_inverse)
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
inline void inv(Parameters const& par, 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>();
@@ -436,13 +430,13 @@ namespace projections
/* Apply the shift from the sphere to the ellipsoid as described
* in [LK12]. */
if (this->m_par.es != 0.0) {
if (par.es != 0.0) {
int invert_sign;
T tanphi, xa;
invert_sign = (lp_lat < 0.0 ? 1 : 0);
tanphi = tan(lp_lat);
xa = this->m_proj_parm.b / sqrt(tanphi * tanphi + this->m_proj_parm.one_minus_f_squared);
lp_lat = atan(sqrt(this->m_par.a * this->m_par.a - xa * xa) / (this->m_proj_parm.one_minus_f * xa));
lp_lat = atan(sqrt(par.a * par.a - xa * xa) / (this->m_proj_parm.one_minus_f * xa));
if (invert_sign) {
lp_lat = -lp_lat;
}
@@ -458,7 +452,7 @@ namespace projections
// Quadrilateralized Spherical Cube
template <typename Parameters, typename T>
inline void setup_qsc(Parameters& par, par_qsc<T>& proj_parm)
inline void setup_qsc(Parameters const& par, par_qsc<T>& proj_parm)
{
static const T fourth_pi = detail::fourth_pi<T>();
static const T half_pi = detail::half_pi<T>();
@@ -505,9 +499,8 @@ namespace projections
{
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);
detail::qsc::setup_qsc(par, this->m_proj_parm);
}
};
@@ -516,7 +509,7 @@ namespace projections
{
// Static projection
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_qsc, qsc_ellipsoid, qsc_ellipsoid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_FI(srs::spar::proj_qsc, qsc_ellipsoid)
// Factory entry(s)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(qsc_entry, qsc_ellipsoid)

View File

@@ -2,8 +2,8 @@
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2017, 2018.
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
// This file was modified by Oracle on 2017, 2018, 2019.
// Modifications copyright (c) 2017-2019, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
// Use, modification and distribution is subject to the Boost Software License,
@@ -135,15 +135,9 @@ namespace projections
return result;
}
// template class, using CRTP to implement forward/inverse
template <typename T, typename Parameters>
struct base_robin_spheroid
: public base_t_fi<base_robin_spheroid<T, Parameters>, T, Parameters>
{
inline base_robin_spheroid(const Parameters& par)
: base_t_fi<base_robin_spheroid<T, Parameters>, T, Parameters>(*this, par)
{}
inline T v(coefs<T> const& c, T const& z) const
{ return (c.c0 + z * (c.c1 + z * (c.c2 + z * c.c3))); }
inline T dv(coefs<T> const& c, T const& z) const
@@ -151,7 +145,7 @@ namespace projections
// FORWARD(s_forward) spheroid
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
inline void fwd(Parameters const& , T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
{
int i;
T dphi;
@@ -169,7 +163,7 @@ namespace projections
// INVERSE(s_inverse) spheroid
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
inline void inv(Parameters const& , 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>();
@@ -251,10 +245,9 @@ namespace projections
struct robin_spheroid : public detail::robin::base_robin_spheroid<T, Parameters>
{
template <typename Params>
inline robin_spheroid(Params const& , Parameters const& par)
: detail::robin::base_robin_spheroid<T, Parameters>(par)
inline robin_spheroid(Params const& , Parameters & par)
{
detail::robin::setup_robin(this->m_par);
detail::robin::setup_robin(par);
}
};
@@ -263,7 +256,7 @@ namespace projections
{
// Static projection
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_robin, robin_spheroid, robin_spheroid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_FI(srs::spar::proj_robin, robin_spheroid)
// Factory entry(s)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(robin_entry, robin_spheroid)

View File

@@ -2,8 +2,8 @@
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2017, 2018.
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
// This file was modified by Oracle on 2017, 2018, 2019.
// Modifications copyright (c) 2017-2019, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
// Use, modification and distribution is subject to the Boost Software License,
@@ -67,20 +67,14 @@ namespace projections
mdist<T> en;
};
// template class, using CRTP to implement forward/inverse
template <typename T, typename Parameters>
struct base_rouss_ellipsoid
: public base_t_fi<base_rouss_ellipsoid<T, Parameters>, T, Parameters>
{
par_rouss<T> m_proj_parm;
inline base_rouss_ellipsoid(const Parameters& par)
: base_t_fi<base_rouss_ellipsoid<T, Parameters>, T, Parameters>(*this, par)
{}
// FORWARD(e_forward) ellipsoid
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
inline void fwd(Parameters const& par, T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
{
T s, al, cp, sp, al2, s2;
@@ -88,20 +82,20 @@ namespace projections
sp = sin(lp_lat);
s = proj_mdist(lp_lat, sp, cp, this->m_proj_parm.en) - this->m_proj_parm.s0;
s2 = s * s;
al = lp_lon * cp / sqrt(1. - this->m_par.es * sp * sp);
al = lp_lon * cp / sqrt(1. - par.es * sp * sp);
al2 = al * al;
xy_x = this->m_par.k0 * al*(1.+s2*(this->m_proj_parm.A1+s2*this->m_proj_parm.A4)-al2*(this->m_proj_parm.A2+s*this->m_proj_parm.A3+s2*this->m_proj_parm.A5
xy_x = par.k0 * al*(1.+s2*(this->m_proj_parm.A1+s2*this->m_proj_parm.A4)-al2*(this->m_proj_parm.A2+s*this->m_proj_parm.A3+s2*this->m_proj_parm.A5
+al2*this->m_proj_parm.A6));
xy_y = this->m_par.k0 * (al2*(this->m_proj_parm.B1+al2*this->m_proj_parm.B4)+
xy_y = par.k0 * (al2*(this->m_proj_parm.B1+al2*this->m_proj_parm.B4)+
s*(1.+al2*(this->m_proj_parm.B3-al2*this->m_proj_parm.B6)+s2*(this->m_proj_parm.B2+s2*this->m_proj_parm.B8)+
s*al2*(this->m_proj_parm.B5+s*this->m_proj_parm.B7)));
}
// INVERSE(e_inverse) ellipsoid
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
inline void inv(Parameters const& par, 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;
T s, al, x = xy_x / par.k0, y = xy_y / par.k0, x2, y2;
x2 = x * x;
y2 = y * y;
@@ -112,7 +106,7 @@ namespace projections
x2*(this->m_proj_parm.D4+y*(this->m_proj_parm.D6+y*this->m_proj_parm.D10)-x2*this->m_proj_parm.D9));
lp_lat=proj_inv_mdist(s, this->m_proj_parm.en);
s = sin(lp_lat);
lp_lon=al * sqrt(1. - this->m_par.es * s * s)/cos(lp_lat);
lp_lon=al * sqrt(1. - par.es * s * s)/cos(lp_lat);
}
static inline std::string get_name()
@@ -124,7 +118,7 @@ namespace projections
// Roussilhe Stereographic
template <typename Parameters, typename T>
inline void setup_rouss(Parameters& par, par_rouss<T>& proj_parm)
inline void setup_rouss(Parameters const& par, par_rouss<T>& proj_parm)
{
T N0, es2, t, t2, R_R0_2, R_R0_4;
@@ -192,9 +186,8 @@ namespace projections
{
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);
detail::rouss::setup_rouss(par, this->m_proj_parm);
}
};
@@ -203,7 +196,7 @@ namespace projections
{
// Static projection
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_rouss, rouss_ellipsoid, rouss_ellipsoid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_FI(srs::spar::proj_rouss, rouss_ellipsoid)
// Factory entry(s)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(rouss_entry, rouss_ellipsoid)

View File

@@ -2,8 +2,8 @@
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2017, 2018.
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
// This file was modified by Oracle on 2017, 2018, 2019.
// Modifications copyright (c) 2017-2019, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
// Use, modification and distribution is subject to the Boost Software License,
@@ -60,26 +60,20 @@ namespace projections
template <typename T>
struct par_rpoly
{
T phi1;
T fxa;
T fxb;
int mode;
T phi1;
T fxa;
T fxb;
bool mode; // TODO: Not really needed
};
// template class, using CRTP to implement forward/inverse
template <typename T, typename Parameters>
struct base_rpoly_spheroid
: public base_t_f<base_rpoly_spheroid<T, Parameters>, T, Parameters>
{
par_rpoly<T> m_proj_parm;
inline base_rpoly_spheroid(const Parameters& par)
: base_t_f<base_rpoly_spheroid<T, Parameters>, T, Parameters>(*this, par)
{}
// FORWARD(s_forward) spheroid
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
inline void fwd(Parameters const& par, T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
{
T fa;
@@ -89,11 +83,11 @@ namespace projections
fa = 0.5 * lp_lon;
if (fabs(lp_lat) < epsilon) {
xy_x = fa + fa;
xy_y = - this->m_par.phi0;
xy_y = - par.phi0;
} else {
xy_y = 1. / tan(lp_lat);
xy_x = sin(fa = 2. * atan(fa * sin(lp_lat))) * xy_y;
xy_y = lp_lat - this->m_par.phi0 + (1. - cos(fa)) * xy_y;
xy_y = lp_lat - par.phi0 + (1. - cos(fa)) * xy_y;
}
}
@@ -139,10 +133,9 @@ namespace projections
struct rpoly_spheroid : public detail::rpoly::base_rpoly_spheroid<T, Parameters>
{
template <typename Params>
inline rpoly_spheroid(Params const& params, Parameters const& par)
: detail::rpoly::base_rpoly_spheroid<T, Parameters>(par)
inline rpoly_spheroid(Params const& params, Parameters & par)
{
detail::rpoly::setup_rpoly(params, this->m_par, this->m_proj_parm);
detail::rpoly::setup_rpoly(params, par, this->m_proj_parm);
}
};
@@ -151,7 +144,7 @@ namespace projections
{
// Static projection
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_rpoly, rpoly_spheroid, rpoly_spheroid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_F(srs::spar::proj_rpoly, rpoly_spheroid)
// Factory entry(s)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_F(rpoly_entry, rpoly_spheroid)

View File

@@ -2,8 +2,8 @@
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2017, 2018.
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
// This file was modified by Oracle on 2017, 2018, 2019.
// Modifications copyright (c) 2017-2019, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
// Use, modification and distribution is subject to the Boost Software License,
@@ -102,20 +102,14 @@ namespace projections
return err;
}
// template class, using CRTP to implement forward/inverse
template <typename T, typename Parameters>
struct base_sconics_spheroid
: public base_t_fi<base_sconics_spheroid<T, Parameters>, T, Parameters>
{
par_sconics<T> m_proj_parm;
inline base_sconics_spheroid(const Parameters& par)
: base_t_fi<base_sconics_spheroid<T, Parameters>, T, Parameters>(*this, par)
{}
// FORWARD(s_forward) spheroid
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
inline void fwd(T lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
inline void fwd(Parameters const& , T lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
{
T rho;
@@ -136,7 +130,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(Parameters const& , T xy_x, T xy_y, T& lp_lon, T& lp_lat) const
{
T rho;
@@ -169,7 +163,7 @@ namespace projections
};
template <typename Params, typename Parameters, typename T>
inline void setup(Params const& params, Parameters& par, par_sconics<T>& proj_parm, proj_type type)
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>();
@@ -262,7 +256,7 @@ namespace projections
inline void setup_murd3(Params const& params, Parameters& par, par_sconics<T>& proj_parm)
{
setup(params, par, proj_parm, proj_murd3);
}
}
// Perspective Conic
template <typename Params, typename Parameters, typename T>
@@ -280,7 +274,7 @@ namespace projections
}} // namespace detail::sconics
#endif // doxygen
/*!
\brief Tissot projection
\ingroup projections
@@ -300,10 +294,9 @@ namespace projections
struct tissot_spheroid : public detail::sconics::base_sconics_spheroid<T, Parameters>
{
template <typename Params>
inline tissot_spheroid(Params const& params, const Parameters& par)
: detail::sconics::base_sconics_spheroid<T, Parameters>(par)
inline tissot_spheroid(Params const& params, Parameters& par)
{
detail::sconics::setup_tissot(params, this->m_par, this->m_proj_parm);
detail::sconics::setup_tissot(params, par, this->m_proj_parm);
}
};
@@ -326,10 +319,9 @@ namespace projections
struct murd1_spheroid : public detail::sconics::base_sconics_spheroid<T, Parameters>
{
template <typename Params>
inline murd1_spheroid(Params const& params, const Parameters& par)
: detail::sconics::base_sconics_spheroid<T, Parameters>(par)
inline murd1_spheroid(Params const& params, Parameters& par)
{
detail::sconics::setup_murd1(params, this->m_par, this->m_proj_parm);
detail::sconics::setup_murd1(params, par, this->m_proj_parm);
}
};
@@ -352,10 +344,9 @@ namespace projections
struct murd2_spheroid : public detail::sconics::base_sconics_spheroid<T, Parameters>
{
template <typename Params>
inline murd2_spheroid(Params const& params, const Parameters& par)
: detail::sconics::base_sconics_spheroid<T, Parameters>(par)
inline murd2_spheroid(Params const& params, Parameters& par)
{
detail::sconics::setup_murd2(params, this->m_par, this->m_proj_parm);
detail::sconics::setup_murd2(params, par, this->m_proj_parm);
}
};
@@ -378,10 +369,9 @@ namespace projections
struct murd3_spheroid : public detail::sconics::base_sconics_spheroid<T, Parameters>
{
template <typename Params>
inline murd3_spheroid(Params const& params, const Parameters& par)
: detail::sconics::base_sconics_spheroid<T, Parameters>(par)
inline murd3_spheroid(Params const& params, Parameters& par)
{
detail::sconics::setup_murd3(params, this->m_par, this->m_proj_parm);
detail::sconics::setup_murd3(params, par, this->m_proj_parm);
}
};
@@ -404,10 +394,9 @@ namespace projections
struct euler_spheroid : public detail::sconics::base_sconics_spheroid<T, Parameters>
{
template <typename Params>
inline euler_spheroid(Params const& params, const Parameters& par)
: detail::sconics::base_sconics_spheroid<T, Parameters>(par)
inline euler_spheroid(Params const& params, Parameters& par)
{
detail::sconics::setup_euler(params, this->m_par, this->m_proj_parm);
detail::sconics::setup_euler(params, par, this->m_proj_parm);
}
};
@@ -430,10 +419,9 @@ namespace projections
struct pconic_spheroid : public detail::sconics::base_sconics_spheroid<T, Parameters>
{
template <typename Params>
inline pconic_spheroid(Params const& params, const Parameters& par)
: detail::sconics::base_sconics_spheroid<T, Parameters>(par)
inline pconic_spheroid(Params const& params, Parameters& par)
{
detail::sconics::setup_pconic(params, this->m_par, this->m_proj_parm);
detail::sconics::setup_pconic(params, par, this->m_proj_parm);
}
};
@@ -456,10 +444,9 @@ namespace projections
struct vitk1_spheroid : public detail::sconics::base_sconics_spheroid<T, Parameters>
{
template <typename Params>
inline vitk1_spheroid(Params const& params, const Parameters& par)
: detail::sconics::base_sconics_spheroid<T, Parameters>(par)
inline vitk1_spheroid(Params const& params, Parameters& par)
{
detail::sconics::setup_vitk1(params, this->m_par, this->m_proj_parm);
detail::sconics::setup_vitk1(params, par, this->m_proj_parm);
}
};
@@ -468,14 +455,14 @@ namespace projections
{
// Static projection
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)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_FI(srs::spar::proj_euler, euler_spheroid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_FI(srs::spar::proj_murd1, murd1_spheroid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_FI(srs::spar::proj_murd2, murd2_spheroid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_FI(srs::spar::proj_murd3, murd3_spheroid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_FI(srs::spar::proj_pconic, pconic_spheroid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_FI(srs::spar::proj_tissot, tissot_spheroid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_FI(srs::spar::proj_vitk1, vitk1_spheroid)
// Factory entry(s)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(euler_entry, euler_spheroid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(murd1_entry, murd1_spheroid)

View File

@@ -2,8 +2,8 @@
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2017, 2018.
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
// This file was modified by Oracle on 2017, 2018, 2019.
// Modifications copyright (c) 2017-2019, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
// Use, modification and distribution is subject to the Boost Software License,
@@ -65,27 +65,21 @@ namespace projections
T K, c, hlf_e, kR, cosp0, sinp0;
};
// template class, using CRTP to implement forward/inverse
template <typename T, typename Parameters>
struct base_somerc_ellipsoid
: public base_t_fi<base_somerc_ellipsoid<T, Parameters>, T, Parameters>
{
par_somerc<T> m_proj_parm;
inline base_somerc_ellipsoid(const Parameters& par)
: base_t_fi<base_somerc_ellipsoid<T, Parameters>, T, Parameters>(*this, par)
{}
// FORWARD(e_forward)
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
inline void fwd(Parameters const& par, 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>();
T phip, lamp, phipp, lampp, sp, cp;
sp = this->m_par.e * sin(lp_lat);
sp = par.e * sin(lp_lat);
phip = 2.* atan( exp( this->m_proj_parm.c * (
log(tan(fourth_pi + 0.5 * lp_lat)) - this->m_proj_parm.hlf_e * log((1. + sp)/(1. - sp)))
+ this->m_proj_parm.K)) - half_pi;
@@ -99,7 +93,7 @@ namespace projections
// INVERSE(e_inverse) ellipsoid & spheroid
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
inline void inv(Parameters const& par, T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
{
static const T fourth_pi = detail::fourth_pi<T>();
@@ -113,10 +107,10 @@ namespace projections
lamp = aasin(cp * sin(lampp) / cos(phip));
con = (this->m_proj_parm.K - log(tan(fourth_pi + 0.5 * phip)))/this->m_proj_parm.c;
for (i = n_iter; i ; --i) {
esp = this->m_par.e * sin(phip);
esp = par.e * sin(phip);
delp = (con + log(tan(fourth_pi + 0.5 * phip)) - this->m_proj_parm.hlf_e *
log((1. + esp)/(1. - esp)) ) *
(1. - esp * esp) * cos(phip) * this->m_par.rone_es;
(1. - esp * esp) * cos(phip) * par.rone_es;
phip -= delp;
if (fabs(delp) < epsilon)
break;
@@ -138,7 +132,7 @@ namespace projections
// Swiss. Obl. Mercator
template <typename Parameters, typename T>
inline void setup_somerc(Parameters& par, par_somerc<T>& proj_parm)
inline void setup_somerc(Parameters const& par, par_somerc<T>& proj_parm)
{
static const T fourth_pi = detail::fourth_pi<T>();
@@ -178,9 +172,8 @@ namespace projections
{
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);
detail::somerc::setup_somerc(par, this->m_proj_parm);
}
};
@@ -189,11 +182,11 @@ namespace projections
{
// Static projection
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_somerc, somerc_ellipsoid, somerc_ellipsoid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_FI(srs::spar::proj_somerc, somerc_ellipsoid)
// Factory entry(s)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(somerc_entry, somerc_ellipsoid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(somerc_init)
{
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(somerc, somerc_entry)

View File

@@ -2,8 +2,8 @@
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2017, 2018.
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
// This file was modified by Oracle on 2017, 2018, 2019.
// Modifications copyright (c) 2017-2019, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
// Use, modification and distribution is subject to the Boost Software License,
@@ -79,6 +79,7 @@ namespace projections
T cosX1;
T akm1;
mode_type mode;
bool variant_c;
};
template <typename T>
@@ -91,20 +92,14 @@ namespace projections
math::pow((T(1) - sinphi) / (T(1) + sinphi), T(0.5) * eccen));
}
// template class, using CRTP to implement forward/inverse
template <typename T, typename Parameters>
struct base_stere_ellipsoid
: public base_t_fi<base_stere_ellipsoid<T, Parameters>, T, Parameters>
{
par_stere<T> m_proj_parm;
inline base_stere_ellipsoid(const Parameters& par)
: base_t_fi<base_stere_ellipsoid<T, Parameters>, T, Parameters>(*this, par)
{}
// FORWARD(e_forward) ellipsoid
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
inline void fwd(T const& lp_lon, T lp_lat, T& xy_x, T& xy_y) const
inline void fwd(Parameters const& par, T const& lp_lon, T lp_lat, T& xy_x, T& xy_y) const
{
static const T half_pi = detail::half_pi<T>();
@@ -114,7 +109,7 @@ namespace projections
sinlam = sin(lp_lon);
sinphi = sin(lp_lat);
if (this->m_proj_parm.mode == obliq || this->m_proj_parm.mode == equit) {
sinX = sin(X = 2. * atan(ssfn_(lp_lat, sinphi, this->m_par.e)) - half_pi);
sinX = sin(X = 2. * atan(ssfn_(lp_lat, sinphi, par.e)) - half_pi);
cosX = cos(X);
}
switch (this->m_proj_parm.mode) {
@@ -143,8 +138,21 @@ namespace projections
sinphi = -sinphi;
BOOST_FALLTHROUGH;
case n_pole:
xy_x = this->m_proj_parm.akm1 * pj_tsfn(lp_lat, sinphi, this->m_par.e);
xy_y = - xy_x * coslam;
// see IOGP Publication 373-7-2 – Geomatics Guidance Note number 7, part 2
// December 2021 pg. 82
if( m_proj_parm.variant_c )
{
auto t = pj_tsfn(lp_lat, sinphi, par.e);
auto tf = pj_tsfn(this->m_proj_parm.phits,
sin(this->m_proj_parm.phits),
par.e);
xy_x = this->m_proj_parm.akm1 * t;
auto mf = this->m_proj_parm.akm1 * tf;
xy_y = - xy_x * coslam - mf;
} else {
xy_x = this->m_proj_parm.akm1 * pj_tsfn(lp_lat, sinphi, par.e);
xy_y = - xy_x * coslam;
}
break;
}
@@ -153,11 +161,12 @@ 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(Parameters const& par, T xy_x, T xy_y, T& lp_lon, T& lp_lat) const
{
static const T half_pi = detail::half_pi<T>();
T cosphi, sinphi, tp=0.0, phi_l=0.0, rho, halfe=0.0, halfpi=0.0;
T mf = 0;
int i;
rho = boost::math::hypot(xy_x, xy_y);
@@ -175,24 +184,34 @@ namespace projections
xy_x *= sinphi;
xy_y = rho * this->m_proj_parm.cosX1 * cosphi - xy_y * this->m_proj_parm.sinX1* sinphi;
halfpi = half_pi;
halfe = .5 * this->m_par.e;
halfe = .5 * par.e;
break;
case n_pole:
xy_y = -xy_y;
BOOST_FALLTHROUGH;
case s_pole:
// see IOGP Publication 373-7-2 – Geomatics Guidance Note number 7, part 2
// December 2021 pg. 82
if( m_proj_parm.variant_c )
{
auto tf = pj_tsfn(this->m_proj_parm.phits,
sin(this->m_proj_parm.phits),
par.e);
mf = this->m_proj_parm.akm1 * tf;
rho = boost::math::hypot(xy_x, xy_y + mf);
}
phi_l = half_pi - 2. * atan(tp = - rho / this->m_proj_parm.akm1);
halfpi = -half_pi;
halfe = -.5 * this->m_par.e;
halfe = -.5 * par.e;
break;
}
for (i = n_iter; i--; phi_l = lp_lat) {
sinphi = this->m_par.e * sin(phi_l);
sinphi = par.e * sin(phi_l);
lp_lat = T(2) * atan(tp * math::pow((T(1)+sinphi)/(T(1)-sinphi), halfe)) - halfpi;
if (fabs(phi_l - lp_lat) < conv_tolerance) {
if (this->m_proj_parm.mode == s_pole)
lp_lat = -lp_lat;
lp_lon = (xy_x == 0. && xy_y == 0.) ? 0. : atan2(xy_x, xy_y);
lp_lon = (xy_x == 0. && xy_y == 0.) ? 0. : atan2(xy_x, xy_y + mf);
return;
}
}
@@ -206,20 +225,14 @@ namespace projections
};
// template class, using CRTP to implement forward/inverse
template <typename T, typename Parameters>
struct base_stere_spheroid
: public base_t_fi<base_stere_spheroid<T, Parameters>, T, Parameters>
{
par_stere<T> m_proj_parm;
inline base_stere_spheroid(const Parameters& par)
: base_t_fi<base_stere_spheroid<T, Parameters>, T, Parameters>(*this, par)
{}
// FORWARD(s_forward) spheroid
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
inline void fwd(T const& lp_lon, T lp_lat, T& xy_x, T& xy_y) const
inline void fwd(Parameters const& , 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>();
@@ -260,7 +273,7 @@ namespace projections
// INVERSE(s_inverse) spheroid
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
inline void inv(T const& xy_x, T xy_y, T& lp_lon, T& lp_lat) const
inline void inv(Parameters const& par, T const& xy_x, T xy_y, T& lp_lon, T& lp_lat) const
{
T c, rh, sinc, cosc;
@@ -279,7 +292,7 @@ namespace projections
break;
case obliq:
if (fabs(rh) <= epsilon10)
lp_lat = this->m_par.phi0;
lp_lat = par.phi0;
else
lp_lat = asin(cosc * this->m_proj_parm.sinX1 + xy_y * sinc * this->m_proj_parm.cosX1 / rh);
if ((c = cosc - this->m_proj_parm.sinX1 * sin(lp_lat)) != 0. || xy_x != 0.)
@@ -290,7 +303,7 @@ namespace projections
BOOST_FALLTHROUGH;
case s_pole:
if (fabs(rh) <= epsilon10)
lp_lat = this->m_par.phi0;
lp_lat = par.phi0;
else
lp_lat = asin(this->m_proj_parm.mode == s_pole ? - cosc : cosc);
lp_lon = (xy_x == 0. && xy_y == 0.) ? 0. : atan2(xy_x, xy_y);
@@ -306,7 +319,7 @@ namespace projections
};
template <typename Parameters, typename T>
inline void setup(Parameters& par, par_stere<T>& proj_parm) /* general initialization */
inline void setup(Parameters const& par, par_stere<T>& proj_parm) /* general initialization */
{
static const T fourth_pi = detail::fourth_pi<T>();
static const T half_pi = detail::half_pi<T>();
@@ -367,13 +380,17 @@ namespace projections
// Stereographic
template <typename Params, typename Parameters, typename T>
inline void setup_stere(Params const& params, Parameters& par, par_stere<T>& proj_parm)
inline void setup_stere(Params const& params, Parameters const& par, par_stere<T>& proj_parm)
{
static const T half_pi = detail::half_pi<T>();
if (! pj_param_r<srs::spar::lat_ts>(params, "lat_ts", srs::dpar::lat_ts, proj_parm.phits))
proj_parm.phits = half_pi;
proj_parm.variant_c = false;
if (pj_param_exists<srs::spar::variant_c>(params, "variant_c", srs::dpar::variant_c))
proj_parm.variant_c = true;
setup(par, proj_parm);
}
@@ -419,10 +436,9 @@ namespace projections
struct stere_ellipsoid : public detail::stere::base_stere_ellipsoid<T, Parameters>
{
template <typename Params>
inline stere_ellipsoid(Params const& params, const Parameters& par)
: detail::stere::base_stere_ellipsoid<T, Parameters>(par)
inline stere_ellipsoid(Params const& params, Parameters const& par)
{
detail::stere::setup_stere(params, this->m_par, this->m_proj_parm);
detail::stere::setup_stere(params, par, this->m_proj_parm);
}
};
@@ -445,10 +461,9 @@ namespace projections
struct stere_spheroid : public detail::stere::base_stere_spheroid<T, Parameters>
{
template <typename Params>
inline stere_spheroid(Params const& params, const Parameters& par)
: detail::stere::base_stere_spheroid<T, Parameters>(par)
inline stere_spheroid(Params const& params, Parameters const& par)
{
detail::stere::setup_stere(params, this->m_par, this->m_proj_parm);
detail::stere::setup_stere(params, par, this->m_proj_parm);
}
};
@@ -471,10 +486,9 @@ namespace projections
struct ups_ellipsoid : public detail::stere::base_stere_ellipsoid<T, Parameters>
{
template <typename Params>
inline ups_ellipsoid(Params const& params, const Parameters& par)
: detail::stere::base_stere_ellipsoid<T, Parameters>(par)
inline ups_ellipsoid(Params const& params, Parameters & par)
{
detail::stere::setup_ups(params, this->m_par, this->m_proj_parm);
detail::stere::setup_ups(params, par, this->m_proj_parm);
}
};
@@ -497,10 +511,9 @@ namespace projections
struct ups_spheroid : public detail::stere::base_stere_spheroid<T, Parameters>
{
template <typename Params>
inline ups_spheroid(Params const& params, const Parameters& par)
: detail::stere::base_stere_spheroid<T, Parameters>(par)
inline ups_spheroid(Params const& params, Parameters & par)
{
detail::stere::setup_ups(params, this->m_par, this->m_proj_parm);
detail::stere::setup_ups(params, par, this->m_proj_parm);
}
};
@@ -509,13 +522,13 @@ namespace projections
{
// Static projection
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)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_FI2(srs::spar::proj_stere, stere_spheroid, stere_ellipsoid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_FI2(srs::spar::proj_ups, ups_spheroid, ups_ellipsoid)
// Factory entry(s)
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)
{
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(stere, stere_entry)

View File

@@ -2,8 +2,8 @@
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2017, 2018.
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
// This file was modified by Oracle on 2017, 2018, 2019.
// Modifications copyright (c) 2017-2019, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
// Use, modification and distribution is subject to the Boost Software License,
@@ -69,20 +69,14 @@ namespace projections
gauss<T> en;
};
// template class, using CRTP to implement forward/inverse
template <typename T, typename Parameters>
struct base_sterea_ellipsoid
: public base_t_fi<base_sterea_ellipsoid<T, Parameters>, T, Parameters>
{
par_sterea<T> m_proj_parm;
inline base_sterea_ellipsoid(const Parameters& par)
: base_t_fi<base_sterea_ellipsoid<T, Parameters>, T, Parameters>(*this, par)
{}
// 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(Parameters const& par, T lp_lon, T lp_lat, T& xy_x, T& xy_y) const
{
T cosc, sinc, cosl_, k;
@@ -90,19 +84,19 @@ namespace projections
sinc = sin(lp_lat);
cosc = cos(lp_lat);
cosl_ = cos(lp_lon);
k = this->m_par.k0 * this->m_proj_parm.R2 / (1. + this->m_proj_parm.sinc0 * sinc + this->m_proj_parm.cosc0 * cosc * cosl_);
k = par.k0 * this->m_proj_parm.R2 / (1. + this->m_proj_parm.sinc0 * sinc + this->m_proj_parm.cosc0 * cosc * cosl_);
xy_x = k * cosc * sin(lp_lon);
xy_y = k * (this->m_proj_parm.cosc0 * sinc - this->m_proj_parm.sinc0 * cosc * cosl_);
}
// 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(Parameters const& par, T xy_x, T xy_y, T& lp_lon, T& lp_lat) const
{
T rho, c, sinc, cosc;
xy_x /= this->m_par.k0;
xy_y /= this->m_par.k0;
xy_x /= par.k0;
xy_y /= par.k0;
if((rho = boost::math::hypot(xy_x, xy_y)) != 0.0) {
c = 2. * atan2(rho, this->m_proj_parm.R2);
sinc = sin(c);
@@ -126,7 +120,7 @@ namespace projections
// Oblique Stereographic Alternative
template <typename Parameters, typename T>
inline void setup_sterea(Parameters& par, par_sterea<T>& proj_parm)
inline void setup_sterea(Parameters const& par, par_sterea<T>& proj_parm)
{
T R;
@@ -157,9 +151,8 @@ namespace projections
{
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);
detail::sterea::setup_sterea(par, this->m_proj_parm);
}
};
@@ -168,11 +161,11 @@ namespace projections
{
// Static projection
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_sterea, sterea_ellipsoid, sterea_ellipsoid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_FI(srs::spar::proj_sterea, sterea_ellipsoid)
// Factory entry(s)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(sterea_entry, sterea_ellipsoid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(sterea_init)
{
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(sterea, sterea_entry)

View File

@@ -2,8 +2,8 @@
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2017, 2018.
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
// This file was modified by Oracle on 2017, 2018, 2019.
// Modifications copyright (c) 2017-2019, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
// Use, modification and distribution is subject to the Boost Software License,
@@ -61,20 +61,14 @@ namespace projections
bool tan_mode;
};
// template class, using CRTP to implement forward/inverse
template <typename T, typename Parameters>
struct base_sts_spheroid
: public base_t_fi<base_sts_spheroid<T, Parameters>, T, Parameters>
{
par_sts<T> m_proj_parm;
inline base_sts_spheroid(const Parameters& par)
: base_t_fi<base_sts_spheroid<T, Parameters>, T, Parameters>(*this, par)
{}
// FORWARD(s_forward) spheroid
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
inline void fwd(T const& lp_lon, T lp_lat, T& xy_x, T& xy_y) const
inline void fwd(Parameters const& , T const& lp_lon, T lp_lat, T& xy_x, T& xy_y) const
{
T c;
@@ -93,7 +87,7 @@ namespace projections
// INVERSE(s_inverse) spheroid
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
inline void inv(T const& xy_x, T xy_y, T& lp_lon, T& lp_lat) const
inline void inv(Parameters const& , T const& xy_x, T xy_y, T& lp_lon, T& lp_lat) const
{
T c;
@@ -115,7 +109,7 @@ namespace projections
};
template <typename Parameters, typename T>
inline void setup(Parameters& par, par_sts<T>& proj_parm, T const& p, T const& q, bool mode)
inline void setup(Parameters& par, par_sts<T>& proj_parm, T const& p, T const& q, bool mode)
{
par.es = 0.;
proj_parm.C_x = q / p;
@@ -172,10 +166,9 @@ namespace projections
struct kav5_spheroid : public detail::sts::base_sts_spheroid<T, Parameters>
{
template <typename Params>
inline kav5_spheroid(Params const& , Parameters const& par)
: detail::sts::base_sts_spheroid<T, Parameters>(par)
inline kav5_spheroid(Params const& , Parameters & par)
{
detail::sts::setup_kav5(this->m_par, this->m_proj_parm);
detail::sts::setup_kav5(par, this->m_proj_parm);
}
};
@@ -195,10 +188,9 @@ namespace projections
struct qua_aut_spheroid : public detail::sts::base_sts_spheroid<T, Parameters>
{
template <typename Params>
inline qua_aut_spheroid(Params const& , Parameters const& par)
: detail::sts::base_sts_spheroid<T, Parameters>(par)
inline qua_aut_spheroid(Params const& , Parameters & par)
{
detail::sts::setup_qua_aut(this->m_par, this->m_proj_parm);
detail::sts::setup_qua_aut(par, this->m_proj_parm);
}
};
@@ -218,10 +210,9 @@ namespace projections
struct mbt_s_spheroid : public detail::sts::base_sts_spheroid<T, Parameters>
{
template <typename Params>
inline mbt_s_spheroid(Params const& , Parameters const& par)
: detail::sts::base_sts_spheroid<T, Parameters>(par)
inline mbt_s_spheroid(Params const& , Parameters & par)
{
detail::sts::setup_mbt_s(this->m_par, this->m_proj_parm);
detail::sts::setup_mbt_s(par, this->m_proj_parm);
}
};
@@ -241,10 +232,9 @@ namespace projections
struct fouc_spheroid : public detail::sts::base_sts_spheroid<T, Parameters>
{
template <typename Params>
inline fouc_spheroid(Params const& , Parameters const& par)
: detail::sts::base_sts_spheroid<T, Parameters>(par)
inline fouc_spheroid(Params const& , Parameters & par)
{
detail::sts::setup_fouc(this->m_par, this->m_proj_parm);
detail::sts::setup_fouc(par, this->m_proj_parm);
}
};
@@ -253,17 +243,17 @@ namespace projections
{
// Static projection
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)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_FI(srs::spar::proj_kav5, kav5_spheroid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_FI(srs::spar::proj_qua_aut, qua_aut_spheroid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_FI(srs::spar::proj_mbt_s, mbt_s_spheroid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_FI(srs::spar::proj_fouc, fouc_spheroid)
// Factory entry(s)
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)
{
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(kav5, kav5_entry)

View File

@@ -2,8 +2,8 @@
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2017, 2018.
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
// This file was modified by Oracle on 2017, 2018, 2019.
// Modifications copyright (c) 2017-2019, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
// Use, modification and distribution is subject to the Boost Software License,
@@ -56,18 +56,12 @@ namespace projections
static const double epsilon10 = 1.e-10;
// template class, using CRTP to implement forward/inverse
template <typename T, typename Parameters>
struct base_tcc_spheroid
: public base_t_f<base_tcc_spheroid<T, Parameters>, T, Parameters>
{
inline base_tcc_spheroid(const Parameters& par)
: base_t_f<base_tcc_spheroid<T, Parameters>, T, Parameters>(*this, par)
{}
// FORWARD(s_forward) spheroid
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
inline void fwd(Parameters const& , T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
{
T b, bt;
@@ -113,10 +107,9 @@ namespace projections
struct tcc_spheroid : public detail::tcc::base_tcc_spheroid<T, Parameters>
{
template <typename Params>
inline tcc_spheroid(Params const& , Parameters const& par)
: detail::tcc::base_tcc_spheroid<T, Parameters>(par)
inline tcc_spheroid(Params const& , Parameters & par)
{
detail::tcc::setup_tcc(this->m_par);
detail::tcc::setup_tcc(par);
}
};
@@ -125,11 +118,11 @@ namespace projections
{
// Static projection
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_tcc, tcc_spheroid, tcc_spheroid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_F(srs::spar::proj_tcc, tcc_spheroid)
// Factory entry(s)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_F(tcc_entry, tcc_spheroid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(tcc_init)
{
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(tcc, tcc_entry)

View File

@@ -2,8 +2,8 @@
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2017, 2018.
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
// This file was modified by Oracle on 2017, 2018, 2019.
// Modifications copyright (c) 2017-2019, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
// Use, modification and distribution is subject to the Boost Software License,
@@ -53,31 +53,25 @@ namespace projections
#ifndef DOXYGEN_NO_DETAIL
namespace detail { namespace tcea
{
// template class, using CRTP to implement forward/inverse
template <typename T, typename Parameters>
struct base_tcea_spheroid
: public base_t_fi<base_tcea_spheroid<T, Parameters>, T, Parameters>
{
inline base_tcea_spheroid(const Parameters& par)
: base_t_fi<base_tcea_spheroid<T, Parameters>, T, Parameters>(*this, par)
{}
// FORWARD(s_forward) spheroid
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
inline void fwd(Parameters const& par, 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);
xy_x = cos(lp_lat) * sin(lp_lon) / par.k0;
xy_y = par.k0 * (atan2(tan(lp_lat), cos(lp_lon)) - par.phi0);
}
// 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(Parameters const& par, T xy_x, T xy_y, T& lp_lon, T& lp_lat) const
{
T t;
xy_y = xy_y / this->m_par.k0 + this->m_par.phi0;
xy_x *= this->m_par.k0;
xy_y = xy_y / par.k0 + par.phi0;
xy_x *= par.k0;
t = sqrt(1. - xy_x * xy_x);
lp_lat = asin(t * sin(xy_y));
lp_lon = atan2(xy_x, t * cos(xy_y));
@@ -99,7 +93,7 @@ namespace projections
}} // namespace detail::tcea
#endif // doxygen
/*!
\brief Transverse Cylindrical Equal Area projection
\ingroup projections
@@ -116,10 +110,9 @@ namespace projections
struct tcea_spheroid : public detail::tcea::base_tcea_spheroid<T, Parameters>
{
template <typename Params>
inline tcea_spheroid(Params const& , Parameters const& par)
: detail::tcea::base_tcea_spheroid<T, Parameters>(par)
inline tcea_spheroid(Params const& , Parameters & par)
{
detail::tcea::setup_tcea(this->m_par);
detail::tcea::setup_tcea(par);
}
};
@@ -128,11 +121,11 @@ namespace projections
{
// Static projection
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_tcea, tcea_spheroid, tcea_spheroid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_FI(srs::spar::proj_tcea, tcea_spheroid)
// Factory entry(s)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(tcea_entry, tcea_spheroid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(tcea_init)
{
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(tcea, tcea_entry)

View File

@@ -1,9 +1,11 @@
// Boost.Geometry - gis-projections (based on PROJ4)
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2023 Adam Wulkiewicz, Lodz, Poland.
// This file was modified by Oracle on 2017, 2018.
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
// This file was modified by Oracle on 2017, 2018, 2019, 2022.
// Modifications copyright (c) 2017-2022, Oracle and/or its affiliates.
// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
// Use, modification and distribution is subject to the Boost Software License,
@@ -15,7 +17,7 @@
// PROJ4 is maintained by Frank Warmerdam
// PROJ4 is converted to Boost.Geometry by Barend Gehrels
// Last updated version of proj: 5.0.0
// Last updated version of proj: 8.2.1
// Original copyright notice:
@@ -40,8 +42,6 @@
#ifndef BOOST_GEOMETRY_PROJECTIONS_TMERC_HPP
#define BOOST_GEOMETRY_PROJECTIONS_TMERC_HPP
#include <boost/geometry/util/math.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>
@@ -49,6 +49,9 @@
#include <boost/geometry/srs/projections/impl/function_overloads.hpp>
#include <boost/geometry/srs/projections/impl/pj_mlfn.hpp>
#include <boost/geometry/util/condition.hpp>
#include <boost/geometry/util/math.hpp>
namespace boost { namespace geometry
{
@@ -59,238 +62,574 @@ namespace projections
namespace detail { namespace tmerc
{
static const double epsilon10 = 1.e-10;
static const double epsilon10 = 1.e-10;
template <typename T>
inline T FC1() { return 1.; }
template <typename T>
inline T FC2() { return .5; }
template <typename T>
inline T FC3() { return .16666666666666666666666666666666666666; }
template <typename T>
inline T FC4() { return .08333333333333333333333333333333333333; }
template <typename T>
inline T FC5() { return .05; }
template <typename T>
inline T FC6() { return .03333333333333333333333333333333333333; }
template <typename T>
inline T FC7() { return .02380952380952380952380952380952380952; }
template <typename T>
inline T FC8() { return .01785714285714285714285714285714285714; }
/* Constant for "exact" transverse mercator */
static const int proj_etmerc_order = 6;
template <typename T>
struct par_tmerc
template <typename T>
inline T FC1() { return 1.; }
template <typename T>
inline T FC2() { return .5; }
template <typename T>
inline T FC3() { return .16666666666666666666666666666666666666; }
template <typename T>
inline T FC4() { return .08333333333333333333333333333333333333; }
template <typename T>
inline T FC5() { return .05; }
template <typename T>
inline T FC6() { return .03333333333333333333333333333333333333; }
template <typename T>
inline T FC7() { return .02380952380952380952380952380952380952; }
template <typename T>
inline T FC8() { return .01785714285714285714285714285714285714; }
template <typename T>
struct par_tmerc
{
T esp;
T ml0;
detail::en<T> en;
};
// More exact: Poder/Engsager
template <typename T>
struct par_tmerc_exact
{
T Qn; /* Merid. quad., scaled to the projection */
T Zb; /* Radius vector in polar coord. systems */
T cgb[6]; /* Constants for Gauss -> Geo lat */
T cbg[6]; /* Constants for Geo lat -> Gauss */
T utg[6]; /* Constants for transv. merc. -> geo */
T gtu[6]; /* Constants for geo -> transv. merc. */
};
template <typename T, typename Parameters>
struct base_tmerc_ellipsoid
{
par_tmerc<T> m_proj_parm;
// FORWARD(e_forward) ellipse
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
inline void fwd(Parameters const& par, T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
{
T esp;
T ml0;
detail::en<T> en;
};
static const T half_pi = detail::half_pi<T>();
static const T FC1 = tmerc::FC1<T>();
static const T FC2 = tmerc::FC2<T>();
static const T FC3 = tmerc::FC3<T>();
static const T FC4 = tmerc::FC4<T>();
static const T FC5 = tmerc::FC5<T>();
static const T FC6 = tmerc::FC6<T>();
static const T FC7 = tmerc::FC7<T>();
static const T FC8 = tmerc::FC8<T>();
// template class, using CRTP to implement forward/inverse
template <typename T, typename Parameters>
struct base_tmerc_ellipsoid
: public base_t_fi<base_tmerc_ellipsoid<T, Parameters>, T, Parameters>
{
par_tmerc<T> m_proj_parm;
T al, als, n, cosphi, sinphi, t;
inline base_tmerc_ellipsoid(const Parameters& par)
: base_t_fi<base_tmerc_ellipsoid<T, Parameters>, T, Parameters>(*this, par)
{}
// FORWARD(e_forward) ellipse
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
/*
* Fail if our longitude is more than 90 degrees from the
* central meridian since the results are essentially garbage.
* Is error -20 really an appropriate return value?
*
* http://trac.osgeo.org/proj/ticket/5
*/
if( lp_lon < -half_pi || lp_lon > half_pi )
{
static const T half_pi = detail::half_pi<T>();
static const T FC1 = tmerc::FC1<T>();
static const T FC2 = tmerc::FC2<T>();
static const T FC3 = tmerc::FC3<T>();
static const T FC4 = tmerc::FC4<T>();
static const T FC5 = tmerc::FC5<T>();
static const T FC6 = tmerc::FC6<T>();
static const T FC7 = tmerc::FC7<T>();
static const T FC8 = tmerc::FC8<T>();
xy_x = HUGE_VAL;
xy_y = HUGE_VAL;
BOOST_THROW_EXCEPTION( projection_exception(error_lat_or_lon_exceed_limit) );
return;
}
T al, als, n, cosphi, sinphi, t;
sinphi = sin(lp_lat);
cosphi = cos(lp_lat);
t = fabs(cosphi) > 1e-10 ? sinphi/cosphi : 0.;
t *= t;
al = cosphi * lp_lon;
als = al * al;
al /= sqrt(1. - par.es * sinphi * sinphi);
n = this->m_proj_parm.esp * cosphi * cosphi;
xy_x = par.k0 * al * (FC1 +
FC3 * als * (1. - t + n +
FC5 * als * (5. + t * (t - 18.) + n * (14. - 58. * t)
+ FC7 * als * (61. + t * ( t * (179. - t) - 479. ) )
)));
xy_y = par.k0 * (pj_mlfn(lp_lat, sinphi, cosphi, this->m_proj_parm.en) - this->m_proj_parm.ml0 +
sinphi * al * lp_lon * FC2 * ( 1. +
FC4 * als * (5. - t + n * (9. + 4. * n) +
FC6 * als * (61. + t * (t - 58.) + n * (270. - 330 * t)
+ FC8 * als * (1385. + t * ( t * (543. - t) - 3111.) )
))));
}
/*
* Fail if our longitude is more than 90 degrees from the
* central meridian since the results are essentially garbage.
* Is error -20 really an appropriate return value?
*
* http://trac.osgeo.org/proj/ticket/5
*/
if( lp_lon < -half_pi || lp_lon > half_pi )
{
xy_x = HUGE_VAL;
xy_y = HUGE_VAL;
BOOST_THROW_EXCEPTION( projection_exception(error_lat_or_lon_exceed_limit) );
return;
}
// INVERSE(e_inverse) ellipsoid
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
inline void inv(Parameters const& par, 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>();
static const T FC2 = tmerc::FC2<T>();
static const T FC3 = tmerc::FC3<T>();
static const T FC4 = tmerc::FC4<T>();
static const T FC5 = tmerc::FC5<T>();
static const T FC6 = tmerc::FC6<T>();
static const T FC7 = tmerc::FC7<T>();
static const T FC8 = tmerc::FC8<T>();
T n, con, cosphi, d, ds, sinphi, t;
lp_lat = pj_inv_mlfn(this->m_proj_parm.ml0 + xy_y / par.k0, par.es, this->m_proj_parm.en);
if (fabs(lp_lat) >= half_pi) {
lp_lat = xy_y < 0. ? -half_pi : half_pi;
lp_lon = 0.;
} else {
sinphi = sin(lp_lat);
cosphi = cos(lp_lat);
t = fabs(cosphi) > 1e-10 ? sinphi/cosphi : 0.;
t *= t;
al = cosphi * lp_lon;
als = al * al;
al /= sqrt(1. - this->m_par.es * sinphi * sinphi);
n = this->m_proj_parm.esp * cosphi * cosphi;
xy_x = this->m_par.k0 * al * (FC1 +
FC3 * als * (1. - t + n +
FC5 * als * (5. + t * (t - 18.) + n * (14. - 58. * t)
+ FC7 * als * (61. + t * ( t * (179. - t) - 479. ) )
d = xy_x * sqrt(con = 1. - par.es * sinphi * sinphi) / par.k0;
con *= t;
t *= t;
ds = d * d;
lp_lat -= (con * ds / (1.-par.es)) * FC2 * (1. -
ds * FC4 * (5. + t * (3. - 9. * n) + n * (1. - 4 * n) -
ds * FC6 * (61. + t * (90. - 252. * n +
45. * t) + 46. * n
- ds * FC8 * (1385. + t * (3633. + t * (4095. + 1574. * t)) )
)));
xy_y = this->m_par.k0 * (pj_mlfn(lp_lat, sinphi, cosphi, this->m_proj_parm.en) - this->m_proj_parm.ml0 +
sinphi * al * lp_lon * FC2 * ( 1. +
FC4 * als * (5. - t + n * (9. + 4. * n) +
FC6 * als * (61. + t * (t - 58.) + n * (270. - 330 * t)
+ FC8 * als * (1385. + t * ( t * (543. - t) - 3111.) )
))));
}
// INVERSE(e_inverse) ellipsoid
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
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>();
static const T FC2 = tmerc::FC2<T>();
static const T FC3 = tmerc::FC3<T>();
static const T FC4 = tmerc::FC4<T>();
static const T FC5 = tmerc::FC5<T>();
static const T FC6 = tmerc::FC6<T>();
static const T FC7 = tmerc::FC7<T>();
static const T FC8 = tmerc::FC8<T>();
T n, con, cosphi, d, ds, sinphi, t;
lp_lat = pj_inv_mlfn(this->m_proj_parm.ml0 + xy_y / this->m_par.k0, this->m_par.es, this->m_proj_parm.en);
if (fabs(lp_lat) >= half_pi) {
lp_lat = xy_y < 0. ? -half_pi : half_pi;
lp_lon = 0.;
} else {
sinphi = sin(lp_lat);
cosphi = cos(lp_lat);
t = fabs(cosphi) > 1e-10 ? sinphi/cosphi : 0.;
n = this->m_proj_parm.esp * cosphi * cosphi;
d = xy_x * sqrt(con = 1. - this->m_par.es * sinphi * sinphi) / this->m_par.k0;
con *= t;
t *= t;
ds = d * d;
lp_lat -= (con * ds / (1.-this->m_par.es)) * FC2 * (1. -
ds * FC4 * (5. + t * (3. - 9. * n) + n * (1. - 4 * n) -
ds * FC6 * (61. + t * (90. - 252. * n +
45. * t) + 46. * n
- ds * FC8 * (1385. + t * (3633. + t * (4095. + 1574. * t)) )
)));
lp_lon = d*(FC1 -
ds*FC3*( 1. + 2.*t + n -
ds*FC5*(5. + t*(28. + 24.*t + 8.*n) + 6.*n
- ds * FC7 * (61. + t * (662. + t * (1320. + 720. * t)) )
))) / cosphi;
}
}
static inline std::string get_name()
{
return "tmerc_ellipsoid";
}
};
// template class, using CRTP to implement forward/inverse
template <typename T, typename Parameters>
struct base_tmerc_spheroid
: public base_t_fi<base_tmerc_spheroid<T, Parameters>, T, Parameters>
{
par_tmerc<T> m_proj_parm;
inline base_tmerc_spheroid(const Parameters& par)
: base_t_fi<base_tmerc_spheroid<T, Parameters>, T, Parameters>(*this, par)
{}
// FORWARD(s_forward) sphere
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
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>();
T b, cosphi;
/*
* Fail if our longitude is more than 90 degrees from the
* central meridian since the results are essentially garbage.
* Is error -20 really an appropriate return value?
*
* http://trac.osgeo.org/proj/ticket/5
*/
if( lp_lon < -half_pi || lp_lon > half_pi )
{
xy_x = HUGE_VAL;
xy_y = HUGE_VAL;
BOOST_THROW_EXCEPTION( projection_exception(error_lat_or_lon_exceed_limit) );
return;
}
cosphi = cos(lp_lat);
b = cosphi * sin(lp_lon);
if (fabs(fabs(b) - 1.) <= epsilon10)
BOOST_THROW_EXCEPTION( projection_exception(error_tolerance_condition) );
xy_x = this->m_proj_parm.ml0 * log((1. + b) / (1. - b));
xy_y = cosphi * cos(lp_lon) / sqrt(1. - b * b);
b = fabs( xy_y );
if (b >= 1.) {
if ((b - 1.) > epsilon10)
BOOST_THROW_EXCEPTION( projection_exception(error_tolerance_condition) );
else xy_y = 0.;
} else
xy_y = acos(xy_y);
if (lp_lat < 0.)
xy_y = -xy_y;
xy_y = this->m_proj_parm.esp * (xy_y - this->m_par.phi0);
}
// INVERSE(s_inverse) sphere
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
{
T h, g;
h = exp(xy_x / this->m_proj_parm.esp);
g = .5 * (h - 1. / h);
h = cos(this->m_par.phi0 + xy_y / this->m_proj_parm.esp);
lp_lat = asin(sqrt((1. - h * h) / (1. + g * g)));
/* Make sure that phi is on the correct hemisphere when false northing is used */
if (xy_y < 0. && -lp_lat+this->m_par.phi0 < 0.0) lp_lat = -lp_lat;
lp_lon = (g != 0.0 || h != 0.0) ? atan2(g, h) : 0.;
}
static inline std::string get_name()
{
return "tmerc_spheroid";
}
};
template <typename Parameters, typename T>
inline void setup(Parameters& par, par_tmerc<T>& proj_parm)
{
if (par.es != 0.0) {
proj_parm.en = pj_enfn<T>(par.es);
proj_parm.ml0 = pj_mlfn(par.phi0, sin(par.phi0), cos(par.phi0), proj_parm.en);
proj_parm.esp = par.es / (1. - par.es);
} else {
proj_parm.esp = par.k0;
proj_parm.ml0 = .5 * proj_parm.esp;
lp_lon = d*(FC1 -
ds*FC3*( 1. + 2.*t + n -
ds*FC5*(5. + t*(28. + 24.*t + 8.*n) + 6.*n
- ds * FC7 * (61. + t * (662. + t * (1320. + 720. * t)) )
))) / cosphi;
}
}
static inline std::string get_name()
{
return "tmerc_ellipsoid";
}
};
template <typename T, typename Parameters>
struct base_tmerc_ellipsoid_exact
{
par_tmerc_exact<T> m_proj_parm;
static inline std::string get_name()
{
return "tmerc_ellipsoid";
}
/* Helper functions for "exact" transverse mercator */
inline
static T gatg(const T *p1, int len_p1, T B, T cos_2B, T sin_2B)
{
T h = 0, h1, h2 = 0;
const T two_cos_2B = 2*cos_2B;
const T* p = p1 + len_p1;
h1 = *--p;
while (p - p1) {
h = -h2 + two_cos_2B*h1 + *--p;
h2 = h1;
h1 = h;
}
return (B + h*sin_2B);
}
/* Complex Clenshaw summation */
inline
static T clenS(const T *a, int size,
T sin_arg_r, T cos_arg_r,
T sinh_arg_i, T cosh_arg_i,
T *R, T *I)
{
T r, i, hr, hr1, hr2, hi, hi1, hi2;
/* arguments */
const T* p = a + size;
r = 2*cos_arg_r*cosh_arg_i;
i = -2*sin_arg_r*sinh_arg_i;
/* summation loop */
hi1 = hr1 = hi = 0;
hr = *--p;
for (; a - p;) {
hr2 = hr1;
hi2 = hi1;
hr1 = hr;
hi1 = hi;
hr = -hr2 + r*hr1 - i*hi1 + *--p;
hi = -hi2 + i*hr1 + r*hi1;
}
r = sin_arg_r*cosh_arg_i;
i = cos_arg_r*sinh_arg_i;
*R = r*hr - i*hi;
*I = r*hi + i*hr;
return *R;
}
/* Real Clenshaw summation */
static T clens(const T *a, int size, T arg_r)
{
T r, hr, hr1, hr2, cos_arg_r;
const T* p = a + size;
cos_arg_r = cos(arg_r);
r = 2*cos_arg_r;
/* summation loop */
hr1 = 0;
hr = *--p;
for (; a - p;) {
hr2 = hr1;
hr1 = hr;
hr = -hr2 + r*hr1 + *--p;
}
return sin(arg_r)*hr;
}
/* Ellipsoidal, forward */
//static PJ_XY exact_e_fwd (PJ_LP lp, PJ *P)
inline void fwd(Parameters const& /*par*/,
T const& lp_lon,
T const& lp_lat,
T& xy_x, T& xy_y) const
{
//PJ_XY xy = {0.0,0.0};
//const auto *Q = &(static_cast<struct tmerc_data*>(par.opaque)->exact);
/* ell. LAT, LNG -> Gaussian LAT, LNG */
T Cn = gatg (this->m_proj_parm.cbg, proj_etmerc_order, lp_lat,
cos(2*lp_lat), sin(2*lp_lat));
/* Gaussian LAT, LNG -> compl. sph. LAT */
const T sin_Cn = sin (Cn);
const T cos_Cn = cos (Cn);
const T sin_Ce = sin (lp_lon);
const T cos_Ce = cos (lp_lon);
const T cos_Cn_cos_Ce = cos_Cn*cos_Ce;
Cn = atan2 (sin_Cn, cos_Cn_cos_Ce);
const T inv_denom_tan_Ce = 1. / hypot (sin_Cn, cos_Cn_cos_Ce);
const T tan_Ce = sin_Ce*cos_Cn * inv_denom_tan_Ce;
#if 0
// Variant of the above: found not to be measurably faster
const T sin_Ce_cos_Cn = sin_Ce*cos_Cn;
const T denom = sqrt(1 - sin_Ce_cos_Cn * sin_Ce_cos_Cn);
const T tan_Ce = sin_Ce_cos_Cn / denom;
#endif
/* compl. sph. N, E -> ell. norm. N, E */
T Ce = asinh ( tan_Ce ); /* Replaces: Ce = log(tan(FORTPI + Ce*0.5)); */
/*
* Non-optimized version:
* const T sin_arg_r = sin(2*Cn);
* const T cos_arg_r = cos(2*Cn);
*
* Given:
* sin(2 * Cn) = 2 sin(Cn) cos(Cn)
* sin(atan(y)) = y / sqrt(1 + y^2)
* cos(atan(y)) = 1 / sqrt(1 + y^2)
* ==> sin(2 * Cn) = 2 tan_Cn / (1 + tan_Cn^2)
*
* cos(2 * Cn) = 2cos^2(Cn) - 1
* = 2 / (1 + tan_Cn^2) - 1
*/
const T two_inv_denom_tan_Ce = 2 * inv_denom_tan_Ce;
const T two_inv_denom_tan_Ce_square = two_inv_denom_tan_Ce * inv_denom_tan_Ce;
const T tmp_r = cos_Cn_cos_Ce * two_inv_denom_tan_Ce_square;
const T sin_arg_r = sin_Cn * tmp_r;
const T cos_arg_r = cos_Cn_cos_Ce * tmp_r - 1;
/*
* Non-optimized version:
* const T sinh_arg_i = sinh(2*Ce);
* const T cosh_arg_i = cosh(2*Ce);
*
* Given
* sinh(2 * Ce) = 2 sinh(Ce) cosh(Ce)
* sinh(asinh(y)) = y
* cosh(asinh(y)) = sqrt(1 + y^2)
* ==> sinh(2 * Ce) = 2 tan_Ce sqrt(1 + tan_Ce^2)
*
* cosh(2 * Ce) = 2cosh^2(Ce) - 1
* = 2 * (1 + tan_Ce^2) - 1
*
* and 1+tan_Ce^2 = 1 + sin_Ce^2 * cos_Cn^2 / (sin_Cn^2 + cos_Cn^2 * cos_Ce^2)
* = (sin_Cn^2 + cos_Cn^2 * cos_Ce^2 + sin_Ce^2 * cos_Cn^2) / (sin_Cn^2 + cos_Cn^2 * cos_Ce^2)
* = 1. / (sin_Cn^2 + cos_Cn^2 * cos_Ce^2)
* = inv_denom_tan_Ce^2
*
*/
const T sinh_arg_i = tan_Ce * two_inv_denom_tan_Ce;
const T cosh_arg_i = two_inv_denom_tan_Ce_square - 1;
T dCn, dCe;
Cn += clenS (this->m_proj_parm.gtu, proj_etmerc_order,
sin_arg_r, cos_arg_r, sinh_arg_i, cosh_arg_i,
&dCn, &dCe);
Ce += dCe;
if (fabs (Ce) <= 2.623395162778) {
xy_y = this->m_proj_parm.Qn * Cn + this->m_proj_parm.Zb; /* Northing */
xy_x = this->m_proj_parm.Qn * Ce; /* Easting */
} else {
BOOST_THROW_EXCEPTION( projection_exception(error_tolerance_condition) );
xy_x = xy_y = HUGE_VAL;
}
}
/* Ellipsoidal, inverse */
inline void inv(Parameters const& /*par*/,
T const& xy_x,
T const& xy_y,
T& lp_lon,
T& lp_lat) const
{
//PJ_LP lp = {0.0,0.0};
//const auto *Q = &(static_cast<struct tmerc_data*>(par.opaque)->exact);
/* normalize N, E */
T Cn = (xy_y - this->m_proj_parm.Zb)/this->m_proj_parm.Qn;
T Ce = xy_x/this->m_proj_parm.Qn;
if (fabs(Ce) <= 2.623395162778) { /* 150 degrees */
/* norm. N, E -> compl. sph. LAT, LNG */
const T sin_arg_r = sin(2*Cn);
const T cos_arg_r = cos(2*Cn);
//const T sinh_arg_i = sinh(2*Ce);
//const T cosh_arg_i = cosh(2*Ce);
const T exp_2_Ce = exp(2*Ce);
const T half_inv_exp_2_Ce = 0.5 / exp_2_Ce;
const T sinh_arg_i = 0.5 * exp_2_Ce - half_inv_exp_2_Ce;
const T cosh_arg_i = 0.5 * exp_2_Ce + half_inv_exp_2_Ce;
T dCn_ignored, dCe;
Cn += clenS(this->m_proj_parm.utg, proj_etmerc_order,
sin_arg_r, cos_arg_r, sinh_arg_i, cosh_arg_i,
&dCn_ignored, &dCe);
Ce += dCe;
/* compl. sph. LAT -> Gaussian LAT, LNG */
const T sin_Cn = sin (Cn);
const T cos_Cn = cos (Cn);
#if 0
// Non-optimized version:
T sin_Ce, cos_Ce;
Ce = atan (sinh (Ce)); // Replaces: Ce = 2*(atan(exp(Ce)) - FORTPI);
sin_Ce = sin (Ce);
cos_Ce = cos (Ce);
Ce = atan2 (sin_Ce, cos_Ce*cos_Cn);
Cn = atan2 (sin_Cn*cos_Ce, hypot (sin_Ce, cos_Ce*cos_Cn));
#else
/*
* One can divide both member of Ce = atan2(...) by cos_Ce, which gives:
* Ce = atan2 (tan_Ce, cos_Cn) = atan2(sinh(Ce), cos_Cn)
*
* and the same for Cn = atan2(...)
* Cn = atan2 (sin_Cn, hypot (sin_Ce, cos_Ce*cos_Cn)/cos_Ce)
* = atan2 (sin_Cn, hypot (sin_Ce/cos_Ce, cos_Cn))
* = atan2 (sin_Cn, hypot (tan_Ce, cos_Cn))
* = atan2 (sin_Cn, hypot (sinhCe, cos_Cn))
*/
const T sinhCe = sinh (Ce);
Ce = atan2 (sinhCe, cos_Cn);
const T modulus_Ce = hypot (sinhCe, cos_Cn);
Cn = atan2 (sin_Cn, modulus_Ce);
#endif
/* Gaussian LAT, LNG -> ell. LAT, LNG */
// Optimization of the computation of cos(2*Cn) and sin(2*Cn)
const T tmp = 2 * modulus_Ce / (sinhCe * sinhCe + 1);
const T sin_2_Cn = sin_Cn * tmp;
const T cos_2_Cn = tmp * modulus_Ce - 1.;
//const T cos_2_Cn = cos(2 * Cn);
//const T sin_2_Cn = sin(2 * Cn);
lp_lat = gatg (this->m_proj_parm.cgb, proj_etmerc_order, Cn, cos_2_Cn, sin_2_Cn);
lp_lon = Ce;
}
else {
BOOST_THROW_EXCEPTION( projection_exception(error_tolerance_condition) );
lp_lat = lp_lon = HUGE_VAL;
}
}
};
template <typename T, typename Parameters>
struct base_tmerc_spheroid
{
par_tmerc<T> m_proj_parm;
// FORWARD(s_forward) sphere
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
inline void fwd(Parameters const& par, T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
{
static const T half_pi = detail::half_pi<T>();
T b, cosphi;
/*
* Fail if our longitude is more than 90 degrees from the
* central meridian since the results are essentially garbage.
* Is error -20 really an appropriate return value?
*
* http://trac.osgeo.org/proj/ticket/5
*/
if( lp_lon < -half_pi || lp_lon > half_pi )
{
xy_x = HUGE_VAL;
xy_y = HUGE_VAL;
BOOST_THROW_EXCEPTION( projection_exception(error_lat_or_lon_exceed_limit) );
return;
}
cosphi = cos(lp_lat);
b = cosphi * sin(lp_lon);
if (fabs(fabs(b) - 1.) <= epsilon10)
BOOST_THROW_EXCEPTION( projection_exception(error_tolerance_condition) );
xy_x = this->m_proj_parm.ml0 * log((1. + b) / (1. - b));
xy_y = cosphi * cos(lp_lon) / sqrt(1. - b * b);
b = fabs( xy_y );
if (b >= 1.) {
if ((b - 1.) > epsilon10)
BOOST_THROW_EXCEPTION( projection_exception(error_tolerance_condition) );
else xy_y = 0.;
} else
xy_y = acos(xy_y);
if (lp_lat < 0.)
xy_y = -xy_y;
xy_y = this->m_proj_parm.esp * (xy_y - par.phi0);
}
// INVERSE(s_inverse) sphere
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
inline void inv(Parameters const& par, T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
{
T h, g;
h = exp(xy_x / this->m_proj_parm.esp);
g = .5 * (h - 1. / h);
h = cos(par.phi0 + xy_y / this->m_proj_parm.esp);
lp_lat = asin(sqrt((1. - h * h) / (1. + g * g)));
/* Make sure that phi is on the correct hemisphere when false northing is used */
if (xy_y < 0. && -lp_lat+par.phi0 < 0.0) lp_lat = -lp_lat;
lp_lon = (g != 0.0 || h != 0.0) ? atan2(g, h) : 0.;
}
static inline std::string get_name()
{
return "tmerc_spheroid";
}
};
template <typename Parameters, typename T>
inline void setup(Parameters const& par, par_tmerc<T>& proj_parm)
{
if (par.es != 0.0) {
proj_parm.en = pj_enfn<T>(par.es);
proj_parm.ml0 = pj_mlfn(par.phi0, sin(par.phi0), cos(par.phi0), proj_parm.en);
proj_parm.esp = par.es / (1. - par.es);
} else {
proj_parm.esp = par.k0;
proj_parm.ml0 = .5 * proj_parm.esp;
}
}
template <typename Parameters, typename T>
inline void setup_exact(Parameters const& par, par_tmerc_exact<T>& proj_parm)
{
assert( par.es > 0 );
/* third flattening n */
//since we do not keep n in parameters we compute it here;
const T n = pow(tan(asin(par.e)/2),2);
T np = n;
/* COEF. OF TRIG SERIES GEO <-> GAUSS */
/* cgb := Gaussian -> Geodetic, KW p190 - 191 (61) - (62) */
/* cbg := Geodetic -> Gaussian, KW p186 - 187 (51) - (52) */
/* PROJ_ETMERC_ORDER = 6th degree : Engsager and Poder: ICC2007 */
proj_parm.cgb[0] = n*( 2 + n*(-2/3.0 + n*(-2 + n*(116/45.0 + n*(26/45.0 +
n*(-2854/675.0 ))))));
proj_parm.cbg[0] = n*(-2 + n*( 2/3.0 + n*( 4/3.0 + n*(-82/45.0 + n*(32/45.0 +
n*( 4642/4725.0))))));
np *= n;
proj_parm.cgb[1] = np*(7/3.0 + n*( -8/5.0 + n*(-227/45.0 + n*(2704/315.0 +
n*( 2323/945.0)))));
proj_parm.cbg[1] = np*(5/3.0 + n*(-16/15.0 + n*( -13/9.0 + n*( 904/315.0 +
n*(-1522/945.0)))));
np *= n;
/* n^5 coeff corrected from 1262/105 -> -1262/105 */
proj_parm.cgb[2] = np*( 56/15.0 + n*(-136/35.0 + n*(-1262/105.0 +
n*( 73814/2835.0))));
proj_parm.cbg[2] = np*(-26/15.0 + n*( 34/21.0 + n*( 8/5.0 +
n*(-12686/2835.0))));
np *= n;
/* n^5 coeff corrected from 322/35 -> 332/35 */
proj_parm.cgb[3] = np*(4279/630.0 + n*(-332/35.0 + n*(-399572/14175.0)));
proj_parm.cbg[3] = np*(1237/630.0 + n*( -12/5.0 + n*( -24832/14175.0)));
np *= n;
proj_parm.cgb[4] = np*(4174/315.0 + n*(-144838/6237.0 ));
proj_parm.cbg[4] = np*(-734/315.0 + n*( 109598/31185.0));
np *= n;
proj_parm.cgb[5] = np*(601676/22275.0 );
proj_parm.cbg[5] = np*(444337/155925.0);
/* Constants of the projections */
/* Transverse Mercator (UTM, ITM, etc) */
np = n*n;
/* Norm. mer. quad, K&W p.50 (96), p.19 (38b), p.5 (2) */
proj_parm.Qn = par.k0/(1 + n) * (1 + np*(1/4.0 + np*(1/64.0 + np/256.0)));
/* coef of trig series */
/* utg := ell. N, E -> sph. N, E, KW p194 (65) */
/* gtu := sph. N, E -> ell. N, E, KW p196 (69) */
proj_parm.utg[0] = n*(-0.5 + n*( 2/3.0 + n*(-37/96.0 + n*( 1/360.0 +
n*( 81/512.0 + n*(-96199/604800.0))))));
proj_parm.gtu[0] = n*( 0.5 + n*(-2/3.0 + n*( 5/16.0 + n*(41/180.0 +
n*(-127/288.0 + n*( 7891/37800.0 ))))));
proj_parm.utg[1] = np*(-1/48.0 + n*(-1/15.0 + n*(437/1440.0 + n*(-46/105.0 +
n*( 1118711/3870720.0)))));
proj_parm.gtu[1] = np*(13/48.0 + n*(-3/5.0 + n*(557/1440.0 + n*(281/630.0 +
n*(-1983433/1935360.0)))));
np *= n;
proj_parm.utg[2] = np*(-17/480.0 + n*( 37/840.0 + n*( 209/4480.0 +
n*( -5569/90720.0 ))));
proj_parm.gtu[2] = np*( 61/240.0 + n*(-103/140.0 + n*(15061/26880.0 +
n*(167603/181440.0))));
np *= n;
proj_parm.utg[3] = np*(-4397/161280.0 + n*( 11/504.0 + n*( 830251/7257600.0)));
proj_parm.gtu[3] = np*(49561/161280.0 + n*(-179/168.0 + n*(6601661/7257600.0)));
np *= n;
proj_parm.utg[4] = np*(-4583/161280.0 + n*( 108847/3991680.0));
proj_parm.gtu[4] = np*(34729/80640.0 + n*(-3418889/1995840.0));
np *= n;
proj_parm.utg[5] = np*(-20648693/638668800.0);
proj_parm.gtu[5] = np*(212378941/319334400.0);
/* Gaussian latitude value of the origin latitude */
const T Z = base_tmerc_ellipsoid_exact<T, Parameters>::gatg (proj_parm.cbg, proj_etmerc_order, par.phi0, cos(2*par.phi0), sin(2*par.phi0));
/* Origin northing minus true northing at the origin latitude */
/* i.e. true northing = N - par.Zb */
proj_parm.Zb = - proj_parm.Qn*(Z + base_tmerc_ellipsoid_exact<T, Parameters>::clens(proj_parm.gtu, proj_etmerc_order, 2*Z));
}
}} // namespace detail::tmerc
#endif // doxygen
@@ -307,14 +646,25 @@ namespace projections
\par Example
\image html ex_tmerc.gif
*/
//approximate tmerc algorithm
/*
template <typename T, typename Parameters>
struct tmerc_ellipsoid : public detail::tmerc::base_tmerc_ellipsoid<T, Parameters>
{
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);
detail::tmerc::setup(par, this->m_proj_parm);
}
};
*/
template <typename T, typename Parameters>
struct tmerc_ellipsoid : public detail::tmerc::base_tmerc_ellipsoid_exact<T, Parameters>
{
template <typename Params>
inline tmerc_ellipsoid(Params const&, Parameters const& par)
{
detail::tmerc::setup_exact(par, this->m_proj_parm);
}
};
@@ -336,9 +686,8 @@ namespace projections
{
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);
detail::tmerc::setup(par, this->m_proj_parm);
}
};
@@ -347,11 +696,11 @@ namespace projections
{
// Static projection
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_tmerc, tmerc_spheroid, tmerc_ellipsoid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_FI2(srs::spar::proj_tmerc, tmerc_spheroid, tmerc_ellipsoid)
// Factory entry(s) - dynamic projection
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI2(tmerc_entry, tmerc_spheroid, tmerc_ellipsoid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(tmerc_init)
{
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(tmerc, tmerc_entry)

View File

@@ -2,8 +2,8 @@
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2017, 2018.
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
// This file was modified by Oracle on 2017, 2018, 2019.
// Modifications copyright (c) 2017-2019, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
// Use, modification and distribution is subject to the Boost Software License,
@@ -65,20 +65,14 @@ namespace projections
T hz0, thz0, rhshz0, ca, sa, lp, lamc;
};
// template class, using CRTP to implement forward/inverse
template <typename T, typename Parameters>
struct base_tpeqd_spheroid
: public base_t_fi<base_tpeqd_spheroid<T, Parameters>, T, Parameters>
{
par_tpeqd<T> m_proj_parm;
inline base_tpeqd_spheroid(const Parameters& par)
: base_t_fi<base_tpeqd_spheroid<T, Parameters>, T, Parameters>(*this, par)
{}
// FORWARD(s_forward) sphere
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
inline void fwd(Parameters const& , T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
{
T t, z1, z2, dl1, dl2, sp, cp;
@@ -98,7 +92,7 @@ namespace projections
// INVERSE(s_inverse) sphere
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
inline void inv(Parameters const& , T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
{
T cz1, cz2, s, d, cp, sp;
@@ -190,10 +184,9 @@ namespace projections
struct tpeqd_spheroid : public detail::tpeqd::base_tpeqd_spheroid<T, Parameters>
{
template <typename Params>
inline tpeqd_spheroid(Params const& params, Parameters const& par)
: detail::tpeqd::base_tpeqd_spheroid<T, Parameters>(par)
inline tpeqd_spheroid(Params const& params, Parameters & par)
{
detail::tpeqd::setup_tpeqd(params, this->m_par, this->m_proj_parm);
detail::tpeqd::setup_tpeqd(params, par, this->m_proj_parm);
}
};
@@ -202,11 +195,11 @@ namespace projections
{
// Static projection
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_tpeqd, tpeqd_spheroid, tpeqd_spheroid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_FI(srs::spar::proj_tpeqd, tpeqd_spheroid)
// Factory entry(s)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(tpeqd_entry, tpeqd_spheroid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(tpeqd_init)
{
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(tpeqd, tpeqd_entry)

View File

@@ -2,8 +2,8 @@
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2017, 2018.
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
// This file was modified by Oracle on 2017, 2018, 2019.
// Modifications copyright (c) 2017-2019, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
// Use, modification and distribution is subject to the Boost Software License,
@@ -61,20 +61,14 @@ namespace projections
T m, rmn, q3, n;
};
// template class, using CRTP to implement forward/inverse
template <typename T, typename Parameters>
struct base_urm5_spheroid
: public base_t_f<base_urm5_spheroid<T, Parameters>, T, Parameters>
{
par_urm5<T> m_proj_parm;
inline base_urm5_spheroid(const Parameters& par)
: base_t_f<base_urm5_spheroid<T, Parameters>, T, Parameters>(*this, par)
{}
// FORWARD(s_forward) spheroid
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
inline void fwd(T const& lp_lon, T lp_lat, T& xy_x, T& xy_y) const
inline void fwd(Parameters const&, T const& lp_lon, T lp_lat, T& xy_x, T& xy_y) const
{
T t;
@@ -136,10 +130,9 @@ namespace projections
struct urm5_spheroid : public detail::urm5::base_urm5_spheroid<T, Parameters>
{
template <typename Params>
inline urm5_spheroid(Params const& params, Parameters const& par)
: detail::urm5::base_urm5_spheroid<T, Parameters>(par)
inline urm5_spheroid(Params const& params, Parameters & par)
{
detail::urm5::setup_urm5(params, this->m_par, this->m_proj_parm);
detail::urm5::setup_urm5(params, par, this->m_proj_parm);
}
};
@@ -148,11 +141,11 @@ namespace projections
{
// Static projection
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_urm5, urm5_spheroid, urm5_spheroid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_F(srs::spar::proj_urm5, urm5_spheroid)
// Factory entry(s)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_F(urm5_entry, urm5_spheroid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(urm5_init)
{
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(urm5, urm5_entry)

View File

@@ -2,8 +2,8 @@
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2017, 2018.
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
// This file was modified by Oracle on 2017, 2018, 2019.
// Modifications copyright (c) 2017-2019, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
// Use, modification and distribution is subject to the Boost Software License,
@@ -65,20 +65,14 @@ namespace projections
T n, C_y;
};
// template class, using CRTP to implement forward/inverse
template <typename T, typename Parameters>
struct base_urmfps_spheroid
: public base_t_fi<base_urmfps_spheroid<T, Parameters>, T, Parameters>
{
par_urmfps<T> m_proj_parm;
inline base_urmfps_spheroid(const Parameters& par)
: base_t_fi<base_urmfps_spheroid<T, Parameters>, T, Parameters>(*this, par)
{}
// FORWARD(s_forward) sphere
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
inline void fwd(T const& lp_lon, T lp_lat, T& xy_x, T& xy_y) const
inline void fwd(Parameters const& , 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);
@@ -87,7 +81,7 @@ namespace projections
// INVERSE(s_inverse) sphere
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
inline void inv(T const& xy_x, T xy_y, T& lp_lon, T& lp_lat) const
inline void inv(Parameters const& , 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);
@@ -102,7 +96,7 @@ namespace projections
};
template <typename Parameters, typename T>
inline void setup(Parameters& par, par_urmfps<T>& proj_parm)
inline void setup(Parameters& par, par_urmfps<T>& proj_parm)
{
proj_parm.C_y = Cy / proj_parm.n;
par.es = 0.;
@@ -151,10 +145,9 @@ namespace projections
struct urmfps_spheroid : public detail::urmfps::base_urmfps_spheroid<T, Parameters>
{
template <typename Params>
inline urmfps_spheroid(Params const& params, Parameters const& par)
: detail::urmfps::base_urmfps_spheroid<T, Parameters>(par)
inline urmfps_spheroid(Params const& params, Parameters & par)
{
detail::urmfps::setup_urmfps(params, this->m_par, this->m_proj_parm);
detail::urmfps::setup_urmfps(params, par, this->m_proj_parm);
}
};
@@ -174,10 +167,9 @@ namespace projections
struct wag1_spheroid : public detail::urmfps::base_urmfps_spheroid<T, Parameters>
{
template <typename Params>
inline wag1_spheroid(Params const& , Parameters const& par)
: detail::urmfps::base_urmfps_spheroid<T, Parameters>(par)
inline wag1_spheroid(Params const& , Parameters & par)
{
detail::urmfps::setup_wag1(this->m_par, this->m_proj_parm);
detail::urmfps::setup_wag1(par, this->m_proj_parm);
}
};
@@ -186,13 +178,13 @@ namespace projections
{
// Static projection
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)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_FI(srs::spar::proj_urmfps, urmfps_spheroid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_FI(srs::spar::proj_wag1, wag1_spheroid)
// Factory entry(s)
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)
{
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(urmfps, urmfps_entry)

View File

@@ -2,8 +2,8 @@
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2017, 2018.
// Modifications copyright (c) 2017, 2018, Oracle and/or its affiliates.
// This file was modified by Oracle on 2017, 2018, 2019.
// Modifications copyright (c) 2017-2019, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
// Use, modification and distribution is subject to the Boost Software License,
@@ -67,18 +67,12 @@ namespace projections
template <typename T>
inline T HPISQ() { return 4.9348022005446793094172454999381; }
// template class, using CRTP to implement forward/inverse
template <typename T, typename Parameters>
struct base_vandg_spheroid
: public base_t_fi<base_vandg_spheroid<T, Parameters>, T, Parameters>
{
inline base_vandg_spheroid(const Parameters& par)
: base_t_fi<base_vandg_spheroid<T, Parameters>, T, Parameters>(*this, par)
{}
// FORWARD(s_forward) spheroid
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
inline void fwd(Parameters const& , 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>();
@@ -123,7 +117,7 @@ namespace projections
// INVERSE(s_inverse) spheroid
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
inline void inv(Parameters const& , 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>();
@@ -132,10 +126,10 @@ namespace projections
static const T two_pi = detail::two_pi<T>();
static const T C2_27 = vandg::C2_27<T>();
static const T PI4_3 = vandg::PI4_3<T>();
static const T PI4_3 = vandg::PI4_3<T>();
static const T TPISQ = vandg::TPISQ<T>();
static const T HPISQ = vandg::HPISQ<T>();
T t, c0, c1, c2, c3, al, r2, r, m, d, ay, x2, y2;
x2 = xy_x * xy_x;
@@ -201,10 +195,9 @@ namespace projections
struct vandg_spheroid : public detail::vandg::base_vandg_spheroid<T, Parameters>
{
template <typename Params>
inline vandg_spheroid(Params const& , Parameters const& par)
: detail::vandg::base_vandg_spheroid<T, Parameters>(par)
inline vandg_spheroid(Params const& , Parameters & par)
{
detail::vandg::setup_vandg(this->m_par);
detail::vandg::setup_vandg(par);
}
};
@@ -213,11 +206,11 @@ namespace projections
{
// Static projection
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_vandg, vandg_spheroid, vandg_spheroid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_FI(srs::spar::proj_vandg, vandg_spheroid)
// Factory entry(s)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(vandg_entry, vandg_spheroid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(vandg_init)
{
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(vandg, vandg_entry)

View File

@@ -2,8 +2,8 @@
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2017, 2018.
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
// This file was modified by Oracle on 2017, 2018, 2019.
// Modifications copyright (c) 2017-2019, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
// Use, modification and distribution is subject to the Boost Software License,
@@ -63,20 +63,14 @@ namespace projections
bool vdg3;
};
// template class, using CRTP to implement forward/inverse
template <typename T, typename Parameters>
struct base_vandg2_spheroid
: public base_t_f<base_vandg2_spheroid<T, Parameters>, T, Parameters>
{
par_vandg2 m_proj_parm;
inline base_vandg2_spheroid(const Parameters& par)
: base_t_f<base_vandg2_spheroid<T, Parameters>, T, Parameters>(*this, par)
{}
// FORWARD(s_forward) spheroid
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
inline void fwd(Parameters const& , 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>();
@@ -149,8 +143,7 @@ namespace projections
struct vandg2_spheroid : public detail::vandg2::base_vandg2_spheroid<T, Parameters>
{
template <typename Params>
inline vandg2_spheroid(Params const& , Parameters const& par)
: detail::vandg2::base_vandg2_spheroid<T, Parameters>(par)
inline vandg2_spheroid(Params const& , Parameters const& )
{
detail::vandg2::setup_vandg2(this->m_proj_parm);
}
@@ -173,10 +166,9 @@ namespace projections
struct vandg3_spheroid : public detail::vandg2::base_vandg2_spheroid<T, Parameters>
{
template <typename Params>
inline vandg3_spheroid(Params const& , Parameters const& par)
: detail::vandg2::base_vandg2_spheroid<T, Parameters>(par)
inline vandg3_spheroid(Params const& , Parameters & par)
{
detail::vandg2::setup_vandg3(this->m_par, this->m_proj_parm);
detail::vandg2::setup_vandg3(par, this->m_proj_parm);
}
};
@@ -185,13 +177,13 @@ namespace projections
{
// Static projection
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)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_F(srs::spar::proj_vandg2, vandg2_spheroid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_F(srs::spar::proj_vandg3, vandg3_spheroid)
// Factory entry(s)
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)
{
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(vandg2, vandg2_entry)

View File

@@ -2,8 +2,8 @@
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2017, 2018.
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
// This file was modified by Oracle on 2017, 2018, 2019.
// Modifications copyright (c) 2017-2019, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
// Use, modification and distribution is subject to the Boost Software License,
@@ -58,18 +58,12 @@ namespace projections
static const double tolerance = 1e-10;
// template class, using CRTP to implement forward/inverse
template <typename T, typename Parameters>
struct base_vandg4_spheroid
: public base_t_f<base_vandg4_spheroid<T, Parameters>, T, Parameters>
{
inline base_vandg4_spheroid(const Parameters& par)
: base_t_f<base_vandg4_spheroid<T, Parameters>, T, Parameters>(*this, par)
{}
// FORWARD(s_forward) spheroid
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
inline void fwd(Parameters const& , 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>();
@@ -141,10 +135,9 @@ namespace projections
struct vandg4_spheroid : public detail::vandg4::base_vandg4_spheroid<T, Parameters>
{
template <typename Params>
inline vandg4_spheroid(Params const& , Parameters const& par)
: detail::vandg4::base_vandg4_spheroid<T, Parameters>(par)
inline vandg4_spheroid(Params const& , Parameters & par)
{
detail::vandg4::setup_vandg4(this->m_par);
detail::vandg4::setup_vandg4(par);
}
};
@@ -153,11 +146,11 @@ namespace projections
{
// Static projection
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_vandg4, vandg4_spheroid, vandg4_spheroid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_F(srs::spar::proj_vandg4, vandg4_spheroid)
// Factory entry(s)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_F(vandg4_entry, vandg4_spheroid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(vandg4_init)
{
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(vandg4, vandg4_entry)

View File

@@ -2,8 +2,8 @@
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2017, 2018.
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
// This file was modified by Oracle on 2017, 2018, 2019.
// Modifications copyright (c) 2017-2019, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
// Use, modification and distribution is subject to the Boost Software License,
@@ -60,18 +60,12 @@ namespace projections
static const double C_p1 = 0.88022;
static const double C_p2 = 0.88550;
// template class, using CRTP to implement forward/inverse
template <typename T, typename Parameters>
struct base_wag2_spheroid
: public base_t_fi<base_wag2_spheroid<T, Parameters>, T, Parameters>
{
inline base_wag2_spheroid(const Parameters& par)
: base_t_fi<base_wag2_spheroid<T, Parameters>, T, Parameters>(*this, par)
{}
// FORWARD(s_forward) spheroid
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
inline void fwd(T const& lp_lon, T lp_lat, T& xy_x, T& xy_y) const
inline void fwd(Parameters const& , 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);
@@ -80,7 +74,7 @@ namespace projections
// INVERSE(s_inverse) spheroid
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
inline void inv(Parameters const& , 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));
@@ -120,10 +114,9 @@ namespace projections
struct wag2_spheroid : public detail::wag2::base_wag2_spheroid<T, Parameters>
{
template <typename Params>
inline wag2_spheroid(Params const& , Parameters const& par)
: detail::wag2::base_wag2_spheroid<T, Parameters>(par)
inline wag2_spheroid(Params const& , Parameters & par)
{
detail::wag2::setup_wag2(this->m_par);
detail::wag2::setup_wag2(par);
}
};
@@ -132,11 +125,11 @@ namespace projections
{
// Static projection
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_wag2, wag2_spheroid, wag2_spheroid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_FI(srs::spar::proj_wag2, wag2_spheroid)
// Factory entry(s)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(wag2_entry, wag2_spheroid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(wag2_init)
{
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(wag2, wag2_entry)

View File

@@ -2,8 +2,8 @@
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2017, 2018.
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
// This file was modified by Oracle on 2017, 2018, 2019.
// Modifications copyright (c) 2017-2019, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
// Use, modification and distribution is subject to the Boost Software License,
@@ -60,20 +60,14 @@ namespace projections
T C_x;
};
// template class, using CRTP to implement forward/inverse
template <typename T, typename Parameters>
struct base_wag3_spheroid
: public base_t_fi<base_wag3_spheroid<T, Parameters>, T, Parameters>
{
par_wag3<T> m_proj_parm;
inline base_wag3_spheroid(const Parameters& par)
: base_t_fi<base_wag3_spheroid<T, Parameters>, T, Parameters>(*this, par)
{}
// FORWARD(s_forward) spheroid
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
inline void fwd(Parameters const& , T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
{
static const T two_thirds = detail::two_thirds<T>();
@@ -83,7 +77,7 @@ namespace projections
// INVERSE(s_inverse) spheroid
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
inline void inv(Parameters const& , T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
{
static const T two_thirds = detail::two_thirds<T>();
@@ -128,10 +122,9 @@ namespace projections
struct wag3_spheroid : public detail::wag3::base_wag3_spheroid<T, Parameters>
{
template <typename Params>
inline wag3_spheroid(Params const& params, Parameters const& par)
: detail::wag3::base_wag3_spheroid<T, Parameters>(par)
inline wag3_spheroid(Params const& params, Parameters & par)
{
detail::wag3::setup_wag3(params, this->m_par, this->m_proj_parm);
detail::wag3::setup_wag3(params, par, this->m_proj_parm);
}
};
@@ -140,11 +133,11 @@ namespace projections
{
// Static projection
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_wag3, wag3_spheroid, wag3_spheroid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_FI(srs::spar::proj_wag3, wag3_spheroid)
// Factory entry(s)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(wag3_entry, wag3_spheroid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(wag3_init)
{
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(wag3, wag3_entry)

View File

@@ -2,8 +2,8 @@
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2017, 2018.
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
// This file was modified by Oracle on 2017, 2018, 2019.
// Modifications copyright (c) 2017-2019, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
// Use, modification and distribution is subject to the Boost Software License,
@@ -54,18 +54,12 @@ namespace projections
namespace detail { namespace wag7
{
// template class, using CRTP to implement forward/inverse
template <typename T, typename Parameters>
struct base_wag7_spheroid
: public base_t_f<base_wag7_spheroid<T, Parameters>, T, Parameters>
{
inline base_wag7_spheroid(const Parameters& par)
: base_t_f<base_wag7_spheroid<T, Parameters>, T, Parameters>(*this, par)
{}
// FORWARD(s_forward) sphere
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
inline void fwd(T lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
inline void fwd(Parameters const& , T lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
{
T theta, ct, D;
@@ -109,10 +103,9 @@ namespace projections
struct wag7_spheroid : public detail::wag7::base_wag7_spheroid<T, Parameters>
{
template <typename Params>
inline wag7_spheroid(Params const& , Parameters const& par)
: detail::wag7::base_wag7_spheroid<T, Parameters>(par)
inline wag7_spheroid(Params const& , Parameters & par)
{
detail::wag7::setup_wag7(this->m_par);
detail::wag7::setup_wag7(par);
}
};
@@ -121,11 +114,11 @@ namespace projections
{
// Static projection
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_wag7, wag7_spheroid, wag7_spheroid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_F(srs::spar::proj_wag7, wag7_spheroid)
// Factory entry(s)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_F(wag7_entry, wag7_spheroid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(wag7_init)
{
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(wag7, wag7_entry)

View File

@@ -2,8 +2,8 @@
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2017, 2018.
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
// This file was modified by Oracle on 2017, 2018, 2019.
// Modifications copyright (c) 2017-2019, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
// Use, modification and distribution is subject to the Boost Software License,
@@ -61,20 +61,14 @@ namespace projections
T cosphi1;
};
// template class, using CRTP to implement forward/inverse
template <typename T, typename Parameters>
struct base_wink1_spheroid
: public base_t_fi<base_wink1_spheroid<T, Parameters>, T, Parameters>
{
par_wink1<T> m_proj_parm;
inline base_wink1_spheroid(const Parameters& par)
: base_t_fi<base_wink1_spheroid<T, Parameters>, T, Parameters>(*this, par) {}
// FORWARD(s_forward) spheroid
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
inline void fwd(Parameters const& , 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;
@@ -82,7 +76,7 @@ namespace projections
// INVERSE(s_inverse) spheroid
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
inline void inv(Parameters const& , 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));
@@ -124,10 +118,9 @@ namespace projections
struct wink1_spheroid : public detail::wink1::base_wink1_spheroid<T, Parameters>
{
template <typename Params>
inline wink1_spheroid(Params const& params, Parameters const& par)
: detail::wink1::base_wink1_spheroid<T, Parameters>(par)
inline wink1_spheroid(Params const& params, Parameters & par)
{
detail::wink1::setup_wink1(params, this->m_par, this->m_proj_parm);
detail::wink1::setup_wink1(params, par, this->m_proj_parm);
}
};
@@ -136,11 +129,11 @@ namespace projections
{
// Static projection
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_wink1, wink1_spheroid, wink1_spheroid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_FI(srs::spar::proj_wink1, wink1_spheroid)
// Factory entry(s)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(wink1_entry, wink1_spheroid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(wink1_init)
{
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(wink1, wink1_entry)

View File

@@ -2,8 +2,8 @@
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2017, 2018.
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
// This file was modified by Oracle on 2017, 2018, 2019.
// Modifications copyright (c) 2017-2019, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
// Use, modification and distribution is subject to the Boost Software License,
@@ -66,20 +66,14 @@ namespace projections
T cosphi1;
};
// template class, using CRTP to implement forward/inverse
template <typename T, typename Parameters>
struct base_wink2_spheroid
: public base_t_f<base_wink2_spheroid<T, Parameters>, T, Parameters>
{
par_wink2<T> m_proj_parm;
inline base_wink2_spheroid(const Parameters& par)
: base_t_f<base_wink2_spheroid<T, Parameters>, T, Parameters>(*this, par) {}
// FORWARD(s_forward) spheroid
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
inline void fwd(T const& lp_lon, T lp_lat, T& xy_x, T& xy_y) const
inline void fwd(Parameters const& , 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>();
@@ -143,10 +137,9 @@ namespace projections
struct wink2_spheroid : public detail::wink2::base_wink2_spheroid<T, Parameters>
{
template <typename Params>
inline wink2_spheroid(Params const& params, Parameters const& par)
: detail::wink2::base_wink2_spheroid<T, Parameters>(par)
inline wink2_spheroid(Params const& params, Parameters & par)
{
detail::wink2::setup_wink2(params, this->m_par, this->m_proj_parm);
detail::wink2::setup_wink2(params, par, this->m_proj_parm);
}
};
@@ -155,16 +148,16 @@ namespace projections
{
// Static projection
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_wink2, wink2_spheroid, wink2_spheroid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_F(srs::spar::proj_wink2, wink2_spheroid)
// Factory entry(s)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_F(wink2_entry, wink2_spheroid)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(wink2_init)
{
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(wink2, wink2_entry)
}
} // namespace detail
#endif // doxygen