[GRASS-SVN] r68867 - in grass/trunk: 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
Wed Jul 6 11:55:44 PDT 2016
Author: wenzeslaus
Date: 2016-07-06 11:55:44 -0700 (Wed, 06 Jul 2016)
New Revision: 68867
Modified:
grass/trunk/general/g.parser/standard_option.c
grass/trunk/include/gis.h
grass/trunk/lib/gis/parser_standard_options.c
grass/trunk/raster/r.in.ascii/main.c
grass/trunk/raster/r.in.lidar/main.c
grass/trunk/raster/r.in.poly/main.c
grass/trunk/raster/r.in.xyz/main.c
grass/trunk/raster/r.slope.aspect/main.c
grass/trunk/scripts/r.plane/r.plane.py
Log:
parser: add standard option for 2D raster map type
Modified: grass/trunk/general/g.parser/standard_option.c
===================================================================
--- grass/trunk/general/g.parser/standard_option.c 2016-07-06 18:18:31 UTC (rev 68866)
+++ grass/trunk/general/g.parser/standard_option.c 2016-07-06 18:55:44 UTC (rev 68867)
@@ -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/trunk/include/gis.h
===================================================================
--- grass/trunk/include/gis.h 2016-07-06 18:18:31 UTC (rev 68866)
+++ grass/trunk/include/gis.h 2016-07-06 18:55:44 UTC (rev 68867)
@@ -231,6 +231,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/trunk/lib/gis/parser_standard_options.c
===================================================================
--- grass/trunk/lib/gis/parser_standard_options.c 2016-07-06 18:18:31 UTC (rev 68866)
+++ grass/trunk/lib/gis/parser_standard_options.c 2016-07-06 18:55:44 UTC (rev 68867)
@@ -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/trunk/raster/r.in.ascii/main.c
===================================================================
--- grass/trunk/raster/r.in.ascii/main.c 2016-07-06 18:18:31 UTC (rev 68866)
+++ grass/trunk/raster/r.in.ascii/main.c 2016-07-06 18:55:44 UTC (rev 68867)
@@ -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/trunk/raster/r.in.lidar/main.c
===================================================================
--- grass/trunk/raster/r.in.lidar/main.c 2016-07-06 18:18:31 UTC (rev 68866)
+++ grass/trunk/raster/r.in.lidar/main.c 2016-07-06 18:55:44 UTC (rev 68867)
@@ -167,13 +167,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/trunk/raster/r.in.poly/main.c
===================================================================
--- grass/trunk/raster/r.in.poly/main.c 2016-07-06 18:18:31 UTC (rev 68866)
+++ grass/trunk/raster/r.in.poly/main.c 2016-07-06 18:55:44 UTC (rev 68867)
@@ -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/trunk/raster/r.in.xyz/main.c
===================================================================
--- grass/trunk/raster/r.in.xyz/main.c 2016-07-06 18:18:31 UTC (rev 68866)
+++ grass/trunk/raster/r.in.xyz/main.c 2016-07-06 18:55:44 UTC (rev 68867)
@@ -209,13 +209,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");
delim_opt = G_define_standard_option(G_OPT_F_SEP);
delim_opt->guisection = _("Input");
Modified: grass/trunk/raster/r.slope.aspect/main.c
===================================================================
--- grass/trunk/raster/r.slope.aspect/main.c 2016-07-06 18:18:31 UTC (rev 68866)
+++ grass/trunk/raster/r.slope.aspect/main.c 2016-07-06 18:55:44 UTC (rev 68867)
@@ -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/trunk/scripts/r.plane/r.plane.py
===================================================================
--- grass/trunk/scripts/r.plane/r.plane.py 2016-07-06 18:18:31 UTC (rev 68866)
+++ grass/trunk/scripts/r.plane/r.plane.py 2016-07-06 18:55:44 UTC (rev 68867)
@@ -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