diff options
| author | Frank Warmerdam <warmerdam@pobox.com> | 2003-03-17 19:45:23 +0000 |
|---|---|---|
| committer | Frank Warmerdam <warmerdam@pobox.com> | 2003-03-17 19:45:23 +0000 |
| commit | 2a88e1eb0e1ef7008b8c4786a1cc0a95cf33ec07 (patch) | |
| tree | 29da38d894a6ece2a997fdac227549ec386d2927 /src/pj_apply_gridshift.c | |
| parent | 94ca0e44c90cd828af224b4c3a27be7075d1898d (diff) | |
| download | PROJ-2a88e1eb0e1ef7008b8c4786a1cc0a95cf33ec07.tar.gz PROJ-2a88e1eb0e1ef7008b8c4786a1cc0a95cf33ec07.zip | |
improved error handling
git-svn-id: http://svn.osgeo.org/metacrs/proj/trunk@1102 4e78687f-474d-0410-85f9-8d5e500ac6b2
Diffstat (limited to 'src/pj_apply_gridshift.c')
| -rw-r--r-- | src/pj_apply_gridshift.c | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/src/pj_apply_gridshift.c b/src/pj_apply_gridshift.c index dbfddda7..19eb5954 100644 --- a/src/pj_apply_gridshift.c +++ b/src/pj_apply_gridshift.c @@ -31,6 +31,9 @@ ****************************************************************************** * * $Log$ + * Revision 1.7 2003/03/17 19:45:23 warmerda + * improved error handling + * * Revision 1.6 2003/03/17 18:56:34 warmerda * implement heirarchical NTv2 gridinfos * @@ -67,10 +70,14 @@ int pj_apply_gridshift( const char *nadgrids, int inverse, { int grid_count = 0; - PJ_GRIDINFO **tables = pj_gridlist_from_nadgrids( nadgrids, &grid_count); + PJ_GRIDINFO **tables; int i; int debug_flag = getenv( "PROJ_DEBUG" ) != NULL; + static int debug_count = 0; + + pj_errno = 0; + tables = pj_gridlist_from_nadgrids( nadgrids, &grid_count); if( tables == NULL || grid_count == 0 ) return pj_errno; @@ -82,13 +89,15 @@ int pj_apply_gridshift( const char *nadgrids, int inverse, input.phi = y[io]; input.lam = x[io]; + output.phi = HUGE_VAL; + output.lam = HUGE_VAL; /* keep trying till we find a table that works */ for( itable = 0; itable < grid_count; itable++ ) { PJ_GRIDINFO *gi = tables[itable]; struct CTABLE *ct = gi->ct; - + /* skip tables that don't match our point at all. */ if( ct->ll.phi > input.phi || ct->ll.lam > input.lam || ct->ll.phi + ct->lim.phi * ct->del.phi < input.phi @@ -130,16 +139,10 @@ int pj_apply_gridshift( const char *nadgrids, int inverse, output = nad_cvt( input, inverse, ct ); if( output.lam != HUGE_VAL ) { - if( debug_flag ) - { - static int debug_count = 0; - - if( debug_count < 20 ) - fprintf( stderr, - "pj_apply_gridshift(): used %s\n", - ct->id ); - } - + if( debug_flag && debug_count++ < 20 ) + fprintf( stderr, + "pj_apply_gridshift(): used %s\n", + ct->id ); break; } } |
