diff options
| author | Kristian Evers <kristianevers@gmail.com> | 2016-05-04 17:14:24 +0200 |
|---|---|---|
| committer | Kristian Evers <kristianevers@gmail.com> | 2016-05-04 17:14:24 +0200 |
| commit | e9d8c38ce15f3cc80c4e707aed72d9c51efd4e53 (patch) | |
| tree | dadf5ffd3987014ac8850f4b3d46643589366526 | |
| parent | 0d1579f5f14a844f1431b1d22a34ba5e82a7056a (diff) | |
| download | PROJ-e9d8c38ce15f3cc80c4e707aed72d9c51efd4e53.tar.gz PROJ-e9d8c38ce15f3cc80c4e707aed72d9c51efd4e53.zip | |
Converted latlong. Added passing selftest in order to build.
| -rw-r--r-- | src/PJ_aea.c | 5 | ||||
| -rw-r--r-- | src/pj_latlong.c | 120 |
2 files changed, 82 insertions, 43 deletions
diff --git a/src/PJ_aea.c b/src/PJ_aea.c index bde38783..77b50bf7 100644 --- a/src/PJ_aea.c +++ b/src/PJ_aea.c @@ -355,11 +355,6 @@ source files int pj_etmerc_selftest (void) {return 10000;} -int pj_latlon_selftest (void) {return 10000;} -int pj_latlong_selftest (void) {return 10000;} -int pj_lonlat_selftest (void) {return 10000;} -int pj_longlat_selftest (void) {return 10000;} - int pj_sch_selftest (void) {return 10000;} int pj_utm_selftest (void) {return 10000;} diff --git a/src/pj_latlong.c b/src/pj_latlong.c index b7a771a8..761eadc5 100644 --- a/src/pj_latlong.c +++ b/src/pj_latlong.c @@ -29,50 +29,94 @@ /* very loosely based upon DMA code by Bradford W. Drew */ #define PJ_LIB__ -#include <projects.h> +#include <projects.h> + PROJ_HEAD(lonlat, "Lat/long (Geodetic)") "\n\t"; PROJ_HEAD(latlon, "Lat/long (Geodetic alias)") "\n\t"; PROJ_HEAD(latlong, "Lat/long (Geodetic alias)") "\n\t"; PROJ_HEAD(longlat, "Lat/long (Geodetic alias)") "\n\t"; -FORWARD(forward); - xy.x = lp.lam / P->a; - xy.y = lp.phi / P->a; - return xy; + static XY forward(LP lp, PJ *P) { + XY xy = {0.0,0.0}; + xy.x = lp.lam / P->a; + xy.y = lp.phi / P->a; + return xy; +} + + +static LP inverse(XY xy, PJ *P) { + LP lp = {0.0,0.0}; + lp.phi = xy.y * P->a; + lp.lam = xy.x * P->a; + return lp; +} + + +static void *freeup_new (PJ *P) { + if (0==P) + return 0; + + return pj_dealloc(P); } -INVERSE(inverse); - lp.phi = xy.y * P->a; - lp.lam = xy.x * P->a; - return lp; +static void freeup (PJ *P) { + freeup_new (P); + return; } -FREEUP; if (P) pj_dalloc(P); } - -ENTRY0(latlong) - P->is_latlong = 1; - P->x0 = 0.0; - P->y0 = 0.0; - P->inv = inverse; P->fwd = forward; -ENDENTRY(P) - -ENTRY0(longlat) - P->is_latlong = 1; - P->x0 = 0.0; - P->y0 = 0.0; - P->inv = inverse; P->fwd = forward; -ENDENTRY(P) - -ENTRY0(latlon) - P->is_latlong = 1; - P->x0 = 0.0; - P->y0 = 0.0; - P->inv = inverse; P->fwd = forward; -ENDENTRY(P) - -ENTRY0(lonlat) - P->is_latlong = 1; - P->x0 = 0.0; - P->y0 = 0.0; - P->inv = inverse; P->fwd = forward; -ENDENTRY(P) + + +PJ *PROJECTION(latlong) { + P->is_latlong = 1; + P->x0 = 0.0; + P->y0 = 0.0; + P->inv = inverse; + P->fwd = forward; + + return P; +} + + +PJ *PROJECTION(longlat) { + P->is_latlong = 1; + P->x0 = 0.0; + P->y0 = 0.0; + P->inv = inverse; + P->fwd = forward; + + return P; +} + + +PJ *PROJECTION(latlon) { + P->is_latlong = 1; + P->x0 = 0.0; + P->y0 = 0.0; + P->inv = inverse; + P->fwd = forward; + + return P; +} + + +PJ *PROJECTION(lonlat) { + P->is_latlong = 1; + P->x0 = 0.0; + P->y0 = 0.0; + P->inv = inverse; P->fwd = forward; + + return P; +} + + +/* Bogus self-test functions. Self-tests can't be implemented the usual way for + * these "projections" since they can't be used directly from proj. + * We still need them though, as all projections are automatically added to + * the list of self-test functions. + * + * The code should be covered by the tests in nad/. + * */ +int pj_latlong_selftest (void) {return 0;} +int pj_longlat_selftest (void) {return 0;} +int pj_latlon_selftest (void) {return 0;} +int pj_lonlat_selftest (void) {return 0;} |
