|
@@ -70,10 +70,10 @@ int IL_vector_input_data_2d(struct interp_params *params, struct Map_info *Map,
|
|
|
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 @@ int IL_vector_input_data_2d(struct interp_params *params, struct Map_info *Map,
|
|
|
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 @@ int IL_vector_input_data_2d(struct interp_params *params, struct Map_info *Map,
|
|
|
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 @@ int IL_vector_input_data_2d(struct interp_params *params, struct Map_info *Map,
|
|
|
}
|
|
|
|
|
|
/* 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 @@ int IL_vector_input_data_2d(struct interp_params *params, struct Map_info *Map,
|
|
|
&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 @@ int IL_vector_input_data_2d(struct interp_params *params, struct Map_info *Map,
|
|
|
}
|
|
|
|
|
|
/* 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 @@ int IL_vector_input_data_2d(struct interp_params *params, struct Map_info *Map,
|
|
|
&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 @@ int IL_vector_input_data_2d(struct interp_params *params, struct Map_info *Map,
|
|
|
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 @@ int IL_vector_input_data_2d(struct interp_params *params, struct Map_info *Map,
|
|
|
|
|
|
if (!once) {
|
|
|
once = 1;
|
|
|
- G_warning(_("strip exists with insufficient data"));
|
|
|
+ G_warning(_("Strip exists with insufficient data"));
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -328,12 +324,11 @@ int IL_vector_input_data_2d(struct interp_params *params, struct Map_info *Map,
|
|
|
|
|
|
/* 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 @@ int IL_vector_input_data_2d(struct interp_params *params, struct Map_info *Map,
|
|
|
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 @@ int IL_vector_input_data_2d(struct interp_params *params, struct Map_info *Map,
|
|
|
"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 @@ int process_point(double x, double y, double z, double sm, struct tree_info *inf
|
|
|
|
|
|
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 @@ int process_point(double x, double y, double z, double sm, struct tree_info *inf
|
|
|
(*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);
|