瀏覽代碼

v.proj: +option for user-defined PROJ pipeline

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@72599 15284696-431f-4ddb-bdfa-cd5b030d7da7
Markus Metz 7 年之前
父節點
當前提交
4b4a3f9d24
共有 1 個文件被更改,包括 17 次插入0 次删除
  1. 17 0
      vector/v.proj/main.c

+ 17 - 0
vector/v.proj/main.c

@@ -47,6 +47,9 @@ int main(int argc, char *argv[])
     char date[40], mon[4];
     struct GModule *module;
     struct Option *omapopt, *mapopt, *isetopt, *ilocopt, *ibaseopt, *smax;
+#ifdef HAVE_PROJ_H
+    struct Option *pipeline;	/* name of custom PROJ pipeline */
+#endif
     struct Key_Value *in_proj_keys, *in_unit_keys;
     struct Key_Value *out_proj_keys, *out_unit_keys;
     struct line_pnts *Points, *Points2;
@@ -108,6 +111,14 @@ int main(int argc, char *argv[])
     omapopt->description = _("Name for output vector map (default: input)");
     omapopt->guisection = _("Target");
 
+#ifdef HAVE_PROJ_H
+    pipeline = G_define_option();
+    pipeline->key = "pipeline";
+    pipeline->type = TYPE_STRING;
+    pipeline->required = NO;
+    pipeline->description = _("PROJ pipeline for coordinate transformation");
+#endif
+
     flag.list = G_define_flag();
     flag.list->key = 'l';
     flag.list->description = _("List vector maps in input mapset and exit");
@@ -271,6 +282,12 @@ int main(int argc, char *argv[])
 	pj_print_proj_params(&info_in, &info_out);
     }
 
+    info_trans.def = NULL;
+#ifdef HAVE_PROJ_H
+    if (pipeline->answer) {
+	info_trans.def = G_store(pipeline->answer);
+    }
+#endif
     if (GPJ_init_transform(&info_in, &info_out, &info_trans) < 0)
 	G_fatal_error(_("Unable to initialize coordinate transformation"));