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

svn_grass at osgeo.org svn_grass at osgeo.org
Fri Dec 5 04:18:27 EST 2008


Author: hamish
Date: 2008-12-05 04:18:27 -0500 (Fri, 05 Dec 2008)
New Revision: 34737

Modified:
   grass/branches/develbranch_6/ps/ps.map/description.html
   grass/branches/develbranch_6/ps/ps.map/ps_vlegend.c
Log:
allow placement of vector legend left of the map

Modified: grass/branches/develbranch_6/ps/ps.map/description.html
===================================================================
--- grass/branches/develbranch_6/ps/ps.map/description.html	2008-12-05 08:08:10 UTC (rev 34736)
+++ grass/branches/develbranch_6/ps/ps.map/description.html	2008-12-05 09:18:27 UTC (rev 34737)
@@ -1478,8 +1478,9 @@
 the map, starting <EM>x</EM> inches from the left edge of the page.
 
 <P>
-<EM>width</EM> is the width in inches of the color symbol (for areas) in front of the 
-legend text. The default is 1/24 * fontsize inches.
+<EM>width</EM> is the width in inches of the color symbol (for lines)
+in front of the legend text. The default is 1/24 * fontsize inches.
+<P>
 <EM>cols</EM> is the number of columns to split the legend into. The default is one 
 column. The maximum number of colums is 10, or equal to the number of legend entries 
 if there are less than 10 entries.

Modified: grass/branches/develbranch_6/ps/ps.map/ps_vlegend.c
===================================================================
--- grass/branches/develbranch_6/ps/ps.map/ps_vlegend.c	2008-12-05 08:08:10 UTC (rev 34736)
+++ grass/branches/develbranch_6/ps/ps.map/ps_vlegend.c	2008-12-05 09:18:27 UTC (rev 34737)
@@ -74,22 +74,33 @@
 	x = 72.0 * vector.x;
     else
 	x = PS.map_left;
+
     if (vector.y > 0.0)
 	y = 72.0 * (PS.page_height - vector.y);
     else if (vector.x <= 0.0)
 	y = PS.min_y;
     else
 	y = PS.map_bot;
+
     margin = 0.4 * fontsize;
-    if (x < PS.map_left + margin)
-	x = PS.map_left + margin;
 
+    if (x < PS.left_marg*72 + margin)
+	x = PS.left_marg*72 + margin;
+
     if (lcount < vector.cols)
 	vector.cols = lcount;
+
+/* FIXME (somehow): allow multi column to draw to the right margin would 
+    be nice, but for normal use locking to the right side of the map box
+    looks better. What's the correct compromise if the right side is always
+    automatically chosen? */
     dx = (PS.map_right - x) / vector.cols;
+/*    dx = ((PS.page_width-PS.right_marg)*72 - x) / vector.cols; */
+
     xs = x;			/*save x and y */
     ys = y;
     lc = (int)lcount / vector.cols;	/* lines per column */
+
     if (lcount % vector.cols)
 	lc++;
 
@@ -254,10 +265,11 @@
 
 	    /* plot the text */
 	    set_rgb_color(BLACK);
-	    fprintf(PS.fp, "a %d get %.1f %.1f MS\n", j - h * lc, x + width,
-		    y);
+	    fprintf(PS.fp, "a %d get %.1f %.1f MS\n",
+			j - h * lc, x + width, y);
 	}
-    }				/*h */
+    }	/* h */
+
     x = xs;
     y = ys - lc * dy;
 



More information about the grass-commit mailing list