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