[GRASS-SVN] r33393 - grass/branches/develbranch_6/ps/ps.map
svn_grass at osgeo.org
svn_grass at osgeo.org
Wed Sep 10 22:12:01 EDT 2008
Author: hamish
Date: 2008-09-10 22:12:00 -0400 (Wed, 10 Sep 2008)
New Revision: 33393
Modified:
grass/branches/develbranch_6/ps/ps.map/ps_fclrtbl.c
Log:
first try at printing data unit labels with FP legends
Modified: grass/branches/develbranch_6/ps/ps.map/ps_fclrtbl.c
===================================================================
--- grass/branches/develbranch_6/ps/ps.map/ps_fclrtbl.c 2008-09-11 00:47:51 UTC (rev 33392)
+++ grass/branches/develbranch_6/ps/ps.map/ps_fclrtbl.c 2008-09-11 02:12:00 UTC (rev 33393)
@@ -10,13 +10,18 @@
#include "colortable.h"
#include "local_proto.h"
+#define LEFT 0
+#define RIGHT 1
+#define LOWER 0
+#define UPPER 1
+#define CENTER 2
#define NSTEPS 3
#define NNSTEP 4 /* number of nice steps */
int PS_fcolortable(void)
{
- char buf[512], *ch;
+ char buf[512], *ch, units[GNAME_MAX];
int i, k;
int R, G, B;
DCELL dmin, dmax, val;
@@ -35,6 +40,7 @@
double ex, cur_d, cur_ex;
int do_color;
double grey_color_val;
+ int max_label_length = 0;
/* let user know what's happenning */
G_message(_("Creating color table for <%s in %s>..."),
@@ -122,6 +128,7 @@
x1 = l;
x2 = x1 + width;
fprintf(PS.fp, "%.8f W\n", cwidth);
+
for (i = 0; i < ncols; i++) {
/* val = dmin + i * step; flip */
val = dmax - i * step;
@@ -233,9 +240,27 @@
fprintf(PS.fp, "(%s) %f %f MS\n", buf, x2 + 0.2 * fontsize,
y - 0.35 * fontsize);
+ if(strlen(buf) > max_label_length)
+ max_label_length = strlen(buf);
+
val += step;
}
+
+ /* print units label, if present */
+ if (G_read_raster_units(ct.name, ct.mapset, units) != 0)
+ units[0] = '\0';
+/* not ready yet
+ if(strlen(units)) {
+ text_box_path( x2 + max_label_length*(fontsize*.7),
+ t - height/2,
+ LEFT, CENTER, units, fontsize, 0);
+
+ set_rgb_color(BLACK);
+ fprintf(PS.fp, "TIB\n");
+ }
+*/
+
G_free_colors(&colors);
return 0;
More information about the grass-commit
mailing list