diff options
| author | Frank Warmerdam <warmerdam@pobox.com> | 2002-06-11 18:08:25 +0000 |
|---|---|---|
| committer | Frank Warmerdam <warmerdam@pobox.com> | 2002-06-11 18:08:25 +0000 |
| commit | 3913cfa1776f3fe00ebc4bf56575371f23566948 (patch) | |
| tree | d0158208e1ff39587dc21b91ef3a2394d72ab424 /src | |
| parent | 4fdaec4c618a7542355ea5eee6d91b42c6806e70 (diff) | |
| download | PROJ-3913cfa1776f3fe00ebc4bf56575371f23566948.tar.gz PROJ-3913cfa1776f3fe00ebc4bf56575371f23566948.zip | |
Added the pj_get_def() function
git-svn-id: http://svn.osgeo.org/metacrs/proj/trunk@1017 4e78687f-474d-0410-85f9-8d5e500ac6b2
Diffstat (limited to 'src')
| -rw-r--r-- | src/pj_pr_list.c | 40 | ||||
| -rw-r--r-- | src/proj.def | 5 | ||||
| -rw-r--r-- | src/proj_api.h | 6 |
3 files changed, 49 insertions, 2 deletions
diff --git a/src/pj_pr_list.c b/src/pj_pr_list.c index e4feeda6..f7a62344 100644 --- a/src/pj_pr_list.c +++ b/src/pj_pr_list.c @@ -46,3 +46,43 @@ pj_pr_list(PJ *P) { (void)pr_list(P, 1); } } + +/************************************************************************/ +/* pj_get_def() */ +/* */ +/* Returns the PROJ.4 command string that would produce this */ +/* definition expanded as much as possible. For instance, */ +/* +init= calls and +datum= defintions would be expanded. */ +/************************************************************************/ + +char *pj_get_def( PJ *P, int options ) + +{ + paralist *t; + int l; + char *definition; + int def_max = 10; + + definition = (char *) pj_malloc(def_max); + definition[0] = '\0'; + + for (t = P->params; t; t = t->next) + { + l = strlen(t->param) + 1; + if( strlen(definition) + l + 5 > def_max ) + { + char *def2; + + def_max = def_max * 2 + l + 5; + def2 = (char *) pj_malloc(def_max); + strcpy( def2, definition ); + pj_dalloc( definition ); + definition = def2; + } + + strcat( definition, " +" ); + strcat( definition, t->param ); + } + + return definition; +} diff --git a/src/proj.def b/src/proj.def index 702a6a31..c3b04244 100644 --- a/src/proj.def +++ b/src/proj.def @@ -1,5 +1,5 @@ LIBRARY PROJ -VERSION 1.1 +VERSION 1.2 EXPORTS pj_init @1 pj_fwd @2 @@ -16,5 +16,8 @@ EXPORTS pj_set_finder @13 pj_strerrno @14 pj_errno @15 + pj_get_def @16 + pj_dalloc @17 + diff --git a/src/proj_api.h b/src/proj_api.h index 3c6b6910..3adbd58e 100644 --- a/src/proj_api.h +++ b/src/proj_api.h @@ -28,6 +28,9 @@ ****************************************************************************** * * $Log$ + * Revision 1.6 2002/06/11 18:08:25 warmerda + * Added the pj_get_def() function + * * Revision 1.5 2002/01/09 14:36:22 warmerda * updated to 4.4.5 * @@ -58,7 +61,7 @@ extern "C" { #endif /* Try to update this every version! */ -#define PJ_VERSION 445 +#define PJ_VERSION 446 extern char const pj_release[]; /* global release id string */ @@ -105,6 +108,7 @@ void pj_free(projPJ); void pj_set_finder( const char *(*)(const char *) ); projPJ pj_init(int, char **); projPJ pj_init_plus(const char *); +char *pj_get_def(projPJ, int); projPJ pj_latlong_from_proj( projPJ ); void *pj_malloc(size_t); void pj_dalloc(void *); |
