diff options
| author | Kristian Evers <kristianevers@gmail.com> | 2019-03-28 20:52:33 +0100 |
|---|---|---|
| committer | Kristian Evers <kristianevers@gmail.com> | 2019-03-28 21:59:22 +0100 |
| commit | 3d670b859026218045cf972e4b38af9e3e9a3c6f (patch) | |
| tree | 7c5c455d43ed3b5ac1207a22a6a9531decd43139 | |
| parent | 4754220ec8e3febd3d96e8096df8291c7a78fdb1 (diff) | |
| download | PROJ-3d670b859026218045cf972e4b38af9e3e9a3c6f.tar.gz PROJ-3d670b859026218045cf972e4b38af9e3e9a3c6f.zip | |
Add no-op operation. It does nothing.
| -rw-r--r-- | docs/source/operations/conversions/index.rst | 1 | ||||
| -rw-r--r-- | docs/source/operations/conversions/noop.rst | 28 | ||||
| -rw-r--r-- | src/Makefile.am | 1 | ||||
| -rw-r--r-- | src/conversions/noop.cpp | 19 | ||||
| -rw-r--r-- | src/lib_proj.cmake | 1 | ||||
| -rw-r--r-- | src/pj_list.h | 1 | ||||
| -rw-r--r-- | test/gie/more_builtins.gie | 17 |
7 files changed, 68 insertions, 0 deletions
diff --git a/docs/source/operations/conversions/index.rst b/docs/source/operations/conversions/index.rst index a9d137ab..42ad079d 100644 --- a/docs/source/operations/conversions/index.rst +++ b/docs/source/operations/conversions/index.rst @@ -15,6 +15,7 @@ conversions. cart geoc latlon + noop pop push unitconvert diff --git a/docs/source/operations/conversions/noop.rst b/docs/source/operations/conversions/noop.rst new file mode 100644 index 00000000..a35b2b58 --- /dev/null +++ b/docs/source/operations/conversions/noop.rst @@ -0,0 +1,28 @@ +.. _noop: + +================================================================================ +No operation +================================================================================ + +.. versionadded:: 6.1.0 + +Pass a coordinate through unchanged. + ++---------------------+--------------------------------------------------------+ +| **Alias** | noop | ++---------------------+--------------------------------------------------------+ +| **Domain** | 4D | ++---------------------+--------------------------------------------------------+ +| **Input type** | Any | ++---------------------+--------------------------------------------------------+ +| **Output type** | Any | ++---------------------+--------------------------------------------------------+ + +The no operation is a dummy operation that returns whatever is passed to it +as seen in this example:: + + $ echo 12 34 56 78 | cct +proj=noop + 12.0000 34.0000 56.0000 78.0000 + +The operation has no options and default options will not affect the output. + diff --git a/src/Makefile.am b/src/Makefile.am index b62a11b0..9858d78f 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -173,6 +173,7 @@ libproj_la_SOURCES = \ conversions/cart.cpp \ conversions/geoc.cpp \ conversions/geocent.cpp \ + conversions/noop.cpp \ conversions/unitconvert.cpp \ \ transformations/affine.cpp \ diff --git a/src/conversions/noop.cpp b/src/conversions/noop.cpp new file mode 100644 index 00000000..a5dd6023 --- /dev/null +++ b/src/conversions/noop.cpp @@ -0,0 +1,19 @@ +#define PJ_LIB__ + +#include "proj_internal.h" + +PROJ_HEAD(noop, "No operation"); + +static PJ_COORD noop(PJ_COORD coord, PJ *P) { + (void) P; + return coord; +} + +PJ *CONVERSION(noop, 0) { + P->fwd4d = noop; + P->inv4d = noop; + P->left = PJ_IO_UNITS_WHATEVER; + P->right = PJ_IO_UNITS_WHATEVER; + return P; +} + diff --git a/src/lib_proj.cmake b/src/lib_proj.cmake index 72a8cc59..38bc05d8 100644 --- a/src/lib_proj.cmake +++ b/src/lib_proj.cmake @@ -174,6 +174,7 @@ set(SRC_LIBPROJ_CONVERSIONS conversions/cart.cpp conversions/geoc.cpp conversions/geocent.cpp + conversions/noop.cpp conversions/unitconvert.cpp ) diff --git a/src/pj_list.h b/src/pj_list.h index 8ab4cdc0..0923bba8 100644 --- a/src/pj_list.h +++ b/src/pj_list.h @@ -106,6 +106,7 @@ PROJ_HEAD(nell_h, "Nell-Hammer") PROJ_HEAD(nicol, "Nicolosi Globular") PROJ_HEAD(nsper, "Near-sided perspective") PROJ_HEAD(nzmg, "New Zealand Map Grid") +PROJ_HEAD(noop, "No operation") PROJ_HEAD(ob_tran, "General Oblique Transformation") PROJ_HEAD(ocea, "Oblique Cylindrical Equal Area") PROJ_HEAD(oea, "Oblated Equal Area") diff --git a/test/gie/more_builtins.gie b/test/gie/more_builtins.gie index e16443d4..f6b52ea3 100644 --- a/test/gie/more_builtins.gie +++ b/test/gie/more_builtins.gie @@ -756,4 +756,21 @@ expect 359 10 0 ------------------------------------------------------------------------------- +------------------------------------------------------------------------------- +# No-op +------------------------------------------------------------------------------- +operation +proj=noop +direction forward +accept 25 25 +expect 25 25 + +accept 25 25 25 +expect 25 25 25 + +accept 25 25 25 25 +expect 25 25 25 25 +------------------------------------------------------------------------------- + + + </gie> |
