diff options
| author | Kristian Evers <kristianevers@gmail.com> | 2018-01-11 16:40:01 +0100 |
|---|---|---|
| committer | Kristian Evers <kristianevers@gmail.com> | 2018-01-11 16:40:01 +0100 |
| commit | b6c8e417d71dca9ac04f57660da2c94a0a85e8ff (patch) | |
| tree | fd364bfd9b7a5404c3cb70e1aaf113a3a4989e4b /src/PJ_pipeline.c | |
| parent | fb69e67f8694fd61943cc9f9c2da75ec35ce9841 (diff) | |
| download | PROJ-b6c8e417d71dca9ac04f57660da2c94a0a85e8ff.tar.gz PROJ-b6c8e417d71dca9ac04f57660da2c94a0a85e8ff.zip | |
Set inv*-functions to zero on pipeline PJ's where an inverse does not exist.
Some projections do not have an inverse mapping. If such a projection is used
as a (forward) step in a pipeline we won't be able to perform an inverse
operation using the pipeline. By setting the inv, inv3d and inv4d pointers to
zero we signal to the caller that an inverse mapping is not available.
Diffstat (limited to 'src/PJ_pipeline.c')
| -rw-r--r-- | src/PJ_pipeline.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/PJ_pipeline.c b/src/PJ_pipeline.c index af9c5394..3dcc85d9 100644 --- a/src/PJ_pipeline.c +++ b/src/PJ_pipeline.c @@ -320,6 +320,7 @@ PJ *OPERATION(pipeline,0) { int i, nsteps = 0, argc; int i_pipeline = -1, i_first_step = -1, i_current_step; char **argv, **current_argv; + PJ *Q; P->fwd4d = pipeline_forward_4d; P->inv4d = pipeline_reverse_4d; @@ -429,14 +430,29 @@ PJ *OPERATION(pipeline,0) { /* Is this step inverted? */ for (j = 0; j < current_argc; j++) - if (0==strcmp("inv", current_argv[j])) + if (0==strcmp("inv", current_argv[j])) { next_step->inverted = 1; + } P->opaque->pipeline[i+1] = next_step; proj_log_trace (P, "Pipeline at [%p]: step at [%p] done", P, next_step); } + /* determine if an inverse operation is possible */ + for (i = 1; i <= nsteps; i++) { + Q = P->opaque->pipeline[i]; + if ( ( Q->inverted && (Q->fwd || Q->fwd3d || Q->fwd4d) ) || + ( Q->inv || Q->inv3d || Q->inv4d) ) { + continue; + } else { + P->inv = 0; + P->inv3d = 0; + P->inv4d = 0; + break; + } + } + proj_log_trace (P, "Pipeline: %d steps built. Determining i/o characteristics", nsteps); /* Determine forward input (= reverse output) data type */ |
