Loading...
Searching...
No Matches
gvl.c File Reference

OGSF library - loading and manipulating volumes (lower level functions). More...

`#include <stdlib.h>`
`#include <grass/gis.h>`
`#include <grass/ogsf.h>`
`#include "gsget.h"`
Include dependency graph for gvl.c:

Go to the source code of this file.

## Macros

#define | FIRST_VOL_ID 81721

## Functions

geovol * | gvl_get_vol (int id)
| Get volume set structure.
geovol * | gvl_get_prev_vol (int id)
| Get previous volume.
int | gvl_getall_vols (geovol **gvols)
| Get all volumes.
int | gvl_num_vols (void)
| Get number of loaded volume sets.
geovol * | gvl_get_last_vol (void)
| Get last volume set from the list.
geovol * | gvl_get_new_vol (void)
| Allocate new volume set and add it to the list.
int | gvl_init_vol (geovol *gvl, double ox, double oy, double oz, int rows, int cols, int depths, double xres, double yres, double zres)
| Initialize geovol structure.
void | gvl_delete_vol (int id)
| Remove volume set from list.
int | gvl_free_vol (geovol *fvl)
| Free geovol struct.
void | gvl_free_volmem (geovol *fvl)
| Free geovol struct memory.
void | print_vol_fields (geovol *gvl)
| Debug volume fields.
int | gvl_get_xextents (geovol *gvl, float *min, float *max)
| Get volume x-extent value.
int | gvl_get_yextents (geovol *gvl, float *min, float *max)
| Get volume y-extent value.
int | gvl_get_zextents (geovol *gvl, float *min, float *max)
| Get volume z-extent value.
int | gvl_get_xrange (float *min, float *max)
| Get volume x-range value.
int | gvl_get_yrange (float *min, float *max)
| Get volume y-range value.
int | gvl_get_zrange (float *min, float *max)
| Get volume z-range value.
int | gvl_isosurf_init (geovol_isosurf *isosurf)
| Initialize geovol_isosurf struct.
int | gvl_isosurf_freemem (geovol_isosurf *isosurf)
| Free geovol_isosurf struct.
geovol_isosurf * | gvl_isosurf_get_isosurf (int id, int isosurf_id)
| Get isosurface of given volume set.
int | gvl_isosurf_get_att_src (geovol_isosurf *isosurf, int desc)
| Get attribute source.
int | gvl_isosurf_set_att_src (geovol_isosurf *isosurf, int desc, int src)
| Set attribute source.
int | gvl_isosurf_set_att_const (geovol_isosurf *isosurf, int desc, float constant)
| Set isosurface attribute constant.
int | gvl_isosurf_set_att_map (geovol_isosurf *isosurf, int desc, const char *filename)
| Set attribute map.
int | gvl_isosurf_set_att_changed (geovol_isosurf *isosurf, int desc)
| Set attribute changed.
int | gvl_slice_init (geovol_slice *slice)
| Initialize geovol_slice struct.
int | gvl_slice_freemem (geovol_slice *slice)
| Free geovol_slice struct.
geovol_slice * | gvl_slice_get_slice (int id, int slice_id)
| Get geovol_slice struct.

## Detailed Description

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.

Author
  Bill Brown, UI-GMSL (May 1997)
  Tomas Paudits (February 2004)
  Doxygenized by Martin Landa <landa.martin gmail.com> (May 2008)

Definition in file gvl.c.

## Macro Definition Documentation

## FIRST_VOL_ID

#define FIRST_VOL_ID 81721

Definition at line 28 of file gvl.c.

Referenced by gvl_get_new_vol().

## Function Documentation

## gvl_delete_vol()

void gvl_delete_vol | ( | int | id | ) |

Remove volume set from list.

Parameters

  id | volume set id

Definition at line 244 of file gvl.c.

References G_debug(), gvl_free_vol(), and gvl_get_vol().

Referenced by GVL_delete_vol().

## gvl_free_vol()

int gvl_free_vol | ( | geovol * | fvl | ) |

Free geovol struct.

Parameters

  fvl | pointer to geovol struct

Returns
  -1 on failure
  1 on success

Definition at line 267 of file gvl.c.

References G_debug(), G_free(), gvl_free_volmem(), and NULL.

Referenced by gvl_delete_vol().

## gvl_free_volmem()

void gvl_free_volmem | ( | geovol * | fvl | ) |

Free geovol struct memory.

Parameters

  fvl | pointer to geovol struct

Definition at line 316 of file gvl.c.

References gvl_file_free_datah().

Referenced by gvl_free_vol().

## gvl_get_last_vol()

geovol * gvl_get_last_vol | ( | void |  | ) |

Get last volume set from the list.

Returns
  pointer to geovol struct
  NULL on failure

Definition at line 124 of file gvl.c.

References G_debug(), and NULL.

Referenced by gvl_get_new_vol().

## gvl_get_new_vol()

geovol * gvl_get_new_vol | ( | void |  | ) |

Allocate new volume set and add it to the list.

Returns
  pointer to geovol struct
  NULL on failure

Definition at line 148 of file gvl.c.

References FIRST_VOL_ID, G_debug(), gvl_get_last_vol(), and NULL.

Referenced by GVL_new_vol().

## gvl_get_prev_vol()

geovol * gvl_get_prev_vol | ( | int | id | ) |

Get previous volume.

Parameters

  id | current volume set id

Returns
  pointer to geovol struct
  NULL on failure

Definition at line 64 of file gvl.c.

References G_debug(), and NULL.

## gvl_get_vol()

geovol * gvl_get_vol | ( | int | id | ) |

Get volume set structure.

Parameters

  id | volume set id

Returns
  pointer to geovol struct
  NULL on failure

Definition at line 40 of file gvl.c.

References G_debug(), and NULL.

Referenced by gvl_delete_vol(), GVL_draw_vol(), GVL_draw_wire(), GVL_Get_ClientData(), GVL_get_dims(), GVL_get_trans(), GVL_get_volname(), GVL_isosurf_add(), GVL_isosurf_del(), GVL_isosurf_get_drawmode(), GVL_isosurf_get_drawres(), gvl_isosurf_get_isosurf(), GVL_isosurf_move_down(), GVL_isosurf_move_up(), GVL_isosurf_num_isosurfs(), GVL_isosurf_set_drawmode(), GVL_isosurf_set_drawres(), GVL_load_vol(), GVL_Set_ClientData(), GVL_set_draw_wire(), GVL_set_focus_center_map(), GVL_set_trans(), GVL_slice_add(), GVL_slice_del(), GVL_slice_get_drawmode(), GVL_slice_get_drawres(), GVL_slice_get_pos(), gvl_slice_get_slice(), GVL_slice_move_down(), GVL_slice_move_up(), GVL_slice_num_slices(), GVL_slice_set_drawmode(), GVL_slice_set_drawres(), GVL_slice_set_pos(), and GVL_vol_exists().

## gvl_get_xextents()

int gvl_get_xextents | ( | geovol * | gvl,
|  | float * | min,
|  | float * | max )

Get volume x-extent value.

Parameters

  | gvl | pointer to geovol struct
  [out] | min | x-min value
  [out] | max | y-max value

Returns
  1

Definition at line 354 of file gvl.c.

References max, and min.

Referenced by gvl_get_xrange().

## gvl_get_xrange()

int gvl_get_xrange | ( | float * | min,
|  | float * | max )

Get volume x-range value.

Parameters

  [out] | min | x-min value
  [out] | max | x-max value

Returns
  1

Definition at line 404 of file gvl.c.

References gvl_get_xextents(), max, and min.

## gvl_get_yextents()

int gvl_get_yextents | ( | geovol * | gvl,
|  | float * | min,
|  | float * | max )

Get volume y-extent value.

Parameters

  | gvl | pointer to geovol struct
  [out] | min | y-min value
  [out] | max | y-max value

Returns
  1

Definition at line 371 of file gvl.c.

References max, and min.

Referenced by gvl_get_yrange().

## gvl_get_yrange()

int gvl_get_yrange | ( | float * | min,
|  | float * | max )

Get volume y-range value.

Parameters

  [out] | min | y-min value
  [out] | max | y-max value

Returns
  1

Definition at line 441 of file gvl.c.

References gvl_get_yextents(), max, and min.

## gvl_get_zextents()

int gvl_get_zextents | ( | geovol * | gvl,
|  | float * | min,
|  | float * | max )

Get volume z-extent value.

Parameters

  | gvl | pointer to geovol struct
  [out] | min | z-min value
  [out] | max | z-max value

Returns
  1

Definition at line 388 of file gvl.c.

References max, and min.

Referenced by gvl_get_zrange().

## gvl_get_zrange()

int gvl_get_zrange | ( | float * | min,
|  | float * | max )

Get volume z-range value.

Parameters

  [out] | min | z-min value
  [out] | max | z-max value

Returns
  1

Definition at line 478 of file gvl.c.

References gvl_get_zextents(), max, and min.

Referenced by GS_get_zrange().

## gvl_getall_vols()

int gvl_getall_vols | ( | geovol ** | gvols | ) |

Get all volumes.

Parameters

  [out] | gvols | list of geovol structs

Returns
  number of available volume sets

Definition at line 86 of file gvl.c.

References G_debug().

## gvl_init_vol()

int gvl_init_vol | ( | geovol * | gvl,
|  | double | ox,
|  | double | oy,
|  | double | oz,
|  | int | rows,
|  | int | cols,
|  | int | depths,
|  | double | xres,
|  | double | yres,
|  | double | zres )

Initialize geovol structure.

Parameters

  gvl | pointer to geovol struct
  ox,oy,oz |
  rows | number of rows
  cols | number of cols
  xres,yres,zres | x/y/z resolution value

Returns
  -1 on failure
  1 on success

Definition at line 187 of file gvl.c.

References G_debug(), G_zero(), and NULL.

Referenced by GVL_new_vol().

## gvl_isosurf_freemem()

int gvl_isosurf_freemem | ( | geovol_isosurf * | isosurf | ) |

Free geovol_isosurf struct.

Parameters

  isosurf | pointer to geovol_isosurf struct

Returns
  -1 on failure
  1 on success

Definition at line 553 of file gvl.c.

References G_debug(), G_free(), and gvl_isosurf_set_att_src().

Referenced by GVL_isosurf_del().

## gvl_isosurf_get_att_src()

int gvl_isosurf_get_att_src | ( | geovol_isosurf * | isosurf,
|  | int | desc )

Get attribute source.

Parameters

  isosurf | pointer to geovol_isosurf struct
  desc | attribute id

Returns
  -1 on failure
  attribute value

Definition at line 607 of file gvl.c.

References G_debug().

Referenced by GVL_isosurf_get_att(), and gvl_isosurf_set_att_src().

## gvl_isosurf_get_isosurf()

geovol_isosurf * gvl_isosurf_get_isosurf | ( | int | id,
|  | int | isosurf_id )

Get isosurface of given volume set.

Parameters

  id | volume set id
  isosurf_id | isosurface id (0 - MAX_ISOSURFS)

Returns
  pointer to geovol_isosurf struct
  NULL on failure

Definition at line 580 of file gvl.c.

References G_debug(), gvl_get_vol(), and NULL.

Referenced by GVL_isosurf_del(), GVL_isosurf_get_att(), GVL_isosurf_get_flags(), GVL_isosurf_get_maskmode(), GVL_isosurf_set_att_const(), GVL_isosurf_set_att_map(), GVL_isosurf_set_flags(), GVL_isosurf_set_maskmode(), and GVL_isosurf_unset_att().

## gvl_isosurf_init()

int gvl_isosurf_init | ( | geovol_isosurf * | isosurf | ) |

Initialize geovol_isosurf struct.

Parameters

  isosurf | pointer to geovol_isosurf struct

Returns
  -1 on failure
  1 on success

Definition at line 520 of file gvl.c.

References G_debug(), and NULL.

Referenced by GVL_isosurf_add().

## gvl_isosurf_set_att_changed()

int gvl_isosurf_set_att_changed | ( | geovol_isosurf * | isosurf,
|  | int | desc )

Set attribute changed.

Parameters

  isosurf | pointer to geovol_isosurf struct
  desc | attribute id

Returns
  -1 on failure
  1 on success

Definition at line 723 of file gvl.c.

References G_debug().

Referenced by gvl_isosurf_set_att_src(), and GVL_isosurf_set_drawres().

## gvl_isosurf_set_att_const()

int gvl_isosurf_set_att_const | ( | geovol_isosurf * | isosurf,
|  | int | desc,
|  | float | constant )

Set isosurface attribute constant.

Parameters

  isosurf | pointer to geovol_isosurf struct
  desc | attribute descriptor
  constant | attribute value

Returns
  -1 on failure
  1 on success

Definition at line 665 of file gvl.c.

References G_debug(), and gvl_isosurf_set_att_src().

Referenced by GVL_isosurf_set_att_const().

## gvl_isosurf_set_att_map()

int gvl_isosurf_set_att_map | ( | geovol_isosurf * | isosurf,
|  | int | desc,
|  | const char * | filename )

Set attribute map.

Parameters

  isosurf | pointer to geovol_isosurf struct
  desc | attribute id
  filename | filename

Returns
  -1 on failure
  1 on success

Definition at line 690 of file gvl.c.

References G_debug(), gvl_file_newh(), gvl_isosurf_set_att_src(), and Gvl_load_colors_data().

Referenced by GVL_isosurf_set_att_map().

## gvl_isosurf_set_att_src()

int gvl_isosurf_set_att_src | ( | geovol_isosurf * | isosurf,
|  | int | desc,
|  | int | src )

Set attribute source.

Parameters

  isosurf | pointer to geovol_isosurf struct
  desc | attribute id
  src | attribute value

Returns
  -1 on failure
  1 on success

Definition at line 632 of file gvl.c.

References G_debug(), gvl_file_free_datah(), gvl_isosurf_get_att_src(), gvl_isosurf_set_att_changed(), and Gvl_unload_colors_data().

Referenced by gvl_isosurf_freemem(), gvl_isosurf_set_att_const(), gvl_isosurf_set_att_map(), and GVL_isosurf_unset_att().

## gvl_num_vols()

int gvl_num_vols | ( | void |  | ) |

Get number of loaded volume sets.

Returns
  number of volumes

Definition at line 105 of file gvl.c.

References G_debug().

Referenced by GVL_num_vols().

## gvl_slice_freemem()

int gvl_slice_freemem | ( | geovol_slice * | slice | ) |

Free geovol_slice struct.

Parameters

  slice | pointer to geovol_slice struct

Returns
  -1 on failure
  1 on success

Definition at line 782 of file gvl.c.

References G_debug(), and G_free().

Referenced by GVL_slice_del().

## gvl_slice_get_slice()

geovol_slice * gvl_slice_get_slice | ( | int | id,
|  | int | slice_id )

Get geovol_slice struct.

Parameters

  id | volume set id
  slice_id | slice id

Returns
  pointer to geovol_slice struct
  NULL on failure

Definition at line 803 of file gvl.c.

References gvl_get_vol(), and NULL.

Referenced by GVL_slice_del(), GVL_slice_get_pos(), GVL_slice_get_transp(), GVL_slice_set_pos(), and GVL_slice_set_transp().

## gvl_slice_init()

int gvl_slice_init | ( | geovol_slice * | slice | ) |

Initialize geovol_slice struct.

Parameters

  slice | pointer to geovol_slice struct

Returns
  -1 on failure
  1 on success

Definition at line 756 of file gvl.c.

References G_debug(), and NULL.

Referenced by GVL_slice_add().

## print_vol_fields()

void print_vol_fields | ( | geovol * | gvl | ) |

Debug volume fields.

Parameters

  gvl | pointer to geovol struct

Definition at line 329 of file gvl.c.

References G_debug().