aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/proj/crs.hpp5
-rw-r--r--scripts/reference_exported_symbols.txt2
-rw-r--r--src/iso19111/coordinateoperation.cpp4
-rw-r--r--src/iso19111/crs.cpp26
4 files changed, 16 insertions, 21 deletions
diff --git a/include/proj/crs.hpp b/include/proj/crs.hpp
index a028aceb..a71bf610 100644
--- a/include/proj/crs.hpp
+++ b/include/proj/crs.hpp
@@ -395,8 +395,9 @@ class PROJ_GCC_DLL GeographicCRS : public GeodeticCRS {
PROJ_INTERNAL void _exportToJSON(io::JSONFormatter *formatter)
const override; // throw(FormattingException)
- PROJ_DLL bool
- is2DPartOf3D(util::nn<const GeographicCRS *> other) PROJ_PURE_DECL;
+ PROJ_DLL bool is2DPartOf3D(
+ util::nn<const GeographicCRS *> other,
+ const io::DatabaseContextPtr &dbContext = nullptr) PROJ_PURE_DECL;
PROJ_INTERNAL bool _isEquivalentTo(
const util::IComparable *other,
diff --git a/scripts/reference_exported_symbols.txt b/scripts/reference_exported_symbols.txt
index 2ce13865..6cb20c08 100644
--- a/scripts/reference_exported_symbols.txt
+++ b/scripts/reference_exported_symbols.txt
@@ -155,7 +155,7 @@ osgeo::proj::crs::GeographicCRS::create(osgeo::proj::util::PropertyMap const&, d
osgeo::proj::crs::GeographicCRS::create(osgeo::proj::util::PropertyMap const&, std::shared_ptr<osgeo::proj::datum::GeodeticReferenceFrame> const&, std::shared_ptr<osgeo::proj::datum::DatumEnsemble> const&, dropbox::oxygen::nn<std::shared_ptr<osgeo::proj::cs::EllipsoidalCS> > const&)
osgeo::proj::crs::GeographicCRS::demoteTo2D(std::string const&, std::shared_ptr<osgeo::proj::io::DatabaseContext> const&) const
osgeo::proj::crs::GeographicCRS::~GeographicCRS()
-osgeo::proj::crs::GeographicCRS::is2DPartOf3D(dropbox::oxygen::nn<osgeo::proj::crs::GeographicCRS const*>) const
+osgeo::proj::crs::GeographicCRS::is2DPartOf3D(dropbox::oxygen::nn<osgeo::proj::crs::GeographicCRS const*>, std::shared_ptr<osgeo::proj::io::DatabaseContext> const&) const
osgeo::proj::crs::InvalidCompoundCRSException::~InvalidCompoundCRSException()
osgeo::proj::crs::InvalidCompoundCRSException::InvalidCompoundCRSException(osgeo::proj::crs::InvalidCompoundCRSException const&)
osgeo::proj::crs::ParametricCRS::coordinateSystem() const
diff --git a/src/iso19111/coordinateoperation.cpp b/src/iso19111/coordinateoperation.cpp
index 30861be0..184ff435 100644
--- a/src/iso19111/coordinateoperation.cpp
+++ b/src/iso19111/coordinateoperation.cpp
@@ -14196,7 +14196,7 @@ void CoordinateOperationFactory::Private::createOperationsBoundToGeog(
if (hubSrcGeog && geogCRSOfBaseOfBoundSrc &&
(hubSrcGeog->_isEquivalentTo(
geogDst, util::IComparable::Criterion::EQUIVALENT) ||
- hubSrcGeog->is2DPartOf3D(NN_NO_CHECK(geogDst)))) {
+ hubSrcGeog->is2DPartOf3D(NN_NO_CHECK(geogDst), dbContext))) {
triedBoundCrsToGeogCRSSameAsHubCRS = true;
CoordinateOperationPtr opIntermediate;
@@ -14976,7 +14976,7 @@ void CoordinateOperationFactory::Private::createOperationsCompoundToGeog(
if (!foundRegisteredTransformWithAllGridsAvailable && srcGeogCRS &&
!srcGeogCRS->_isEquivalentTo(
geogDst, util::IComparable::Criterion::EQUIVALENT) &&
- !srcGeogCRS->is2DPartOf3D(NN_NO_CHECK(geogDst))) {
+ !srcGeogCRS->is2DPartOf3D(NN_NO_CHECK(geogDst), dbContext)) {
auto verticalTransformsTmp = createOperations(
componentsSrc[1],
NN_NO_CHECK(srcGeogCRS)
diff --git a/src/iso19111/crs.cpp b/src/iso19111/crs.cpp
index eb3918f7..134f6006 100644
--- a/src/iso19111/crs.cpp
+++ b/src/iso19111/crs.cpp
@@ -1006,7 +1006,8 @@ CRSNNPtr CRS::promoteTo3D(const std::string &newName,
if (firstResAxisList[2]->_isEquivalentTo(
verticalAxisIfNotAlreadyPresent.get(),
util::IComparable::Criterion::EQUIVALENT) &&
- geogCRS->is2DPartOf3D(NN_NO_CHECK(firstResGeog))) {
+ geogCRS->is2DPartOf3D(NN_NO_CHECK(firstResGeog),
+ dbContext)) {
return NN_NO_CHECK(
util::nn_dynamic_pointer_cast<CRS>(firstRes));
}
@@ -2371,7 +2372,8 @@ GeographicCRS::create(const util::PropertyMap &properties,
/** \brief Return whether the current GeographicCRS is the 2D part of the
* other 3D GeographicCRS.
*/
-bool GeographicCRS::is2DPartOf3D(util::nn<const GeographicCRS *> other)
+bool GeographicCRS::is2DPartOf3D(util::nn<const GeographicCRS *> other,
+ const io::DatabaseContextPtr &dbContext)
PROJ_PURE_DEFN {
const auto &axis = d->coordinateSystem_->axisList();
const auto &otherAxis = other->d->coordinateSystem_->axisList();
@@ -2389,19 +2391,10 @@ bool GeographicCRS::is2DPartOf3D(util::nn<const GeographicCRS *> other)
util::IComparable::Criterion::EQUIVALENT))) {
return false;
}
- const auto &thisDatum = GeodeticCRS::getPrivate()->datum_;
- const auto &otherDatum = other->GeodeticCRS::getPrivate()->datum_;
- if (thisDatum && otherDatum) {
- return thisDatum->_isEquivalentTo(
- otherDatum.get(), util::IComparable::Criterion::EQUIVALENT);
- }
- const auto &thisDatumEnsemble = datumEnsemble();
- const auto &otherDatumEnsemble = other->datumEnsemble();
- if (thisDatumEnsemble && otherDatumEnsemble) {
- return thisDatumEnsemble->_isEquivalentTo(
- otherDatumEnsemble.get(), util::IComparable::Criterion::EQUIVALENT);
- }
- return false;
+ const auto thisDatum = datumNonNull(dbContext);
+ const auto otherDatum = other->datumNonNull(dbContext);
+ return thisDatum->_isEquivalentTo(otherDatum.get(),
+ util::IComparable::Criterion::EQUIVALENT);
}
//! @endcond
@@ -2543,7 +2536,8 @@ GeographicCRS::demoteTo2D(const std::string &newName,
auto firstResAsGeogCRS =
util::nn_dynamic_pointer_cast<GeographicCRS>(firstRes);
if (firstResAsGeogCRS &&
- firstResAsGeogCRS->is2DPartOf3D(NN_NO_CHECK(this))) {
+ firstResAsGeogCRS->is2DPartOf3D(NN_NO_CHECK(this),
+ dbContext)) {
return NN_NO_CHECK(firstResAsGeogCRS);
}
}