[projections] re-add empty lines where in original

This makes it closer to original
This commit is contained in:
Barend Gehrels
2015-05-02 20:37:37 +02:00
parent 9d6eb2befa
commit 9befaa94e4
33 changed files with 64 additions and 0 deletions

View File

@@ -155,17 +155,20 @@ namespace boost { namespace geometry { namespace projections
{
double cosphi, sinphi;
int secant;
if (fabs(proj_parm.phi1 + proj_parm.phi2) < EPS10) throw proj_exception(-21);
proj_parm.n = sinphi = sin(proj_parm.phi1);
cosphi = cos(proj_parm.phi1);
secant = fabs(proj_parm.phi1 - proj_parm.phi2) >= EPS10;
if( (proj_parm.ellips = (par.es > 0.))) {
double ml1, m1;
if (!pj_enfn(par.es, proj_parm.en)) throw proj_exception(0);
m1 = pj_msfn(sinphi, cosphi, par.es);
ml1 = pj_qsfn(sinphi, par.e, par.one_es);
if (secant) { /* secant cone */
double ml2, m2;
sinphi = sin(proj_parm.phi2);
cosphi = cos(proj_parm.phi2);
m2 = pj_msfn(sinphi, cosphi, par.es);

View File

@@ -129,6 +129,7 @@ namespace boost { namespace geometry { namespace projections
void setup_airy(Parameters& par, par_airy& proj_parm)
{
double beta;
proj_parm.no_cut = pj_param(par.params, "bno_cut").i;
beta = 0.5 * (HALFPI - pj_param(par.params, "rlat_b").f);
if (fabs(beta) < EPS)

View File

@@ -162,6 +162,7 @@ namespace boost { namespace geometry { namespace projections
} while (((fabs(xy_x-x) > EPSILON) || (fabs(xy_y-y) > EPSILON)) && (round++ < MAXROUND));
if (iter == MAXITER && round == MAXROUND) fprintf(stderr, "Warning: Accuracy of 1e-12 not reached. Last increments: dlat=%e and dlon=%e\n", dp, dl);
}
};

View File

@@ -148,6 +148,7 @@ namespace boost { namespace geometry { namespace projections
void setup_bonne(Parameters& par, par_bonne& proj_parm)
{
double c;
proj_parm.phi1 = pj_param(par.params, "rlat_1").f;
if (fabs(proj_parm.phi1) < EPS10) throw proj_exception(-23);
if (par.es) {

View File

@@ -125,6 +125,7 @@ namespace boost { namespace geometry { namespace projections
void setup_cea(Parameters& par, par_cea& proj_parm)
{
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);

View File

@@ -127,6 +127,7 @@ namespace boost { namespace geometry { namespace projections
{
double cosphi, sinphi;
int secant;
proj_parm.phi1 = pj_param(par.params, "rlat_1").f;
proj_parm.phi2 = pj_param(par.params, "rlat_2").f;
if (fabs(proj_parm.phi1 + proj_parm.phi2) < EPS10) throw proj_exception(-21);
@@ -137,6 +138,7 @@ namespace boost { namespace geometry { namespace projections
secant = fabs(proj_parm.phi1 - proj_parm.phi2) >= EPS10;
if( (proj_parm.ellips = (par.es > 0.)) ) {
double ml1, m1;
m1 = pj_msfn(sinphi, cosphi, par.es);
ml1 = pj_mlfn(proj_parm.phi1, sinphi, cosphi, proj_parm.en);
if (secant) { /* secant cone */

View File

@@ -262,6 +262,7 @@ namespace boost { namespace geometry { namespace projections
np *= n;
proj_parm.cgb[5] = np*(601676/22275.0 );
proj_parm.cbg[5] = np*(444337/155925.0);
/* Constants of the projections */
/* Transverse Mercator (UTM, ITM, etc) */
np = n*n;

View File

@@ -181,6 +181,7 @@ namespace boost { namespace geometry { namespace projections
{
double del, sig, s, t, x1, x2, T2, y1, m1, m2, y2;
int i;
if (!pj_enfn(par.es, proj_parm.en)) throw proj_exception(0);
if( (i = phi12(par, proj_parm, &del, &sig)) != 0)
throw proj_exception(i);

View File

@@ -1025,6 +1025,7 @@ namespace boost { namespace geometry { namespace projections
xy_x = out.x;
xy_y = out.y;
}
};
@@ -1035,6 +1036,7 @@ namespace boost { namespace geometry { namespace projections
std::string opt;
isea_grid_init(&proj_parm.dgg);
proj_parm.dgg.output = ISEA_PLANE;
/* proj_parm.dgg.radius = par.a; / * otherwise defaults to 1 */
/* calling library will scale, I think */
@@ -1049,21 +1051,27 @@ namespace boost { namespace geometry { namespace projections
throw proj_exception(-34);
}
}
if (pj_param(par.params, "tazi").i) {
proj_parm.dgg.o_az = pj_param(par.params, "razi").f;
}
if (pj_param(par.params, "tlon_0").i) {
proj_parm.dgg.o_lon = pj_param(par.params, "rlon_0").f;
}
if (pj_param(par.params, "tlat_0").i) {
proj_parm.dgg.o_lat = pj_param(par.params, "rlat_0").f;
}
if (pj_param(par.params, "taperture").i) {
proj_parm.dgg.aperture = pj_param(par.params, "iaperture").i;
}
if (pj_param(par.params, "tresolution").i) {
proj_parm.dgg.resolution = pj_param(par.params, "iresolution").i;
}
opt = pj_param(par.params, "smode").s;
if (! opt.empty()) {
if (opt == std::string("plane")) {
@@ -1082,14 +1090,17 @@ namespace boost { namespace geometry { namespace projections
throw proj_exception(-34);
}
}
if (pj_param(par.params, "trescale").i) {
proj_parm.dgg.radius = ISEA_SCALE;
}
if (pj_param(par.params, "tresolution").i) {
proj_parm.dgg.resolution = pj_param(par.params, "iresolution").i;
} else {
proj_parm.dgg.resolution = 4;
}
if (pj_param(par.params, "taperture").i) {
proj_parm.dgg.aperture = pj_param(par.params, "iaperture").i;
} else {

View File

@@ -152,6 +152,7 @@ namespace boost { namespace geometry { namespace projections
xy_y *= -1.0;
xy_x *= -1.0;
}
}
inline void inv(cartesian_type& xy_x, cartesian_type& xy_y, geographic_type& lp_lon, geographic_type& lp_lat) const
@@ -233,6 +234,7 @@ namespace boost { namespace geometry { namespace projections
while (ok==0);
lp_lon -= this->m_par.lam0;
}
};
@@ -243,22 +245,28 @@ namespace boost { namespace geometry { namespace projections
double ts;
/* read some Parameters,
* 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 */
if (!pj_param(par.params, "tlon_0").i)
par.lam0 = 0.7417649320975901 - 0.308341501185665;
/* if scale not set default to 0.9999 */
if (!pj_param(par.params, "tk").i)
par.k0 = 0.9999;
/* always the same */
}

View File

@@ -155,6 +155,7 @@ namespace boost { namespace geometry { namespace projections
void setup_labrd(Parameters& par, par_labrd& proj_parm)
{
double Az, sinp, R, N, t;
proj_parm.rot = pj_param(par.params, "bno_rot").i == 0;
Az = pj_param(par.params, "razi").f;
sinp = sin(par.phi0);

View File

@@ -269,6 +269,7 @@ namespace boost { namespace geometry { namespace projections
void setup_laea(Parameters& par, par_laea& proj_parm)
{
double t;
if (fabs((t = fabs(par.phi0)) - HALFPI) < EPS10)
proj_parm.mode = par.phi0 < 0. ? S_POLE : N_POLE;
else if (fabs(t) < EPS10)
@@ -277,6 +278,7 @@ namespace boost { namespace geometry { namespace projections
proj_parm.mode = OBLIQ;
if (par.es) {
double sinphi;
par.e = sqrt(par.es);
proj_parm.qp = pj_qsfn(1., par.e, par.one_es);
proj_parm.mmf = .5 / (1. - par.es);

View File

@@ -94,6 +94,7 @@ namespace boost { namespace geometry { namespace projections
void setup_lagrng(Parameters& par, par_lagrng& proj_parm)
{
double phi1;
if ((proj_parm.rw = pj_param(par.params, "dW").f) <= 0) throw proj_exception(-27);
proj_parm.hrw = 0.5 * (proj_parm.rw = 1. / proj_parm.rw);
phi1 = pj_param(par.params, "rlat_1").f;

View File

@@ -143,6 +143,7 @@ namespace boost { namespace geometry { namespace projections
{
double cosphi, sinphi;
int secant;
proj_parm.phi1 = pj_param(par.params, "rlat_1").f;
if (pj_param(par.params, "tlat_2").i)
proj_parm.phi2 = pj_param(par.params, "rlat_2").f;
@@ -157,6 +158,7 @@ namespace boost { namespace geometry { namespace projections
secant = fabs(proj_parm.phi1 - proj_parm.phi2) >= EPS10;
if( (proj_parm.ellips = (par.es != 0.)) ) {
double ml1, m1;
par.e = sqrt(par.es);
m1 = pj_msfn(sinphi, cosphi, par.es);
ml1 = pj_tsfn(proj_parm.phi1, sinphi, par.e);

View File

@@ -120,6 +120,7 @@ namespace boost { namespace geometry { namespace projections
void setup_lcca(Parameters& par, par_lcca& proj_parm)
{
double s2p0, N0, R0, tan0, tan20;
if (!pj_enfn(par.es, proj_parm.en)) throw proj_exception(0);
if (!pj_param(par.params, "tlat_0").i) throw proj_exception(50);
if (par.phi0 == 0.) throw proj_exception(51);

View File

@@ -198,6 +198,7 @@ namespace boost { namespace geometry { namespace projections
{
int land, path;
double lam, alf, esc, ess;
land = pj_param(par.params, "ilsat").i;
if (land <= 0 || land > 5) throw proj_exception(-28);
path = pj_param(par.params, "ipath").i;

View File

@@ -114,6 +114,7 @@ namespace boost { namespace geometry { namespace projections
{
double phits=0.0;
int is_phits;
if( (is_phits = pj_param(par.params, "tlat_ts").i) ) {
phits = fabs(pj_param(par.params, "rlat_ts").f);
if (phits >= HALFPI) throw proj_exception(-24);

View File

@@ -151,6 +151,7 @@ namespace boost { namespace geometry { namespace projections
void setup(Parameters& par, par_mod_ster& proj_parm) /* general initialization */
{
double esphi, chio;
if (par.es) {
esphi = par.e * sin(par.phi0);
chio = 2. * atan(tan((HALFPI + par.phi0) * .5) *
@@ -172,6 +173,7 @@ namespace boost { namespace geometry { namespace projections
{0., 0.},
{0.019430, 0.}
};
proj_parm.n = 2;
par.lam0 = DEG_TO_RAD * 20.;
par.phi0 = DEG_TO_RAD * 18.;
@@ -190,6 +192,7 @@ namespace boost { namespace geometry { namespace projections
{0., 0.},
{-0.0088162, -0.00617325}
};
proj_parm.n = 2;
par.lam0 = DEG_TO_RAD * -165.;
par.phi0 = DEG_TO_RAD * -10.;
@@ -210,6 +213,7 @@ namespace boost { namespace geometry { namespace projections
{0., 0.},
{0.075528, 0.}
};
proj_parm.n = 4;
par.lam0 = DEG_TO_RAD * -96.;
par.phi0 = DEG_TO_RAD * -39.;
@@ -239,6 +243,7 @@ namespace boost { namespace geometry { namespace projections
{.0636871, -.1408027},
{.3660976, -.2937382}
};
proj_parm.n = 5;
par.lam0 = DEG_TO_RAD * -152.;
par.phi0 = DEG_TO_RAD * 64.;
@@ -282,6 +287,7 @@ namespace boost { namespace geometry { namespace projections
{-.0216473, .0776645},
{-.0225161, .0853673}
};
proj_parm.n = 9;
par.lam0 = DEG_TO_RAD * -120.;
par.phi0 = DEG_TO_RAD * 45.;

View File

@@ -104,6 +104,7 @@ namespace boost { namespace geometry { namespace projections
void setup(Parameters& par, par_moll& proj_parm, double p)
{
double r, sp, p2 = p + p;
par.es = 0;
sp = sin(p);
r = sqrt(TWOPI * sp / (p2 + sin(p2)));

View File

@@ -117,6 +117,7 @@ namespace boost { namespace geometry { namespace projections
/* longitude */
y2 = yc * yc;
lp_lon = xy_x / (A0 + y2 * (A1 + y2 * (A2 + y2 * y2 * y2 * (A3 + y2 * A4))));
}
};

View File

@@ -216,6 +216,7 @@ namespace boost { namespace geometry { namespace projections
void setup_tpers(Parameters& par, par_nsper& proj_parm)
{
double omega, gamma;
omega = pj_param(par.params, "dtilt").f * DEG_TO_RAD;
gamma = pj_param(par.params, "dazi").f * DEG_TO_RAD;
proj_parm.tilt = 1;

View File

@@ -155,6 +155,7 @@ namespace boost { namespace geometry { namespace projections
{
double phip;
Parameters pj;
/* get name of projection to be translated */
pj.name = pj_param(par.params, "so_proj").s;
/* copy existing header into new */
@@ -182,6 +183,7 @@ namespace boost { namespace geometry { namespace projections
}
if (pj_param(par.params, "to_alpha").i) {
double lamc, phic, alpha;
lamc = pj_param(par.params, "ro_lon_c").f;
phic = pj_param(par.params, "ro_lat_c").f;
alpha = pj_param(par.params, "ro_alpha").f;
@@ -199,6 +201,7 @@ namespace boost { namespace geometry { namespace projections
phip = pj_param(par.params, "ro_lat_p").f;
} else { /* specified new "equator" points */
double lam1, lam2, phi1, phi2, con;
lam1 = pj_param(par.params, "ro_lon_1").f;
phi1 = pj_param(par.params, "ro_lat_1").f;
lam2 = pj_param(par.params, "ro_lon_2").f;

View File

@@ -107,6 +107,7 @@ namespace boost { namespace geometry { namespace projections
void setup_ocea(Parameters& par, par_ocea& proj_parm)
{
double phi_0=0.0, phi_1, phi_2, lam_1, lam_2, lonz, alpha;
proj_parm.rok = par.a / par.k0;
proj_parm.rtk = par.a * par.k0;
if ( pj_param(par.params, "talpha").i) {

View File

@@ -144,6 +144,7 @@ namespace boost { namespace geometry { namespace projections
double con, com, cosph0, D, F, H, L, sinph0, p, J, gamma=0,
gamma0, lamc=0, lam1=0, lam2=0, phi1=0, phi2=0, 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) != 0)
alpha_c = pj_param(par.params, "ralpha").f;

View File

@@ -113,6 +113,7 @@ namespace boost { namespace geometry { namespace projections
void setup_rouss(Parameters& par, par_rouss& proj_parm)
{
double N0, es2, t, t2, R_R0_2, R_R0_4;
if (!proj_mdist_ini(par.es, proj_parm.en))
throw proj_exception(0);
es2 = sin(par.phi0);

View File

@@ -153,6 +153,7 @@ namespace boost { namespace geometry { namespace projections
{
double del, cs;
int i;
if( (i = phi12(par, proj_parm, &del)) )
throw proj_exception(i);
switch (proj_parm.type) {

View File

@@ -120,6 +120,7 @@ namespace boost { namespace geometry { namespace projections
void setup_somerc(Parameters& par, par_somerc& proj_parm)
{
double cp, phip0, sp;
proj_parm.hlf_e = 0.5 * par.e;
cp = cos(par.phi0);
cp *= cp;

View File

@@ -257,6 +257,7 @@ namespace boost { namespace geometry { namespace projections
void setup(Parameters& par, par_stere& proj_parm) /* general initialization */
{
double t;
if (fabs((t = fabs(par.phi0)) - HALFPI) < EPS10)
proj_parm.mode = par.phi0 < 0. ? S_POLE : N_POLE;
else
@@ -264,6 +265,7 @@ namespace boost { namespace geometry { namespace projections
proj_parm.phits = fabs(proj_parm.phits);
if (par.es) {
double X;
switch (proj_parm.mode) {
case N_POLE:
case S_POLE:

View File

@@ -116,7 +116,9 @@ namespace boost { namespace geometry { namespace projections
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);
proj_parm.cosc0 = cos(proj_parm.phic0);

View File

@@ -240,6 +240,7 @@ namespace boost { namespace geometry { namespace projections
void setup_utm(Parameters& par, par_tmerc& proj_parm)
{
int zone;
par.y0 = pj_param(par.params, "bsouth").i ? 10000000. : 0.;
par.x0 = 500000.;
if (pj_param(par.params, "tzone").i) /* zone input ? */

View File

@@ -114,6 +114,7 @@ namespace boost { namespace geometry { namespace projections
void setup_tpeqd(Parameters& par, par_tpeqd& proj_parm)
{
double lam_1, lam_2, phi_1, phi_2, A12, pp;
/* get control point locations */
phi_1 = pj_param(par.params, "rlat_1").f;
lam_1 = pj_param(par.params, "rlon_1").f;

View File

@@ -85,6 +85,7 @@ namespace boost { namespace geometry { namespace projections
void setup_urm5(Parameters& par, par_urm5& proj_parm)
{
double alpha, t;
proj_parm.n = pj_param(par.params, "dn").f;
proj_parm.q3 = pj_param(par.params, "dq").f / 3.;
alpha = pj_param(par.params, "ralpha").f;

View File

@@ -87,6 +87,7 @@ namespace boost { namespace geometry { namespace projections
void setup_wag3(Parameters& par, par_wag3& proj_parm)
{
double ts;
ts = pj_param(par.params, "rlat_ts").f;
proj_parm.C_x = cos(ts) / cos(2.*ts/3.);
par.es = 0.;