27 static int Next_vol = 0;
30 static double Region[6];
42 Region[0] = wind3.
north;
43 Region[1] = wind3.
south;
44 Region[2] = wind3.
west;
45 Region[3] = wind3.
east;
46 Region[4] = wind3.
top;
61 Region[0] = wind3.
north;
62 Region[1] = wind3.
south;
63 Region[2] = wind3.
west;
64 Region[3] = wind3.
east;
65 Region[4] = wind3.
top;
121 for (i = 0; i < Next_vol && !found; i++) {
122 if (Vol_ID[i] ==
id) {
150 Vol_ID[Next_vol] = nvl->
gvol_id;
188 ret = (
int *)
G_malloc(Next_vol *
sizeof(
int));
192 for (i = 0; i < Next_vol; i++) {
228 for (i = 0; i < Next_vol && !found; i++) {
229 if (Vol_ID[i] ==
id) {
231 for (j = i; j < Next_vol; j++) {
232 Vol_ID[j] = Vol_ID[j + 1];
261 G_debug(3,
"GVL_load_vol(): id=%d, name=%s",
id, filename);
267 G_message(
_(
"Loading 3d raster map <%s>..."), filename);
294 if (0 > gvl->
hfile) {
321 G_debug(3,
"GVL_get_dims() id=%d, rows=%d, cols=%d, depths=%d",
386 G_debug(3,
"GVL_set_draw_wire");
427 G_debug(3,
"GVL_draw_wire(): id=%d",
id);
445 for (
id = 0;
id < Next_vol;
id++) {
459 for (
id = 0;
id < Next_vol;
id++) {
521 G_debug(3,
"GS_set_focus_center_map");
526 center[
X] = (gvl->
xmax - gvl->
xmin) / 2.;
527 center[
Y] = (gvl->
ymax - gvl->
ymin) / 2.;
528 center[
Z] = (gvl->
zmax - gvl->
zmin) / 2.;
553 G_debug(3,
"GVL_isosurf_get_drawres");
580 G_debug(3,
"GVL_isosurf_set_drawres(): id=%d",
id);
582 if (xres < 1 || yres < 1 || zres < 1) {
640 G_debug(3,
"GVL_isosurf_set_drawmode(): id=%d mode=%d",
id, mode);
666 G_debug(3,
"GVL_isosurf_add() id=%d",
id);
719 for (i = isosurf_id + 1; i < gvl->
n_isosurfs; i++) {
742 G_debug(3,
"GVL_isosurf_move_up");
749 if (isosurf_id < 0 || isosurf_id > (gvl->
n_isosurfs - 1))
755 tmp = gvl->
isosurf[isosurf_id - 1];
757 gvl->
isosurf[isosurf_id] = tmp;
776 G_debug(3,
"GVL_isosurf_move_up");
783 if (isosurf_id < 0 || isosurf_id > (gvl->
n_isosurfs - 1))
789 tmp = gvl->
isosurf[isosurf_id + 1];
791 gvl->
isosurf[isosurf_id] = tmp;
810 int att,
int *
set,
float *constant,
char *mapname)
815 G_debug(3,
"GVL_isosurf_get_att");
853 G_debug(3,
"GVL_isosurf_unset_att");
888 G_debug(3,
"GVL_isosurf_set_att_const() id=%d isosurf_id=%d " 889 "att=%d const=%f",
id, isosurf_id, att, constant);
921 const char *filename)
925 G_debug(3,
"GVL_isosurf_set_att_map(): id=%d, isosurf_id=%d " 926 "att=%d map=%s",
id, isosurf_id, att, filename);
951 G_debug(3,
"GVL_isosurf_get_flags");
977 G_debug(3,
"GVL_isosurf_get_flags");
1002 G_debug(3,
"GVL_isosurf_num_isosurfs");
1029 G_debug(3,
"GVL_isosurf_set_att_const");
1082 G_debug(3,
"GVL_slice_get_drawres");
1109 G_debug(3,
"GVL_slice_set_drawres(): id=%d",
id);
1111 if (xres < 1 || yres < 1 || zres < 1) {
1122 for (i = 0; i < gvl->
n_slices; i++) {
1169 G_debug(3,
"GVL_slice_set_drawmode(): id=%d, mode=%d",
id, mode);
1247 for (i = slice_id + 1; i < gvl->
n_slices; i++) {
1270 G_debug(3,
"GVL_slice_move_up");
1277 if (slice_id < 0 || slice_id > (gvl->
n_slices - 1))
1283 tmp = gvl->
slice[slice_id - 1];
1284 gvl->
slice[slice_id - 1] = gvl->
slice[slice_id];
1285 gvl->
slice[slice_id] = tmp;
1304 G_debug(3,
"GVL_slice_move_up");
1311 if (slice_id < 0 || slice_id > (gvl->
n_slices - 1))
1314 if (slice_id == (gvl->
n_slices - 1))
1317 tmp = gvl->
slice[slice_id + 1];
1318 gvl->
slice[slice_id + 1] = gvl->
slice[slice_id];
1319 gvl->
slice[slice_id] = tmp;
1336 G_debug(3,
"GVL_isosurf_num_isosurfs");
1360 float *x1,
float *x2,
float *y1,
float *y2,
float *z1,
1361 float *z2,
int *dir)
1365 int cols, rows, depths;
1377 if (slice->
dir ==
X) {
1382 else if (slice->
dir ==
Y) {
1387 else if (slice->
dir ==
Z) {
1396 *x1 = slice->
x1 / (cols - 1);
1397 *x2 = slice->
x2 / (cols - 1);
1398 *y1 = slice->
y1 / (rows - 1);
1399 *y2 = slice->
y2 / (rows - 1);
1400 *z1 = slice->
z1 / (depths - 1);
1401 *z2 = slice->
z2 / (depths - 1);
1421 float x1,
float x2,
float y1,
float y2,
float z1,
1426 int cols, rows, depths;
1443 else if (dir ==
Y) {
1448 else if (dir ==
Z) {
1457 slice->
x1 = ((x1 < 0.) ? 0. : ((x1 > 1.) ? 1. : x1)) * (cols - 1);
1458 slice->
x2 = ((x2 < 0.) ? 0. : ((x2 > 1.) ? 1. : x2)) * (cols - 1);
1459 slice->
y1 = ((y1 < 0.) ? 0. : ((y1 > 1.) ? 1. : y1)) * (rows - 1);
1460 slice->
y2 = ((y2 < 0.) ? 0. : ((y2 > 1.) ? 1. : y2)) * (rows - 1);
1461 slice->
z1 = ((z1 < 0.) ? 0. : ((z1 > 1.) ? 1. : z1)) * (depths - 1);
1462 slice->
z2 = ((z2 < 0.) ? 0. : ((z2 > 1.) ? 1. : z2)) * (depths - 1);
void Rast3d_init_defaults(void)
Initializes the default values described in RASTER3D Defaults. Applications have to use this function...
geovol * gvl_get_vol(int)
Get volume set structure.
int GVL_get_trans(int id, float *xtrans, float *ytrans, float *ztrans)
Get trans ?
int gvl_file_newh(const char *, IFLAG)
Get handle for given file name and type.
int GVL_slice_move_down(int id, int slice_id)
Move down slice.
int gvl_num_vols(void)
Get number of loaded volume sets.
void GVL_set_trans(int id, float xtrans, float ytrans, float ztrans)
Set trans ?
geovol_slice * gvl_slice_get_slice(int, int)
Get geovol_slice struct.
void GS_set_focus(float *)
Set focus.
int GVL_slice_get_drawmode(int id, int *mode)
Get slice draw mode.
void GVL_alldraw_wire(void)
Draw all volume sets in wire mode.
int GVL_isosurf_del(int id, int isosurf_id)
Delete isosurface.
int GVL_isosurf_unset_att(int id, int isosurf_id, int att)
Unset isosurface attributes.
void GVL_init_region(void)
Initialize 3D region.
geovol_isosurf * gvl_isosurf_get_isosurf(int, int)
Get isosurface of given volume set.
int gvl_isosurf_set_att_map(geovol_isosurf *, int, const char *)
Set attribute map.
int GVL_new_vol(void)
Create new volume set.
int GVL_load_vol(int id, const char *filename)
Load 3d raster map to volume set.
int GVL_isosurf_set_flags(int id, int isosurf_id, int inout)
Set isosurface flags.
int GVL_isosurf_set_drawres(int id, int xres, int yres, int zres)
Set isosurface draw resolution.
int GVL_slice_move_up(int id, int slice_id)
Move up slice.
int GVL_num_vols(void)
Get number of loaded volume sets.
void G_free(void *)
Free allocated memory.
void gvl_delete_vol(int)
Remove volume set from list.
geovol_isosurf * isosurf[MAX_ISOSURFS]
int gvl_isosurf_set_att_changed(geovol_isosurf *, int)
Set attribute changed.
int GVL_isosurf_add(int id)
Add isosurface.
int gvl_slice_freemem(geovol_slice *)
Free geovol_slice struct.
int GVL_isosurf_get_att(int id, int isosurf_id, int att, int *set, float *constant, char *mapname)
Get isosurface attributes.
int GVL_get_volname(int id, char *filename)
Get volume set name.
int GVL_isosurf_set_drawmode(int id, int mode)
Set isosurface draw mode.
int GVL_slice_del(int id, int slice_id)
Delete slice.
int GVL_slice_num_slices(int id)
Get number or slices.
int GVL_isosurf_move_up(int id, int isosurf_id)
Move up isosurface in list.
void GVL_draw_wire(int id)
Draw volume in wire mode.
void G_message(const char *,...) __attribute__((format(printf
int gvl_init_vol(geovol *, double, double, double, int, int, int, double, double, double)
Initialize geovol structure.
int GVL_isosurf_get_drawmode(int id, int *mode)
Get isosurface draw mode.
int gvl_isosurf_set_att_const(geovol_isosurf *, int, float)
Set isosurface attribute constant.
int GVL_isosurf_set_maskmode(int id, int isosurf_id, int mode)
Set mask attribute mode.
int GVL_slice_set_pos(int id, int slice_id, float x1, float x2, float y1, float y2, float z1, float z2, int dir)
Get slice position.
int GVL_isosurf_set_att_map(int id, int isosurf_id, int att, const char *filename)
Set isosurface map attribute.
void GVL_isosurf_get_drawres(int id, int *xres, int *yres, int *zres)
Get draw resolution for isosurface.
int GVL_isosurf_get_maskmode(int id, int isosurf_id, int *mode)
Get isosurface mask mode.
int gvld_wire_vol(geovol *)
Draw volume in wire mode (bounding box)
int GVL_slice_set_drawmode(int id, int mode)
Set slice draw mode.
int GVL_get_region(float *n, float *s, float *w, float *e, float *t, float *b)
Get region extent settings.
geovol_isosurf_att att[MAX_ATTS]
int gvl_isosurf_freemem(geovol_isosurf *)
Free geovol_isosurf struct.
char * gvl_file_get_name(int)
Get file name for given handle.
int GVL_vol_exists(int id)
Check if volume set exists.
int GVL_Set_ClientData(int id, void *clientd)
Set client data for volume set.
int GVL_isosurf_set_att_const(int id, int isosurf_id, int att, float constant)
Set constant isosurface attribute.
geovol_slice * slice[MAX_SLICES]
int GVL_slice_add(int id)
Add slice.
int Rast3d_read_window(RASTER3D_Region *, const char *)
Reads window from the file specified by windowName. The name is converted by the rules defined in win...
int GVL_isosurf_num_isosurfs(int id)
Get number of available isosurfaces.
void * GVL_get_window()
Get window.
void GVL_slice_get_drawres(int id, int *xres, int *yres, int *zres)
Get draw resolution of slice.
int GVL_isosurf_get_flags(int id, int isosurf_id, int *inout)
Get isosurface flags.
void GVL_alldraw_vol(void)
Draw all volume sets.
void GVL_set_draw_wire(int id, int draw_wire)
Set drawing wire box.
void GVL_draw_vol(int vid)
Draw volume set.
int gvl_slice_init(geovol_slice *)
Initialize geovol_slice struct.
int gvl_isosurf_get_att_src(geovol_isosurf *, int)
Get attribute source.
int GVL_slice_get_transp(int id, int slice_id, int *transp)
Get slice trans ?
int gvl_isosurf_init(geovol_isosurf *)
Initialize geovol_isosurf struct.
int GVL_slice_get_pos(int id, int slice_id, float *x1, float *x2, float *y1, float *y2, float *z1, float *z2, int *dir)
Get slice position.
void GVL_get_dims(int id, int *rows, int *cols, int *depths)
Get volume dimensions.
void GVL_set_focus_center_map(int id)
Set focus on map center.
int GVL_delete_vol(int id)
Delete volume set from list.
int gvld_vol(geovol *)
Draw volume set (slices and isosurfaces)
int gvld_wind3_box(geovol *)
Draw volume bounding box.
void GVL_libinit(void)
Library initialization for volumes.
#define VOL_FTYPE_RASTER3D
int * GVL_get_vol_list(int *numvols)
Get list of loaded volume sets.
geovol * gvl_get_new_vol(void)
Allocate new volume set and add it to the list.
int G_debug(int, const char *,...) __attribute__((format(printf
int GVL_isosurf_move_down(int id, int isosurf_id)
Move down isosurface in list.
int GVL_slice_set_transp(int id, int slice_id, int transp)
Set slice trans ?
int GVL_slice_set_drawres(int id, int xres, int yres, int zres)
Set slice draw resolution.
void * GVL_Get_ClientData(int id)
Get client data.
void Rast3d_get_window(RASTER3D_Region *)
Stores the current default window in window.
int gvl_isosurf_set_att_src(geovol_isosurf *, int, int)
Set attribute source.