12 static int Rast3d_tile2xdrTile(
RASTER3D_Map *map,
const void *tile,
int rows,
13 int cols,
int depths,
int xRedundant,
14 int yRedundant,
int zRedundant
UNUSED,
20 Rast3d_error(
"Rast3d_tile2xdrTile: error in Rast3d_init_copy_to_xdr");
26 Rast3d_error(
"Rast3d_tile2xdrTile: error in Rast3d_copy_to_xdr");
33 for (z = 0; z < depths; z++) {
34 for (y = 0; y < rows; y++) {
37 "Rast3d_tile2xdrTile: error in Rast3d_copy_to_xdr");
50 for (z = 0; z < depths; z++) {
53 "Rast3d_tile2xdrTile: error in Rast3d_copy_to_xdr");
62 Rast3d_error(
"Rast3d_tile2xdrTile: error in Rast3d_copy_to_xdr");
70 static int Rast3d_writeTileUncompressed(
RASTER3D_Map *map,
int nofNum)
74 Rast3d_error(
"Rast3d_writeTileUncompressed: can't write file.");
83 static int Rast3d_writeTileCompressed(
RASTER3D_Map *map,
int nofNum)
89 "Rast3d_fpcompress_write_xdr_nums");
128 int rows, cols, depths, xRedundant, yRedundant, zRedundant, nofNum;
131 if ((tileIndex > map->
nTiles) || (tileIndex < 0))
135 if (map->
index[tileIndex] != -1)
139 map->
index[tileIndex] = lseek(map->
data_fd, (
long)0, SEEK_END);
140 if (map->
index[tileIndex] == -1) {
146 &cols, &depths, &xRedundant,
147 &yRedundant, &zRedundant);
150 yRedundant, zRedundant, nofNum, type);
152 if (!Rast3d_tile2xdrTile(map, tile, rows, cols, depths, xRedundant,
153 yRedundant, zRedundant, nofNum, type)) {
154 Rast3d_error(
"Rast3d_write_tile: error in Rast3d_tile2xdrTile");
159 if (!Rast3d_writeTileUncompressed(map, nofNum)) {
161 "Rast3d_write_tile: error in Rast3d_writeTileUncompressed");
166 if (!Rast3d_writeTileCompressed(map, nofNum)) {
168 "Rast3d_write_tile: error in Rast3d_writeTileCompressed");
175 lseek(map->
data_fd, (
long)0, SEEK_END) - map->
index[tileIndex];
200 Rast3d_error(
"Rast3d_write_tile_float: error in Rast3d_write_tile");
224 Rast3d_error(
"Rast3d_write_tile_double: error in Rast3d_write_tile");
255 Rast3d_error(
"Rast3d_flush_tile: error in Rast3d_get_tile_ptr");
260 Rast3d_error(
"Rast3d_flush_tile: error in Rast3d_write_tile");
265 Rast3d_error(
"Rast3d_flush_tile: error in Rast3d__remove_tile");
294 int xMax,
int yMax,
int zMax)
300 "Rast3d_flush_tile_cube: function invalid in non-cache mode");
302 for (
x = xMin;
x <= xMax;
x++)
303 for (y = yMin; y <= yMax; y++)
304 for (z = zMin; z <= zMax; z++)
308 "Rast3d_flush_tile_cube: error in Rast3d_flush_tile");
339 int xMax,
int yMax,
int zMax)
341 int xTileMin, yTileMin, zTileMin, xTileMax, yTileMax, zTileMax;
342 int xOffs, yOffs, zOffs;
343 int regionMaxX, regionMaxY, regionMaxZ;
347 "Rast3d_flush_tiles_in_cube: function invalid in non-cache mode");
358 if ((xMin < 0) && (xMax < 0))
360 "Rast3d_flush_tiles_in_cube: coordinate out of Range");
361 if ((xMin >= regionMaxX) && (xMax >= regionMaxX))
363 "Rast3d_flush_tiles_in_cube: coordinate out of Range");
365 xMin =
MIN(
MAX(0, xMin), regionMaxX - 1);
367 if ((yMin < 0) && (yMax < 0))
369 "Rast3d_flush_tiles_in_cube: coordinate out of Range");
370 if ((yMin >= regionMaxY) && (yMax >= regionMaxY))
372 "Rast3d_flush_tiles_in_cube: coordinate out of Range");
374 yMin =
MIN(
MAX(0, yMin), regionMaxY - 1);
376 if ((zMin < 0) && (zMax < 0))
378 "Rast3d_flush_tiles_in_cube: coordinate out of Range");
379 if ((zMin >= regionMaxZ) && (zMax >= regionMaxZ))
381 "Rast3d_flush_tiles_in_cube: coordinate out of Range");
383 zMin =
MIN(
MAX(0, zMin), regionMaxZ - 1);
386 &zTileMin, &xOffs, &yOffs, &zOffs);
396 &yTileMax, &zTileMax, &xOffs, &yOffs, &zOffs);
403 yTileMax, zTileMax)) {
405 "Rast3d_flush_tiles_in_cube: error in Rast3d_flush_tile_cube");
#define G_incr_void_ptr(ptr, size)
void Rast3d_get_coords_map(RASTER3D_Map *, int *, int *, int *)
Returns the size of the region of map in cells.
void * Rast3d_get_tile_ptr(RASTER3D_Map *, int)
This function returns a pointer to a tile which contains the data for the tile with index tileIndex....
int Rast3d_tile2tile_index(RASTER3D_Map *, int, int, int)
Returns tile-index corresponding to tile-coordinates (xTile, yTile, zTile).
void Rast3d_range_update_from_tile(RASTER3D_Map *, const void *, int, int, int, int, int, int, int, int)
void Rast3d_coord2tile_coord(RASTER3D_Map *, int, int, int, int *, int *, int *, int *, int *, int *)
Converts cell-coordinates (x, y, z) into tile-coordinates (xTile, yTile, zTile) and the coordinate of...
int Rast3d_copy_to_xdr(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__remove_tile(RASTER3D_Map *, int)
void Rast3d_fatal_error(const char *,...) __attribute__((format(printf
int Rast3d_init_copy_to_xdr(RASTER3D_Map *, int)
int Rast3d_fpcompress_write_xdr_nums(int, char *, int, int, char *, int)
#define UNUSED
A macro for an attribute, if attached to a variable, indicating that the variable is not used.
#define RASTER3D_NO_COMPRESSION
int Rast3d_write_tile_double(RASTER3D_Map *map, int tileIndex, const void *tile)
Is equivalent to Rast3d_write_tile (map, tileIndex, tile, DCELL_TYPE).
int Rast3d_flush_tile_cube(RASTER3D_Map *map, int xMin, int yMin, int zMin, int xMax, int yMax, int zMax)
Writes the tiles with tile-coordinates contained in the axis-parallel cube with vertices (xMin,...
int Rast3d_write_tile_float(RASTER3D_Map *map, int tileIndex, const void *tile)
Is equivalent to Rast3d_write_tile (map, tileIndex, tile, FCELL_TYPE).
int Rast3d_flush_tile(RASTER3D_Map *map, int tileIndex)
Writes the tile with tileIndex to the file corresponding to map and removes the tile from the cache (...
int Rast3d_write_tile(RASTER3D_Map *map, int tileIndex, const void *tile, int type)
Writes tile with index tileIndex to the file corresponding to map. It is assumed that the cells in ti...
int Rast3d_flush_tiles_in_cube(RASTER3D_Map *map, int xMin, int yMin, int zMin, int xMax, int yMax, int zMax)
Writes those tiles for which every cell has coordinate contained in the axis-parallel cube defined by...