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) {
320 G_debug(3,
"GVL_get_dims() id=%d, rows=%d, cols=%d, depths=%d",
325 "GVL_get_dims(): Attempted to access a null volume structure "
392 G_debug(3,
"GVL_set_draw_wire");
433 G_debug(3,
"GVL_draw_wire(): id=%d",
id);
451 for (
id = 0;
id < Next_vol;
id++) {
465 for (
id = 0;
id < Next_vol;
id++) {
527 G_debug(3,
"GS_set_focus_center_map");
532 center[
X] = (gvl->
xmax - gvl->
xmin) / 2.;
533 center[
Y] = (gvl->
ymax - gvl->
ymin) / 2.;
534 center[
Z] = (gvl->
zmax - gvl->
zmin) / 2.;
559 G_debug(3,
"GVL_isosurf_get_drawres");
586 G_debug(3,
"GVL_isosurf_set_drawres(): id=%d",
id);
588 if (xres < 1 || yres < 1 || zres < 1) {
646 G_debug(3,
"GVL_isosurf_set_drawmode(): id=%d mode=%d",
id, mode);
672 G_debug(3,
"GVL_isosurf_add() id=%d",
id);
725 for (i = isosurf_id + 1; i < gvl->
n_isosurfs; i++) {
748 G_debug(3,
"GVL_isosurf_move_up");
755 if (isosurf_id < 0 || isosurf_id > (gvl->
n_isosurfs - 1))
761 tmp = gvl->
isosurf[isosurf_id - 1];
763 gvl->
isosurf[isosurf_id] = tmp;
782 G_debug(3,
"GVL_isosurf_move_up");
789 if (isosurf_id < 0 || isosurf_id > (gvl->
n_isosurfs - 1))
795 tmp = gvl->
isosurf[isosurf_id + 1];
797 gvl->
isosurf[isosurf_id] = tmp;
816 float *constant,
char *mapname)
821 G_debug(3,
"GVL_isosurf_get_att");
859 G_debug(3,
"GVL_isosurf_unset_att");
895 "GVL_isosurf_set_att_const() id=%d isosurf_id=%d "
897 id, isosurf_id, att, constant);
929 const char *filename)
934 "GVL_isosurf_set_att_map(): id=%d, isosurf_id=%d "
936 id, isosurf_id, att, filename);
961 G_debug(3,
"GVL_isosurf_get_flags");
987 G_debug(3,
"GVL_isosurf_get_flags");
1012 G_debug(3,
"GVL_isosurf_num_isosurfs");
1039 G_debug(3,
"GVL_isosurf_set_att_const");
1092 G_debug(3,
"GVL_slice_get_drawres");
1119 G_debug(3,
"GVL_slice_set_drawres(): id=%d",
id);
1121 if (xres < 1 || yres < 1 || zres < 1) {
1132 for (i = 0; i < gvl->
n_slices; i++) {
1179 G_debug(3,
"GVL_slice_set_drawmode(): id=%d, mode=%d",
id, mode);
1257 for (i = slice_id + 1; i < gvl->
n_slices; i++) {
1280 G_debug(3,
"GVL_slice_move_up");
1287 if (slice_id < 0 || slice_id > (gvl->
n_slices - 1))
1293 tmp = gvl->
slice[slice_id - 1];
1294 gvl->
slice[slice_id - 1] = gvl->
slice[slice_id];
1295 gvl->
slice[slice_id] = tmp;
1314 G_debug(3,
"GVL_slice_move_up");
1321 if (slice_id < 0 || slice_id > (gvl->
n_slices - 1))
1324 if (slice_id == (gvl->
n_slices - 1))
1327 tmp = gvl->
slice[slice_id + 1];
1328 gvl->
slice[slice_id + 1] = gvl->
slice[slice_id];
1329 gvl->
slice[slice_id] = tmp;
1346 G_debug(3,
"GVL_isosurf_num_isosurfs");
1370 float *y2,
float *z1,
float *z2,
int *dir)
1374 int cols, rows, depths;
1386 if (slice->
dir ==
X) {
1391 else if (slice->
dir ==
Y) {
1396 else if (slice->
dir ==
Z) {
1405 *x1 = slice->
x1 / (cols - 1);
1406 *x2 = slice->
x2 / (cols - 1);
1407 *y1 = slice->
y1 / (rows - 1);
1408 *y2 = slice->
y2 / (rows - 1);
1409 *z1 = slice->
z1 / (depths - 1);
1410 *z2 = slice->
z2 / (depths - 1);
1430 float y2,
float z1,
float z2,
int dir)
1434 int cols, rows, depths;
1451 else if (dir ==
Y) {
1456 else if (dir ==
Z) {
1465 slice->
x1 = ((x1 < 0.) ? 0. : ((x1 > 1.) ? 1. : x1)) * (cols - 1);
1466 slice->
x2 = ((x2 < 0.) ? 0. : ((x2 > 1.) ? 1. : x2)) * (cols - 1);
1467 slice->
y1 = ((y1 < 0.) ? 0. : ((y1 > 1.) ? 1. : y1)) * (rows - 1);
1468 slice->
y2 = ((y2 < 0.) ? 0. : ((y2 > 1.) ? 1. : y2)) * (rows - 1);
1469 slice->
z1 = ((z1 < 0.) ? 0. : ((z1 > 1.) ? 1. : z1)) * (depths - 1);
1470 slice->
z2 = ((z2 < 0.) ? 0. : ((z2 > 1.) ? 1. : z2)) * (depths - 1);
void G_free(void *)
Free allocated memory.
void G_message(const char *,...) __attribute__((format(printf
int G_debug(int, const char *,...) __attribute__((format(printf
int gvl_file_newh(const char *, IFLAG)
Get handle for given file name and type.
int gvl_slice_freemem(geovol_slice *)
Free geovol_slice struct.
char * gvl_file_get_name(int)
Get file name for given handle.
int gvl_isosurf_set_att_map(geovol_isosurf *, int, const char *)
Set attribute map.
int gvl_slice_init(geovol_slice *)
Initialize geovol_slice struct.
int gvld_vol(geovol *)
Draw volume set (slices and isosurfaces)
geovol * gvl_get_vol(int)
Get volume set structure.
geovol_isosurf * gvl_isosurf_get_isosurf(int, int)
Get isosurface of given volume set.
int gvl_isosurf_set_att_changed(geovol_isosurf *, int)
Set attribute changed.
int gvl_isosurf_init(geovol_isosurf *)
Initialize geovol_isosurf struct.
int gvl_isosurf_set_att_const(geovol_isosurf *, int, float)
Set isosurface attribute constant.
void GS_set_focus(float *)
Set focus.
int gvl_isosurf_set_att_src(geovol_isosurf *, int, int)
Set attribute source.
int gvl_isosurf_freemem(geovol_isosurf *)
Free geovol_isosurf struct.
int gvld_wire_vol(geovol *)
Draw volume in wire mode (bounding box)
geovol_slice * gvl_slice_get_slice(int, int)
Get geovol_slice struct.
geovol * gvl_get_new_vol(void)
Allocate new volume set and add it to the list.
int gvld_wind3_box(geovol *)
Draw volume bounding box.
int gvl_isosurf_get_att_src(geovol_isosurf *, int)
Get attribute source.
void gvl_delete_vol(int)
Remove volume set from list.
int gvl_init_vol(geovol *, double, double, double, int, int, int, double, double, double)
Initialize geovol structure.
int gvl_num_vols(void)
Get number of loaded volume sets.
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...
void Rast3d_init_defaults(void)
Initializes the default values described in RASTER3D Defaults. Applications have to use this function...
void Rast3d_get_window(RASTER3D_Region *)
Stores the current default window in window.
int GVL_slice_get_drawmode(int id, int *mode)
Get slice draw mode.
int GVL_isosurf_unset_att(int id, int isosurf_id, int att)
Unset isosurface attributes.
int GVL_isosurf_get_flags(int id, int isosurf_id, int *inout)
Get isosurface flags.
int GVL_isosurf_num_isosurfs(int id)
Get number of available isosurfaces.
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_draw_wire(int id)
Draw volume in wire 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_slice_move_down(int id, int slice_id)
Move down slice.
int GVL_isosurf_get_att(int id, int isosurf_id, int att, int *set, float *constant, char *mapname)
Get isosurface attributes.
int GVL_slice_num_slices(int id)
Get number or slices.
int GVL_load_vol(int id, const char *filename)
Load 3d raster map to volume set.
void GVL_isosurf_get_drawres(int id, int *xres, int *yres, int *zres)
Get draw resolution for isosurface.
int GVL_slice_set_transp(int id, int slice_id, int transp)
Set slice trans ?
void * GVL_get_window(void)
Get window.
int GVL_isosurf_set_att_const(int id, int isosurf_id, int att, float constant)
Set constant isosurface attribute.
int GVL_slice_set_drawres(int id, int xres, int yres, int zres)
Set slice draw resolution.
int GVL_isosurf_set_drawmode(int id, int mode)
Set isosurface draw mode.
void GVL_slice_get_drawres(int id, int *xres, int *yres, int *zres)
Get draw resolution of slice.
int GVL_get_volname(int id, char *filename)
Get volume set name.
int GVL_isosurf_set_flags(int id, int isosurf_id, int inout)
Set isosurface flags.
int GVL_slice_move_up(int id, int slice_id)
Move up slice.
int GVL_isosurf_set_drawres(int id, int xres, int yres, int zres)
Set isosurface draw resolution.
int GVL_isosurf_set_maskmode(int id, int isosurf_id, int mode)
Set mask attribute mode.
int GVL_delete_vol(int id)
Delete volume set from list.
int GVL_num_vols(void)
Get number of loaded volume sets.
int GVL_slice_get_transp(int id, int slice_id, int *transp)
Get slice trans ?
int GVL_isosurf_del(int id, int isosurf_id)
Delete isosurface.
void GVL_alldraw_vol(void)
Draw all volume sets.
int GVL_isosurf_move_up(int id, int isosurf_id)
Move up isosurface in list.
void GVL_alldraw_wire(void)
Draw all volume sets in wire mode.
int GVL_isosurf_add(int id)
Add isosurface.
void GVL_init_region(void)
Initialize 3D region.
int GVL_slice_set_drawmode(int id, int mode)
Set slice draw mode.
void GVL_libinit(void)
Library initialization for volumes.
int GVL_Set_ClientData(int id, void *clientd)
Set client data for volume set.
void GVL_set_focus_center_map(int id)
Set focus on map center.
int GVL_slice_add(int id)
Add slice.
void GVL_set_trans(int id, float xtrans, float ytrans, float ztrans)
Set trans ?
int GVL_get_trans(int id, float *xtrans, float *ytrans, float *ztrans)
Get trans ?
int GVL_slice_del(int id, int slice_id)
Delete slice.
int GVL_isosurf_move_down(int id, int isosurf_id)
Move down isosurface in list.
int GVL_isosurf_get_maskmode(int id, int isosurf_id, int *mode)
Get isosurface mask mode.
void GVL_set_draw_wire(int id, int draw_wire)
Set drawing wire box.
int GVL_get_region(float *n, float *s, float *w, float *e, float *t, float *b)
Get region extent settings.
int * GVL_get_vol_list(int *numvols)
Get list of loaded volume sets.
int GVL_isosurf_set_att_map(int id, int isosurf_id, int att, const char *filename)
Set isosurface map attribute.
int GVL_vol_exists(int id)
Check if volume set exists.
void GVL_get_dims(int id, int *rows, int *cols, int *depths)
Get volume dimensions.
int GVL_new_vol(void)
Create new volume set.
int GVL_isosurf_get_drawmode(int id, int *mode)
Get isosurface draw mode.
void * GVL_Get_ClientData(int id)
Get client data.
void GVL_draw_vol(int vid)
Draw volume set.
#define VOL_FTYPE_RASTER3D
geovol_slice * slice[MAX_SLICES]
geovol_isosurf * isosurf[MAX_ISOSURFS]
geovol_isosurf_att att[MAX_ATTS]