[GRASS-SVN] r33516 - in grass/branches/develbranch_6: lib/gis raster/r.colors

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Sep 24 01:15:24 EDT 2008


Author: hamish
Date: 2008-09-24 01:15:24 -0400 (Wed, 24 Sep 2008)
New Revision: 33516

Modified:
   grass/branches/develbranch_6/lib/gis/colors.desc
   grass/branches/develbranch_6/raster/r.colors/description.html
   grass/branches/develbranch_6/raster/r.colors/main.c
Log:
backport rules="-" means take from stdin;
color=rules also means interactive mode, saying from stdin is misleading;
handle 'color=rules rules=file' as the user expects


Modified: grass/branches/develbranch_6/lib/gis/colors.desc
===================================================================
--- grass/branches/develbranch_6/lib/gis/colors.desc	2008-09-24 01:56:00 UTC (rev 33515)
+++ grass/branches/develbranch_6/lib/gis/colors.desc	2008-09-24 05:15:24 UTC (rev 33516)
@@ -5,10 +5,10 @@
 byg: blue through yellow to green
 byr: blue through yellow to red
 celsius: blue to red for degree Celsius temperature
-curvature: for terrain curvatures (from v.surf.rst and r.slope.aspect curvature colors)
+curvature: for terrain curvatures (from v.surf.rst and r.slope.aspect)
 differences: differences oriented colors
 elevation: maps percentage ranges of raster values to elevation color ramp
-etopo2: rainbow color ramp for the ETOPO2 2-minute Worldwide Bathymetry/Topography dataset
+etopo2: colors for ETOPO2 2-minute Worldwide Bathymetry/Topography dataset
 evi: enhanced vegetative index colors
 grey: grey scale
 grey1.0: grey scale for raster values between 0.0-1.0
@@ -21,11 +21,11 @@
 rainbow: rainbow color table
 ramp: color ramp
 random: random color table
-rules: create new color table based on user-specified rules read from stdin
+rules: create new color table based on user-specified rules
 ryb: red through yellow to blue
 ryg: red through yellow to green
 sepia: yellowish-brown through to white
 slope: r.slope.aspect-type slope colors for raster values 0-90
-srtm: color palette for Shuttle Radar Topography Mission elevation values
+srtm: color palette for Shuttle Radar Topography Mission elevation
 terrain: global elevation color table covering -11000 to +8850m
 wave: color wave

Modified: grass/branches/develbranch_6/raster/r.colors/description.html
===================================================================
--- grass/branches/develbranch_6/raster/r.colors/description.html	2008-09-24 01:56:00 UTC (rev 33515)
+++ grass/branches/develbranch_6/raster/r.colors/description.html	2008-09-24 05:15:24 UTC (rev 33516)
@@ -39,7 +39,7 @@
      random      random color table
      grey.eq     histogram-equalized grey scale
      grey.log    histogram logarithmic transformed grey scale
-     rules       create new color table based on user-specified rules read from stdin
+     rules       create new color table based on user-specified rules
 </pre>
 
 <p>

Modified: grass/branches/develbranch_6/raster/r.colors/main.c
===================================================================
--- grass/branches/develbranch_6/raster/r.colors/main.c	2008-09-24 01:56:00 UTC (rev 33515)
+++ grass/branches/develbranch_6/raster/r.colors/main.c	2008-09-24 05:15:24 UTC (rev 33516)
@@ -193,7 +193,7 @@
     opt.rules = G_define_standard_option(G_OPT_F_INPUT);
     opt.rules->key = "rules";
     opt.rules->required = NO;
-    opt.rules->description = _("Path to rules file");
+    opt.rules->description = _("Path to rules file (\"-\" to read rules from stdin)");
     opt.rules->guisection = _("Colors");
 
     flag.r = G_define_flag();
@@ -259,6 +259,24 @@
     cmap = opt.rast->answer;
     rules = opt.rules->answer;
 
+    /* handle 'color=rules rules=file' */
+    if(style && rules) {
+	if(strcmp(style, "rules") == 0)
+	    style = NULL;
+    }
+
+    /* handle rules="-" (from stdin) by translating that to colors=rules */
+    /* this method should not be ported to GRASS 7 where color=rules DNE */
+    if(rules && strcmp(rules, "-") == 0) {
+	if(style && (strcmp(style, "rules") != 0))
+	    G_fatal_error(
+	      _("\"color\", \"rules\", and \"raster\" options are mutually exclusive"));
+	else {
+	    style = G_store("rules");
+	    rules = NULL;
+	}
+    }
+
     if (!name)
 	G_fatal_error(_("No map specified"));
 



More information about the grass-commit mailing list