GRASS Programmer's Manual
6.5.svn(2014)-r66266
|
OGSF library - loading and manipulating volumes (lower level functions) More...
#include <string.h>
#include <stdlib.h>
#include <grass/gis.h>
#include <grass/gstypes.h>
#include <grass/gsurf.h>
#include <grass/G3d.h>
#include <grass/glocale.h>
Go to the source code of this file.
Data Structures | |
struct | slice_data |
structure for slice mode reading from volume file More... | |
Macros | |
#define | LUCKY 33 |
#define | MODE_DIRECT 0 |
#define | MODE_SLICE 1 |
#define | MODE_FULL 2 |
#define | MODE_PRELOAD 3 |
#define | MODE_DEFAULT 0 |
#define | STATUS_READY 0 |
#define | STATUS_BUSY 1 |
Functions | |
void * | open_g3d_file (const char *filename, IFLAG *type, double *min, double *max) |
Open 3d raster file. More... | |
int | close_g3d_file (void *map) |
Close g3d file. More... | |
geovol_file * | gvl_file_get_volfile (int id) |
Get geovol_file structure for given handle. More... | |
int | find_datah (const char *name, IFLAG type, int begin) |
Find file with name and type in geovol_file array an return handle. More... | |
char * | gvl_file_get_name (int id) |
Get file name for given handle. More... | |
int | gvl_file_get_file_type (geovol_file *vf) |
Get file type for given handle. More... | |
int | gvl_file_get_data_type (geovol_file *vf) |
Get data type for given handle. More... | |
void | gvl_file_get_min_max (geovol_file *vf, double *min, double *max) |
Get minimum and maximum value in volume file. More... | |
void * | open_volfile (const char *name, IFLAG file_type, IFLAG *data_type, double *min, double *max) |
Open 3d raster file. More... | |
int | close_volfile (void *map, IFLAG type) |
Close volume file. More... | |
int | gvl_file_newh (const char *name, IFLAG file_type) |
Get handle for given file name and type. More... | |
int | free_volfile_buffs (geovol_file *vf) |
Free allocated buffers. More... | |
int | gvl_file_free_datah (int id) |
Free geovol_file structure for given handle. More... | |
int | read_g3d_value (IFLAG type, void *map, int x, int y, int z, void *value) |
Eead value from g3d file. More... | |
int | read_g3d_slice (IFLAG type, void *map, int level, void *data) |
Read slice of values at level from g3d file. More... | |
int | read_g3d_vol (IFLAG type, void *map, void *data) |
Read all values from g3d file. More... | |
int | is_null_g3d_value (IFLAG type, void *value) |
Check for null value. More... | |
int | get_buff_value (IFLAG type, void *data, int offset, void *value) |
Get value from buffer. More... | |
int | get_direct_value (geovol_file *vf, int x, int y, int z, void *value) |
Read value direct from volume file. More... | |
int | alloc_vol_buff (geovol_file *vf) |
Allocate buffer memory for full mode reading. More... | |
int | free_vol_buff (geovol_file *vf) |
Free memory buffer memory. More... | |
int | read_vol (geovol_file *vf) |
Read all values from volume file. More... | |
int | get_vol_value (geovol_file *vf, int x, int y, int z, void *value) |
Get value from volume buffer. More... | |
int | alloc_slice_buff (geovol_file *vf) |
Allocate buffer for slice mode reading. More... | |
int | free_slice_buff (geovol_file *vf) |
Free buffer for slice mode reading. More... | |
int | read_slice (geovol_file *vf, int s, int l) |
Read slice of values at level from volume file. More... | |
void | shift_slices (geovol_file *vf) |
Read new slice into buffer. More... | |
int | get_slice_value (geovol_file *vf, int x, int y, int z, void *value) |
Get value from slice buffer. More... | |
int | gvl_file_start_read (geovol_file *vf) |
Start read - allocate memory buffer a read first data into buffer. More... | |
int | gvl_file_end_read (geovol_file *vf) |
End read - free buffer memory. More... | |
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. More... | |
int | gvl_file_is_null_value (geovol_file *vf, void *value) |
Check for null value. More... | |
int | gvl_file_set_mode (geovol_file *vf, IFLAG mode) |
Set read mode. More... | |
int | gvl_file_set_slices_param (geovol_file *vf, int n, int b) |
Set parameters for slice reading. More... | |
OGSF library - loading and manipulating volumes (lower level functions)
GRASS OpenGL gsurf OGSF Library
(C) 1999-2008 by the GRASS Development Team
This program is free software under the GNU General Public License (>=v2). Read the file COPYING that comes with GRASS for details.
Definition in file gvl_file.c.
#define LUCKY 33 |
Definition at line 28 of file gvl_file.c.
#define MODE_DEFAULT 0 |
Definition at line 35 of file gvl_file.c.
Referenced by gvl_file_newh().
#define MODE_DIRECT 0 |
Definition at line 30 of file gvl_file.c.
Referenced by gvl_file_get_value().
#define MODE_FULL 2 |
Definition at line 32 of file gvl_file.c.
Referenced by gvl_file_end_read(), gvl_file_get_value(), and gvl_file_start_read().
#define MODE_PRELOAD 3 |
Definition at line 33 of file gvl_file.c.
Referenced by free_volfile_buffs(), gvl_file_get_value(), and gvl_file_set_mode().
#define MODE_SLICE 1 |
Definition at line 31 of file gvl_file.c.
Referenced by free_volfile_buffs(), gvl_file_end_read(), gvl_file_get_value(), gvl_file_set_mode(), gvl_file_set_slices_param(), and gvl_file_start_read().
#define STATUS_BUSY 1 |
Definition at line 38 of file gvl_file.c.
Referenced by gvl_file_get_value(), gvl_file_set_mode(), gvl_file_set_slices_param(), and gvl_file_start_read().
#define STATUS_READY 0 |
Definition at line 37 of file gvl_file.c.
Referenced by gvl_file_end_read(), and gvl_file_newh().
int alloc_slice_buff | ( | geovol_file * | vf | ) |
Allocate buffer for slice mode reading.
vf | pointer to geovol_file struct |
Definition at line 812 of file gvl_file.c.
References Cols, NULL, slice_data::num, Rows, slice_data::slice, and switch().
Referenced by gvl_file_start_read().
int alloc_vol_buff | ( | geovol_file * | vf | ) |
Allocate buffer memory for full mode reading.
vf | pointer to geovol_file |
Definition at line 718 of file gvl_file.c.
References Cols, Depths, NULL, and Rows.
Referenced by gvl_file_set_mode(), and gvl_file_start_read().
int close_g3d_file | ( | void * | map | ) |
Close g3d file.
map | 3d raster map |
Definition at line 467 of file gvl_file.c.
References G3d_closeCell(), and G_warning().
Referenced by close_volfile().
int close_volfile | ( | void * | map, |
IFLAG | type | ||
) |
Close volume file.
map | volume filename |
type | file type |
Definition at line 252 of file gvl_file.c.
References close_g3d_file().
Referenced by gvl_file_free_datah().
Find file with name and type in geovol_file array an return handle.
name | file name begin |
data | id |
-1 | not found |
Definition at line 140 of file gvl_file.c.
References file_name, and file_type.
Referenced by gvl_file_newh().
int free_slice_buff | ( | geovol_file * | vf | ) |
Free buffer for slice mode reading.
vf | pointer to geovol_file struct |
Definition at line 851 of file gvl_file.c.
References for(), G_free(), slice_data::num, and slice_data::slice.
Referenced by gvl_file_end_read().
int free_vol_buff | ( | geovol_file * | vf | ) |
Free memory buffer memory.
vf | pointer to geovol_file struct |
Definition at line 751 of file gvl_file.c.
References G_free().
Referenced by gvl_file_end_read().
int free_volfile_buffs | ( | geovol_file * | vf | ) |
Free allocated buffers.
vf | pointer to geovol_file struct |
Definition at line 343 of file gvl_file.c.
References G_free(), MODE_PRELOAD, MODE_SLICE, and NULL.
Referenced by gvl_file_free_datah().
Get value from buffer.
type | data type |
data | data buffer |
offset | |
value |
Definition at line 653 of file gvl_file.c.
Referenced by get_slice_value(), and get_vol_value().
Read value direct from volume file.
vf | pointer to geovol_file struct |
x,y,z | real point [out] value data value |
Definition at line 689 of file gvl_file.c.
References read_g3d_value().
Referenced by gvl_file_get_value().
Get value from slice buffer.
vf | pointer to geovol_file struct | |
x,y,z | real point | |
[out] | value | data value |
Definition at line 928 of file gvl_file.c.
References slice_data::base, Cols, slice_data::crnt, get_buff_value(), if(), slice_data::num, shift_slices(), and slice_data::slice.
Referenced by gvl_file_get_value().
Get value from volume buffer.
vf | pointer to geovol_file struct | |
x,y,z | real point | |
[out] | value | data value |
Definition at line 791 of file gvl_file.c.
References Cols, get_buff_value(), and Rows.
Referenced by gvl_file_get_value().
int gvl_file_end_read | ( | geovol_file * | vf | ) |
End read - free buffer memory.
vf | pointer to geovol_file struct |
Definition at line 1019 of file gvl_file.c.
References free_slice_buff(), free_vol_buff(), MODE_FULL, MODE_SLICE, and STATUS_READY.
Referenced by gvl_isosurf_calc(), and slice_calc().
Free geovol_file structure for given handle.
id |
Definition at line 365 of file gvl_file.c.
References close_volfile(), free_volfile_buffs(), G_debug(), G_free(), and NULL.
Referenced by gvl_free_volmem(), and gvl_isosurf_set_att_src().
int gvl_file_get_data_type | ( | geovol_file * | vf | ) |
Get data type for given handle.
vf | pointer to geovol_file struct |
Definition at line 203 of file gvl_file.c.
Referenced by iso_get_cube_value(), and slice_get_value().
int gvl_file_get_file_type | ( | geovol_file * | vf | ) |
Get file type for given handle.
vf | pointer to geovol_file struct |
Definition at line 191 of file gvl_file.c.
void gvl_file_get_min_max | ( | geovol_file * | vf, |
double * | min, | ||
double * | max | ||
) |
Get minimum and maximum value in volume file.
vf | pointer to geovol_file struct | |
[out] | min | min value |
[out] | max | max value |
Definition at line 215 of file gvl_file.c.
Referenced by iso_get_range().
char* gvl_file_get_name | ( | int | id | ) |
Get file name for given handle.
id | handle id |
Definition at line 166 of file gvl_file.c.
References NULL.
Referenced by GVL_get_volname(), GVL_isosurf_get_att(), gvl_slices_calc(), and gvld_isosurf().
Get value for volume file at x, y, z.
vf | pointer to geovol_file struct |
Definition at line 1051 of file gvl_file.c.
References get_direct_value(), get_slice_value(), get_vol_value(), MODE_DIRECT, MODE_FULL, MODE_PRELOAD, MODE_SLICE, and STATUS_BUSY.
Referenced by iso_get_cube_value(), and slice_get_value().
geovol_file* gvl_file_get_volfile | ( | int | id | ) |
Get geovol_file structure for given handle.
id |
Definition at line 118 of file gvl_file.c.
References NULL.
Referenced by gvl_isosurf_calc(), iso_get_cube_value(), iso_get_range(), slice_calc(), and slice_get_value().
int gvl_file_is_null_value | ( | geovol_file * | vf, |
void * | value | ||
) |
Check for null value.
vf | pointer to geovol_file struct |
value | data value |
Definition at line 1088 of file gvl_file.c.
References is_null_g3d_value().
Referenced by iso_get_cube_value().
int gvl_file_newh | ( | const char * | name, |
IFLAG | file_type | ||
) |
Get handle for given file name and type.
name | volume filename |
file_type | file type |
Definition at line 270 of file gvl_file.c.
References file_type, find_datah(), first, G_store(), gvl_file_set_mode(), tools::id, max, min, MODE_DEFAULT, NULL, open_volfile(), and STATUS_READY.
Referenced by gvl_isosurf_set_att_map(), and GVL_load_vol().
int gvl_file_set_mode | ( | geovol_file * | vf, |
IFLAG | mode | ||
) |
Set read mode.
vf | pointer to geovol_file struct |
mode | read mode |
Definition at line 1117 of file gvl_file.c.
References alloc_vol_buff(), slice_data::base, slice_data::crnt, G_free(), tools::mode, MODE_PRELOAD, MODE_SLICE, NULL, slice_data::num, read_vol(), and STATUS_BUSY.
Referenced by gvl_file_newh(), gvl_isosurf_calc(), and slice_calc().
Set parameters for slice reading.
vf | pointer to geovol_file struct |
n | |
b |
Definition at line 1167 of file gvl_file.c.
References slice_data::base, MODE_SLICE, slice_data::num, return, and STATUS_BUSY.
int gvl_file_start_read | ( | geovol_file * | vf | ) |
Start read - allocate memory buffer a read first data into buffer.
vf | pointer to geovol_file struct |
Definition at line 968 of file gvl_file.c.
References alloc_slice_buff(), alloc_vol_buff(), slice_data::base, slice_data::crnt, for(), MODE_FULL, MODE_SLICE, slice_data::num, read_slice(), read_vol(), and STATUS_BUSY.
Referenced by gvl_isosurf_calc(), and slice_calc().
int is_null_g3d_value | ( | IFLAG | type, |
void * | value | ||
) |
Check for null value.
type | data type |
value |
Definition at line 616 of file gvl_file.c.
References G3d_isNullValueNum().
Referenced by gvl_file_is_null_value().
void * open_g3d_file | ( | const char * | filename, |
IFLAG * | type, | ||
double * | min, | ||
double * | max | ||
) |
Open 3d raster file.
filename | file name | |
type | data type | |
[out] | min | min value |
[out] | max | max value |
to data
Definition at line 418 of file gvl_file.c.
References G3d_fileTypeMap(), G3d_openCellOld(), G3d_range_load(), G3d_range_min_max(), G_find_grid3(), G_warning(), and NULL.
Referenced by open_volfile().
void* open_volfile | ( | const char * | name, |
IFLAG | file_type, | ||
IFLAG * | data_type, | ||
double * | min, | ||
double * | max | ||
) |
Open 3d raster file.
name | file name | |
file_type | file type | |
data_type | data type | |
[out] | min | min value |
[out] | max | max value |
Definition at line 233 of file gvl_file.c.
References NULL, and open_g3d_file().
Referenced by gvl_file_newh().
Read slice of values at level from g3d file.
type | data type | |
map | 3D raster map | |
level | ||
[out] | data |
Definition at line 522 of file gvl_file.c.
References Cols, G3d_getDouble(), G3d_getFloat(), Rows, and y.
Referenced by read_slice().
Eead value from g3d file.
type | data type | |
map | 3D raster map | |
x,y,z | real coordinates | |
[out] | value | data value |
Definition at line 490 of file gvl_file.c.
References G3d_getDouble(), and G3d_getFloat().
Referenced by get_direct_value().
int read_g3d_vol | ( | IFLAG | type, |
void * | map, | ||
void * | data | ||
) |
Read all values from g3d file.
type | data type | |
map | 3D raster map | |
[out] | data | data buffer |
Definition at line 567 of file gvl_file.c.
References Cols, Depths, G3d_getDouble(), G3d_getFloat(), Rows, and y.
Referenced by read_vol().
Read slice of values at level from volume file.
vf | pointer to geovol_file struct |
s | |
l |
Definition at line 873 of file gvl_file.c.
References read_g3d_slice(), slice_data::slice, and switch().
Referenced by gvl_file_start_read(), and shift_slices().
int read_vol | ( | geovol_file * | vf | ) |
Read all values from volume file.
vf | pointer to geovol_file struct |
Definition at line 766 of file gvl_file.c.
References read_g3d_vol().
Referenced by gvl_file_set_mode(), and gvl_file_start_read().
void shift_slices | ( | geovol_file * | vf | ) |
Read new slice into buffer.
vf | pointer to geovol_file struct |
Definition at line 897 of file gvl_file.c.
References slice_data::base, slice_data::crnt, for(), slice_data::num, read_slice(), and slice_data::slice.
Referenced by get_slice_value().