00001 #include <math.h>
00002 #include <grass/gis.h>
00003
00004 int G_set_color_range ( CELL min,CELL max, struct Colors *colors)
00005 {
00006 if (min < max)
00007 {
00008 colors->cmin = (DCELL) min;
00009 colors->cmax = (DCELL) max;
00010 }
00011 else
00012 {
00013 colors->cmin = (DCELL) max;
00014 colors->cmax = (DCELL) min;
00015 }
00016
00017 return 0;
00018 }
00019
00020 int
00021 G_set_d_color_range (DCELL min, DCELL max, struct Colors *colors)
00022 {
00023 if (min < max)
00024 {
00025 colors->cmin = min;
00026 colors->cmax = max;
00027 }
00028 else
00029 {
00030 colors->cmin = max;
00031 colors->cmax = min;
00032 }
00033
00034 return 0;
00035 }
00036
00037
00038
00039
00040
00041
00049 int
00050 G_get_color_range (CELL *min, CELL *max, struct Colors *colors)
00051 {
00052 if(!colors->is_float)
00053 {
00054 *min = (CELL) floor(colors->cmin);
00055 *max = (CELL) ceil(colors->cmax);
00056 }
00057 else
00058 {
00059 *min = -255 * 255 * 255;
00060 *max = 255 * 255 * 255;
00061 }
00062
00063 return 0;
00064 }
00065
00066
00067 int
00068 G_get_d_color_range (DCELL *min, DCELL *max, struct Colors *colors)
00069 {
00070 *min = colors->cmin;
00071 *max = colors->cmax;
00072
00073 return 0;
00074 }