|
GRASS Programmer's Manual
6.5.svn(2014)-r66266
|
#include <unistd.h>#include <rpc/types.h>#include <rpc/xdr.h>#include "G.h"#include <grass/glocale.h>
Go to the source code of this file.
Macros | |
| #define | DEFAULT_CELL_MIN 1 |
| #define | DEFAULT_CELL_MAX 255 |
Functions | |
| int | G__remove_fp_range (const char *name) |
| int | G_construct_default_range (struct Range *range) |
| Sets the integer range r to [1,255]. More... | |
| int | G_read_fp_range (const char *name, const char *mapset, struct FPRange *drange) |
Read the floating point range file f_range. This file is written in binary using XDR format. If there is no defined min/max in r, an empty f_rangefile is created. An empty range file indicates that the min, max are undefined. This is a valid case, and the result should be an initialized range struct with no defined min/max. If the range file is missing and the map is a floating-point map, this function will create a default range by calling G_construct_default_range(). More... | |
| int | G_read_range (const char *name, const char *mapset, struct Range *range) |
| read raster range More... | |
| int | G_write_range (const char *name, const struct Range *range) |
| write raster range file More... | |
| int | G_write_fp_range (const char *name, const struct FPRange *range) |
Write the floating point range file f_range. This file is written in binary using XDR format. If there is no defined min/max in r, an empty f_rangefile is created. More... | |
| int | G_update_range (CELL cat, struct Range *range) |
| update range structure More... | |
| int | G_update_fp_range (DCELL val, struct FPRange *range) |
| int | G_row_update_range (const CELL *cell, int n, struct Range *range) |
| update range structure More... | |
| int | G__row_update_range (const CELL *cell, int n, struct Range *range, int ignore_zeros) |
| int | G_row_update_fp_range (const void *rast, int n, struct FPRange *range, RASTER_MAP_TYPE data_type) |
| int | G_init_range (struct Range *range) |
| initialize range structure More... | |
| int | G_get_range_min_max (const struct Range *range, CELL *min, CELL *max) |
| get range min and max More... | |
| int | G_init_fp_range (struct FPRange *range) |
Must set a flag in the range structure that indicates that no min/max have been defined - probably a "first" boolean flag. More... | |
| int | G_get_fp_range_min_max (const struct FPRange *range, DCELL *min, DCELL *max) |
| Extract the min/max from the range structure r. If the range structure has no defined min/max (first!=0) there will not be a valid range. In this case the min and max returned must be the NULL-value. More... | |
| #define DEFAULT_CELL_MAX 255 |
Definition at line 86 of file range.c.
Referenced by G_construct_default_range().
| #define DEFAULT_CELL_MIN 1 |
Definition at line 85 of file range.c.
Referenced by G_construct_default_range().
| int G__remove_fp_range | ( | const char * | name | ) |
Definition at line 95 of file range.c.
References G_remove_misc().
Definition at line 498 of file range.c.
References cat, G_is_c_null_value(), and min.
Referenced by G_row_update_range().
| int G_construct_default_range | ( | struct Range * | range | ) |
Sets the integer range r to [1,255].
| r |
Definition at line 112 of file range.c.
References DEFAULT_CELL_MAX, DEFAULT_CELL_MIN, and G_update_range().
| int G_get_fp_range_min_max | ( | const struct FPRange * | range, |
| DCELL * | min, | ||
| DCELL * | max | ||
| ) |
Extract the min/max from the range structure r. If the range structure has no defined min/max (first!=0) there will not be a valid range. In this case the min and max returned must be the NULL-value.
| r | |
| min | |
| max |
Definition at line 667 of file range.c.
References G_is_d_null_value(), and G_set_d_null_value().
Referenced by E_edit_fp_cats(), G3d_range_min_max(), G_ask_colors(), G_quantize_fp_map(), G_read_colors(), G_read_range(), gsd_put_legend(), and switch().
| int G_get_range_min_max | ( | const struct Range * | range, |
| CELL * | min, | ||
| CELL * | max | ||
| ) |
get range min and max
The mininum and maximum CELL values are extracted from the range structure.
If the range structure has no defined min/max (first!=0) there will not be a valid range. In this case the min and max returned must be the NULL-value.
| range | |
| min | |
| max |
Definition at line 608 of file range.c.
References G_is_c_null_value(), and G_set_c_null_value().
Referenced by G_number_of_cats(), G_read_colors(), Gs_numtype(), and gsd_put_legend().
| int G_init_fp_range | ( | struct FPRange * | range | ) |
Must set a flag in the range structure that indicates that no min/max have been defined - probably a "first" boolean flag.
| r |
Definition at line 642 of file range.c.
References G_set_d_null_value().
| int G_init_range | ( | struct Range * | range | ) |
initialize range structure
Initializes the range structure for updates by G_update_range and G_row_update_range.
Must set a flag in the range structure that indicates that no min/max have been defined - probably a "first" boolean flag.
| range |
Definition at line 579 of file range.c.
References G_set_c_null_value().
Referenced by G_read_range().
| int G_read_fp_range | ( | const char * | name, |
| const char * | mapset, | ||
| struct FPRange * | drange | ||
| ) |
Read the floating point range file f_range. This file is written in binary using XDR format. If there is no defined min/max in r, an empty f_rangefile is created. An empty range file indicates that the min, max are undefined. This is a valid case, and the result should be an initialized range struct with no defined min/max. If the range file is missing and the map is a floating-point map, this function will create a default range by calling G_construct_default_range().
| r | |
| name | |
| mapset |
Definition at line 139 of file range.c.
References buf, dcell1, dcell2, fd, G_find_file2_misc(), G_init_fp_range(), G_open_old_misc(), G_raster_map_type(), G_read_range(), G_update_fp_range(), G_warning(), sprintf(), xdr_buf, XDR_DOUBLE_NBYTES, and xdr_str.
Referenced by E_edit_fp_cats(), G_ask_colors(), G_quantize_fp_map(), G_read_colors(), G_read_range(), and gsd_put_legend().
| int G_read_range | ( | const char * | name, |
| const char * | mapset, | ||
| struct Range * | range | ||
| ) |
read raster range
This routine reads the range information for the raster map name in mapset into the range structure. A diagnostic message is printed and -1 is returned if there is an error reading the range file. Otherwise, 0 is returned.
Old range file (those with 4 numbers) should treat zeros in this file as NULL-values. New range files (those with just 2 numbers) should treat these numbers as real data (zeros are real data in this case). An empty range file indicates that the min, max are undefined. This is a valid case, and the result should be an initialized range struct with no defined min/max. If the range file is missing and the map is a floating-point map, this function will create a default range by calling G_construct_default_range().
| name | |
| mapset | |
| range |
Definition at line 226 of file range.c.
References buf, count, dmax, dmin, fclose(), fd, G_find_file2_misc(), G_fopen_old_misc(), G_get_fp_range_min_max(), G_init_range(), G_quant_get_limits(), G_quant_is_round(), G_quant_is_truncate(), G_raster_map_type(), G_read_fp_range(), G_read_quant(), G_update_range(), G_warning(), n, NULL, and sprintf().
Referenced by G_number_of_cats(), G_read_colors(), G_read_fp_range(), Gs_numtype(), and gsd_put_legend().
| int G_row_update_fp_range | ( | const void * | rast, |
| int | n, | ||
| struct FPRange * | range, | ||
| RASTER_MAP_TYPE | data_type | ||
| ) |
Definition at line 524 of file range.c.
References G_incr_void_ptr(), G_is_null_value(), G_raster_size(), and min.
Referenced by G3d_range_updateFromTile().
update range structure
This routine updates the range data just like G_update_range, but for n values from the cell array.
| cell | |
| n | |
| range |
Definition at line 489 of file range.c.
References G__row_update_range().
Referenced by G_put_map_row_random().
| int G_update_fp_range | ( | DCELL | val, |
| struct FPRange * | range | ||
| ) |
Definition at line 456 of file range.c.
References G_is_d_null_value(), and min.
Referenced by G_read_fp_range(), and if().
| int G_update_range | ( | CELL | cat, |
| struct Range * | range | ||
| ) |
update range structure
Compares the cat value with the minimum and maximum values in the range structure, modifying the range if cat extends the range.
NULL-values must be detected and ignored.
| cat | |
| range |
Definition at line 436 of file range.c.
References cat, G_is_c_null_value(), and min.
Referenced by G_construct_default_range(), and G_read_range().
| int G_write_fp_range | ( | const char * | name, |
| const struct FPRange * | range | ||
| ) |
Write the floating point range file f_range. This file is written in binary using XDR format. If there is no defined min/max in r, an empty f_rangefile is created.
| r |
Definition at line 380 of file range.c.
References buf, fd, G_mapset(), G_open_new(), G_remove(), G_warning(), sprintf(), xdr_buf, XDR_DOUBLE_NBYTES, and xdr_str.
| int G_write_range | ( | const char * | name, |
| const struct Range * | range | ||
| ) |
write raster range file
This routine writes the range information for the raster map name in the current mapset from the range structure. A diagnostic message is printed and -1 is returned if there is an error writing the range file. Otherwise, 0 is returned.
This routine only writes 2 numbers (min,max) to the range file, instead of the 4 (pmin,pmax,nmin,nmax) previously written. If there is no defined min,max, an empty file is written.
| name | |
| range |
Definition at line 334 of file range.c.
References buf, fclose(), fd, G_fopen_new_misc(), G_mapset(), G_raster_map_type(), G_remove_misc(), G_warning(), and sprintf().