diff options
Diffstat (limited to 'src/proj_internal.h')
| -rw-r--r-- | src/proj_internal.h | 109 |
1 files changed, 63 insertions, 46 deletions
diff --git a/src/proj_internal.h b/src/proj_internal.h index cca57859..4dc63e1d 100644 --- a/src/proj_internal.h +++ b/src/proj_internal.h @@ -287,6 +287,55 @@ typedef PJ_COORD (* PJ_OPERATOR) (PJ_COORD, PJ *); #define PJD_GRIDSHIFT 3 #define PJD_WGS84 4 /* WGS84 (or anything considered equivalent) */ +struct CoordOperation +{ + int idxInOriginalList; + double minxSrc = 0.0; + double minySrc = 0.0; + double maxxSrc = 0.0; + double maxySrc = 0.0; + double minxDst = 0.0; + double minyDst = 0.0; + double maxxDst = 0.0; + double maxyDst = 0.0; + PJ* pj = nullptr; + std::string name{}; + double accuracy = -1.0; + bool isOffshore = false; + + CoordOperation(int idxInOriginalListIn, + double minxSrcIn, double minySrcIn, double maxxSrcIn, double maxySrcIn, + double minxDstIn, double minyDstIn, double maxxDstIn, double maxyDstIn, + PJ* pjIn, const std::string& nameIn, double accuracyIn, bool isOffshoreIn): + idxInOriginalList(idxInOriginalListIn), + minxSrc(minxSrcIn), minySrc(minySrcIn), maxxSrc(maxxSrcIn), maxySrc(maxySrcIn), + minxDst(minxDstIn), minyDst(minyDstIn), maxxDst(maxxDstIn), maxyDst(maxyDstIn), + pj(pjIn), name(nameIn), + accuracy(accuracyIn), + isOffshore(isOffshoreIn) + { + } + + CoordOperation(const CoordOperation&) = delete; + + CoordOperation(CoordOperation&& other): + idxInOriginalList(other.idxInOriginalList), + minxSrc(other.minxSrc), minySrc(other.minySrc), maxxSrc(other.maxxSrc), maxySrc(other.maxySrc), + minxDst(other.minxDst), minyDst(other.minyDst), maxxDst(other.maxxDst), maxyDst(other.maxyDst), + name(std::move(other.name)), + accuracy(other.accuracy), + isOffshore(other.isOffshore) { + pj = other.pj; + other.pj = nullptr; + } + + CoordOperation& operator=(const CoordOperation&) = delete; + + ~CoordOperation() + { + proj_destroy(pj); + } +}; /* base projection data structure */ struct PJconsts { @@ -493,52 +542,6 @@ struct PJconsts { /************************************************************************************* proj_create_crs_to_crs() alternative coordinate operations **************************************************************************************/ - - struct CoordOperation - { - double minxSrc = 0.0; - double minySrc = 0.0; - double maxxSrc = 0.0; - double maxySrc = 0.0; - double minxDst = 0.0; - double minyDst = 0.0; - double maxxDst = 0.0; - double maxyDst = 0.0; - PJ* pj = nullptr; - std::string name{}; - double accuracy = -1.0; - bool isOffshore = false; - - CoordOperation(double minxSrcIn, double minySrcIn, double maxxSrcIn, double maxySrcIn, - double minxDstIn, double minyDstIn, double maxxDstIn, double maxyDstIn, - PJ* pjIn, const std::string& nameIn, double accuracyIn, bool isOffshoreIn): - minxSrc(minxSrcIn), minySrc(minySrcIn), maxxSrc(maxxSrcIn), maxySrc(maxySrcIn), - minxDst(minxDstIn), minyDst(minyDstIn), maxxDst(maxxDstIn), maxyDst(maxyDstIn), - pj(pjIn), name(nameIn), - accuracy(accuracyIn), - isOffshore(isOffshoreIn) - { - } - - CoordOperation(const CoordOperation&) = delete; - - CoordOperation(CoordOperation&& other): - minxSrc(other.minxSrc), minySrc(other.minySrc), maxxSrc(other.maxxSrc), maxySrc(other.maxySrc), - minxDst(other.minxDst), minyDst(other.minyDst), maxxDst(other.maxxDst), maxyDst(other.maxyDst), - name(std::move(other.name)), - accuracy(other.accuracy), - isOffshore(other.isOffshore) { - pj = other.pj; - other.pj = nullptr; - } - - CoordOperation& operator=(const CoordOperation&) = delete; - - ~CoordOperation() - { - proj_destroy(pj); - } - }; std::vector<CoordOperation> alternativeCoordinateOperations{}; int iCurCoordOp = -1; @@ -873,6 +876,20 @@ std::string PROJ_DLL pj_context_get_user_writable_directory(PJ_CONTEXT *ctx, boo void PROJ_DLL pj_context_set_user_writable_directory(PJ_CONTEXT* ctx, const std::string& path); std::string PROJ_DLL pj_get_relative_share_proj(PJ_CONTEXT *ctx); +std::vector<CoordOperation> pj_create_prepared_operations(PJ_CONTEXT *ctx, + const PJ *source_crs, + const PJ *target_crs, + PJ_OBJ_LIST* op_list); + +int pj_get_suggested_operation(PJ_CONTEXT *ctx, + const std::vector<CoordOperation>& opList, + const int iExcluded[2], + PJ_DIRECTION direction, + PJ_COORD coord); + +const PJ_UNITS *pj_list_linear_units(); +const PJ_UNITS *pj_list_angular_units(); + /* classic public API */ #include "proj_api.h" |
