[GRASS-SVN] r51208 - grass/trunk/raster/r.in.ascii
svn_grass at osgeo.org
svn_grass at osgeo.org
Fri Mar 30 13:54:00 EDT 2012
Author: martinl
Date: 2012-03-30 10:53:59 -0700 (Fri, 30 Mar 2012)
New Revision: 51208
Modified:
grass/trunk/raster/r.in.ascii/main.c
Log:
r.in.ascii: replace i/f/d flags by `type` option
Modified: grass/trunk/raster/r.in.ascii/main.c
===================================================================
--- grass/trunk/raster/r.in.ascii/main.c 2012-03-30 17:42:22 UTC (rev 51207)
+++ grass/trunk/raster/r.in.ascii/main.c 2012-03-30 17:53:59 UTC (rev 51208)
@@ -52,11 +52,11 @@
struct GModule *module;
struct
{
- struct Option *input, *output, *title, *mult, *nv;
+ struct Option *input, *output, *title, *mult, *nv, *type;
} parm;
struct
{
- struct Flag *i, *f, *d, *s;
+ struct Flag *s;
} flag;
char *null_val_str;
DCELL mult;
@@ -80,6 +80,14 @@
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->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";
@@ -103,21 +111,6 @@
parm.nv->label = _("String representing NULL value data cell");
parm.nv->guisection = _("NULL data");
- flag.i = G_define_flag();
- flag.i->key = 'i';
- flag.i->description = _("Integer values are imported");
- flag.i->guisection = _("Data type");
-
- flag.f = G_define_flag();
- flag.f->key = 'f';
- flag.f->description = _("Floating point values are imported");
- flag.f->guisection = _("Data type");
-
- flag.d = G_define_flag();
- flag.d->key = 'd';
- flag.d->description = _("Double floating point values are imported");
- flag.d->guisection = _("Data type");
-
flag.s = G_define_flag();
flag.s->key = 's';
flag.s->description =
@@ -145,16 +138,20 @@
null_val_str = parm.nv->answer;
data_type = -1;
- if (flag.i->answer) { /* interger data */
- data_type = CELL_TYPE;
+ if (parm.type->answer) {
+ switch(parm.type->answer[0]) {
+ case 'C':
+ data_type = CELL_TYPE;
+ break;
+ case 'F':
+ data_type = FCELL_TYPE;
+ break;
+ case 'D':
+ data_type = DCELL_TYPE;
+ break;
+ }
}
- if (flag.f->answer) { /* floating-point data */
- data_type = FCELL_TYPE;
- }
- if (flag.d->answer) { /* double data; overwrite others */
- data_type = DCELL_TYPE;
- }
-
+
if (strcmp(input, "-") == 0) {
Tmp_file = G_tempfile();
if (NULL == (Tmp_fd = fopen(Tmp_file, "w+")))
More information about the grass-commit
mailing list