[GRASS-SVN] r55213 - grass/branches/develbranch_6/scripts/d.rast.leg

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Feb 25 14:55:15 PST 2013


Author: hamish
Date: 2013-02-25 14:55:14 -0800 (Mon, 25 Feb 2013)
New Revision: 55213

Modified:
   grass/branches/develbranch_6/scripts/d.rast.leg/d.rast.leg
Log:
better handle spaces in GISDBASE (#1683), bugfix on WinGrass, so candidate for backporting after testing.

Modified: grass/branches/develbranch_6/scripts/d.rast.leg/d.rast.leg
===================================================================
--- grass/branches/develbranch_6/scripts/d.rast.leg/d.rast.leg	2013-02-25 22:32:15 UTC (rev 55212)
+++ grass/branches/develbranch_6/scripts/d.rast.leg/d.rast.leg	2013-02-25 22:55:14 UTC (rev 55213)
@@ -117,15 +117,12 @@
 fi
 
 #for -n flag of d.legend
-eval `g.findfile el=cell file=$GIS_OPT_MAP`
+eval `g.findfile el=cell file="$GIS_OPT_MAP"`
 if [ ! "$file" ] ; then
    g.message -e "Raster map '$GIS_OPT_MAP' not found in mapset search path"
    exit 1
 fi
-filemapset="${mapset}"
-# would it be better to search for cats/ file ??
-eval `g.gisenv`
-HISTFILEDIR=$GISDBASE/$LOCATION_NAME/$filemapset/cell_misc/
+
 eval `r.info -t "$GIS_OPT_MAP"`
 
 # for rast=
@@ -137,6 +134,12 @@
     else
 	eval `r.info -t "$GIS_OPT_RAST"`
     fi
+
+    eval `g.findfile ele=cell_misc file="$GIS_OPT_RAST" | grep '^file='`
+    HSTGRM_DIR="$file"
+else
+    eval `g.findfile ele=cell_misc file="$GIS_OPT_MAP" | grep '^file='`
+    HSTGRM_DIR="$file"
 fi
 
 
@@ -167,14 +170,16 @@
     	d.frame -s at=0,90,$XPOS,100 frame=right
 	if [ -z "$GIS_OPT_RAST" ] ; then
 		g.message -d "No lines; own legend"
-		if test -f $HISTFILEDIR/$GIS_OPT_MAP/histogram ; then
+		# HB: I'm not sure this works as written. e.g. try erode.index at spearfish
+		# would it be better to search for cats/ file ??
+		if test -f "$HSTGRM_DIR/histogram" ; then
 	  	     d.legend $FLIP $SMOOTH -n map="$GIS_OPT_MAP" $LEG_AT
         	else
 	             d.legend $FLIP $SMOOTH $OMIT map="$GIS_OPT_MAP" $LEG_AT
         	fi
 	else
 		g.message -d "No lines; external legend"
-		if test -f $HISTFILEDIR/$GIS_OPT_RAST/histogram ; then
+		if test -f "$HSTGRM_DIR/histogram" ; then
 		     d.legend $FLIP $SMOOTH -n map="$GIS_OPT_RAST" $LEG_AT
 		else
 		     d.legend $FLIP $SMOOTH $OMIT map="$GIS_OPT_RAST" $LEG_AT
@@ -195,7 +200,7 @@
     	d.frame -s at=0,90,$XPOS,100 frame=right
 	if [ -z "$GIS_OPT_RAST" ] ; then
 		g.message -d message="Lines=$GIS_OPT_NUM_OF_LINES; own legend"
-		if test -f $HISTFILEDIR/$GIS_OPT_MAP/histogram ; then
+		if test -f "$HSTGRM_DIR/histogram" ; then
 	             d.legend $FLIP -n map="$GIS_OPT_MAP" \
 			lines="$GIS_OPT_NUM_OF_LINES" $LEG_AT
         	else
@@ -203,7 +208,7 @@
         	fi
 	else
 		g.message -d message="Lines=$GIS_OPT_NUM_OF_LINES; external legend"
-		if test -f $HISTFILEDIR/$GIS_OPT_RAST/histogram ; then
+		if test -f "$HSTGRM_DIR/histogram" ; then
 		     d.legend $FLIP -n map="$GIS_OPT_RAST" \
 			lines="$GIS_OPT_NUM_OF_LINES" $LEG_AT
 		else



More information about the grass-commit mailing list