// 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,
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
};
- // 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;
// 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>();
// 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>();
{
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);
}
};
{
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);
}
};
{
// 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)