color_write.c File Reference

#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <grass/gis.h>

Include dependency graph for color_write.c:

Go to the source code of this file.

Defines

#define PRECISION   30
#define THRESHOLD   .0000000000000000000000000000005

Functions

int G_write_colors (char *name, char *mapset, struct Colors *colors)
 write map layer color table
int G__write_colors (FILE *fd, struct Colors *colors)


Define Documentation

#define PRECISION   30

Definition at line 22 of file color_write.c.

#define THRESHOLD   .0000000000000000000000000000005

Definition at line 23 of file color_write.c.


Function Documentation

int G__write_colors ( FILE *  fd,
struct Colors *  colors 
)

Definition at line 108 of file color_write.c.

References getenv().

Referenced by G_write_colors().

int G_write_colors ( char *  name,
char *  mapset,
struct Colors *  colors 
)

write map layer color table

The color table is written for the raster file name in the specified mapset from the colors structure. If there is an error, -1 is returned. No diagnostic is printed. Otherwise, 1 is returned. The colors structure must be created properly, i.e., G_init_colors to initialize the structure and G_add_color_rule to set the category colors.

Remarks:
{These routines are called by higher level routines which read or create entire color tables, such asG_read_colors or G_make_ramp_colors.} Note. The calling sequence for this function deserves special attention. The mapset parameter seems to imply that it is possible to overwrite the color table for a raster file which is in another mapset. However, this is not what actually happens. It is very useful for users to create their own color tables for raster files in other mapsets, but without overwriting other users' color tables for the same raster file. If mapset is the current mapset, then the color file for name will be overwritten by the new color table. But if mapset is not the current mapset, then the color table is actually written in the current mapset under the colr2 element as: colr2/mapset/name.
Parameters:
name 
mapset 
colors 
Returns:
int
The rules are written out using floating-point format, removing trailing zeros (possibly producing integers). The flag marking the colors as floating-point is not written.

Returns:
int

Definition at line 76 of file color_write.c.

References G__name_is_fully_qualified(), G__write_colors(), G_fopen_new(), G_mapset(), and G_remove().


Generated on Sun Apr 6 17:32:17 2008 for GRASS by  doxygen 1.5.5