aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorEven Rouault <even.rouault@spatialys.com>2019-11-26 14:11:50 +0100
committerGitHub <noreply@github.com>2019-11-26 14:11:50 +0100
commitaeaf21ecae5296adf81ed2cab72ec07b919abf87 (patch)
tree45eff36135b1045a5b8ccbbc68bce42437e373fe /test
parentf764bd8a970ce6d40da3203d4d0af6c8d5d2f762 (diff)
parent49c15bc4a08c1b302bfbd509b2588dd80142de31 (diff)
downloadPROJ-aeaf21ecae5296adf81ed2cab72ec07b919abf87.tar.gz
PROJ-aeaf21ecae5296adf81ed2cab72ec07b919abf87.zip
Merge pull request #1748 from rouault/improve_hgrid_vgrid_hgrid_inv_take2
Optimize pipelines involving horizontal shift grid, vertical shift grid, inverse horizontal shift grid (take 2)
Diffstat (limited to 'test')
-rw-r--r--test/gie/4D-API_cs2cs-style.gie49
-rw-r--r--test/unit/test_io.cpp89
2 files changed, 138 insertions, 0 deletions
diff --git a/test/gie/4D-API_cs2cs-style.gie b/test/gie/4D-API_cs2cs-style.gie
index 19b3ad96..e5722b5e 100644
--- a/test/gie/4D-API_cs2cs-style.gie
+++ b/test/gie/4D-API_cs2cs-style.gie
@@ -386,6 +386,55 @@ operation +proj=pop +v_3
accept 12 56 0 0
expect 12 56 0 0
+-------------------------------------------------------------------------------
+Test Pipeline +omit_inv
+-------------------------------------------------------------------------------
+
+operation +proj=pipeline
+ +step +proj=affine +xoff=1 +yoff=1 +omit_inv
+
+accept 2 49 0 0
+expect 3 50 0 0
+
+direction inverse
+accept 2 49 0 0
+expect 2 49 0 0
+
+
+operation +proj=pipeline
+ +step +inv +proj=affine +xoff=1 +yoff=1 +omit_inv
+
+accept 2 49 0 0
+expect 1 48 0 0
+
+direction inverse
+accept 2 49 0 0
+expect 2 49 0 0
+
+-------------------------------------------------------------------------------
+Test Pipeline +omit_fwd
+-------------------------------------------------------------------------------
+
+operation +proj=pipeline
+ +step +proj=affine +xoff=1 +yoff=1 +omit_fwd
+
+accept 2 49 0 0
+expect 2 49 0 0
+
+direction inverse
+accept 2 49 0 0
+expect 1 48 0 0
+
+
+operation +proj=pipeline
+ +step +inv +proj=affine +xoff=1 +yoff=1 +omit_fwd
+
+accept 2 49 0 0
+expect 2 49 0 0
+
+direction inverse
+accept 2 49 0 0
+expect 3 50 0 0
-------------------------------------------------------------------------------
Test bugfix of https://github.com/OSGeo/proj.4/issues/1002
diff --git a/test/unit/test_io.cpp b/test/unit/test_io.cpp
index fff86d27..552eb5bf 100644
--- a/test/unit/test_io.cpp
+++ b/test/unit/test_io.cpp
@@ -6832,6 +6832,95 @@ TEST(io, projstringformatter_axisswap_unitconvert_axisswap) {
// ---------------------------------------------------------------------------
+TEST(io, projstringformatter_optim_hgridshift_vgridshift_hgridshift_inv) {
+ // Nominal case
+ {
+ auto fmt = PROJStringFormatter::create();
+ fmt->addStep("hgridshift");
+ fmt->addParam("grids", "foo");
+
+ fmt->addStep("vgridshift");
+ fmt->addParam("grids", "bar");
+
+ fmt->startInversion();
+ fmt->addStep("hgridshift");
+ fmt->addParam("grids", "foo");
+ fmt->stopInversion();
+
+ EXPECT_EQ(fmt->toString(),
+ "+proj=pipeline "
+ "+step +proj=push +v_1 +v_2 "
+ "+step +proj=hgridshift +grids=foo +omit_inv "
+ "+step +proj=vgridshift +grids=bar "
+ "+step +inv +proj=hgridshift +grids=foo +omit_fwd "
+ "+step +proj=pop +v_1 +v_2");
+ }
+
+ // Variant with first hgridshift inverted, and second forward
+ {
+ auto fmt = PROJStringFormatter::create();
+
+ fmt->startInversion();
+ fmt->addStep("hgridshift");
+ fmt->addParam("grids", "foo");
+ fmt->stopInversion();
+
+ fmt->addStep("vgridshift");
+ fmt->addParam("grids", "bar");
+
+ fmt->addStep("hgridshift");
+ fmt->addParam("grids", "foo");
+
+ EXPECT_EQ(fmt->toString(),
+ "+proj=pipeline "
+ "+step +proj=push +v_1 +v_2 "
+ "+step +inv +proj=hgridshift +grids=foo +omit_inv "
+ "+step +proj=vgridshift +grids=bar "
+ "+step +proj=hgridshift +grids=foo +omit_fwd "
+ "+step +proj=pop +v_1 +v_2");
+ }
+
+ // Do not apply ! not same grid name
+ {
+ auto fmt = PROJStringFormatter::create();
+ fmt->addStep("hgridshift");
+ fmt->addParam("grids", "foo");
+
+ fmt->addStep("vgridshift");
+ fmt->addParam("grids", "bar");
+
+ fmt->startInversion();
+ fmt->addStep("hgridshift");
+ fmt->addParam("grids", "foo2");
+ fmt->stopInversion();
+
+ EXPECT_EQ(fmt->toString(), "+proj=pipeline "
+ "+step +proj=hgridshift +grids=foo "
+ "+step +proj=vgridshift +grids=bar "
+ "+step +inv +proj=hgridshift +grids=foo2");
+ }
+
+ // Do not apply ! missing inversion
+ {
+ auto fmt = PROJStringFormatter::create();
+ fmt->addStep("hgridshift");
+ fmt->addParam("grids", "foo");
+
+ fmt->addStep("vgridshift");
+ fmt->addParam("grids", "bar");
+
+ fmt->addStep("hgridshift");
+ fmt->addParam("grids", "foo");
+
+ EXPECT_EQ(fmt->toString(), "+proj=pipeline "
+ "+step +proj=hgridshift +grids=foo "
+ "+step +proj=vgridshift +grids=bar "
+ "+step +proj=hgridshift +grids=foo");
+ }
+}
+
+// ---------------------------------------------------------------------------
+
TEST(io, projparse_longlat) {
auto expected = "GEODCRS[\"unknown\",\n"