9 static int Rast3d_xdrTile2tile(
RASTER3D_Map *map,
void *tile,
int rows,
10 int cols,
int depths,
int xRedundant,
11 int yRedundant,
int zRedundant,
int nofNum,
14 int y, z, xLength, yLength, length;
17 Rast3d_error(
"Rast3d_xdrTile2tile: error in Rast3d_init_copy_from_xdr");
23 Rast3d_error(
"Rast3d_xdrTile2tile: error in Rast3d_copy_from_xdr");
30 xLength = xRedundant * length;
31 yLength = map->
tileX * yRedundant * length;
34 for (z = 0; z < depths; z++) {
35 for (y = 0; y < rows; y++) {
38 "Rast3d_xdrTile2tile: error in Rast3d_copy_from_xdr");
58 for (z = 0; z < depths; z++) {
61 "Rast3d_xdrTile2tile: error in Rast3d_copy_from_xdr");
76 Rast3d_error(
"Rast3d_xdrTile2tile: error in Rast3d_copy_from_xdr");
91 static int Rast3d_readTileUncompressed(
RASTER3D_Map *map,
int tileIndex,
101 if ((res = read(map->
data_fd,
xdr, nofBytes)) < 0 ||
102 (size_t)res != nofBytes) {
103 Rast3d_error(
"Rast3d_readTileUncompressed: can't read file");
112 static int Rast3d_readTileCompressed(
RASTER3D_Map *map,
int tileIndex,
119 "Rast3d_fpcompress_read_xdr_nums");
153 int nofNum, rows, cols, depths, xRedundant, yRedundant, zRedundant;
155 if ((tileIndex >= map->
nTiles) || (tileIndex < 0))
158 if (map->
index[tileIndex] == -1) {
164 &cols, &depths, &xRedundant,
165 &yRedundant, &zRedundant);
167 if (lseek(map->
data_fd, map->
index[tileIndex], SEEK_SET) == -1) {
173 if (!Rast3d_readTileUncompressed(map, tileIndex, nofNum)) {
175 "Rast3d_read_tile: error in Rast3d_readTileUncompressed");
179 else if (!Rast3d_readTileCompressed(map, tileIndex, nofNum)) {
180 Rast3d_error(
"Rast3d_read_tile: error in Rast3d_readTileCompressed");
184 if (!Rast3d_xdrTile2tile(map, tile, rows, cols, depths, xRedundant,
185 yRedundant, zRedundant, nofNum, type)) {
186 Rast3d_error(
"Rast3d_read_tile: error in Rast3d_xdrTile2tile");
213 Rast3d_error(
"Rast3d_read_tile_float: error in Rast3d_read_tile");
236 Rast3d_error(
"Rast3d_read_tile_double: error in Rast3d_read_tile");
266 "Rast3d_lock_tile: function invalid in non-cache mode");
269 Rast3d_error(
"Rast3d_lock_tile: error in Rast3d_cache_lock");
293 "Rast3d_unlock_tile: function invalid in non-cache mode");
296 Rast3d_error(
"Rast3d_unlock_tile: error in Rast3d_cache_unlock");
319 "Rast3d_unlock_all: function invalid in non-cache mode");
322 Rast3d_error(
"Rast3d_unlock_all: error in Rast3d_cache_unlock_all");
344 "Rast3d_autoLockOn: function invalid in non-cache mode");
364 "Rast3d_autoLockOff: function invalid in non-cache mode");
393 "Rast3d_autoLockOff: function invalid in non-cache mode");
#define G_incr_void_ptr(ptr, size)
int Rast3d_cache_lock(RASTER3D_cache *, int)
int Rast3d_mask_is_off(RASTER3D_Map *)
Returns 1 if the mask for map is turned off. Returns 0 otherwise.
int Rast3d_init_copy_from_xdr(RASTER3D_Map *, int)
void Rast3d_cache_autolock_off(RASTER3D_cache *)
void Rast3d_set_null_tile_type(RASTER3D_Map *, void *, int)
Assumes that tile is a tile with the same dimensions as the tiles of map. Fills tile with NULL-values...
void Rast3d_mask_tile(RASTER3D_Map *, int, void *, int)
Replaces the values stored in tile (with tileIndex) for which Rast3d_is_masked returns 1 with NULL-va...
void Rast3d_set_null_value(void *, int, int)
Fills the vector pointed to by c with nofElts NULL-values of type.
int Rast3d__compute_cache_size(RASTER3D_Map *, int)
void Rast3d_cache_autolock_on(RASTER3D_cache *)
void Rast3d_cache_set_min_unlock(RASTER3D_cache *, int)
int Rast3d_cache_unlock_all(RASTER3D_cache *)
int Rast3d_cache_unlock(RASTER3D_cache *, int)
int Rast3d_copy_from_xdr(int, void *)
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_fpcompress_read_xdr_nums(int, char *, int, int, int, char *, int)
void Rast3d_fatal_error(const char *,...) __attribute__((format(printf
#define RASTER3D_NO_COMPRESSION
#define RASTER3D_MIN(a, b)
int Rast3d_read_tile(RASTER3D_Map *map, int tileIndex, void *tile, int type)
Reads tile with index tileIndex into the tile buffer. The cells are stored with type type which must ...
void Rast3d_autolock_off(RASTER3D_Map *map)
Turns autolock mode Off.
void Rast3d_min_unlocked(RASTER3D_Map *map, int minUnlocked)
Sets the minimum number of unlocked tiles to minUnlocked. This function should be used in combination...
int Rast3d_begin_cycle(RASTER3D_Map *map)
Starts a new cycle.
int Rast3d_read_tile_double(RASTER3D_Map *map, int tileIndex, void *tile)
Is equivalent to Rast3d_read_tile (map, tileIndex, tile, DCELL_TYPE).
int Rast3d_read_tile_float(RASTER3D_Map *map, int tileIndex, void *tile)
Is equivalent to Rast3d_read_tile (map, tileIndex, tile, FCELL_TYPE).
int Rast3d_end_cycle(RASTER3D_Map *map)
Ends a cycle.
int Rast3d_unlock_all(RASTER3D_Map *map)
Unlocks every tile in cache of map.
int Rast3d_unlock_tile(RASTER3D_Map *map, int tileIndex)
Unlocks tile with tileIndex.
int Rast3d_lock_tile(RASTER3D_Map *map, int tileIndex)
Locks tile with tileIndex in cache. If after locking fewer than the minimum number of unlocked tiles ...
void Rast3d_autolock_on(RASTER3D_Map *map)
Turns autolock mode on.