diff options
| author | Frank Warmerdam <warmerdam@pobox.com> | 2010-09-20 19:10:11 +0000 |
|---|---|---|
| committer | Frank Warmerdam <warmerdam@pobox.com> | 2010-09-20 19:10:11 +0000 |
| commit | 783043034627d9930f39a53a8a40fe7918b01e74 (patch) | |
| tree | f6aeb22bf514fa55c8c18e7a8e41d95375aed896 | |
| parent | f6fd69c3053963e5552ab1b98a7859b52f87430b (diff) | |
| download | PROJ-783043034627d9930f39a53a8a40fe7918b01e74.tar.gz PROJ-783043034627d9930f39a53a8a40fe7918b01e74.zip | |
use pj_log, fix bug with apply_vgridshift
git-svn-id: http://svn.osgeo.org/metacrs/proj/trunk@1903 4e78687f-474d-0410-85f9-8d5e500ac6b2
| -rw-r--r-- | src/pj_apply_vgridshift.c | 45 | ||||
| -rw-r--r-- | src/projects.h | 6 |
2 files changed, 32 insertions, 19 deletions
diff --git a/src/pj_apply_vgridshift.c b/src/pj_apply_vgridshift.c index fb35308c..d8f18e07 100644 --- a/src/pj_apply_vgridshift.c +++ b/src/pj_apply_vgridshift.c @@ -52,7 +52,6 @@ int pj_apply_vgridshift( PJ *defn, const char *listname, { int i; - int debug_flag = getenv( "PROJ_DEBUG" ) != NULL; static int debug_count = 0; PJ_GRIDINFO **tables; @@ -67,7 +66,7 @@ int pj_apply_vgridshift( PJ *defn, const char *listname, return defn->ctx->last_errno; } - if( tables == NULL || *gridlist_count_p == 0 ) + if( *gridlist_count_p == 0 ) { pj_ctx_set_errno( defn->ctx, -38); return -38; @@ -163,33 +162,41 @@ int pj_apply_vgridshift( PJ *defn, const char *listname, if( value != HUGE_VAL ) { - if( debug_flag && debug_count++ < 20 ) - fprintf( stderr, - "pj_apply_gridshift(): used %s\n", - ct->id ); + if( debug_count++ < 20 ) + pj_log( defn->ctx, PJ_LOG_DEBUG_MINOR, + "pj_apply_gridshift(): used %s", + ct->id ); break; } } if( value == HUGE_VAL ) { - if( debug_flag ) + char gridlist[3000]; + + pj_log( defn->ctx, PJ_LOG_DEBUG_MAJOR, + "pj_apply_vgridshift(): failed to find a grid shift table for\n" + " location (%.7fdW,%.7fdN)", + x[io] * RAD_TO_DEG, + y[io] * RAD_TO_DEG ); + + gridlist[0] = '\0'; + for( itable = 0; itable < *gridlist_count_p; itable++ ) { - fprintf( stderr, - "pj_apply_vgridshift(): failed to find a grid shift table for\n" - " location (%.7fdW,%.7fdN)\n", - x[io] * RAD_TO_DEG, - y[io] * RAD_TO_DEG ); - for( itable = 0; itable < *gridlist_count_p; itable++ ) + PJ_GRIDINFO *gi = tables[itable]; + if( strlen(gridlist) + strlen(gi->gridname) > sizeof(gridlist)-100 ) { - PJ_GRIDINFO *gi = tables[itable]; - if( itable == 0 ) - fprintf( stderr, " tried: %s", gi->gridname ); - else - fprintf( stderr, ",%s", gi->gridname ); + strcat( gridlist, "..." ); + break; } - fprintf( stderr, "\n" ); + + if( itable == 0 ) + sprintf( gridlist, " tried: %s", gi->gridname ); + else + sprintf( gridlist+strlen(gridlist), ",%s", gi->gridname ); } + pj_log( defn->ctx, PJ_LOG_DEBUG_MAJOR, + "%s", gridlist ); pj_ctx_set_errno( defn->ctx, PJD_ERR_GRID_AREA ); return PJD_ERR_GRID_AREA; diff --git a/src/projects.h b/src/projects.h index 2431b878..07fce9a4 100644 --- a/src/projects.h +++ b/src/projects.h @@ -418,6 +418,12 @@ void nad_free(struct CTABLE *); /* higher level handling of datum grid shift files */ +int pj_apply_vgridshift( PJ *defn, const char *listname, + PJ_GRIDINFO ***gridlist_p, + int *gridlist_count_p, + int inverse, + long point_count, int point_offset, + double *x, double *y, double *z ); int pj_apply_gridshift_2( PJ *defn, int inverse, long point_count, int point_offset, double *x, double *y, double *z ); |
