00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #include <grass/gis.h>
00013 static int add_aspect_colors (struct Colors *, DCELL, DCELL);
00014
00015
00027 int G_make_aspect_colors (struct Colors *colors, CELL min, CELL max)
00028 {
00029 G_init_colors (colors);
00030 return add_aspect_colors (colors,(DCELL) min,(DCELL) max) ;
00031 }
00032
00033 int G_make_aspect_fp_colors (struct Colors *colors, DCELL min, DCELL max)
00034 {
00035 G_init_colors (colors);
00036 return add_aspect_colors (colors,min,max) ;
00037 }
00038
00039 int G_add_aspect_colors (struct Colors *colors, CELL min, CELL max)
00040 {
00041 return add_aspect_colors (colors,(DCELL) min,(DCELL) max) ;
00042 }
00043
00044 static int add_aspect_colors (struct Colors *colors, DCELL min, DCELL max)
00045 {
00046 DCELL half;
00047
00048 if (max < min)
00049 return -1;
00050
00051 if (min == 1.) min = 0.;
00052 if (max == -1.) max = 0.;
00053 half = (min+max)/2.;
00054
00055 G_add_d_raster_color_rule (&min, 0,0,0, &half, 255, 255, 255, colors);
00056 G_add_d_raster_color_rule (&half, 255, 255, 255, &max, 0,0,0, colors);
00057
00058 return 1;
00059 }