aboutsummaryrefslogtreecommitdiff
path: root/src/pj_pr_list.c
diff options
context:
space:
mode:
authorFrank Warmerdam <warmerdam@pobox.com>2002-06-11 18:08:25 +0000
committerFrank Warmerdam <warmerdam@pobox.com>2002-06-11 18:08:25 +0000
commit3913cfa1776f3fe00ebc4bf56575371f23566948 (patch)
treed0158208e1ff39587dc21b91ef3a2394d72ab424 /src/pj_pr_list.c
parent4fdaec4c618a7542355ea5eee6d91b42c6806e70 (diff)
downloadPROJ-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/pj_pr_list.c')
-rw-r--r--src/pj_pr_list.c40
1 files changed, 40 insertions, 0 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;
+}