diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/iso19111/c_api.cpp | 34 | ||||
| -rw-r--r-- | src/proj.h | 3 |
2 files changed, 37 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 @@ -1263,6 +1263,9 @@ PJ PROJ_DLL *proj_datum_ensemble_get_member(PJ_CONTEXT *ctx, const PJ *datum_ensemble, int member_index); +double PROJ_DLL proj_dynamic_datum_get_frame_reference_epoch(PJ_CONTEXT *ctx, + const PJ *datum); + PJ PROJ_DLL *proj_crs_get_coordinate_system(PJ_CONTEXT *ctx, const PJ *crs); PJ_COORDINATE_SYSTEM_TYPE PROJ_DLL proj_cs_get_type(PJ_CONTEXT *ctx, |
