raster.c File Reference

#include <grass/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)
 Advance void pointer.
int G_raster_cmp (void *v1, void *v2, RASTER_MAP_TYPE data_type)
 Compares raster values p and q.
int G_raster_cpy (void *v1, void *v2, int n, RASTER_MAP_TYPE data_type)
 Copies raster values q into p.
int G_set_raster_value_c (void *rast, CELL cval, RASTER_MAP_TYPE data_type)
 Places a CELL raster value.
int G_set_raster_value_f (void *rast, FCELL fval, RASTER_MAP_TYPE data_type)
 Places a FCELL raster value.
int G_set_raster_value_d (void *rast, DCELL dval, RASTER_MAP_TYPE data_type)
 Places a DCELL raster value.
CELL G_get_raster_value_c (void *rast, RASTER_MAP_TYPE data_type)
 Retrieves the value of type data_type from pointer p.
FCELL G_get_raster_value_f (void *rast, RASTER_MAP_TYPE data_type)
 Retrieves the value of type data_type from pointer p.
DCELL G_get_raster_value_d (void *rast, RASTER_MAP_TYPE data_type)
 Retrieves the value of type data_type from pointer p,.


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.

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 237 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,.

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 307 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.

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 272 of file raster.c.

References G_is_null_value(), and G_set_f_null_value().

void* G_incr_void_ptr ( void *  ptr,
int  size 
)

Advance void pointer.

Advances void pointer by n bytes Returns new pointer value.

Useful 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 useful to generalize the row processing - loop i.e. void * buf_ptr += G_raster_size(data_type)

Parameters:
ptr 
size 
Returns:
void *

Definition at line 32 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 values 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 56 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 102 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 
)

Places a CELL raster value.

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 125 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 
)

Places a DCELL raster value.

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 197 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 
)

Places a FCELL raster value.

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 161 of file raster.c.

References G_is_f_null_value(), and G_set_null_value().


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