[GRASS-SVN] r45776 - grass/branches/develbranch_6/ps/ps.map

svn_grass at osgeo.org svn_grass at osgeo.org
Sat Mar 26 22:25:49 EDT 2011


Author: hamish
Date: 2011-03-26 19:25:49 -0700 (Sat, 26 Mar 2011)
New Revision: 45776

Modified:
   grass/branches/develbranch_6/ps/ps.map/ps_vlegend.c
   grass/branches/develbranch_6/ps/ps.map/r_vlegend.c
   grass/branches/develbranch_6/ps/ps.map/vector.h
Log:
RGB color support for vlegend instruction (#192)

Modified: grass/branches/develbranch_6/ps/ps.map/ps_vlegend.c
===================================================================
--- grass/branches/develbranch_6/ps/ps.map/ps_vlegend.c	2011-03-27 02:11:34 UTC (rev 45775)
+++ grass/branches/develbranch_6/ps/ps.map/ps_vlegend.c	2011-03-27 02:25:49 UTC (rev 45776)
@@ -150,8 +150,8 @@
 	/*      } */
 
 	/* draw the border, if set */
-	if (vector.border != -1) {
-	    set_rgb_color(vector.border);
+	if (! color_none(&vector.border)) {
+	    set_ps_color(&vector.border);
 
 	    fprintf(PS.fp, "%.1f %.1f w %.1f B\n",
 		    x - margin, y - lc * dy - margin, y);

Modified: grass/branches/develbranch_6/ps/ps.map/r_vlegend.c
===================================================================
--- grass/branches/develbranch_6/ps/ps.map/r_vlegend.c	2011-03-27 02:11:34 UTC (rev 45775)
+++ grass/branches/develbranch_6/ps/ps.map/r_vlegend.c	2011-03-27 02:25:49 UTC (rev 45776)
@@ -5,6 +5,7 @@
 
 #include <stdlib.h>
 #include <string.h>
+#include <grass/glocale.h>
 #include "vector.h"
 #include "local_proto.h"
 
@@ -25,14 +26,16 @@
 {
     char buf[1024];
     char *key, *data;
-    int fontsize, cols, border;
+    int fontsize, cols;
     double x, y, width, cseparation;
+    int r, g, b, ret;
+    PSCOLOR border;
 
     fontsize = 0;
     x = y = 0.0;
     width = -1;
     cols = 1;
-    border = -1;
+    unset_color(&border);
     cseparation = -1;
 
     while (input(2, buf, help)) {
@@ -42,7 +45,7 @@
 	if (KEY("where")) {
 	    if (sscanf(data, "%lf %lf", &x, &y) != 2) {
 		x = y = 0.0;
-		error(key, data, "illegal where request");
+		error(key, data, _("illegal where request"));
 	    }
 	    else
 		continue;
@@ -73,12 +76,14 @@
 	}
 
 	if (KEY("border")) {
-	    border = get_color_number(data);
-	    if (border < 0) {
-		if (border != -999)	/* here -999 is "none" */
-		    error(key, data, "illegal border request");
-		border = -1;
-	    }
+	    ret = G_str_to_color(data, &r, &g, &b);
+	    if (ret == 1)
+		set_color(&border, r, g, b);
+	    else if (ret == 2)  /* i.e. "none" */
+		unset_color(&border);
+	    else
+		error(key, data, _("illegal border color request"));
+
 	    continue;
 	}
 
@@ -88,7 +93,7 @@
 	    continue;
 	}
 
-	error(key, data, "illegal vlegend sub-request");
+	error(key, data, _("illegal vlegend sub-request"));
     }
     vector.x = x;
     vector.y = y;

Modified: grass/branches/develbranch_6/ps/ps.map/vector.h
===================================================================
--- grass/branches/develbranch_6/ps/ps.map/vector.h	2011-03-27 02:11:34 UTC (rev 45775)
+++ grass/branches/develbranch_6/ps/ps.map/vector.h	2011-03-27 02:25:49 UTC (rev 45776)
@@ -103,7 +103,7 @@
     char *font;			/* legend font */
     double width;		/* width of legend symbols */
     int cols;			/* number of colums  */
-    int border;			/* border color number or -1 for none */
+    PSCOLOR border;		/* border color */
     double span;		/* column separation in inches */
     LAYER *layer;
 };



More information about the grass-commit mailing list