GRASS Programmer's Manual  6.5.svn(2014)-r66266
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
g3dmask.c File Reference
#include <stdio.h>
#include <grass/gis.h>
#include "G3d_intern.h"
Include dependency graph for g3dmask.c:

Go to the source code of this file.

Macros

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

Functions

int G3d_maskClose ()
 
int G3d_maskFileExists ()
 Returns 1 if the 3d mask file exists. More...
 
int G3d_maskOpenOld ()
 
int G3d_maskReopen (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 G3d_isMasked (G3D_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 G3d_maskNum (G3D_Map *map, int x, int y, int z, void *value, int type)
 Replaces the value stored in value with the NULL-value if G3d_isMasked (x, y, z) returns 1. Does nothing otherwise. value is assumed to be oftype. More...
 
void G3d_maskFloat (G3D_Map *map, int x, int y, int z, float *value)
 Same as G3d_maskNum (x, y, z, value, FCELL_TYPE). More...
 
void G3d_maskDouble (G3D_Map *map, int x, int y, int z, double *value)
 Same as G3d_maskNum (x, y, z, value, DCELL_TYPE). More...
 
void G3d_maskTile (G3D_Map *map, int tileIndex, void *tile, int type)
 Replaces the values stored in tile (with tileIndex) for which G3d_isMasked 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 G3d_maskOn (G3D_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 G3d_maskOff (G3D_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 G3d_maskIsOn (G3D_Map *map)
 Returns 1 if the mask for map is turned on. Returns 0 otherwise. More...
 
int G3d_maskIsOff (G3D_Map *map)
 Returns 1 if the mask for map is turned off. Returns 0 otherwise. More...
 
const char * G3d_maskFile (void)
 Returns the name of the 3d mask file. More...
 
int G3d_maskMapExists (void)
 Returns 1 if the 3d mask is loaded. More...
 

Macro Definition Documentation

#define G3D_MASKNUM (   map,
  Xmask,
  Ymask,
  Zmask,
  VALUEmask,
  TYPEmask 
)
Value:
\
(G3D_MASKNUMmaskValue = G3d_getMaskFloat (map, Xmask, Ymask, Zmask), \
((G3d_isNullValueNum (&G3D_MASKNUMmaskValue, FCELL_TYPE)) ? \
G3d_setNullValue (VALUEmask, 1, TYPEmask) : dummy()))
void G3d_setNullValue(void *c, int nofElts, int type)
Fills the vector pointed to by c with nofElts NULL-values of type.
Definition: g3dnull.c:32
int G3d_isNullValueNum(const void *n, int type)
Definition: g3dnull.c:9

Definition at line 28 of file g3dmask.c.

Referenced by G3d_maskDouble(), G3d_maskFloat(), G3d_maskNum(), and G3d_maskTile().

Function Documentation

int G3d_isMasked ( G3D_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 176 of file g3dmask.c.

References G3d_isNullValueNum().

int G3d_maskClose ( )

Definition at line 36 of file g3dmask.c.

References G3d_closeCell(), and G3d_error().

Referenced by G3d_maskReopen().

void G3d_maskDouble ( G3D_Map *  map,
int  x,
int  y,
int  z,
double *  value 
)

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

Parameters
x
y
z
value
Returns
void

Definition at line 247 of file g3dmask.c.

References G3D_MASKNUM.

const char* G3d_maskFile ( void  )

Returns the name of the 3d mask file.

Returns
char *

Definition at line 397 of file g3dmask.c.

int G3d_maskFileExists ( )

Returns 1 if the 3d mask file exists.

Returns
int

Definition at line 64 of file g3dmask.c.

References buf, G_find_file(), G_mapset(), NULL, and sprintf().

Referenced by G3d_maskOpenOld(), N_read_rast3d_to_array_3d(), and N_write_array_3d_to_rast3d().

void G3d_maskFloat ( G3D_Map *  map,
int  x,
int  y,
int  z,
float *  value 
)

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

Parameters
x
y
z
value
Returns
void

Definition at line 225 of file g3dmask.c.

References G3D_MASKNUM.

int G3d_maskIsOff ( G3D_Map *  map)

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

Parameters
map
Returns
int

Definition at line 383 of file g3dmask.c.

Referenced by G3d_readTile(), N_read_rast3d_to_array_3d(), and N_write_array_3d_to_rast3d().

int G3d_maskIsOn ( G3D_Map *  map)

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

Parameters
map
Returns
int

Definition at line 368 of file g3dmask.c.

Referenced by N_read_rast3d_to_array_3d(), and N_write_array_3d_to_rast3d().

int G3d_maskMapExists ( void  )

Returns 1 if the 3d mask is loaded.

Returns
int

Definition at line 411 of file g3dmask.c.

void G3d_maskNum ( G3D_Map *  map,
int  x,
int  y,
int  z,
void *  value,
int  type 
)

Replaces the value stored in value with the NULL-value if G3d_isMasked (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 203 of file g3dmask.c.

References G3D_MASKNUM.

void G3d_maskOff ( G3D_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 352 of file g3dmask.c.

Referenced by G3d_openCellNew(), G3d_openCellOldNoHeader(), N_read_rast3d_to_array_3d(), and N_write_array_3d_to_rast3d().

void G3d_maskOn ( G3D_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 335 of file g3dmask.c.

Referenced by N_read_rast3d_to_array_3d(), and N_write_array_3d_to_rast3d().

int G3d_maskReopen ( 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 g3dmask.c.

References G3d_error(), G3d_maskClose(), and G3d_maskOpenOld().

void G3d_maskTile ( G3D_Map *  map,
int  tileIndex,
void *  tile,
int  type 
)

Replaces the values stored in tile (with tileIndex) for which G3d_isMasked 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 274 of file g3dmask.c.

References dialogs::cols, G3d_computeClippedTileDimensions(), G3d_getTileDimensionsMap(), G3d_length(), G3D_MASKNUM, G3d_tileIndexOrigin(), and y.

Referenced by G3d_readTile().