[GRASS-SVN] r56765 - grass-addons/grass6/display/d.shortcuts

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Jun 17 22:20:02 PDT 2013


Author: hamish
Date: 2013-06-17 22:20:01 -0700 (Mon, 17 Jun 2013)
New Revision: 56765

Modified:
   grass-addons/grass6/display/d.shortcuts/d.mark
Log:
auto-add the symbol's group; enable access to all groups

Modified: grass-addons/grass6/display/d.shortcuts/d.mark
===================================================================
--- grass-addons/grass6/display/d.shortcuts/d.mark	2013-06-18 05:13:54 UTC (rev 56764)
+++ grass-addons/grass6/display/d.shortcuts/d.mark	2013-06-18 05:20:01 UTC (rev 56765)
@@ -1,14 +1,13 @@
 #!/bin/sh
 # d.mark - quickly display site data in a nice way
 #
-# COPYRIGHT:	(c) 2007 by Hamish Bowman
+# COPYRIGHT:	(c) 2007-2013 by Hamish Bowman
 #
 #	This program is free software under the GNU General Public
 #	License (>=v2). Read the file COPYING that comes with GRASS
 #	for details.
 #
 
-
 #%Module
 #% description: Quickly display a marker on the display monitor
 #%End
@@ -25,7 +24,7 @@
 #% key_desc: name
 #% description: Basic symbol to use
 #% answer: triangle
-#% options: arrow1,arrow2,box,circle,cross1,cross2,diamond,marker,octagon,point,pushpin,star,triangle,x
+#% options: 4pt_star,adcp,airport,alpha_flag,arrow1,arrow2,box,bridge,circle,compass,cross1,cross2,diamond,dive_flag,fancy_compass,fiducial,fish,half-arrow_left,half-arrow_right,half-box,half-circle,marker,muchomurka,n_arrow1,n_arrow1b,n_arrow2,n_arrow3,n_arrow4,n_arrow5,n_arrow6,n_arrow7a,n_arrow7b,n_arrow8,octagon,offbox_ne,offbox_nw,offbox_se,offbox_sw,pentagon,ping,point,pushpin,ring,smrk,star,strike_box,strike_circle,strike_half-bowtie,strike_line,strike_triangle,target,triangle,x
 #% required : no
 #%end
 #%option
@@ -81,8 +80,8 @@
 
 
 COORD=`echo "$GIS_OPT_AT" | tr ',' ' '`
+SYMBOL=`basename "$GIS_OPT_SYMBOL"`
 
-
 if [ $GIS_FLAG_M -eq 0 ] ; then
     MAPUN=""
 
@@ -107,10 +106,36 @@
    DOROT=""
 fi
 
+# uncomment to generate #%options: list
+#  for file in `find "$GISBASE/etc/symbol/" -type f`; do
+#     basename "$file"
+#  done | sort | grep -v '~$' | tr '\n' ',' | sed -e 's/,$//'
+#
+
+ICONS=$(
+  for file in `find "$GISBASE/etc/symbol/" -type f`; do
+     basename "$file"
+  done
+)
+
+if [ `echo "$ICONS" | tr ' ' '\n' | grep -c "^$SYMBOL$"` -ne 1 ] ; then
+    g.message -e "Trouble finding symbol \"$SYMBOL\""
+    exit 1
+fi
+
+GROUPDIR=$(dirname `find "$GISBASE/etc/symbol/" -type f -name "$SYMBOL"`)
+GROUP=`basename "$GROUPDIR"`
+if [ -z "$GROUP" ] ; then
+    g.message -e "Trouble locating symbol \"$GROUP/$SYMBOL\""
+    exit 1
+fi
+g.message -d "selected symbol: [$GROUP/$SYMBOL]"
+
+
 (
 cat << EOF
 $DOWIDTH
 $DOROT
-symbol basic/$GIS_OPT_SYMBOL $GIS_OPT_SIZE $COORD $GIS_OPT_COLOR $GIS_OPT_FCOLOR
+symbol $GROUP/$SYMBOL $GIS_OPT_SIZE $COORD $GIS_OPT_COLOR $GIS_OPT_FCOLOR
 EOF
 ) | d.graph $MAPUN



More information about the grass-commit mailing list