Skip to content

Commit

Permalink
Free format everywhere (#693)
Browse files Browse the repository at this point in the history
* Free format now in cmd lines, in gie, and in init files

* Corrected handling of defaults

* Add demo of integrated definition and validation

* Repair stack-smashing memmove in get_init

* repair paralist corruption, clean up debug output

* Install test files for nmake builds

* Add many improvements following suggestions by @schwehr

* Be consistent in requiring lower case everywhere in gie.c

Also, this Fixes #703 and Fixes #697
  • Loading branch information
busstoptaktik committed Dec 17, 2017
1 parent 5332070 commit 74ae4b0
Show file tree
Hide file tree
Showing 24 changed files with 1,566 additions and 877 deletions.
4 changes: 3 additions & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,13 @@ test_script:
- cd bin
- echo "Contents of current directory:"
- dir
- echo "Contents of ..\test\gie:"
- dir ..\test\gie
- gie.exe ..\test\gie\builtins.gie
- gie.exe ..\test\gie\more_builtins.gie
- gie.exe ..\test\gie\deformation.gie
- gie.exe ..\test\gie\axisswap.gie
- gie.exe ..\test\gie\ellipsoid.gie
- gie.exe -vvvvv ..\test\gie\more_builtins.gie
- gie.exe ..\test\gie\GDA.gie

deploy: off
Expand Down
83 changes: 83 additions & 0 deletions nad/val_def.demo
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@

-----------------------------------------------------------------------

INTEGRATING DEFINITION AND VALIDATION OF GEODETIC SYSTEMS

-----------------------------------------------------------------------
Thomas Knudsen, thokn@sdfe.dk, 2017-12-06
-----------------------------------------------------------------------

This demo shows how to use the free format definition strings,
introduced in PROJ version 5.0.0, to integrate system definition
information with system validation data.

The system definition parts are used when doing actual transformations,
e.g. using the cct 4D transformation program:

echo 9 55 0 0 | cct +init=val_def.demo:DKTM1

The system validation parts are used when validating the systems
defined in the file. This is done using the gie test program:

gie val_def.demo

Which will respond with a report detailing how many tests succeeded,
resp. failed.

The syntax of proj init files is orthogonal to the syntax of gie
integrity evaluation files. This makes it possible to interleave
init and gie blocks in the same file.

#-----------------------------------------------------------------------



#-----------------------------------------------------------------------
# Danish Transverse Mercator, zone 1
#-----------------------------------------------------------------------
<DKTM1> proj = etmerc
lat_0 = 0 lon_0 = 9
x_0 = 200000 y_0 = -5000000

k = 0.99998

ellps = GRS80
units = m

no_defs
#-----------------------------------------------------------------------
<gie>
operation init = val_def.demo:DKTM1
tolerance 100 um
accept 9 55
expect 200000.0000 1097108.3684
roundtrip 1000 1 nm
</gie>
#-----------------------------------------------------------------------



#-----------------------------------------------------------------------
# Danish Transverse Mercator, zone 2
#-----------------------------------------------------------------------
<DKTM2> proj = etmerc
lat_0 = 0 lon_0 = 10
x_0 = 400000 y_0 = -5000000

k = 0.99998

ellps = GRS80
units = m

no_defs
#-----------------------------------------------------------------------
<gie>
operation init = val_def.demo:DKTM2
tolerance 100 um
accept 10 55
expect 400000.0000 1097108.3684
accept 10.5 55.5
expect 431597.1668 1152884.9398
roundtrip 1000 100 um
</gie>
#-----------------------------------------------------------------------
9 changes: 3 additions & 6 deletions src/PJ_pipeline.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,9 @@
pj_init code, implementing support for multilevel, embedded pipelines.
Syntactically, the pipeline system introduces the "+step" keyword (which
indicates the start of each transformation step), the "+omit_fwd" and
"+omit_inv" keywords (which indicate that a given transformation step
should be omitted when the pipeline is executed in forward, resp. inverse
direction), and reintroduces the +inv keyword (indicating that a given
transformation step should run in reverse, i.e. forward, when the pipeline
is executed in inverse direction, and vice versa).
indicates the start of each transformation step), and reintroduces the +inv
keyword (indicating that a given transformation step should run in reverse, i.e.
forward, when the pipeline is executed in inverse direction, and vice versa).
Hence, the first transformation example above, can be implemented as:
Expand Down
15 changes: 9 additions & 6 deletions src/cct.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,20 +71,23 @@ Thomas Knudsen, thokn@sdfe.dk, 2016-05-25/2017-10-26
***********************************************************************/

#include "optargpm.h"
#include "proj_internal.h"
#include <proj.h>
#include "projects.h"
#include <ctype.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#include <math.h>

#include <proj.h>
#include "proj_internal.h"
#include "projects.h"
#include "optargpm.h"


/* Prototypes for functions in proj_strtod.c */
double proj_strtod(const char *str, char **endptr);
double proj_atof(const char *str);

/* Prototypes from functions in this file */
char *column (char *buf, int n);
PJ_COORD parse_input_line (char *buf, int *columns, double fixed_height, double fixed_time);

Expand Down

0 comments on commit 74ae4b0

Please sign in to comment.