aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEven Rouault <even.rouault@spatialys.com>2019-02-20 12:57:26 +0100
committerEven Rouault <even.rouault@spatialys.com>2019-02-20 12:57:26 +0100
commit545936e04bda914a9caf8c1e4e0eefb4c5c80397 (patch)
tree50a55231e88674ac30ed73bb3d856d066548ccf0 /src
parent70bc293a43def169fa34ed8e97a5cb06b336f247 (diff)
downloadPROJ-545936e04bda914a9caf8c1e4e0eefb4c5c80397.tar.gz
PROJ-545936e04bda914a9caf8c1e4e0eefb4c5c80397.zip
Operation sorting: tweak
Diffstat (limited to 'src')
-rw-r--r--src/iso19111/coordinateoperation.cpp28
1 files changed, 12 insertions, 16 deletions
diff --git a/src/iso19111/coordinateoperation.cpp b/src/iso19111/coordinateoperation.cpp
index d3446460..d66afd0d 100644
--- a/src/iso19111/coordinateoperation.cpp
+++ b/src/iso19111/coordinateoperation.cpp
@@ -9821,6 +9821,17 @@ struct SortFunction {
return false;
}
+ if (accuracyA < 0 && accuracyB < 0) {
+ // unknown accuracy ? then prefer operations with grids, which
+ // are likely to have best practical accuracy
+ if (iterA->second.hasGrids_ && !iterB->second.hasGrids_) {
+ return true;
+ }
+ if (!iterA->second.hasGrids_ && iterB->second.hasGrids_) {
+ return false;
+ }
+ }
+
// Operations with larger non-zero area of use go before those with
// lower one
const double areaA = iterA->second.area_;
@@ -9852,15 +9863,6 @@ struct SortFunction {
if (iterA->second.hasGrids_ && !iterB->second.hasGrids_) {
return false;
}
- } else if (accuracyA < 0 && accuracyB < 0) {
- // unknown accuracy ? then prefer operations with grids, which
- // are likely to have best practical accuracy
- if (iterA->second.hasGrids_ && !iterB->second.hasGrids_) {
- return true;
- }
- if (!iterA->second.hasGrids_ && iterB->second.hasGrids_) {
- return false;
- }
}
// The less intermediate steps, the better
@@ -10136,13 +10138,7 @@ struct FilterResults {
bool hasGrids = false;
bool gridsAvailable = true;
bool gridsKnown = true;
- if (context->getAuthorityFactory() &&
- (gridAvailabilityUse ==
- CoordinateOperationContext::GridAvailabilityUse::
- USE_FOR_SORTING ||
- gridAvailabilityUse ==
- CoordinateOperationContext::GridAvailabilityUse::
- IGNORE_GRID_AVAILABILITY)) {
+ if (context->getAuthorityFactory()) {
const auto gridsNeeded = op->gridsNeeded(
context->getAuthorityFactory()->databaseContext());
for (const auto &gridDesc : gridsNeeded) {