3
############################################################################
6
# AUTHOR(S): CERL, updated by Michael Barton
7
# PURPOSE: Slide show of GRASS raster/vector maps
8
# COPYRIGHT: (C) 2004 by the GRASS Development Team
10
# This program is free software under the GNU General Public
11
# License (>=v2). Read the file COPYING that comes with GRASS
14
#############################################################################
17
#% description: Slide show of GRASS raster/vector maps.
18
#% keywords: display, slideshow
22
#% description: Show vector maps rather than raster maps
27
#% description: Map prefix. Specify character(s) to view selected maps only
33
#% description: Map number show across the monitor
40
#% description: Map number show down the monitor
47
#% description: Mapsets to use. Specify multiple mapsets comma separated
54
#% description: Number of seconds to pause between slides
60
if test "$GISBASE" = ""; then
61
echo "You must be in GRASS GIS to run this program." >&2
65
if [ "$1" != "@ARGS_PARSED@" ] ; then
66
exec g.parser "$0" "$@"
74
# in case of problems or user break:
75
trap 'cd $CWD ; d.frame -s full_screen ; exit 1' 2 3 15
77
GISDBASE=`g.gisenv GISDBASE`
78
LOCATION_NAME=`g.gisenv LOCATION_NAME`
79
MAPSET=`g.gisenv MAPSET`
80
LOCATION="$GISDBASE/$LOCATION_NAME/$MAPSET"
82
# Get list of current mapsets
83
if [ -r $LOCATION/SEARCH_PATH ]
85
MAPSETS=`cat $LOCATION/SEARCH_PATH | tr -s '\012' ' '`
87
if [ "$MAPSET" = "PERMANENT" ]
91
MAPSETS="$MAPSET PERMANENT"
95
if [ -n "$GIS_OPT_PREFIX" ] ; then
96
PREFIX=$GIS_OPT_PREFIX
98
if [ -n "$GIS_OPT_DOWN" ] ; then
101
if [ -n "$GIS_OPT_ACROSS" ] ; then
102
ACROSS=$GIS_OPT_ACROSS
104
if [ -n "$GIS_OPT_MAPSETS" ] ; then
105
MAPSETS=`echo $GIS_OPT_MAPSETS | sed 's/,/ /g'`
108
if [ $GIS_FLAG_V -eq 1 ] ; then
114
# Check if mapset exists
116
for mapset in $MAPSETS
118
if [ -d $LOCATION/../$mapset ]
120
mapsets="$mapsets $mapset"
123
if [ "$mapsets" = "" ]
125
g.message -e "$MAPSETS: No such mapset(s) found"
133
if [ $? -ne 0 ] ; then
134
g.message -e "An error occured while running 'd.frame -e'"
138
# figure height and widths of the windows
139
avail_width=`expr 99 - $ACROSS`
140
avail_height=`expr 99 - $DOWN`
141
map_width=`expr $avail_width / $ACROSS`
142
wind_height=`expr $avail_height / $DOWN`
143
label_height=`expr $wind_height / 10`
144
map_height=`expr $wind_height - $label_height`
146
# generate the needed windows
149
while [ $at_horiz -lt $ACROSS ]
153
right=`expr $left + $map_width`
154
while [ $at_vert -lt $DOWN ]
156
bottom=`expr $top - $map_height`
157
d.frame -c map.$at_horiz.$at_vert at=$bottom,$top,$left,$right
159
bottom=`expr $top - $label_height`
160
d.frame -c lab.$at_horiz.$at_vert at=$bottom,$top,$left,$right
161
at_vert=`expr $at_vert + 1`
162
top=`expr $bottom - 1`
164
at_horiz=`expr $at_horiz + 1`
165
left=`expr $right + 1`
171
for mapset in $MAPSETS
173
cd $LOCATION/../$mapset
178
for i in MASK `ls cell/$PREFIX* 2> /dev/null`
180
i=`echo $i | sed 's/cell\///'`
183
atnum=`expr $atnum % $totmaps`
184
at_vert=`expr $atnum % $DOWN`
185
at_hori=`expr $atnum / $DOWN`
187
d.frame -s lab.$at_hori.$at_vert
189
echo $i in $mapset | d.text size=80
191
d.frame -s map.$at_hori.$at_vert
193
g.message -v message="[$i]"
196
if [ "$GIS_OPT_DELAY" -gt 0 ] ; then
197
sleep "$GIS_OPT_DELAY"
200
atnum=`expr $atnum + 1`
209
for mapset in $MAPSETS
211
cd $LOCATION/../$mapset
216
for i in `ls -d vector/$PREFIX* 2> /dev/null`
218
i=`echo $i | sed 's/^vector\///'`
219
atnum=`expr $atnum % $totmaps`
220
at_vert=`expr $atnum % $DOWN`
221
at_hori=`expr $atnum / $DOWN`
223
d.frame -s lab.$at_hori.$at_vert
225
echo $i in $mapset | d.text size=80
227
d.frame -s map.$at_hori.$at_vert
229
g.message -v message="[$i]"
232
if [ "$GIS_OPT_DELAY" -gt 0 ] ; then
233
sleep "$GIS_OPT_DELAY"
236
atnum=`expr $atnum + 1`
242
####################################
250
totmaps=`expr $ACROSS \* $DOWN`
252
if [ $SHOW_VECT -eq 0 ] ; then
253
g.message "Displaying raster maps..."
256
g.message "Displaying vector maps..."
261
d.frame -s full_screen