|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r77179 - trunk/boost/geometry/extensions/gis/projections/proj
From: barend.gehrels_at_[hidden]
Date: 2012-03-03 13:26:02
Author: barendgehrels
Date: 2012-03-03 13:26:01 EST (Sat, 03 Mar 2012)
New Revision: 77179
URL: http://svn.boost.org/trac/boost/changeset/77179
Log:
Boost.Geometry - projections, generated again from proj4 (trunk)
Text files modified:
trunk/boost/geometry/extensions/gis/projections/proj/cea.hpp | 17 ++--
trunk/boost/geometry/extensions/gis/projections/proj/geos.hpp | 87 ++++++++++++++++++++-----
trunk/boost/geometry/extensions/gis/projections/proj/gn_sinu.hpp | 2
trunk/boost/geometry/extensions/gis/projections/proj/krovak.hpp | 133 +++++++++++++++++++--------------------
trunk/boost/geometry/extensions/gis/projections/proj/moll.hpp | 14 +--
trunk/boost/geometry/extensions/gis/projections/proj/nell.hpp | 12 +--
trunk/boost/geometry/extensions/gis/projections/proj/omerc.hpp | 24 +++---
trunk/boost/geometry/extensions/gis/projections/proj/robin.hpp | 88 +++++++++++++-------------
trunk/boost/geometry/extensions/gis/projections/proj/sterea.hpp | 21 +++--
9 files changed, 221 insertions(+), 177 deletions(-)
Modified: trunk/boost/geometry/extensions/gis/projections/proj/cea.hpp
==============================================================================
--- trunk/boost/geometry/extensions/gis/projections/proj/cea.hpp (original)
+++ trunk/boost/geometry/extensions/gis/projections/proj/cea.hpp 2012-03-03 13:26:01 EST (Sat, 03 Mar 2012)
@@ -16,7 +16,7 @@
// PROJ4 is converted to Boost.Geometry by Barend Gehrels (Geodan, Amsterdam)
// Original copyright notice:
-
+
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
@@ -47,7 +47,7 @@
namespace boost { namespace geometry { namespace projection
{
#ifndef DOXYGEN_NO_DETAIL
- namespace detail { namespace cea{
+ namespace detail { namespace cea{
static const double EPS = 1e-10;
struct par_cea
@@ -108,7 +108,7 @@
inline void inv(cartesian_type& xy_x, cartesian_type& xy_y, geographic_type& lp_lon, geographic_type& lp_lat) const
{
double t;
-
+
if ((t = fabs(xy_y *= this->m_par.k0)) - EPS <= 1.) {
if (t >= 1.)
lp_lat = xy_y < 0. ? -HALFPI : HALFPI;
@@ -123,11 +123,10 @@
template <typename Parameters>
void setup_cea(Parameters& par, par_cea& proj_parm)
{
- double t;
+ double t = 0;
if (pj_param(par.params, "tlat_ts").i &&
- (par.k0 = cos(t = pj_param(par.params, "rlat_ts").f)) < 0.) throw proj_exception(-24);
- else
- t = 0.;
+ (par.k0 = cos(t = pj_param(par.params, "rlat_ts").f)) < 0.)
+ throw proj_exception(-24);
if (par.es) {
t = sin(t);
par.k0 /= sqrt(1. - par.es * t * t);
@@ -143,7 +142,7 @@
}
}} // namespace detail::cea
- #endif // doxygen
+ #endif // doxygen
/*!
\brief Equal Area Cylindrical projection
@@ -215,7 +214,7 @@
factory.add_to_factory("cea", new cea_entry<Geographic, Cartesian, Parameters>);
}
- } // namespace detail
+ } // namespace detail
#endif // doxygen
}}} // namespace boost::geometry::projection
Modified: trunk/boost/geometry/extensions/gis/projections/proj/geos.hpp
==============================================================================
--- trunk/boost/geometry/extensions/gis/projections/proj/geos.hpp (original)
+++ trunk/boost/geometry/extensions/gis/projections/proj/geos.hpp 2012-03-03 13:26:01 EST (Sat, 03 Mar 2012)
@@ -16,7 +16,7 @@
// PROJ4 is converted to Boost.Geometry by Barend Gehrels (Geodan, Amsterdam)
// Original copyright notice:
-
+
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
@@ -45,7 +45,7 @@
namespace boost { namespace geometry { namespace projection
{
#ifndef DOXYGEN_NO_DETAIL
- namespace detail { namespace geos{
+ namespace detail { namespace geos{
struct par_geos
{
@@ -56,9 +56,11 @@
double radius_g;
double radius_g_1;
double C;
+ std::string sweep_axis;
+ int flip_axis;
};
-
-
+
+
// template class, using CRTP to implement forward/inverse
template <typename Geographic, typename Cartesian, typename Parameters>
@@ -78,7 +80,7 @@
inline void fwd(geographic_type& lp_lon, geographic_type& lp_lat, cartesian_type& xy_x, cartesian_type& xy_y) const
{
double r, Vx, Vy, Vz, tmp;
-
+
/* Calculation of geocentric latitude. */
lp_lat = atan (this->m_proj_parm.radius_p2 * tan (lp_lat));
/* Calculation of the three components of the vector from satellite to
@@ -92,18 +94,34 @@
throw proj_exception();;
/* Calculation based on view angles from satellite. */
tmp = this->m_proj_parm.radius_g - Vx;
- xy_x = this->m_proj_parm.radius_g_1 * atan (Vy / tmp);
- xy_y = this->m_proj_parm.radius_g_1 * atan (Vz / boost::math::hypot (Vy, tmp));
+ if(this->m_proj_parm.flip_axis)
+ {
+ xy_x = this->m_proj_parm.radius_g_1 * atan (Vy / boost::math::hypot (Vz, tmp));
+ xy_y = this->m_proj_parm.radius_g_1 * atan (Vz / tmp);
+ }
+ else
+ {
+ xy_x = this->m_proj_parm.radius_g_1 * atan (Vy / tmp);
+ xy_y = this->m_proj_parm.radius_g_1 * atan (Vz / boost::math::hypot (Vy, tmp));
+ }
}
inline void inv(cartesian_type& xy_x, cartesian_type& xy_y, geographic_type& lp_lon, geographic_type& lp_lat) const
{
double Vx, Vy, Vz, a, b, det, k;
-
+
/* Setting three components of vector from satellite to position.*/
Vx = -1.0;
- Vy = tan (xy_x / this->m_proj_parm.radius_g_1);
- Vz = tan (xy_y / this->m_proj_parm.radius_g_1) * boost::math::hypot(1.0, Vy);
+ if(this->m_proj_parm.flip_axis)
+ {
+ Vz = tan (xy_y / this->m_proj_parm.radius_g_1);
+ Vy = tan (xy_x / this->m_proj_parm.radius_g_1) * boost::math::hypot(1.0, Vz);
+ }
+ else
+ {
+ Vy = tan (xy_x / this->m_proj_parm.radius_g_1);
+ Vz = tan (xy_y / this->m_proj_parm.radius_g_1) * boost::math::hypot(1.0, Vy);
+ }
/* Calculation of terms in cubic equation and determinant.*/
a = Vz / this->m_proj_parm.radius_p;
a = Vy * Vy + a * a + Vx * Vx;
@@ -139,7 +157,7 @@
inline void fwd(geographic_type& lp_lon, geographic_type& lp_lat, cartesian_type& xy_x, cartesian_type& xy_y) const
{
double Vx, Vy, Vz, tmp;
-
+
/* Calculation of the three components of the vector from satellite to
** position on earth surface (lon,lat).*/
tmp = cos(lp_lat);
@@ -150,18 +168,34 @@
if (((this->m_proj_parm.radius_g - Vx) * Vx - Vy * Vy - Vz * Vz) < 0.) throw proj_exception();;
/* Calculation based on view angles from satellite.*/
tmp = this->m_proj_parm.radius_g - Vx;
- xy_x = this->m_proj_parm.radius_g_1 * atan(Vy / tmp);
- xy_y = this->m_proj_parm.radius_g_1 * atan(Vz / boost::math::hypot(Vy, tmp));
+ if(this->m_proj_parm.flip_axis)
+ {
+ xy_x = this->m_proj_parm.radius_g_1 * atan(Vy / boost::math::hypot(Vz, tmp));
+ xy_y = this->m_proj_parm.radius_g_1 * atan(Vz / tmp);
+ }
+ else
+ {
+ xy_x = this->m_proj_parm.radius_g_1 * atan(Vy / tmp);
+ xy_y = this->m_proj_parm.radius_g_1 * atan(Vz / boost::math::hypot(Vy, tmp));
+ }
}
inline void inv(cartesian_type& xy_x, cartesian_type& xy_y, geographic_type& lp_lon, geographic_type& lp_lat) const
{
double Vx, Vy, Vz, a, b, det, k;
-
+
/* Setting three components of vector from satellite to position.*/
Vx = -1.0;
- Vy = tan (xy_x / (this->m_proj_parm.radius_g - 1.0));
- Vz = tan (xy_y / (this->m_proj_parm.radius_g - 1.0)) * sqrt (1.0 + Vy * Vy);
+ if(this->m_proj_parm.flip_axis)
+ {
+ Vz = tan (xy_y / (this->m_proj_parm.radius_g - 1.0));
+ Vy = tan (xy_x / (this->m_proj_parm.radius_g - 1.0)) * sqrt (1.0 + Vz * Vz);
+ }
+ else
+ {
+ Vy = tan (xy_x / (this->m_proj_parm.radius_g - 1.0));
+ Vz = tan (xy_y / (this->m_proj_parm.radius_g - 1.0)) * sqrt (1.0 + Vy * Vy);
+ }
/* Calculation of terms in cubic equation and determinant.*/
a = Vy * Vy + Vz * Vz + Vx * Vx;
b = 2 * this->m_proj_parm.radius_g * Vx;
@@ -183,7 +217,22 @@
{
if ((proj_parm.h = pj_param(par.params, "dh").f) <= 0.) throw proj_exception(-30);
if (par.phi0) throw proj_exception(-46);
- proj_parm.radius_g = 1. + (proj_parm.radius_g_1 = proj_parm.h / par.a);
+ proj_parm.sweep_axis = pj_param(par.params, "ssweep").s;
+ if (proj_parm.sweep_axis.empty())
+ proj_parm.flip_axis = 0;
+ else
+ {
+ if (proj_parm.sweep_axis[1] != '\0' ||
+ (proj_parm.sweep_axis[0] != 'x' &&
+ proj_parm.sweep_axis[0] != 'y'))
+ throw proj_exception(-49);
+ if (proj_parm.sweep_axis[0] == 'y')
+ proj_parm.flip_axis = 1;
+ else
+ proj_parm.flip_axis = 0;
+ }
+ proj_parm.radius_g_1 = proj_parm.h / par.a;
+ proj_parm.radius_g = 1. + proj_parm.radius_g_1;
proj_parm.C = proj_parm.radius_g * proj_parm.radius_g - 1.0;
if (par.es) {
proj_parm.radius_p = sqrt (par.one_es);
@@ -199,7 +248,7 @@
}
}} // namespace detail::geos
- #endif // doxygen
+ #endif // doxygen
/*!
\brief Geostationary Satellite View projection
@@ -271,7 +320,7 @@
factory.add_to_factory("geos", new geos_entry<Geographic, Cartesian, Parameters>);
}
- } // namespace detail
+ } // namespace detail
#endif // doxygen
}}} // namespace boost::geometry::projection
Modified: trunk/boost/geometry/extensions/gis/projections/proj/gn_sinu.hpp
==============================================================================
--- trunk/boost/geometry/extensions/gis/projections/proj/gn_sinu.hpp (original)
+++ trunk/boost/geometry/extensions/gis/projections/proj/gn_sinu.hpp 2012-03-03 13:26:01 EST (Sat, 03 Mar 2012)
@@ -84,7 +84,7 @@
inline void inv(cartesian_type& xy_x, cartesian_type& xy_y, geographic_type& lp_lon, geographic_type& lp_lat) const
{
- double s; boost::ignore_unused_variable_warning(s);
+ double s;
if ((s = fabs(lp_lat = pj_inv_mlfn(xy_y, this->m_par.es, this->m_proj_parm.en))) < HALFPI) {
s = sin(lp_lat);
Modified: trunk/boost/geometry/extensions/gis/projections/proj/krovak.hpp
==============================================================================
--- trunk/boost/geometry/extensions/gis/projections/proj/krovak.hpp (original)
+++ trunk/boost/geometry/extensions/gis/projections/proj/krovak.hpp 2012-03-03 13:26:01 EST (Sat, 03 Mar 2012)
@@ -16,7 +16,7 @@
// PROJ4 is converted to Boost.Geometry by Barend Gehrels (Geodan, Amsterdam)
// Original copyright notice:
-
+
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
@@ -45,42 +45,42 @@
namespace boost { namespace geometry { namespace projection
{
#ifndef DOXYGEN_NO_DETAIL
- namespace detail { namespace krovak{
+ namespace detail { namespace krovak{
struct par_krovak
{
double C_x;
};
-
-
-
-
-
+
+
+
+
+
/**
NOTES: According to EPSG the full Krovak projection method should have
the following parameters. Within PROJ.4 the azimuth, and pseudo
- standard parallel are hardcoded in the algorithm and can't be
+ standard parallel are hardcoded in the algorithm and can't be
altered from outside. The others all have defaults to match the
common usage with Krovak projection.
-
+
lat_0 = latitude of centre of the projection
-
+
lon_0 = longitude of centre of the projection
-
+
** = azimuth (true) of the centre line passing through the centre of the projection
-
+
** = latitude of pseudo standard parallel
-
+
k = scale factor on the pseudo standard parallel
-
+
x_0 = False Easting of the centre of the projection at the apex of the cone
-
+
y_0 = False Northing of the centre of the projection at the apex of the cone
-
+
**/
-
-
-
+
+
+
// template class, using CRTP to implement forward/inverse
template <typename Geographic, typename Cartesian, typename Parameters>
@@ -100,20 +100,17 @@
inline void fwd(geographic_type& lp_lon, geographic_type& lp_lat, cartesian_type& xy_x, cartesian_type& xy_y) const
{
/* calculate xy from lat/lon */
-
-
-
-
+
/* Constants, identical to inverse transform function */
double s45, s90, e2, e, alfa, uq, u0, g, k, k1, n0, ro0, ad, a, s0, n;
double gfi, u, fi0, deltav, s, d, eps, ro;
-
-
+
+
s45 = 0.785398163397448; /* 45 DEG */
s90 = 2 * s45;
fi0 = this->m_par.phi0; /* Latitude of projection centre 49 DEG 30' */
-
- /* Ellipsoid is used as Parameter in for.c and inv.c, therefore a must
+
+ /* Ellipsoid is used as Parameter in for.c and inv.c, therefore a must
be set to 1 here.
Ellipsoid Bessel 1841 a = 6377397.155m 1/f = 299.1528128,
e2=0.006674372230614;
@@ -122,67 +119,67 @@
/* e2 = this->m_par.es;*/ /* 0.006674372230614; */
e2 = 0.006674372230614;
e = sqrt(e2);
-
+
alfa = sqrt(1. + (e2 * pow(cos(fi0), 4)) / (1. - e2));
-
+
uq = 1.04216856380474; /* DU(2, 59, 42, 42.69689) */
u0 = asin(sin(fi0) / alfa);
g = pow( (1. + e * sin(fi0)) / (1. - e * sin(fi0)) , alfa * e / 2. );
-
+
k = tan( u0 / 2. + s45) / pow (tan(fi0 / 2. + s45) , alfa) * g;
-
+
k1 = this->m_par.k0;
n0 = a * sqrt(1. - e2) / (1. - e2 * pow(sin(fi0), 2));
s0 = 1.37008346281555; /* Latitude of pseudo standard parallel 78 DEG 30'00" N */
n = sin(s0);
ro0 = k1 * n0 / tan(s0);
ad = s90 - uq;
-
+
/* Transformation */
-
+
gfi =pow ( ((1. + e * sin(lp_lat)) /
(1. - e * sin(lp_lat))) , (alfa * e / 2.));
-
+
u= 2. * (atan(k * pow( tan(lp_lat / 2. + s45), alfa) / gfi)-s45);
-
+
deltav = - lp_lon * alfa;
-
+
s = asin(cos(ad) * sin(u) + sin(ad) * cos(u) * cos(deltav));
d = asin(cos(u) * sin(deltav) / cos(s));
eps = n * d;
ro = ro0 * pow(tan(s0 / 2. + s45) , n) / pow(tan(s / 2. + s45) , n) ;
-
+
/* x and y are reverted! */
xy_y = ro * cos(eps) / a;
xy_x = ro * sin(eps) / a;
-
+
if( !pj_param(this->m_par.params, "tczech").i )
{
xy_y *= -1.0;
xy_x *= -1.0;
}
-
+
return;
}
-
-
-
+
+
+
inline void inv(cartesian_type& xy_x, cartesian_type& xy_y, geographic_type& lp_lon, geographic_type& lp_lat) const
{
/* calculate lat/lon from xy */
-
+
/* Constants, identisch wie in der Umkehrfunktion */
double s45, s90, fi0, e2, e, alfa, uq, u0, g, k, k1, n0, ro0, ad, a, s0, n;
double u, deltav, s, d, eps, ro, fi1, xy0;
int ok;
-
+
s45 = 0.785398163397448; /* 45 DEG */
s90 = 2 * s45;
fi0 = this->m_par.phi0; /* Latitude of projection centre 49 DEG 30' */
-
-
- /* Ellipsoid is used as Parameter in for.c and inv.c, therefore a must
+
+
+ /* Ellipsoid is used as Parameter in for.c and inv.c, therefore a must
be set to 1 here.
Ellipsoid Bessel 1841 a = 6377397.155m 1/f = 299.1528128,
e2=0.006674372230614;
@@ -191,47 +188,47 @@
/* e2 = this->m_par.es; */ /* 0.006674372230614; */
e2 = 0.006674372230614;
e = sqrt(e2);
-
+
alfa = sqrt(1. + (e2 * pow(cos(fi0), 4)) / (1. - e2));
uq = 1.04216856380474; /* DU(2, 59, 42, 42.69689) */
u0 = asin(sin(fi0) / alfa);
g = pow( (1. + e * sin(fi0)) / (1. - e * sin(fi0)) , alfa * e / 2. );
-
+
k = tan( u0 / 2. + s45) / pow (tan(fi0 / 2. + s45) , alfa) * g;
-
+
k1 = this->m_par.k0;
n0 = a * sqrt(1. - e2) / (1. - e2 * pow(sin(fi0), 2));
s0 = 1.37008346281555; /* Latitude of pseudo standard parallel 78 DEG 30'00" N */
n = sin(s0);
ro0 = k1 * n0 / tan(s0);
ad = s90 - uq;
-
-
+
+
/* Transformation */
/* revert y, x*/
xy0=xy_x;
xy_x=xy_y;
xy_y=xy0;
-
+
if( !pj_param(this->m_par.params, "tczech").i )
{
xy_x *= -1.0;
xy_y *= -1.0;
}
-
+
ro = sqrt(xy_x * xy_x + xy_y * xy_y);
eps = atan2(xy_y, xy_x);
d = eps / sin(s0);
s = 2. * (atan( pow(ro0 / ro, 1. / n) * tan(s0 / 2. + s45)) - s45);
-
+
u = asin(cos(ad) * sin(s) - sin(ad) * cos(s) * cos(d));
deltav = asin(cos(s) * sin(d) / cos(u));
-
+
lp_lon = this->m_par.lam0 - deltav / alfa;
-
+
/* ITERATION FOR lp_lat */
fi1 = u;
-
+
ok = 0;
do
{
@@ -239,18 +236,18 @@
pow( tan(u / 2. + s45) , 1. / alfa) *
pow( (1. + e * sin(fi1)) / (1. - e * sin(fi1)) , e / 2.)
) - s45);
-
+
if (fabs(fi1 - lp_lat) < 0.000000000000001) ok=1;
fi1 = lp_lat;
-
+
}
while (ok==0);
-
+
lp_lon -= this->m_par.lam0;
-
+
return;
}
-
+
};
// Krovak
@@ -262,14 +259,14 @@
* here Latitude Truescale */
ts = pj_param(par.params, "rlat_ts").f;
proj_parm.C_x = ts;
-
+
/* we want Bessel as fixed ellipsoid */
par.a = 6377397.155;
par.e = sqrt(par.es = 0.006674372230614);
/* if latitude of projection center is not set, use 49d30'N */
if (!pj_param(par.params, "tlat_0").i)
par.phi0 = 0.863937979737193;
-
+
/* if center long is not set use 42d30'E of Ferro - 17d40' for Ferro */
/* that will correspond to using longitudes relative to greenwich */
/* as input and output, instead of lat/long relative to Ferro */
@@ -280,12 +277,12 @@
par.k0 = 0.9999;
/* always the same */
// par.inv = e_inverse;
-
+
// par.fwd = e_forward;
}
}} // namespace detail::krovak
- #endif // doxygen
+ #endif // doxygen
/*!
\brief Krovak projection
@@ -329,7 +326,7 @@
factory.add_to_factory("krovak", new krovak_entry<Geographic, Cartesian, Parameters>);
}
- } // namespace detail
+ } // namespace detail
#endif // doxygen
}}} // namespace boost::geometry::projection
Modified: trunk/boost/geometry/extensions/gis/projections/proj/moll.hpp
==============================================================================
--- trunk/boost/geometry/extensions/gis/projections/proj/moll.hpp (original)
+++ trunk/boost/geometry/extensions/gis/projections/proj/moll.hpp 2012-03-03 13:26:01 EST (Sat, 03 Mar 2012)
@@ -16,7 +16,7 @@
// PROJ4 is converted to Boost.Geometry by Barend Gehrels (Geodan, Amsterdam)
// Original copyright notice:
-
+
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
@@ -46,7 +46,7 @@
namespace boost { namespace geometry { namespace projection
{
#ifndef DOXYGEN_NO_DETAIL
- namespace detail { namespace moll{
+ namespace detail { namespace moll{
static const int MAX_ITER = 10;
static const double LOOP_TOL = 1e-7;
@@ -74,7 +74,7 @@
{
double k, V;
int i;
-
+
k = this->m_proj_parm.C_p * sin(lp_lat);
for (i = MAX_ITER; i ; --i) {
lp_lat -= V = (lp_lat + sin(lp_lat) - k) /
@@ -92,8 +92,6 @@
inline void inv(cartesian_type& xy_x, cartesian_type& xy_y, geographic_type& lp_lon, geographic_type& lp_lat) const
{
-
-
lp_lat = aasin(xy_y / this->m_proj_parm.C_y);
lp_lon = xy_x / (this->m_proj_parm.C_x * cos(lp_lat));
lp_lat += lp_lat;
@@ -102,7 +100,7 @@
};
template <typename Parameters>
- void setup(Parameters& par, par_moll& proj_parm, double p)
+ void setup(Parameters& par, par_moll& proj_parm, double p)
{
boost::ignore_unused_variable_warning(par);
boost::ignore_unused_variable_warning(proj_parm);
@@ -145,7 +143,7 @@
}
}} // namespace detail::moll
- #endif // doxygen
+ #endif // doxygen
/*!
\brief Mollweide projection
@@ -253,7 +251,7 @@
factory.add_to_factory("wag5", new wag5_entry<Geographic, Cartesian, Parameters>);
}
- } // namespace detail
+ } // namespace detail
#endif // doxygen
}}} // namespace boost::geometry::projection
Modified: trunk/boost/geometry/extensions/gis/projections/proj/nell.hpp
==============================================================================
--- trunk/boost/geometry/extensions/gis/projections/proj/nell.hpp (original)
+++ trunk/boost/geometry/extensions/gis/projections/proj/nell.hpp 2012-03-03 13:26:01 EST (Sat, 03 Mar 2012)
@@ -16,7 +16,7 @@
// PROJ4 is converted to Boost.Geometry by Barend Gehrels (Geodan, Amsterdam)
// Original copyright notice:
-
+
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
@@ -45,7 +45,7 @@
namespace boost { namespace geometry { namespace projection
{
#ifndef DOXYGEN_NO_DETAIL
- namespace detail { namespace nell{
+ namespace detail { namespace nell{
static const int MAX_ITER = 10;
static const double LOOP_TOL = 1e-7;
@@ -68,7 +68,7 @@
{
double k, V;
int i;
-
+
k = 2. * sin(lp_lat);
V = lp_lat * lp_lat;
lp_lat *= 1.00371 + V * (-0.0935382 + V * -0.011412);
@@ -84,8 +84,6 @@
inline void inv(cartesian_type& xy_x, cartesian_type& xy_y, geographic_type& lp_lon, geographic_type& lp_lat) const
{
-
-
lp_lon = 2. * xy_x / (1. + cos(xy_y));
lp_lat = aasin(0.5 * (xy_y + sin(xy_y)));
}
@@ -101,7 +99,7 @@
}
}} // namespace detail::nell
- #endif // doxygen
+ #endif // doxygen
/*!
\brief Nell projection
@@ -145,7 +143,7 @@
factory.add_to_factory("nell", new nell_entry<Geographic, Cartesian, Parameters>);
}
- } // namespace detail
+ } // namespace detail
#endif // doxygen
}}} // namespace boost::geometry::projection
Modified: trunk/boost/geometry/extensions/gis/projections/proj/omerc.hpp
==============================================================================
--- trunk/boost/geometry/extensions/gis/projections/proj/omerc.hpp (original)
+++ trunk/boost/geometry/extensions/gis/projections/proj/omerc.hpp 2012-03-03 13:26:01 EST (Sat, 03 Mar 2012)
@@ -16,7 +16,7 @@
// PROJ4 is converted to Boost.Geometry by Barend Gehrels (Geodan, Amsterdam)
// Original copyright notice:
-
+
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
@@ -47,11 +47,11 @@
namespace boost { namespace geometry { namespace projection
{
#ifndef DOXYGEN_NO_DETAIL
- namespace detail { namespace omerc{
+ namespace detail { namespace omerc{
static const double TOL = 1.e-7;
static const double EPS = 1.e-10;
- inline double TSFN0(double x)
+ inline double TSFN0(double x)
{return tan(.5 * (HALFPI - (x))); }
@@ -61,8 +61,8 @@
double v_pole_n, v_pole_s, u_0;
int no_rot;
};
-
-
+
+
// template class, using CRTP to implement forward/inverse
template <typename Geographic, typename Cartesian, typename Parameters>
@@ -82,7 +82,7 @@
inline void fwd(geographic_type& lp_lon, geographic_type& lp_lat, cartesian_type& xy_x, cartesian_type& xy_y) const
{
double Q, S, T, U, V, temp, u, v;
-
+
if (fabs(fabs(lp_lat) - HALFPI) > EPS) {
Q = this->m_proj_parm.E / pow(pj_tsfn(lp_lat, sin(lp_lat), this->m_par.e), this->m_proj_parm.B);
temp = 1. / Q;
@@ -95,7 +95,7 @@
v = 0.5 * this->m_proj_parm.ArB * log((1. - U)/(1. + U));
temp = cos(this->m_proj_parm.B * lp_lon);
u = (fabs(temp) < TOL) ? this->m_proj_parm.AB * lp_lon :
- this->m_proj_parm.ArB * atan2((S * this->m_proj_parm.cosgam + V * this->m_proj_parm.singam) , temp);
+ this->m_proj_parm.ArB * atan2((S * this->m_proj_parm.cosgam + V * this->m_proj_parm.singam) , temp);
} else {
v = lp_lat > 0 ? this->m_proj_parm.v_pole_n : this->m_proj_parm.v_pole_s;
u = this->m_proj_parm.ArB * lp_lat;
@@ -113,7 +113,7 @@
inline void inv(cartesian_type& xy_x, cartesian_type& xy_y, geographic_type& lp_lon, geographic_type& lp_lat) const
{
double u, v, Qp, Sp, Tp, Vp, Up;
-
+
if (this->m_proj_parm.no_rot) {
v = xy_y;
u = xy_x;
@@ -147,9 +147,9 @@
gamma0, lamc, lam1, lam2, phi1, phi2, alpha_c;
int alp, gam, no_off = 0;
proj_parm.no_rot = pj_param(par.params, "tno_rot").i;
- if ((alp = pj_param(par.params, "talpha").i))
+ if ((alp = pj_param(par.params, "talpha").i) != 0)
alpha_c = pj_param(par.params, "ralpha").f;
- if ((gam = pj_param(par.params, "tgamma").i))
+ if ((gam = pj_param(par.params, "tgamma").i) != 0)
gamma = pj_param(par.params, "rgamma").f;
if (alp || gam) {
lamc = pj_param(par.params, "rlonc").f;
@@ -239,7 +239,7 @@
}
}} // namespace detail::omerc
- #endif // doxygen
+ #endif // doxygen
/*!
\brief Oblique Mercator projection
@@ -286,7 +286,7 @@
factory.add_to_factory("omerc", new omerc_entry<Geographic, Cartesian, Parameters>);
}
- } // namespace detail
+ } // namespace detail
#endif // doxygen
}}} // namespace boost::geometry::projection
Modified: trunk/boost/geometry/extensions/gis/projections/proj/robin.hpp
==============================================================================
--- trunk/boost/geometry/extensions/gis/projections/proj/robin.hpp (original)
+++ trunk/boost/geometry/extensions/gis/projections/proj/robin.hpp 2012-03-03 13:26:01 EST (Sat, 03 Mar 2012)
@@ -16,7 +16,7 @@
// PROJ4 is converted to Boost.Geometry by Barend Gehrels (Geodan, Amsterdam)
// Original copyright notice:
-
+
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
@@ -46,7 +46,7 @@
namespace boost { namespace geometry { namespace projection
{
#ifndef DOXYGEN_NO_DETAIL
- namespace detail { namespace robin{
+ namespace detail { namespace robin{
static const double FXC = 0.8487;
static const double FYC = 1.3523;
static const double C1 = 11.45915590261646417544;
@@ -59,45 +59,45 @@
static struct COEFS {
double c0, c1, c2, c3;
} X[] = {
- {1, -5.67239e-12, -7.15511e-05, 3.11028e-06},
- {0.9986, -0.000482241, -2.4897e-05, -1.33094e-06},
- {0.9954, -0.000831031, -4.4861e-05, -9.86588e-07},
- {0.99, -0.00135363, -5.96598e-05, 3.67749e-06},
- {0.9822, -0.00167442, -4.4975e-06, -5.72394e-06},
- {0.973, -0.00214869, -9.03565e-05, 1.88767e-08},
- {0.96, -0.00305084, -9.00732e-05, 1.64869e-06},
- {0.9427, -0.00382792, -6.53428e-05, -2.61493e-06},
- {0.9216, -0.00467747, -0.000104566, 4.8122e-06},
- {0.8962, -0.00536222, -3.23834e-05, -5.43445e-06},
- {0.8679, -0.00609364, -0.0001139, 3.32521e-06},
- {0.835, -0.00698325, -6.40219e-05, 9.34582e-07},
- {0.7986, -0.00755337, -5.00038e-05, 9.35532e-07},
- {0.7597, -0.00798325, -3.59716e-05, -2.27604e-06},
- {0.7186, -0.00851366, -7.0112e-05, -8.63072e-06},
- {0.6732, -0.00986209, -0.000199572, 1.91978e-05},
- {0.6213, -0.010418, 8.83948e-05, 6.24031e-06},
- {0.5722, -0.00906601, 0.000181999, 6.24033e-06},
- {0.5322, 0.,0.,0. }},
+ {1, -5.67239e-12, -7.15511e-05, 3.11028e-06},
+ {0.9986, -0.000482241, -2.4897e-05, -1.33094e-06},
+ {0.9954, -0.000831031, -4.4861e-05, -9.86588e-07},
+ {0.99, -0.00135363, -5.96598e-05, 3.67749e-06},
+ {0.9822, -0.00167442, -4.4975e-06, -5.72394e-06},
+ {0.973, -0.00214869, -9.03565e-05, 1.88767e-08},
+ {0.96, -0.00305084, -9.00732e-05, 1.64869e-06},
+ {0.9427, -0.00382792, -6.53428e-05, -2.61493e-06},
+ {0.9216, -0.00467747, -0.000104566, 4.8122e-06},
+ {0.8962, -0.00536222, -3.23834e-05, -5.43445e-06},
+ {0.8679, -0.00609364, -0.0001139, 3.32521e-06},
+ {0.835, -0.00698325, -6.40219e-05, 9.34582e-07},
+ {0.7986, -0.00755337, -5.00038e-05, 9.35532e-07},
+ {0.7597, -0.00798325, -3.59716e-05, -2.27604e-06},
+ {0.7186, -0.00851366, -7.0112e-05, -8.63072e-06},
+ {0.6732, -0.00986209, -0.000199572, 1.91978e-05},
+ {0.6213, -0.010418, 8.83948e-05, 6.24031e-06},
+ {0.5722, -0.00906601, 0.000181999, 6.24033e-06},
+ {0.5322, 0.,0.,0.} },
Y[] = {
- {0, 0.0124, 3.72529e-10, 1.15484e-09},
- {0.062, 0.0124001, 1.76951e-08, -5.92321e-09},
- {0.124, 0.0123998, -7.09668e-08, 2.25753e-08},
- {0.186, 0.0124008, 2.66917e-07, -8.44523e-08},
- {0.248, 0.0123971, -9.99682e-07, 3.15569e-07},
- {0.31, 0.0124108, 3.73349e-06, -1.1779e-06},
- {0.372, 0.0123598, -1.3935e-05, 4.39588e-06},
- {0.434, 0.0125501, 5.20034e-05, -1.00051e-05},
- {0.4968, 0.0123198, -9.80735e-05, 9.22397e-06},
- {0.5571, 0.0120308, 4.02857e-05, -5.2901e-06},
- {0.6176, 0.0120369, -3.90662e-05, 7.36117e-07},
- {0.6769, 0.0117015, -2.80246e-05, -8.54283e-07},
- {0.7346, 0.0113572, -4.08389e-05, -5.18524e-07},
- {0.7903, 0.0109099, -4.86169e-05, -1.0718e-06},
- {0.8435, 0.0103433, -6.46934e-05, 5.36384e-09},
- {0.8936, 0.00969679, -6.46129e-05, -8.54894e-06},
- {0.9394, 0.00840949, -0.000192847, -4.21023e-06},
- {0.9761, 0.00616525, -0.000256001, -4.21021e-06},
- {1., 0.,0.,0 }};
+ {0, 0.0124, 3.72529e-10, 1.15484e-09},
+ {0.062, 0.0124001, 1.76951e-08, -5.92321e-09},
+ {0.124, 0.0123998, -7.09668e-08, 2.25753e-08},
+ {0.186, 0.0124008, 2.66917e-07, -8.44523e-08},
+ {0.248, 0.0123971, -9.99682e-07, 3.15569e-07},
+ {0.31, 0.0124108, 3.73349e-06, -1.1779e-06},
+ {0.372, 0.0123598, -1.3935e-05, 4.39588e-06},
+ {0.434, 0.0125501, 5.20034e-05, -1.00051e-05},
+ {0.4958, 0.0123198, -9.80735e-05, 9.22397e-06},
+ {0.5571, 0.0120308, 4.02857e-05, -5.2901e-06},
+ {0.6176, 0.0120369, -3.90662e-05, 7.36117e-07},
+ {0.6769, 0.0117015, -2.80246e-05, -8.54283e-07},
+ {0.7346, 0.0113572, -4.08389e-05, -5.18524e-07},
+ {0.7903, 0.0109099, -4.86169e-05, -1.0718e-06},
+ {0.8435, 0.0103433, -6.46934e-05, 5.36384e-09},
+ {0.8936, 0.00969679, -6.46129e-05, -8.54894e-06},
+ {0.9394, 0.00840949, -0.000192847, -4.21023e-06},
+ {0.9761, 0.00616525, -0.000256001, -4.21021e-06},
+ {1., 0.,0.,0} };
// template class, using CRTP to implement forward/inverse
template <typename Geographic, typename Cartesian, typename Parameters>
@@ -122,7 +122,7 @@
{
int i;
double dphi;
-
+
i = int_floor((dphi = fabs(lp_lat)) * C1);
if (i >= NODES) i = NODES - 1;
dphi = RAD_TO_DEG * (dphi - RC1 * i);
@@ -136,7 +136,7 @@
int i;
double t, t1;
struct COEFS T;
-
+
lp_lon = xy_x / FXC;
lp_lat = fabs(xy_y / FYC);
if (lp_lat >= 1.) { /* simple pathologic cases */
@@ -179,7 +179,7 @@
}
}} // namespace detail::robin
- #endif // doxygen
+ #endif // doxygen
/*!
\brief Robinson projection
@@ -223,7 +223,7 @@
factory.add_to_factory("robin", new robin_entry<Geographic, Cartesian, Parameters>);
}
- } // namespace detail
+ } // namespace detail
#endif // doxygen
}}} // namespace boost::geometry::projection
Modified: trunk/boost/geometry/extensions/gis/projections/proj/sterea.hpp
==============================================================================
--- trunk/boost/geometry/extensions/gis/projections/proj/sterea.hpp (original)
+++ trunk/boost/geometry/extensions/gis/projections/proj/sterea.hpp 2012-03-03 13:26:01 EST (Sat, 03 Mar 2012)
@@ -16,7 +16,7 @@
// PROJ4 is converted to Boost.Geometry by Barend Gehrels (Geodan, Amsterdam)
// Original copyright notice:
-
+
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
@@ -48,7 +48,7 @@
namespace boost { namespace geometry { namespace projection
{
#ifndef DOXYGEN_NO_DETAIL
- namespace detail { namespace sterea{
+ namespace detail { namespace sterea{
static const double DEL_TOL = 1.e-14;
static const int MAX_ITER = 10;
@@ -59,9 +59,9 @@
double R2;
gauss::GAUSS en;
};
-
-
-
+
+
+
// template class, using CRTP to implement forward/inverse
template <typename Geographic, typename Cartesian, typename Parameters>
@@ -81,7 +81,7 @@
inline void fwd(geographic_type& lp_lon, geographic_type& lp_lat, cartesian_type& xy_x, cartesian_type& xy_y) const
{
double cosc, sinc, cosl_, k;
-
+
detail::gauss::gauss(m_proj_parm.en, lp_lon, lp_lat);
sinc = sin(lp_lat);
cosc = cos(lp_lat);
@@ -94,7 +94,7 @@
inline void inv(cartesian_type& xy_x, cartesian_type& xy_y, geographic_type& lp_lon, geographic_type& lp_lat) const
{
double rho, c, sinc, cosc;
-
+
xy_x /= this->m_par.k0;
xy_y /= this->m_par.k0;
if((rho = boost::math::hypot(xy_x, xy_y))) {
@@ -116,6 +116,9 @@
template <typename Parameters>
void setup_sterea(Parameters& par, par_sterea& proj_parm)
{
+
+
+
double R;
proj_parm.en = detail::gauss::gauss_ini(par.e, par.phi0, proj_parm.phic0, R);
proj_parm.sinc0 = sin(proj_parm.phic0);
@@ -126,7 +129,7 @@
}
}} // namespace detail::sterea
- #endif // doxygen
+ #endif // doxygen
/*!
\brief Oblique Stereographic Alternative projection
@@ -171,7 +174,7 @@
factory.add_to_factory("sterea", new sterea_entry<Geographic, Cartesian, Parameters>);
}
- } // namespace detail
+ } // namespace detail
// Create EPSG specializations
// (Proof of Concept, only for some)
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk