Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix proj_assign_context()/pj_set_ctx() with pipelines and alternative coord operations #1726

Merged
merged 1 commit into from
Nov 12, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/ctx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,14 @@ void pj_set_ctx( projPJ pj, projCtx ctx )
if (pj==nullptr)
return;
pj->ctx = ctx;
if( pj->is_pipeline )
{
pj_pipeline_assign_context_to_steps(pj, ctx);
}
for( const auto &alt: pj->alternativeCoordinateOperations )
{
pj_set_ctx(alt.pj, ctx);
}
}

/************************************************************************/
Expand Down
6 changes: 5 additions & 1 deletion src/pipeline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,11 @@ static PJ_LPZ pipeline_reverse_3d (PJ_XYZ xyz, PJ *P);
static PJ_XY pipeline_forward (PJ_LP lp, PJ *P);
static PJ_LP pipeline_reverse (PJ_XY xy, PJ *P);


void pj_pipeline_assign_context_to_steps( PJ* P, PJ_CONTEXT* ctx )
{
for (int i = 1; i <= static_cast<struct pj_opaque*>(P->opaque)->steps; i++)
proj_assign_context(static_cast<struct pj_opaque*>(P->opaque)->pipeline[i], ctx);
}


static PJ_COORD pipeline_forward_4d (PJ_COORD point, PJ *P) {
Expand Down
2 changes: 2 additions & 0 deletions src/proj_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -922,6 +922,8 @@ std::string pj_double_quote_string_param_if_needed(const std::string& str);
PJ *pj_create_internal (PJ_CONTEXT *ctx, const char *definition);
PJ *pj_create_argv_internal (PJ_CONTEXT *ctx, int argc, char **argv);

void pj_pipeline_assign_context_to_steps( PJ* P, PJ_CONTEXT* ctx );

/* classic public API */
#include "proj_api.h"

Expand Down