aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEven Rouault <even.rouault@spatialys.com>2021-09-28 14:47:10 +0200
committerEven Rouault <even.rouault@spatialys.com>2021-09-28 14:47:10 +0200
commit40ab72f2e9d913c7128fde24576183068dcd7ee2 (patch)
treeecaabb15882203178135bbabe37bad860dcca772 /src
parente6e6e4ca345e774910afa5bbe485c3d9f7851cd4 (diff)
downloadPROJ-40ab72f2e9d913c7128fde24576183068dcd7ee2.tar.gz
PROJ-40ab72f2e9d913c7128fde24576183068dcd7ee2.zip
PROJStringFormatter: add optimizations useful for IAU CRS transformation pipelines
Diffstat (limited to 'src')
-rw-r--r--src/iso19111/io.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/iso19111/io.cpp b/src/iso19111/io.cpp
index 9e7f0580..1f193559 100644
--- a/src/iso19111/io.cpp
+++ b/src/iso19111/io.cpp
@@ -7868,6 +7868,32 @@ const std::string &PROJStringFormatter::toString() const {
continue;
}
+ // axisswap order=2,-1 followed by axisswap order=-2,1 is a no-op
+ if (curStep.name == "axisswap" && prevStep.name == "axisswap" &&
+ curStepParamCount == 1 && prevStepParamCount == 1 &&
+ !prevStep.inverted &&
+ prevStep.paramValues[0].equals("order", "2,-1") &&
+ !curStep.inverted &&
+ curStep.paramValues[0].equals("order", "-2,1")) {
+ deletePrevAndCurIter();
+ continue;
+ }
+
+ // axisswap order=2,-1 followed by axisswap order=1,-2 is
+ // equivalent to axisswap order=2,1
+ if (curStep.name == "axisswap" && prevStep.name == "axisswap" &&
+ curStepParamCount == 1 && prevStepParamCount == 1 &&
+ !prevStep.inverted &&
+ prevStep.paramValues[0].equals("order", "2,-1") &&
+ !curStep.inverted &&
+ curStep.paramValues[0].equals("order", "1,-2")) {
+ prevStep.inverted = false;
+ prevStep.paramValues[0] = Step::KeyValue("order", "2,1");
+ // Delete this iter
+ iterCur = steps.erase(iterCur);
+ continue;
+ }
+
// axisswap order=2,1 followed by axisswap order=2,-1 is
// equivalent to axisswap order=1,-2
// Same for axisswap order=-2,1 followed by axisswap order=2,1