diff options
| -rw-r--r-- | .gitignore | 65 | ||||
| -rw-r--r-- | .travis.yml | 73 | ||||
| -rwxr-xr-x | libtool | 14 | ||||
| -rw-r--r-- | src/PJ_aeqd.c | 72 | ||||
| -rw-r--r-- | src/PJ_krovak.c | 12 | ||||
| -rw-r--r-- | src/PJ_stere.c | 2 | ||||
| -rw-r--r-- | src/pj_init.c | 5 |
7 files changed, 187 insertions, 56 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..0868c086 --- /dev/null +++ b/.gitignore @@ -0,0 +1,65 @@ +*~ +Makefile +CMakeFiles +CMakeCache.txt +CTestTestfile.cmake +cmake_install.cmake + +/*.manifest +/*.swp +/autom4te.cache +/config.log +/config.status +/config.cache +/proj.pc +/nbproject +/bin +/lib +/DartConfiguration.tcl +/Testing + +# html +/html/dl +/html/robots.txt + +# nad +/nad/WI +/nad/prvi +/nad/WO +/nad/alaska +/nad/FL +/nad/README.NADUS +/nad/stpaul +/nad/stgeorge +/nad/TN +/nad/conus +/nad/MD +/nad/hawaii +/nad/stlrnc +/nad/null +/nad/*.lla + +# src +/src/*.o +/src/*.lo +/src/*.la +/src/proj.dll +/src/*.lib +/src/*.pdb +/src/*.exp +/src/*.opt +/src/*.obj +/src/*.exe +/src/.libs +/src/.deps +/src/*.manifest +/src/*.swp +/src/nad2nad +/src/nad2bin +/src/proj +/src/geod +/src/stamp-h* +/src/proj_config.h +/src/cs2cs +/src/multistresstest +/src/test228 diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 00000000..50cc80b1 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,73 @@ +# This is the config file for building proj.4 and running its test suite +# with Travis-ci.org + +language: c + +compiler: + - gcc + - clang + +before_install: + - sudo pip install git+git://github.com/tbonfort/cpp-coveralls.git@extensions + +install: +# cmake build + - mkdir build_cmake + - cd build_cmake + - cmake .. -DCMAKE_INSTALL_PREFIX=/tmp/proj_cmake_install + - make -j3 + - make install + - find /tmp/proj_cmake_install + - cd .. +# autoconf build + - mkdir build_autoconf + - cd build_autoconf + - ../configure --prefix=/tmp/proj_autoconf_install + - make -j3 + - make install + - find /tmp/proj_autoconf_install + - make check + - cd .. +# Now with grids + - wget http://download.osgeo.org/proj/proj-datumgrid-1.5.zip + - cd nad + - unzip -o ../proj-datumgrid-1.5.zip + - cd .. +# cmake build with grids + - mkdir build_cmake_nad + - cd build_cmake_nad + - cmake .. -DCMAKE_INSTALL_PREFIX=/tmp/proj_cmake_install_nad + - make -j3 + - make install + - find /tmp/proj_cmake_install_nad + - cd .. +# autoconf build with grids + - mkdir build_autoconf_nad + - cd build_autoconf_nad + - ../configure --prefix=/tmp/proj_autoconf_install_nad + - make -j3 + - make install + - find /tmp/proj_autoconf_install_nad + - make check + - cd .. +# autoconf build with grids and coverage + - CFLAGS="--coverage" LDFLAGS="-lgcov" ./configure + - make -j3 + - make check + - mv src/.libs/*.gc* src + +script: + - echo "done" + +after_success: + - coveralls --extension .c + +notifications: + #email: + # recipients: + # - gdal-commits@lists.osgeo.org + + irc: + channels: + - "irc.freenode.org#gdal" + use_notice: true @@ -2,7 +2,7 @@ # libtool - Provide generalized library-building support services. # Generated automatically by config.status (proj) 4.9.1 -# Libtool was configured on host vagrant-ubuntu-trusty-32: +# Libtool was configured on host even-desktop: # NOTE: Changes made to this file will be lost: look at ltmain.sh. # # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, @@ -66,12 +66,12 @@ PATH_SEPARATOR=":" # The host system. host_alias= -host=i686-pc-linux-gnu +host=x86_64-unknown-linux-gnu host_os=linux-gnu # The build system. build_alias= -build=i686-pc-linux-gnu +build=x86_64-unknown-linux-gnu build_os=linux-gnu # A sed program that does not truncate output. @@ -164,7 +164,7 @@ lock_old_archive_extraction=no LTCC="gcc" # LTCC compiler flags. -LTCFLAGS="-g -O2" +LTCFLAGS="--coverage" # Take the output of nm and produce a listing of raw symbols and C names. global_symbol_pipe="sed -n -e 's/^.*[ ]\\([ABCDGIRSTW][ABCDGIRSTW]*\\)[ ][ ]*\\([_A-Za-z][_A-Za-z0-9]*\\)\$/\\1 \\2 \\2/p' | sed '/ __gnu_lto/d'" @@ -272,10 +272,10 @@ finish_eval="" hardcode_into_libs=yes # Compile-time system search path for libraries. -sys_lib_search_path_spec="/usr/lib/gcc/i686-linux-gnu/4.8 /usr/lib/i386-linux-gnu /usr/lib /lib/i386-linux-gnu /lib " +sys_lib_search_path_spec="/usr/lib/gcc/x86_64-linux-gnu/4.4.3 /usr/lib /lib /usr/lib/x86_64-linux-gnu " # Run-time system search path for libraries. -sys_lib_dlsearch_path_spec="/lib /usr/lib /usr/lib/i386-linux-gnu/libfakeroot /usr/lib/i386-linux-gnu/mesa /lib/i386-linux-gnu /usr/lib/i386-linux-gnu /lib/i686-linux-gnu /usr/lib/i686-linux-gnu /usr/local/lib " +sys_lib_dlsearch_path_spec="/lib /usr/lib /usr/lib/fglrx /usr/lib32/fglrx /usr/lib/atlas /usr/lib32/alsa-lib /usr/lib/alsa-lib /usr/local/lib /lib/x86_64-linux-gnu /usr/lib/x86_64-linux-gnu " # Whether dlopen is supported. dlopen_support=unknown @@ -292,7 +292,7 @@ striplib="strip --strip-unneeded" # The linker used to build libraries. -LD="/usr/bin/ld" +LD="/usr/bin/ld -m elf_x86_64" # How to create reloadable object files. reload_flag=" -r" diff --git a/src/PJ_aeqd.c b/src/PJ_aeqd.c index 7dc83184..739dfdd6 100644 --- a/src/PJ_aeqd.c +++ b/src/PJ_aeqd.c @@ -34,19 +34,23 @@ double Mp; \ double He; \ double G; \ - int mode; + int mode; \ + struct geod_geodesic g; #define PJ_LIB__ +#include "geodesic.h" #include <projects.h> PROJ_HEAD(aeqd, "Azimuthal Equidistant") "\n\tAzi, Sph&Ell\n\tlat_0 guam"; #define EPS10 1.e-10 #define TOL 1.e-14 +#define RHO 57.295779513082320876798154814105 #define N_POLE 0 -#define S_POLE 1 +#define S_POLE 1 #define EQUIT 2 #define OBLIQ 3 + FORWARD(e_guam_fwd); /* Guam elliptical */ double cosphi, sinphi, t; @@ -59,7 +63,9 @@ FORWARD(e_guam_fwd); /* Guam elliptical */ return (xy); } FORWARD(e_forward); /* elliptical */ - double coslam, cosphi, sinphi, rho, s, H, H2, c, Az, t, ct, st, cA, sA; + double coslam, cosphi, sinphi, rho; + double azi1, azi2, s12; + double lam1, phi1, lam2, phi2; coslam = cos(lp.lam); cosphi = cos(lp.phi); @@ -78,22 +84,14 @@ FORWARD(e_forward); /* elliptical */ xy.x = xy.y = 0.; break; } - t = atan2(P->one_es * sinphi + P->es * P->N1 * P->sinph0 * - sqrt(1. - P->es * sinphi * sinphi), cosphi); - ct = cos(t); st = sin(t); - Az = atan2(sin(lp.lam) * ct, P->cosph0 * st - P->sinph0 * coslam * ct); - cA = cos(Az); sA = sin(Az); - s = aasin( P->ctx, fabs(sA) < TOL ? - (P->cosph0 * st - P->sinph0 * coslam * ct) / cA : - sin(lp.lam) * ct / sA ); - H = P->He * cA; - H2 = H * H; - c = P->N1 * s * (1. + s * s * (- H2 * (1. - H2)/6. + - s * ( P->G * H * (1. - 2. * H2 * H2) / 8. + - s * ((H2 * (4. - 7. * H2) - 3. * P->G * P->G * (1. - 7. * H2)) / - 120. - s * P->G * H / 48.)))); - xy.x = c * sA; - xy.y = c * cA; + + phi1 = P->phi0*RHO; lam1 = P->lam0*RHO; + phi2 = lp.phi*RHO; lam2 = (lp.lam+P->lam0)*RHO; + + geod_inverse(&P->g, phi1, lam1, phi2, lam2, &s12, &azi1, &azi2); + azi1 /= RHO; + xy.x = s12 * sin(azi1) / P->a; + xy.y = s12 * cos(azi1) / P->a; break; } return (xy); @@ -113,7 +111,7 @@ FORWARD(s_forward); /* spherical */ oblcon: if (fabs(fabs(xy.y) - 1.) < TOL) if (xy.y < 0.) - F_ERROR + F_ERROR else xy.x = xy.y = 0.; else { @@ -150,7 +148,8 @@ INVERSE(e_guam_inv); /* Guam elliptical */ return (lp); } INVERSE(e_inverse); /* elliptical */ - double c, Az, cosAz, A, B, D, E, F, psi, t; + double c; + double azi1, azi2, s12, x2, y2, lat1, lon1, lat2, lon2; if ((c = hypot(xy.x, xy.y)) < EPS10) { lp.phi = P->phi0; @@ -158,23 +157,17 @@ INVERSE(e_inverse); /* elliptical */ return (lp); } if (P->mode == OBLIQ || P->mode == EQUIT) { - cosAz = cos(Az = atan2(xy.x, xy.y)); - t = P->cosph0 * cosAz; - B = P->es * t / P->one_es; - A = - B * t; - B *= 3. * (1. - A) * P->sinph0; - D = c / P->N1; - E = D * (1. - D * D * (A * (1. + A) / 6. + B * (1. + 3.*A) * D / 24.)); - F = 1. - E * E * (A / 2. + B * E / 6.); - psi = aasin(P->ctx, P->sinph0 * cos(E) + t * sin(E)); - lp.lam = aasin(P->ctx, sin(Az) * sin(E) / cos(psi)); - if ((t = fabs(psi)) < EPS10) - lp.phi = 0.; - else if (fabs(t - HALFPI) < 0.) - lp.phi = HALFPI; - else - lp.phi = atan((1. - P->es * F * P->sinph0 / sin(psi)) * tan(psi) / - P->one_es); + + x2 = xy.x * P->a; + y2 = xy.y * P->a; + lat1 = P->phi0 * RHO; + lon1 = P->lam0 * RHO; + azi1 = atan2(x2, y2) * RHO; + s12 = sqrt(x2 * x2 + y2 * y2); + geod_direct(&P->g, lat1, lon1, azi1, s12, &lat2, &lon2, &azi2); + lp.phi = lat2 / RHO; + lp.lam = lon2 / RHO; + lp.lam -= P->lam0; } else { /* Polar */ lp.phi = pj_inv_mlfn(P->ctx, P->mode == N_POLE ? P->Mp - c : P->Mp + c, P->es, P->en); @@ -206,7 +199,7 @@ INVERSE(s_inverse); /* spherical */ xy.y = (cosc - P->sinph0 * sin(lp.phi)) * c_rh; xy.x *= sinc * P->cosph0; } - lp.lam = atan2(xy.x, xy.y); + lp.lam = xy.y == 0. ? 0. : atan2(xy.x, xy.y); } else if (P->mode == N_POLE) { lp.phi = HALFPI - c_rh; lp.lam = atan2(xy.x, -xy.y); @@ -224,6 +217,7 @@ FREEUP; } } ENTRY1(aeqd, en) + geod_init(&P->g, P->a, P->es / (1 + sqrt(P->one_es))); P->phi0 = pj_param(P->ctx, P->params, "rlat_0").f; if (fabs(fabs(P->phi0) - HALFPI) < EPS10) { P->mode = P->phi0 < 0. ? S_POLE : N_POLE; diff --git a/src/PJ_krovak.c b/src/PJ_krovak.c index 48f9a8fe..dd250134 100644 --- a/src/PJ_krovak.c +++ b/src/PJ_krovak.c @@ -72,9 +72,9 @@ FORWARD(e_forward); /* ellipsoid */ double gfi, u, fi0, deltav, s, d, eps, ro; - s45 = 0.785398163397448; /* 45° */ + s45 = 0.785398163397448; /* 45deg */ s90 = 2 * s45; - fi0 = P->phi0; /* Latitude of projection centre 49° 30' */ + fi0 = P->phi0; /* Latitude of projection centre 49deg 30' */ /* Ellipsoid is used as Parameter in for.c and inv.c, therefore a must be set to 1 here. @@ -96,7 +96,7 @@ FORWARD(e_forward); /* ellipsoid */ k1 = P->k0; n0 = a * sqrt(1. - e2) / (1. - e2 * pow(sin(fi0), 2)); - s0 = 1.37008346281555; /* Latitude of pseudo standard parallel 78° 30'00" N */ + s0 = 1.37008346281555; /* Latitude of pseudo standard parallel 78deg 30'00" N */ n = sin(s0); ro0 = k1 * n0 / tan(s0); ad = s90 - uq; @@ -138,9 +138,9 @@ INVERSE(e_inverse); /* ellipsoid */ double u, deltav, s, d, eps, ro, fi1, xy0; int ok; - s45 = 0.785398163397448; /* 45° */ + s45 = 0.785398163397448; /* 45deg */ s90 = 2 * s45; - fi0 = P->phi0; /* Latitude of projection centre 49° 30' */ + fi0 = P->phi0; /* Latitude of projection centre 49deg 30' */ /* Ellipsoid is used as Parameter in for.c and inv.c, therefore a must @@ -162,7 +162,7 @@ INVERSE(e_inverse); /* ellipsoid */ k1 = P->k0; n0 = a * sqrt(1. - e2) / (1. - e2 * pow(sin(fi0), 2)); - s0 = 1.37008346281555; /* Latitude of pseudo standard parallel 78° 30'00" N */ + s0 = 1.37008346281555; /* Latitude of pseudo standard parallel 78deg 30'00" N */ n = sin(s0); ro0 = k1 * n0 / tan(s0); ad = s90 - uq; diff --git a/src/PJ_stere.c b/src/PJ_stere.c index 52ec1df1..a0524627 100644 --- a/src/PJ_stere.c +++ b/src/PJ_stere.c @@ -192,8 +192,6 @@ setup(PJ *P) { /* general initialization */ } break; case EQUIT: - P->akm1 = 2. * P->k0; - break; case OBLIQ: t = sin(P->phi0); X = 2. * atan(ssfn_(P->phi0, t, P->e)) - HALFPI; diff --git a/src/pj_init.c b/src/pj_init.c index 614af7fb..622e80bf 100644 --- a/src/pj_init.c +++ b/src/pj_init.c @@ -308,7 +308,7 @@ pj_init_plus_ctx( projCtx ctx, const char *definition ) char *argv[MAX_ARG]; char *defn_copy; int argc = 0, i, blank_count = 0; - PJ *result; + PJ *result = NULL; /* make a copy that we can manipulate */ defn_copy = (char *) pj_malloc( strlen(definition)+1 ); @@ -333,7 +333,7 @@ pj_init_plus_ctx( projCtx ctx, const char *definition ) if( argc+1 == MAX_ARG ) { pj_ctx_set_errno( ctx, -44 ); - return NULL; + goto bum_call; } argv[argc++] = defn_copy + i + 1; @@ -361,6 +361,7 @@ pj_init_plus_ctx( projCtx ctx, const char *definition ) /* perform actual initialization */ result = pj_init_ctx( ctx, argc, argv ); +bum_call: pj_dalloc( defn_copy ); return result; |
