color_range.c

Go to the documentation of this file.
00001 #include "gis.h"
00002 
00003 int G_set_color_range ( CELL min,CELL max, struct Colors *colors)
00004 {
00005     if (min < max)
00006     {
00007         colors->cmin = (DCELL) min;
00008         colors->cmax = (DCELL) max;
00009     }
00010     else
00011     {
00012         colors->cmin = (DCELL) max;
00013         colors->cmax = (DCELL) min;
00014     }
00015 
00016     return 0;
00017 }
00018 
00019 int 
00020 G_set_d_color_range (DCELL min, DCELL max, struct Colors *colors)
00021 {
00022     if (min < max)
00023     {
00024         colors->cmin = min;
00025         colors->cmax = max;
00026     }
00027     else
00028     {
00029         colors->cmin = max;
00030         colors->cmax = min;
00031     }
00032 
00033     return 0;
00034 }
00035 
00036 /* returns min and max category in the range or huge numbers
00037    if the co,lor table is defined on floating cell values and
00038    not on categories */
00039 
00040 
00048 int 
00049 G_get_color_range (CELL *min, CELL *max, struct Colors *colors)
00050 {
00051     double floor(), ceil();
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 /* returns min and max values in the range */
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 }

Generated on Wed Aug 23 17:49:22 2006 for GRASS by  doxygen 1.4.7