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