[GRASS-SVN] r70188 - in grass/branches/releasebranch_7_2: general/g.parser include lib/gis raster/r.in.ascii raster/r.in.lidar raster/r.in.poly raster/r.in.xyz raster/r.slope.aspect scripts/r.plane

svn_grass at osgeo.org svn_grass at osgeo.org
Sun Jan 1 12:52:50 PST 2017


Author: neteler
Date: 2017-01-01 12:52:50 -0800 (Sun, 01 Jan 2017)
New Revision: 70188

Modified:
   grass/branches/releasebranch_7_2/general/g.parser/standard_option.c
   grass/branches/releasebranch_7_2/include/gis.h
   grass/branches/releasebranch_7_2/lib/gis/parser_standard_options.c
   grass/branches/releasebranch_7_2/raster/r.in.ascii/main.c
   grass/branches/releasebranch_7_2/raster/r.in.lidar/main.c
   grass/branches/releasebranch_7_2/raster/r.in.poly/main.c
   grass/branches/releasebranch_7_2/raster/r.in.xyz/main.c
   grass/branches/releasebranch_7_2/raster/r.slope.aspect/main.c
   grass/branches/releasebranch_7_2/scripts/r.plane/r.plane.py
Log:
parser: add standard option for 2D raster map type (trunk, r68867)

Modified: grass/branches/releasebranch_7_2/general/g.parser/standard_option.c
===================================================================
--- grass/branches/releasebranch_7_2/general/g.parser/standard_option.c	2017-01-01 20:37:35 UTC (rev 70187)
+++ grass/branches/releasebranch_7_2/general/g.parser/standard_option.c	2017-01-01 20:52:50 UTC (rev 70188)
@@ -22,6 +22,7 @@
                                   "G_OPT_R_COVER",
                                   "G_OPT_R_ELEV",
                                   "G_OPT_R_ELEVS",
+                                  "G_OPT_R_TYPE",
                                   "G_OPT_R_INTERP_TYPE",
                                   "G_OPT_R_BASENAME_INPUT",
                                   "G_OPT_R_BASENAME_OUTPUT",

Modified: grass/branches/releasebranch_7_2/include/gis.h
===================================================================
--- grass/branches/releasebranch_7_2/include/gis.h	2017-01-01 20:37:35 UTC (rev 70187)
+++ grass/branches/releasebranch_7_2/include/gis.h	2017-01-01 20:52:50 UTC (rev 70188)
@@ -237,6 +237,7 @@
     G_OPT_R_COVER,		/*!< old input cover raster map */
     G_OPT_R_ELEV,		/*!< old input elevation raster map */
     G_OPT_R_ELEVS,		/*!< old input elevation raster maps */
+    G_OPT_R_TYPE,               /*!< raster map type */
     G_OPT_R_INTERP_TYPE,        /*!< interpolation type */
     G_OPT_R_BASENAME_INPUT,     /*!< old input basename raster maps */
     G_OPT_R_BASENAME_OUTPUT,    /*!< new output basename raster maps */

Modified: grass/branches/releasebranch_7_2/lib/gis/parser_standard_options.c
===================================================================
--- grass/branches/releasebranch_7_2/lib/gis/parser_standard_options.c	2017-01-01 20:37:35 UTC (rev 70187)
+++ grass/branches/releasebranch_7_2/lib/gis/parser_standard_options.c	2017-01-01 20:52:50 UTC (rev 70188)
@@ -60,6 +60,7 @@
    - G_OPT_R_COVER
    - G_OPT_R_ELEV
    - G_OPT_R_ELEVS
+   - G_OPT_R_TYPE
    - G_OPT_R_INTERP_TYPE
    - G_OPT_R_BASENAME_INPUT
    - G_OPT_R_BASENAME_OUTPUT
@@ -325,6 +326,20 @@
 	Opt->gisprompt = "old,cell,raster";
 	Opt->description = _("Name of input elevation raster map(s)");
 	break;
+    case G_OPT_R_TYPE:
+        Opt->key = "type";
+        Opt->type = TYPE_STRING;
+        Opt->required = YES;
+        Opt->multiple = NO;
+        Opt->label = _("Type of raster map to be created");
+        Opt->description = _("Storage type for resultant raster map");
+        Opt->options = "CELL,FCELL,DCELL";
+        G_asprintf((char **) &(Opt->descriptions),
+                   "CELL;%s;FCELL;%s;DCELL;%s",
+                   _("Integer"),
+                   _("Single precision floating point"),
+                   _("Double precision floating point"));
+        break;
     case G_OPT_R_INTERP_TYPE:
         Opt->key = "method";
         Opt->type = TYPE_STRING;

Modified: grass/branches/releasebranch_7_2/raster/r.in.ascii/main.c
===================================================================
--- grass/branches/releasebranch_7_2/raster/r.in.ascii/main.c	2017-01-01 20:37:35 UTC (rev 70187)
+++ grass/branches/releasebranch_7_2/raster/r.in.ascii/main.c	2017-01-01 20:52:50 UTC (rev 70188)
@@ -80,14 +80,10 @@
 
     parm.output = G_define_standard_option(G_OPT_R_OUTPUT);
 
-    parm.type = G_define_option();
-    parm.type->key = "type";
-    parm.type->type = TYPE_STRING;
+    parm.type = G_define_standard_option(G_OPT_R_TYPE);
     parm.type->required = NO;
-    parm.type->options = "CELL,FCELL,DCELL";
-    parm.type->label = _("Storage type for resultant raster map");
     parm.type->description = _("Default: CELL for integer values, DCELL for floating-point values");
-    
+
     parm.title = G_define_option();
     parm.title->key = "title";
     parm.title->key_desc = "phrase";

Modified: grass/branches/releasebranch_7_2/raster/r.in.lidar/main.c
===================================================================
--- grass/branches/releasebranch_7_2/raster/r.in.lidar/main.c	2017-01-01 20:37:35 UTC (rev 70187)
+++ grass/branches/releasebranch_7_2/raster/r.in.lidar/main.c	2017-01-01 20:52:50 UTC (rev 70188)
@@ -169,13 +169,9 @@
                _("Skewness of point values in cell"),
                _("Trimmed mean of point values in cell"));
 
-    type_opt = G_define_option();
-    type_opt->key = "type";
-    type_opt->type = TYPE_STRING;
+    type_opt = G_define_standard_option(G_OPT_R_TYPE);
     type_opt->required = NO;
-    type_opt->options = "CELL,FCELL,DCELL";
     type_opt->answer = "FCELL";
-    type_opt->description = _("Storage type for resultant raster map");
 
     base_raster_opt = G_define_standard_option(G_OPT_R_INPUT);
     base_raster_opt->key = "base_raster";

Modified: grass/branches/releasebranch_7_2/raster/r.in.poly/main.c
===================================================================
--- grass/branches/releasebranch_7_2/raster/r.in.poly/main.c	2017-01-01 20:37:35 UTC (rev 70187)
+++ grass/branches/releasebranch_7_2/raster/r.in.poly/main.c	2017-01-01 20:52:50 UTC (rev 70188)
@@ -49,12 +49,8 @@
     title->required = NO;
     title->description = _("Title for resultant raster map");
 
-    type = G_define_option();
-    type->key = "type";
-    type->type = TYPE_STRING;
+    type = G_define_standard_option(G_OPT_R_TYPE);
     type->required = NO;
-    type->description = _("Output raster type");
-    type->options = "CELL,FCELL,DCELL";
     type->answer = "CELL";
 
     nulls = G_define_option();

Modified: grass/branches/releasebranch_7_2/raster/r.in.xyz/main.c
===================================================================
--- grass/branches/releasebranch_7_2/raster/r.in.xyz/main.c	2017-01-01 20:37:35 UTC (rev 70187)
+++ grass/branches/releasebranch_7_2/raster/r.in.xyz/main.c	2017-01-01 20:52:50 UTC (rev 70188)
@@ -180,13 +180,9 @@
     method_opt->answer = "mean";
     method_opt->guisection = _("Statistic");
 
-    type_opt = G_define_option();
-    type_opt->key = "type";
-    type_opt->type = TYPE_STRING;
+    type_opt = G_define_standard_option(G_OPT_R_TYPE);
     type_opt->required = NO;
-    type_opt->options = "CELL,FCELL,DCELL";
     type_opt->answer = "FCELL";
-    type_opt->description = _("Storage type for resultant raster map");
 
     delim_opt = G_define_standard_option(G_OPT_F_SEP);
     delim_opt->guisection = _("Input");

Modified: grass/branches/releasebranch_7_2/raster/r.slope.aspect/main.c
===================================================================
--- grass/branches/releasebranch_7_2/raster/r.slope.aspect/main.c	2017-01-01 20:37:35 UTC (rev 70187)
+++ grass/branches/releasebranch_7_2/raster/r.slope.aspect/main.c	2017-01-01 20:52:50 UTC (rev 70188)
@@ -180,11 +180,10 @@
     parm.slope_fmt->description = _("Format for reporting the slope");
     parm.slope_fmt->guisection = _("Settings");
 
-    parm.out_precision = G_define_option();
+    parm.out_precision = G_define_standard_option(G_OPT_R_TYPE);
     parm.out_precision->key = "precision";
-    parm.out_precision->type = TYPE_STRING;
-    parm.out_precision->options = "CELL,FCELL,DCELL";
-    parm.out_precision->description =
+    parm.out_precision->required = NO;
+    parm.out_precision->label =
 	_("Type of output aspect and slope maps");
     parm.out_precision->answer = "FCELL";
     parm.out_precision->guisection = _("Settings");

Modified: grass/branches/releasebranch_7_2/scripts/r.plane/r.plane.py
===================================================================
--- grass/branches/releasebranch_7_2/scripts/r.plane/r.plane.py	2017-01-01 20:37:35 UTC (rev 70187)
+++ grass/branches/releasebranch_7_2/scripts/r.plane/r.plane.py	2017-01-01 20:52:50 UTC (rev 70188)
@@ -57,12 +57,9 @@
 #% description: Elevation coordinate of a point on the plane
 #% required : yes
 #%end
-#%option
-#% key: type
-#% type: string
-#% options: CELL,FCELL,DCELL
-#% description: Type of raster map to be created
+#%option G_OPT_R_TYPE
 #% answer: FCELL
+#% required: no
 #%end
 
 import math



More information about the grass-commit mailing list