aboutsummaryrefslogtreecommitdiff
path: root/src/iso19111/io.cpp
diff options
context:
space:
mode:
authorEven Rouault <even.rouault@spatialys.com>2019-03-25 13:56:43 +0100
committerEven Rouault <even.rouault@spatialys.com>2019-03-25 13:56:43 +0100
commit09db4826d4a1e5df900cb4b93a4b3eae2c487cb9 (patch)
treeee4ba388d7d9507397b5cbad5814cb7e1ee540c0 /src/iso19111/io.cpp
parent46f08f1434f66a4160d7c74923efcfb81505b398 (diff)
downloadPROJ-09db4826d4a1e5df900cb4b93a4b3eae2c487cb9.tar.gz
PROJ-09db4826d4a1e5df900cb4b93a4b3eae2c487cb9.zip
WKT2_2018: always export ID of SOURCECRS/TARGETCRS and STEPs
even if there is one on upper node This is a particular logic allowed by paragraph 7.3.3 Identifier of OGC 18-010r6
Diffstat (limited to 'src/iso19111/io.cpp')
-rw-r--r--src/iso19111/io.cpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/iso19111/io.cpp b/src/iso19111/io.cpp
index 78b18719..578234b4 100644
--- a/src/iso19111/io.cpp
+++ b/src/iso19111/io.cpp
@@ -141,6 +141,7 @@ struct WKTFormatter::Private {
std::vector<bool> stackHasChild_{};
std::vector<bool> stackHasId_{false};
std::vector<bool> stackEmptyKeyword_{};
+ std::vector<bool> stackDisableUsage_{};
std::vector<bool> outputUnitStack_{true};
std::vector<bool> outputIdStack_{true};
std::vector<UnitOfMeasureNNPtr> axisLinearUnitStack_{
@@ -272,6 +273,11 @@ const std::string &WKTFormatter::toString() const {
if (d->outputUnitStack_.size() != 1)
throw FormattingException(
"Unbalanced pushOutputUnit() / popOutputUnit()");
+ if (d->stackHasId_.size() != 1)
+ throw FormattingException("Unbalanced pushHasId() / popHasId()");
+ if (!d->stackDisableUsage_.empty())
+ throw FormattingException(
+ "Unbalanced pushDisableUsage() / popDisableUsage()");
return d->result_;
}
@@ -556,6 +562,28 @@ bool WKTFormatter::outputId() const {
// ---------------------------------------------------------------------------
+void WKTFormatter::pushHasId(bool hasId) { d->stackHasId_.push_back(hasId); }
+
+// ---------------------------------------------------------------------------
+
+void WKTFormatter::popHasId() { d->stackHasId_.pop_back(); }
+
+// ---------------------------------------------------------------------------
+
+void WKTFormatter::pushDisableUsage() { d->stackDisableUsage_.push_back(true); }
+
+// ---------------------------------------------------------------------------
+
+void WKTFormatter::popDisableUsage() { d->stackDisableUsage_.pop_back(); }
+
+// ---------------------------------------------------------------------------
+
+bool WKTFormatter::outputUsage() const {
+ return outputId() && d->stackDisableUsage_.empty();
+}
+
+// ---------------------------------------------------------------------------
+
void WKTFormatter::pushAxisLinearUnit(const UnitOfMeasureNNPtr &unit) {
d->axisLinearUnitStack_.push_back(unit);
}