diff options
| author | Even Rouault <even.rouault@spatialys.com> | 2020-10-11 20:13:42 +0200 |
|---|---|---|
| committer | Even Rouault <even.rouault@spatialys.com> | 2020-10-11 20:13:42 +0200 |
| commit | 686713479eb0b39feb5369b82647f96edf809b6c (patch) | |
| tree | 2a27a48120eafa170aa4e391d0706c614c9c174a /src/iso19111/c_api.cpp | |
| parent | d1a0d95da549f7d32bcd8be408afe1fca62a6fb2 (diff) | |
| download | PROJ-686713479eb0b39feb5369b82647f96edf809b6c.tar.gz PROJ-686713479eb0b39feb5369b82647f96edf809b6c.zip | |
C API: add proj_dynamic_datum_get_frame_reference_epoch()
Diffstat (limited to 'src/iso19111/c_api.cpp')
| -rw-r--r-- | src/iso19111/c_api.cpp | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/iso19111/c_api.cpp b/src/iso19111/c_api.cpp index c152df88..cad76431 100644 --- a/src/iso19111/c_api.cpp +++ b/src/iso19111/c_api.cpp @@ -8163,6 +8163,40 @@ PJ *proj_crs_get_datum_forced(PJ_CONTEXT *ctx, const PJ *crs) { // --------------------------------------------------------------------------- +/** \brief Returns the frame reference epoch of a dynamic geodetic or vertical + * reference frame. + * + * @param ctx PROJ context, or NULL for default context + * @param datum Object of type DynamicGeodeticReferenceFrame or + * DynamicVerticalReferenceFrame (must not be NULL) + * @return the frame reference epoch as decimal year, or -1 in case of error. + * + * @since 7.2 + */ +double proj_dynamic_datum_get_frame_reference_epoch(PJ_CONTEXT *ctx, + const PJ *datum) { + SANITIZE_CTX(ctx); + if (!datum) { + proj_log_error(ctx, __FUNCTION__, "missing required input"); + return -1; + } + auto dgrf = dynamic_cast<const DynamicGeodeticReferenceFrame *>( + datum->iso_obj.get()); + auto dvrf = dynamic_cast<const DynamicVerticalReferenceFrame *>( + datum->iso_obj.get()); + if (!dgrf && !dvrf) { + proj_log_error(ctx, __FUNCTION__, "Object is not a " + "DynamicGeodeticReferenceFrame or " + "DynamicVerticalReferenceFrame"); + return -1; + } + const auto &frameReferenceEpoch = + dgrf ? dgrf->frameReferenceEpoch() : dvrf->frameReferenceEpoch(); + return frameReferenceEpoch.value(); +} + +// --------------------------------------------------------------------------- + /** \brief Returns the coordinate system of a SingleCRS. * * The returned object must be unreferenced with proj_destroy() after |
