15 static int Rast3d_maskMapExistsVar = 0;
19 static void dummy(
void)
25 static float RASTER3D_MASKNUMmaskValue;
28 #define RASTER3D_MASKNUM(map,Xmask,Ymask,Zmask,VALUEmask,TYPEmask) \ 30 (RASTER3D_MASKNUMmaskValue = Rast3d_getMaskFloat (map, Xmask, Ymask, Zmask), \ 31 ((Rast3d_is_null_value_num (&RASTER3D_MASKNUMmaskValue, FCELL_TYPE)) ? \ 32 Rast3d_set_null_value (VALUEmask, 1, TYPEmask) : dummy())) 39 if (!Rast3d_maskMapExistsVar)
42 Rast3d_maskMapExistsVar = 0;
78 if (Rast3d_maskMapExistsVar)
83 if (!Rast3d_maskMapExistsVar)
88 maskOpenOldCacheDefault))
103 static float Rast3d_getMaskFloat(
RASTER3D_Map * map,
int x,
int y,
int z)
105 double north, east, top;
110 east = ((double)
x + 0.5) / (double)map->
window.
cols *
138 if (Rast3d_maskMapExistsVar)
145 tmp = maskOpenOldCacheDefault;
146 maskOpenOldCacheDefault = cache;
154 maskOpenOldCacheDefault = tmp;
175 if (!Rast3d_maskMapExistsVar)
178 RASTER3D_MASKNUMmaskValue = Rast3d_getMaskFloat(map, x, y, z);
202 if (!Rast3d_maskMapExistsVar)
224 if (!Rast3d_maskMapExistsVar)
246 if (!Rast3d_maskMapExistsVar)
273 int nofNum, rows, cols, depths, xRedundant, yRedundant, zRedundant;
274 int x, y, z, xLength, yLength, dx, dy, dz, length;
276 if (!Rast3d_maskMapExistsVar)
280 &rows, &cols, &depths,
281 &xRedundant, &yRedundant,
295 xRedundant = yRedundant = 0;
302 xLength = xRedundant * length;
303 yLength = map->
tileX * yRedundant * length;
305 for (dz = z; dz < depths; dz++) {
306 for (dy = y; dy < rows; dy++) {
307 for (dx = x; dx < cols; dx++) {
410 return Rast3d_maskMapExistsVar;
#define RASTER3D_USE_CACHE_DEFAULT
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...
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_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_struct_map(RASTER3D_Map *, RASTER3D_Region *)
Returns in region the region of map.
int Rast3d_mask_is_off(RASTER3D_Map *map)
Returns 1 if the mask for map is turned off. Returns 0 otherwise.
int Rast3d_mask_map_exists(void)
Returns 1 if the 3d mask is loaded.
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).
void Rast3d_get_tile_dimensions_map(RASTER3D_Map *, int *, int *, int *)
Returns the tile dimensions used for map.
#define RASTER3D_DEFAULT_WINDOW
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.
#define RASTER3D_MASKNUM(map, Xmask, Ymask, Zmask, VALUEmask, TYPEmask)
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...
void Rast3d_error(const char *,...) __attribute__((format(printf
#define RASTER3D_MASK_MAP
#define RASTER3D_CELL_ELEMENT
int Rast3d_mask_open_old(void)
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_value(RASTER3D_Map *, double, double, double, void *, int)
Returns in value the value of the map which corresponds to region coordinates (north, east, top).
int Rast3d_mask_is_on(RASTER3D_Map *map)
Returns 1 if the mask for map is turned on. Returns 0 otherwise.
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...
int Rast3d_mask_file_exists(void)
Returns 1 if the 3d mask file exists.
const char * G_find_file_misc(const char *, const char *, char *, const char *)
Searches for a file from the mapset search list or in a specified mapset.
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).
#define RASTER3D_DIRECTORY
const char * G_mapset(void)
Get current mapset name.
const char * Rast3d_mask_file(void)
Returns the name of the 3d mask file.
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...
int Rast3d_is_null_value_num(const void *, int)
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.
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...