Imported Upstream version 1.72.0
[platform/upstream/boost.git] / boost / geometry / srs / projections / proj / labrd.hpp
index 1b86fe7..823bd69 100644 (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,7 +222,7 @@ 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)