mirror of
https://github.com/boostorg/geometry.git
synced 2026-01-31 08:12:13 +00:00
[srs] Rename upper-case global types and move them if possible.
- Types defined in projects.h: COMPLEX, PJ_ELLPS, PJ_DATUM, PJ_UNITS, PJ_PRIME_MERIDIANS. - Move types used for global data, tables defining ellipsoids, datums, units and meridians to files defining the tables. - Remove types that are not used in Boost.Geometry: DERIVS and FACTORS.
This commit is contained in:
@@ -3,8 +3,8 @@
|
||||
|
||||
// Copyright (c) 2008-2012 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,
|
||||
@@ -41,17 +41,35 @@
|
||||
|
||||
#include <boost/geometry/srs/projections/impl/projects.hpp>
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace boost { namespace geometry { namespace projections {
|
||||
|
||||
namespace detail {
|
||||
|
||||
// Originally defined in projects.h
|
||||
struct pj_datums_type
|
||||
{
|
||||
std::string id; /* datum keyword */
|
||||
std::string defn; /* ie. "to_wgs84=..." */
|
||||
std::string ellipse_id; /* ie from ellipse table */
|
||||
std::string comments; /* EPSG code, etc */
|
||||
};
|
||||
|
||||
// Originally defined in projects.h
|
||||
struct pj_prime_meridians_type
|
||||
{
|
||||
std::string id; /* prime meridian keyword */
|
||||
std::string defn; /* offset from greenwich in DMS format. */
|
||||
};
|
||||
|
||||
/*
|
||||
* The ellipse code must match one from pj_ellps.c. The datum id should
|
||||
* be kept to 12 characters or less if possible. Use the official OGC
|
||||
* datum name for the comments if available.
|
||||
*/
|
||||
|
||||
static const PJ_DATUMS pj_datums[] =
|
||||
static const pj_datums_type pj_datums[] =
|
||||
{
|
||||
/* id definition ellipse comments */
|
||||
/* -- ---------- ------- -------- */
|
||||
@@ -87,7 +105,7 @@ static const PJ_DATUMS pj_datums[] =
|
||||
};
|
||||
|
||||
|
||||
static const PJ_PRIME_MERIDIANS pj_prime_meridians[] =
|
||||
static const pj_prime_meridians_type pj_prime_meridians[] =
|
||||
{
|
||||
/* id definition */
|
||||
/* -- ---------- */
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
|
||||
// Copyright (c) 2008-2012 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,
|
||||
@@ -41,11 +41,22 @@
|
||||
|
||||
#include <boost/geometry/srs/projections/impl/projects.hpp>
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace boost { namespace geometry { namespace projections {
|
||||
|
||||
namespace detail {
|
||||
|
||||
static const PJ_ELLPS pj_ellps[] =
|
||||
// Originally defined in projects.h
|
||||
struct pj_ellps_type
|
||||
{
|
||||
std::string id; /* ellipse keyword name */
|
||||
std::string major; /* a= value */
|
||||
std::string ell; /* elliptical parameter */
|
||||
std::string name; /* comments */
|
||||
};
|
||||
|
||||
static const pj_ellps_type pj_ellps[] =
|
||||
{
|
||||
{"MERIT", "a=6378137.0", "rf=298.257", "MERIT 1983"},
|
||||
{"SGS85", "a=6378136.0", "rf=298.257", "Soviet Geodetic System 85"},
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
|
||||
// Copyright (c) 2008-2012 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,
|
||||
@@ -44,11 +44,19 @@
|
||||
namespace boost { namespace geometry { namespace projections {
|
||||
namespace detail {
|
||||
|
||||
// Originally defined in projects.h
|
||||
struct pj_units_type
|
||||
{
|
||||
std::string id; /* units keyword */
|
||||
std::string to_meter; /* multiply by value to get meters */
|
||||
std::string name; /* comments */
|
||||
};
|
||||
|
||||
/* Field 2 that contains the multiplier to convert named units to meters
|
||||
** may be expressed by either a simple floating point constant or a
|
||||
** numerator/denomenator values (e.g. 1/1000) */
|
||||
|
||||
static const PJ_UNITS pj_units[] =
|
||||
static const pj_units_type pj_units[] =
|
||||
{
|
||||
{ "km", "1000.", "Kilometer" },
|
||||
{ "m", "1.", "Meter" },
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
|
||||
// Copyright (c) 2008-2012 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,
|
||||
@@ -52,10 +52,10 @@ namespace boost { namespace geometry { namespace projections { namespace detail
|
||||
** n should always be >= 1 though no checks are made
|
||||
*/
|
||||
template <typename T>
|
||||
inline COMPLEX<T>
|
||||
pj_zpoly1(COMPLEX<T> z, const COMPLEX<T> *C, int n)
|
||||
inline pj_complex<T>
|
||||
pj_zpoly1(pj_complex<T> z, const pj_complex<T> *C, int n)
|
||||
{
|
||||
COMPLEX<T> a;
|
||||
pj_complex<T> a;
|
||||
T t;
|
||||
|
||||
a = *(C += n);
|
||||
@@ -71,14 +71,14 @@ namespace boost { namespace geometry { namespace projections { namespace detail
|
||||
|
||||
/* evaluate complex polynomial and derivative */
|
||||
template <typename T>
|
||||
inline COMPLEX<T>
|
||||
pj_zpolyd1(COMPLEX<T> z, const COMPLEX<T> *C, int n, COMPLEX<T> *der)
|
||||
inline pj_complex<T>
|
||||
pj_zpolyd1(pj_complex<T> z, const pj_complex<T> *C, int n, pj_complex<T> *der)
|
||||
{
|
||||
T t;
|
||||
bool first = true;
|
||||
|
||||
COMPLEX<T> a = *(C += n);
|
||||
COMPLEX<T> b = a;
|
||||
pj_complex<T> a = *(C += n);
|
||||
pj_complex<T> b = a;
|
||||
while (n-- > 0)
|
||||
{
|
||||
if (first)
|
||||
|
||||
@@ -60,11 +60,11 @@ namespace detail
|
||||
/* datum_type values */
|
||||
enum datum_type
|
||||
{
|
||||
datum_unknown = 0,
|
||||
datum_3param = 1,
|
||||
datum_7param = 2,
|
||||
datum_unknown = 0,
|
||||
datum_3param = 1,
|
||||
datum_7param = 2,
|
||||
datum_gridshift = 3,
|
||||
datum_wgs84 = 4 /* WGS84 (or anything considered equivelent) */
|
||||
datum_wgs84 = 4 /* WGS84 (or anything considered equivelent) */
|
||||
};
|
||||
|
||||
/* library errors */
|
||||
@@ -140,16 +140,16 @@ struct pvalue
|
||||
|
||||
// Originally defined in proj_internal.h
|
||||
//enum pj_io_units {
|
||||
// PJ_IO_UNITS_WHATEVER = 0, /* Doesn't matter (or depends on pipeline neighbours) */
|
||||
// PJ_IO_UNITS_CLASSIC = 1, /* Scaled meters (right), projected system */
|
||||
// PJ_IO_UNITS_PROJECTED = 2, /* Meters, projected system */
|
||||
// PJ_IO_UNITS_CARTESIAN = 3, /* Meters, 3D cartesian system */
|
||||
// PJ_IO_UNITS_ANGULAR = 4 /* Radians */
|
||||
// pj_io_units_whatever = 0, /* Doesn't matter (or depends on pipeline neighbours) */
|
||||
// pj_io_units_classic = 1, /* Scaled meters (right), projected system */
|
||||
// pj_io_units_projected = 2, /* Meters, projected system */
|
||||
// pj_io_units_cartesian = 3, /* Meters, 3D cartesian system */
|
||||
// pj_io_units_angular = 4 /* Radians */
|
||||
//};
|
||||
|
||||
// Originally defined in proj_internal.h
|
||||
/* Maximum latitudinal overshoot accepted */
|
||||
//static const double PJ_EPS_LAT = 1e-12;
|
||||
//static const double pj_epsilon_lat = 1e-12;
|
||||
|
||||
template <typename T>
|
||||
struct pj_consts
|
||||
@@ -222,55 +222,7 @@ struct pj_consts
|
||||
|
||||
// PROJ4 complex. Might be replaced with std::complex
|
||||
template <typename T>
|
||||
struct COMPLEX { T r, i; };
|
||||
|
||||
struct PJ_ELLPS
|
||||
{
|
||||
std::string id; /* ellipse keyword name */
|
||||
std::string major; /* a= value */
|
||||
std::string ell; /* elliptical parameter */
|
||||
std::string name; /* comments */
|
||||
};
|
||||
|
||||
struct PJ_DATUMS
|
||||
{
|
||||
std::string id; /* datum keyword */
|
||||
std::string defn; /* ie. "to_wgs84=..." */
|
||||
std::string ellipse_id; /* ie from ellipse table */
|
||||
std::string comments; /* EPSG code, etc */
|
||||
};
|
||||
|
||||
struct PJ_PRIME_MERIDIANS
|
||||
{
|
||||
std::string id; /* prime meridian keyword */
|
||||
std::string defn; /* offset from greenwich in DMS format. */
|
||||
};
|
||||
|
||||
struct PJ_UNITS
|
||||
{
|
||||
std::string id; /* units keyword */
|
||||
std::string to_meter; /* multiply by value to get meters */
|
||||
std::string name; /* comments */
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct DERIVS
|
||||
{
|
||||
T x_l, x_p; /* derivatives of x for lambda-phi */
|
||||
T y_l, y_p; /* derivatives of y for lambda-phi */
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct FACTORS
|
||||
{
|
||||
DERIVS<T> der;
|
||||
T h, k; /* meridinal, parallel scales */
|
||||
T omega, thetap; /* angular distortion, theta prime */
|
||||
T conv; /* convergence */
|
||||
T s; /* areal scale factor */
|
||||
T a, b; /* max-min scale error */
|
||||
int code; /* info as to analytics, see following */
|
||||
};
|
||||
struct pj_complex { T r, i; };
|
||||
|
||||
} // namespace detail
|
||||
#endif // DOXYGEN_NO_DETAIL
|
||||
|
||||
@@ -102,7 +102,7 @@ namespace projections
|
||||
template <typename T>
|
||||
inline T d180() { return T(180) * geometry::math::d2r<T>(); }
|
||||
|
||||
static const double EPSLN = 1.e-10; // allow a little 'slack' on zone edge positions
|
||||
static const double epsilon = 1.e-10; // allow a little 'slack' on zone edge positions
|
||||
|
||||
// Converted from #define SETUP(n, proj, x_0, y_0, lon_0)
|
||||
template <template <typename, typename> class Entry, typename Parameters, typename CalculationType>
|
||||
@@ -192,7 +192,7 @@ namespace projections
|
||||
const CalculationType y90 = this->m_proj_parm.dy0 + sqrt(c2); // lt=90 corresponds to y=y0+sqrt(2.0)
|
||||
|
||||
int z = 0;
|
||||
if (xy_y > y90+EPSLN || xy_y < -y90+EPSLN) // 0
|
||||
if (xy_y > y90+epsilon || xy_y < -y90+epsilon) // 0
|
||||
z = 0;
|
||||
else if (xy_y >= d4044118) // 1|2
|
||||
z = (xy_x <= -d40? 1: 2);
|
||||
@@ -221,24 +221,24 @@ namespace projections
|
||||
lp_lon += this->m_proj_parm.pj[z-1]->params().lam0;
|
||||
|
||||
switch (z) {
|
||||
case 1: ok = (lp_lon >= -d180-EPSLN && lp_lon <= -d40+EPSLN) ||
|
||||
((lp_lon >= -d40-EPSLN && lp_lon <= -d10+EPSLN) &&
|
||||
(lp_lat >= d60-EPSLN && lp_lat <= d90+EPSLN)); break;
|
||||
case 2: ok = (lp_lon >= -d40-EPSLN && lp_lon <= d180+EPSLN) ||
|
||||
((lp_lon >= -d180-EPSLN && lp_lon <= -d160+EPSLN) &&
|
||||
(lp_lat >= d50-EPSLN && lp_lat <= d90+EPSLN)) ||
|
||||
((lp_lon >= -d50-EPSLN && lp_lon <= -d40+EPSLN) &&
|
||||
(lp_lat >= d60-EPSLN && lp_lat <= d90+EPSLN)); break;
|
||||
case 3: ok = (lp_lon >= -d180-EPSLN && lp_lon <= -d40+EPSLN); break;
|
||||
case 4: ok = (lp_lon >= -d40-EPSLN && lp_lon <= d180+EPSLN); break;
|
||||
case 5: ok = (lp_lon >= -d180-EPSLN && lp_lon <= -d100+EPSLN); break;
|
||||
case 6: ok = (lp_lon >= -d100-EPSLN && lp_lon <= -d20+EPSLN); break;
|
||||
case 7: ok = (lp_lon >= -d20-EPSLN && lp_lon <= d80+EPSLN); break;
|
||||
case 8: ok = (lp_lon >= d80-EPSLN && lp_lon <= d180+EPSLN); break;
|
||||
case 9: ok = (lp_lon >= -d180-EPSLN && lp_lon <= -d100+EPSLN); break;
|
||||
case 10: ok = (lp_lon >= -d100-EPSLN && lp_lon <= -d20+EPSLN); break;
|
||||
case 11: ok = (lp_lon >= -d20-EPSLN && lp_lon <= d80+EPSLN); break;
|
||||
case 12: ok = (lp_lon >= d80-EPSLN && lp_lon <= d180+EPSLN); break;
|
||||
case 1: ok = (lp_lon >= -d180-epsilon && lp_lon <= -d40+epsilon) ||
|
||||
((lp_lon >= -d40-epsilon && lp_lon <= -d10+epsilon) &&
|
||||
(lp_lat >= d60-epsilon && lp_lat <= d90+epsilon)); break;
|
||||
case 2: ok = (lp_lon >= -d40-epsilon && lp_lon <= d180+epsilon) ||
|
||||
((lp_lon >= -d180-epsilon && lp_lon <= -d160+epsilon) &&
|
||||
(lp_lat >= d50-epsilon && lp_lat <= d90+epsilon)) ||
|
||||
((lp_lon >= -d50-epsilon && lp_lon <= -d40+epsilon) &&
|
||||
(lp_lat >= d60-epsilon && lp_lat <= d90+epsilon)); break;
|
||||
case 3: ok = (lp_lon >= -d180-epsilon && lp_lon <= -d40+epsilon); break;
|
||||
case 4: ok = (lp_lon >= -d40-epsilon && lp_lon <= d180+epsilon); break;
|
||||
case 5: ok = (lp_lon >= -d180-epsilon && lp_lon <= -d100+epsilon); break;
|
||||
case 6: ok = (lp_lon >= -d100-epsilon && lp_lon <= -d20+epsilon); break;
|
||||
case 7: ok = (lp_lon >= -d20-epsilon && lp_lon <= d80+epsilon); break;
|
||||
case 8: ok = (lp_lon >= d80-epsilon && lp_lon <= d180+epsilon); break;
|
||||
case 9: ok = (lp_lon >= -d180-epsilon && lp_lon <= -d100+epsilon); break;
|
||||
case 10: ok = (lp_lon >= -d100-epsilon && lp_lon <= -d20+epsilon); break;
|
||||
case 11: ok = (lp_lon >= -d20-epsilon && lp_lon <= d80+epsilon); break;
|
||||
case 12: ok = (lp_lon >= d80-epsilon && lp_lon <= d180+epsilon); break;
|
||||
}
|
||||
|
||||
z = (!ok? 0: z); // projectable?
|
||||
|
||||
@@ -69,12 +69,12 @@ namespace projections
|
||||
namespace detail { namespace mod_ster
|
||||
{
|
||||
|
||||
static const double EPSLN = 1e-12;
|
||||
static const double epsilon = 1e-12;
|
||||
|
||||
template <typename T>
|
||||
struct par_mod_ster
|
||||
{
|
||||
COMPLEX<T> *zcoeff;
|
||||
pj_complex<T> *zcoeff;
|
||||
T cchio, schio;
|
||||
int n;
|
||||
};
|
||||
@@ -103,7 +103,7 @@ namespace projections
|
||||
static const CalculationType half_pi = detail::half_pi<CalculationType>();
|
||||
|
||||
CalculationType sinlon, coslon, esphi, chi, schi, cchi, s;
|
||||
COMPLEX<CalculationType> p;
|
||||
pj_complex<CalculationType> p;
|
||||
|
||||
sinlon = sin(lp_lon);
|
||||
coslon = cos(lp_lon);
|
||||
@@ -127,7 +127,7 @@ namespace projections
|
||||
static const CalculationType half_pi = detail::half_pi<CalculationType>();
|
||||
|
||||
int nn;
|
||||
COMPLEX<CalculationType> p, fxy, fpxy, dp;
|
||||
pj_complex<CalculationType> p, fxy, fpxy, dp;
|
||||
CalculationType den, rh = 0, z, sinz = 0, cosz = 0, chi, phi = 0, dphi, esphi;
|
||||
|
||||
p.r = xy_x;
|
||||
@@ -141,7 +141,7 @@ namespace projections
|
||||
dp.i = -(fxy.i * fpxy.r - fxy.r * fpxy.i) / den;
|
||||
p.r += dp.r;
|
||||
p.i += dp.i;
|
||||
if ((fabs(dp.r) + fabs(dp.i)) <= EPSLN)
|
||||
if ((fabs(dp.r) + fabs(dp.i)) <= epsilon)
|
||||
break;
|
||||
}
|
||||
if (nn) {
|
||||
@@ -150,7 +150,7 @@ namespace projections
|
||||
sinz = sin(z);
|
||||
cosz = cos(z);
|
||||
lp_lon = this->m_par.lam0;
|
||||
if (fabs(rh) <= EPSLN) {
|
||||
if (fabs(rh) <= epsilon) {
|
||||
/* if we end up here input coordinates were (0,0).
|
||||
* pj_inv() adds P->lam0 to lp.lam, this way we are
|
||||
* sure to get the correct offset */
|
||||
@@ -165,7 +165,7 @@ namespace projections
|
||||
dphi = 2. * atan(tan((half_pi + chi) * .5) *
|
||||
pow((1. + esphi) / (1. - esphi), this->m_par.e * .5)) - half_pi - phi;
|
||||
phi += dphi;
|
||||
if (fabs(dphi) <= EPSLN)
|
||||
if (fabs(dphi) <= epsilon)
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -206,15 +206,17 @@ namespace projections
|
||||
template <typename Parameters, typename T>
|
||||
inline void setup_mil_os(Parameters& par, par_mod_ster<T>& proj_parm)
|
||||
{
|
||||
static COMPLEX<T> AB[] = {
|
||||
static const T d2r = geometry::math::d2r<T>();
|
||||
|
||||
static pj_complex<T> AB[] = {
|
||||
{0.924500, 0.},
|
||||
{0., 0.},
|
||||
{0.019430, 0.}
|
||||
};
|
||||
|
||||
proj_parm.n = 2;
|
||||
par.lam0 = geometry::math::d2r<T>() * 20.;
|
||||
par.phi0 = geometry::math::d2r<T>() * 18.;
|
||||
par.lam0 = d2r * 20.;
|
||||
par.phi0 = d2r * 18.;
|
||||
proj_parm.zcoeff = AB;
|
||||
par.es = 0.;
|
||||
|
||||
@@ -225,15 +227,17 @@ namespace projections
|
||||
template <typename Parameters, typename T>
|
||||
inline void setup_lee_os(Parameters& par, par_mod_ster<T>& proj_parm)
|
||||
{
|
||||
static COMPLEX<T> AB[] = {
|
||||
static const T d2r = geometry::math::d2r<T>();
|
||||
|
||||
static pj_complex<T> AB[] = {
|
||||
{ 0.721316, 0.},
|
||||
{ 0., 0.},
|
||||
{-0.0088162, -0.00617325}
|
||||
};
|
||||
|
||||
proj_parm.n = 2;
|
||||
par.lam0 = geometry::math::d2r<T>() * -165.;
|
||||
par.phi0 = geometry::math::d2r<T>() * -10.;
|
||||
par.lam0 = d2r * -165.;
|
||||
par.phi0 = d2r * -10.;
|
||||
proj_parm.zcoeff = AB;
|
||||
par.es = 0.;
|
||||
|
||||
@@ -244,7 +248,9 @@ namespace projections
|
||||
template <typename Parameters, typename T>
|
||||
inline void setup_gs48(Parameters& par, par_mod_ster<T>& proj_parm)
|
||||
{
|
||||
static COMPLEX<T> AB[] = { /* 48 United States */
|
||||
static const T d2r = geometry::math::d2r<T>();
|
||||
|
||||
static pj_complex<T> AB[] = { /* 48 United States */
|
||||
{ 0.98879, 0.},
|
||||
{ 0., 0.},
|
||||
{-0.050909, 0.},
|
||||
@@ -253,8 +259,8 @@ namespace projections
|
||||
};
|
||||
|
||||
proj_parm.n = 4;
|
||||
par.lam0 = geometry::math::d2r<T>() * -96.;
|
||||
par.phi0 = geometry::math::d2r<T>() * -39.;
|
||||
par.lam0 = d2r * -96.;
|
||||
par.phi0 = d2r * -39.;
|
||||
proj_parm.zcoeff = AB;
|
||||
par.es = 0.;
|
||||
par.a = 6370997.;
|
||||
@@ -266,7 +272,9 @@ namespace projections
|
||||
template <typename Parameters, typename T>
|
||||
inline void setup_alsk(Parameters& par, par_mod_ster<T>& proj_parm)
|
||||
{
|
||||
static COMPLEX<T> ABe[] = { /* Alaska ellipsoid */
|
||||
static const T d2r = geometry::math::d2r<T>();
|
||||
|
||||
static pj_complex<T> ABe[] = { /* Alaska ellipsoid */
|
||||
{ .9945303, 0.},
|
||||
{ .0052083, -.0027404},
|
||||
{ .0072721, .0048181},
|
||||
@@ -275,7 +283,7 @@ namespace projections
|
||||
{ .3582802, -.2884586}
|
||||
};
|
||||
|
||||
static COMPLEX<T> ABs[] = { /* Alaska sphere */
|
||||
static pj_complex<T> ABs[] = { /* Alaska sphere */
|
||||
{ .9972523, 0.},
|
||||
{ .0052513, -.0041175},
|
||||
{ .0074606, .0048125},
|
||||
@@ -285,8 +293,8 @@ namespace projections
|
||||
};
|
||||
|
||||
proj_parm.n = 5;
|
||||
par.lam0 = geometry::math::d2r<T>() * -152.;
|
||||
par.phi0 = geometry::math::d2r<T>() * 64.;
|
||||
par.lam0 = d2r * -152.;
|
||||
par.phi0 = d2r * 64.;
|
||||
if (par.es != 0.0) { /* fixed ellipsoid/sphere */
|
||||
proj_parm.zcoeff = ABe;
|
||||
par.a = 6378206.4;
|
||||
@@ -303,7 +311,9 @@ namespace projections
|
||||
template <typename Parameters, typename T>
|
||||
inline void setup_gs50(Parameters& par, par_mod_ster<T>& proj_parm)
|
||||
{
|
||||
static COMPLEX<T> ABe[] = { /* GS50 ellipsoid */
|
||||
static const T d2r = geometry::math::d2r<T>();
|
||||
|
||||
static pj_complex<T> ABe[] = { /* GS50 ellipsoid */
|
||||
{ .9827497, 0.},
|
||||
{ .0210669, .0053804},
|
||||
{-.1031415, -.0571664},
|
||||
@@ -315,7 +325,7 @@ namespace projections
|
||||
{-.0194029, .0759677},
|
||||
{-.0210072, .0834037}
|
||||
};
|
||||
static COMPLEX<T> ABs[] = { /* GS50 sphere */
|
||||
static pj_complex<T> ABs[] = { /* GS50 sphere */
|
||||
{ .9842990, 0.},
|
||||
{ .0211642, .0037608},
|
||||
{-.1036018, -.0575102},
|
||||
@@ -329,8 +339,8 @@ namespace projections
|
||||
};
|
||||
|
||||
proj_parm.n = 9;
|
||||
par.lam0 = geometry::math::d2r<T>() * -120.;
|
||||
par.phi0 = geometry::math::d2r<T>() * 45.;
|
||||
par.lam0 = d2r * -120.;
|
||||
par.phi0 = d2r * 45.;
|
||||
if (par.es != 0.0) { /* fixed ellipsoid/sphere */
|
||||
proj_parm.zcoeff = ABe;
|
||||
par.a = 6378206.4;
|
||||
|
||||
@@ -68,22 +68,20 @@ namespace projections
|
||||
namespace detail { namespace nzmg
|
||||
{
|
||||
|
||||
static const double EPSLN = 1e-10;
|
||||
//static const double SEC5_TO_RAD = 0.4848136811095359935899141023;
|
||||
//static const double RAD_TO_SEC5 = 2.062648062470963551564733573;
|
||||
static const double epsilon = 1e-10;
|
||||
static const int Nbf = 5;
|
||||
static const int Ntpsi = 9;
|
||||
static const int Ntphi = 8;
|
||||
|
||||
template <typename T>
|
||||
inline T SEC5_TO_RAD() { return 0.4848136811095359935899141023; }
|
||||
inline T sec5_to_rad() { return 0.4848136811095359935899141023; }
|
||||
template <typename T>
|
||||
inline T RAD_TO_SEC5() { return 2.062648062470963551564733573; }
|
||||
inline T rad_to_sec5() { return 2.062648062470963551564733573; }
|
||||
|
||||
template <typename T>
|
||||
inline const COMPLEX<T> * bf()
|
||||
inline const pj_complex<T> * bf()
|
||||
{
|
||||
static const COMPLEX<T> result[] = {
|
||||
static const pj_complex<T> result[] = {
|
||||
{.7557853228, 0.0},
|
||||
{.249204646, .003371507},
|
||||
{-.001541739, .041058560},
|
||||
@@ -128,13 +126,13 @@ namespace projections
|
||||
// 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
|
||||
{
|
||||
static const CalculationType RAD_TO_SEC5 = nzmg::RAD_TO_SEC5<CalculationType>();
|
||||
static const CalculationType rad_to_sec5 = nzmg::rad_to_sec5<CalculationType>();
|
||||
|
||||
COMPLEX<CalculationType> p;
|
||||
pj_complex<CalculationType> p;
|
||||
const CalculationType * C;
|
||||
int i;
|
||||
|
||||
lp_lat = (lp_lat - this->m_par.phi0) * RAD_TO_SEC5;
|
||||
lp_lat = (lp_lat - this->m_par.phi0) * rad_to_sec5;
|
||||
for (p.r = *(C = tpsi<CalculationType>() + (i = Ntpsi)); i ; --i)
|
||||
p.r = *--C + lp_lat * p.r;
|
||||
p.r *= lp_lat;
|
||||
@@ -148,10 +146,10 @@ namespace projections
|
||||
// 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
|
||||
{
|
||||
static const CalculationType SEC5_TO_RAD = nzmg::SEC5_TO_RAD<CalculationType>();
|
||||
static const CalculationType sec5_to_rad = nzmg::sec5_to_rad<CalculationType>();
|
||||
|
||||
int nn, i;
|
||||
COMPLEX<CalculationType> p, f, fp, dp;
|
||||
pj_complex<CalculationType> p, f, fp, dp;
|
||||
CalculationType den;
|
||||
const CalculationType* C;
|
||||
|
||||
@@ -164,14 +162,14 @@ namespace projections
|
||||
den = fp.r * fp.r + fp.i * fp.i;
|
||||
p.r += dp.r = -(f.r * fp.r + f.i * fp.i) / den;
|
||||
p.i += dp.i = -(f.i * fp.r - f.r * fp.i) / den;
|
||||
if ((fabs(dp.r) + fabs(dp.i)) <= EPSLN)
|
||||
if ((fabs(dp.r) + fabs(dp.i)) <= epsilon)
|
||||
break;
|
||||
}
|
||||
if (nn) {
|
||||
lp_lon = p.i;
|
||||
for (lp_lat = *(C = tphi<CalculationType>() + (i = Ntphi)); i ; --i)
|
||||
lp_lat = *--C + p.r * lp_lat;
|
||||
lp_lat = this->m_par.phi0 + p.r * lp_lat * SEC5_TO_RAD;
|
||||
lp_lat = this->m_par.phi0 + p.r * lp_lat * sec5_to_rad;
|
||||
} else
|
||||
lp_lon = lp_lat = HUGE_VAL;
|
||||
}
|
||||
@@ -188,11 +186,12 @@ namespace projections
|
||||
inline void setup_nzmg(Parameters& par)
|
||||
{
|
||||
typedef typename Parameters::type calc_t;
|
||||
static const calc_t d2r = geometry::math::d2r<calc_t>();
|
||||
|
||||
/* force to International major axis */
|
||||
par.ra = 1. / (par.a = 6378388.0);
|
||||
par.lam0 = geometry::math::d2r<calc_t>() * 173.;
|
||||
par.phi0 = geometry::math::d2r<calc_t>() * -41.;
|
||||
par.lam0 = 173. * d2r;
|
||||
par.phi0 = -41. * d2r;
|
||||
par.x0 = 2510000.;
|
||||
par.y0 = 6023150.;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user