raster.c File Reference

#include "gis.h"

Include dependency graph for raster.c:

Go to the source code of this file.

Functions

void * G_incr_void_ptr (void *ptr, int size)
 Advances void pointer by n bytes. returns new pointer value. Usefull in raster row processing loops, substitutes.
int G_raster_cmp (void *v1, void *v2, RASTER_MAP_TYPE data_type)
 Compares raster vlues p and q. Returns 1 if p > q or only q is null value -1 if p < q or only p is null value 0 if p == q or p==q==null value.
int G_raster_cpy (void *v1, void *v2, int n, RASTER_MAP_TYPE data_type)
 Copies raster values q into p. If q is null value, sets q to null value.
int G_set_raster_value_c (void *rast, CELL cval, RASTER_MAP_TYPE data_type)
 If G_is_c_null_value(val) is true, sets p to null value. Converts CELL val to data_type (type of p) and stores result in p. Used for assigning CELL values to raster cells of any type.
int G_set_raster_value_f (void *rast, FCELL fval, RASTER_MAP_TYPE data_type)
 If G_is_f_null_value(val) is true, sets p to null value. Converts FCELL val to data_type (type of p) and stores result in p. Used for assigning FCELL values to raster cells of any type.
int G_set_raster_value_d (void *rast, DCELL dval, RASTER_MAP_TYPE data_type)
 If G_is_d_null_value(val) is true, sets p to null value. Converts DCELL val to data_type (type of p) and stores result in p. Used for assigning DCELL values to raster cells of any type.
CELL G_get_raster_value_c (void *rast, RASTER_MAP_TYPE data_type)
 Retrieves the value of type data_type from pointer p, converts it to CELL type and returns the result. If null value is stored in p, returns CELL null value. Used for retreiving CELL values from raster cells of any type. NOTE: when data_type != CELL_TYPE, no quantization is used, only type conversion.
FCELL G_get_raster_value_f (void *rast, RASTER_MAP_TYPE data_type)
 Retrieves the value of type data_type from pointer p, converts it to FCELL type and returns the result. If null value is stored in p, returns FCELL null value. Used for retreiving FCELL values from raster cells of any type.
DCELL G_get_raster_value_d (void *rast, RASTER_MAP_TYPE data_type)
 Retrieves the value of type data_type from pointer p, converts it to DCELL type and returns the result. If null value is stored in p, returns DCELL null value. Used for retreiving DCELL values from raster cells of any type.


Function Documentation

CELL G_get_raster_value_c ( void *  rast,
RASTER_MAP_TYPE  data_type 
)

Retrieves the value of type data_type from pointer p, converts it to CELL type and returns the result. If null value is stored in p, returns CELL null value. Used for retreiving CELL values from raster cells of any type. NOTE: when data_type != CELL_TYPE, no quantization is used, only type conversion.

Parameters:
p 
data_type 
Returns:
CELL

Definition at line 229 of file raster.c.

References G_is_null_value(), and G_set_c_null_value().

DCELL G_get_raster_value_d ( void *  rast,
RASTER_MAP_TYPE  data_type 
)

Retrieves the value of type data_type from pointer p, converts it to DCELL type and returns the result. If null value is stored in p, returns DCELL null value. Used for retreiving DCELL values from raster cells of any type.

Parameters:
p 
data_type 
Returns:
DCELL

Definition at line 297 of file raster.c.

References G_is_null_value(), and G_set_d_null_value().

Referenced by G__lookup_colors(), G_get_raster_cat(), G_mark_raster_cats(), and G_set_raster_cat().

FCELL G_get_raster_value_f ( void *  rast,
RASTER_MAP_TYPE  data_type 
)

Retrieves the value of type data_type from pointer p, converts it to FCELL type and returns the result. If null value is stored in p, returns FCELL null value. Used for retreiving FCELL values from raster cells of any type.

Parameters:
p 
data_type 
Returns:
FCELL

Definition at line 263 of file raster.c.

References G_is_null_value(), and G_set_f_null_value().

void* G_incr_void_ptr ( void *  ptr,
int  size 
)

Advances void pointer by n bytes. returns new pointer value. Usefull in raster row processing loops, substitutes.

  CELL *cell; 
  cell += n;
Now
  rast = G_incr_void_ptr(rast, G_raster_size(data_type))
(where rast is void* and data_type is RASTER_MAP_TYPE can be used instead of rast++.) very usefull to generalize the row processing - loop (i.e. void * buf_ptr += G_raster_size(data_type)

Parameters:
ptr 
size 
Returns:
void *

Definition at line 27 of file raster.c.

Referenced by G__lookup_colors(), G_get_raster_row_colors(), G_mark_raster_cats(), and G_row_update_fp_range().

int G_raster_cmp ( void *  v1,
void *  v2,
RASTER_MAP_TYPE  data_type 
)

Compares raster vlues p and q. Returns 1 if p > q or only q is null value -1 if p < q or only p is null value 0 if p == q or p==q==null value.

Parameters:
p 
q 
data_type 
Returns:
int

Definition at line 50 of file raster.c.

References G_is_null_value().

Referenced by G__lookup_colors().

int G_raster_cpy ( void *  v1,
void *  v2,
int  n,
RASTER_MAP_TYPE  data_type 
)

Copies raster values q into p. If q is null value, sets q to null value.

Parameters:
p 
q 
n 
data_type 
Returns:
int

Definition at line 97 of file raster.c.

References G_copy(), and G_raster_size().

int G_set_raster_value_c ( void *  rast,
CELL  cval,
RASTER_MAP_TYPE  data_type 
)

If G_is_c_null_value(val) is true, sets p to null value. Converts CELL val to data_type (type of p) and stores result in p. Used for assigning CELL values to raster cells of any type.

Parameters:
p 
val 
data_type 
Returns:
int

Definition at line 120 of file raster.c.

References G_is_c_null_value(), and G_set_null_value().

int G_set_raster_value_d ( void *  rast,
DCELL  dval,
RASTER_MAP_TYPE  data_type 
)

If G_is_d_null_value(val) is true, sets p to null value. Converts DCELL val to data_type (type of p) and stores result in p. Used for assigning DCELL values to raster cells of any type.

Parameters:
p 
val 
data_type 
Returns:
int

Definition at line 192 of file raster.c.

References G_is_d_null_value(), and G_set_null_value().

Referenced by G_get_ith_c_raster_cat(), G_get_ith_f_raster_cat(), G_get_ith_raster_cat(), and G_get_next_marked_raster_cat().

int G_set_raster_value_f ( void *  rast,
FCELL  fval,
RASTER_MAP_TYPE  data_type 
)

If G_is_f_null_value(val) is true, sets p to null value. Converts FCELL val to data_type (type of p) and stores result in p. Used for assigning FCELL values to raster cells of any type.

Parameters:
p 
val 
data_type 
Returns:
int

Definition at line 156 of file raster.c.

References G_is_f_null_value(), and G_set_null_value().


Generated on Mon Jan 1 19:49:39 2007 for GRASS by  doxygen 1.5.1