#include <unistd.h>#include <rpc/types.h>#include <rpc/xdr.h>#include "G.h"#include "glocale.h"Include dependency graph for range.c:

Go to the source code of this file.
Defines | |
| #define | DEFAULT_CELL_MIN 1 |
| #define | DEFAULT_CELL_MAX 255 |
Functions | |
| int | G__remove_fp_range (char *name) |
| int | G_construct_default_range (struct Range *range) |
| Sets the integer range r to [1,255]. | |
| int | G_read_fp_range (char *name, 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(). | |
| int | G_read_range (char *name, char *mapset, struct Range *range) |
| read raster range | |
| int | G_write_range (char *name, struct Range *range) |
| write raster range file | |
| int | G_write_fp_range (char *name, 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. | |
| int | G_update_range (CELL cat, struct Range *range) |
| update range structure | |
| int | G_update_fp_range (DCELL val, struct FPRange *range) |
| int | G_row_update_range (CELL *cell, int n, struct Range *range) |
| update range structure | |
| int | G__row_update_range (CELL *cell, int n, struct Range *range, int ignore_zeros) |
| int | G_row_update_fp_range (void *rast, int n, struct FPRange *range, RASTER_MAP_TYPE data_type) |
| int | G_init_range (struct Range *range) |
| initialize range structure | |
| int | G_get_range_min_max (struct Range *range, CELL *min, CELL *max) |
| get range min and max | |
| 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. | |
| int | G_get_fp_range_min_max (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. | |
| #define DEFAULT_CELL_MAX 255 |
| #define DEFAULT_CELL_MIN 1 |
| int G__remove_fp_range | ( | char * | name | ) |
| int G__row_update_range | ( | CELL * | cell, | |
| int | n, | |||
| struct Range * | range, | |||
| int | ignore_zeros | |||
| ) |
Definition at line 537 of file range.c.
References cat, and G_is_c_null_value().
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 113 of file range.c.
References DEFAULT_CELL_MAX, DEFAULT_CELL_MIN, and G_update_range().
| int G_get_fp_range_min_max | ( | 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 726 of file range.c.
References G_is_d_null_value(), and G_set_d_null_value().
Referenced by G_make_colors(), G_quantize_fp_map(), G_read_colors(), and G_read_range().
| int G_get_range_min_max | ( | struct Range * | range, | |
| CELL * | min, | |||
| CELL * | max | |||
| ) |
get range min and max
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.
Definition at line 663 of file range.c.
References G_is_c_null_value(), and G_set_c_null_value().
Referenced by G_number_of_cats(), and G_read_colors().
| 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 701 of file range.c.
References G_set_d_null_value().
Referenced by G_read_fp_range().
| int G_init_range | ( | struct Range * | range | ) |
initialize range structure
Must set a flag in the range structure that indicates that no min/max have been defined - probably a "first" boolean flag.
Definition at line 628 of file range.c.
References G_set_c_null_value().
Referenced by G_read_range().
| int G_read_fp_range | ( | char * | name, | |
| 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 140 of file range.c.
References G_find_file2(), G_init_fp_range(), G_open_old(), G_raster_map_type(), G_read_range(), G_update_fp_range(), G_warning(), MAXFILES, and XDR_DOUBLE_NBYTES.
Referenced by G_make_colors(), G_quantize_fp_map(), G_read_colors(), and G_read_range().
| int G_read_range | ( | char * | name, | |
| char * | mapset, | |||
| struct Range * | range | |||
| ) |
read raster range
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().
Definition at line 246 of file range.c.
References count, G_find_file2(), G_fopen_old(), 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(), and NULL.
Referenced by G_number_of_cats(), G_read_colors(), and G_read_fp_range().
| int G_row_update_fp_range | ( | void * | rast, | |
| int | n, | |||
| struct FPRange * | range, | |||
| RASTER_MAP_TYPE | data_type | |||
| ) |
Definition at line 567 of file range.c.
References G_incr_void_ptr(), G_is_null_value(), and G_raster_size().
| int G_row_update_range | ( | CELL * | cell, | |
| int | n, | |||
| struct Range * | range | |||
| ) |
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 528 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 493 of file range.c.
References G_is_d_null_value().
Referenced by G_read_fp_range().
| int G_update_range | ( | CELL | cat, | |
| struct Range * | range | |||
| ) |
update range structure
NULL-values must be detected and ignored.
Definition at line 471 of file range.c.
References G_is_c_null_value().
Referenced by G_construct_default_range(), and G_read_range().
| int G_write_fp_range | ( | char * | name, | |
| 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 411 of file range.c.
References G_mapset(), G_open_new(), G_remove(), G_warning(), and XDR_DOUBLE_NBYTES.
| int G_write_range | ( | char * | name, | |
| struct Range * | range | |||
| ) |
write raster range file
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.
Definition at line 362 of file range.c.
References fprintf(), G_fopen_new(), G_mapset(), G_raster_map_type(), G_remove(), and G_warning().
1.4.7