Преглед изворни кода

change default color table for 2D and 3D rasters (see https://trac.osgeo.org/grass/ticket/3043)

Introduces DEFAULT_COLOR_TABLE define for
an easy change and global control.

Depends on https://trac.osgeo.org/grass/changeset/68506 which includes the
viridis color table used as a new default.

Also removes (obsolete?) calls to the
color table specific function and
uses the general function instead.


git-svn-id: https://svn.osgeo.org/grass/grass/trunk@68586 15284696-431f-4ddb-bdfa-cd5b030d7da7
Vaclav Petras пре 9 година
родитељ
комит
69a2251192
3 измењених фајлова са 4 додато и 3 уклоњено
  1. 1 0
      include/gis.h
  2. 2 2
      lib/raster/color_read.c
  3. 1 1
      lib/raster3d/color.c

+ 1 - 0
include/gis.h

@@ -340,6 +340,7 @@ enum rule_type {
 /* default colors */
 #define DEFAULT_FG_COLOR "black"
 #define DEFAULT_BG_COLOR "white"
+#define DEFAULT_COLOR_TABLE "viridis"
 
 /* error codes */
 #define G_FATAL_EXIT    0

+ 2 - 2
lib/raster/color_read.c

@@ -87,7 +87,7 @@ int Rast_read_colors(const char *name, const char *mapset,
 		Rast_get_range_min_max(&range, &min, &max);
 		if (!Rast_is_c_null_value(&min) &&
 		    !Rast_is_c_null_value(&max))
-		    Rast_make_rainbow_colors(colors, min, max);
+		    Rast_make_colors(colors, DEFAULT_COLOR_TABLE, min, max);
 		return 0;
 	    }
 	}
@@ -96,7 +96,7 @@ int Rast_read_colors(const char *name, const char *mapset,
 		Rast_get_fp_range_min_max(&drange, &dmin, &dmax);
 		if (!Rast_is_d_null_value(&dmin) &&
 		    !Rast_is_d_null_value(&dmax))
-		    Rast_make_rainbow_fp_colors(colors, dmin, dmax);
+		    Rast_make_fp_colors(colors, DEFAULT_COLOR_TABLE, dmin, dmax);
 		return 0;
 	    }
 	}

+ 1 - 1
lib/raster3d/color.c

@@ -57,7 +57,7 @@ int Rast3d_read_colors(const char *name, const char *mapset, struct Colors *colo
 	if (Rast3d_read_range(name, mapset, &drange) >= 0) {
 	    Rast_get_fp_range_min_max(&drange, &dmin, &dmax);
 	    if (!Rast_is_d_null_value(&dmin) && !Rast_is_d_null_value(&dmax))
-		Rast_make_rainbow_fp_colors(colors, dmin, dmax);
+		Rast_make_fp_colors(colors, DEFAULT_COLOR_TABLE, dmin, dmax);
 	    return 0;
 	}
 	err = "missing";