diff options
| author | Kristian Evers <kristianevers@gmail.com> | 2020-04-11 12:13:46 +0200 |
|---|---|---|
| committer | Kristian Evers <kristianevers@gmail.com> | 2020-04-12 12:20:44 +0200 |
| commit | 925ae56c40b0cfa7d861f55e4332cb5603168a2c (patch) | |
| tree | a116f540e214a6f4568b8fa0c4877d6d71649b89 /src/4D_api.cpp | |
| parent | 21ebdfb89bc4b222c4fb78815971b19192a2a09e (diff) | |
| download | PROJ-925ae56c40b0cfa7d861f55e4332cb5603168a2c.tar.gz PROJ-925ae56c40b0cfa7d861f55e4332cb5603168a2c.zip | |
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
Diffstat (limited to 'src/4D_api.cpp')
| -rw-r--r-- | src/4D_api.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
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) { |
