[GRASS-SVN] r43638 -
grass/branches/releasebranch_6_4/lib/rst/interp_float
svn_grass at osgeo.org
svn_grass at osgeo.org
Wed Sep 22 16:25:03 EDT 2010
Author: neteler
Date: 2010-09-22 20:25:03 +0000 (Wed, 22 Sep 2010)
New Revision: 43638
Modified:
grass/branches/releasebranch_6_4/lib/rst/interp_float/interp2d.c
grass/branches/releasebranch_6_4/lib/rst/interp_float/output2d.c
grass/branches/releasebranch_6_4/lib/rst/interp_float/vinput2d.c
Log:
backport: fprintf -> G_warning() etc
Modified: grass/branches/releasebranch_6_4/lib/rst/interp_float/interp2d.c
===================================================================
--- grass/branches/releasebranch_6_4/lib/rst/interp_float/interp2d.c 2010-09-22 20:23:06 UTC (rev 43637)
+++ grass/branches/releasebranch_6_4/lib/rst/interp_float/interp2d.c 2010-09-22 20:25:03 UTC (rev 43638)
@@ -27,6 +27,7 @@
#include <math.h>
#include <unistd.h>
#include <grass/gis.h>
+#include <grass/glocale.h>
#include <grass/bitmap.h>
#include <grass/interpf.h>
@@ -115,13 +116,13 @@
if (!w) {
if (!(w = (double *)G_malloc(sizeof(double) * (params->KMAX2 + 9)))) {
- fprintf(stderr, "Cannot allocate w\n");
+ G_warning(_("Out of memory"));
return -1;
}
}
if (!w2) {
if (!(w2 = (double *)G_malloc(sizeof(double) * (params->KMAX2 + 9)))) {
- fprintf(stderr, "Cannot allocate w2\n");
+ G_warning(_("Out of memory"));
return -1;
}
}
@@ -208,22 +209,15 @@
if (!once) {
once = 1;
- fprintf(stderr, "WARNING:\n");
- fprintf(stderr,
- "Overshoot -- increase in tension suggested.\n");
- fprintf(stderr, "Overshoot occures at (%d,%d) cell\n",
- l, k);
- fprintf(stderr,
- "The z-value is %f,zmin is %f,zmax is %f\n",
- zz, zmin, zmax);
+ G_warning(_("Overshoot - increase in tension suggested. "
+ "Overshoot occures at (%d,%d) cell. "
+ "Z-value %f, zmin %f, zmax %f."),
+ l, k, zz, zmin, zmax);
}
}
-
-
+
params->az[l] = (FCELL) zz;
- /*
- * fprintf(stderr,"%f ",zz);
- */
+
if (cond1) {
params->adx[l] = (FCELL) (-dx * tfsta2);
params->ady[l] = (FCELL) (-dy * tfsta2);
Modified: grass/branches/releasebranch_6_4/lib/rst/interp_float/output2d.c
===================================================================
--- grass/branches/releasebranch_6_4/lib/rst/interp_float/output2d.c 2010-09-22 20:23:06 UTC (rev 43637)
+++ grass/branches/releasebranch_6_4/lib/rst/interp_float/output2d.c 2010-09-22 20:25:03 UTC (rev 43638)
@@ -19,6 +19,7 @@
#include <grass/bitmap.h>
#include <grass/linkm.h>
+#include <grass/glocale.h>
#include <grass/interpf.h>
@@ -121,8 +122,8 @@
ncols = cellhd->cols;
if (ncols != params->nsizc) {
- fprintf(stderr, "first change your cols number to nsizc! %d %d\n",
- ncols, params->nsizc);
+ G_warning(_("First change your cols number to nsizc %d %d"),
+ ncols, params->nsizc);
return -1;
}
@@ -587,8 +588,7 @@
G_short_history(params->elev, type, &hist);
params->dmin = sqrt(params->dmin);
- fprintf(stdout, "history initiated\n");
- fflush(stdout);
+
/*
* sprintf (hist.edhist[0], "tension=%f, smoothing=%f", params->fi *
* dnorm / 1000., params->rsm);
Modified: grass/branches/releasebranch_6_4/lib/rst/interp_float/vinput2d.c
===================================================================
--- grass/branches/releasebranch_6_4/lib/rst/interp_float/vinput2d.c 2010-09-22 20:23:06 UTC (rev 43637)
+++ grass/branches/releasebranch_6_4/lib/rst/interp_float/vinput2d.c 2010-09-22 20:25:03 UTC (rev 43638)
@@ -70,10 +70,10 @@
Cats = Vect_new_cats_struct();
if (field == 0 && !Vect_is_3d(Map))
- G_fatal_error(_("Vector is not 3D"));
+ G_fatal_error(_("Vector map <%s> is not 3D"), Vect_get_full_name(Map));
if (field > 0 && zcol != NULL) { /* open db driver */
- G_message(_("Loading data from attribute table ..."));
+ G_verbose_message(_("Loading data from attribute table ..."));
Fi = Vect_get_field(Map, field);
if (Fi == NULL)
G_fatal_error(_("Database connection not defined for layer %d"),
@@ -91,10 +91,10 @@
zctype = db_column_Ctype(driver, Fi->table, zcol);
G_debug(3, " zcol C type = %d", zctype);
if (zctype == -1)
- G_fatal_error(_("Cannot find z column <%s> (please verify name, e.g. with v.info)"),
+ G_fatal_error(_("Column <%s> not found"),
zcol);
if (zctype != DB_C_TYPE_INT && zctype != DB_C_TYPE_DOUBLE)
- G_fatal_error(_("Column type of z column is not supported (must be integer or double)"));
+ G_fatal_error(_("Data type of column <%s> must be numeric"), zcol);
db_CatValArray_init(&zarray);
G_debug(3, "RST SQL WHERE: %s", params->wheresql);
@@ -105,11 +105,9 @@
sctype = db_column_Ctype(driver, Fi->table, scol);
G_debug(3, " scol C type = %d", sctype);
if (sctype == -1)
- G_fatal_error(_("Cannot read column type of smooth column"));
- if (sctype == DB_C_TYPE_DATETIME)
- G_fatal_error(_("Column type of smooth column (datetime) is not supported"));
+ G_fatal_error(_("Column <%s> not found"), scol);
if (sctype != DB_C_TYPE_INT && sctype != DB_C_TYPE_DOUBLE)
- G_fatal_error(_("Column type of s column is not supported (must be integer or double)"));
+ G_fatal_error(_("Data type of column <%s> must be numeric"), scol);
db_CatValArray_init(&sarray);
db_select_CatValArray(driver, Fi->table, Fi->key, scol,
@@ -120,14 +118,14 @@
}
/* Lines without nodes */
- G_message(_("Reading lines from vector map ... "));
+ G_message(_("Reading features from vector map ..."));
sm = 0;
line = 1;
while ((ltype = Vect_read_next_line(Map, Points, Cats)) != -2) {
if (!(ltype & (GV_POINT | GV_LINE | GV_BOUNDARY)))
continue;
-
+
if (field > 0) { /* use cat or attribute */
Vect_cat_get(Cats, field, &cat);
@@ -170,8 +168,7 @@
&sm);
}
if (sm < 0.0)
- G_fatal_error
- ("Negative value of smoothing detected: sm must be >= 0");
+ G_fatal_error(_("Negative value of smoothing detected: sm must be >= 0"));
}
G_debug(5, " z = %f sm = %f", z, sm);
}
@@ -233,11 +230,11 @@
}
/* Process all nodes */
- G_message(_("Reading nodes from vector map ... "));
+ G_message(_("Reading nodes from vector map ..."));
nnodes = Vect_get_num_nodes(Map);
for (k1 = 1; k1 <= nnodes; k1++) {
G_debug(5, " node %d", k1);
- G_percent(k1, nnodes - 1, 1);
+ G_percent(k1, nnodes, 1);
Vect_get_node_coor(Map, k1, &x1, &y1, &z);
/* TODO: check more lines ? */
@@ -288,8 +285,7 @@
&sm);
}
if (sm < 0.0)
- G_fatal_error
- ("Negative value of smoothing detected: sm must be >= 0");
+ G_fatal_error(_("Negative value of smoothing detected: sm must be >= 0"));
}
G_debug(5, " z = %f sm = %f", z, sm);
}
@@ -298,7 +294,7 @@
process_point(x1, y1, z, sm, info, params->zmult, xmin, xmax, ymin,
ymax, zmin, zmax, &npoint, &OUTRANGE, &k);
}
-
+
if (field > 0 && zcol != NULL)
db_CatValArray_free(&zarray);
if (scol != NULL) {
@@ -315,7 +311,7 @@
if (!once) {
once = 1;
- G_warning(_("strip exists with insufficient data"));
+ G_warning(_("Strip exists with insufficient data"));
}
}
@@ -328,12 +324,11 @@
/* G_read_vector_timestamp(name,mapset,ts); */
- fprintf(stderr, "\n");
if (OUTRANGE > 0)
- G_warning(_("there are points outside specified 2D/3D region--ignored %d points"),
+ G_warning(_("There are points outside specified 2D/3D region - %d points ignored"),
OUTRANGE);
if (npoint > 0)
- G_warning(_("ignoring %d points -- too dense"), npoint);
+ G_important_message(_("Ignoring %d points (too dense)"), npoint);
npoint = k - npoint - OUTRANGE;
if (npoint < params->kmin) {
if (npoint != 0) {
@@ -342,16 +337,14 @@
params->kmin = npoint;
}
else {
- fprintf(stderr, "ERROR2: zero points in the given region!\n");
+ G_warning(_("Zero points in the given region"));
return -1;
}
}
if (npoint > params->KMAX2 && params->kmin <= params->kmax) {
- fprintf(stderr,
- "ERROR: segmentation parameters set to invalid values: npmin= %d, segmax= %d \n",
- params->kmin, params->kmax);
- fprintf(stderr,
- "for smooth connection of segments, npmin > segmax (see manual) \n");
+ G_warning(_("Segmentation parameters set to invalid values: npmin= %d, segmax= %d "
+ "for smooth connection of segments, npmin > segmax (see manual)"),
+ params->kmin, params->kmax);
return -1;
}
if (npoint < params->KMAX2 && params->kmax != params->KMAX2)
@@ -359,12 +352,11 @@
"segmentation is necessary, to run the program faster set "
"segmax=%d (see manual)"), params->KMAX2, params->KMAX2);
- fprintf(stdout, "\n");
- fprintf(stdout, "The number of points from vector map is %d\n", k);
- fprintf(stdout, "The number of points outside of 2D/3D region %d\n",
- OUTRANGE);
- fprintf(stdout, "The number of points being used is %d\n", npoint);
- fflush(stdout);
+ G_message(_("Number of points from vector map %d"), k);
+ G_verbose_message(_("Number of points outside of 2D/3D region %d"),
+ OUTRANGE);
+ G_message(_("Number of points being used %d"), npoint);
+
*n_points = npoint;
return (totsegm);
}
@@ -396,13 +388,13 @@
if (!((c1 >= 0) && (c2 >= 0) && (c3 >= 0) && (c4 >= 0))) {
if (!(*OUTRANGE)) {
- G_warning(_("some points outside of region -- will ignore..."));
+ G_warning(_("Some points outside of region (ignored)"));
}
(*OUTRANGE)++;
}
else {
if (!(point = quad_point_new(x, y, z, sm))) {
- fprintf(stderr, "cannot allocate memory for point\n");
+ G_warning(_("Unable to allocate memory"));
return -1;
}
a = MT_insert(point, info, info->root, 4);
@@ -410,7 +402,7 @@
(*npoint)++;
}
if (a < 0) {
- fprintf(stderr, "cannot insert %f,%f,%f a = %d\n", x, y, z, a);
+ G_warning(_("Unable to insert %f,%f,%f a = %d"), x, y, z, a);
return -1;
}
free(point);
More information about the grass-commit
mailing list