Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make "Vertical Offset and Slope" method usable as a deriving conversion of a DerivedVerticalCRS #3270

Merged
merged 2 commits into from
Aug 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 16 additions & 11 deletions include/proj/coordinateoperation.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,12 @@ using CoordinateOperationPtr = std::shared_ptr<CoordinateOperation>;
/** Non-null shared pointer of CoordinateOperation */
using CoordinateOperationNNPtr = util::nn<CoordinateOperationPtr>;

class Transformation;
/** Shared pointer of Transformation */
using TransformationPtr = std::shared_ptr<Transformation>;
/** Non-null shared pointer of Transformation */
using TransformationNNPtr = util::nn<TransformationPtr>;

/** \brief Abstract class for a mathematical operation on coordinates.
*
* A mathematical operation:
Expand Down Expand Up @@ -171,12 +177,15 @@ class PROJ_GCC_DLL CoordinateOperation : public common::ObjectUsage,
PROJ_FRIEND(io::AuthorityFactory);
PROJ_FRIEND(CoordinateOperationFactory);
PROJ_FRIEND(ConcatenatedOperation);
PROJ_FRIEND(io::WKTParser);
PROJ_INTERNAL void
setWeakSourceTargetCRS(std::weak_ptr<crs::CRS> sourceCRSIn,
std::weak_ptr<crs::CRS> targetCRSIn);
PROJ_INTERNAL void setCRSs(const crs::CRSNNPtr &sourceCRSIn,
const crs::CRSNNPtr &targetCRSIn,
const crs::CRSPtr &interpolationCRSIn);
PROJ_INTERNAL void
setInterpolationCRS(const crs::CRSPtr &interpolationCRSIn);
PROJ_INTERNAL void setCRSs(const CoordinateOperation *in,
bool inverseSourceTarget);
PROJ_INTERNAL
Expand Down Expand Up @@ -608,6 +617,9 @@ class PROJ_GCC_DLL SingleOperation : virtual public CoordinateOperation {

PROJ_DLL std::list<std::string> validateParameters() const;

PROJ_DLL TransformationNNPtr substitutePROJAlternativeGridNames(
io::DatabaseContextNNPtr databaseContext) const;

PROJ_PRIVATE :
//! @cond Doxygen_Suppress

Expand All @@ -628,6 +640,9 @@ class PROJ_GCC_DLL SingleOperation : virtual public CoordinateOperation {
util::IComparable::Criterion criterion =
util::IComparable::Criterion::STRICT,
const io::DatabaseContextPtr &dbContext = nullptr) const override;

PROJ_INTERNAL bool isLongitudeRotation() const;

//! @endcond

protected:
Expand Down Expand Up @@ -1418,12 +1433,6 @@ class PROJ_GCC_DLL Conversion : public SingleOperation {

// ---------------------------------------------------------------------------

class Transformation;
/** Shared pointer of Transformation */
using TransformationPtr = std::shared_ptr<Transformation>;
/** Non-null shared pointer of Transformation */
using TransformationNNPtr = util::nn<TransformationPtr>;

/** \brief A mathematical operation on coordinates in which parameters are
* empirically derived from data containing the coordinates of a series of
* points in both coordinate reference systems.
Expand Down Expand Up @@ -1577,9 +1586,6 @@ class PROJ_GCC_DLL Transformation : public SingleOperation {
const crs::CRSNNPtr &targetCRSIn, const common::Length &offsetHeight,
const std::vector<metadata::PositionalAccuracyNNPtr> &accuracies);

PROJ_DLL TransformationNNPtr substitutePROJAlternativeGridNames(
io::DatabaseContextNNPtr databaseContext) const;

PROJ_DLL static TransformationNNPtr createChangeVerticalUnit(
const util::PropertyMap &properties, const crs::CRSNNPtr &sourceCRSIn,
const crs::CRSNNPtr &targetCRSIn, const common::Scale &factor,
Expand All @@ -1595,8 +1601,6 @@ class PROJ_GCC_DLL Transformation : public SingleOperation {

PROJ_INTERNAL const std::string &getHeightToGeographic3DFilename() const;

PROJ_INTERNAL bool isLongitudeRotation() const;

PROJ_INTERNAL void _exportToWKT(io::WKTFormatter *formatter)
const override; // throw(io::FormattingException)

Expand Down Expand Up @@ -1629,6 +1633,7 @@ class PROJ_GCC_DLL Transformation : public SingleOperation {
const override; // throw(FormattingException)

PROJ_FRIEND(CoordinateOperationFactory);
PROJ_FRIEND(SingleOperation);
PROJ_INTERNAL TransformationNNPtr inverseAsTransformation() const;

PROJ_INTERNAL CoordinateOperationNNPtr _shallowClone() const override;
Expand Down
2 changes: 1 addition & 1 deletion scripts/reference_exported_symbols.txt
Original file line number Diff line number Diff line change
Expand Up @@ -686,6 +686,7 @@ osgeo::proj::operation::SingleOperation::parameterValueNumeric(int, osgeo::proj:
osgeo::proj::operation::SingleOperation::parameterValues() const
osgeo::proj::operation::SingleOperation::parameterValue(std::string const&, int) const
osgeo::proj::operation::SingleOperation::~SingleOperation()
osgeo::proj::operation::SingleOperation::substitutePROJAlternativeGridNames(dropbox::oxygen::nn<std::shared_ptr<osgeo::proj::io::DatabaseContext> >) const
osgeo::proj::operation::SingleOperation::validateParameters() const
osgeo::proj::operation::Transformation::createAbridgedMolodensky(osgeo::proj::util::PropertyMap const&, dropbox::oxygen::nn<std::shared_ptr<osgeo::proj::crs::CRS> > const&, dropbox::oxygen::nn<std::shared_ptr<osgeo::proj::crs::CRS> > const&, double, double, double, double, double, std::vector<dropbox::oxygen::nn<std::shared_ptr<osgeo::proj::metadata::PositionalAccuracy> >, std::allocator<dropbox::oxygen::nn<std::shared_ptr<osgeo::proj::metadata::PositionalAccuracy> > > > const&)
osgeo::proj::operation::Transformation::createChangeVerticalUnit(osgeo::proj::util::PropertyMap const&, dropbox::oxygen::nn<std::shared_ptr<osgeo::proj::crs::CRS> > const&, dropbox::oxygen::nn<std::shared_ptr<osgeo::proj::crs::CRS> > const&, osgeo::proj::common::Scale const&, std::vector<dropbox::oxygen::nn<std::shared_ptr<osgeo::proj::metadata::PositionalAccuracy> >, std::allocator<dropbox::oxygen::nn<std::shared_ptr<osgeo::proj::metadata::PositionalAccuracy> > > > const&)
Expand All @@ -709,7 +710,6 @@ osgeo::proj::operation::Transformation::createVerticalOffset(osgeo::proj::util::
osgeo::proj::operation::Transformation::getTOWGS84Parameters() const
osgeo::proj::operation::Transformation::inverse() const
osgeo::proj::operation::Transformation::sourceCRS() const
osgeo::proj::operation::Transformation::substitutePROJAlternativeGridNames(dropbox::oxygen::nn<std::shared_ptr<osgeo::proj::io::DatabaseContext> >) const
osgeo::proj::operation::Transformation::targetCRS() const
osgeo::proj::operation::Transformation::~Transformation()
osgeo::proj::util::ArrayOfBaseObject::add(osgeo::proj::util::BaseObjectNNPtr const&)
Expand Down
16 changes: 13 additions & 3 deletions src/iso19111/io.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3334,7 +3334,12 @@ WKTParser::Private::buildConversion(const WKTNodeNNPtr &node,
Conversion::create(invConvProps, invMethodProps, parameters, values)
->inverse()));
}
return Conversion::create(convProps, methodProps, parameters, values);
auto conv = Conversion::create(convProps, methodProps, parameters, values);
auto interpolationCRS =
dealWithEPSGCodeForInterpolationCRSParameter(parameters, values);
if (interpolationCRS)
conv->setInterpolationCRS(interpolationCRS);
return conv;
}

// ---------------------------------------------------------------------------
Expand All @@ -3346,8 +3351,13 @@ CRSPtr WKTParser::Private::dealWithEPSGCodeForInterpolationCRSParameter(
// crs_epsg_code] into proper interpolation CRS
if (dbContext_ != nullptr) {
for (size_t i = 0; i < parameters.size(); ++i) {
if (parameters[i]->nameStr() ==
EPSG_NAME_PARAMETER_EPSG_CODE_FOR_INTERPOLATION_CRS) {
const auto &l_name = parameters[i]->nameStr();
const auto epsgCode = parameters[i]->getEPSGCode();
if (l_name == EPSG_NAME_PARAMETER_EPSG_CODE_FOR_INTERPOLATION_CRS ||
epsgCode ==
EPSG_CODE_PARAMETER_EPSG_CODE_FOR_INTERPOLATION_CRS ||
l_name == EPSG_NAME_PARAMETER_EPSG_CODE_FOR_HORIZONTAL_CRS ||
epsgCode == EPSG_CODE_PARAMETER_EPSG_CODE_FOR_HORIZONTAL_CRS) {
const int code =
static_cast<int>(values[i]->value().getSIValue());
try {
Expand Down
2 changes: 2 additions & 0 deletions src/iso19111/operation/parammappings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1053,6 +1053,8 @@ const struct ParamNameCode paramNameCodes[] = {
PARAM_NAME_CODE(GEOCENTRIC_TRANSLATION_FILE),
PARAM_NAME_CODE(INCLINATION_IN_LATITUDE),
PARAM_NAME_CODE(INCLINATION_IN_LONGITUDE),
PARAM_NAME_CODE(EPSG_CODE_FOR_HORIZONTAL_CRS),
PARAM_NAME_CODE(EPSG_CODE_FOR_INTERPOLATION_CRS),
};

const ParamNameCode *getParamNameCodes(size_t &nElts) {
Expand Down
Loading