[GRASS-SVN] r33529 - grass/trunk/scripts/d.rast.leg
svn_grass at osgeo.org
svn_grass at osgeo.org
Thu Sep 25 04:35:08 EDT 2008
Author: neteler
Date: 2008-09-25 04:35:08 -0400 (Thu, 25 Sep 2008)
New Revision: 33529
Modified:
grass/trunk/scripts/d.rast.leg/d.rast.leg
grass/trunk/scripts/d.rast.leg/d.rast.leg.html
Log:
Added rast parameter for static legends
Modified: grass/trunk/scripts/d.rast.leg/d.rast.leg
===================================================================
--- grass/trunk/scripts/d.rast.leg/d.rast.leg 2008-09-25 07:48:05 UTC (rev 33528)
+++ grass/trunk/scripts/d.rast.leg/d.rast.leg 2008-09-25 08:35:08 UTC (rev 33529)
@@ -51,7 +51,7 @@
#% key: map
#% type: string
#% gisprompt: old,cell,raster
-#% description: raster input map
+#% description: Name of raster map
#% required : yes
#%end
#%option
@@ -60,6 +60,13 @@
#% description: Number of lines to appear in the legend
#% required : no
#%end
+#%option
+#% key: rast
+#% type: string
+#% gisprompt: old,cell,raster
+#% description: Name of raster map to generate legend from
+#% required : no
+#%end
if test "$GISBASE" = ""; then
echo "You must be in GRASS GIS to run this program." >&2
@@ -87,6 +94,15 @@
filemapset="${mapset}"
HISTFILEDIR=$GISDBASE/$LOCATION_NAME/$filemapset/cell_misc/
+# for rast=
+if [ ! -z $GIS_OPT_RAST ] ; then
+ eval `g.findfile el=cell file=$GIS_OPT_RAST`
+ if [ ! "$file" ] ; then
+ g.message -e "Raster map '$GIS_OPT_RAST' not found in mapset search path"
+ exit 1
+ fi
+fi
+
# save defined font setting
FONTCMD=`d.frame -l | grep d.font | sed 's+"++1'| sed 's+"++1'`
d.frame -e
@@ -110,11 +126,19 @@
#draw legend
d.frame -s at=0,90,65,100 frame=right
- if test -f $HISTFILEDIR/$GIS_OPT_MAP/histogram ; then
- d.legend $FLIP -n map=$GIS_OPT_MAP
- else
- d.legend $FLIP $OMIT map=$GIS_OPT_MAP
- fi
+ if [ -z $GIS_OPT_RAST ] ; then
+ if test -f $HISTFILEDIR/$GIS_OPT_MAP/histogram ; then
+ d.legend $FLIP -n map=$GIS_OPT_MAP
+ else
+ d.legend $FLIP $OMIT map=$GIS_OPT_MAP
+ fi
+ else
+ if test -f $HISTFILEDIR/$GIS_OPT_RAST/histogram ; then
+ d.legend $FLIP -n map=$GIS_OPT_RAST
+ else
+ d.legend $FLIP $OMIT map=$GIS_OPT_RAST
+ fi
+ fi
#draw map
d.frame -s at=0,100,0,65 frame=left
@@ -133,11 +157,19 @@
#draw legend
d.frame -s at=0,90,65,100 frame=right
- if test -f $HISTFILEDIR/$GIS_OPT_MAP/histogram ; then
- d.legend $FLIP -n map=$GIS_OPT_MAP lines=$GIS_OPT_NUM_OF_LINES
- else
- d.legend $FLIP $OMIT map=$GIS_OPT_MAP
- fi
+ 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
+ else
+ d.legend $FLIP $OMIT map=$GIS_OPT_MAP
+ fi
+ else
+ if test -f $HISTFILEDIR/$GIS_OPT_RAST/histogram ; then
+ d.legend $FLIP -n map=$GIS_OPT_RAST lines=$GIS_OPT_NUM_OF_LINES
+ else
+ d.legend $FLIP $OMIT map=$GIS_OPT_RAST
+ fi
+ fi
#draw map
d.frame -s at=0,100,0,65 frame=left
Modified: grass/trunk/scripts/d.rast.leg/d.rast.leg.html
===================================================================
--- grass/trunk/scripts/d.rast.leg/d.rast.leg.html 2008-09-25 07:48:05 UTC (rev 33528)
+++ grass/trunk/scripts/d.rast.leg/d.rast.leg.html 2008-09-25 08:35:08 UTC (rev 33529)
@@ -18,7 +18,12 @@
<P>
The user may adjust the <B>num_of_lines</B> parameter or
the size of graphics window to get an appropriate result.
+
<P>
+The user may specify a second raster map with the <b>rast</b> parameter from
+which the legend is generated. This is useful to visualize (time) series of
+raster maps with a common static legend instead of the default dynamic legend.
+<P>
To remove all frames when clearing the display, use
"<em><tt>d.erase -f</tt></em>".
More information about the grass-commit
mailing list