[GRASS-SVN] r49071 - grass/trunk/vector/v.colors

svn_grass at osgeo.org svn_grass at osgeo.org
Thu Nov 3 08:05:17 EDT 2011


Author: martinl
Date: 2011-11-03 05:05:17 -0700 (Thu, 03 Nov 2011)
New Revision: 49071

Modified:
   grass/trunk/vector/v.colors/main.c
   grass/trunk/vector/v.colors/scan_cats.c
   grass/trunk/vector/v.colors/write_rgb.c
Log:
v.colors: add progress info messages


Modified: grass/trunk/vector/v.colors/main.c
===================================================================
--- grass/trunk/vector/v.colors/main.c	2011-11-03 12:04:22 UTC (rev 49070)
+++ grass/trunk/vector/v.colors/main.c	2011-11-03 12:05:17 UTC (rev 49071)
@@ -285,6 +285,7 @@
         colors = colors_tmp;
     }
 
+    G_important_message(_("Writing color rules..."));
     if (rgbcolumn)
 	write_rgb_values(&Map, layer, rgbcolumn, &colors);
     else

Modified: grass/trunk/vector/v.colors/scan_cats.c
===================================================================
--- grass/trunk/vector/v.colors/scan_cats.c	2011-11-03 12:04:22 UTC (rev 49070)
+++ grass/trunk/vector/v.colors/scan_cats.c	2011-11-03 12:05:17 UTC (rev 49071)
@@ -10,20 +10,23 @@
 	       const char *style, const char *rules,
 	       const struct FPRange *range, struct Colors *colors)
 {
-    int ltype, lmin, lmax, cmin, cmax;
+    int ltype, lmin, lmax, cmin, cmax, line;
     struct line_cats *Cats;
 
     cmin = cmax = -1;
     Cats = Vect_new_cats_struct();
 
     G_message(_("Reading features..."));
+    line = 0;
     while(TRUE) {
 	ltype = Vect_read_next_line(Map, NULL, Cats);
 	if (ltype == -1)
 	    G_fatal_error(_("Unable to read vector map"));
 	if (ltype == -2)
 	    break; /* EOF */
-
+	
+	G_progress(++line, 1e4);
+	
 	scan_layer(field, Cats, &lmin, &lmax);
 
 	if (cmin == -1 || lmin <= cmin)
@@ -31,7 +34,8 @@
 	if (cmax == -1 || lmax >= cmax)
 	    cmax = lmax;
     }
-
+    G_progress(1, 1);
+    
     if (range) {
 	if (range->min >= cmin && range->min <= cmax)
 	    cmin = range->min;

Modified: grass/trunk/vector/v.colors/write_rgb.c
===================================================================
--- grass/trunk/vector/v.colors/write_rgb.c	2011-11-03 12:04:22 UTC (rev 49070)
+++ grass/trunk/vector/v.colors/write_rgb.c	2011-11-03 12:05:17 UTC (rev 49071)
@@ -42,6 +42,7 @@
     db_begin_transaction(driver);
     
     for (i = 0; i < nrec; i++) {
+	G_percent(i, nrec, 2);
 	if (Rast_get_c_color((const CELL *) &(pval[i]), &red, &grn, &blu,
 			     colors) == 0)
 	    G_warning(_("No color value defined for category %d"), pval[i]);
@@ -54,6 +55,7 @@
 	if (db_execute_immediate(driver, &stmt) != DB_OK)
 	    G_fatal_error(_("Unable to update RGB values"));
     }
+    G_percent(1, 1, 1);
     
     db_commit_transaction(driver);
     



More information about the grass-commit mailing list