aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEven Rouault <even.rouault@spatialys.com>2018-12-27 10:53:51 +0100
committerEven Rouault <even.rouault@spatialys.com>2018-12-27 11:03:14 +0100
commita4d389c37529bda488dc14fb4225e4dec40c0743 (patch)
tree3531b98791f3aec23b382c62576be078f66f3fd8 /src
parent81ec8c0b58d66333fccd3703dab62a11132a0331 (diff)
downloadPROJ-a4d389c37529bda488dc14fb4225e4dec40c0743.tar.gz
PROJ-a4d389c37529bda488dc14fb4225e4dec40c0743.zip
Remove proj_def.dat (fixes #201)
Diffstat (limited to 'src')
-rw-r--r--src/init.cpp76
-rw-r--r--src/projections/lagrng.cpp5
-rw-r--r--src/tests/multistresstest.cpp13
-rw-r--r--src/tests/test228.cpp5
-rw-r--r--src/transformations/deformation.cpp3
5 files changed, 9 insertions, 93 deletions
diff --git a/src/init.cpp b/src/init.cpp
index 5710031c..72ed69fe 100644
--- a/src/init.cpp
+++ b/src/init.cpp
@@ -330,76 +330,6 @@ Expand key from buffer or (if not in buffer) from init file
return init_items;
}
-
-
-static paralist *append_defaults_to_paralist (PJ_CONTEXT *ctx, paralist *start, const char *key, int allow_init_epsg) {
- paralist *defaults, *last = nullptr;
- char keystring[ID_TAG_MAX + 20];
- paralist *next, *proj;
- int err;
-
- if (nullptr==start)
- return nullptr;
-
- if (strlen(key) > ID_TAG_MAX)
- return nullptr;
-
- /* Set defaults, unless inhibited (either explicitly through a "no_defs" token */
- /* or implicitly, because we are initializing a pipeline) */
- if (pj_param_exists (start, "no_defs"))
- return start;
- proj = pj_param_exists (start, "proj");
- if (nullptr==proj)
- return start;
- if (strlen (proj->param) < 6)
- return start;
- if (0==strcmp ("pipeline", proj->param + 5))
- return start;
-
- err = pj_ctx_get_errno (ctx);
- pj_ctx_set_errno (ctx, 0);
-
- /* Locate end of start-list */
- for (last = start; last->next; last = last->next);
-
- strcpy (keystring, "proj_def.dat:");
- strcat (keystring, key);
- defaults = get_init (ctx, keystring, allow_init_epsg);
-
- /* Defaults are optional - so we don't care if we cannot open the file */
- pj_ctx_set_errno (ctx, err);
-
- if (!defaults)
- return last;
-
- /* Loop over all default items */
- for (next = defaults; next; next = next->next) {
-
- /* Don't override existing parameter value of same name */
- if (pj_param_exists (start, next->param))
- continue;
-
- /* Don't default ellipse if datum, ellps or any ellipsoid information is set */
- if (0==strncmp(next->param,"ellps=", 6)) {
- if (pj_param_exists (start, "datum")) continue;
- if (pj_param_exists (start, "ellps")) continue;
- if (pj_param_exists (start, "a")) continue;
- if (pj_param_exists (start, "b")) continue;
- if (pj_param_exists (start, "rf")) continue;
- if (pj_param_exists (start, "f")) continue;
- if (pj_param_exists (start, "e")) continue;
- if (pj_param_exists (start, "es")) continue;
- }
-
- /* If we're here, it's OK to append the current default item */
- last = last->next = pj_mkparam(next->param);
- }
- last->next = nullptr;
-
- pj_dealloc_params (ctx, defaults, 0);
- return last;
-}
-
/*****************************************************************************/
static paralist *pj_expand_init_internal(PJ_CONTEXT *ctx, paralist *init, int allow_init_epsg) {
/******************************************************************************
@@ -664,12 +594,6 @@ pj_init_ctx_with_allow_init_epsg(projCtx ctx, int argc, char **argv, int allow_i
return nullptr;
}
-
- /* Append general and projection specific defaults to the definition list */
- append_defaults_to_paralist (ctx, start, "general", allow_init_epsg);
- append_defaults_to_paralist (ctx, start, name, allow_init_epsg);
-
-
/* Allocate projection structure */
PIN = proj(nullptr);
if (nullptr==PIN) {
diff --git a/src/projections/lagrng.cpp b/src/projections/lagrng.cpp
index 8c0150aa..a119ea31 100644
--- a/src/projections/lagrng.cpp
+++ b/src/projections/lagrng.cpp
@@ -76,7 +76,10 @@ PJ *PROJECTION(lagrng) {
return pj_default_destructor (P, ENOMEM);
P->opaque = Q;
- Q->w = pj_param(P->ctx, P->params, "dW").f;
+ if( pj_param(P->ctx, P->params, "tW").i )
+ Q->w = pj_param(P->ctx, P->params, "dW").f;
+ else
+ Q->w = 2;
if (Q->w <= 0)
return pj_default_destructor(P, PJD_ERR_W_OR_M_ZERO_OR_LESS);
Q->hw = 0.5 * Q->w;
diff --git a/src/tests/multistresstest.cpp b/src/tests/multistresstest.cpp
index 234783b3..33d2d738 100644
--- a/src/tests/multistresstest.cpp
+++ b/src/tests/multistresstest.cpp
@@ -46,7 +46,6 @@
#define num_threads 10
static int num_iterations = 1000000;
static int reinit_every_iteration=0;
-static int add_no_defs = 0;
typedef struct {
const char *src_def;
@@ -179,15 +178,7 @@ static volatile int active_thread_count = 0;
static projPJ custom_pj_init_plus_ctx(projCtx ctx, const char* def)
{
- if( add_no_defs )
- {
- char szBuffer[256];
- strcpy(szBuffer, def);
- strcat(szBuffer, " +no_defs");
- return pj_init_plus_ctx(ctx, szBuffer);
- }
- else
- return pj_init_plus_ctx(ctx, def);
+ return pj_init_plus_ctx(ctx, def);
}
/************************************************************************/
@@ -462,8 +453,6 @@ int main( int argc, char **argv )
{
if( strcmp(argv[i], "-reinit") == 0 )
reinit_every_iteration = 1;
- else if( strcmp(argv[i], "-add_no_defs") == 0 )
- add_no_defs = 1;
else if( strcmp(argv[i], "-num_iterations") == 0 && i+1 < argc )
{
num_iterations = atoi(argv[i+1]);
diff --git a/src/tests/test228.cpp b/src/tests/test228.cpp
index fcacd7c9..4fadda94 100644
--- a/src/tests/test228.cpp
+++ b/src/tests/test228.cpp
@@ -36,10 +36,9 @@ static void* thread_main(void* unused)
p_proj_ctxt=pj_ctx_alloc();
p_WGS84_proj=pj_init_plus_ctx(p_proj_ctxt,"+proj=longlat "
- "+ellps=WGS84 +datum=WGS84 +no_defs");
+ "+ellps=WGS84 +datum=WGS84");
p_OSGB36_proj=pj_init_plus_ctx(p_proj_ctxt,
- "+proj=longlat +ellps=airy +datum=OSGB36 +nadgrids=OSTN02_NTv2.gsb "
- "+no_defs");
+ "+proj=longlat +ellps=airy +datum=OSGB36 +nadgrids=OSTN02_NTv2.gsb");
while(run)
{
diff --git a/src/transformations/deformation.cpp b/src/transformations/deformation.cpp
index 6c30f21c..0197cf5c 100644
--- a/src/transformations/deformation.cpp
+++ b/src/transformations/deformation.cpp
@@ -269,7 +269,8 @@ PJ *TRANSFORMATION(deformation,1) {
return destructor(P, ENOMEM);
P->opaque = (void *) Q;
- Q->cart = proj_create(P->ctx, "+proj=cart");
+ // Pass a dummy ellipsoid definition that will be overridden just afterwards
+ Q->cart = proj_create(P->ctx, "+proj=cart +a=1");
if (Q->cart == nullptr)
return destructor(P, ENOMEM);