14 Rast3d_tile2xdrTile(
RASTER3D_Map * map,
const void *tile,
int rows,
int cols,
15 int depths,
int xRedundant,
int yRedundant,
int zRedundant,
21 Rast3d_error(
"Rast3d_tile2xdrTile: error in Rast3d_init_copy_to_xdr");
28 Rast3d_error(
"Rast3d_tile2xdrTile: error in Rast3d_copy_to_xdr");
35 for (z = 0; z < depths; z++) {
36 for (y = 0; y < rows; y++) {
38 Rast3d_error(
"Rast3d_tile2xdrTile: error in Rast3d_copy_to_xdr");
46 map->
tileX * yRedundant *
53 for (z = 0; z < depths; z++) {
55 Rast3d_error(
"Rast3d_tile2xdrTile: error in Rast3d_copy_to_xdr");
64 Rast3d_error(
"Rast3d_tile2xdrTile: error in Rast3d_copy_to_xdr");
72 static int Rast3d_writeTileUncompressed(
RASTER3D_Map * map,
int nofNum)
76 Rast3d_error(
"Rast3d_writeTileUncompressed: can't write file.");
85 static int Rast3d_writeTileCompressed(
RASTER3D_Map * map,
int nofNum)
90 (
"Rast3d_writeTileCompressed: error in Rast3d_fpcompress_write_xdr_nums");
130 int rows, cols, depths, xRedundant, yRedundant, zRedundant, nofNum;
133 if ((tileIndex > map->
nTiles) || (tileIndex < 0))
137 if (map->
index[tileIndex] != -1)
141 map->
index[tileIndex] = lseek(map->
data_fd, (
long)0, SEEK_END);
142 if (map->
index[tileIndex] == -1) {
148 &rows, &cols, &depths,
149 &xRedundant, &yRedundant,
153 xRedundant, yRedundant, zRedundant, nofNum,
156 if (!Rast3d_tile2xdrTile(map, tile, rows, cols, depths,
157 xRedundant, yRedundant, zRedundant, nofNum, type)) {
158 Rast3d_error(
"Rast3d_write_tile: error in Rast3d_tile2xdrTile");
163 if (!Rast3d_writeTileUncompressed(map, nofNum)) {
164 Rast3d_error(
"Rast3d_write_tile: error in Rast3d_writeTileUncompressed");
168 else {
if (!Rast3d_writeTileCompressed(map, nofNum)) {
169 Rast3d_error(
"Rast3d_write_tile: error in Rast3d_writeTileCompressed");
176 map->
index[tileIndex];
202 Rast3d_error(
"Rast3d_write_tile_float: error in Rast3d_write_tile");
227 Rast3d_error(
"Rast3d_write_tile_double: error in Rast3d_write_tile");
261 Rast3d_error(
"Rast3d_flush_tile: error in Rast3d_get_tile_ptr");
266 Rast3d_error(
"Rast3d_flush_tile: error in Rast3d_write_tile");
271 Rast3d_error(
"Rast3d_flush_tile: error in Rast3d__remove_tile");
308 (
"Rast3d_flush_tile_cube: function invalid in non-cache mode");
310 for (x = xMin; x <= xMax; x++)
311 for (y = yMin; y <= yMax; y++)
312 for (z = zMin; z <= zMax; z++)
314 Rast3d_error(
"Rast3d_flush_tile_cube: error in Rast3d_flush_tile");
350 int xTileMin, yTileMin, zTileMin, xTileMax, yTileMax, zTileMax;
351 int xOffs, yOffs, zOffs;
352 int regionMaxX, regionMaxY, regionMaxZ;
356 (
"Rast3d_flush_tiles_in_cube: function invalid in non-cache mode");
367 if ((xMin < 0) && (xMax < 0))
369 if ((xMin >= regionMaxX) && (xMax >= regionMaxX))
372 xMin =
MIN(
MAX(0, xMin), regionMaxX - 1);
374 if ((yMin < 0) && (yMax < 0))
376 if ((yMin >= regionMaxY) && (yMax >= regionMaxY))
379 yMin =
MIN(
MAX(0, yMin), regionMaxY - 1);
381 if ((zMin < 0) && (zMax < 0))
383 if ((zMin >= regionMaxZ) && (zMax >= regionMaxZ))
386 zMin =
MIN(
MAX(0, zMin), regionMaxZ - 1);
389 &xTileMin, &yTileMin, &zTileMin,
390 &xOffs, &yOffs, &zOffs);
400 &xTileMax, &yTileMax, &zTileMax,
401 &xOffs, &yOffs, &zOffs);
408 xTileMax, yTileMax, zTileMax)) {
409 Rast3d_error(
"Rast3d_flush_tiles_in_cube: error in Rast3d_flush_tile_cube");
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_init_copy_to_xdr(RASTER3D_Map *, int)
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...
#define G_incr_void_ptr(ptr, size)
void Rast3d_range_update_from_tile(RASTER3D_Map *, const void *, int, int, int, int, int, int, int, int)
void Rast3d_fatal_error(const char *,...) __attribute__((format(printf
void Rast3d_error(const char *,...) __attribute__((format(printf
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__remove_tile(RASTER3D_Map *, int)
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_write_tile_float(RASTER3D_Map *map, int tileIndex, const void *tile)
Is equivalent to Rast3d_write_tile (map, tileIndex, tile, FCELL_TYPE).
#define RASTER3D_NO_COMPRESSION
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_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...
int Rast3d_fpcompress_write_xdr_nums(int, char *, int, int, char *, int)
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_copy_to_xdr(const void *, 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_tile2tile_index(RASTER3D_Map *, int, int, int)
Returns tile-index corresponding to tile-coordinates (xTile, yTile, zTile).