15 static int Rast3d_maskMapExistsVar = 0;
19 static void dummy(
void)
24 static float RASTER3D_MASKNUMmaskValue;
27 #define RASTER3D_MASKNUM(map, Xmask, Ymask, Zmask, VALUEmask, TYPEmask) \
29 (RASTER3D_MASKNUMmaskValue = \
30 Rast3d_getMaskFloat(map, Xmask, Ymask, Zmask), \
31 ((Rast3d_is_null_value_num(&RASTER3D_MASKNUMmaskValue, FCELL_TYPE)) \
32 ? Rast3d_set_null_value(VALUEmask, 1, TYPEmask) \
40 if (!Rast3d_maskMapExistsVar)
43 Rast3d_maskMapExistsVar = 0;
79 if (Rast3d_maskMapExistsVar)
84 if (!Rast3d_maskMapExistsVar)
89 maskOpenOldCacheDefault)) ==
NULL) {
103 static float Rast3d_getMaskFloat(
RASTER3D_Map *map,
int x,
int y,
int z)
105 double north, east, top;
111 east = ((double)
x + 0.5) / (double)map->
window.
cols *
141 if (Rast3d_maskMapExistsVar)
148 tmp = maskOpenOldCacheDefault;
149 maskOpenOldCacheDefault = cache;
157 maskOpenOldCacheDefault = tmp;
177 if (!Rast3d_maskMapExistsVar)
180 RASTER3D_MASKNUMmaskValue = Rast3d_getMaskFloat(map,
x, y, z);
204 if (!Rast3d_maskMapExistsVar)
225 if (!Rast3d_maskMapExistsVar)
246 if (!Rast3d_maskMapExistsVar)
272 int nofNum, rows, cols, depths, xRedundant, yRedundant, zRedundant;
273 int x, y, z, xLength, yLength, dx, dy, dz, length;
275 if (!Rast3d_maskMapExistsVar)
279 &cols, &depths, &xRedundant,
280 &yRedundant, &zRedundant);
293 xRedundant = yRedundant = 0;
300 xLength = xRedundant * length;
301 yLength = map->
tileX * yRedundant * length;
303 for (dz = z; dz < depths; dz++) {
304 for (dy = y; dy < rows; dy++) {
305 for (dx =
x; dx < cols; dx++) {
307 tile = (
char *)tile + length;
310 tile = (
char *)tile + xLength;
312 tile = (
char *)tile + yLength;
402 return Rast3d_maskMapExistsVar;
const char * G_find_file_misc(const char *, const char *, char *, const char *)
Searches for a misc file from the mapset search list or in a specified mapset.
const char * G_mapset(void)
Get current mapset name.
void * Rast3d_open_cell_old(const char *, const char *, RASTER3D_Region *, int, int)
Opens existing g3d-file name in mapset. Tiles are stored in memory with type which must be any of FCE...
void Rast3d_get_region_value(RASTER3D_Map *, double, double, double, void *, int)
Returns in value the value of the map which corresponds to region coordinates (north,...
void Rast3d_get_tile_dimensions_map(RASTER3D_Map *, int *, int *, int *)
Returns the tile dimensions used for map.
void Rast3d_tile_index_origin(RASTER3D_Map *, int, int *, int *, int *)
Computes the cell-coordinates (x, y, z) which correspond to the origin of the tile with tileIndex.
void Rast3d_get_region_struct_map(RASTER3D_Map *, RASTER3D_Region *)
Returns in region the region of map.
int Rast3d_is_null_value_num(const void *, int)
int Rast3d_compute_clipped_tile_dimensions(RASTER3D_Map *, int, int *, int *, int *, int *, int *, int *)
Computes the dimensions of the tile when clipped to fit the region of map. The clipped dimensions are...
void Rast3d_error(const char *,...) __attribute__((format(printf
int Rast3d_close(RASTER3D_Map *)
Close 3D raster map files.
void Rast3d_set_window_map(RASTER3D_Map *, RASTER3D_Region *)
Sets the window for map to window. Can be used multiple times for the same map.
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 r...
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...
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).
#define RASTER3D_MASKNUM(map, Xmask, Ymask, Zmask, VALUEmask, TYPEmask)
int Rast3d_mask_map_exists(void)
Returns 1 if the 3d mask is loaded.
int Rast3d_mask_open_old(void)
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.
int Rast3d_mask_file_exists(void)
Returns 1 if the 3d mask file exists.
const char * Rast3d_mask_file(void)
Returns the name of the 3d mask file.
int Rast3d_mask_close(void)
int Rast3d_mask_is_on(RASTER3D_Map *map)
Returns 1 if the mask for map is turned on. Returns 0 otherwise.
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...
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).
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-va...
int Rast3d_mask_is_off(RASTER3D_Map *map)
Returns 1 if the mask for map is turned off. Returns 0 otherwise.
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....
#define RASTER3D_DIRECTORY
#define RASTER3D_DEFAULT_WINDOW
#define RASTER3D_USE_CACHE_DEFAULT
#define RASTER3D_MASK_MAP
#define RASTER3D_CELL_ELEMENT