[GRASS-SVN] r39133 - in grass/trunk: display/d.legend raster/r.mapcalc raster/r.to.vect

svn_grass at osgeo.org svn_grass at osgeo.org
Fri Sep 11 23:45:58 EDT 2009


Author: glynn
Date: 2009-09-11 23:45:57 -0400 (Fri, 11 Sep 2009)
New Revision: 39133

Modified:
   grass/trunk/display/d.legend/main.c
   grass/trunk/raster/r.mapcalc/map.c
   grass/trunk/raster/r.to.vect/areas_io.c
Log:
Fix bugs introduced by r38099


Modified: grass/trunk/display/d.legend/main.c
===================================================================
--- grass/trunk/display/d.legend/main.c	2009-09-12 03:37:29 UTC (rev 39132)
+++ grass/trunk/display/d.legend/main.c	2009-09-12 03:45:57 UTC (rev 39133)
@@ -373,8 +373,10 @@
 	     j++, i += thin) {
 	    if (!flip)
 		cstr = Rast_get_c_cat(&i, &cats);
-	    else
-		cstr = Rast_get_c_cat((max_ind - (i - min_ind)), &cats);
+	    else {
+		CELL cat = max_ind - (i - min_ind);
+		cstr = Rast_get_c_cat(&cat, &cats);
+	    }
 
 	    if (!use_catlist)
 		catlist[j - 1] = (double)i;
@@ -405,7 +407,7 @@
 				  opt8->answers[i], min_ind, max_ind);
 		}
 
-		cstr = Rast_get_c_cat(&(catlist[i]), &cats);
+		cstr = Rast_get_d_cat(&catlist[i], &cats);
 		if (!cstr[0]) {	/* no cat label found, skip str output */
 		    if (hide_nodata)
 			continue;
@@ -604,7 +606,7 @@
 			max_ind - k * (double)(max_ind - min_ind) / (steps -
 								     1);
 
-		cstr = Rast_get_c_cat(tcell, &cats);
+		cstr = Rast_get_c_cat(&tcell, &cats);
 		if (!cstr[0])	/* no cats found, disable str output */
 		    hide_catstr = 1;
 		else
@@ -780,9 +782,9 @@
 	    /*              for(i=min_ind, j=1, k=0; j<=do_cats && i<=max_ind; j++, i+=thin)        */
 	{
 	    if (!flip)
-		cstr = Rast_get_c_cat(&(catlist[i]), &cats);
+		cstr = Rast_get_d_cat(&catlist[i], &cats);
 	    else
-		cstr = Rast_get_c_cat(&(catlist[catlistCount - i - 1]), &cats);
+		cstr = Rast_get_d_cat(&catlist[catlistCount - i - 1], &cats);
 
 
 	    if (!cstr[0]) {	/* no cat label found, skip str output */

Modified: grass/trunk/raster/r.mapcalc/map.c
===================================================================
--- grass/trunk/raster/r.mapcalc/map.c	2009-09-12 03:37:29 UTC (rev 39132)
+++ grass/trunk/raster/r.mapcalc/map.c	2009-09-12 03:45:57 UTC (rev 39133)
@@ -341,7 +341,7 @@
 	    values = vbuf;
 	    for (i = 0; i < NCATS; i++) {
 		CELL cat = i + key;
-		if ((label = Rast_get_c_cat((CELL *) cat, pcats)) == NULL
+		if ((label = Rast_get_c_cat(&cat, pcats)) == NULL
 		    || sscanf(label, "%lf", values) != 1)
 		    SET_NULL_D(values);
 		values++;

Modified: grass/trunk/raster/r.to.vect/areas_io.c
===================================================================
--- grass/trunk/raster/r.to.vect/areas_io.c	2009-09-12 03:37:29 UTC (rev 39132)
+++ grass/trunk/raster/r.to.vect/areas_io.c	2009-09-12 03:45:57 UTC (rev 39133)
@@ -348,16 +348,14 @@
 		    sprintf(buf, "%d", (int)p->cat);
 		    break;
 		case FCELL_TYPE:
-		    sprintf(buf, "%f", (float)p->cat);
-		    break;
 		case DCELL_TYPE:
-		    sprintf(buf, "%lf", p->cat);
+		    sprintf(buf, "%f", p->cat);
 		    break;
 		}
 		db_append_string(&sql, buf);
 
 		if (has_cats) {
-		    temp_buf = Rast_get_c_cat(&(p->cat), &RastCats);
+		    temp_buf = Rast_get_d_cat(&p->cat, &RastCats);
 
 		    db_set_string(&label, temp_buf);
 		    db_double_quote_string(&label);



More information about the grass-commit mailing list