[GRASS-SVN] r55191 - grass/branches/develbranch_6/scripts/v.colors

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Feb 25 01:07:55 PST 2013


Author: hamish
Date: 2013-02-25 01:07:54 -0800 (Mon, 25 Feb 2013)
New Revision: 55191

Modified:
   grass/branches/develbranch_6/scripts/v.colors/v.colors
Log:
add v.colors placeholder raster map naming option (#1693)

Modified: grass/branches/develbranch_6/scripts/v.colors/v.colors
===================================================================
--- grass/branches/develbranch_6/scripts/v.colors/v.colors	2013-02-25 08:52:46 UTC (rev 55190)
+++ grass/branches/develbranch_6/scripts/v.colors/v.colors	2013-02-25 09:07:54 UTC (rev 55191)
@@ -83,6 +83,15 @@
 #% gisprompt: old_file,file,input
 #% guisection: Colors
 #%End
+#%Option
+#% key: placeholder
+#% type: string
+#% required: no
+#% label: Dummy raster map name containing color rules for use with d.legend
+#% description: Use with the -s flag (using this option implies -s)
+#% gisprompt: new,cell,raster
+#% guisection: Colors
+#%End
 #%Flag
 #% key: s
 #% description: Save placeholder raster map for use with d.legend
@@ -314,16 +323,24 @@
 fi
 
 
-if [ $GIS_FLAG_S -eq 1 ] ; then
-   g.rename rast="tmp_colr_$$","vcolors_$$" --quiet
-   g.message "Raster map containing color rules saved to <vcolors_$$>"
+if [ -n "$GIS_OPT_PLACEHOLDER" ] || [ $GIS_FLAG_S -eq 1 ] ; then
+
+   if [ -n "$GIS_OPT_PLACEHOLDER" ] ; then
+      DUMMY_NAME="$GIS_OPT_PLACEHOLDER"
+   else
+      DUMMY_NAME="vcolors_$$"
+   fi
+
+   g.rename rast="tmp_colr_$$","$DUMMY_NAME" --quiet
+   g.message "Raster map containing color rules saved to <$DUMMY_NAME>"
+
    # TODO save full v.colors command line history
-   r.support map="vcolors_$$" history="" \
+   r.support map="$DUMMY_NAME" history="" \
 	source1="vector map=$GIS_OPT_MAP" \
 	source2="column=$GIS_OPT_COLUMN" \
 	title="Dummy raster to use as thematic vector legend" \
 	description="generated by v.colors using r.mapcalc"
-   r.support map="vcolors_$$" \
+   r.support map="$DUMMY_NAME" \
 	history="RGB saved into <$GIS_OPT_RGB_COLUMN> using <$GIS_OPT_COLOR$GIS_OPT_RASTER$GIS_OPT_RULES>"
 else
    g.remove rast="tmp_colr_$$" --quiet



More information about the grass-commit mailing list