[GRASS-SVN] r38113 - in grass/trunk: imagery/i.albedo
imagery/i.biomass imagery/i.eb.soilheatflux
imagery/i.evapo.time_integration imagery/i.modis.qc
imagery/i.vi imagery/i.vpoints include lib/g3d lib/raster
lib/rst/interp_float ps/ps.map raster/r.composite
raster/r.flow raster/r.lake raster/r.param.scale
raster/r.random raster/r.random.surface raster/r.slope.aspect
raster/r.terraflow raster/r.watershed/ram
raster/r.watershed/seg raster/simwe/simlib
swig/perl/R_slope_aspect/r_slope_aspect vector/v.to.rast
svn_grass at osgeo.org
svn_grass at osgeo.org
Mon Jun 29 05:49:37 EDT 2009
Author: martinl
Date: 2009-06-29 05:49:36 -0400 (Mon, 29 Jun 2009)
New Revision: 38113
Modified:
grass/trunk/imagery/i.albedo/main.c
grass/trunk/imagery/i.biomass/main.c
grass/trunk/imagery/i.eb.soilheatflux/main.c
grass/trunk/imagery/i.evapo.time_integration/main.c
grass/trunk/imagery/i.modis.qc/main.c
grass/trunk/imagery/i.vi/main.c
grass/trunk/imagery/i.vpoints/colors.c
grass/trunk/include/raster.h
grass/trunk/lib/g3d/g3dcolor.c
grass/trunk/lib/raster/color_hist.c
grass/trunk/lib/raster/color_init.c
grass/trunk/lib/raster/color_insrt.c
grass/trunk/lib/raster/color_rand.c
grass/trunk/lib/raster/color_read.c
grass/trunk/lib/raster/color_rule.c
grass/trunk/lib/raster/color_rules.c
grass/trunk/lib/raster/color_set.c
grass/trunk/lib/raster/color_write.c
grass/trunk/lib/raster/color_xform.c
grass/trunk/lib/rst/interp_float/output2d.c
grass/trunk/lib/rst/interp_float/resout2d.c
grass/trunk/ps/ps.map/main.c
grass/trunk/raster/r.composite/main.c
grass/trunk/raster/r.flow/io.c
grass/trunk/raster/r.lake/main.c
grass/trunk/raster/r.param.scale/write_cols.c
grass/trunk/raster/r.random.surface/save.c
grass/trunk/raster/r.random/support.c
grass/trunk/raster/r.slope.aspect/main.c
grass/trunk/raster/r.terraflow/main.cc
grass/trunk/raster/r.watershed/ram/close_maps.c
grass/trunk/raster/r.watershed/seg/close_maps.c
grass/trunk/raster/simwe/simlib/output.c
grass/trunk/swig/perl/R_slope_aspect/r_slope_aspect/r_slope_aspect.c
grass/trunk/vector/v.to.rast/support.c
Log:
rasterlib: fns from color_rule.c renamed, see
http://trac.osgeo.org/grass/wiki/Grass7/RasterLib
Modified: grass/trunk/imagery/i.albedo/main.c
===================================================================
--- grass/trunk/imagery/i.albedo/main.c 2009-06-28 20:49:17 UTC (rev 38112)
+++ grass/trunk/imagery/i.albedo/main.c 2009-06-29 09:49:36 UTC (rev 38113)
@@ -61,7 +61,8 @@
RASTER_MAP_TYPE in_data_type[MAXFILES]; /* 0=numbers 1=text */
RASTER_MAP_TYPE out_data_type = DCELL_TYPE;
-
+ CELL val1, val2;
+
/************************************/
int peak1, peak2, peak3;
int i_peak1, i_peak2, i_peak3;
@@ -401,7 +402,9 @@
/* Color table from 0.0 to 1.0 */
Rast_init_colors(&colors);
- Rast_add_color_rule(0.0, 0, 0, 0, 1.0, 255, 255, 255, &colors);
+ val1 = 0;
+ val2 = 1;
+ Rast_add_c_color_rule(&val1, 0, 0, 0, &val2, 255, 255, 255, &colors);
/* Metadata */
Rast_short_history(result, "raster", &history);
Rast_command_history(&history);
Modified: grass/trunk/imagery/i.biomass/main.c
===================================================================
--- grass/trunk/imagery/i.biomass/main.c 2009-06-28 20:49:17 UTC (rev 38112)
+++ grass/trunk/imagery/i.biomass/main.c 2009-06-29 09:49:36 UTC (rev 38113)
@@ -42,6 +42,8 @@
void *inrast_fpar, *inrast_luf, *inrast_lat;
void *inrast_doy, *inrast_tsw, *inrast_wa;
DCELL * outrast1;
+ CELL val1, val2;
+
/************************************/
G_gisinit(argv[0]);
module = G_define_module();
@@ -183,7 +185,9 @@
/* Color table for biomass */
Rast_init_colors(&colors);
- Rast_add_color_rule(0, 0, 0, 0, 1, 255, 255, 255, &colors);
+ val1 = 0;
+ val2 = 1;
+ Rast_add_c_color_rule(&val1, 0, 0, 0, &val2, 255, 255, 255, &colors);
G_free(inrast_fpar);
G_free(inrast_luf);
G_free(inrast_lat);
Modified: grass/trunk/imagery/i.eb.soilheatflux/main.c
===================================================================
--- grass/trunk/imagery/i.eb.soilheatflux/main.c 2009-06-28 20:49:17 UTC (rev 38112)
+++ grass/trunk/imagery/i.eb.soilheatflux/main.c 2009-06-29 09:49:36 UTC (rev 38113)
@@ -42,6 +42,7 @@
void *inrast_albedo, *inrast_ndvi, *inrast_tempk, *inrast_rnet,
*inrast_time;
DCELL * outrast;
+ CELL val1, val2;
G_gisinit(argv[0]);
@@ -186,7 +187,9 @@
/* Colors in grey shade */
Rast_init_colors(&colors);
- Rast_add_color_rule(0.0, 0, 0, 0, 200.0, 255, 255, 255, &colors);
+ val1 = 0;
+ val2 = 200;
+ Rast_add_c_color_rule(&val1, 0, 0, 0, &val2, 255, 255, 255, &colors);
Rast_short_history(result, "raster", &history);
Rast_command_history(&history);
Rast_write_history(result, &history);
Modified: grass/trunk/imagery/i.evapo.time_integration/main.c
===================================================================
--- grass/trunk/imagery/i.evapo.time_integration/main.c 2009-06-28 20:49:17 UTC (rev 38112)
+++ grass/trunk/imagery/i.evapo.time_integration/main.c 2009-06-29 09:49:36 UTC (rev 38113)
@@ -63,6 +63,7 @@
double startperiod, endperiod; /*first and last days (DOYs) of the period studied */
void *inrast[MAXFILES], *inrast1[MAXFILES], *inrast2[MAXFILES];
DCELL *outrast;
+ CELL val1, val2;
RASTER_MAP_TYPE in_data_type[MAXFILES]; /* ETa */
RASTER_MAP_TYPE in_data_type1[MAXFILES]; /* DOY of ETa */
@@ -429,7 +430,9 @@
/* Color table from 0.0 to 10.0 */
Rast_init_colors(&colors);
- Rast_add_color_rule(0.0, 0, 0, 0, 10.0, 255, 255, 255, &colors);
+ val1 = 0;
+ val2 = 10;
+ Rast_add_c_color_rule(&val1, 0, 0, 0, &val2, 255, 255, 255, &colors);
/* Metadata */
Rast_short_history(result, "raster", &history);
Rast_command_history(&history);
Modified: grass/trunk/imagery/i.modis.qc/main.c
===================================================================
--- grass/trunk/imagery/i.modis.qc/main.c 2009-06-28 20:49:17 UTC (rev 38112)
+++ grass/trunk/imagery/i.modis.qc/main.c 2009-06-29 09:49:36 UTC (rev 38113)
@@ -77,7 +77,8 @@
CELL *inrast;
CELL *outrast;
RASTER_MAP_TYPE data_type_output = CELL_TYPE;
-
+ CELL val1, val2;
+
/************************************/
G_gisinit(argv[0]);
module = G_define_module();
@@ -334,7 +335,9 @@
/* Color from 0 to 10 in grey */
Rast_init_colors(&colors);
- Rast_add_color_rule(0, 0, 0, 0, 10, 255, 255, 255, &colors);
+ val1 = 0;
+ val2 = 10;
+ Rast_add_c_color_rule(&val1, 0, 0, 0, &val2, 255, 255, 255, &colors);
Rast_short_history(result, "raster", &history);
Rast_command_history(&history);
Rast_write_history(result, &history);
Modified: grass/trunk/imagery/i.vi/main.c
===================================================================
--- grass/trunk/imagery/i.vi/main.c 2009-06-28 20:49:17 UTC (rev 38112)
+++ grass/trunk/imagery/i.vi/main.c 2009-06-29 09:49:36 UTC (rev 38113)
@@ -69,6 +69,7 @@
DCELL *inrast_redchan, *inrast_nirchan, *inrast_greenchan;
DCELL *inrast_bluechan, *inrast_chan5chan, *inrast_chan7chan;
DCELL *outrast;
+ CELL val1, val2;
G_gisinit(argv[0]);
@@ -400,7 +401,9 @@
/* Color from -1.0 to +1.0 in grey */
Rast_init_colors(&colors);
- Rast_add_color_rule(-1.0, 0, 0, 0, 1.0, 255, 255, 255, &colors);
+ val1 = -1;
+ val2 = 1;
+ Rast_add_c_color_rule(&val1, 0, 0, 0, &val2, 255, 255, 255, &colors);
Rast_short_history(result, "raster", &history);
Rast_command_history(&history);
Rast_write_history(result, &history);
Modified: grass/trunk/imagery/i.vpoints/colors.c
===================================================================
--- grass/trunk/imagery/i.vpoints/colors.c 2009-06-28 20:49:17 UTC (rev 38112)
+++ grass/trunk/imagery/i.vpoints/colors.c 2009-06-29 09:49:36 UTC (rev 38113)
@@ -29,48 +29,48 @@
{
/* SCREEN OUTLINE and CURSOR */
- Rast_add_color_rule((CELL) 241, 180, 180, 180, (CELL) 241, 180, 180, 180,
+ Rast_add_c_color_rule((CELL) 241, 180, 180, 180, (CELL) 241, 180, 180, 180,
colors);
/* RED */
- Rast_add_color_rule((CELL) 242, 200, 90, 90, (CELL) 242, 200, 90, 90,
+ Rast_add_c_color_rule((CELL) 242, 200, 90, 90, (CELL) 242, 200, 90, 90,
colors);
/* ORANGE */
- Rast_add_color_rule((CELL) 243, 150, 100, 50, (CELL) 243, 150, 100, 50,
+ Rast_add_c_color_rule((CELL) 243, 150, 100, 50, (CELL) 243, 150, 100, 50,
colors);
/* YELLOW */
- Rast_add_color_rule((CELL) 244, 200, 200, 10, (CELL) 244, 200, 200, 10,
+ Rast_add_c_color_rule((CELL) 244, 200, 200, 10, (CELL) 244, 200, 200, 10,
colors);
/* GREEN */
- Rast_add_color_rule((CELL) 245, 90, 200, 90, (CELL) 245, 90, 200, 90,
+ Rast_add_c_color_rule((CELL) 245, 90, 200, 90, (CELL) 245, 90, 200, 90,
colors);
/* BLUE */
- Rast_add_color_rule((CELL) 246, 90, 90, 200, (CELL) 246, 90, 90, 200,
+ Rast_add_c_color_rule((CELL) 246, 90, 90, 200, (CELL) 246, 90, 90, 200,
colors);
/* INDIGO */
- Rast_add_color_rule((CELL) 247, 100, 100, 10, (CELL) 247, 100, 100, 10,
+ Rast_add_c_color_rule((CELL) 247, 100, 100, 10, (CELL) 247, 100, 100, 10,
colors);
/* VIOLET */
- Rast_add_color_rule((CELL) 248, 150, 150, 10, (CELL) 248, 150, 150, 10,
+ Rast_add_c_color_rule((CELL) 248, 150, 150, 10, (CELL) 248, 150, 150, 10,
colors);
/* WHITE */
- Rast_add_color_rule((CELL) 249, 250, 250, 250, (CELL) 249, 250, 250, 250,
+ Rast_add_c_color_rule((CELL) 249, 250, 250, 250, (CELL) 249, 250, 250, 250,
colors);
/* BLACK */
- Rast_add_color_rule((CELL) 250, 0, 0, 0, (CELL) 250, 0, 0, 0, colors);
+ Rast_add_c_color_rule((CELL) 250, 0, 0, 0, (CELL) 250, 0, 0, 0, colors);
/* GRAY */
- Rast_add_color_rule((CELL) 251, 180, 180, 180, (CELL) 251, 180, 180, 180,
+ Rast_add_c_color_rule((CELL) 251, 180, 180, 180, (CELL) 251, 180, 180, 180,
colors);
/* BROWN */
- Rast_add_color_rule((CELL) 252, 100, 100, 30, (CELL) 252, 100, 100, 30,
+ Rast_add_c_color_rule((CELL) 252, 100, 100, 30, (CELL) 252, 100, 100, 30,
colors);
/* MAGENTA */
- Rast_add_color_rule((CELL) 253, 150, 90, 150, (CELL) 253, 150, 90, 150,
+ Rast_add_c_color_rule((CELL) 253, 150, 90, 150, (CELL) 253, 150, 90, 150,
colors);
/* AQUA */
- Rast_add_color_rule((CELL) 254, 50, 120, 120, (CELL) 254, 50, 120, 120,
+ Rast_add_c_color_rule((CELL) 254, 50, 120, 120, (CELL) 254, 50, 120, 120,
colors);
/* */
- Rast_add_color_rule((CELL) 255, 250, 0, 0, (CELL) 255, 250, 0, 0, colors);
+ Rast_add_c_color_rule((CELL) 255, 250, 0, 0, (CELL) 255, 250, 0, 0, colors);
set_colors(colors);
@@ -144,32 +144,32 @@
switch (curs_color) {
case BLUE:
- Rast_add_color_rule((CELL) 241, 90, 90, 200, (CELL) 241, 90, 90, 200,
+ Rast_add_c_color_rule((CELL) 241, 90, 90, 200, (CELL) 241, 90, 90, 200,
colors);
break;
case GRAY:
- Rast_add_color_rule((CELL) 241, 180, 180, 180, (CELL) 241, 180, 180, 180,
+ Rast_add_c_color_rule((CELL) 241, 180, 180, 180, (CELL) 241, 180, 180, 180,
colors);
break;
case GREEN:
- Rast_add_color_rule((CELL) 241, 90, 200, 90, (CELL) 241, 90, 200, 90,
+ Rast_add_c_color_rule((CELL) 241, 90, 200, 90, (CELL) 241, 90, 200, 90,
colors);
break;
case RED:
- Rast_add_color_rule((CELL) 241, 200, 90, 90, (CELL) 241, 200, 90, 90,
+ Rast_add_c_color_rule((CELL) 241, 200, 90, 90, (CELL) 241, 200, 90, 90,
colors);
break;
case WHITE:
- Rast_add_color_rule((CELL) 241, 250, 250, 250, (CELL) 241, 250, 250, 250,
+ Rast_add_c_color_rule((CELL) 241, 250, 250, 250, (CELL) 241, 250, 250, 250,
colors);
break;
case YELLOW:
- Rast_add_color_rule((CELL) 241, 200, 200, 10, (CELL) 241, 200, 200, 10,
+ Rast_add_c_color_rule((CELL) 241, 200, 200, 10, (CELL) 241, 200, 200, 10,
colors);
break;
}
Modified: grass/trunk/include/raster.h
===================================================================
--- grass/trunk/include/raster.h 2009-06-28 20:49:17 UTC (rev 38112)
+++ grass/trunk/include/raster.h 2009-06-29 09:49:36 UTC (rev 38113)
@@ -174,36 +174,30 @@
int Rast_remove_colors(const char *, const char *);
/* color_rule.c */
-void Rast_add_d_raster_color_rule(const DCELL *, int, int, int,
- const DCELL *, int, int, int,
- struct Colors *);
-void Rast_add_f_raster_color_rule(const FCELL *, int, int, int,
- const FCELL *, int, int, int,
- struct Colors *);
-void Rast_add_c_raster_color_rule(const CELL *, int, int, int,
- const CELL *, int, int, int,
- struct Colors *);
-void Rast_add_raster_color_rule(const void *, int, int, int,
- const void *, int, int, int,
- struct Colors *, RASTER_MAP_TYPE);
-void Rast_add_color_rule(const CELL, int, int, int,
- const CELL, int, int, int,
- struct Colors *);
-int Rast_add_modular_d_raster_color_rule(const DCELL *, int, int, int,
- const DCELL *, int, int, int,
- struct Colors *);
-int Rast_add_modular_f_raster_color_rule(const FCELL *, int, int, int,
- const FCELL *, int, int, int,
- struct Colors *);
-int Rast_add_modular_c_raster_color_rule(const CELL *, int, int, int,
- const CELL *, int, int, int,
- struct Colors *);
-int Rast_add_modular_raster_color_rule(const void *, int, int, int,
- const void *, int, int, int,
- struct Colors *, RASTER_MAP_TYPE);
-int Rast_add_modular_color_rule(CELL, int, int, int,
- CELL, int, int, int,
- struct Colors *);
+void Rast_add_d_color_rule(const DCELL *, int, int, int,
+ const DCELL *, int, int, int,
+ struct Colors *);
+void Rast_add_f_color_rule(const FCELL *, int, int, int,
+ const FCELL *, int, int, int,
+ struct Colors *);
+void Rast_add_c_color_rule(const CELL *, int, int, int,
+ const CELL *, int, int, int,
+ struct Colors *);
+void Rast_add_color_rule(const void *, int, int, int,
+ const void *, int, int, int,
+ struct Colors *, RASTER_MAP_TYPE);
+int Rast_add_modular_d_color_rule(const DCELL *, int, int, int,
+ const DCELL *, int, int, int,
+ struct Colors *);
+int Rast_add_modular_f_color_rule(const FCELL *, int, int, int,
+ const FCELL *, int, int, int,
+ struct Colors *);
+int Rast_add_modular_c_color_rule(const CELL *, int, int, int,
+ const CELL *, int, int, int,
+ struct Colors *);
+int Rast_add_modular_color_rule(const void *, int, int, int,
+ const void *, int, int, int,
+ struct Colors *, RASTER_MAP_TYPE);
/* color_rule_get.c */
int Rast_colors_count(const struct Colors *);
Modified: grass/trunk/lib/g3d/g3dcolor.c
===================================================================
--- grass/trunk/lib/g3d/g3dcolor.c 2009-06-28 20:49:17 UTC (rev 38112)
+++ grass/trunk/lib/g3d/g3dcolor.c 2009-06-29 09:49:36 UTC (rev 38113)
@@ -228,21 +228,21 @@
else if (modular) {
if (fp_rule)
- Rast_add_modular_d_raster_color_rule((DCELL *) & val1, r1, g1,
+ Rast_add_modular_d_color_rule((DCELL *) & val1, r1, g1,
b1, (DCELL *) & val2, r2,
g2, b2, colors);
else
- Rast_add_modular_color_rule((CELL) cat1, r1, g1, b1,
- (CELL) cat2, r2, g2, b2, colors);
+ Rast_add_modular_c_color_rule((CELL *) &cat1, r1, g1, b1,
+ (CELL *) &cat2, r2, g2, b2, colors);
}
else {
if (fp_rule)
- Rast_add_d_raster_color_rule((DCELL *) & val1, r1, g1, b1,
- (DCELL *) & val2, r2, g2, b2,
- colors);
+ Rast_add_d_color_rule((DCELL *) & val1, r1, g1, b1,
+ (DCELL *) & val2, r2, g2, b2,
+ colors);
else
- Rast_add_color_rule((CELL) cat1, r1, g1, b1,
- (CELL) cat2, r2, g2, b2, colors);
+ Rast_add_c_color_rule((CELL *) &cat1, r1, g1, b1,
+ (CELL *) &cat2, r2, g2, b2, colors);
}
/*
fprintf (stderr, "adding rule %d=%.2lf %d %d %d %d=%.2lf %d %d %d\n", cat1,val1, r1, g1, b1, cat2, val2, r2, g2, b2);
Modified: grass/trunk/lib/raster/color_hist.c
===================================================================
--- grass/trunk/lib/raster/color_hist.c 2009-06-28 20:49:17 UTC (rev 38112)
+++ grass/trunk/lib/raster/color_hist.c 2009-06-29 09:49:36 UTC (rev 38113)
@@ -32,7 +32,7 @@
struct Cell_stats *statf)
{
long count, total;
- CELL prev = 0, cat;
+ CELL prev = 0, cat, val2;
double span, sum;
int first;
int x, grey;
@@ -73,15 +73,16 @@
first = 0;
}
else if (grey != x) {
- Rast_add_color_rule(prev, grey, grey, grey, cat - 1, grey, grey,
- grey, colors);
+ val2 = cat - 1;
+ Rast_add_c_color_rule(&prev, grey, grey, grey, &val2, grey, grey,
+ grey, colors);
grey = x;
prev = cat;
}
}
if (!first) {
- Rast_add_color_rule(prev, grey, grey, grey, cat, grey, grey, grey,
- colors);
+ Rast_add_c_color_rule(&prev, grey, grey, grey, &cat, grey, grey, grey,
+ colors);
}
}
@@ -101,7 +102,7 @@
{
long count, total;
double lmin, lmax;
- CELL prev = 0, cat;
+ CELL prev = 0, cat, val2;
int first;
int x, grey;
int R, G, B;
@@ -144,14 +145,15 @@
first = 0;
}
else if (grey != x) {
- Rast_add_color_rule(prev, grey, grey, grey, cat - 1, grey, grey,
- grey, colors);
+ val2 = cat - 1;
+ Rast_add_c_color_rule(&prev, grey, grey, grey, &val2, grey, grey,
+ grey, colors);
grey = x;
prev = cat;
}
}
if (!first) {
- Rast_add_color_rule(prev, grey, grey, grey, cat, grey, grey, grey,
- colors);
+ Rast_add_c_color_rule(&prev, grey, grey, grey, &cat, grey, grey, grey,
+ colors);
}
}
Modified: grass/trunk/lib/raster/color_init.c
===================================================================
--- grass/trunk/lib/raster/color_init.c 2009-06-28 20:49:17 UTC (rev 38112)
+++ grass/trunk/lib/raster/color_init.c 2009-06-29 09:49:36 UTC (rev 38113)
@@ -17,7 +17,7 @@
* \brief Initialize color structure
*
* The <i>colors</i> structure is initialized for subsequent calls
- * to Rast_add_color_rule() and Rast_set_color().
+ * to Rast_add_c_color_rule() and Rast_set_color().
*
* \param colors pointer to Colors structure
*/
Modified: grass/trunk/lib/raster/color_insrt.c
===================================================================
--- grass/trunk/lib/raster/color_insrt.c 2009-06-28 20:49:17 UTC (rev 38112)
+++ grass/trunk/lib/raster/color_insrt.c 2009-06-29 09:49:36 UTC (rev 38113)
@@ -1,6 +1,6 @@
/* This routine is public only because source is in different files.
* It should NEVER be called directly.
- * It is used by Rast_add_color_rule() and G__read_old_colors().
+ * It is used by Rast_add_c_color_rule() and G__read_old_colors().
* These routines know when it is approriate to call this routine.
*/
#include <grass/gis.h>
Modified: grass/trunk/lib/raster/color_rand.c
===================================================================
--- grass/trunk/lib/raster/color_rand.c 2009-06-28 20:49:17 UTC (rev 38112)
+++ grass/trunk/lib/raster/color_rand.c 2009-06-29 09:49:36 UTC (rev 38113)
@@ -43,7 +43,8 @@
red = rand() & 0377;
grn = rand() & 0377;
blu = rand() & 0377;
- Rast_add_modular_color_rule(n, red, grn, blu, n, red, grn, blu, colors);
+ Rast_add_modular_c_color_rule(&n, red, grn, blu,
+ &n, red, grn, blu, colors);
}
Rast_set_c_color_range(min, max, colors);
}
Modified: grass/trunk/lib/raster/color_read.c
===================================================================
--- grass/trunk/lib/raster/color_read.c 2009-06-28 20:49:17 UTC (rev 38112)
+++ grass/trunk/lib/raster/color_read.c 2009-06-29 09:49:36 UTC (rev 38113)
@@ -282,21 +282,21 @@
else if (modular) {
if (fp_rule)
- Rast_add_modular_d_raster_color_rule((DCELL *) & val1, r1, g1,
+ Rast_add_modular_d_color_rule((DCELL *) & val1, r1, g1,
b1, (DCELL *) & val2, r2,
g2, b2, colors);
else
- Rast_add_modular_color_rule((CELL) cat1, r1, g1, b1,
- (CELL) cat2, r2, g2, b2, colors);
+ Rast_add_modular_c_color_rule((CELL *) &cat1, r1, g1, b1,
+ (CELL *) &cat2, r2, g2, b2, colors);
}
else {
if (fp_rule)
- Rast_add_d_raster_color_rule((DCELL *) & val1, r1, g1, b1,
+ Rast_add_d_color_rule((DCELL *) & val1, r1, g1, b1,
(DCELL *) & val2, r2, g2, b2,
colors);
else
- Rast_add_color_rule((CELL) cat1, r1, g1, b1,
- (CELL) cat2, r2, g2, b2, colors);
+ Rast_add_c_color_rule((CELL *) &cat1, r1, g1, b1,
+ (CELL *) &cat2, r2, g2, b2, colors);
}
G_debug(3, "adding rule %ld=%.2lf %d %d %d %ld=%.2lf %d %d %d",
cat1, val1, r1, g1, b1, cat2, val2, r2, g2, b2);
Modified: grass/trunk/lib/raster/color_rule.c
===================================================================
--- grass/trunk/lib/raster/color_rule.c 2009-06-28 20:49:17 UTC (rev 38112)
+++ grass/trunk/lib/raster/color_rule.c 2009-06-29 09:49:36 UTC (rev 38113)
@@ -25,7 +25,7 @@
/*!
* \brief Adds the floating-point rule (DCELL version)
*
- * See Rast_add_raster_color_rule() for details.
+ * See Rast_add_color_rule() for details.
*
* \param v1 cell value
* \param r1,g1,b1 color value
@@ -34,9 +34,9 @@
* \param[in,out] colors pointer to color table structure
* \return
*/
-void Rast_add_d_raster_color_rule(const DCELL * val1, int r1, int g1, int b1,
- const DCELL * val2, int r2, int g2, int b2,
- struct Colors *colors)
+void Rast_add_d_color_rule(const DCELL *val1, int r1, int g1, int b1,
+ const DCELL *val2, int r2, int g2, int b2,
+ struct Colors *colors)
{
add_color_rule(val1, r1, g1, b1, val2, r2, g2, b2, &colors->fixed,
colors->version, &colors->cmin, &colors->cmax, DCELL_TYPE);
@@ -46,7 +46,7 @@
/*!
* \brief Adds the floating-point rule (FCELL version)
*
- * See Rast_add_raster_color_rule() for details.
+ * See Rast_add_color_rule() for details.
*
* \param v1 cell value
* \param r1,g1,b1 color value
@@ -55,9 +55,9 @@
* \param[in,out] colors pointer to color table structure
* \return
*/
-void Rast_add_f_raster_color_rule(const FCELL * cat1, int r1, int g1, int b1,
- const FCELL * cat2, int r2, int g2, int b2,
- struct Colors *colors)
+void Rast_add_f_color_rule(const FCELL *cat1, int r1, int g1, int b1,
+ const FCELL *cat2, int r2, int g2, int b2,
+ struct Colors *colors)
{
add_color_rule(cat1, r1, g1, b1, cat2, r2, g2, b2, &colors->fixed,
colors->version, &colors->cmin, &colors->cmax, FCELL_TYPE);
@@ -67,7 +67,7 @@
/*!
* \brief Adds the floating-point rule (CCELL version)
*
- * See Rast_add_raster_color_rule() for details.
+ * See Rast_add_color_rule() for details.
*
* \param v1 cell value
* \param r1,g1,b1 color value
@@ -76,9 +76,9 @@
* \param[in,out] colors pointer to color table structure
* \return
*/
-void Rast_add_c_raster_color_rule(const CELL * cat1, int r1, int g1, int b1,
- const CELL * cat2, int r2, int g2, int b2,
- struct Colors *colors)
+void Rast_add_c_color_rule(const CELL *cat1, int r1, int g1, int b1,
+ const CELL *cat2, int r2, int g2, int b2,
+ struct Colors *colors)
{
add_color_rule(cat1, r1, g1, b1, cat2, r2, g2, b2, &colors->fixed,
colors->version, &colors->cmin, &colors->cmax, CELL_TYPE);
@@ -94,9 +94,9 @@
* If either <em>v1</em> or <em>v2</em> is the NULL-value, this call is converted into
* <tt>Rast_set_null_value_color (r1, g1, b1, colors)</tt>
*
- * - If <em>map_type</em> is CELL_TYPE, calls Rast_add_c_raster_color_rule()
- * - If <em>map_type</em> is FCELL_TYPE, calls Rast_add_f_raster_color_rule()
- * - If <em>map_type</em> is DCELL_TYPE, calls Rast_add_d_raster_color_rule()
+ * - If <em>map_type</em> is CELL_TYPE, calls Rast_add_c_color_rule()
+ * - If <em>map_type</em> is FCELL_TYPE, calls Rast_add_f_color_rule()
+ * - If <em>map_type</em> is DCELL_TYPE, calls Rast_add_d_color_rule()
*
* \param v1 cell value
* \param r1,g1,b1 color value
@@ -107,60 +107,15 @@
* \return
*/
-void Rast_add_raster_color_rule(const void *val1, int r1, int g1, int b1,
- const void *val2, int r2, int g2, int b2,
- struct Colors *colors, RASTER_MAP_TYPE data_type)
+void Rast_add_color_rule(const void *val1, int r1, int g1, int b1,
+ const void *val2, int r2, int g2, int b2,
+ struct Colors *colors, RASTER_MAP_TYPE data_type)
{
add_color_rule(val1, r1, g1, b1, val2, r2, g2, b2, &colors->fixed,
colors->version, &colors->cmin, &colors->cmax, data_type);
}
-
/*!
- * \brief Set colors rules
- *
- * This is the heart
- * and soul of the new color logic. It adds a color rule to the <b>colors</b>
- * structure. The colors defined by the red, green, and blue values
- * <b>r1,g1,b1</b> and <b>r2,g2,b2</b> are assigned to <b>cat1</b> and
- * <b>cat2</b> respectively. Colors for data values between <b>cat1</b> and
- * <b>cat2</b> are not stored in the structure but are interpolated when
- * queried by <i>Rast_lookup_colors</i> and<i>Rast_get_c_color.</i> The color
- * components <b>r1,g1,b1</b> and <b>r2,g2,b2</b> must be in the range
- * 0 -- 255.
- * For example, to create a linear grey scale for the range 200 -- 1000:
- *
- \code
- struct Colors colr;
- Rast_init_colors (&colr);
- Rast_add_color_rule ((CELL)200, 0,0,0, (CELL) 1000, 255,255,255);
- \endcode
- *
- * The programmer is encouraged to review \ref
- * Raster_Color_Table_Format how this routine fits into the 5.x raster
- * color logic.
- *
- * <b>Note:</b> The <i>colors</i> structure must have been initialized
- * by Rast_init_colors(). See \ref Predefined_Color_Tables for routines
- * to build some predefined color tables.
- *
- * \param cat1 cell value
- * \param r1,g1,b1 color value
- * \param cat2 cell value
- * \param r2,g2,b2 color value
- * \param[in,out] colors pointer to color table structure
- * \return
- */
-void Rast_add_color_rule(CELL cat1, int r1, int g1, int b1,
- CELL cat2, int r2, int g2,
- int b2, struct Colors *colors)
-{
- add_color_rule((void *)&cat1, r1, g1, b1, (void *)&cat2, r2, g2, b2,
- &colors->fixed, colors->version, &colors->cmin,
- &colors->cmax, CELL_TYPE);
-}
-
-/*!
* \brief Add modular color rule (DCELL version)
*
* \param val1 cell value
@@ -172,9 +127,9 @@
* \return -1 on failure
* \return 1 on success
*/
-int Rast_add_modular_d_raster_color_rule(const DCELL * val1, int r1, int g1, int b1,
- const DCELL * val2, int r2, int g2, int b2,
- struct Colors *colors)
+int Rast_add_modular_d_color_rule(const DCELL *val1, int r1, int g1, int b1,
+ const DCELL *val2, int r2, int g2, int b2,
+ struct Colors *colors)
{
DCELL min, max;
@@ -202,9 +157,9 @@
* \return -1 on failure
* \return 1 on success
*/
-int Rast_add_modular_f_raster_color_rule(const FCELL * val1, int r1, int g1, int b1,
- const FCELL * val2, int r2, int g2, int b2,
- struct Colors *colors)
+int Rast_add_modular_f_color_rule(const FCELL *val1, int r1, int g1, int b1,
+ const FCELL *val2, int r2, int g2, int b2,
+ struct Colors *colors)
{
DCELL min, max;
@@ -221,7 +176,7 @@
}
/*!
- * \brief Add modular color rule (CCELL version)
+ * \brief Add modular color rule (CELL version)
*
* \param val1 cell value
* \param r1,g1,b1 color value
@@ -232,43 +187,19 @@
* \return -1 on failure
* \return 1 on success
*/
-int Rast_add_modular_c_raster_color_rule(const CELL * val1, int r1, int g1, int b1,
- const CELL * val2, int r2, int g2, int b2,
- struct Colors *colors)
+int Rast_add_modular_c_color_rule(const CELL *val1, int r1, int g1, int b1,
+ const CELL *val2, int r2, int g2, int b2,
+ struct Colors *colors)
{
- return Rast_add_modular_color_rule(*val1, r1, g1, b1, *val2, r2, g2, b2,
- colors);
-}
-
-/*!
- * \brief Add modular color rule
- *
- * \todo Question: shouldn't this function call
- * G_add_modular_<data_type>_raster_color_rule() instead?
- *
- * \param val1 cell value
- * \param r1,g1,b1 color value
- * \param val2 cell value
- * \param r2,g2,b2 color value
- * \param[in,out] colors pointer to color table structure
- * \param data_type raster data type
- *
- * \return -1 on failure
- * \return 1 on success
- */
-int Rast_add_modular_raster_color_rule(
- const void *val1, int r1, int g1, int b1,
- const void *val2, int r2, int g2, int b2,
- struct Colors *colors, RASTER_MAP_TYPE data_type)
-{
CELL min, max;
if (colors->version < 0)
- return -1; /* can't use this on 3.0 colors */
+ return -1; /* can;t use this on 3.0 colors */
min = colors->cmin;
max = colors->cmax;
- add_color_rule(val1, r1, g1, b1, val2, r2, g2, b2, &colors->modular, 0,
- &colors->cmin, &colors->cmax, data_type);
+ add_color_rule((void *)&val1, r1, g1, b1, (void *)&val2, r2, g2, b2,
+ &colors->modular, 0, &colors->cmin, &colors->cmax,
+ CELL_TYPE);
colors->cmin = min; /* don't reset these */
colors->cmax = max;
@@ -278,8 +209,8 @@
/*!
* \brief Add modular color rule
*
- * \todo This function seems to be same as
- * Rast_add_modular_raster_color_rule(). Can be removed?
+ * \todo Question: shouldn't this function call
+ * G_add_modular_<data_type>_raster_color_rule() instead?
*
* \param val1 cell value
* \param r1,g1,b1 color value
@@ -291,19 +222,18 @@
* \return -1 on failure
* \return 1 on success
*/
-int Rast_add_modular_color_rule(CELL cat1, int r1, int g1,
- int b1, CELL cat2, int r2,
- int g2, int b2, struct Colors *colors)
+int Rast_add_modular_color_rule(const void *val1, int r1, int g1, int b1,
+ const void *val2, int r2, int g2, int b2,
+ struct Colors *colors, RASTER_MAP_TYPE data_type)
{
CELL min, max;
if (colors->version < 0)
- return -1; /* can;t use this on 3.0 colors */
+ return -1; /* can't use this on 3.0 colors */
min = colors->cmin;
max = colors->cmax;
- add_color_rule((void *)&cat1, r1, g1, b1, (void *)&cat2, r2, g2, b2,
- &colors->modular, 0, &colors->cmin, &colors->cmax,
- CELL_TYPE);
+ add_color_rule(val1, r1, g1, b1, val2, r2, g2, b2, &colors->modular, 0,
+ &colors->cmin, &colors->cmax, data_type);
colors->cmin = min; /* don't reset these */
colors->cmax = max;
Modified: grass/trunk/lib/raster/color_rules.c
===================================================================
--- grass/trunk/lib/raster/color_rules.c 2009-06-28 20:49:17 UTC (rev 38112)
+++ grass/trunk/lib/raster/color_rules.c 2009-06-29 09:49:36 UTC (rev 38113)
@@ -210,7 +210,7 @@
struct rule *lo = &rule[n - 1];
struct rule *hi = &rule[n];
- Rast_add_d_raster_color_rule(&lo->val, lo->r, lo->g, lo->b,
+ Rast_add_d_color_rule(&lo->val, lo->r, lo->g, lo->b,
&hi->val, hi->r, hi->g, hi->b, colors);
}
Modified: grass/trunk/lib/raster/color_set.c
===================================================================
--- grass/trunk/lib/raster/color_set.c 2009-06-28 20:49:17 UTC (rev 38112)
+++ grass/trunk/lib/raster/color_set.c 2009-06-29 09:49:36 UTC (rev 38113)
@@ -26,7 +26,7 @@
* color logic.</b>
*
* It is provided only for backward compatibility. Overuse can create
- * large color tables. Rast_add_color_rule() should be used whenever
+ * large color tables. Rast_add_c_color_rule() should be used whenever
* possible.
*
* <b>Note:</b> The <i>colors</i> structure must have been
@@ -43,7 +43,7 @@
if (Rast_is_c_null_value(&cat))
Rast_set_null_value_color(r, g, b, colors);
else
- Rast_add_color_rule(cat, r, g, b, cat, r, g, b, colors);
+ Rast_add_c_color_rule(&cat, r, g, b, &cat, r, g, b, colors);
}
/*!
@@ -62,7 +62,7 @@
if (Rast_is_d_null_value(&val))
Rast_set_null_value_color(r, g, b, colors);
else
- Rast_add_d_raster_color_rule(&val, r, g, b, &val, r, g, b, colors);
+ Rast_add_d_color_rule(&val, r, g, b, &val, r, g, b, colors);
}
/*!
Modified: grass/trunk/lib/raster/color_write.c
===================================================================
--- grass/trunk/lib/raster/color_write.c 2009-06-28 20:49:17 UTC (rev 38112)
+++ grass/trunk/lib/raster/color_write.c 2009-06-29 09:49:36 UTC (rev 38113)
@@ -39,7 +39,7 @@
* printed. Otherwise, 1 is returned.
*
* The <i>colors</i> structure must be created properly, i.e.,
- * Rast_init_colors() to initialize the structure and Rast_add_color_rule()
+ * Rast_init_colors() to initialize the structure and Rast_add_c_color_rule()
* to set the category colors. These routines are called by
* higher level routines which read or create entire color tables,
* such as Rast_read_colors() or Rast_make_ramp_colors().
Modified: grass/trunk/lib/raster/color_xform.c
===================================================================
--- grass/trunk/lib/raster/color_xform.c 2009-06-28 20:49:17 UTC (rev 38112)
+++ grass/trunk/lib/raster/color_xform.c 2009-06-29 09:49:36 UTC (rev 38113)
@@ -104,7 +104,7 @@
Rast_get_d_color(&x, &red2, &grn2, &blu2, src);
if (!first)
- Rast_add_color_rule(prev, red, grn, blu, cat, red2, grn2, blu2, dst);
+ Rast_add_c_color_rule(&prev, red, grn, blu, &cat, red2, grn2, blu2, dst);
sum += count;
first = 0;
@@ -171,7 +171,7 @@
Rast_get_d_color(&x, &red2, &grn2, &blu2, src);
if (!first)
- Rast_add_d_raster_color_rule(&val, red, grn, blu, &val2, red2, grn2, blu2, dst);
+ Rast_add_d_color_rule(&val, red, grn, blu, &val2, red2, grn2, blu2, dst);
first = 0;
if (i == statf->count)
@@ -234,7 +234,7 @@
}
if (i > 0)
- Rast_add_d_raster_color_rule(&prev, red, grn, blu,
+ Rast_add_d_color_rule(&prev, red, grn, blu,
&x, red2, grn2, blu2,
dst);
@@ -299,12 +299,12 @@
if (i > 0) {
DCELL x0 = prev, x1 = x;
- Rast_add_d_raster_color_rule(&x0, red, grn, blu,
+ Rast_add_d_color_rule(&x0, red, grn, blu,
&x1, red2, grn2, blu2,
dst);
x0 = -x0;
x1 = -x1;
- Rast_add_d_raster_color_rule(&x0, red, grn, blu,
+ Rast_add_d_color_rule(&x0, red, grn, blu,
&x1, red2, grn2, blu2,
dst);
}
Modified: grass/trunk/lib/rst/interp_float/output2d.c
===================================================================
--- grass/trunk/lib/rst/interp_float/output2d.c 2009-06-28 20:49:17 UTC (rev 38112)
+++ grass/trunk/lib/rst/interp_float/output2d.c 2009-06-29 09:49:36 UTC (rev 38113)
@@ -20,10 +20,9 @@
#include <grass/raster.h>
#include <grass/bitmap.h>
#include <grass/linkm.h>
-
#include <grass/interpf.h>
+#include <grass/glocale.h>
-
#define MULT 100000
@@ -51,7 +50,8 @@
const char *mapset = NULL;
int cond1, cond2;
FCELL dat1, dat2;
-
+ CELL val1, val2;
+
cond2 = ((params->pcurv != NULL) || (params->tcurv != NULL)
|| (params->mcurv != NULL));
cond1 = ((params->slope != NULL) || (params->aspect != NULL) || cond2);
@@ -64,7 +64,7 @@
if (params->elev != NULL) {
cf1 = Rast_open_fp_cell_new(params->elev);
if (cf1 < 0) {
- fprintf(stderr, "unable to create raster map %s\n", params->elev);
+ G_warning(_("Unable to create raster map <%s>"), params->elev);
return -1;
}
}
@@ -72,8 +72,8 @@
if (params->slope != NULL) {
cf2 = Rast_open_fp_cell_new(params->slope);
if (cf2 < 0) {
- fprintf(stderr, "unable to create raster map %s\n",
- params->slope);
+ G_warning(_("Unable to create raster map <%s>"),
+ params->slope);
return -1;
}
}
@@ -81,7 +81,7 @@
if (params->aspect != NULL) {
cf3 = Rast_open_fp_cell_new(params->aspect);
if (cf3 < 0) {
- fprintf(stderr, "unable to create raster map %s\n",
+ G_warning(_("Unable to create raster map <%s>"),
params->aspect);
return -1;
}
@@ -90,8 +90,8 @@
if (params->pcurv != NULL) {
cf4 = Rast_open_fp_cell_new(params->pcurv);
if (cf4 < 0) {
- fprintf(stderr, "unable to create raster map %s\n",
- params->pcurv);
+ G_warning(_("Unable to create raster map <%s>"),
+ params->pcurv);
return -1;
}
}
@@ -99,8 +99,8 @@
if (params->tcurv != NULL) {
cf5 = Rast_open_fp_cell_new(params->tcurv);
if (cf5 < 0) {
- fprintf(stderr, "unable to create raster map %s\n",
- params->tcurv);
+ G_warning(_("Unable to create raster map <%s>"),
+ params->tcurv);
return -1;
}
}
@@ -108,23 +108,23 @@
if (params->mcurv != NULL) {
cf6 = Rast_open_fp_cell_new(params->mcurv);
if (cf6 < 0) {
- fprintf(stderr, "unable to create raster map %s\n",
- params->mcurv);
+ G_warning(_("Unable to create raster map <%s>"),
+ params->mcurv);
return -1;
}
}
nrows = cellhd->rows;
if (nrows != params->nsizr) {
- fprintf(stderr, "first change your rows number to nsizr! %d %d\n",
- nrows, params->nsizr);
+ G_warning(_("First change your rows number to nsizr! %d %d"),
+ nrows, params->nsizr);
return -1;
}
ncols = cellhd->cols;
if (ncols != params->nsizc) {
- fprintf(stderr, "first change your cols number to nsizc! %d %d\n",
- ncols, params->nsizc);
+ G_warning(_("First change your cols number to nsizc! %d %d"),
+ ncols, params->nsizc);
return -1;
}
@@ -132,14 +132,14 @@
return -1;
if (nrows != G_window_rows()) {
- fprintf(stderr, "OOPS: rows changed from %d to %d\n", nrows,
- G_window_rows());
+ G_warning(_("Rows changed from %d to %d"), nrows,
+ G_window_rows());
return -1;
}
if (ncols != G_window_cols()) {
- fprintf(stderr, "OOPS: cols changed from %d to %d\n", ncols,
- G_window_cols());
+ G_warning(_("Cols changed from %d to %d"), ncols,
+ G_window_cols());
return -1;
}
@@ -151,7 +151,7 @@
((params->nsizr - 1 -
i) * params->nsizc * sizeof(FCELL)), 0)
== -1) {
- fprintf(stderr, "cannot fseek to the right spot\n");
+ G_warning(_("Unable to fseek to the right spot"));
return -1;
}
ii = fread(cell1, sizeof(FCELL), params->nsizc, params->Tmp_fd_z);
@@ -172,7 +172,7 @@
((params->nsizr - 1 -
i) * params->nsizc * sizeof(FCELL)), 0)
== -1) {
- fprintf(stderr, "cannot fseek to the right spot\n");
+ G_warning(_("Unable to fseek to the right spot"));
return -1;
}
fread(cell1, sizeof(FCELL), params->nsizc, params->Tmp_fd_dx);
@@ -188,7 +188,7 @@
((params->nsizr - 1 -
i) * params->nsizc * sizeof(FCELL)), 0)
== -1) {
- fprintf(stderr, "cannot fseek to the right spot\n");
+ G_warning(_("Unable to fseek to the right spot"));
return -1;
}
fread(cell1, sizeof(FCELL), params->nsizc, params->Tmp_fd_dy);
@@ -204,7 +204,7 @@
((params->nsizr - 1 -
i) * params->nsizc * sizeof(FCELL)), 0)
== -1) {
- fprintf(stderr, "cannot fseek to the right spot\n");
+ G_warning(_("Unable to fseek to the right spot"));
return -1;
}
fread(cell1, sizeof(FCELL), params->nsizc, params->Tmp_fd_xx);
@@ -220,7 +220,7 @@
((params->nsizr - 1 -
i) * params->nsizc * sizeof(FCELL)), 0)
== -1) {
- fprintf(stderr, "cannot fseek to the right spot\n");
+ G_warning(_("Unable to fseek to the right spot"));
return -1;
}
fread(cell1, sizeof(FCELL), params->nsizc, params->Tmp_fd_yy);
@@ -236,7 +236,7 @@
((params->nsizr - 1 -
i) * params->nsizc * sizeof(FCELL)), 0)
== -1) {
- fprintf(stderr, "cannot fseek to the right spot\n");
+ G_warning(_("Unable to fseek to the right spot"));
return -1;
}
fread(cell1, sizeof(FCELL), params->nsizc, params->Tmp_fd_xy);
@@ -266,23 +266,23 @@
data2 = (FCELL) (zminac + i * zstep);
switch (i) {
case 1:
- Rast_add_f_raster_color_rule(&data1, 0, 191, 191,
+ Rast_add_f_color_rule(&data1, 0, 191, 191,
&data2, 0, 255, 0, &colors);
break;
case 2:
- Rast_add_f_raster_color_rule(&data1, 0, 255, 0,
+ Rast_add_f_color_rule(&data1, 0, 255, 0,
&data2, 255, 255, 0, &colors);
break;
case 3:
- Rast_add_f_raster_color_rule(&data1, 255, 255, 0,
+ Rast_add_f_color_rule(&data1, 255, 255, 0,
&data2, 255, 127, 0, &colors);
break;
case 4:
- Rast_add_f_raster_color_rule(&data1, 255, 127, 0,
+ Rast_add_f_color_rule(&data1, 255, 127, 0,
&data2, 191, 127, 63, &colors);
break;
case 5:
- Rast_add_f_raster_color_rule(&data1, 191, 127, 63,
+ Rast_add_f_color_rule(&data1, 191, 127, 63,
&data2, 20, 20, 20, &colors);
break;
}
@@ -291,7 +291,7 @@
if (params->elev != NULL) {
mapset = G_find_file("cell", params->elev, "");
if (mapset == NULL) {
- fprintf(stderr, "file [%s] not found\n", params->elev);
+ G_warning(_("Raster map <%s> not found"), params->elev);
return -1;
}
Rast_write_colors(params->elev, mapset, &colors);
@@ -309,56 +309,70 @@
* (&colors,smin,smax);
*/
Rast_init_colors(&colors);
- Rast_add_color_rule(0, 255, 255, 255, 2, 255, 255, 0, &colors);
- Rast_add_color_rule(2, 255, 255, 0, 5, 0, 255, 0, &colors);
- Rast_add_color_rule(5, 0, 255, 0, 10, 0, 255, 255, &colors);
- Rast_add_color_rule(10, 0, 255, 255, 15, 0, 0, 255, &colors);
- Rast_add_color_rule(15, 0, 0, 255, 30, 255, 0, 255, &colors);
- Rast_add_color_rule(30, 255, 0, 255, 50, 255, 0, 0, &colors);
- Rast_add_color_rule(50, 255, 0, 0, 90, 0, 0, 0, &colors);
+ val1 = 0;
+ val2 = 2;
+ Rast_add_c_color_rule(&val1, 255, 255, 255, &val2, 255, 255, 0, &colors);
+ val1 = 2;
+ val2 = 5;
+ Rast_add_c_color_rule(&val1, 255, 255, 0, &val2, 0, 255, 0, &colors);
+ val1 = 5;
+ val2 = 10;
+ Rast_add_c_color_rule(&val1, 0, 255, 0, &val2, 0, 255, 255, &colors);
+ val1 = 10;
+ val2 = 15;
+ Rast_add_c_color_rule(&val1, 0, 255, 255, &val2, 0, 0, 255, &colors);
+ val1 = 15;
+ val2 = 30;
+ Rast_add_c_color_rule(&val1, 0, 0, 255, &val2, 255, 0, 255, &colors);
+ val1 = 30;
+ val2 = 50;
+ Rast_add_c_color_rule(&val1, 255, 0, 255, &val2, 255, 0, 0, &colors);
+ val1 = 50;
+ val2 = 90;
+ Rast_add_c_color_rule(&val1, 255, 0, 0, &val2, 0, 0, 0, &colors);
}
else {
Rast_init_colors(&colors);
dat1 = (FCELL) - 5.0; /* replace by min dx, amin1 (c1min,
* c2min); */
dat2 = (FCELL) - 0.1;
- Rast_add_f_raster_color_rule(&dat1, 127, 0, 255,
+ Rast_add_f_color_rule(&dat1, 127, 0, 255,
&dat2, 0, 0, 255, &colors);
dat1 = dat2;
dat2 = (FCELL) - 0.01;
- Rast_add_f_raster_color_rule(&dat1, 0, 0, 255,
+ Rast_add_f_color_rule(&dat1, 0, 0, 255,
&dat2, 0, 127, 255, &colors);
dat1 = dat2;
dat2 = (FCELL) - 0.001;
- Rast_add_f_raster_color_rule(&dat1, 0, 127, 255,
+ Rast_add_f_color_rule(&dat1, 0, 127, 255,
&dat2, 0, 255, 255, &colors);
dat1 = dat2;
dat2 = (FCELL) 0.0;
- Rast_add_f_raster_color_rule(&dat1, 0, 255, 255,
+ Rast_add_f_color_rule(&dat1, 0, 255, 255,
&dat2, 200, 255, 200, &colors);
dat1 = dat2;
dat2 = (FCELL) 0.001;
- Rast_add_f_raster_color_rule(&dat1, 200, 255, 200,
+ Rast_add_f_color_rule(&dat1, 200, 255, 200,
&dat2, 255, 255, 0, &colors);
dat1 = dat2;
dat2 = (FCELL) 0.01;
- Rast_add_f_raster_color_rule(&dat1, 255, 255, 0,
+ Rast_add_f_color_rule(&dat1, 255, 255, 0,
&dat2, 255, 127, 0, &colors);
dat1 = dat2;
dat2 = (FCELL) 0.1;
- Rast_add_f_raster_color_rule(&dat1, 255, 127, 0,
+ Rast_add_f_color_rule(&dat1, 255, 127, 0,
&dat2, 255, 0, 0, &colors);
dat1 = dat2;
dat2 = (FCELL) 5.0; /* replace by max dx, amax1 (c1max,
* c2max); */
- Rast_add_f_raster_color_rule(&dat1, 255, 0, 0,
+ Rast_add_f_color_rule(&dat1, 255, 0, 0,
&dat2, 255, 0, 200, &colors);
}
if (params->slope != NULL) {
mapset = G_find_file("cell", params->slope, "");
if (mapset == NULL) {
- fprintf(stderr, "file [%s] not found\n", params->slope);
+ G_warning(_("Raster map <%s> not found"), params->slope);
return -1;
}
Rast_write_colors(params->slope, mapset, &colors);
@@ -385,54 +399,64 @@
/* colortable for aspect */
if (!params->deriv) {
Rast_init_colors(&colors);
- Rast_add_color_rule(0, 255, 255, 255, 0, 255, 255, 255, &colors);
- Rast_add_color_rule(1, 255, 255, 0, 90, 0, 255, 0, &colors);
- Rast_add_color_rule(90, 0, 255, 0, 180, 0, 255, 255, &colors);
- Rast_add_color_rule(180, 0, 255, 255, 270, 255, 0, 0, &colors);
- Rast_add_color_rule(270, 255, 0, 0, 360, 255, 255, 0, &colors);
+ val1 = 0;
+ val2 = 0;
+ Rast_add_c_color_rule(&val1, 255, 255, 255, &val2, 255, 255, 255, &colors);
+ val1 = 1;
+ val2 = 90;
+ Rast_add_c_color_rule(&val1, 255, 255, 0, &val2, 0, 255, 0, &colors);
+ val1 = 90;
+ val2 = 180;
+ Rast_add_c_color_rule(&val1, 0, 255, 0, &val2, 0, 255, 255, &colors);
+ val1 = 180;
+ val2 = 270;
+ Rast_add_c_color_rule(&val1, 0, 255, 255, &val2, 255, 0, 0, &colors);
+ val1 = 270;
+ val2 = 360;
+ Rast_add_c_color_rule(&val1, 255, 0, 0, &val2, 255, 255, 0, &colors);
}
else {
Rast_init_colors(&colors);
dat1 = (FCELL) - 5.0; /* replace by min dy, amin1 (c1min,
* c2min); */
dat2 = (FCELL) - 0.1;
- Rast_add_f_raster_color_rule(&dat1, 127, 0, 255,
+ Rast_add_f_color_rule(&dat1, 127, 0, 255,
&dat2, 0, 0, 255, &colors);
dat1 = dat2;
dat2 = (FCELL) - 0.01;
- Rast_add_f_raster_color_rule(&dat1, 0, 0, 255,
+ Rast_add_f_color_rule(&dat1, 0, 0, 255,
&dat2, 0, 127, 255, &colors);
dat1 = dat2;
dat2 = (FCELL) - 0.001;
- Rast_add_f_raster_color_rule(&dat1, 0, 127, 255,
+ Rast_add_f_color_rule(&dat1, 0, 127, 255,
&dat2, 0, 255, 255, &colors);
dat1 = dat2;
dat2 = (FCELL) 0.0;
- Rast_add_f_raster_color_rule(&dat1, 0, 255, 255,
+ Rast_add_f_color_rule(&dat1, 0, 255, 255,
&dat2, 200, 255, 200, &colors);
dat1 = dat2;
dat2 = (FCELL) 0.001;
- Rast_add_f_raster_color_rule(&dat1, 200, 255, 200,
+ Rast_add_f_color_rule(&dat1, 200, 255, 200,
&dat2, 255, 255, 0, &colors);
dat1 = dat2;
dat2 = (FCELL) 0.01;
- Rast_add_f_raster_color_rule(&dat1, 255, 255, 0,
+ Rast_add_f_color_rule(&dat1, 255, 255, 0,
&dat2, 255, 127, 0, &colors);
dat1 = dat2;
dat2 = (FCELL) 0.1;
- Rast_add_f_raster_color_rule(&dat1, 255, 127, 0,
+ Rast_add_f_color_rule(&dat1, 255, 127, 0,
&dat2, 255, 0, 0, &colors);
dat1 = dat2;
dat2 = (FCELL) 5.0; /* replace by max dy, amax1 (c1max,
* c2max); */
- Rast_add_f_raster_color_rule(&dat1, 255, 0, 0,
+ Rast_add_f_color_rule(&dat1, 255, 0, 0,
&dat2, 255, 0, 200, &colors);
}
if (params->aspect != NULL) {
mapset = G_find_file("cell", params->aspect, "");
if (mapset == NULL) {
- fprintf(stderr, "file [%s] not found\n", params->aspect);
+ G_warning(_("Raster map <%s> not found"), params->aspect);
return -1;
}
Rast_write_colors(params->aspect, mapset, &colors);
@@ -461,42 +485,42 @@
dat1 = (FCELL) amin1(c1min, c2min); /* for derivatives use min
* dxx,dyy,dxy */
dat2 = (FCELL) - 0.01;
- Rast_add_f_raster_color_rule(&dat1, 127, 0, 255,
+ Rast_add_f_color_rule(&dat1, 127, 0, 255,
&dat2, 0, 0, 255, &colors);
dat1 = dat2;
dat2 = (FCELL) - 0.001;
- Rast_add_f_raster_color_rule(&dat1, 0, 0, 255,
+ Rast_add_f_color_rule(&dat1, 0, 0, 255,
&dat2, 0, 127, 255, &colors);
dat1 = dat2;
dat2 = (FCELL) - 0.00001;
- Rast_add_f_raster_color_rule(&dat1, 0, 127, 255,
+ Rast_add_f_color_rule(&dat1, 0, 127, 255,
&dat2, 0, 255, 255, &colors);
dat1 = dat2;
dat2 = (FCELL) 0.0;
- Rast_add_f_raster_color_rule(&dat1, 0, 255, 255,
+ Rast_add_f_color_rule(&dat1, 0, 255, 255,
&dat2, 200, 255, 200, &colors);
dat1 = dat2;
dat2 = (FCELL) 0.00001;
- Rast_add_f_raster_color_rule(&dat1, 200, 255, 200,
+ Rast_add_f_color_rule(&dat1, 200, 255, 200,
&dat2, 255, 255, 0, &colors);
dat1 = dat2;
dat2 = (FCELL) 0.001;
- Rast_add_f_raster_color_rule(&dat1, 255, 255, 0,
+ Rast_add_f_color_rule(&dat1, 255, 255, 0,
&dat2, 255, 127, 0, &colors);
dat1 = dat2;
dat2 = (FCELL) 0.01;
- Rast_add_f_raster_color_rule(&dat1, 255, 127, 0,
+ Rast_add_f_color_rule(&dat1, 255, 127, 0,
&dat2, 255, 0, 0, &colors);
dat1 = dat2;
dat2 = (FCELL) amax1(c1max, c2max); /* for derivatives use max
* dxx,dyy,dxy */
- Rast_add_f_raster_color_rule(&dat1, 255, 0, 0,
+ Rast_add_f_color_rule(&dat1, 255, 0, 0,
&dat2, 255, 0, 200, &colors);
if (params->pcurv != NULL) {
mapset = G_find_file("cell", params->pcurv, "");
if (mapset == NULL) {
- fprintf(stderr, "file [%s] not found\n", params->pcurv);
+ G_warning(_("Raster map <%s> not found"), params->pcurv);
return -1;
}
Rast_write_colors(params->pcurv, mapset, &colors);
@@ -524,7 +548,7 @@
if (params->tcurv != NULL) {
mapset = G_find_file("cell", params->tcurv, "");
if (mapset == NULL) {
- fprintf(stderr, "file [%s] not found\n", params->tcurv);
+ G_warning(_("Raster map <%s> not found"), params->tcurv);
return -1;
}
Rast_write_colors(params->tcurv, mapset, &colors);
@@ -552,7 +576,7 @@
if (params->mcurv != NULL) {
mapset = G_find_file("cell", params->mcurv, "");
if (mapset == NULL) {
- fprintf(stderr, "file [%s] not found\n", params->mcurv);
+ G_warning(_("Raster map <%s> not found"), params->mcurv);
return -1;
}
Rast_write_colors(params->mcurv, mapset, &colors);
@@ -582,7 +606,7 @@
if (params->elev != NULL) {
mapset = G_find_file("cell", params->elev, "");
if (mapset == NULL) {
- fprintf(stderr, "file [%s] not found\n", params->elev);
+ G_warning(_("Raster map <%s> not found"), params->elev);
return -1;
}
type = "raster";
Modified: grass/trunk/lib/rst/interp_float/resout2d.c
===================================================================
--- grass/trunk/lib/rst/interp_float/resout2d.c 2009-06-28 20:49:17 UTC (rev 38112)
+++ grass/trunk/lib/rst/interp_float/resout2d.c 2009-06-29 09:49:36 UTC (rev 38113)
@@ -21,8 +21,8 @@
#include <grass/bitmap.h>
#include <grass/linkm.h>
#include <grass/interpf.h>
+#include <grass/glocale.h>
-
/* output cell maps for elevation, aspect, slope and curvatures */
int IL_resample_output_2d(struct interp_params *params, double zmin, double zmax, /* min,max input z-values */
@@ -50,16 +50,16 @@
struct _Color_Rule_ *rule;
const char *maps, *type;
int cond1, cond2;
-
+ CELL val1, val2;
+
cond2 = ((params->pcurv != NULL) ||
(params->tcurv != NULL) || (params->mcurv != NULL));
cond1 = ((params->slope != NULL) || (params->aspect != NULL) || cond2);
/* change region to output cell file region */
- fprintf(stderr,
- "Temporarily changing the region to desired resolution...\n");
+ G_verbose_message(_("Temporarily changing the region to desired resolution..."));
if (Rast_set_window(outhd) < 0) {
- fprintf(stderr, "Cannot set region to output region!\n");
+ G_warning(_("Unable to set region"));
return -1;
}
mapset = G_mapset();
@@ -69,7 +69,8 @@
if (params->elev != NULL) {
cf1 = Rast_open_fp_cell_new(params->elev);
if (cf1 < 0) {
- fprintf(stderr, "unable to create raster map %s\n", params->elev);
+ G_warning(_("Unable to create raster map <%s>"),
+ params->elev);
return -1;
}
}
@@ -77,8 +78,8 @@
if (params->slope != NULL) {
cf2 = Rast_open_fp_cell_new(params->slope);
if (cf2 < 0) {
- fprintf(stderr, "unable to create raster map %s\n",
- params->slope);
+ G_warning(_("Unable to create raster map <%s>"),
+ params->elev);
return -1;
}
}
@@ -86,8 +87,8 @@
if (params->aspect != NULL) {
cf3 = Rast_open_fp_cell_new(params->aspect);
if (cf3 < 0) {
- fprintf(stderr, "unable to create raster map %s\n",
- params->aspect);
+ G_warning(_("Unable to create raster map <%s>"),
+ params->elev);
return -1;
}
}
@@ -95,8 +96,8 @@
if (params->pcurv != NULL) {
cf4 = Rast_open_fp_cell_new(params->pcurv);
if (cf4 < 0) {
- fprintf(stderr, "unable to create raster map %s\n",
- params->pcurv);
+ G_warning(_("Unable to create raster map <%s>"),
+ params->elev);
return -1;
}
}
@@ -104,8 +105,8 @@
if (params->tcurv != NULL) {
cf5 = Rast_open_fp_cell_new(params->tcurv);
if (cf5 < 0) {
- fprintf(stderr, "unable to create raster map %s\n",
- params->tcurv);
+ G_warning(_("Unable to create raster map <%s>"),
+ params->elev);
return -1;
}
}
@@ -113,23 +114,23 @@
if (params->mcurv != NULL) {
cf6 = Rast_open_fp_cell_new(params->mcurv);
if (cf6 < 0) {
- fprintf(stderr, "unable to create raster map %s\n",
- params->mcurv);
+ G_warning(_("Unable to create raster map <%s>"),
+ params->elev);
return -1;
}
}
nrows = outhd->rows;
if (nrows != params->nsizr) {
- fprintf(stderr, "first change your rows number(%d) to %d!\n",
- nrows, params->nsizr);
+ G_warning(_("First change your rows number(%d) to %d"),
+ nrows, params->nsizr);
return -1;
}
ncols = outhd->cols;
if (ncols != params->nsizc) {
- fprintf(stderr, "first change your rows number(%d) to %d!\n",
- ncols, params->nsizc);
+ G_warning(_("First change your columns number(%d) to %d"),
+ ncols, params->nsizr);
return -1;
}
@@ -140,12 +141,12 @@
if (fseek(params->Tmp_fd_z, (long)
((params->nsizr - 1 -
i) * params->nsizc * sizeof(FCELL)), 0) == -1) {
- fprintf(stderr, "cannot fseek to the right spot\n");
+ G_warning(_("Unable to fseek to the right spot"));
return -1;
}
fread(cell1, sizeof(FCELL), params->nsizc, params->Tmp_fd_z);
if (Rast_put_f_raster_row(cf1, cell1) < 0) {
- fprintf(stderr, "cannot write file\n");
+ G_warning(_("Failed writing raster map"));
return -1;
}
}
@@ -158,7 +159,7 @@
if (fseek(params->Tmp_fd_dx, (long)
((params->nsizr - 1 -
i) * params->nsizc * sizeof(FCELL)), 0) == -1) {
- fprintf(stderr, "cannot fseek to the right spot\n");
+ G_warning(_("Unable to fseek to the right spot"));
return -1;
}
fread(cell1, sizeof(FCELL), params->nsizc, params->Tmp_fd_dx);
@@ -168,7 +169,7 @@
* fprintf(stderr,"params->nsizc=%d \n",params->nsizc);
*/
if (Rast_put_f_raster_row(cf2, cell1) < 0) {
- fprintf(stderr, "cannot write file\n");
+ G_warning(_("Failed writing raster map"));
return -1;
}
}
@@ -181,12 +182,12 @@
if (fseek(params->Tmp_fd_dy, (long)
((params->nsizr - 1 -
i) * params->nsizc * sizeof(FCELL)), 0) == -1) {
- fprintf(stderr, "cannot fseek to the right spot\n");
+ G_warning(_("Unable to fseek to the right spot"));
return -1;
}
fread(cell1, sizeof(FCELL), params->nsizc, params->Tmp_fd_dy);
if (Rast_put_f_raster_row(cf3, cell1) < 0) {
- fprintf(stderr, "cannot write file\n");
+ G_warning(_("Failed writing raster map"));
return -1;
}
}
@@ -199,12 +200,12 @@
if (fseek(params->Tmp_fd_xx, (long)
((params->nsizr - 1 -
i) * params->nsizc * sizeof(FCELL)), 0) == -1) {
- fprintf(stderr, "cannot fseek to the right spot\n");
+ G_warning(_("Unable to fseek to the right spot"));
return -1;
}
fread(cell1, sizeof(FCELL), params->nsizc, params->Tmp_fd_xx);
if (Rast_put_f_raster_row(cf4, cell1) < 0) {
- fprintf(stderr, "cannot write file\n");
+ G_warning(_("Failed writing raster map"));
return -1;
}
}
@@ -217,12 +218,12 @@
if (fseek(params->Tmp_fd_yy, (long)
((params->nsizr - 1 -
i) * params->nsizc * sizeof(FCELL)), 0) == -1) {
- fprintf(stderr, "cannot fseek to the right spot\n");
+ G_warning(_("Unable to fseek to the right spot"));
return -1;
}
fread(cell1, sizeof(FCELL), params->nsizc, params->Tmp_fd_yy);
if (Rast_put_f_raster_row(cf5, cell1) < 0) {
- fprintf(stderr, "cannot write file\n");
+ G_warning(_("Failed writing raster map"));
return -1;
}
}
@@ -235,12 +236,12 @@
if (fseek(params->Tmp_fd_xy, (long)
((params->nsizr - 1 -
i) * params->nsizc * sizeof(FCELL)), 0) == -1) {
- fprintf(stderr, "cannot fseek to the right spot\n");
+ G_warning(_("Unable to fseek to the right spot"));
return -1;
}
fread(cell1, sizeof(FCELL), params->nsizc, params->Tmp_fd_xy);
if (Rast_put_f_raster_row(cf6, cell1) < 0) {
- fprintf(stderr, "cannot write file\n");
+ G_warning(_("Failed writing raster map"));
return -1;
}
}
@@ -265,7 +266,7 @@
if (params->elev != NULL) {
if (maps == NULL) {
- fprintf(stderr, "file [%s] not found\n", input);
+ G_warning(_("Raster map <%s> not found"), input);
return -1;
}
Rast_init_colors(&colors2);
@@ -283,7 +284,7 @@
for (; rule; rule = rule->prev) {
value1 = rule->low.value * params->zmult;
value2 = rule->high.value * params->zmult;
- Rast_add_modular_d_raster_color_rule(&value1, rule->low.red,
+ Rast_add_modular_d_color_rule(&value1, rule->low.red,
rule->low.grn,
rule->low.blu, &value2,
rule->high.red,
@@ -302,7 +303,7 @@
for (; rule; rule = rule->prev) {
value1 = rule->low.value * params->zmult;
value2 = rule->high.value * params->zmult;
- Rast_add_d_raster_color_rule(&value1, rule->low.red,
+ Rast_add_d_color_rule(&value1, rule->low.red,
rule->low.grn, rule->low.blu,
&value2, rule->high.red,
rule->high.grn, rule->high.blu,
@@ -313,12 +314,13 @@
maps = NULL;
maps = G_find_file("cell", params->elev, "");
if (maps == NULL) {
- fprintf(stderr, "file [%s] not found\n", params->elev);
+ G_warning(_("Raster map <%s> not found"), params->elev);
return -1;
}
if (Rast_write_colors(params->elev, maps, &colors2) < 0) {
- fprintf(stderr, "Cannot write color table\n");
+ G_warning(_("Unable to write color file of raster map <%s>"),
+ params->elev);
return -1;
}
Rast_quantize_fp_map_range(params->elev, mapset,
@@ -327,26 +329,39 @@
(CELL) (zmaxac + 0.5));
}
else
- fprintf(stderr,
- "No color table for input file -- will not create color table\n");
+ G_warning(_("No color table for input raster map -- will not create color table"));
}
/* colortable for slopes */
if (cond1 & (!params->deriv)) {
Rast_init_colors(&colors);
- Rast_add_color_rule(0, 255, 255, 255, 2, 255, 255, 0, &colors);
- Rast_add_color_rule(2, 255, 255, 0, 5, 0, 255, 0, &colors);
- Rast_add_color_rule(5, 0, 255, 0, 10, 0, 255, 255, &colors);
- Rast_add_color_rule(10, 0, 255, 255, 15, 0, 0, 255, &colors);
- Rast_add_color_rule(15, 0, 0, 255, 30, 255, 0, 255, &colors);
- Rast_add_color_rule(30, 255, 0, 255, 50, 255, 0, 0, &colors);
- Rast_add_color_rule(50, 255, 0, 0, 90, 0, 0, 0, &colors);
+ val1 = 0;
+ val2 = 2;
+ Rast_add_c_color_rule(&val1, 255, 255, 255, &val2, 255, 255, 0, &colors);
+ val1 = 2;
+ val2 = 5;
+ Rast_add_c_color_rule(&val1, 255, 255, 0, &val2, 0, 255, 0, &colors);
+ val1 = 5;
+ val2 = 10;
+ Rast_add_c_color_rule(&val1, 0, 255, 0, &val2, 0, 255, 255, &colors);
+ val1 = 10;
+ val2 = 15;
+ Rast_add_c_color_rule(&val1, 0, 255, 255, &val2, 0, 0, 255, &colors);
+ val1 = 15;
+ val2 = 30;
+ Rast_add_c_color_rule(&val1, 0, 0, 255, &val2, 255, 0, 255, &colors);
+ val1 = 30;
+ val2 = 50;
+ Rast_add_c_color_rule(&val1, 255, 0, 255, &val2, 255, 0, 0, &colors);
+ val1 = 50;
+ val2 = 90;
+ Rast_add_c_color_rule(&val1, 255, 0, 0, &val2, 0, 0, 0, &colors);
if (params->slope != NULL) {
maps = NULL;
maps = G_find_file("cell", params->slope, "");
if (maps == NULL) {
- fprintf(stderr, "file [%s] not found\n", params->slope);
+ G_warning(_("Raster map <%s> not found"), params->slope);
return -1;
}
Rast_write_colors(params->slope, maps, &colors);
@@ -366,17 +381,27 @@
/* colortable for aspect */
Rast_init_colors(&colors);
- Rast_add_color_rule(0, 255, 255, 255, 0, 255, 255, 255, &colors);
- Rast_add_color_rule(1, 255, 255, 0, 90, 0, 255, 0, &colors);
- Rast_add_color_rule(90, 0, 255, 0, 180, 0, 255, 255, &colors);
- Rast_add_color_rule(180, 0, 255, 255, 270, 255, 0, 0, &colors);
- Rast_add_color_rule(270, 255, 0, 0, 360, 255, 255, 0, &colors);
+ val1 = 0;
+ val2 = 0;
+ Rast_add_c_color_rule(&val1, 255, 255, 255, &val2, 255, 255, 255, &colors);
+ val1 = 1;
+ val2 = 90;
+ Rast_add_c_color_rule(&val1, 255, 255, 0, &val2, 0, 255, 0, &colors);
+ val1 = 90;
+ val2 = 180;
+ Rast_add_c_color_rule(&val1, 0, 255, 0, &val2, 0, 255, 255, &colors);
+ val1 = 180;
+ val2 = 270;
+ Rast_add_c_color_rule(&val1, 0, 255, 255, &val2, 255, 0, 0, &colors);
+ val1 = 270;
+ val2 = 360;
+ Rast_add_c_color_rule(&val1, 255, 0, 0, &val2, 255, 255, 0, &colors);
if (params->aspect != NULL) {
maps = NULL;
maps = G_find_file("cell", params->aspect, "");
if (maps == NULL) {
- fprintf(stderr, "file [%s] not found\n", params->aspect);
+ G_warning(_("Raster map <%s> not found"), params->aspect);
return -1;
}
Rast_write_colors(params->aspect, maps, &colors);
@@ -401,41 +426,41 @@
dat1 = (FCELL) amin1(c1min, c2min);
dat2 = (FCELL) - 0.01;
- Rast_add_f_raster_color_rule(&dat1, 50, 0, 155,
+ Rast_add_f_color_rule(&dat1, 50, 0, 155,
&dat2, 0, 0, 255, &colors);
dat1 = dat2;
dat2 = (FCELL) - 0.001;
- Rast_add_f_raster_color_rule(&dat1, 0, 0, 255,
+ Rast_add_f_color_rule(&dat1, 0, 0, 255,
&dat2, 0, 127, 255, &colors);
dat1 = dat2;
dat2 = (FCELL) - 0.00001;
- Rast_add_f_raster_color_rule(&dat1, 0, 127, 255,
+ Rast_add_f_color_rule(&dat1, 0, 127, 255,
&dat2, 0, 255, 255, &colors);
dat1 = dat2;
dat2 = (FCELL) 0.00;
- Rast_add_f_raster_color_rule(&dat1, 0, 255, 255,
+ Rast_add_f_color_rule(&dat1, 0, 255, 255,
&dat2, 200, 255, 200, &colors);
dat1 = dat2;
dat2 = (FCELL) 0.00001;
- Rast_add_f_raster_color_rule(&dat1, 200, 255, 200,
+ Rast_add_f_color_rule(&dat1, 200, 255, 200,
&dat2, 255, 255, 0, &colors);
dat1 = dat2;
dat2 = (FCELL) 0.001;
- Rast_add_f_raster_color_rule(&dat1, 255, 255, 0,
+ Rast_add_f_color_rule(&dat1, 255, 255, 0,
&dat2, 255, 127, 0, &colors);
dat1 = dat2;
dat2 = (FCELL) 0.01;
- Rast_add_f_raster_color_rule(&dat1, 255, 127, 0,
+ Rast_add_f_color_rule(&dat1, 255, 127, 0,
&dat2, 255, 0, 0, &colors);
dat1 = dat2;
dat2 = (FCELL) amax1(c1max, c2max);
- Rast_add_f_raster_color_rule(&dat1, 255, 0, 0,
+ Rast_add_f_color_rule(&dat1, 255, 0, 0,
&dat2, 155, 0, 20, &colors);
maps = NULL;
if (params->pcurv != NULL) {
maps = G_find_file("cell", params->pcurv, "");
if (maps == NULL) {
- fprintf(stderr, "file [%s] not found\n", params->pcurv);
+ G_warning(_("Raster map <%s> not found"), params->pcurv);
return -1;
}
Rast_write_colors(params->pcurv, maps, &colors);
@@ -462,7 +487,7 @@
maps = NULL;
maps = G_find_file("cell", params->tcurv, "");
if (maps == NULL) {
- fprintf(stderr, "file [%s] not found\n", params->tcurv);
+ G_warning(_("Raster map <%s> not found"), params->tcurv);
return -1;
}
Rast_write_colors(params->tcurv, maps, &colors);
@@ -486,7 +511,7 @@
maps = NULL;
maps = G_find_file("cell", params->mcurv, "");
if (maps == NULL) {
- fprintf(stderr, "file [%s] not found\n", params->mcurv);
+ G_warning(_("Raster map <%s> not found"), params->mcurv);
return -1;
}
Rast_write_colors(params->mcurv, maps, &colors);
@@ -512,7 +537,7 @@
if (params->elev != NULL) {
maps = G_find_file("cell", params->elev, "");
if (maps == NULL) {
- fprintf(stderr, "file [%s] not found \n", params->elev);
+ G_warning(_("Raster map <%s> not found"), params->elev);
return -1;
}
Rast_short_history(params->elev, "raster", &hist);
@@ -536,10 +561,10 @@
Rast_write_history(params->elev, &hist);
}
- /* change region to initial region */
- fprintf(stderr, "Changing the region back to initial...\n");
+/* change region to initial region */
+ G_verbose_message(_("Changing the region back to initial..."));
if (Rast_set_window(winhd) < 0) {
- fprintf(stderr, "Cannot set region to back to initial region!\n");
+ G_warning(_("Unable to set region"));
return -1;
}
Modified: grass/trunk/ps/ps.map/main.c
===================================================================
--- grass/trunk/ps/ps.map/main.c 2009-06-28 20:49:17 UTC (rev 38112)
+++ grass/trunk/ps/ps.map/main.c 2009-06-29 09:49:36 UTC (rev 38113)
@@ -425,7 +425,7 @@
for (i = 0; i < count; i += 2) {
dmin = val_list[i];
dmax = val_list[i + 1];
- Rast_add_d_raster_color_rule(&dmin, r, g, b, &dmax, r, g, b,
+ Rast_add_d_color_rule(&dmin, r, g, b, &dmax, r, g, b,
&PS.colors);
}
G_free(val_list);
Modified: grass/trunk/raster/r.composite/main.c
===================================================================
--- grass/trunk/raster/r.composite/main.c 2009-06-28 20:49:17 UTC (rev 38112)
+++ grass/trunk/raster/r.composite/main.c 2009-06-29 09:49:36 UTC (rev 38113)
@@ -298,8 +298,8 @@
CELL i0 = i;
CELL i1 = i + mr;
- Rast_add_c_raster_color_rule(&i0, 0, grn, blu,
- &i1, 255, grn, blu, colors);
+ Rast_add_c_color_rule(&i0, 0, grn, blu,
+ &i1, 255, grn, blu, colors);
i += nr;
}
Modified: grass/trunk/raster/r.flow/io.c
===================================================================
--- grass/trunk/raster/r.flow/io.c 2009-06-28 20:49:17 UTC (rev 38112)
+++ grass/trunk/raster/r.flow/io.c 2009-06-29 09:49:36 UTC (rev 38113)
@@ -193,6 +193,7 @@
int dsfd, row, col;
double dsmax = 0.0;
struct Colors colors;
+ CELL val1, val2;
if (Rast_set_window(®ion) < 0)
G_fatal_error(_("Cannot reset current region"));
@@ -212,12 +213,24 @@
Rast_init_colors(&colors);
- Rast_add_color_rule(-1, 0, 0, 0, -1, 0, 0, 0, &colors);
- Rast_add_color_rule(0, 255, 255, 255, 5, 255, 255, 0, &colors);
- Rast_add_color_rule(5, 255, 255, 0, 30, 0, 255, 255, &colors);
- Rast_add_color_rule(30, 0, 255, 255, 100, 0, 127, 255, &colors);
- Rast_add_color_rule(100, 0, 127, 255, 1000, 0, 0, 255, &colors);
- Rast_add_color_rule(1000, 0, 0, 255, (CELL) dsmax, 0, 0, 0, &colors);
+ val1 = -1;
+ val2 = -1;
+ Rast_add_c_color_rule(&val1, 0, 0, 0, &val2, 0, 0, 0, &colors);
+ val1 = 0;
+ val2 = 5;
+ Rast_add_c_color_rule(&val1, 255, 255, 255, &val2, 255, 255, 0, &colors);
+ val1 = 5;
+ val2 = 30;
+ Rast_add_c_color_rule(&val1, 255, 255, 0, &val2, 0, 255, 255, &colors);
+ val1 = 30;
+ val2 = 100;
+ Rast_add_c_color_rule(&val1, 0, 255, 255, &val2, 0, 127, 255, &colors);
+ val1 = 100;
+ val2 = 1000;
+ Rast_add_c_color_rule(&val1, 0, 127, 255, &val2, 0, 0, 255, &colors);
+ val1 = 1000;
+ val2 = (CELL) dsmax;
+ Rast_add_c_color_rule(&val1, 0, 0, 255, &val2, 0, 0, 0, &colors);
if ((mapset = G_find_file("cell", parm.dsout, "")) == NULL)
G_fatal_error(_("Unable to find file %s"), parm.dsout);
Modified: grass/trunk/raster/r.lake/main.c
===================================================================
--- grass/trunk/raster/r.lake/main.c 2009-06-28 20:49:17 UTC (rev 38112)
+++ grass/trunk/raster/r.lake/main.c 2009-06-29 09:49:36 UTC (rev 38113)
@@ -374,11 +374,11 @@
/* Add blue color gradient from light bank to dark depth */
Rast_init_colors(&colr);
if (negative_flag->answer == 1) {
- Rast_add_f_raster_color_rule(&max_depth, 0, 240, 255,
+ Rast_add_f_color_rule(&max_depth, 0, 240, 255,
&min_depth, 0, 50, 170, &colr);
}
else {
- Rast_add_f_raster_color_rule(&min_depth, 0, 240, 255,
+ Rast_add_f_color_rule(&min_depth, 0, 240, 255,
&max_depth, 0, 50, 170, &colr);
}
Modified: grass/trunk/raster/r.param.scale/write_cols.c
===================================================================
--- grass/trunk/raster/r.param.scale/write_cols.c 2009-06-28 20:49:17 UTC (rev 38112)
+++ grass/trunk/raster/r.param.scale/write_cols.c 2009-06-29 09:49:36 UTC (rev 38113)
@@ -20,15 +20,21 @@
void write_cols(void)
{
struct Colors colours;
-
+ CELL val1, val2;
Rast_init_colors(&colours);
- Rast_add_color_rule(FLAT, 180, 180, 180, /* White */
- PIT, 0, 0, 0, &colours); /* Black */
- Rast_add_color_rule(CHANNEL, 0, 0, 255, /* Blue */
- PASS, 0, 255, 0, &colours); /* Green */
- Rast_add_color_rule(RIDGE, 255, 255, 0, /* Yellow */
- PEAK, 255, 0, 0, &colours); /* Red */
+ val1 = FLAT;
+ val2 = PIT;
+ Rast_add_c_color_rule(&val1, 180, 180, 180, /* White */
+ &val2, 0, 0, 0, &colours); /* Black */
+ val1 = CHANNEL;
+ val2 = PASS;
+ Rast_add_c_color_rule(&val1, 0, 0, 255, /* Blue */
+ &val2, 0, 255, 0, &colours); /* Green */
+ val1 = RIDGE;
+ val2 = PEAK;
+ Rast_add_c_color_rule(&val1, 255, 255, 0, /* Yellow */
+ &val2, 255, 0, 0, &colours); /* Red */
Rast_write_colors(rast_out_name, G_mapset(), &colours);
Modified: grass/trunk/raster/r.random/support.c
===================================================================
--- grass/trunk/raster/r.random/support.c 2009-06-28 20:49:17 UTC (rev 38112)
+++ grass/trunk/raster/r.random/support.c 2009-06-29 09:49:36 UTC (rev 38113)
@@ -63,9 +63,9 @@
/* set colors for output raster */
if (Rast_read_colors(inraster, "", &clr) >= 0) {
if (theState->use_nulls) {
- Rast_add_raster_color_rule(nulls.data.v, 127, 127, 127,
- nulls.data.v, 127, 127, 127, &clr,
- nulls.type);
+ Rast_add_color_rule(nulls.data.v, 127, 127, 127,
+ nulls.data.v, 127, 127, 127, &clr,
+ nulls.type);
}
Rast_write_colors(theState->outraster, G_mapset(), &clr);
}
Modified: grass/trunk/raster/r.random.surface/save.c
===================================================================
--- grass/trunk/raster/r.random.surface/save.c 2009-06-28 20:49:17 UTC (rev 38112)
+++ grass/trunk/raster/r.random.surface/save.c 2009-06-29 09:49:36 UTC (rev 38113)
@@ -213,8 +213,8 @@
G_debug(3, "(LowColor):%d", LowColor);
G_debug(3, "(HighColor):%d", HighColor);
- Rast_add_color_rule(1, LowColor, LowColor, LowColor,
- High, HighColor, HighColor, HighColor, &Colr);
+ Rast_add_c_color_rule(&Low, LowColor, LowColor, LowColor,
+ &High, HighColor, HighColor, HighColor, &Colr);
if (Rast_write_colors(OutNames[NumMap], G_mapset(), &Colr) == -1)
G_warning(_("Unable to write color table for raster map <%s>"),
Modified: grass/trunk/raster/r.slope.aspect/main.c
===================================================================
--- grass/trunk/raster/r.slope.aspect/main.c 2009-06-28 20:49:17 UTC (rev 38112)
+++ grass/trunk/raster/r.slope.aspect/main.c 2009-06-29 09:49:36 UTC (rev 38113)
@@ -1082,15 +1082,30 @@
if (slope_fd >= 0) {
/* colortable for slopes */
+ CELL val1, val2;
Rast_init_colors(&colors);
- Rast_add_color_rule(0, 255, 255, 255, 2, 255, 255, 0, &colors);
- Rast_add_color_rule(2, 255, 255, 0, 5, 0, 255, 0, &colors);
- Rast_add_color_rule(5, 0, 255, 0, 10, 0, 255, 255, &colors);
- Rast_add_color_rule(10, 0, 255, 255, 15, 0, 0, 255, &colors);
- Rast_add_color_rule(15, 0, 0, 255, 30, 255, 0, 255, &colors);
- Rast_add_color_rule(30, 255, 0, 255, 50, 255, 0, 0, &colors);
- Rast_add_color_rule(50, 255, 0, 0, 90, 0, 0, 0, &colors);
-
+ val1 = 0;
+ val2 = 2;
+ Rast_add_c_color_rule(&val1, 255, 255, 255, &val2, 255, 255, 0, &colors);
+ val1 = 2;
+ val2 = 5;
+ Rast_add_c_color_rule(&val1, 255, 255, 0, &val2, 0, 255, 0, &colors);
+ val1 = 5;
+ val2 = 10;
+ Rast_add_c_color_rule(&val1, 0, 255, 0, &val2, 0, 255, 255, &colors);
+ val1 = 10;
+ val2 = 15;
+ Rast_add_c_color_rule(&val1, 0, 255, 255, &val2, 0, 0, 255, &colors);
+ val1 = 15;
+ val2 = 30;
+ Rast_add_c_color_rule(&val1, 0, 0, 255, &val2, 255, 0, 255, &colors);
+ val1 = 30;
+ val2 = 50;
+ Rast_add_c_color_rule(&val1, 255, 0, 255, &val2, 255, 0, 0, &colors);
+ val1 = 50;
+ val2 = 90;
+ Rast_add_c_color_rule(&val1, 255, 0, 0, &val2, 0, 0, 0, &colors);
+
Rast_set_null_value(slp_raster, G_window_cols(), data_type);
Rast_put_raster_row(slope_fd, slp_raster, data_type);
Rast_close(slope_fd);
@@ -1184,31 +1199,31 @@
dat1 = (FCELL) c2min;
dat2 = (FCELL) - 0.01;
- Rast_add_f_raster_color_rule(&dat1, 127, 0, 255,
+ Rast_add_f_color_rule(&dat1, 127, 0, 255,
&dat2, 0, 0, 255, &colors);
dat1 = dat2;
dat2 = (FCELL) - 0.001;
- Rast_add_f_raster_color_rule(&dat1, 0, 0, 255,
+ Rast_add_f_color_rule(&dat1, 0, 0, 255,
&dat2, 0, 127, 255, &colors);
dat1 = dat2;
dat2 = (FCELL) - 0.00001;
- Rast_add_f_raster_color_rule(&dat1, 0, 127, 255,
+ Rast_add_f_color_rule(&dat1, 0, 127, 255,
&dat2, 0, 255, 255, &colors);
dat1 = dat2;
dat2 = (FCELL) 0.0;
- Rast_add_f_raster_color_rule(&dat1, 0, 255, 255,
+ Rast_add_f_color_rule(&dat1, 0, 255, 255,
&dat2, 200, 255, 200, &colors);
dat1 = dat2;
dat2 = (FCELL) 0.00001;
- Rast_add_f_raster_color_rule(&dat1, 200, 255, 200,
+ Rast_add_f_color_rule(&dat1, 200, 255, 200,
&dat2, 255, 255, 0, &colors);
dat1 = dat2;
dat2 = (FCELL) 0.001;
- Rast_add_f_raster_color_rule(&dat1, 255, 255, 0,
+ Rast_add_f_color_rule(&dat1, 255, 255, 0,
&dat2, 255, 127, 0, &colors);
dat1 = dat2;
dat2 = (FCELL) 0.01;
- Rast_add_f_raster_color_rule(&dat1, 255, 127, 0,
+ Rast_add_f_color_rule(&dat1, 255, 127, 0,
&dat2, 255, 0, 0, &colors);
dat1 = dat2;
if (c1max > c2max)
@@ -1216,7 +1231,7 @@
else
dat2 = (FCELL) c2max;
- Rast_add_f_raster_color_rule(&dat1, 255, 0, 0,
+ Rast_add_f_color_rule(&dat1, 255, 0, 0,
&dat2, 255, 0, 200, &colors);
}
Modified: grass/trunk/raster/r.terraflow/main.cc
===================================================================
--- grass/trunk/raster/r.terraflow/main.cc 2009-06-28 20:49:17 UTC (rev 38112)
+++ grass/trunk/raster/r.terraflow/main.cc 2009-06-29 09:49:36 UTC (rev 38113)
@@ -351,11 +351,11 @@
Rast_init_colors(&colors);
- Rast_add_color_rule(v[0], 255,255,255, v[1], 255,255,0, &colors);
- Rast_add_color_rule(v[1], 255,255,0, v[2], 0,255,255, &colors);
- Rast_add_color_rule(v[2], 0,255,255, v[3], 0,127,255, &colors);
- Rast_add_color_rule(v[3], 0,127,255, v[4], 0,0,255, &colors);
- Rast_add_color_rule(v[4], 0,0,255, (CELL)v[5], 0,0,0, &colors);
+ Rast_add_c_color_rule(&v[0], 255,255,255, &v[1], 255,255,0, &colors);
+ Rast_add_c_color_rule(&v[1], 255,255,0, &v[2], 0,255,255, &colors);
+ Rast_add_c_color_rule(&v[2], 0,255,255, &v[3], 0,127,255, &colors);
+ Rast_add_c_color_rule(&v[3], 0,127,255, &v[4], 0,0,255, &colors);
+ Rast_add_c_color_rule(&v[4], 0,0,255, &v[5], 0,0,0, &colors);
if (Rast_write_colors(cellname, mapset, &colors) == -1) {
Modified: grass/trunk/raster/r.watershed/ram/close_maps.c
===================================================================
--- grass/trunk/raster/r.watershed/ram/close_maps.c 2009-06-28 20:49:17 UTC (rev 38112)
+++ grass/trunk/raster/r.watershed/ram/close_maps.c 2009-06-29 09:49:36 UTC (rev 38113)
@@ -84,51 +84,51 @@
if (min < (-stddev - 1)) {
clr_min = min;
clr_max = -stddev - 1;
- Rast_add_d_raster_color_rule(&clr_min, 0, 0, 0, &clr_max, 0,
+ Rast_add_d_color_rule(&clr_min, 0, 0, 0, &clr_max, 0,
0, 0, &colors);
}
clr_min = -stddev - 1.;
clr_max = -1. * exp(lstddev * 0.75);
- Rast_add_d_raster_color_rule(&clr_min, 0, 0, 0, &clr_max, 0,
+ Rast_add_d_color_rule(&clr_min, 0, 0, 0, &clr_max, 0,
0, 255, &colors);
clr_min = clr_max;
clr_max = -1. * exp(lstddev * 0.5);
- Rast_add_d_raster_color_rule(&clr_min, 0, 0, 255, &clr_max, 0,
+ Rast_add_d_color_rule(&clr_min, 0, 0, 255, &clr_max, 0,
255, 255, &colors);
clr_min = clr_max;
clr_max = -1. * exp(lstddev * 0.35);
- Rast_add_d_raster_color_rule(&clr_min, 0, 255, 255, &clr_max, 0,
+ Rast_add_d_color_rule(&clr_min, 0, 255, 255, &clr_max, 0,
255, 0, &colors);
clr_min = clr_max;
clr_max = -1.;
- Rast_add_d_raster_color_rule(&clr_min, 0, 255, 0, &clr_max, 255,
+ Rast_add_d_color_rule(&clr_min, 0, 255, 0, &clr_max, 255,
255, 0, &colors);
}
clr_min = -1.;
clr_max = 1.;
- Rast_add_d_raster_color_rule(&clr_min, 255, 255, 0, &clr_max, 255,
+ Rast_add_d_color_rule(&clr_min, 255, 255, 0, &clr_max, 255,
255, 0, &colors);
clr_min = 1;
clr_max = exp(lstddev * 0.35);
- Rast_add_d_raster_color_rule(&clr_min, 255, 255, 0, &clr_max, 0,
+ Rast_add_d_color_rule(&clr_min, 255, 255, 0, &clr_max, 0,
255, 0, &colors);
clr_min = clr_max;
clr_max = exp(lstddev * 0.5);
- Rast_add_d_raster_color_rule(&clr_min, 0, 255, 0, &clr_max, 0,
+ Rast_add_d_color_rule(&clr_min, 0, 255, 0, &clr_max, 0,
255, 255, &colors);
clr_min = clr_max;
clr_max = exp(lstddev * 0.75);
- Rast_add_d_raster_color_rule(&clr_min, 0, 255, 255, &clr_max, 0,
+ Rast_add_d_color_rule(&clr_min, 0, 255, 255, &clr_max, 0,
0, 255, &colors);
clr_min = clr_max;
clr_max = stddev + 1.;
- Rast_add_d_raster_color_rule(&clr_min, 0, 0, 255, &clr_max, 0, 0,
+ Rast_add_d_color_rule(&clr_min, 0, 0, 255, &clr_max, 0, 0,
0, &colors);
if (max > 0 && max > stddev + 1) {
clr_min = stddev + 1;
clr_max = max;
- Rast_add_d_raster_color_rule(&clr_min, 0, 0, 0, &clr_max, 0, 0,
+ Rast_add_d_color_rule(&clr_min, 0, 0, 0, &clr_max, 0, 0,
0, &colors);
}
Rast_write_colors(wat_name, this_mapset, &colors);
Modified: grass/trunk/raster/r.watershed/seg/close_maps.c
===================================================================
--- grass/trunk/raster/r.watershed/seg/close_maps.c 2009-06-28 20:49:17 UTC (rev 38112)
+++ grass/trunk/raster/r.watershed/seg/close_maps.c 2009-06-29 09:49:36 UTC (rev 38113)
@@ -83,51 +83,51 @@
if (min < (-stddev - 1)) {
clr_min = min;
clr_max = -stddev - 1;
- Rast_add_d_raster_color_rule(&clr_min, 0, 0, 0, &clr_max, 0,
+ Rast_add_d_color_rule(&clr_min, 0, 0, 0, &clr_max, 0,
0, 0, &colors);
}
clr_min = -stddev - 1.;
clr_max = -1. * exp(lstddev * 0.75);
- Rast_add_d_raster_color_rule(&clr_min, 0, 0, 0, &clr_max, 0,
+ Rast_add_d_color_rule(&clr_min, 0, 0, 0, &clr_max, 0,
0, 255, &colors);
clr_min = clr_max;
clr_max = -1. * exp(lstddev * 0.5);
- Rast_add_d_raster_color_rule(&clr_min, 0, 0, 255, &clr_max, 0,
+ Rast_add_d_color_rule(&clr_min, 0, 0, 255, &clr_max, 0,
255, 255, &colors);
clr_min = clr_max;
clr_max = -1. * exp(lstddev * 0.35);
- Rast_add_d_raster_color_rule(&clr_min, 0, 255, 255, &clr_max, 0,
+ Rast_add_d_color_rule(&clr_min, 0, 255, 255, &clr_max, 0,
255, 0, &colors);
clr_min = clr_max;
clr_max = -1.;
- Rast_add_d_raster_color_rule(&clr_min, 0, 255, 0, &clr_max, 255,
+ Rast_add_d_color_rule(&clr_min, 0, 255, 0, &clr_max, 255,
255, 0, &colors);
}
clr_min = -1.;
clr_max = 1.;
- Rast_add_d_raster_color_rule(&clr_min, 255, 255, 0, &clr_max, 255,
+ Rast_add_d_color_rule(&clr_min, 255, 255, 0, &clr_max, 255,
255, 0, &colors);
clr_min = 1;
clr_max = exp(lstddev * 0.35);
- Rast_add_d_raster_color_rule(&clr_min, 255, 255, 0, &clr_max, 0,
+ Rast_add_d_color_rule(&clr_min, 255, 255, 0, &clr_max, 0,
255, 0, &colors);
clr_min = clr_max;
clr_max = exp(lstddev * 0.5);
- Rast_add_d_raster_color_rule(&clr_min, 0, 255, 0, &clr_max, 0,
+ Rast_add_d_color_rule(&clr_min, 0, 255, 0, &clr_max, 0,
255, 255, &colors);
clr_min = clr_max;
clr_max = exp(lstddev * 0.75);
- Rast_add_d_raster_color_rule(&clr_min, 0, 255, 255, &clr_max, 0,
+ Rast_add_d_color_rule(&clr_min, 0, 255, 255, &clr_max, 0,
0, 255, &colors);
clr_min = clr_max;
clr_max = stddev + 1.;
- Rast_add_d_raster_color_rule(&clr_min, 0, 0, 255, &clr_max, 0, 0,
+ Rast_add_d_color_rule(&clr_min, 0, 0, 255, &clr_max, 0, 0,
0, &colors);
if (max > 0 && max > stddev + 1) {
clr_min = stddev + 1;
clr_max = max;
- Rast_add_d_raster_color_rule(&clr_min, 0, 0, 0, &clr_max, 0, 0, 0,
+ Rast_add_d_color_rule(&clr_min, 0, 0, 0, &clr_max, 0, 0, 0,
&colors);
}
Rast_write_colors(wat_name, this_mapset, &colors);
Modified: grass/trunk/raster/simwe/simlib/output.c
===================================================================
--- grass/trunk/raster/simwe/simlib/output.c 2009-06-28 20:49:17 UTC (rev 38112)
+++ grass/trunk/raster/simwe/simlib/output.c 2009-06-29 09:49:36 UTC (rev 38113)
@@ -286,23 +286,23 @@
dat1 = (FCELL) 0.;
dat2 = (FCELL) 0.001;
- Rast_add_f_raster_color_rule(&dat1, 255, 255, 255, &dat2, 255, 255, 0,
+ Rast_add_f_color_rule(&dat1, 255, 255, 255, &dat2, 255, 255, 0,
&colors);
dat1 = dat2;
dat2 = (FCELL) 0.05;
- Rast_add_f_raster_color_rule(&dat1, 255, 255, 0, &dat2, 0, 255, 255,
+ Rast_add_f_color_rule(&dat1, 255, 255, 0, &dat2, 0, 255, 255,
&colors);
dat1 = dat2;
dat2 = (FCELL) 0.1;
- Rast_add_f_raster_color_rule(&dat1, 0, 255, 255, &dat2, 0, 127, 255,
+ Rast_add_f_color_rule(&dat1, 0, 255, 255, &dat2, 0, 127, 255,
&colors);
dat1 = dat2;
dat2 = (FCELL) 0.5;
- Rast_add_f_raster_color_rule(&dat1, 0, 127, 255, &dat2, 0, 0, 255,
+ Rast_add_f_color_rule(&dat1, 0, 127, 255, &dat2, 0, 0, 255,
&colors);
dat1 = dat2;
dat2 = (FCELL) gmax;
- Rast_add_f_raster_color_rule(&dat1, 0, 0, 255, &dat2, 0, 0, 0, &colors);
+ Rast_add_f_color_rule(&dat1, 0, 0, 255, &dat2, 0, 0, 0, &colors);
if (ts == 1) {
@@ -330,23 +330,23 @@
dat1 = (FCELL) 0.;
dat2 = (FCELL) 0.0005;
- Rast_add_f_raster_color_rule(&dat1, 255, 255, 255, &dat2, 255, 255, 0,
+ Rast_add_f_color_rule(&dat1, 255, 255, 255, &dat2, 255, 255, 0,
&colors);
dat1 = dat2;
dat2 = (FCELL) 0.005;
- Rast_add_f_raster_color_rule(&dat1, 255, 255, 0, &dat2, 0, 255, 255,
+ Rast_add_f_color_rule(&dat1, 255, 255, 0, &dat2, 0, 255, 255,
&colors);
dat1 = dat2;
dat2 = (FCELL) 0.05;
- Rast_add_f_raster_color_rule(&dat1, 0, 255, 255, &dat2, 0, 127, 255,
+ Rast_add_f_color_rule(&dat1, 0, 255, 255, &dat2, 0, 127, 255,
&colors);
dat1 = dat2;
dat2 = (FCELL) 0.1;
- Rast_add_f_raster_color_rule(&dat1, 0, 127, 255, &dat2, 0, 0, 255,
+ Rast_add_f_color_rule(&dat1, 0, 127, 255, &dat2, 0, 0, 255,
&colors);
dat1 = dat2;
dat2 = (FCELL) dismax;
- Rast_add_f_raster_color_rule(&dat1, 0, 0, 255, &dat2, 0, 0, 0, &colors);
+ Rast_add_f_color_rule(&dat1, 0, 0, 255, &dat2, 0, 0, 0, &colors);
if (ts == 1) {
if ((mapst = G_find_file("cell", disch0, "")) == NULL)
@@ -373,19 +373,19 @@
dat1 = (FCELL) 0.;
dat2 = (FCELL) 0.001;
- Rast_add_f_raster_color_rule(&dat1, 255, 255, 255, &dat2, 255, 255, 0,
+ Rast_add_f_color_rule(&dat1, 255, 255, 255, &dat2, 255, 255, 0,
&colors);
dat1 = dat2;
dat2 = (FCELL) 0.1;
- Rast_add_f_raster_color_rule(&dat1, 255, 255, 0, &dat2, 255, 127, 0,
+ Rast_add_f_color_rule(&dat1, 255, 255, 0, &dat2, 255, 127, 0,
&colors);
dat1 = dat2;
dat2 = (FCELL) 1.;
- Rast_add_f_raster_color_rule(&dat1, 255, 127, 0, &dat2, 191, 127, 63,
+ Rast_add_f_color_rule(&dat1, 255, 127, 0, &dat2, 191, 127, 63,
&colors);
dat1 = dat2;
dat2 = (FCELL) dismax;
- Rast_add_f_raster_color_rule(&dat1, 191, 127, 63, &dat2, 0, 0, 0,
+ Rast_add_f_color_rule(&dat1, 191, 127, 63, &dat2, 0, 0, 0,
&colors);
if (ts == 1) {
@@ -414,34 +414,34 @@
dat1 = (FCELL) ermax;
dat2 = (FCELL) 0.1;
- Rast_add_f_raster_color_rule(&dat1, 0, 0, 0, &dat2, 0, 0, 255, &colors);
+ Rast_add_f_color_rule(&dat1, 0, 0, 0, &dat2, 0, 0, 255, &colors);
dat1 = dat2;
dat2 = (FCELL) 0.01;
- Rast_add_f_raster_color_rule(&dat1, 0, 0, 255, &dat2, 0, 191, 191,
+ Rast_add_f_color_rule(&dat1, 0, 0, 255, &dat2, 0, 191, 191,
&colors);
dat1 = dat2;
dat2 = (FCELL) 0.0001;
- Rast_add_f_raster_color_rule(&dat1, 0, 191, 191, &dat2, 170, 255, 255,
+ Rast_add_f_color_rule(&dat1, 0, 191, 191, &dat2, 170, 255, 255,
&colors);
dat1 = dat2;
dat2 = (FCELL) 0.;
- Rast_add_f_raster_color_rule(&dat1, 170, 255, 255, &dat2, 255, 255, 255,
+ Rast_add_f_color_rule(&dat1, 170, 255, 255, &dat2, 255, 255, 255,
&colors);
dat1 = dat2;
dat2 = (FCELL) - 0.0001;
- Rast_add_f_raster_color_rule(&dat1, 255, 255, 255, &dat2, 255, 255, 0,
+ Rast_add_f_color_rule(&dat1, 255, 255, 255, &dat2, 255, 255, 0,
&colors);
dat1 = dat2;
dat2 = (FCELL) - 0.01;
- Rast_add_f_raster_color_rule(&dat1, 255, 255, 0, &dat2, 255, 127, 0,
+ Rast_add_f_color_rule(&dat1, 255, 255, 0, &dat2, 255, 127, 0,
&colors);
dat1 = dat2;
dat2 = (FCELL) - 0.1;
- Rast_add_f_raster_color_rule(&dat1, 255, 127, 0, &dat2, 255, 0, 0,
+ Rast_add_f_color_rule(&dat1, 255, 127, 0, &dat2, 255, 0, 0,
&colors);
dat1 = dat2;
dat2 = (FCELL) ermin;
- Rast_add_f_raster_color_rule(&dat1, 255, 0, 0, &dat2, 255, 0, 255,
+ Rast_add_f_color_rule(&dat1, 255, 0, 0, &dat2, 255, 0, 255,
&colors);
if (ts == 1) {
@@ -703,34 +703,34 @@
dat1 = (FCELL) etmax;
dat2 = (FCELL) 0.1;
- Rast_add_f_raster_color_rule(&dat1, 0, 0, 0, &dat2, 0, 0, 255, &colors);
+ Rast_add_f_color_rule(&dat1, 0, 0, 0, &dat2, 0, 0, 255, &colors);
dat1 = dat2;
dat2 = (FCELL) 0.01;
- Rast_add_f_raster_color_rule(&dat1, 0, 0, 255, &dat2, 0, 191, 191,
+ Rast_add_f_color_rule(&dat1, 0, 0, 255, &dat2, 0, 191, 191,
&colors);
dat1 = dat2;
dat2 = (FCELL) 0.0001;
- Rast_add_f_raster_color_rule(&dat1, 0, 191, 191, &dat2, 170, 255, 255,
+ Rast_add_f_color_rule(&dat1, 0, 191, 191, &dat2, 170, 255, 255,
&colors);
dat1 = dat2;
dat2 = (FCELL) 0.;
- Rast_add_f_raster_color_rule(&dat1, 170, 255, 255, &dat2, 255, 255, 255,
+ Rast_add_f_color_rule(&dat1, 170, 255, 255, &dat2, 255, 255, 255,
&colors);
dat1 = dat2;
dat2 = (FCELL) - 0.0001;
- Rast_add_f_raster_color_rule(&dat1, 255, 255, 255, &dat2, 255, 255, 0,
+ Rast_add_f_color_rule(&dat1, 255, 255, 255, &dat2, 255, 255, 0,
&colors);
dat1 = dat2;
dat2 = (FCELL) - 0.01;
- Rast_add_f_raster_color_rule(&dat1, 255, 255, 0, &dat2, 255, 127, 0,
+ Rast_add_f_color_rule(&dat1, 255, 255, 0, &dat2, 255, 127, 0,
&colors);
dat1 = dat2;
dat2 = (FCELL) - 0.1;
- Rast_add_f_raster_color_rule(&dat1, 255, 127, 0, &dat2, 255, 0, 0,
+ Rast_add_f_color_rule(&dat1, 255, 127, 0, &dat2, 255, 0, 0,
&colors);
dat1 = dat2;
dat2 = (FCELL) etmin;
- Rast_add_f_raster_color_rule(&dat1, 255, 0, 0, &dat2, 255, 0, 255,
+ Rast_add_f_color_rule(&dat1, 255, 0, 0, &dat2, 255, 0, 255,
&colors);
/* if (ts == 1) {
Modified: grass/trunk/swig/perl/R_slope_aspect/r_slope_aspect/r_slope_aspect.c
===================================================================
--- grass/trunk/swig/perl/R_slope_aspect/r_slope_aspect/r_slope_aspect.c 2009-06-28 20:49:17 UTC (rev 38112)
+++ grass/trunk/swig/perl/R_slope_aspect/r_slope_aspect/r_slope_aspect.c 2009-06-29 09:49:36 UTC (rev 38113)
@@ -1106,14 +1106,29 @@
if (slope_fd >= 0) {
/* colortable for slopes */
+ CELL val1, val2;
Rast_init_colors(&colors);
- Rast_add_color_rule(0, 255, 255, 255, 2, 255, 255, 0, &colors);
- Rast_add_color_rule(2, 255, 255, 0, 5, 0, 255, 0, &colors);
- Rast_add_color_rule(5, 0, 255, 0, 10, 0, 255, 255, &colors);
- Rast_add_color_rule(10, 0, 255, 255, 15, 0, 0, 255, &colors);
- Rast_add_color_rule(15, 0, 0, 255, 30, 255, 0, 255, &colors);
- Rast_add_color_rule(30, 255, 0, 255, 50, 255, 0, 0, &colors);
- Rast_add_color_rule(50, 255, 0, 0, 90, 0, 0, 0, &colors);
+ val1 = 0;
+ val2 = 2;
+ Rast_add_c_color_rule(&val1, 255, 255, 255, &val2, 255, 255, 0, &colors);
+ val1 = 2;
+ val2 = 5;
+ Rast_add_c_color_rule(&val1, 255, 255, 0, &val2, 0, 255, 0, &colors);
+ val1 = 5;
+ val2 = 10;
+ Rast_add_c_color_rule(&val1, 0, 255, 0, &val2, 0, 255, 255, &colors);
+ val1 = 10;
+ val2 = 15;
+ Rast_add_c_color_rule(&val1, 0, 255, 255, &val2, 0, 0, 255, &colors);
+ val1 = 15;
+ val2 = 30;
+ Rast_add_c_color_rule(&val1, 0, 0, 255, &val2, 255, 0, 255, &colors);
+ val1 = 30;
+ val2 = 50;
+ Rast_add_c_color_rule(&val1, 255, 0, 255, &val2, 255, 0, 0, &colors);
+ val1 = 50;
+ val2 = 90;
+ Rast_add_c_color_rule(&val1, 255, 0, 0, &val2, 0, 0, 0, &colors);
Rast_set_null_value(slp_raster, G_window_cols(), data_type);
Rast_put_raster_row(slope_fd, slp_raster, data_type);
@@ -1206,31 +1221,31 @@
dat1 = (FCELL) c2min;
dat2 = (FCELL) - 0.01;
- Rast_add_f_raster_color_rule(&dat1, 127, 0, 255,
+ Rast_add_f_color_rule(&dat1, 127, 0, 255,
&dat2, 0, 0, 255, &colors);
dat1 = dat2;
dat2 = (FCELL) - 0.001;
- Rast_add_f_raster_color_rule(&dat1, 0, 0, 255,
+ Rast_add_f_color_rule(&dat1, 0, 0, 255,
&dat2, 0, 127, 255, &colors);
dat1 = dat2;
dat2 = (FCELL) - 0.00001;
- Rast_add_f_raster_color_rule(&dat1, 0, 127, 255,
+ Rast_add_f_color_rule(&dat1, 0, 127, 255,
&dat2, 0, 255, 255, &colors);
dat1 = dat2;
dat2 = (FCELL) 0.0;
- Rast_add_f_raster_color_rule(&dat1, 0, 255, 255,
+ Rast_add_f_color_rule(&dat1, 0, 255, 255,
&dat2, 200, 255, 200, &colors);
dat1 = dat2;
dat2 = (FCELL) 0.00001;
- Rast_add_f_raster_color_rule(&dat1, 200, 255, 200,
+ Rast_add_f_color_rule(&dat1, 200, 255, 200,
&dat2, 255, 255, 0, &colors);
dat1 = dat2;
dat2 = (FCELL) 0.001;
- Rast_add_f_raster_color_rule(&dat1, 255, 255, 0,
+ Rast_add_f_color_rule(&dat1, 255, 255, 0,
&dat2, 255, 127, 0, &colors);
dat1 = dat2;
dat2 = (FCELL) 0.01;
- Rast_add_f_raster_color_rule(&dat1, 255, 127, 0,
+ Rast_add_f_color_rule(&dat1, 255, 127, 0,
&dat2, 255, 0, 0, &colors);
dat1 = dat2;
if (c1max > c2max)
@@ -1238,7 +1253,7 @@
else
dat2 = (FCELL) c2max;
- Rast_add_f_raster_color_rule(&dat1, 255, 0, 0,
+ Rast_add_f_color_rule(&dat1, 255, 0, 0,
&dat2, 255, 0, 200, &colors);
}
Modified: grass/trunk/vector/v.to.rast/support.c
===================================================================
--- grass/trunk/vector/v.to.rast/support.c 2009-06-28 20:49:17 UTC (rev 38112)
+++ grass/trunk/vector/v.to.rast/support.c 2009-06-29 09:49:36 UTC (rev 38113)
@@ -201,7 +201,7 @@
/* set the color rules: for each rule */
for (i = 0; i < colors_n_values - 1; i++) {
if (is_fp) { /* add floating point color rule */
- Rast_add_d_raster_color_rule(&my_color_rules[i].d,
+ Rast_add_d_color_rule(&my_color_rules[i].d,
my_color_rules[i].red,
my_color_rules[i].green,
my_color_rules[i].blue,
@@ -211,13 +211,13 @@
my_color_rules[i + 1].blue, &colors);
}
else { /* add CELL color rule */
- Rast_add_color_rule((CELL) my_color_rules[i].i,
- my_color_rules[i].red, my_color_rules[i].green,
- my_color_rules[i].blue,
- (CELL) my_color_rules[i + 1].i,
- my_color_rules[i + 1].red,
- my_color_rules[i + 1].green,
- my_color_rules[i + 1].blue, &colors);
+ Rast_add_c_color_rule(&my_color_rules[i].i,
+ my_color_rules[i].red, my_color_rules[i].green,
+ my_color_rules[i].blue,
+ &my_color_rules[i + 1].i,
+ my_color_rules[i + 1].red,
+ my_color_rules[i + 1].green,
+ my_color_rules[i + 1].blue, &colors);
}
}
More information about the grass-commit
mailing list