[GRASS-SVN] r34163 - grass/branches/develbranch_6/scripts/d.rast.leg
svn_grass at osgeo.org
svn_grass at osgeo.org
Wed Nov 5 09:06:50 EST 2008
Author: neteler
Date: 2008-11-05 09:06:50 -0500 (Wed, 05 Nov 2008)
New Revision: 34163
Modified:
grass/branches/develbranch_6/scripts/d.rast.leg/d.rast.leg
Log:
added title and position parameters (merge from trunk, r34160)
Modified: grass/branches/develbranch_6/scripts/d.rast.leg/d.rast.leg
===================================================================
--- grass/branches/develbranch_6/scripts/d.rast.leg/d.rast.leg 2008-11-05 11:35:42 UTC (rev 34162)
+++ grass/branches/develbranch_6/scripts/d.rast.leg/d.rast.leg 2008-11-05 14:06:50 UTC (rev 34163)
@@ -67,6 +67,19 @@
#% description: Name of raster map to generate legend from
#% required : no
#%end
+#%option
+#% key: title
+#% type: string
+#% description: Name of raster map to print in legend
+#% required : no
+#%end
+#%option
+#% key: position
+#% type: double
+#% description: Position of vertical map-legend separator (in percent)
+#% answer: 65
+#% required : no
+#%end
if test "$GISBASE" = ""; then
echo "You must be in GRASS GIS to run this program." >&2
@@ -85,6 +98,12 @@
FLIP="-f"
fi
+if [ ! -z $GIS_OPT_TITLE ] ; then
+ MAPNAME="$GIS_OPT_TITLE"
+else
+ MAPNAME="$GIS_OPT_MAP"
+fi
+
#for -n flag of d.legend
eval `g.findfile el=cell file=$GIS_OPT_MAP`
if [ ! "$file" ] ; then
@@ -110,22 +129,24 @@
# restore font setting
$FONTCMD
+XPOS=$GIS_OPT_POSITION
+
#at=bottom,top,left,right
if [ -z "$GIS_OPT_NUM_OF_LINES" ]
then
#draw title
- d.frame -s at=90,100,65,100 frame=title
+ d.frame -s at=90,100,$XPOS,100 frame=title
# if test -f $GISBASE/bin/d.text.freetype ; then
# d.text.freetype -sp text=$GIS_OPT_MAP col=black size=18 \
# east_north=20,20 path=/usr/X11R6/lib/X11/fonts/TTF/luximb.ttf
# else
- echo "$GIS_OPT_MAP" | d.text col=black size=30
+ echo "$MAPNAME" | d.text col=black size=30
# fi
#draw legend
- d.frame -s at=0,90,65,100 frame=right
+ d.frame -s at=0,90,$XPOS,100 frame=right
if [ -z $GIS_OPT_RAST ] ; then
if test -f $HISTFILEDIR/$GIS_OPT_MAP/histogram ; then
d.legend $FLIP -n map=$GIS_OPT_MAP
@@ -141,22 +162,22 @@
fi
#draw map
- d.frame -s at=0,100,0,65 frame=left
+ d.frame -s at=0,100,0,$XPOS frame=left
d.rast map=$GIS_OPT_MAP
else
#draw title
- d.frame -s at=90,100,65,100 frame=title
+ d.frame -s at=90,100,$XPOS,100 frame=title
# if test -f $GISBASE/bin/d.text.freetype ; then
# d.text.freetype -sp text=$GIS_OPT_MAP col=black size=18 \
# east_north=20,20 path=/usr/X11R6/lib/X11/fonts/TTF/luximb.ttf
# else
- echo "$GIS_OPT_MAP" | d.text col=black size=30
+ echo "$MAPNAME" | d.text col=black size=30
# fi
#draw legend
- d.frame -s at=0,90,65,100 frame=right
+ d.frame -s at=0,90,$XPOS,100 frame=right
if [ -z $GIS_OPT_RAST ] ; then
if test -f $HISTFILEDIR/$GIS_OPT_MAP/histogram ; then
d.legend $FLIP -n map=$GIS_OPT_MAP lines=$GIS_OPT_NUM_OF_LINES
@@ -172,7 +193,7 @@
fi
#draw map
- d.frame -s at=0,100,0,65 frame=left
+ d.frame -s at=0,100,0,$XPOS frame=left
d.rast map=$GIS_OPT_MAP
fi
More information about the grass-commit
mailing list