GRASS GIS 8 Programmer's Manual  8.2.2dev(2023)-3d2c704037
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

geovolgvl_get_vol (int id)
 Get volume set structure. More...
 
geovolgvl_get_prev_vol (int id)
 Get previous volume. More...
 
int gvl_getall_vols (geovol **gvols)
 Get all volumes. More...
 
int gvl_num_vols (void)
 Get number of loaded volume sets. More...
 
geovolgvl_get_last_vol (void)
 Get last volume set from the list. More...
 
geovolgvl_get_new_vol (void)
 Allocate new volume set and add it to the list. More...
 
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. More...
 
void gvl_delete_vol (int id)
 Remove volume set from list. More...
 
int gvl_free_vol (geovol *fvl)
 Free geovol struct. More...
 
void gvl_free_volmem (geovol *fvl)
 Free geovol struct memory. More...
 
void print_vol_fields (geovol *gvl)
 Debug volume fields. More...
 
int gvl_get_xextents (geovol *gvl, float *min, float *max)
 Get volume x-extent value. More...
 
int gvl_get_yextents (geovol *gvl, float *min, float *max)
 Get volume y-extent value. More...
 
int gvl_get_zextents (geovol *gvl, float *min, float *max)
 Get volume z-extent value. More...
 
int gvl_get_xrange (float *min, float *max)
 Get volume x-range value. More...
 
int gvl_get_yrange (float *min, float *max)
 Get volume y-range value. More...
 
int gvl_get_zrange (float *min, float *max)
 Get volume z-range value. More...
 
int gvl_isosurf_init (geovol_isosurf *isosurf)
 Initialize geovol_isosurf struct. More...
 
int gvl_isosurf_freemem (geovol_isosurf *isosurf)
 Free geovol_isosurf struct. More...
 
geovol_isosurfgvl_isosurf_get_isosurf (int id, int isosurf_id)
 Get isosurface of given volume set. More...
 
int gvl_isosurf_get_att_src (geovol_isosurf *isosurf, int desc)
 Get attribute source. More...
 
int gvl_isosurf_set_att_src (geovol_isosurf *isosurf, int desc, int src)
 Set attribute source. More...
 
int gvl_isosurf_set_att_const (geovol_isosurf *isosurf, int desc, float constant)
 Set isosurface attribute constant. More...
 
int gvl_isosurf_set_att_map (geovol_isosurf *isosurf, int desc, const char *filename)
 Set attribute map. More...
 
int gvl_isosurf_set_att_changed (geovol_isosurf *isosurf, int desc)
 Set attribute changed. More...
 
int gvl_slice_init (geovol_slice *slice)
 Initialize geovol_slice struct. More...
 
int gvl_slice_freemem (geovol_slice *slice)
 Free geovol_slice struct. More...
 
geovol_slicegvl_slice_get_slice (int id, int slice_id)
 Get geovol_slice struct. More...
 

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 27 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
idvolume set id

Definition at line 242 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
fvlpointer to geovol struct
Returns
-1 on failure
1 on success

Definition at line 265 of file gvl.c.

References G_debug(), G_free(), gvl_free_volmem(), g_vol::next, and NULL.

Referenced by gvl_delete_vol().

◆ gvl_free_volmem()

void gvl_free_volmem ( geovol fvl)

Free geovol struct memory.

Parameters
fvlpointer to geovol struct

Definition at line 314 of file gvl.c.

References gvl_file_free_datah(), and g_vol::hfile.

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 122 of file gvl.c.

References G_debug(), g_vol::gvol_id, g_vol::next, 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 145 of file gvl.c.

References FIRST_VOL_ID, G_debug(), G_malloc, gvl_get_last_vol(), g_vol::gvol_id, g_vol::next, and NULL.

◆ gvl_get_prev_vol()

geovol* gvl_get_prev_vol ( int  id)

Get previous volume.

Parameters
idcurrent volume set id
Returns
pointer to geovol struct
NULL on failure

Definition at line 63 of file gvl.c.

References G_debug(), g_vol::gvol_id, g_vol::next, and NULL.

◆ gvl_get_vol()

◆ gvl_get_xextents()

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

Get volume x-extent value.

Parameters
gvlpointer to geovol struct
[out]minx-min value
[out]maxy-max value
Returns
1

Definition at line 352 of file gvl.c.

References g_vol::x_trans, g_vol::xmax, and g_vol::xmin.

Referenced by gvl_get_xrange().

◆ gvl_get_xrange()

int gvl_get_xrange ( float *  min,
float *  max 
)

Get volume x-range value.

Parameters
[out]minx-min value
[out]maxx-max value
Returns
1

Definition at line 402 of file gvl.c.

References gvl_get_xextents(), and g_vol::next.

◆ gvl_get_yextents()

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

Get volume y-extent value.

Parameters
gvlpointer to geovol struct
[out]miny-min value
[out]maxy-max value
Returns
1

Definition at line 369 of file gvl.c.

References g_vol::y_trans, g_vol::ymax, and g_vol::ymin.

Referenced by gvl_get_yrange().

◆ gvl_get_yrange()

int gvl_get_yrange ( float *  min,
float *  max 
)

Get volume y-range value.

Parameters
[out]miny-min value
[out]maxy-max value
Returns
1

Definition at line 439 of file gvl.c.

References gvl_get_yextents(), and g_vol::next.

◆ gvl_get_zextents()

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

Get volume z-extent value.

Parameters
gvlpointer to geovol struct
[out]minz-min value
[out]maxz-max value
Returns
1

Definition at line 386 of file gvl.c.

References g_vol::z_trans, g_vol::zmax, and g_vol::zmin.

Referenced by gvl_get_zrange().

◆ gvl_get_zrange()

int gvl_get_zrange ( float *  min,
float *  max 
)

Get volume z-range value.

Parameters
[out]minz-min value
[out]maxz-max value
Returns
1

Definition at line 476 of file gvl.c.

References gvl_get_zextents(), and g_vol::next.

Referenced by GS_get_zrange().

◆ gvl_getall_vols()

int gvl_getall_vols ( geovol **  gvols)

Get all volumes.

Parameters
[out]listof geovol structs
Returns
number of available volume sets

Definition at line 85 of file gvl.c.

References G_debug(), and g_vol::next.

◆ 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 
)

◆ gvl_isosurf_freemem()

int gvl_isosurf_freemem ( geovol_isosurf isosurf)

Free geovol_isosurf struct.

Parameters
isosurfpointer to geovol_isosurf struct
Returns
-1 on failure
1 on success

Definition at line 551 of file gvl.c.

References geovol_isosurf::data, G_debug(), G_free(), gvl_isosurf_set_att_src(), MAX_ATTS, and NOTSET_ATT.

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
isosurfpointer to geovol_isosurf struct
descattribute id
Returns
-1 on failure
attribute value

Definition at line 605 of file gvl.c.

References geovol_isosurf::att, geovol_isosurf_att::att_src, G_debug(), and LEGAL_ATT.

◆ gvl_isosurf_get_isosurf()

geovol_isosurf* gvl_isosurf_get_isosurf ( int  id,
int  isosurf_id 
)

Get isosurface of given volume set.

Parameters
idvolume set id
isosurf_idisosurface id (0 - MAX_ISOSURFS)
Returns
pointer to geovol_isosurf struct
NULL on failure

Definition at line 578 of file gvl.c.

References G_debug(), gvl_get_vol(), g_vol::isosurf, g_vol::n_isosurfs, and NULL.

Referenced by GVL_isosurf_del(), GVL_isosurf_get_flags(), GVL_isosurf_set_att_const(), GVL_isosurf_set_flags(), and GVL_isosurf_unset_att().

◆ gvl_isosurf_init()

◆ gvl_isosurf_set_att_changed()

int gvl_isosurf_set_att_changed ( geovol_isosurf isosurf,
int  desc 
)

Set attribute changed.

Parameters
isosurfpointer to geovol_isosurf struct
descattribute id
Returns
-1 on failure
1 on success

Definition at line 723 of file gvl.c.

References geovol_isosurf::att, ATT_MASK, ATT_TOPO, geovol_isosurf_att::changed, G_debug(), LEGAL_ATT, and MAX_ATTS.

Referenced by 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
isosurfpointer to geovol_isosurf struct
descattribute descriptor
constantattribute value
Returns
-1 on failure
1 on success

Definition at line 663 of file gvl.c.

References geovol_isosurf::att, CONST_ATT, geovol_isosurf_att::constant, 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
isosurfpointer to geovol_isosurf struct
descattribute id
filenamefilename
Returns
-1 on failure
1 on success

Definition at line 690 of file gvl.c.

◆ gvl_isosurf_set_att_src()

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

Set attribute source.

Parameters
isosurfpointer to geovol_isosurf struct
descattribute id
srcattribute value
Returns
-1 on failure
1 on success

Definition at line 630 of file gvl.c.

Referenced by gvl_isosurf_freemem(), gvl_isosurf_set_att_const(), 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 104 of file gvl.c.

References G_debug(), and g_vol::next.

Referenced by GVL_num_vols().

◆ gvl_slice_freemem()

int gvl_slice_freemem ( geovol_slice slice)

Free geovol_slice struct.

Parameters
slicepointer to geovol_slice struct
Returns
-1 on failure
1 on success

Definition at line 782 of file gvl.c.

◆ gvl_slice_get_slice()

geovol_slice* gvl_slice_get_slice ( int  id,
int  slice_id 
)

Get geovol_slice struct.

Parameters
idvolume set id
slice_idslice id
Returns
pointer to geovol_slice struct
NULL on failure

Definition at line 803 of file gvl.c.

References gvl_get_vol(), g_vol::n_slices, NULL, and g_vol::slice.

◆ gvl_slice_init()

int gvl_slice_init ( geovol_slice slice)

Initialize geovol_slice struct.

Parameters
slicepointer to geovol_slice struct
Returns
-1 on failure
1 on success

Definition at line 756 of file gvl.c.

◆ print_vol_fields()

void print_vol_fields ( geovol gvl)