[GRASS-SVN] r29780 - grass/trunk/vector/v.to.rast
svn_grass at osgeo.org
svn_grass at osgeo.org
Mon Jan 21 09:50:10 EST 2008
Author: martinl
Date: 2008-01-21 09:50:10 -0500 (Mon, 21 Jan 2008)
New Revision: 29780
Modified:
grass/trunk/vector/v.to.rast/do_areas.c
grass/trunk/vector/v.to.rast/main.c
grass/trunk/vector/v.to.rast/support.c
grass/trunk/vector/v.to.rast/vect2rast.c
Log:
v.to.rast: Use standardized options, message standardization.
Modified: grass/trunk/vector/v.to.rast/do_areas.c
===================================================================
--- grass/trunk/vector/v.to.rast/do_areas.c 2008-01-21 14:46:48 UTC (rev 29779)
+++ grass/trunk/vector/v.to.rast/do_areas.c 2008-01-21 14:50:10 UTC (rev 29780)
@@ -65,7 +65,7 @@
if (Vect_get_area_points (Map, list[i].index, Points) <= 0)
{
- G_warning (_("Get area [%d] failed"), list[i].index);
+ G_warning (_("Get area %d failed"), list[i].index);
return -1;
}
Modified: grass/trunk/vector/v.to.rast/main.c
===================================================================
--- grass/trunk/vector/v.to.rast/main.c 2008-01-21 14:46:48 UTC (rev 29779)
+++ grass/trunk/vector/v.to.rast/main.c 2008-01-21 14:50:10 UTC (rev 29780)
@@ -48,12 +48,12 @@
use_opt->multiple = NO;
use_opt->options = "attr,cat,val,z,dir";
use_opt->answer = "attr";
- use_opt->description = _("Source of raster values:\n"
- "\t\tattr - read values from attribute table\n"
- "\t\tcat - use category values\n"
- "\t\tval - use value specified by value option\n"
- "\t\tz - use z coordinate (points or contours only)\n"
- "\t\tdir - output as flow direction (lines only)");
+ use_opt->description = _("Source of raster values");
+ use_opt->descriptions = _("attr;read values from attribute table;"
+ "cat;use category values;"
+ "val;use value specified by value option;"
+ "z;use z coordinate (points or contours only);"
+ "dir;output as flow direction (lines only)");
type_opt = G_define_standard_option(G_OPT_V_TYPE);
type_opt -> options = "point,line,area";
@@ -62,13 +62,9 @@
field_opt = G_define_standard_option(G_OPT_V_FIELD);
/* for GRASS 7, IMHO this should be changed to "attrcolumn" */
- col = G_define_option();
- col->key = "column";
- col->type = TYPE_STRING;
- col->key_desc = "name";
- col->required = NO;
- col->multiple = NO;
+ col = G_define_standard_option(G_OPT_COLUMN);
col->description = _("Name of column for attr parameter (data type must be numeric)");
+ col->guisection = _("Attributes");
val_opt = G_define_option();
val_opt->key = "value";
@@ -86,19 +82,15 @@
rows->answer = "4096";
rows->description = _("Number of rows to hold in memory");
- rgbcol_opt = G_define_option();
+ rgbcol_opt = G_define_standard_option(G_OPT_COLUMN);
rgbcol_opt->key = "rgbcolumn";
- rgbcol_opt->type = TYPE_STRING ;
- rgbcol_opt->required = NO ;
- rgbcol_opt->multiple = NO ;
rgbcol_opt->description= _("Name of color definition column (with RRR:GGG:BBB entries)");
+ rgbcol_opt->guisection = _("Attributes");
- label_opt = G_define_option();
+ label_opt = G_define_standard_option(G_OPT_COLUMN);
label_opt->key = "labelcolumn";
- label_opt->type = TYPE_STRING ;
- label_opt->required = NO ;
- label_opt->multiple = NO ;
label_opt->description= _("Name of column used as raster category labels");
+ label_opt->guisection = _("Attributes");
if (G_parser (argc, argv))
exit(EXIT_FAILURE);
Modified: grass/trunk/vector/v.to.rast/support.c
===================================================================
--- grass/trunk/vector/v.to.rast/support.c 2008-01-21 14:46:48 UTC (rev 29779)
+++ grass/trunk/vector/v.to.rast/support.c 2008-01-21 14:50:10 UTC (rev 29780)
@@ -123,17 +123,18 @@
db_CatValArray_init ( &cvarr );
if ((Fi = Vect_get_field (&Map, field)) == NULL)
- G_fatal_error (_("Unable to get layer info for vector map"));
+ G_fatal_error (_("Database connection not defined for layer %d"),
+ field);
if ((Driver = db_start_driver_open_database (Fi->driver, Fi->database)) == NULL)
G_fatal_error (_("Unable to open database <%s> by driver <%s>"), Fi->database, Fi->driver);
/* get number of records in attr_column */
if ((nrec = db_select_CatValArray (Driver, Fi->table, Fi->key, attr_column , NULL, &cvarr)) == -1)
- G_fatal_error (_("Unknown column '%s' in table '%s'"), attr_column, Fi->table);
+ G_fatal_error (_("Unknown column <%s> in table <%s>"), attr_column, Fi->table);
if (nrec < 0)
- G_fatal_error (_("No records selected from table '%s'"), Fi->table);
+ G_fatal_error (_("No records selected from table <%s>"), Fi->table);
G_debug (3, "nrec = %d", nrec );
@@ -257,7 +258,8 @@
db_CatValArray_init (&cvarr);
if (!(Fi = Vect_get_field (&Map, field)))
- G_fatal_error (_("Unable to get layer info for vector map"));
+ G_fatal_error (_("Database connection not defined for layer %d"),
+ field);
if (!(Driver = db_start_driver_open_database (Fi->driver, Fi->database)))
G_fatal_error (_("Unable to open database <%s> by driver <%s>"),
@@ -265,11 +267,11 @@
/* get number of records in label_column */
if ((nrec = db_select_CatValArray (Driver, Fi->table, Fi->key, attr_column, NULL, &cvarr)) == -1)
- G_fatal_error (_("Unknown column '%s' in table '%s'"),
+ G_fatal_error (_("Unknown column <%s> in table <%s>"),
attr_column, Fi->table);
if (nrec < 0)
- G_fatal_error (_("No records selected from table '%s'"), Fi->table);
+ G_fatal_error (_("No records selected from table <%s>"), Fi->table);
G_debug (3, "nrec = %d", nrec );
@@ -317,7 +319,8 @@
db_set_string (&my_labels_rules[i].label, db_get_value_string (&value));
break;
default:
- G_warning (_("Column type [%d] not supported"), col_type);
+ G_warning (_("Column type (%s) not supported"),
+ db_sqltype_name(col_type));
}
/* add the raster category to label */
@@ -464,7 +467,7 @@
G_close_cell (fd);
if (G_write_cats (rast_name, &rast_cats) <= 0)
- G_warning (_("Unable to write categories for map <%s>"), rast_name);
+ G_warning (_("Unable to write categories for raster map <%s>"), rast_name);
G_free_cats (&rast_cats);
return 1;
Modified: grass/trunk/vector/v.to.rast/vect2rast.c
===================================================================
--- grass/trunk/vector/v.to.rast/vect2rast.c 2008-01-21 14:46:48 UTC (rev 29779)
+++ grass/trunk/vector/v.to.rast/vect2rast.c 2008-01-21 14:50:10 UTC (rev 29780)
@@ -41,14 +41,15 @@
Vect_open_old (&Map, vector_map, vector_mapset);
if ( (use == USE_Z) && !(Vect_is_3d(&Map)) )
- G_fatal_error (_("Vector map is not 3D"));
+ G_fatal_error (_("Vector map <%s> is not 3D"), Vect_get_full_name(&Map));
switch (use)
{
case USE_ATTR:
db_CatValArray_init ( &cvarr );
if (!(Fi = Vect_get_field (&Map, field)))
- G_fatal_error (_("Unable to get layer info for vector map"));
+ G_fatal_error (_("Database connection not defined for layer %d"),
+ field);
if ((Driver = db_start_driver_open_database ( Fi->driver, Fi->database)) == NULL)
G_fatal_error (_("Unable to open database <%s> by driver <%s>"), Fi->database, Fi->driver);
@@ -61,11 +62,12 @@
ctype = cvarr.ctype;
if ( ctype != DB_C_TYPE_INT && ctype != DB_C_TYPE_DOUBLE )
- G_fatal_error (_("Column type [%s] not supported (did you mean 'labelcolumn'?)"),
- db_sqltype_name(ctype));
+ G_fatal_error (_("Column type (%s) not supported (did you mean 'labelcolumn'?)"),
+ db_sqltype_name(ctype));
if ( nrec < 0 )
- G_fatal_error (_("Cannot select data from table"));
+ G_fatal_error (_("No records selected from table <%s>"),
+ Fi->table);
G_debug (1, "%d records selected from table", nrec);
@@ -90,7 +92,7 @@
format = USE_DCELL;
break;
default:
- G_fatal_error (_("Unable to use column '%s'"), column);
+ G_fatal_error (_("Unable to use column <%s>"), column);
break;
}
break;
More information about the grass-commit
mailing list