[GRASS-SVN] r35365 - grass/branches/develbranch_6/vector/v.to.rast

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Jan 12 09:57:05 EST 2009


Author: martinl
Date: 2009-01-12 09:57:05 -0500 (Mon, 12 Jan 2009)
New Revision: 35365

Modified:
   grass/branches/develbranch_6/vector/v.to.rast/do_areas.c
   grass/branches/develbranch_6/vector/v.to.rast/do_lines.c
   grass/branches/develbranch_6/vector/v.to.rast/main.c
   grass/branches/develbranch_6/vector/v.to.rast/raster.c
   grass/branches/develbranch_6/vector/v.to.rast/vect2rast.c
Log:
v.to.rast: be more verbose (percentage information)
	   (merge from relbr64, r35364)


Modified: grass/branches/develbranch_6/vector/v.to.rast/do_areas.c
===================================================================
--- grass/branches/develbranch_6/vector/v.to.rast/do_areas.c	2009-01-12 14:48:46 UTC (rev 35364)
+++ grass/branches/develbranch_6/vector/v.to.rast/do_areas.c	2009-01-12 14:57:05 UTC (rev 35365)
@@ -30,9 +30,11 @@
     if (nareas <= 0)
 	return 0;
 
+    G_message(_("Reading areas..."));
     for (i = 0; i < nareas; i++) {
 	/* Note: in old version (grass5.0) there was a check here if the current area 
 	 *        is identical to previous one. I don't see any reason for this in topological vectors */
+	G_percent(i, nareas, 2);
 	cat = list[i].cat;
 	G_debug(3, "Area cat = %d", cat);
 
@@ -79,7 +81,8 @@
 
 	G_plot_polygon(Points->x, Points->y, Points->n_points);
     }
-
+    G_percent(1, 1, 1);
+    
     return nareas;
 }
 

Modified: grass/branches/develbranch_6/vector/v.to.rast/do_lines.c
===================================================================
--- grass/branches/develbranch_6/vector/v.to.rast/do_lines.c	2009-01-12 14:48:46 UTC (rev 35364)
+++ grass/branches/develbranch_6/vector/v.to.rast/do_lines.c	2009-01-12 14:57:05 UTC (rev 35365)
@@ -32,7 +32,9 @@
     count = 0;
     *count_all = 0;
 
+    G_message(_("Reading features..."));
     for (index = 1; index <= nlines; index++) {
+	G_percent(index, nlines, 2);
 	type = Vect_read_line(Map, Points, Cats, index);
 	Vect_cat_get(Cats, field, &cat);
 

Modified: grass/branches/develbranch_6/vector/v.to.rast/main.c
===================================================================
--- grass/branches/develbranch_6/vector/v.to.rast/main.c	2009-01-12 14:48:46 UTC (rev 35364)
+++ grass/branches/develbranch_6/vector/v.to.rast/main.c	2009-01-12 14:57:05 UTC (rev 35365)
@@ -8,7 +8,7 @@
  *               Brad Douglas <rez touchofmadness.com>, Glynn Clements <glynn gclements.plus.com>,
  *               Hamish Bowman <hamish_nospam yahoo.com>, Markus Neteler <neteler itc.it>
  * PURPOSE:      
- * COPYRIGHT:    (C) 2003-2006 by the GRASS Development Team
+ * COPYRIGHT:    (C) 2003-2009 by the GRASS Development Team
  *
  *               This program is free software under the GNU General Public
  *               License (>=v2). Read the file COPYING that comes with GRASS
@@ -36,8 +36,8 @@
 
     module = G_define_module();
     module->keywords = _("vector, raster, conversion");
-    module->description = _("Converts a binary GRASS vector map layer "
-			    "into a GRASS raster map layer.");
+    module->description = _("Converts a binary GRASS vector map "
+			    "into a GRASS raster map .");
 
     input = G_define_standard_option(G_OPT_V_INPUT);
     output = G_define_standard_option(G_OPT_R_OUTPUT);
@@ -135,7 +135,10 @@
     value = atof(val_opt->answer);
     value_type = (strchr(val_opt->answer, '.')) ? USE_DCELL : USE_CELL;
 
-    return vect_to_rast(input->answer, output->answer, field,
-			col->answer, nrows, use, value, value_type,
-			rgbcol_opt->answer, label_opt->answer, type);
+    if (vect_to_rast(input->answer, output->answer, field,
+		     col->answer, nrows, use, value, value_type,
+		     rgbcol_opt->answer, label_opt->answer, type))
+      exit(EXIT_FAILURE);
+   
+    exit(EXIT_SUCCESS);
 }

Modified: grass/branches/develbranch_6/vector/v.to.rast/raster.c
===================================================================
--- grass/branches/develbranch_6/vector/v.to.rast/raster.c	2009-01-12 14:48:46 UTC (rev 35364)
+++ grass/branches/develbranch_6/vector/v.to.rast/raster.c	2009-01-12 14:57:05 UTC (rev 35365)
@@ -137,6 +137,7 @@
     int i;
 
     for (i = 0; i < page.rows; i++, at_row++) {
+	G_percent(i, page.rows, 2);
 	switch (format) {
 	case USE_CELL:
 	    cell = raster.cell[i];
@@ -156,7 +157,8 @@
 	    break;
 	}
     }
-
+    G_percent(1, 1, 1);
+    
     return configure_plot();
 }
 

Modified: grass/branches/develbranch_6/vector/v.to.rast/vect2rast.c
===================================================================
--- grass/branches/develbranch_6/vector/v.to.rast/vect2rast.c	2009-01-12 14:48:46 UTC (rev 35364)
+++ grass/branches/develbranch_6/vector/v.to.rast/vect2rast.c	2009-01-12 14:57:05 UTC (rev 35365)
@@ -36,7 +36,7 @@
     if ((vector_mapset = G_find_vector2(vector_map, "")) == NULL)
 	G_fatal_error(_("Vector map <%s> not found"), vector_map);
 
-    G_debug(1, "Loading vector information...");
+    G_message(_("Loading data..."));
     Vect_set_open_level(2);
     Vect_open_old(&Map, vector_map, vector_mapset);
 
@@ -179,11 +179,8 @@
 	    }
 	}
 
-	G_message(_("Converted areas: %d of %d"), nareas, nareas_all);
-	G_message(_("Converted points/lines: %d of %d"), nlines, nplines_all);
+	G_message(_("Writing raster map..."));
 
-	G_debug(1, "Writing raster map ...");
-
 	stat = output_raster(fd);
     } while (stat == 0);
 
@@ -199,7 +196,7 @@
 
     Vect_close(&Map);
 
-    G_debug(1, "Creating support files for raster map...");
+    G_verbose_message(_("Creating support files for raster map..."));
     G_close_cell(fd);
     update_hist(raster_map, vector_map, vector_mapset, Map.head.orig_scale);
 
@@ -224,5 +221,10 @@
     update_labels(raster_map, vector_map, field, labelcolumn, use, value,
 		  column);
 
+    G_message(_("Converted areas: %d of %d"), nareas, nareas_all);
+    G_message(_("Converted points/lines: %d of %d"), nlines, nplines_all);
+    
+    G_done_msg(" ");
+    
     return 0;
 }



More information about the grass-commit mailing list