diff options
Diffstat (limited to 'boost/geometry/srs/projections/proj/nell_h.hpp')
-rw-r--r-- | boost/geometry/srs/projections/proj/nell_h.hpp | 70 |
1 files changed, 32 insertions, 38 deletions
diff --git a/boost/geometry/srs/projections/proj/nell_h.hpp b/boost/geometry/srs/projections/proj/nell_h.hpp index 05de9e263e..73f0018ac6 100644 --- a/boost/geometry/srs/projections/proj/nell_h.hpp +++ b/boost/geometry/srs/projections/proj/nell_h.hpp @@ -1,13 +1,9 @@ -#ifndef BOOST_GEOMETRY_PROJECTIONS_NELL_H_HPP -#define BOOST_GEOMETRY_PROJECTIONS_NELL_H_HPP - -// Boost.Geometry - extensions-gis-projections (based on PROJ4) -// This file is automatically generated. DO NOT EDIT. +// Boost.Geometry - gis-projections (based on PROJ4) // Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands. -// This file was modified by Oracle on 2017. -// Modifications copyright (c) 2017, Oracle and/or its affiliates. +// This file was modified by Oracle on 2017, 2018. +// Modifications copyright (c) 2017-2018, 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, @@ -19,7 +15,7 @@ // PROJ4 is maintained by Frank Warmerdam // PROJ4 is converted to Boost.Geometry by Barend Gehrels -// Last updated version of proj: 4.9.1 +// Last updated version of proj: 5.0.0 // Original copyright notice: @@ -41,6 +37,9 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. +#ifndef BOOST_GEOMETRY_PROJECTIONS_NELL_H_HPP +#define BOOST_GEOMETRY_PROJECTIONS_NELL_H_HPP + #include <boost/geometry/util/math.hpp> #include <boost/geometry/srs/projections/impl/base_static.hpp> @@ -53,7 +52,7 @@ namespace boost { namespace geometry namespace srs { namespace par4 { - struct nell_h {}; + struct nell_h {}; // Nell-Hammer }} //namespace srs::par4 @@ -63,26 +62,21 @@ namespace projections namespace detail { namespace nell_h { - static const int NITER = 9; - static const double EPS = 1e-7; + static const int n_iter = 9; + static const double epsilon = 1e-7; // template class, using CRTP to implement forward/inverse - template <typename CalculationType, typename Parameters> - struct base_nell_h_spheroid : public base_t_fi<base_nell_h_spheroid<CalculationType, Parameters>, - CalculationType, Parameters> + template <typename T, typename Parameters> + struct base_nell_h_spheroid + : public base_t_fi<base_nell_h_spheroid<T, Parameters>, T, Parameters> { - - typedef CalculationType geographic_type; - typedef CalculationType cartesian_type; - - inline base_nell_h_spheroid(const Parameters& par) - : base_t_fi<base_nell_h_spheroid<CalculationType, Parameters>, - CalculationType, Parameters>(*this, par) {} + : base_t_fi<base_nell_h_spheroid<T, Parameters>, T, Parameters>(*this, par) + {} // FORWARD(s_forward) spheroid // Project coordinates from geographic (lon, lat) to cartesian (x, y) - inline void fwd(geographic_type& lp_lon, geographic_type& lp_lat, cartesian_type& xy_x, cartesian_type& xy_y) const + inline void fwd(T& lp_lon, T& lp_lat, T& xy_x, T& xy_y) const { xy_x = 0.5 * lp_lon * (1. + cos(lp_lat)); xy_y = 2.0 * (lp_lat - tan(0.5 *lp_lat)); @@ -90,22 +84,22 @@ namespace projections // INVERSE(s_inverse) spheroid // Project coordinates from cartesian (x, y) to geographic (lon, lat) - inline void inv(cartesian_type& xy_x, cartesian_type& xy_y, geographic_type& lp_lon, geographic_type& lp_lat) const + inline void inv(T& xy_x, T& xy_y, T& lp_lon, T& lp_lat) const { - static const CalculationType HALFPI = detail::HALFPI<CalculationType>(); + static const T half_pi = detail::half_pi<T>(); - CalculationType V, c, p; + T V, c, p; int i; p = 0.5 * xy_y; - for (i = NITER; i ; --i) { + for (i = n_iter; i ; --i) { c = cos(0.5 * lp_lat); lp_lat -= V = (lp_lat - tan(lp_lat/2) - p)/(1. - 0.5/(c*c)); - if (fabs(V) < EPS) + if (fabs(V) < epsilon) break; } if (!i) { - lp_lat = p < 0. ? -HALFPI : HALFPI; + lp_lat = p < 0. ? -half_pi : half_pi; lp_lon = 2. * xy_x; } else lp_lon = 2. * xy_x / (1. + cos(lp_lat)); @@ -140,10 +134,10 @@ namespace projections \par Example \image html ex_nell_h.gif */ - template <typename CalculationType, typename Parameters> - struct nell_h_spheroid : public detail::nell_h::base_nell_h_spheroid<CalculationType, Parameters> + template <typename T, typename Parameters> + struct nell_h_spheroid : public detail::nell_h::base_nell_h_spheroid<T, Parameters> { - inline nell_h_spheroid(const Parameters& par) : detail::nell_h::base_nell_h_spheroid<CalculationType, Parameters>(par) + inline nell_h_spheroid(const Parameters& par) : detail::nell_h::base_nell_h_spheroid<T, Parameters>(par) { detail::nell_h::setup_nell_h(this->m_par); } @@ -157,20 +151,20 @@ namespace projections BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::par4::nell_h, nell_h_spheroid, nell_h_spheroid) // Factory entry(s) - template <typename CalculationType, typename Parameters> - class nell_h_entry : public detail::factory_entry<CalculationType, Parameters> + template <typename T, typename Parameters> + class nell_h_entry : public detail::factory_entry<T, Parameters> { public : - virtual base_v<CalculationType, Parameters>* create_new(const Parameters& par) const + virtual base_v<T, Parameters>* create_new(const Parameters& par) const { - return new base_v_fi<nell_h_spheroid<CalculationType, Parameters>, CalculationType, Parameters>(par); + return new base_v_fi<nell_h_spheroid<T, Parameters>, T, Parameters>(par); } }; - template <typename CalculationType, typename Parameters> - inline void nell_h_init(detail::base_factory<CalculationType, Parameters>& factory) + template <typename T, typename Parameters> + inline void nell_h_init(detail::base_factory<T, Parameters>& factory) { - factory.add_to_factory("nell_h", new nell_h_entry<CalculationType, Parameters>); + factory.add_to_factory("nell_h", new nell_h_entry<T, Parameters>); } } // namespace detail |