[GRASS-SVN] r34739 - grass/trunk/ps/ps.map
svn_grass at osgeo.org
svn_grass at osgeo.org
Fri Dec 5 04:36:49 EST 2008
Author: hamish
Date: 2008-12-05 04:36:49 -0500 (Fri, 05 Dec 2008)
New Revision: 34739
Modified:
grass/trunk/ps/ps.map/ps.map.html
grass/trunk/ps/ps.map/ps_vlegend.c
Log:
merge fixes from devbr6 (trac #355):
- allow placement of vector legend left of the map
- patch from Bob Covill to save pattern file for legend even if pattern is never used within the map region
Modified: grass/trunk/ps/ps.map/ps.map.html
===================================================================
--- grass/trunk/ps/ps.map/ps.map.html 2008-12-05 09:32:18 UTC (rev 34738)
+++ grass/trunk/ps/ps.map/ps.map.html 2008-12-05 09:36:49 UTC (rev 34739)
@@ -1476,8 +1476,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/trunk/ps/ps.map/ps_vlegend.c
===================================================================
--- grass/trunk/ps/ps.map/ps_vlegend.c 2008-12-05 09:32:18 UTC (rev 34738)
+++ grass/trunk/ps/ps.map/ps_vlegend.c 2008-12-05 09:36:49 UTC (rev 34739)
@@ -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++;
@@ -181,6 +192,7 @@
eps_bbox(vector.layer[i].pat, &llx, &lly, &urx,
&ury);
sprintf(pat, "APATTEPS%d", i);
+ pat_save(PS.fp, vector.layer[i].pat, pat);
fprintf(PS.fp,
"<< /PatternType 1\n /PaintType 1\n /TilingType 1\n");
@@ -254,10 +266,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