aboutsummaryrefslogtreecommitdiff
path: root/src/iso19111/factory.cpp
diff options
context:
space:
mode:
authorEven Rouault <even.rouault@spatialys.com>2019-10-27 20:59:29 +0100
committerGitHub <noreply@github.com>2019-10-27 20:59:29 +0100
commite2d5b13f3442a8e88093a9d68e1be550194a4d77 (patch)
tree31789cfd11ea72eb9e5fc07eb2b2ac0839cfd5fd /src/iso19111/factory.cpp
parente7dff6e3a9895af20b3d02337299d5f05c2ea4bc (diff)
parent46c6ddf84defeb4ae855285da4416dff7178cacc (diff)
downloadPROJ-e2d5b13f3442a8e88093a9d68e1be550194a4d77.tar.gz
PROJ-e2d5b13f3442a8e88093a9d68e1be550194a4d77.zip
Merge pull request #1696 from rouault/modify_concatenated_operation_structure
Database: add an auxiliary concatenated_operation_step table to allow arbitrary number of steps (fixes #1632)
Diffstat (limited to 'src/iso19111/factory.cpp')
-rw-r--r--src/iso19111/factory.cpp35
1 files changed, 13 insertions, 22 deletions
diff --git a/src/iso19111/factory.cpp b/src/iso19111/factory.cpp
index 9be04580..6fef6366 100644
--- a/src/iso19111/factory.cpp
+++ b/src/iso19111/factory.cpp
@@ -3141,8 +3141,7 @@ operation::CoordinateOperationNNPtr AuthorityFactory::createCoordinateOperation(
"source_crs_auth_name, source_crs_code, "
"target_crs_auth_name, target_crs_code, "
"area_of_use_auth_name, area_of_use_code, accuracy, "
- "step1_auth_name, step1_code, step2_auth_name, step2_code, "
- "step3_auth_name, step3_code, operation_version, deprecated FROM "
+ "operation_version, deprecated FROM "
"concatenated_operation WHERE auth_name = ? AND code = ?",
code);
if (res.empty()) {
@@ -3150,6 +3149,13 @@ operation::CoordinateOperationNNPtr AuthorityFactory::createCoordinateOperation(
throw NoSuchAuthorityCodeException(
"concatenated_operation not found", d->authority(), code);
}
+
+ auto resSteps = d->runWithCodeParam(
+ "SELECT step_auth_name, step_code FROM "
+ "concatenated_operation_step WHERE operation_auth_name = ? "
+ "AND operation_code = ? ORDER BY step_number",
+ code);
+
try {
const auto &row = res.front();
size_t idx = 0;
@@ -3163,32 +3169,17 @@ operation::CoordinateOperationNNPtr AuthorityFactory::createCoordinateOperation(
const auto &area_of_use_auth_name = row[idx++];
const auto &area_of_use_code = row[idx++];
const auto &accuracy = row[idx++];
- const auto &step1_auth_name = row[idx++];
- const auto &step1_code = row[idx++];
- const auto &step2_auth_name = row[idx++];
- const auto &step2_code = row[idx++];
- const auto &step3_auth_name = row[idx++];
- const auto &step3_code = row[idx++];
const auto &operation_version = row[idx++];
const auto &deprecated_str = row[idx++];
const bool deprecated = deprecated_str == "1";
std::vector<operation::CoordinateOperationNNPtr> operations;
- operations.push_back(
- d->createFactory(step1_auth_name)
- ->createCoordinateOperation(step1_code, false,
- usePROJAlternativeGridNames,
- std::string()));
- operations.push_back(
- d->createFactory(step2_auth_name)
- ->createCoordinateOperation(step2_code, false,
- usePROJAlternativeGridNames,
- std::string()));
-
- if (!step3_auth_name.empty()) {
+ for (const auto &rowStep : resSteps) {
+ const auto &step_auth_name = rowStep[0];
+ const auto &step_code = rowStep[1];
operations.push_back(
- d->createFactory(step3_auth_name)
- ->createCoordinateOperation(step3_code, false,
+ d->createFactory(step_auth_name)
+ ->createCoordinateOperation(step_code, false,
usePROJAlternativeGridNames,
std::string()));
}