[GRASS-SVN] r56223 - grass/trunk/vector/v.drape

svn_grass at osgeo.org svn_grass at osgeo.org
Sun May 12 10:15:27 PDT 2013


Author: martinl
Date: 2013-05-12 10:15:27 -0700 (Sun, 12 May 2013)
New Revision: 56223

Modified:
   grass/trunk/vector/v.drape/main.c
Log:
v.drape: use G_OPT_R_INTERP_TYPE & Rast_option_to_interp_type


Modified: grass/trunk/vector/v.drape/main.c
===================================================================
--- grass/trunk/vector/v.drape/main.c	2013-05-12 17:12:15 UTC (rev 56222)
+++ grass/trunk/vector/v.drape/main.c	2013-05-12 17:15:27 UTC (rev 56223)
@@ -114,8 +114,7 @@
     struct GModule *module;
     struct Option *in_opt, *out_opt, *type_opt, *rast_opt, *method_opt,
 	*scale_opt, *where_opt, *layer_opt, *null_opt;
-    char *desc;
-
+    
     struct Map_info In, Out;
     struct line_pnts *Points;
     struct line_cats *Cats;
@@ -159,20 +158,8 @@
     
     out_opt = G_define_standard_option(G_OPT_V_OUTPUT);
 
-    method_opt = G_define_option();
-    method_opt->key = "method";
-    method_opt->type = TYPE_STRING;
-    method_opt->required = NO;
-    method_opt->multiple = NO;
-    method_opt->options = "nearest,bilinear,cubic";
+    method_opt = G_define_standard_option(G_OPT_R_INTERP_TYPE);
     method_opt->answer = "nearest";
-    desc = NULL;
-    G_asprintf(&desc,
-	       "nearest;%s;bilinear;%s;cubic;%s",
-	       _("nearest neighbor"),
-	       _("bilinear interpolation"),
-	       _("cubic convolution interpolation"));
-    method_opt->descriptions = desc;
     method_opt->description = _("Sampling method");
     
     scale_opt = G_define_option();
@@ -197,14 +184,8 @@
 	null_val = atof(null_opt->answer);
 
     /* which interpolation method should we use */
-    if (method_opt->answer[0] == 'b')
-	method = BILINEAR;
-    else if (method_opt->answer[0] == 'c')
-	method = CUBIC;
-    else {
-	method = NEAREST;
-    }
-
+    method = Rast_option_to_interp_type(method_opt);
+    
     /* setup the region */
     G_get_window(&window);
 



More information about the grass-commit mailing list