[GRASS-SVN] r33784 - grass/trunk/display/d.vect

svn_grass at osgeo.org svn_grass at osgeo.org
Thu Oct 9 04:58:48 EDT 2008


Author: martinl
Date: 2008-10-09 04:58:48 -0400 (Thu, 09 Oct 2008)
New Revision: 33784

Modified:
   grass/trunk/display/d.vect/plot1.c
Log:
d.vect: print only one warning for invalid rgb (print message for every affected feature)


Modified: grass/trunk/display/d.vect/plot1.c
===================================================================
--- grass/trunk/display/d.vect/plot1.c	2008-10-09 08:55:59 UTC (rev 33783)
+++ grass/trunk/display/d.vect/plot1.c	2008-10-09 08:58:48 UTC (rev 33784)
@@ -56,7 +56,8 @@
     dbCatValArray cvarr_rgb, cvarr_width;
     dbCatVal *cv_rgb = NULL, *cv_width = NULL;
     int nrec_rgb = 0, nrec_width = 0;
-
+    int nerror_rgb;
+    
     int open_db;
     int custom_rgb = FALSE;
     char colorstring[12];	/* RRR:GGG:BBB */
@@ -65,6 +66,8 @@
     unsigned char which;
     int width;
 
+    nerror_rgb = 0;
+    
     line_color = G_malloc(sizeof(RGBA_Color));
     fill_color = G_malloc(sizeof(RGBA_Color));
     primary_color = G_malloc(sizeof(RGBA_Color));
@@ -113,7 +116,7 @@
 	/* for reading RRR:GGG:BBB color strings from table */
 
 	if (rgb_column == NULL || *rgb_column == '\0')
-	    G_fatal_error(_("Color definition column not specified."));
+	    G_fatal_error(_("Color definition column not specified"));
 
 	db_CatValArray_init(&cvarr_rgb);
 
@@ -188,7 +191,7 @@
 	if (Vect_level(Map) >= 2) {
 	    line++;
 	    if (line > nlines)
-		return 0;
+		break;
 	    if (!Vect_line_alive(Map, line))
 		continue;
 	    ltype = Vect_read_line(Map, Points, Cats, line);
@@ -200,7 +203,7 @@
 		G_warning(_("Unable to read vector map"));
 		return -1;
 	    case -2:		/* EOF */
-		return 0;
+		break;
 	    }
 	}
 
@@ -290,15 +293,18 @@
 			}
 			else {
 			    custom_rgb = FALSE;
-			    G_warning(_("Error in color definition column (%s), element %d "
-				       "with cat %d: colorstring [%s]"),
-				      rgb_column, line, cat, colorstring);
+			    G_important_message(_("Error in color definition column '%s', feature id %d "
+						  "with cat %d: colorstring '%s'"),
+						rgb_column, line, cat, colorstring);
+			    nerror_rgb++;
 			}
 		    }
 		    else {
 			custom_rgb = FALSE;
-			G_warning(_("Error in color definition column (%s), element %d with cat %d"),
-				  rgb_column, line, cat);
+			G_important_message(_("Error in color definition column '%s', feature id %d "
+					      "with cat %d"),
+					    rgb_column, line, cat);
+			nerror_rgb++;
 		    }
 		}
 	    }			/* end if cat */
@@ -429,6 +435,11 @@
 	}
     }
 
+    if (nerror_rgb > 0) {
+	G_warning(_("Error in color definition column '%s': %d features affected"),
+		  rgb_column, nerror_rgb);
+    }
+    
     Vect_destroy_line_struct(Points);
     Vect_destroy_cats_struct(Cats);
 



More information about the grass-commit mailing list