[GRASS-SVN] r54544 - grass/trunk/raster/r.cost
svn_grass at osgeo.org
svn_grass at osgeo.org
Sun Jan 6 03:50:13 PST 2013
Author: martinl
Date: 2013-01-06 03:50:12 -0800 (Sun, 06 Jan 2013)
New Revision: 54544
Modified:
grass/trunk/raster/r.cost/main.c
Log:
r.cost: message cosmetics
fix -i flag
Modified: grass/trunk/raster/r.cost/main.c
===================================================================
--- grass/trunk/raster/r.cost/main.c 2013-01-06 11:23:12 UTC (rev 54543)
+++ grass/trunk/raster/r.cost/main.c 2013-01-06 11:50:12 UTC (rev 54544)
@@ -241,7 +241,7 @@
flag5 = G_define_flag();
flag5->key = 'i';
- flag5->description = _("Only print info about disk space and memory requirements");
+ flag5->description = _("Print info about disk space and memory requirements and exit");
/* Parse options */
if (G_parser(argc, argv))
@@ -401,18 +401,21 @@
mem_mb = (double) srows * scols * 24. / 1048576. * segments_in_memory;
mem_mb += nrows * ncols * 0.05 * 20. / 1048576.; /* for Dijkstra search */
}
- if (disk_mb > 200 || mem_mb > 200 || G_verbose() > G_verbose_std()) {
- G_message("--------------------------------------------");
- G_message(_("Will need at least %.2f MB of disk space"), disk_mb);
- G_message(_("Will need at least %.2f MB of memory"), mem_mb);
- G_message("--------------------------------------------");
- }
if (flag5->answer) {
+ fprintf(stdout, _("Will need at least %.2f MB of disk space"), disk_mb);
+ fprintf(stdout, "\n");
+ fprintf(stdout, _("Will need at least %.2f MB of memory"), mem_mb);
+ fprintf(stdout, "\n");
Rast_close(cost_fd);
exit(EXIT_SUCCESS);
}
+ G_verbose_message("--------------------------------------------");
+ G_verbose_message(_("Will need at least %.2f MB of disk space"), disk_mb);
+ G_verbose_message(_("Will need at least %.2f MB of memory"), mem_mb);
+ G_verbose_message("--------------------------------------------");
+
/* Create segmented format files for cost layer and output layer */
G_verbose_message(_("Creating some temporary files..."));
@@ -490,7 +493,7 @@
if (dir == TRUE) {
int i;
- G_message(_("Initializing directional output "));
+ G_message(_("Initializing directional output..."));
for (row = 0; row < nrows; row++) {
G_percent(row, nrows, 2);
@@ -512,7 +515,7 @@
struct line_cats *Cats;
struct bound_box box;
struct start_pt *new_start_pt;
- int cat, type, got_one = 0;
+ int cat, type, npoints = 0;
Points = Vect_new_line_struct();
Cats = Vect_new_cats_struct();
@@ -543,7 +546,7 @@
}
if (!Vect_point_in_box(Points->x[0], Points->y[0], 0, &box))
continue;
- got_one = 1;
+ npoints++;
col = (int)Rast_easting_to_col(Points->x[0], &window);
row = (int)Rast_northing_to_row(Points->y[0], &window);
@@ -568,10 +571,12 @@
}
}
+ if (npoints < 1)
+ G_fatal_error(_("No start points found in vector map <%s>"), Vect_get_full_name(&In));
+ else
+ G_verbose_message(_("%d points found"), npoints);
+
Vect_close(&In);
-
- if (!got_one)
- G_fatal_error(_("No start points found in vector <%s>"), opt7->answer);
}
/* read vector with stop points */
@@ -1031,7 +1036,7 @@
nearest_size = Rast_cell_size(nearest_data_type);
/* Copy segmented map to output map */
- G_message(_("Writing raster map <%s>..."), cum_cost_layer);
+ G_message(_("Writing output raster map <%s>..."), cum_cost_layer);
if (nearest_layer) {
G_message(_("Writing raster map with nearest start point <%s>..."), nearest_layer);
}
@@ -1127,7 +1132,7 @@
dir_fd = Rast_open_new(move_dir_layer, dir_data_type);
dir_cell = Rast_allocate_buf(dir_data_type);
- G_message(_("Writing movement direction file %s..."), move_dir_layer);
+ G_message(_("Writing output movement direction raster map <%s>..."), move_dir_layer);
for (row = 0; row < nrows; row++) {
p = dir_cell;
for (col = 0; col < ncols; col++) {
More information about the grass-commit
mailing list