GRASS GIS 8 Programmer's Manual  8.5.0dev(2024)-b4187339ee
mask.c File Reference
#include <stdio.h>
#include <grass/gis.h>
#include "raster3d_intern.h"
Include dependency graph for mask.c:

Go to the source code of this file.

Macros

#define RASTER3D_MASKNUM(map, Xmask, Ymask, Zmask, VALUEmask, TYPEmask)
 

Functions

int Rast3d_mask_close (void)
 
int Rast3d_mask_file_exists (void)
 Returns 1 if the 3d mask file exists. More...
 
int Rast3d_mask_open_old (void)
 
int Rast3d_mask_reopen (int cache)
 This function should be used to adjust the cache size used for the 3d-mask. First the open 3d-mask is closed and then opened again with a cache size as specified with cache. More...
 
int Rast3d_is_masked (RASTER3D_Map *map, int x, int y, int z)
 Returns 1 if the cell with cell-coordinates (x, y, z) is masked out. Returns 0 otherwise. More...
 
void Rast3d_mask_num (RASTER3D_Map *map, int x, int y, int z, void *value, int type)
 Replaces the value stored in value with the NULL-value if Rast3d_is_masked (x, y, z) returns 1. Does nothing otherwise. value is assumed to be oftype. More...
 
void Rast3d_mask_float (RASTER3D_Map *map, int x, int y, int z, float *value)
 Same as Rast3d_mask_num (x, y, z, value, FCELL_TYPE). More...
 
void Rast3d_mask_double (RASTER3D_Map *map, int x, int y, int z, double *value)
 Same as Rast3d_mask_num (x, y, z, value, DCELL_TYPE). More...
 
void Rast3d_mask_tile (RASTER3D_Map *map, int tileIndex, void *tile, int type)
 Replaces the values stored in tile (with tileIndex) for which Rast3d_is_masked returns 1 with NULL-values. Does not change the remaining values. The values are assumed to be of type. Whether replacement is performed or not only depends on location of the cells of the tile and not on the status of the mask for map (i.e. turned on or off). More...
 
void Rast3d_mask_on (RASTER3D_Map *map)
 Turns on the mask for map. Do not invoke this function after the first tile has been read since the result might be inconsistent cell-values. More...
 
void Rast3d_mask_off (RASTER3D_Map *map)
 Turns off the mask for map. This is the default. Do not invoke this function after the first tile has been read since the result might be inconsistent cell-values. More...
 
int Rast3d_mask_is_on (RASTER3D_Map *map)
 Returns 1 if the mask for map is turned on. Returns 0 otherwise. More...
 
int Rast3d_mask_is_off (RASTER3D_Map *map)
 Returns 1 if the mask for map is turned off. Returns 0 otherwise. More...
 
const char * Rast3d_mask_file (void)
 Returns the name of the 3d mask file. More...
 
int Rast3d_mask_map_exists (void)
 Returns 1 if the 3d mask is loaded. More...
 

Macro Definition Documentation

◆ RASTER3D_MASKNUM

#define RASTER3D_MASKNUM (   map,
  Xmask,
  Ymask,
  Zmask,
  VALUEmask,
  TYPEmask 
)
Value:
\
(RASTER3D_MASKNUMmaskValue = \
Rast3d_getMaskFloat(map, Xmask, Ymask, Zmask), \
((Rast3d_is_null_value_num(&RASTER3D_MASKNUMmaskValue, FCELL_TYPE)) \
? Rast3d_set_null_value(VALUEmask, 1, TYPEmask) \
: dummy()))
void Rast3d_set_null_value(void *, int, int)
Fills the vector pointed to by c with nofElts NULL-values of type.
Definition: null.c:34
int Rast3d_is_null_value_num(const void *, int)
Definition: null.c:12
#define FCELL_TYPE
Definition: raster.h:12

Definition at line 27 of file mask.c.

Function Documentation

◆ Rast3d_is_masked()

int Rast3d_is_masked ( RASTER3D_Map map,
int  x,
int  y,
int  z 
)

Returns 1 if the cell with cell-coordinates (x, y, z) is masked out. Returns 0 otherwise.

Parameters
x
y
z
Returns
int

Definition at line 175 of file mask.c.

◆ Rast3d_mask_close()

int Rast3d_mask_close ( void  )

Definition at line 37 of file mask.c.

◆ Rast3d_mask_double()

void Rast3d_mask_double ( RASTER3D_Map map,
int  x,
int  y,
int  z,
double *  value 
)

Same as Rast3d_mask_num (x, y, z, value, DCELL_TYPE).

Parameters
x
y
z
value
Returns
void

Definition at line 244 of file mask.c.

◆ Rast3d_mask_file()

const char* Rast3d_mask_file ( void  )

Returns the name of the 3d mask file.

Returns
char *

Definition at line 387 of file mask.c.

References RASTER3D_MASK_MAP.

◆ Rast3d_mask_file_exists()

int Rast3d_mask_file_exists ( void  )

Returns 1 if the 3d mask file exists.

Returns
int

Definition at line 64 of file mask.c.

References G_find_file_misc(), G_mapset(), NULL, RASTER3D_CELL_ELEMENT, RASTER3D_DIRECTORY, and RASTER3D_MASK_MAP.

◆ Rast3d_mask_float()

void Rast3d_mask_float ( RASTER3D_Map map,
int  x,
int  y,
int  z,
float *  value 
)

Same as Rast3d_mask_num (x, y, z, value, FCELL_TYPE).

Parameters
x
y
z
value
Returns
void

Definition at line 223 of file mask.c.

◆ Rast3d_mask_is_off()

int Rast3d_mask_is_off ( RASTER3D_Map map)

Returns 1 if the mask for map is turned off. Returns 0 otherwise.

Parameters
map
Returns
int

Definition at line 374 of file mask.c.

References RASTER3D_Map::useMask.

◆ Rast3d_mask_is_on()

int Rast3d_mask_is_on ( RASTER3D_Map map)

Returns 1 if the mask for map is turned on. Returns 0 otherwise.

Parameters
map
Returns
int

Definition at line 360 of file mask.c.

References RASTER3D_Map::useMask.

◆ Rast3d_mask_map_exists()

int Rast3d_mask_map_exists ( void  )

Returns 1 if the 3d mask is loaded.

Returns
int

Definition at line 400 of file mask.c.

◆ Rast3d_mask_num()

void Rast3d_mask_num ( RASTER3D_Map map,
int  x,
int  y,
int  z,
void *  value,
int  type 
)

Replaces the value stored in value with the NULL-value if Rast3d_is_masked (x, y, z) returns 1. Does nothing otherwise. value is assumed to be oftype.

Parameters
x
y
z
value
type
Returns
void

Definition at line 201 of file mask.c.

◆ Rast3d_mask_off()

void Rast3d_mask_off ( RASTER3D_Map map)

Turns off the mask for map. This is the default. Do not invoke this function after the first tile has been read since the result might be inconsistent cell-values.

Parameters
map
Returns
void

Definition at line 345 of file mask.c.

References RASTER3D_Map::useMask.

Referenced by Rast3d_open_cell_old_no_header().

◆ Rast3d_mask_on()

void Rast3d_mask_on ( RASTER3D_Map map)

Turns on the mask for map. Do not invoke this function after the first tile has been read since the result might be inconsistent cell-values.

Parameters
map
Returns
void

Definition at line 329 of file mask.c.

References RASTER3D_Map::useMask.

◆ Rast3d_mask_open_old()

int Rast3d_mask_open_old ( void  )

Definition at line 74 of file mask.c.

Referenced by Rast3d_open_cell_old_no_header().

◆ Rast3d_mask_reopen()

int Rast3d_mask_reopen ( int  cache)

This function should be used to adjust the cache size used for the 3d-mask. First the open 3d-mask is closed and then opened again with a cache size as specified with cache.

Parameters
cache
Returns
1 ... if successful 0 ... otherwise.

Definition at line 137 of file mask.c.

◆ Rast3d_mask_tile()

void Rast3d_mask_tile ( RASTER3D_Map map,
int  tileIndex,
void *  tile,
int  type 
)

Replaces the values stored in tile (with tileIndex) for which Rast3d_is_masked returns 1 with NULL-values. Does not change the remaining values. The values are assumed to be of type. Whether replacement is performed or not only depends on location of the cells of the tile and not on the status of the mask for map (i.e. turned on or off).

Parameters
map
tileIndex
tile
type
Returns
void

Definition at line 270 of file mask.c.