Imported Upstream version 1.72.0
[platform/upstream/boost.git] / boost / geometry / srs / projections / proj / aea.hpp
index 42c2cc9..00f5631 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,
@@ -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;
@@ -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)