From 925ae56c40b0cfa7d861f55e4332cb5603168a2c Mon Sep 17 00:00:00 2001 From: Kristian Evers Date: Sat, 11 Apr 2020 12:13:46 +0200 Subject: Add proj_degree_input() and proj_degree_output() Equivalent to proj_angular_input() and proj_angular_output() but checking for degree units instead. proj_create_crs_to_crs() rarely, if ever, returns pipelines that has radians as input or output so using proj_angular_*() is not a useful check for io units of pipelines. These two new functions should make life a bit easier for users that generally store there angular coordinates in radians. Closes #2027 --- src/4D_api.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'src/4D_api.cpp') diff --git a/src/4D_api.cpp b/src/4D_api.cpp index 6e494793..069093f2 100644 --- a/src/4D_api.cpp +++ b/src/4D_api.cpp @@ -93,6 +93,27 @@ int proj_angular_output (PJ *P, enum PJ_DIRECTION dir) { return proj_angular_input (P, opposite_direction(dir)); } +/*****************************************************************************/ +int proj_degree_input (PJ *P, enum PJ_DIRECTION dir) { +/****************************************************************************** + Returns 1 if the operator P expects degree input coordinates when + operating in direction dir, 0 otherwise. + dir: {PJ_FWD, PJ_INV} +******************************************************************************/ + if (PJ_FWD==dir) + return pj_left (P)==PJ_IO_UNITS_DEGREES; + return pj_right (P)==PJ_IO_UNITS_DEGREES; +} + +/*****************************************************************************/ +int proj_degree_output (PJ *P, enum PJ_DIRECTION dir) { +/****************************************************************************** + Returns 1 if the operator P provides degree output coordinates when + operating in direction dir, 0 otherwise. + dir: {PJ_FWD, PJ_INV} +******************************************************************************/ + return proj_degree_input (P, opposite_direction(dir)); +} /* Geodesic distance (in meter) + fwd and rev azimuth between two points on the ellipsoid */ PJ_COORD proj_geod (const PJ *P, PJ_COORD a, PJ_COORD b) { -- cgit v1.2.3