diff options
| author | Even Rouault <even.rouault@spatialys.com> | 2019-09-25 20:38:26 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-09-25 20:38:26 +0200 |
| commit | 6ed53b7a8c635fc404f193c1a99ea73418b9b343 (patch) | |
| tree | e9f3bf18d5d623faa1ac3b94fd43101458664e87 /src | |
| parent | b21f2b98b44a89f9d548b868ad6fa8f7d1dff717 (diff) | |
| parent | 03e5d0b6fa001ff9c355a889c6a2ce00c6b560e9 (diff) | |
| download | PROJ-6ed53b7a8c635fc404f193c1a99ea73418b9b343.tar.gz PROJ-6ed53b7a8c635fc404f193c1a99ea73418b9b343.zip | |
Merge pull request #1637 from rouault/fix_solaris_build
io.cpp: fix build on Solaris
Diffstat (limited to 'src')
| -rw-r--r-- | src/iso19111/io.cpp | 8 | ||||
| -rw-r--r-- | src/projections/hatano.cpp | 4 | ||||
| -rw-r--r-- | src/projections/isea.cpp | 102 | ||||
| -rw-r--r-- | src/projections/mbtfpp.cpp | 6 |
4 files changed, 60 insertions, 60 deletions
diff --git a/src/iso19111/io.cpp b/src/iso19111/io.cpp index 550312d8..b316d094 100644 --- a/src/iso19111/io.cpp +++ b/src/iso19111/io.cpp @@ -4444,12 +4444,12 @@ class JSONParser { } template <class TargetCRS, class DatumBuilderType, - class CS = CoordinateSystem> + class CSClass = CoordinateSystem> util::nn<std::shared_ptr<TargetCRS>> buildCRS(const json &j, DatumBuilderType f) { auto datum = (this->*f)(getObject(j, "datum")); auto cs = buildCS(getObject(j, "coordinate_system")); - auto csCast = util::nn_dynamic_pointer_cast<CS>(cs); + auto csCast = util::nn_dynamic_pointer_cast<CSClass>(cs); if (!csCast) { throw ParsingException("coordinate_system not of expected type"); } @@ -4457,7 +4457,7 @@ class JSONParser { NN_NO_CHECK(csCast)); } - template <class TargetCRS, class BaseCRS, class CS = CoordinateSystem> + template <class TargetCRS, class BaseCRS, class CSClass = CoordinateSystem> util::nn<std::shared_ptr<TargetCRS>> buildDerivedCRS(const json &j) { auto baseCRSObj = create(getObject(j, "base_crs")); auto baseCRS = util::nn_dynamic_pointer_cast<BaseCRS>(baseCRSObj); @@ -4465,7 +4465,7 @@ class JSONParser { throw ParsingException("base_crs not of expected type"); } auto cs = buildCS(getObject(j, "coordinate_system")); - auto csCast = util::nn_dynamic_pointer_cast<CS>(cs); + auto csCast = util::nn_dynamic_pointer_cast<CSClass>(cs); if (!csCast) { throw ParsingException("coordinate_system not of expected type"); } diff --git a/src/projections/hatano.cpp b/src/projections/hatano.cpp index 6c125d2e..29a01f80 100644 --- a/src/projections/hatano.cpp +++ b/src/projections/hatano.cpp @@ -11,7 +11,7 @@ PROJ_HEAD(hatano, "Hatano Asymmetrical Equal Area") "\n\tPCyl, Sph"; #define EPS 1e-7 #define ONETOL 1.000001 #define CN 2.67595 -#define CS 2.43763 +#define CSz 2.43763 #define RCN 0.37369906014686373063 #define RCS 0.41023453108141924738 #define FYCN 1.75859 @@ -28,7 +28,7 @@ static PJ_XY hatano_s_forward (PJ_LP lp, PJ *P) { /* Spheroidal, forwa int i; (void) P; - c = sin(lp.phi) * (lp.phi < 0. ? CS : CN); + c = sin(lp.phi) * (lp.phi < 0. ? CSz : CN); for (i = NITER; i; --i) { lp.phi -= th1 = (lp.phi + sin(lp.phi) - c) / (1. + cos(lp.phi)); if (fabs(th1) < EPS) break; diff --git a/src/projections/isea.cpp b/src/projections/isea.cpp index c712d7ea..351739d4 100644 --- a/src/projections/isea.cpp +++ b/src/projections/isea.cpp @@ -668,10 +668,10 @@ static int isea_tri_plane(int tri, struct isea_pt *pt, double radius) { /* convert projected triangle coords to quad xy coords, return quad number */ static int isea_ptdd(int tri, struct isea_pt *pt) { - int downtri, quad; + int downtri, quadz; downtri = (((tri - 1) / 5) % 2 == 1); - quad = ((tri - 1) % 5) + ((tri - 1) / 10) * 5 + 1; + quadz = ((tri - 1) % 5) + ((tri - 1) / 10) * 5 + 1; isea_rotate(pt, downtri ? 240.0 : 60.0); if (downtri) { @@ -679,10 +679,10 @@ static int isea_ptdd(int tri, struct isea_pt *pt) { /* pt->y += cos(30.0 * M_PI / 180.0); */ pt->y += .86602540378443864672; } - return quad; + return quadz; } -static int isea_dddi_ap3odd(struct isea_dgg *g, int quad, struct isea_pt *pt, +static int isea_dddi_ap3odd(struct isea_dgg *g, int quadz, struct isea_pt *pt, struct isea_pt *di) { struct isea_pt v; @@ -715,40 +715,40 @@ static int isea_dddi_ap3odd(struct isea_dgg *g, int quad, struct isea_pt *pt, * you want to test for max coords for the next quad in the same * "row" first to get the case where both are max */ - if (quad <= 5) { + if (quadz <= 5) { if (d == 0 && i == maxcoord) { /* north pole */ - quad = 0; + quadz = 0; d = 0; i = 0; } else if (i == maxcoord) { /* upper right in next quad */ - quad += 1; - if (quad == 6) - quad = 1; + quadz += 1; + if (quadz == 6) + quadz = 1; i = maxcoord - d; d = 0; } else if (d == maxcoord) { /* lower right in quad to lower right */ - quad += 5; + quadz += 5; d = 0; } - } else if (quad >= 6) { + } else if (quadz >= 6) { if (i == 0 && d == maxcoord) { /* south pole */ - quad = 11; + quadz = 11; d = 0; i = 0; } else if (d == maxcoord) { /* lower right in next quad */ - quad += 1; - if (quad == 11) - quad = 6; + quadz += 1; + if (quadz == 11) + quadz = 6; d = maxcoord - i; i = 0; } else if (i == maxcoord) { /* upper right in quad to upper right */ - quad = (quad - 4) % 5; + quadz = (quadz - 4) % 5; i = 0; } } @@ -756,11 +756,11 @@ static int isea_dddi_ap3odd(struct isea_dgg *g, int quad, struct isea_pt *pt, di->x = d; di->y = i; - g->quad = quad; - return quad; + g->quad = quadz; + return quadz; } -static int isea_dddi(struct isea_dgg *g, int quad, struct isea_pt *pt, +static int isea_dddi(struct isea_dgg *g, int quadz, struct isea_pt *pt, struct isea_pt *di) { struct isea_pt v; double hexwidth; @@ -768,7 +768,7 @@ static int isea_dddi(struct isea_dgg *g, int quad, struct isea_pt *pt, struct hex h; if (g->aperture == 3 && g->resolution % 2 != 0) { - return isea_dddi_ap3odd(g, quad, pt, di); + return isea_dddi_ap3odd(g, quadz, pt, di); } /* todo might want to do this as an iterated loop */ if (g->aperture >0) { @@ -793,41 +793,41 @@ static int isea_dddi(struct isea_dgg *g, int quad, struct isea_pt *pt, hex_iso(&h); /* we may actually be on another quad */ - if (quad <= 5) { + if (quadz <= 5) { if (h.x == 0 && h.z == -sidelength) { /* north pole */ - quad = 0; + quadz = 0; h.z = 0; h.y = 0; h.x = 0; } else if (h.z == -sidelength) { - quad = quad + 1; - if (quad == 6) - quad = 1; + quadz = quadz + 1; + if (quadz == 6) + quadz = 1; h.y = sidelength - h.x; h.z = h.x - sidelength; h.x = 0; } else if (h.x == sidelength) { - quad += 5; + quadz += 5; h.y = -h.z; h.x = 0; } - } else if (quad >= 6) { + } else if (quadz >= 6) { if (h.z == 0 && h.x == sidelength) { /* south pole */ - quad = 11; + quadz = 11; h.x = 0; h.y = 0; h.z = 0; } else if (h.x == sidelength) { - quad = quad + 1; - if (quad == 11) - quad = 6; + quadz = quadz + 1; + if (quadz == 11) + quadz = 6; h.x = h.y + sidelength; h.y = 0; h.z = -h.x; } else if (h.y == -sidelength) { - quad -= 4; + quadz -= 4; h.y = 0; h.z = -h.x; } @@ -835,35 +835,35 @@ static int isea_dddi(struct isea_dgg *g, int quad, struct isea_pt *pt, di->x = h.x; di->y = -h.z; - g->quad = quad; - return quad; + g->quad = quadz; + return quadz; } static int isea_ptdi(struct isea_dgg *g, int tri, struct isea_pt *pt, struct isea_pt *di) { struct isea_pt v; - int quad; + int quadz; v = *pt; - quad = isea_ptdd(tri, &v); - quad = isea_dddi(g, quad, &v, di); - return quad; + quadz = isea_ptdd(tri, &v); + quadz = isea_dddi(g, quadz, &v, di); + return quadz; } /* q2di to seqnum */ -static long isea_disn(struct isea_dgg *g, int quad, struct isea_pt *di) { +static long isea_disn(struct isea_dgg *g, int quadz, struct isea_pt *di) { long sidelength; long sn, height; long hexes; - if (quad == 0) { + if (quadz == 0) { g->serial = 1; return g->serial; } /* hexes in a quad */ hexes = lround(pow(static_cast<double>(g->aperture), static_cast<double>(g->resolution))); - if (quad == 11) { + if (quadz == 11) { g->serial = 1 + 10 * hexes + 1; return g->serial; } @@ -871,11 +871,11 @@ static long isea_disn(struct isea_dgg *g, int quad, struct isea_pt *di) { height = lround(floor((pow(g->aperture, (g->resolution - 1) / 2.0)))); sn = ((long)di->x) * height; sn += ((long)di->y) / height; - sn += (quad - 1) * hexes; + sn += (quadz - 1) * hexes; sn += 2; } else { sidelength = lround((pow(g->aperture, g->resolution / 2.0))); - sn = lround(floor(((quad - 1) * hexes + sidelength * di->x + di->y + 2))); + sn = lround(floor(((quadz - 1) * hexes + sidelength * di->x + di->y + 2))); } g->serial = sn; @@ -894,15 +894,15 @@ static int isea_hex(struct isea_dgg *g, int tri, long sidelength; long d, i, x, y; #endif - int quad; + int quadz; - quad = isea_ptdi(g, tri, pt, &v); + quadz = isea_ptdi(g, tri, pt, &v); if( v.x < (INT_MIN >> 4) || v.x > (INT_MAX >> 4) ) { throw "Invalid shift"; } - hex->x = ((int)v.x * 16) + quad; + hex->x = ((int)v.x * 16) + quadz; hex->y = v.y; return 1; @@ -914,16 +914,16 @@ static int isea_hex(struct isea_dgg *g, int tri, if (g->aperture == 3 && g->resolution % 2 != 0) { long offset = lround((pow(3.0, g->resolution - 1) + 0.5)); - d += offset * ((g->quad-1) % 5); - i += offset * ((g->quad-1) % 5); + d += offset * ((g->quadz-1) % 5); + i += offset * ((g->quadz-1) % 5); - if (quad == 0) { + if (quadz == 0) { d = 0; i = offset; - } else if (quad == 11) { + } else if (quadz == 11) { d = 2 * offset; i = 0; - } else if (quad > 5) { + } else if (quadz > 5) { d += offset; } diff --git a/src/projections/mbtfpp.cpp b/src/projections/mbtfpp.cpp index a4ab60b9..6cc7c466 100644 --- a/src/projections/mbtfpp.cpp +++ b/src/projections/mbtfpp.cpp @@ -7,7 +7,7 @@ PROJ_HEAD(mbtfpp, "McBride-Thomas Flat-Polar Parabolic") "\n\tCyl, Sph"; -#define CS .95257934441568037152 +#define CSy .95257934441568037152 #define FXC .92582009977255146156 #define FYC 3.40168025708304504493 #define C23 .66666666666666666666 @@ -19,7 +19,7 @@ static PJ_XY mbtfpp_s_forward (PJ_LP lp, PJ *P) { /* Spheroidal, forwa PJ_XY xy = {0.0,0.0}; (void) P; - lp.phi = asin(CS * sin(lp.phi)); + lp.phi = asin(CSy * sin(lp.phi)); xy.x = FXC * lp.lam * (2. * cos(C23 * lp.phi) - 1.); xy.y = FYC * sin(C13 * lp.phi); return xy; @@ -41,7 +41,7 @@ static PJ_LP mbtfpp_s_inverse (PJ_XY xy, PJ *P) { /* Spheroidal, inver lp.phi = asin(lp.phi); lp.lam = xy.x / ( FXC * (2. * cos(C23 * (lp.phi *= 3.)) - 1.) ); - if (fabs(lp.phi = sin(lp.phi) / CS) >= 1.) { + if (fabs(lp.phi = sin(lp.phi) / CSy) >= 1.) { if (fabs(lp.phi) > ONEEPS) { proj_errno_set(P, PJD_ERR_TOLERANCE_CONDITION); return lp; |
