49static int Numfiles = 0;
51static int Cur_id =
LUCKY;
65static int init_volfiles(
void)
93static int check_num_volfiles(
void)
95 if (Numfiles < Cur_max) {
117 for (i = 0; i < Numfiles; i++) {
118 if (Data[i]->data_id ==
id) {
140 start =
begin ? 0 : i + 1;
142 for (i = start; i < Numfiles; i++) {
144 if (Data[i]->file_type == type) {
145 return (Data[i]->data_id);
167 for (i = 0; i < Numfiles; i++) {
168 if (Data[i]->data_id ==
id) {
188 return (
vf->file_type);
200 return (
vf->data_type);
268 static int first = 1;
275 if (0 > init_volfiles()) {
283 for (i = 0; i < Numfiles; i++) {
284 if (Data[i]->data_id ==
id) {
293 if (0 > check_num_volfiles()) {
305 new = Data[Numfiles];
309 new->data_id = Cur_id++;
312 new->file_type = file_type;
317 new->data_type = data_type;
325 return (new->data_id);
365 G_debug(5,
"gvl_file_free_datah(): id=%d",
id);
367 for (i = 0; i < Numfiles; i++) {
368 if (Data[i]->data_id ==
id) {
372 if (
fvf->count > 1) {
384 for (
j = i;
j < (Numfiles - 1);
j++) {
385 Data[
j] = Data[
j + 1];
422 G_warning(
_(
"3D raster map <%s> not found"), filename);
431 G_warning(
_(
"Unable to open 3D raster map <%s>"), filename);
437 G_warning(
_(
"Unable to read range of 3D raster map <%s>"), filename);
465 G_warning(
_(
"Unable to close 3D raster map <%s>"),
524 for (y = 0; y <
Rows; y++) {
525 ((
float *)data)[
x + y *
Cols] =
535 for (y = 0; y <
Rows; y++) {
536 ((
double *)data)[
x + y *
Cols] =
569 for (y = 0; y <
Rows; y++) {
570 for (z = 0; z <
Depths; z++) {
582 for (y = 0; y <
Rows; y++) {
583 for (z = 0; z <
Depths; z++) {
652 *((
float *)value) = ((
float *)data)[offset];
657 *((
double *)value) = ((
double *)data)[offset];
685 switch (
vf->file_type) {
714 switch (
vf->data_type) {
761 switch (
vf->file_type) {
808 slice_data *
sd = (slice_data *)
vf->buff;
810 switch (
vf->data_type) {
813 for (i = 0; i <
sd->num; i++) {
822 for (i = 0; i <
sd->num; i++) {
847 slice_data *
sd = (slice_data *)
vf->buff;
849 for (i = 0; i <
sd->num; i++) {
869 slice_data *
sd = (slice_data *)
vf->buff;
871 switch (
vf->file_type) {
895 slice_data *
sd = (slice_data *)
vf->buff;
899 for (i = 0; i <
sd->num - 1; i++) {
900 sd->slice[i] =
sd->slice[i + 1];
902 sd->slice[
sd->num - 1] = tmp;
923 slice_data *
sd = (slice_data *)
vf->buff;
926 if ((z >=
sd->crnt - (
sd->base - 1)) &&
934 else if (z ==
sd->crnt - (
sd->base - 1) + 1) {
988 sd = (slice_data *)
vf->buff;
993 for (i = 0; i < (
sd->num -
sd->base + 1); i++)
1085 switch (
vf->file_type) {
1119 if (
vf->mode == mode)
1129 if ((
vf->buff = (slice_data *)
G_malloc(
sizeof(slice_data))) ==
NULL)
1132 sd = (slice_data *)
vf->buff;
1172 sd = (slice_data *)
vf->buff;
void G_free(void *)
Free allocated memory.
void void void void G_fatal_error(const char *,...) __attribute__((format(printf
const char * G_find_raster3d(const char *, const char *)
Search for a 3D raster map in current search path or in a specified mapset.
void G_warning(const char *,...) __attribute__((format(printf
char * G_store(const char *)
Copy string to allocated memory.
int G_debug(int, const char *,...) __attribute__((format(printf
void * GVL_get_window(void)
Get window.
int Rast3d_file_type_map(RASTER3D_Map *)
Returns the type with which tiles of map are stored on file.
int Rast3d_is_null_value_num(const void *, int)
int Rast3d_range_load(RASTER3D_Map *)
Loads the range into the range structure of map.
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...
double Rast3d_get_double(RASTER3D_Map *, int, int, int)
Is equivalent to Rast3d_get_value (map, x, y, z, &value, DCELL_TYPE); return value.
int Rast3d_close(RASTER3D_Map *)
Close 3D raster map files.
float Rast3d_get_float(RASTER3D_Map *, int, int, int)
Is equivalent to Rast3d_get_value (map, x, y, z, &value, FCELL_TYPE); return value.
void Rast3d_range_min_max(RASTER3D_Map *, double *, double *)
Returns in min and max the minimum and maximum values of the range.
int close_g3d_file(void *)
Close g3d file.
int is_null_g3d_value(unsigned int type, void *value)
Check for null value.
int gvl_file_free_datah(int id)
Free geovol_file structure for given handle.
int gvl_file_get_data_type(geovol_file *vf)
Get data type for given handle.
void * open_g3d_file(const char *, unsigned int *, double *, double *)
Open 3d raster file.
int gvl_file_end_read(geovol_file *vf)
End read - free buffer memory.
void shift_slices(geovol_file *vf)
Read new slice into buffer.
int get_vol_value(geovol_file *vf, int x, int y, int z, void *value)
Get value from volume buffer.
int read_g3d_value(unsigned int type, void *map, int x, int y, int z, void *value)
Eead value from g3d file.
int read_vol(geovol_file *vf)
Read all values from volume file.
void gvl_file_get_min_max(geovol_file *vf, double *min, double *max)
Get minimum and maximum value in volume file.
int get_direct_value(geovol_file *vf, int x, int y, int z, void *value)
Read value direct from volume file.
int get_slice_value(geovol_file *vf, int x, int y, int z, void *value)
Get value from slice buffer.
int close_volfile(void *map, unsigned int type)
Close volume file.
int free_slice_buff(geovol_file *vf)
Free buffer for slice mode reading.
int alloc_slice_buff(geovol_file *vf)
Allocate buffer for slice mode reading.
int find_datah(const char *name, unsigned int type, int begin)
Find file with name and type in geovol_file array an return handle.
int gvl_file_set_mode(geovol_file *vf, unsigned int mode)
Set read mode.
int gvl_file_set_slices_param(geovol_file *vf, int n, int b)
Set parameters for slice reading.
int read_g3d_vol(unsigned int type, void *map, void *data)
Read all values from g3d file.
int free_vol_buff(geovol_file *vf)
Free memory buffer memory.
int gvl_file_get_value(geovol_file *vf, int x, int y, int z, void *value)
Get value for volume file at x, y, z.
int gvl_file_start_read(geovol_file *vf)
Start read - allocate memory buffer a read first data into buffer.
char * gvl_file_get_name(int id)
Get file name for given handle.
int get_buff_value(unsigned int type, void *data, int offset, void *value)
Get value from buffer.
int gvl_file_newh(const char *name, unsigned int file_type)
Get handle for given file name and type.
int gvl_file_get_file_type(geovol_file *vf)
Get file type for given handle.
int free_volfile_buffs(geovol_file *vf)
Free allocated buffers.
int gvl_file_is_null_value(geovol_file *vf, void *value)
Check for null value.
geovol_file * gvl_file_get_volfile(int id)
Get geovol_file structure for given handle.
int read_g3d_slice(unsigned int type, void *map, int level, void *data)
Read slice of values at level from g3d file.
void * open_volfile(const char *name, unsigned int file_type, unsigned int *data_type, double *min, double *max)
Open 3d raster file.
int read_slice(geovol_file *vf, int s, int l)
Read slice of values at level from volume file.
int alloc_vol_buff(geovol_file *vf)
Allocate buffer memory for full mode reading.
OGSF header file (structures)
#define VOL_FTYPE_RASTER3D
#define RASTER3D_DEFAULT_WINDOW
#define RASTER3D_USE_CACHE_DEFAULT
#define RASTER3D_TILE_SAME_AS_FILE