Slide.show.sh update

Angus Carr apcarr at FLASH.LakeheadU.CA
Fri Feb 19 10:58:03 EST 1999


Hi, all.
Last week, I was having a problem with slide.show.sh. I thought it was a
problem caused by the grass5 changeover, and a script that had not been
updated. I was wrong. 
slide.show.sh takes the list of mapsets to show slides from from the
search path. If there is no search path, it takes the list from the
PERMANENT mapset. I rarely set a search path with what I am doing, so the
script is defaulting to PERMANENT. With what I am doing right now, I have
no maps in PERMANENT. So, slide.show.sh failed to show anything.

What slide.show.sh should do is default to the current mapset, as well as 
the PERMANENT mapset (at least in my humble opinion). So, I propose the
following change on line 82 of slide.show.sh (as shown by a 
"diff new old") :
=========================
82c82
<               MAPSETS=`echo $MAPSET PERMANENT `
---
>               MAPSETS=PERMANENT
=========================

Below is a complete script. This change should allow those of us who do
multiple small, short-term analyses to use slide.show.sh.

Enjoy,
Angus Carr.

=========================
:

if [ $? != 0 ]
then
	exit 1
fi
d.colormode fixed

# set gis variables
eval `g.gisenv`
LOCATION=$GISDBASE/$LOCATION_NAME/$MAPSET

# set defaults
DOWN=3
ACROSS=4

# evaluate arguments
for i do
	case $i in
		down=*)
			DOWN=`echo $i | sed s/down=//` ;;
		height=*)
			DOWN=`echo $i | sed s/height=//` ;;
		across=*)
			ACROSS=`echo $i | sed s/across=//` ;;
		width=*)
			ACROSS=`echo $i | sed s/width=//` ;;
		mapsets=*)
			MAPSETS=`echo $i | sed s/mapsets=//` ;;
		mapset=*)
			MAPSETS=`echo $i | sed s/mapset=//` ;;
		*)
			echo ""
			echo "Unrecognized option: $i"
			echo Options: across=#maps_across down=#_maps_down
			echo Defaults:
			echo "   across =   $ACROSS"
			echo "   down   =   $DOWN"
			exit
	esac
done

d.frame -e
# figure height and widths of the windows
avail_width=`expr 99 - $ACROSS`
avail_height=`expr 99 - $DOWN`
map_width=`expr $avail_width / $ACROSS`
wind_height=`expr $avail_height / $DOWN`
label_height=`expr $wind_height / 10`
map_height=`expr $wind_height - $label_height`

# generate the needed windows
at_horiz=0
left=1
while [ $at_horiz -lt $ACROSS ]
do
	at_vert=0
	top=99
	right=`expr $left + $map_width`
	while [ $at_vert -lt $DOWN ]
	do
		bottom=`expr $top - $map_height`
		d.frame -c map.$at_horiz.$at_vert
at=$bottom,$top,$left,$right
		top=$bottom
		bottom=`expr $top - $label_height`
		d.frame -c lab.$at_horiz.$at_vert
at=$bottom,$top,$left,$right
		at_vert=`expr $at_vert + 1`
		top=`expr $bottom - 1`
	done
	at_horiz=`expr $at_horiz + 1`
	left=`expr $right + 1`
done

# Get list of current mapsets

if [ x$MAPSETS = x ]
then
	if [ -r $LOCATION/SEARCH_PATH ]
	then
		MAPSETS=`cat $LOCATION/SEARCH_PATH`
	else
		MAPSETS=`echo $MAPSET PERMANENT `
	fi
fi

# Draw the maps

atnum=0
totmaps=`expr $ACROSS \* $DOWN`

for mapset in $MAPSETS
do
	cd $LOCATION/../$mapset
	if [ ! -d cell ]
	then
		continue
	fi
	for i in MASK `ls cell`
	do
		if [ ! $i = "MASK" ]
		then
			atnum=`expr $atnum % $totmaps`
			at_vert=`expr $atnum % $DOWN`
			at_hori=`expr $atnum / $DOWN`

			d.frame -s lab.$at_hori.$at_vert
			d.erase
			echo $i in $mapset | d.text size=80

			d.frame -s map.$at_hori.$at_vert
			d.erase
			d.rast $i

			atnum=`expr $atnum + 1`
		fi
	done
done




More information about the grass-user mailing list