diff options
| author | Thomas Knudsen <busstoptaktik@users.noreply.github.com> | 2018-01-03 21:06:58 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-01-03 21:06:58 +0100 |
| commit | a3a67fb366e4628e5bda9e30b93b73648665e4d3 (patch) | |
| tree | 30d49dbe319a16c5ba058ff886512116238b4c0e /src/pj_transform.c | |
| parent | 403f930355926aced5caba5bfbcc230ad152cf86 (diff) | |
| download | PROJ-a3a67fb366e4628e5bda9e30b93b73648665e4d3.tar.gz PROJ-a3a67fb366e4628e5bda9e30b93b73648665e4d3.zip | |
Introduce preparation/finalization steps in fwd/inv subsystem, supporting arbitrary dimensionality in test code
* Call trans func of same dimensionality as input in gie
* Refactor prep/fin code for pj_fwd/pj_inv 2D,3D,4D
* Remove prime meridian handling from pj_transform (now handled in pj_fwd_prepare/pj_inv_finalize)
* Introduce prep/fin skips, mostly in support of axisswap and pipeline drivers
* Refactor fwd/inv subsystem
* pj_transform: Let pj_fwd/inv handle scaling
* Let pj_fwd/inv3d fall back to 2D eventually
Diffstat (limited to 'src/pj_transform.c')
| -rw-r--r-- | src/pj_transform.c | 28 |
1 files changed, 6 insertions, 22 deletions
diff --git a/src/pj_transform.c b/src/pj_transform.c index 21861331..c72df2e7 100644 --- a/src/pj_transform.c +++ b/src/pj_transform.c @@ -117,15 +117,6 @@ int pj_transform( PJ *srcdefn, PJ *dstdefn, long point_count, int point_offset, } /* -------------------------------------------------------------------- */ -/* Transform Z to meters if it isn't already. */ -/* -------------------------------------------------------------------- */ - if( srcdefn->vto_meter != 1.0 && z != NULL ) - { - for( i = 0; i < point_count; i++ ) - z[point_offset*i] *= srcdefn->vto_meter; - } - -/* -------------------------------------------------------------------- */ /* Transform geocentric source coordinates to lat/long. */ /* -------------------------------------------------------------------- */ if( srcdefn->is_geocent ) @@ -145,6 +136,7 @@ int pj_transform( PJ *srcdefn, PJ *dstdefn, long point_count, int point_offset, { x[point_offset*i] *= srcdefn->to_meter; y[point_offset*i] *= srcdefn->to_meter; + z[point_offset*i] *= srcdefn->to_meter; } } } @@ -253,11 +245,12 @@ int pj_transform( PJ *srcdefn, PJ *dstdefn, long point_count, int point_offset, } } } + /* -------------------------------------------------------------------- */ /* But if they are already lat long, adjust for the prime */ /* meridian if there is one in effect. */ /* -------------------------------------------------------------------- */ - if( srcdefn->from_greenwich != 0.0 ) + if ((srcdefn->is_geocent || srcdefn->is_latlong) && ( srcdefn->from_greenwich != 0.0 )) { for( i = 0; i < point_count; i++ ) { @@ -308,15 +301,14 @@ int pj_transform( PJ *srcdefn, PJ *dstdefn, long point_count, int point_offset, /* But if they are staying lat long, adjust for the prime */ /* meridian if there is one in effect. */ /* -------------------------------------------------------------------- */ - if( dstdefn->from_greenwich != 0.0 ) + if ((dstdefn->is_geocent || dstdefn->is_latlong) && ( dstdefn->from_greenwich != 0.0 )) { for( i = 0; i < point_count; i++ ) { if( x[point_offset*i] != HUGE_VAL ) x[point_offset*i] -= dstdefn->from_greenwich; } - } - +} /* -------------------------------------------------------------------- */ /* Transform destination latlong to geocentric if required. */ @@ -340,6 +332,7 @@ int pj_transform( PJ *srcdefn, PJ *dstdefn, long point_count, int point_offset, { x[point_offset*i] *= dstdefn->fr_meter; y[point_offset*i] *= dstdefn->fr_meter; + z[point_offset*i] *= srcdefn->fr_meter; } } } @@ -454,15 +447,6 @@ int pj_transform( PJ *srcdefn, PJ *dstdefn, long point_count, int point_offset, } /* -------------------------------------------------------------------- */ -/* Transform Z from meters if needed. */ -/* -------------------------------------------------------------------- */ - if( dstdefn->vto_meter != 1.0 && z != NULL ) - { - for( i = 0; i < point_count; i++ ) - z[point_offset*i] *= dstdefn->vfr_meter; - } - -/* -------------------------------------------------------------------- */ /* Transform normalized axes into unusual output coordinate axis */ /* orientation if needed. */ /* -------------------------------------------------------------------- */ |
