Browse Source

d.vect: fix bug for vector maps open at level 1
message standardization
(merge from devbr6, https://trac.osgeo.org/grass/changeset/35040)


git-svn-id: https://svn.osgeo.org/grass/grass/trunk@35041 15284696-431f-4ddb-bdfa-cd5b030d7da7

Martin Landa 16 years ago
parent
commit
0ea1b05dac
2 changed files with 20 additions and 23 deletions
  1. 5 5
      display/d.vect/main.c
  2. 15 18
      display/d.vect/plot1.c

+ 5 - 5
display/d.vect/main.c

@@ -418,13 +418,13 @@ int main(int argc, char **argv)
 	has_fcolor = 0;
 	has_fcolor = 0;
     }
     }
     else if (ret == 0) {	/* error */
     else if (ret == 0) {	/* error */
-	G_fatal_error(_("Unknown color: [%s]"), fcolor_opt->answer);
+	G_fatal_error(_("Unknown color: '%s'"), fcolor_opt->answer);
     }
     }
 
 
     size = atoi(size_opt->answer);
     size = atoi(size_opt->answer);
     Symb = S_read(icon_opt->answer);
     Symb = S_read(icon_opt->answer);
     if (Symb == NULL)
     if (Symb == NULL)
-	G_warning(_("Cannot read symbol, cannot display points"));
+	G_warning(_("Unable to read symbol, unable todisplay points"));
     else
     else
 	S_stroke(Symb, size, 0.0, 0);
 	S_stroke(Symb, size, 0.0, 0);
 
 
@@ -623,12 +623,12 @@ int main(int argc, char **argv)
 		    D_line_width(default_width);
 		    D_line_width(default_width);
 	    }
 	    }
 	    else
 	    else
-		G_warning(_("Cannot display areas, topology not available"));
+		G_warning(_("Unable to display areas, topology not available"));
 	}
 	}
 
 
 	if (display & DISP_SHAPE) {
 	if (display & DISP_SHAPE) {
 	    if (id_flag->answer && level < 2) {
 	    if (id_flag->answer && level < 2) {
-		G_warning(_("Cannot display lines by id, topology not available"));
+		G_warning(_("Unable to display lines by id, topology not available"));
 	    }
 	    }
 	    else {
 	    else {
 		stat = plot1(&Map, type, area, Clist,
 		stat = plot1(&Map, type, area, Clist,
@@ -670,7 +670,7 @@ int main(int argc, char **argv)
 	    if (level >= 2)
 	    if (level >= 2)
 		stat = topo(&Map, type, area, &lattr);
 		stat = topo(&Map, type, area, &lattr);
 	    else
 	    else
-		G_warning(_("Cannot display topology, not available"));
+		G_warning(_("Unable to display topology, not available"));
 	}
 	}
     }
     }
 
 

+ 15 - 18
display/d.vect/plot1.c

@@ -189,8 +189,8 @@ int plot1(struct Map_info *Map, int type, int area, struct cat_list *Clist,
 
 
     line = 0;
     line = 0;
     while (1) {
     while (1) {
+	line++;
 	if (Vect_level(Map) >= 2) {
 	if (Vect_level(Map) >= 2) {
-	    line++;
 	    if (line > nlines)
 	    if (line > nlines)
 		break;
 		break;
 	    if (!Vect_line_alive(Map, line))
 	    if (!Vect_line_alive(Map, line))
@@ -199,11 +199,10 @@ int plot1(struct Map_info *Map, int type, int area, struct cat_list *Clist,
 	}
 	}
 	else {
 	else {
 	    ltype = Vect_read_next_line(Map, Points, Cats);
 	    ltype = Vect_read_next_line(Map, Points, Cats);
-	    switch (ltype) {
-	    case -1:
-		G_warning(_("Unable to read vector map"));
-		return -1;
-	    case -2:		/* EOF */
+	    if (ltype == -1) {
+		G_fatal_error(_("Unable to read vector map"));
+	    }
+	    else if (ltype == -2) { /* EOF */
 		break;
 		break;
 	    }
 	    }
 	}
 	}
@@ -264,12 +263,11 @@ int plot1(struct Map_info *Map, int type, int area, struct cat_list *Clist,
 	}
 	}
 
 
 	if (table_colors_flag) {
 	if (table_colors_flag) {
-
 	    /* only first category */
 	    /* only first category */
-	    cat = Vect_get_line_cat(Map, line,
-				    (Clist->field > 0 ? Clist->field :
-				     (Cats->n_cats >
-				      0 ? Cats->field[0] : 1)));
+	    Vect_cat_get(Cats, 
+			 (Clist->field > 0 ? Clist->field :
+			  (Cats->n_cats >
+			   0 ? Cats->field[0] : 1)), &cat);
 
 
 	    if (cat >= 0) {
 	    if (cat >= 0) {
 		G_debug(3, "display element %d, cat %d", line, cat);
 		G_debug(3, "display element %d, cat %d", line, cat);
@@ -319,7 +317,7 @@ int plot1(struct Map_info *Map, int type, int area, struct cat_list *Clist,
 	if (cats_color_flag) {
 	if (cats_color_flag) {
 	    custom_rgb = FALSE;
 	    custom_rgb = FALSE;
 	    if (Clist->field > 0) {
 	    if (Clist->field > 0) {
-		cat = Vect_get_line_cat(Map, line, Clist->field);
+		Vect_cat_get(Cats, Clist->field, &cat);
 		if (cat >= 0) {
 		if (cat >= 0) {
 		    G_debug(3, "display element %d, cat %d", line, cat);
 		    G_debug(3, "display element %d, cat %d", line, cat);
 		    /* fetch color number from category */
 		    /* fetch color number from category */
@@ -350,13 +348,12 @@ int plot1(struct Map_info *Map, int type, int area, struct cat_list *Clist,
 
 
 
 
 	if (nrec_width) {
 	if (nrec_width) {
-
 	    /* only first category */
 	    /* only first category */
-	    cat = Vect_get_line_cat(Map, line,
-				    (Clist->field > 0 ? Clist->field :
-				     (Cats->n_cats >
-				      0 ? Cats->field[0] : 1)));
-
+	    Vect_cat_get(Cats,
+			 (Clist->field > 0 ? Clist->field :
+			  (Cats->n_cats >
+			   0 ? Cats->field[0] : 1)), &cat);
+	    
 	    if (cat >= 0) {
 	    if (cat >= 0) {
 		G_debug(3, "display element %d, cat %d", line, cat);
 		G_debug(3, "display element %d, cat %d", line, cat);