[GRASS-SVN] r37046 - grass/branches/develbranch_6/ps/ps.map

svn_grass at osgeo.org svn_grass at osgeo.org
Fri May 8 02:35:44 EDT 2009


Author: hamish
Date: 2009-05-08 02:35:43 -0400 (Fri, 08 May 2009)
New Revision: 37046

Modified:
   grass/branches/develbranch_6/ps/ps.map/colortable.h
   grass/branches/develbranch_6/ps/ps.map/description.html
   grass/branches/develbranch_6/ps/ps.map/ps_map.c
   grass/branches/develbranch_6/ps/ps.map/r_colortable.c
Log:
allow CELL maps to use continuous gradient legends

Modified: grass/branches/develbranch_6/ps/ps.map/colortable.h
===================================================================
--- grass/branches/develbranch_6/ps/ps.map/colortable.h	2009-05-08 06:16:03 UTC (rev 37045)
+++ grass/branches/develbranch_6/ps/ps.map/colortable.h	2009-05-08 06:35:43 UTC (rev 37046)
@@ -18,7 +18,7 @@
     int cols;
     int nodata;
     int tickbar;
-    int discrete;	/* for FP maps use discrete bands not continuous gradient */
+    int discrete;	/* force discrete bands or continuous gradient */
     int range_override;
 };
 

Modified: grass/branches/develbranch_6/ps/ps.map/description.html
===================================================================
--- grass/branches/develbranch_6/ps/ps.map/description.html	2009-05-08 06:16:03 UTC (rev 37045)
+++ grass/branches/develbranch_6/ps/ps.map/description.html	2009-05-08 06:35:43 UTC (rev 37046)
@@ -244,7 +244,7 @@
 	<B>color</B> text color
 	<B>nodata</B> [Y|n]
 	<B>tickbar</B> [y|N]
-	<B>discrete</B> [y|N]
+	<B>discrete</B> [y|n]
 	<B>end</B>
 </PRE>
 
@@ -270,6 +270,7 @@
 See also the <a href="#vlegend">vlegend</a> command for creating vector map
 legends.
 
+
 <h4>Categorical (CELL) Maps</h4>
 
 Adding the <B>nodata N</B> instruction will prevent the "no data" box 
@@ -279,9 +280,8 @@
 <B>Note</B>:  Be careful about asking for color tables for integer
 raster map layers which have many categories, such as elevation.
 This could result in the printing of an extremely long color table!
-In this situation it is useful to use <em>r.mapcalc</em> to convert the
-map to a floating point (FCELL) map to take advantage of the continuous
-color gradient legend.
+In this situation it is useful to use the <B>discrete N</B> instruction
+to force a continuous color gradient legend.
 <P>
 Be aware that the color table only includes categories which
 have a label. If there are only a few categories, you can use
@@ -289,6 +289,7 @@
 do this by hand, you can supply a label rules file to the <em>r.category</em>
 module.
 
+
 <h4>Floating point (FCELL and DCELL) Maps</h4>
 
 The legend's <B>range</B> can be adjusted for floating point rasters, but if

Modified: grass/branches/develbranch_6/ps/ps.map/ps_map.c
===================================================================
--- grass/branches/develbranch_6/ps/ps.map/ps_map.c	2009-05-08 06:16:03 UTC (rev 37045)
+++ grass/branches/develbranch_6/ps/ps.map/ps_map.c	2009-05-08 06:35:43 UTC (rev 37046)
@@ -145,10 +145,10 @@
 
     /* do the colortable, if requested */
     if (PS.do_colortable) {
-	if (G_raster_map_is_fp(ct.name, ct.mapset) && ct.discrete == FALSE)
+	if (ct.discrete == TRUE)
+	    PS_colortable();
+	else
 	    PS_fcolortable();
-	else
-	    PS_colortable();
     }
 
     /* do comments, if any */

Modified: grass/branches/develbranch_6/ps/ps.map/r_colortable.c
===================================================================
--- grass/branches/develbranch_6/ps/ps.map/r_colortable.c	2009-05-08 06:16:03 UTC (rev 37045)
+++ grass/branches/develbranch_6/ps/ps.map/r_colortable.c	2009-05-08 06:35:43 UTC (rev 37046)
@@ -23,7 +23,7 @@
     "color      color",
     "nodata     Y|n",
     "tickbar    y|N"
-    "discrete   y|N"
+    "discrete   y|n"
     ""
 };
 
@@ -44,7 +44,7 @@
     h = w = x = y = 0.0;
     ct.nodata = TRUE;
     ct.tickbar = FALSE;
-    ct.discrete = FALSE;
+    ct.discrete = -1;	    /* default: TRUE for CELL map, FALSE for FP maps */
     range_override = FALSE;
 
     while (input(2, buf, help)) {
@@ -149,6 +149,7 @@
 
 	error(key, data, "illegal colortabe sub-request");
     }
+
     ct.x = x;
     ct.y = y;
     if (fontsize)
@@ -165,6 +166,14 @@
 	}
     }
 
+    /* set default if legend type was not specified */
+    if (ct.discrete == -1) {
+	if (G_raster_map_is_fp(ct.name, ct.mapset))
+	    ct.discrete = FALSE;
+	else
+	    ct.discrete = TRUE;
+    }
+
     ct.min = min;
     ct.max = max;
     ct.range_override = range_override;



More information about the grass-commit mailing list