aboutsummaryrefslogtreecommitdiff
path: root/src/iso19111/coordinateoperation.cpp
diff options
context:
space:
mode:
authorKristian Evers <kristianevers@gmail.com>2019-02-18 09:45:47 +0100
committerKristian Evers <kristianevers@gmail.com>2019-02-18 09:45:47 +0100
commitf61aa8a01961cff194fcf49c66e4ca9b4bd68052 (patch)
tree189e5bc87ac99a73f515b3800c2e1898c732f7b3 /src/iso19111/coordinateoperation.cpp
parent24ce8716974020600aa22fe7334628a29f578774 (diff)
parent4277e15cefae5bb1d49312498e0f626b652e7524 (diff)
downloadPROJ-f61aa8a01961cff194fcf49c66e4ca9b4bd68052.tar.gz
PROJ-f61aa8a01961cff194fcf49c66e4ca9b4bd68052.zip
Merge remote-tracking branch 'osgeo/master' into 6.0
Diffstat (limited to 'src/iso19111/coordinateoperation.cpp')
-rw-r--r--src/iso19111/coordinateoperation.cpp36
1 files changed, 20 insertions, 16 deletions
diff --git a/src/iso19111/coordinateoperation.cpp b/src/iso19111/coordinateoperation.cpp
index d964cdc1..2128124b 100644
--- a/src/iso19111/coordinateoperation.cpp
+++ b/src/iso19111/coordinateoperation.cpp
@@ -9242,7 +9242,8 @@ struct CoordinateOperationContext::Private {
bool usePROJNames_ = true;
GridAvailabilityUse gridAvailabilityUse_ =
GridAvailabilityUse::USE_FOR_SORTING;
- bool allowUseIntermediateCRS_ = true;
+ IntermediateCRSUse allowUseIntermediateCRS_ = CoordinateOperationContext::
+ IntermediateCRSUse::IF_NO_DIRECT_TRANSFORMATION;
std::vector<std::pair<std::string, std::string>>
intermediateCRSAuthCodes_{};
bool discardSuperseded_ = true;
@@ -9436,18 +9437,17 @@ CoordinateOperationContext::getGridAvailabilityUse() const {
*
* Concretely if in the database there is an operation from A to C
* (or C to A), and another one from C to B (or B to C), but no direct
- * operation between A and B, setting this parameter to true, allow
- * chaining both operations.
+ * operation between A and B, setting this parameter to
+ * ALWAYS/IF_NO_DIRECT_TRANSFORMATION, allow chaining both operations.
*
* The current implementation is limited to researching one intermediate
* step.
*
- * By default, all potential C candidates will be used. setIntermediateCRS()
- * can be used to restrict them.
- *
- * The default is true.
+ * By default, with the IF_NO_DIRECT_TRANSFORMATION stratgey, all potential
+ * C candidates will be used if there is no direct tranformation.
*/
-void CoordinateOperationContext::setAllowUseIntermediateCRS(bool use) {
+void CoordinateOperationContext::setAllowUseIntermediateCRS(
+ IntermediateCRSUse use) {
d->allowUseIntermediateCRS_ = use;
}
@@ -9458,12 +9458,13 @@ void CoordinateOperationContext::setAllowUseIntermediateCRS(bool use) {
*
* Concretely if in the database there is an operation from A to C
* (or C to A), and another one from C to B (or B to C), but no direct
- * operation between A and B, setting this parameter to true, allow
- * chaining both operations.
+ * operation between A and B, setting this parameter to
+ * ALWAYS/IF_NO_DIRECT_TRANSFORMATION, allow chaining both operations.
*
- * The default is true.
+ * The default is IF_NO_DIRECT_TRANSFORMATION.
*/
-bool CoordinateOperationContext::getAllowUseIntermediateCRS() const {
+CoordinateOperationContext::IntermediateCRSUse
+CoordinateOperationContext::getAllowUseIntermediateCRS() const {
return d->allowUseIntermediateCRS_;
}
@@ -10401,9 +10402,6 @@ findOpsInRegistryDirect(const crs::CRSNNPtr &sourceCRS,
static std::vector<CoordinateOperationNNPtr> findsOpsInRegistryWithIntermediate(
const crs::CRSNNPtr &sourceCRS, const crs::CRSNNPtr &targetCRS,
const CoordinateOperationContextNNPtr &context) {
- if (!context->getAllowUseIntermediateCRS()) {
- return std::vector<CoordinateOperationNNPtr>();
- }
const auto &authFactory = context->getAuthorityFactory();
assert(authFactory);
@@ -11215,7 +11213,13 @@ CoordinateOperationFactory::Private::createOperations(
// NAD27 to NAD83 has tens of results already. No need to look
// for a pivot
- if (res.size() < 5 || getenv("PROJ_FORCE_SEARCH_PIVOT")) {
+ if ((res.empty() &&
+ context.context->getAllowUseIntermediateCRS() ==
+ CoordinateOperationContext::IntermediateCRSUse::
+ IF_NO_DIRECT_TRANSFORMATION) ||
+ context.context->getAllowUseIntermediateCRS() ==
+ CoordinateOperationContext::IntermediateCRSUse::ALWAYS ||
+ getenv("PROJ_FORCE_SEARCH_PIVOT")) {
auto resWithIntermediate = findsOpsInRegistryWithIntermediate(
sourceCRS, targetCRS, context.context);
res.insert(res.end(), resWithIntermediate.begin(),