aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEven Rouault <even.rouault@spatialys.com>2019-11-18 19:47:05 +0100
committerEven Rouault <even.rouault@spatialys.com>2019-11-18 19:47:05 +0100
commitee71b3412868a08c91d46066ddc39d30b08442d6 (patch)
tree5769b17fe802d8aee80e153463a55a4496799afe /src
parent70aae0fe4262686d61289c3b710a4877c43e6c13 (diff)
downloadPROJ-ee71b3412868a08c91d46066ddc39d30b08442d6.tar.gz
PROJ-ee71b3412868a08c91d46066ddc39d30b08442d6.zip
createOperations(): small perf improvement. Do not attempt going through an intermediate CRS if we found direct transformation(s) but had to eliminate them due to other criteria
Diffstat (limited to 'src')
-rw-r--r--src/iso19111/coordinateoperation.cpp23
1 files changed, 14 insertions, 9 deletions
diff --git a/src/iso19111/coordinateoperation.cpp b/src/iso19111/coordinateoperation.cpp
index 8ac94a8e..92bfa2ba 100644
--- a/src/iso19111/coordinateoperation.cpp
+++ b/src/iso19111/coordinateoperation.cpp
@@ -10455,10 +10455,9 @@ struct CoordinateOperationFactory::Private {
buildCRSIds(const crs::CRSNNPtr &crs, Private::Context &context,
std::list<std::pair<std::string, std::string>> &ids);
- static std::vector<CoordinateOperationNNPtr>
- findOpsInRegistryDirect(const crs::CRSNNPtr &sourceCRS,
- const crs::CRSNNPtr &targetCRS,
- Private::Context &context);
+ static std::vector<CoordinateOperationNNPtr> findOpsInRegistryDirect(
+ const crs::CRSNNPtr &sourceCRS, const crs::CRSNNPtr &targetCRS,
+ Private::Context &context, bool &resNonEmptyBeforeFiltering);
static std::vector<CoordinateOperationNNPtr>
findOpsInRegistryDirectTo(const crs::CRSNNPtr &targetCRS,
@@ -11444,7 +11443,7 @@ getCandidateAuthorities(const io::AuthorityFactoryPtr &authFactory,
std::vector<CoordinateOperationNNPtr>
CoordinateOperationFactory::Private::findOpsInRegistryDirect(
const crs::CRSNNPtr &sourceCRS, const crs::CRSNNPtr &targetCRS,
- Private::Context &context) {
+ Private::Context &context, bool &resNonEmptyBeforeFiltering) {
const auto &authFactory = context.context->getAuthorityFactory();
assert(authFactory);
@@ -11453,6 +11452,7 @@ CoordinateOperationFactory::Private::findOpsInRegistryDirect(
" --> " + objectAsStr(targetCRS.get()) + ")");
#endif
+ resNonEmptyBeforeFiltering = false;
std::list<std::pair<std::string, std::string>> sourceIds;
std::list<std::pair<std::string, std::string>> targetIds;
buildCRSIds(sourceCRS, context, sourceIds);
@@ -11481,6 +11481,7 @@ CoordinateOperationFactory::Private::findOpsInRegistryDirect(
context.context->getDiscardSuperseded(), true, false,
context.extent1, context.extent2);
if (!res.empty()) {
+ resNonEmptyBeforeFiltering = true;
auto resFiltered =
FilterResults(res, context.context, context.extent1,
context.extent2, false)
@@ -12725,7 +12726,9 @@ bool CoordinateOperationFactory::Private::createOperationsFromDatabase(
return true;
}
- res = findOpsInRegistryDirect(sourceCRS, targetCRS, context);
+ bool resFindDirectNonEmptyBeforeFiltering = false;
+ res = findOpsInRegistryDirect(sourceCRS, targetCRS, context,
+ resFindDirectNonEmptyBeforeFiltering);
// If we get at least a result with perfect accuracy, do not
// bother generating synthetic transforms.
@@ -12771,7 +12774,7 @@ bool CoordinateOperationFactory::Private::createOperationsFromDatabase(
// NAD27 to NAD83 has tens of results already. No need to look
// for a pivot
if (!sameGeodeticDatum &&
- ((res.empty() &&
+ ((res.empty() && !resFindDirectNonEmptyBeforeFiltering &&
context.context->getAllowUseIntermediateCRS() ==
CoordinateOperationContext::IntermediateCRSUse::
IF_NO_DIRECT_TRANSFORMATION) ||
@@ -13086,8 +13089,10 @@ void CoordinateOperationFactory::Private::
candidate);
if (geogCandidate &&
geogCandidate->coordinateSystem()->axisList().size() == 2) {
- res = findOpsInRegistryDirect(NN_NO_CHECK(geogCandidate),
- targetCRSIn, context);
+ bool ignored;
+ res =
+ findOpsInRegistryDirect(NN_NO_CHECK(geogCandidate),
+ targetCRSIn, context, ignored);
break;
}
}