GRASS GIS 8 Programmer's Manual
8.5.0dev(2024)-36359e2344
|
Raster Library - Quantization rules (input / output) More...
Go to the source code of this file.
Macros | |
#define | QUANT_FILE_NAME "f_quant" |
Functions | |
int | Rast__quant_import (const char *name, const char *mapset, struct Quant *quant) |
Reads quantization rules (internal use only) More... | |
int | Rast__quant_export (const char *name, const char *mapset, const struct Quant *quant) |
Writes the quantization rules (internal use only) More... | |
Raster Library - Quantization rules (input / output)
(C) 1999-2010 by the GRASS Development Team
This program is free software under the GNU General Public License (>=v2). Read the file COPYING that comes with GRASS for details.
Definition in file quant_io.c.
#define QUANT_FILE_NAME "f_quant" |
Definition at line 24 of file quant_io.c.
int Rast__quant_export | ( | const char * | name, |
const char * | mapset, | ||
const struct Quant * | quant | ||
) |
Writes the quantization rules (internal use only)
Writes the quantization rules stored in quant for name . If the mapset is the same as the current mapset, the quant file is created in 'cell_misc/name' directory, otherwise it is created in 'quant2/mapset' directory, much like writing colors for map in another mapset. The rules are written in decreasing order of priority (i.e. rules added earlier are written later).
Note: if no rules are defined an empty file is created.
name | map name |
mapset | mapset name |
quant | pointer to Quant structure |
Definition at line 270 of file quant_io.c.
References G__make_mapset_element_misc(), G_fopen_new(), G_fopen_new_misc(), G_make_mapset_object_group(), G_mapset(), G_name_is_fully_qualified(), G_remove(), G_remove_misc(), GMAPSET_MAX, GNAME_MAX, name, and QUANT_FILE_NAME.
Referenced by Rast_write_quant().
int Rast__quant_import | ( | const char * | name, |
const char * | mapset, | ||
struct Quant * | quant | ||
) |
Reads quantization rules (internal use only)
Reads quantization rules for raster map name in mapset and stores them in the quantization structure "quant". If the map is in another mapset, first checks for quant2 table for this map in current mapset.
Note: in the case of negative return value, the result of using the quantization structure is not defined. in case of return value 0, calls to Rast_quant_perform_d() and Rast_quant_perform_f() return NO_DATA (see description of Rast_quant_perform_d() for more details). in case of return values 2 and 3, the explicit rule for quant is set: floating range is mapped to integer range.
Note: use Rast_quant_init() to allocate and initialize the quantization staructure quant before the first usage of G_quant_import().
Note: this function uses Rast_quant_free () to clear all previously stored rules in quant.
name | map name | |
mapset | mapset name | |
[out] | quant | pointer to Quant structure |
Definition at line 95 of file quant_io.c.
References _, CELL_TYPE, G_fopen_old(), G_fully_qualified_name(), G_mapset(), G_name_is_fully_qualified(), G_warning(), GMAPSET_MAX, GNAME_MAX, name, Rast_map_type(), and Rast_quant_free().
Referenced by Rast_read_quant().