|
@@ -1,116 +1,174 @@
|
|
|
#!/bin/sh
|
|
|
-#
|
|
|
############################################################################
|
|
|
#
|
|
|
-# MODULE: d.split for GRASS 5.7, based on split.sh for GRASS 5
|
|
|
-# AUTHOR(S): split.sh by the GRASS team 1989.
|
|
|
-# Updated to GRASS 5.7 by Michael Barton 2004/04/06
|
|
|
-#
|
|
|
-# PURPOSE: Divides active display into 2 frames and draws maps
|
|
|
-# (or runs GRASS commands) in each frame
|
|
|
-# COPYRIGHT: (C) 2004 by the GRASS Development Team
|
|
|
+# MODULE: d.frame.split
|
|
|
+# AUTHOR: M. Hamish Bowman, Dept. Marine Science, Otago Univeristy,
|
|
|
+# New Zealand
|
|
|
+# PURPOSE: Split the display into quarter frames, etc
|
|
|
+# (This script entierly replaces d.split frpm GRASS 5,6)
|
|
|
#
|
|
|
-# This program is free software under the GNU General Public
|
|
|
-# License (>=v2). Read the file COPYING that comes with GRASS
|
|
|
-# for details.
|
|
|
+# COPYRIGHT: (c) 2007 Hamish Bowman, and the GRASS Development Team
|
|
|
+# This program is free software released to the public domain
|
|
|
#
|
|
|
#############################################################################
|
|
|
|
|
|
-
|
|
|
#%Module
|
|
|
-#% description: Divides active display into two frames & displays maps/executes commands in each frame.
|
|
|
-#% keywords: display, setup
|
|
|
+#% description: Split the display into subframes.
|
|
|
#%End
|
|
|
#%option
|
|
|
-#% key: map1
|
|
|
-#% type: string
|
|
|
-#% gisprompt: old,cell,raster
|
|
|
-#% description: Enter raster map to display in 1st frame
|
|
|
-#% required : no
|
|
|
-#%end
|
|
|
-#%option
|
|
|
-#% key: cmd1
|
|
|
-#% type: string
|
|
|
-#% answer: d.rast
|
|
|
-#% description: Enter command to execute in 1st frame
|
|
|
-#% required : no
|
|
|
-#%end
|
|
|
-#%option
|
|
|
-#% key: map2
|
|
|
-#% type: string
|
|
|
-#% gisprompt: old,cell,raster
|
|
|
-#% description: Enter raster map to display in 2nd frame
|
|
|
-#% required : no
|
|
|
+#% key: frames
|
|
|
+#% type: integer
|
|
|
+#% description: Number of subframes
|
|
|
+#% options: 2,4,6,8,9,12,16
|
|
|
+#% answer: 4
|
|
|
#%end
|
|
|
-#%option
|
|
|
-#% key: cmd2
|
|
|
-#% type: string
|
|
|
-#% answer: d.rast
|
|
|
-#% description: Enter command to execute in 2nd frame
|
|
|
-#% required : no
|
|
|
+#%flag
|
|
|
+#% key: h
|
|
|
+#% description: Split horizontally not vertically
|
|
|
#%end
|
|
|
-#%option
|
|
|
-#% key: view
|
|
|
-#% type: string
|
|
|
-#% answer: vert
|
|
|
-#% description: How to split display
|
|
|
-#% options: vert,horiz
|
|
|
-#% required : yes
|
|
|
-#%end
|
|
|
-
|
|
|
|
|
|
if [ -z "$GISBASE" ] ; then
|
|
|
- echo "You must be in GRASS GIS to run this program." >&2
|
|
|
- exit 1
|
|
|
-fi
|
|
|
+ echo "You must be in GRASS GIS to run this program." 1>&2
|
|
|
+ exit 1
|
|
|
+fi
|
|
|
|
|
|
-if [ "$1" != "@ARGS_PARSED@" ] ; then
|
|
|
- exec g.parser "$0" "$@"
|
|
|
-fi
|
|
|
+# skip parser if no args are given
|
|
|
+if [ "$#" -gt 0 ] ; then
|
|
|
+ if [ "$1" != "@ARGS_PARSED@" ] ; then
|
|
|
+ exec g.parser "$0" "$@"
|
|
|
+ fi
|
|
|
+else
|
|
|
+ GIS_OPT_FRAMES=4
|
|
|
+ GIS_FLAG_H=0
|
|
|
+fi
|
|
|
|
|
|
|
|
|
-# Set up the two windows
|
|
|
-if [ "$GIS_OPT_VIEW" = "vert" ]
|
|
|
-then
|
|
|
-# split it: left (win1) and right (win2)
|
|
|
- d.frame -e
|
|
|
- d.frame -c frame=win1 at=0,100,0,49.5
|
|
|
- d.frame -c frame=win2 at=0,100,50.5,100
|
|
|
+if [ `d.mon -p | cut -f1 -d' '` != "Currently" ] ; then
|
|
|
+ g.message -e "No monitor currently selected for output"
|
|
|
+ exit 1
|
|
|
fi
|
|
|
|
|
|
-if [ "$GIS_OPT_VIEW" = "horiz" ]
|
|
|
-then
|
|
|
-# split it: top (win1) and bottom (win2)
|
|
|
- d.frame -e
|
|
|
- d.frame -c frame=win1 at=50.5,100,0,100
|
|
|
- d.frame -c frame=win2 at=0,49.5,0,100
|
|
|
+d.erase -f
|
|
|
+if [ $? -ne 0 ] ; then
|
|
|
+ g.message -e "Error clearing display monitor"
|
|
|
+ exit 1
|
|
|
fi
|
|
|
|
|
|
|
|
|
-g.message "View displayed: $GIS_OPT_VIEW"
|
|
|
+case "$GIS_OPT_FRAMES" in
|
|
|
+ 2) if [ $GIS_FLAG_H -eq 0 ] ; then
|
|
|
+ #split vert
|
|
|
+ d.frame -c frame=uno at=50,100,0,100
|
|
|
+ d.frame -c frame=dos at=0,50,0,100
|
|
|
+ else
|
|
|
+ d.frame -c frame=uno at=0,100,0,50
|
|
|
+ d.frame -c frame=dos at=0,100,50,100
|
|
|
+ fi
|
|
|
+ ;;
|
|
|
+ 4) d.frame -c frame=uno at=50,100,0,50
|
|
|
+ d.frame -c frame=dos at=50,100,50,100
|
|
|
+ d.frame -c frame=tres at=0,50,0,50
|
|
|
+ d.frame -c frame=cuatro at=0,50,50,100
|
|
|
+ ;;
|
|
|
+ 6) if [ $GIS_FLAG_H -eq 0 ] ; then
|
|
|
+ #split vert
|
|
|
+ d.frame -c frame=uno at=66.6667,100,0,50
|
|
|
+ d.frame -c frame=dos at=66.6667,100,50,100
|
|
|
+ d.frame -c frame=tres at=33.3333,66.6667,0,50
|
|
|
+ d.frame -c frame=cuatro at=33.3333,66.6667,50,100
|
|
|
+ d.frame -c frame=cinco at=0,33.3333,0,50
|
|
|
+ d.frame -c frame=seis at=0,33.3333,50,100
|
|
|
+ else
|
|
|
+ d.frame -c frame=uno at=50,100,0,33.3333
|
|
|
+ d.frame -c frame=dos at=50,100,33.3333,66.6667
|
|
|
+ d.frame -c frame=tres at=50,100,66.6667,100
|
|
|
+ d.frame -c frame=cuatro at=0,50,0,33.3333
|
|
|
+ d.frame -c frame=cinco at=0,50,33.3333,66.6667
|
|
|
+ d.frame -c frame=seis at=0,50,66.6667,100
|
|
|
+ fi
|
|
|
+ ;;
|
|
|
+ 8) if [ $GIS_FLAG_H -eq 0 ] ; then
|
|
|
+ #split vert
|
|
|
+ d.frame -c frame=uno at=75,100,0,50
|
|
|
+ d.frame -c frame=dos at=75,100,50,100
|
|
|
+ d.frame -c frame=tres at=50,75,0,50
|
|
|
+ d.frame -c frame=cuatro at=50,75,50,100
|
|
|
+ d.frame -c frame=cinco at=25,50,0,50
|
|
|
+ d.frame -c frame=seis at=25,50,50,100
|
|
|
+ d.frame -c frame=siete at=0,25,0,50
|
|
|
+ d.frame -c frame=ocho at=0,25,50,100
|
|
|
+ else
|
|
|
+ d.frame -c frame=uno at=50,100,0,25
|
|
|
+ d.frame -c frame=dos at=50,100,25,50
|
|
|
+ d.frame -c frame=tres at=50,100,50,75
|
|
|
+ d.frame -c frame=cuatro at=50,100,75,100
|
|
|
+ d.frame -c frame=cinco at=0,50,0,25
|
|
|
+ d.frame -c frame=seis at=0,50,25,50
|
|
|
+ d.frame -c frame=siete at=0,50,50,75
|
|
|
+ d.frame -c frame=ocho at=0,50,75,100
|
|
|
+ fi
|
|
|
+ ;;
|
|
|
+ 9) d.frame -c frame=uno at=66.6667,100,0,33.3333
|
|
|
+ d.frame -c frame=dos at=66.6667,100,33.3333,66.6667
|
|
|
+ d.frame -c frame=tres at=66.6667,100,66.6667,100
|
|
|
+ d.frame -c frame=cuatro at=33.3333,66.6667,0,33.3333
|
|
|
+ d.frame -c frame=cinco at=33.3333,66.6667,33.3333,66.6667
|
|
|
+ d.frame -c frame=seis at=33.3333,66.6667,66.6667,100
|
|
|
+ d.frame -c frame=siete at=0,33.3333,0,33.3333
|
|
|
+ d.frame -c frame=ocho at=0,33.3333,33.3333,66.6667
|
|
|
+ d.frame -c frame=nueve at=0,33.3333,66.6667,100
|
|
|
+ ;;
|
|
|
+ 12) if [ $GIS_FLAG_H -eq 0 ] ; then
|
|
|
+ #split vert
|
|
|
+ d.frame -c frame=uno at=75,100,0,33.3333
|
|
|
+ d.frame -c frame=dos at=75,100,33.3333,66.6667
|
|
|
+ d.frame -c frame=tres at=75,100,66.6667,100
|
|
|
+ d.frame -c frame=cuatro at=50,75,0,33.3333
|
|
|
+ d.frame -c frame=cinco at=50,75,33.3333,66.6667
|
|
|
+ d.frame -c frame=seis at=50,75,66.6667,100
|
|
|
+ d.frame -c frame=siete at=25,50,0,33.3333
|
|
|
+ d.frame -c frame=ocho at=25,50,33.3333,66.6667
|
|
|
+ d.frame -c frame=nueve at=25,50,66.6667,100
|
|
|
+ d.frame -c frame=diez at=0,25,0,33.3333
|
|
|
+ d.frame -c frame=once at=0,25,33.3333,66.6667
|
|
|
+ d.frame -c frame=doce at=0,25,66.6667,100
|
|
|
+ else
|
|
|
+ d.frame -c frame=uno at=66.6667,100,0,25
|
|
|
+ d.frame -c frame=dos at=66.6667,100,25,50
|
|
|
+ d.frame -c frame=tres at=66.6667,100,50,75
|
|
|
+ d.frame -c frame=cuatro at=66.6667,100,75,100
|
|
|
+ d.frame -c frame=cinco at=33.3333,66.6667,0,25
|
|
|
+ d.frame -c frame=seis at=33.3333,66.6667,25,50
|
|
|
+ d.frame -c frame=siete at=33.3333,66.6667,50,75
|
|
|
+ d.frame -c frame=ocho at=33.3333,66.6667,75,100
|
|
|
+ d.frame -c frame=nueve at=0,33.3333,0,25
|
|
|
+ d.frame -c frame=diez at=0,33.3333,25,50
|
|
|
+ d.frame -c frame=once at=0,33.3333,50,75
|
|
|
+ d.frame -c frame=doce at=0,33.3333,75,100
|
|
|
+ fi
|
|
|
+ ;;
|
|
|
+ 16) d.frame -c frame=uno at=75,100,0,25
|
|
|
+ d.frame -c frame=dos at=75,100,25,50
|
|
|
+ d.frame -c frame=tres at=75,100,50,75
|
|
|
+ d.frame -c frame=cuatro at=75,100,75,100
|
|
|
+ d.frame -c frame=cinco at=50,75,0,25
|
|
|
+ d.frame -c frame=seis at=50,75,25,50
|
|
|
+ d.frame -c frame=siete at=50,75,50,75
|
|
|
+ d.frame -c frame=ocho at=50,75,75,100
|
|
|
+ d.frame -c frame=nueve at=25,50,0,25
|
|
|
+ d.frame -c frame=diez at=25,50,25,50
|
|
|
+ d.frame -c frame=once at=25,50,50,75
|
|
|
+ d.frame -c frame=doce at=25,50,75,100
|
|
|
+ d.frame -c frame=trece at=0,25,0,25
|
|
|
+ d.frame -c frame=catorce at=0,25,25,50
|
|
|
+ d.frame -c frame=quince at=0,25,50,75
|
|
|
+ d.frame -c frame=dieciseis at=0,25,75,100
|
|
|
+ ;;
|
|
|
+esac
|
|
|
|
|
|
-if [ "$GIS_OPT_MAP1" != "" ]
|
|
|
-then
|
|
|
- d.frame -s frame=win1
|
|
|
- g.message "Window 1: $GIS_OPT_CMD1 $GIS_OPT_MAP1"
|
|
|
- d.rast $GIS_OPT_MAP1
|
|
|
-else
|
|
|
- d.frame -s frame=win1
|
|
|
- g.message "Window 1: $GIS_OPT_CMD1 $GIS_OPT_MAP1"
|
|
|
- $GIS_OPT_CMD1
|
|
|
-fi
|
|
|
|
|
|
+d.frame -s uno
|
|
|
|
|
|
-if [ "$GIS_OPT_MAP2" != "" ]
|
|
|
-then
|
|
|
- d.frame -s frame=win2
|
|
|
- g.message "Window 2: $GIS_OPT_CMD2 $GIS_OPT_MAP2"
|
|
|
- d.rast $GIS_OPT_MAP2
|
|
|
-else
|
|
|
- d.frame -s frame=win2
|
|
|
- g.message "Window 2: $GIS_OPT_CMD2 $GIS_OPT_MAP2"
|
|
|
- $GIS_OPT_CMD2
|
|
|
-fi
|
|
|
-
|
|
|
-g.message "Done."
|
|
|
g.message "Use 'd.erase -f' to clear frames from display monitor."
|
|
|
+
|
|
|
+exit
|