GRASS GIS 8 Programmer's Manual  8.5.0dev(2024)-d6dec75dd4
gv2.c File Reference

OGSF library - loading and manipulating vector sets (higher level functions) More...

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

Go to the source code of this file.

Functions

int GV_vect_exists (int id)
 Check if vector set exists. More...
 
int GV_new_vector (void)
 Register new vector set. More...
 
int GV_num_vects (void)
 Get number of available vector sets. More...
 
int * GV_get_vect_list (int *numvects)
 Get list of vector sets. More...
 
int GV_delete_vector (int id)
 Delete vector set from list. More...
 
int GV_load_vector (int id, const char *filename)
 Load vector set. More...
 
int GV_get_vectname (int id, char **filename)
 Get vector map name. More...
 
int GV_set_style (int id, int mem, int color, int width, int use_z)
 Set vector style. More...
 
int GV_get_style (int id, int *mem, int *color, int *width, int *use_z)
 Get vector style. More...
 
int GV_set_style_thematic (int id, int layer, const char *color, const char *width, struct Colors *color_rules)
 Set vector set style for thematic mapping. More...
 
int GV_unset_style_thematic (int id)
 Make style for thematic mapping inactive. More...
 
void GV_set_trans (int id, float xtrans, float ytrans, float ztrans)
 Set trans ? More...
 
int GV_get_trans (int id, float *xtrans, float *ytrans, float *ztrans)
 Get trans ? More...
 
int GV_select_surf (int hv, int hs)
 Select surface identified by hs to have vector identified by hv draped over it. More...
 
int GV_unselect_surf (int hv, int hs)
 Unselect surface. More...
 
int GV_surf_is_selected (int hv, int hs)
 Check if surface is selected. More...
 
void GV_draw_vect (int vid)
 Draw vector set. More...
 
void GV_alldraw_vect (void)
 Draw all loaded vector sets. More...
 
void GV_draw_fastvect (int vid)
 Draw vector set (fast mode) More...
 
void GV_alldraw_fastvect (void)
 Draw all loaded vector sets (fast mode) More...
 
int GV_Set_ClientData (int id, void *clientd)
 Set client data. More...
 
void * GV_Get_ClientData (int id)
 Get client data. More...
 

Detailed Description

OGSF library - loading and manipulating vector sets (higher level functions)

(C) 1999-2008, 2011 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 USACERL, GMSL/University of Illinois
Updated by Martin landa <landa.martin gmail.com> (doxygenized in May 2008, thematic mapping in June 2011)

Definition in file gv2.c.

Function Documentation

◆ GV_alldraw_fastvect()

void GV_alldraw_fastvect ( void  )

Draw all loaded vector sets (fast mode)

Definition at line 548 of file gv2.c.

◆ GV_alldraw_vect()

void GV_alldraw_vect ( void  )

Draw all loaded vector sets.

Definition at line 506 of file gv2.c.

Referenced by Nviz_draw_all_vect().

◆ GV_delete_vector()

int GV_delete_vector ( int  id)

Delete vector set from list.

Parameters
idvector set id
Returns
1 on success
-1 on error

Definition at line 129 of file gv2.c.

References G_debug(), gv_delete_vect(), and GV_vect_exists().

◆ GV_draw_fastvect()

void GV_draw_fastvect ( int  vid)

Draw vector set (fast mode)

Todo:
Seems to be broken, nothing is drawn
Parameters
vidvector set id

Definition at line 524 of file gv2.c.

References g_vect::drape_surf_id, gs_get_surf(), gv_get_vect(), gvd_vect(), and g_vect::n_surfs.

◆ GV_draw_vect()

void GV_draw_vect ( int  vid)

Draw vector set.

Parameters
vidvector set id

Definition at line 482 of file gv2.c.

References g_vect::drape_surf_id, gs_get_surf(), gv_get_vect(), gvd_vect(), and g_vect::n_surfs.

◆ GV_Get_ClientData()

void* GV_Get_ClientData ( int  id)

Get client data.

Parameters
idvector set id
Returns
pointer to client data
NULL on error

Definition at line 590 of file gv2.c.

References g_vect::clientdata, gv_get_vect(), and NULL.

◆ GV_get_style()

int GV_get_style ( int  id,
int *  mem,
int *  color,
int *  width,
int *  use_z 
)

Get vector style.

Parameters
idvector set id
[out]memnon-zero for use memory
[out]colorcolor value
[out]widthline width
[out]use_znon-zero for 3d mode
Returns
-1 on error (invalid vector set id)
1 on success

Definition at line 257 of file gv2.c.

◆ GV_get_trans()

int GV_get_trans ( int  id,
float *  xtrans,
float *  ytrans,
float *  ztrans 
)

Get trans ?

Parameters
idvector set id
[out]xtrans,ytrans,ztransx/y/z trans values

Definition at line 366 of file gv2.c.

References gv_get_vect(), g_vect::x_trans, g_vect::y_trans, and g_vect::z_trans.

◆ GV_get_vect_list()

int* GV_get_vect_list ( int *  numvects)

Get list of vector sets.

Must free when no longer needed!

Parameters
numvectsnumber of vector sets
Returns
pointer to list of point sets
NULL on error

Definition at line 99 of file gv2.c.

◆ GV_get_vectname()

int GV_get_vectname ( int  id,
char **  filename 
)

Get vector map name.

Note: char array is allocated by G_store()

Parameters
idvector set id
filename&filename
Returns
-1 on error (invalid vector set id)
1 on success

Definition at line 204 of file gv2.c.

◆ GV_load_vector()

int GV_load_vector ( int  id,
const char *  filename 
)

Load vector set.

Check to see if handle already loaded, if so - free before loading new for now, always load to memory

Todo:
Load file handle & ready for reading instead of using memory
Parameters
idvector set id
filenamefilename
Returns
-1 on error (invalid vector set id)
1 on success

Definition at line 172 of file gv2.c.

◆ GV_new_vector()

int GV_new_vector ( void  )

Register new vector set.

Returns
vector set id
-1 on error

Definition at line 61 of file gv2.c.

◆ GV_num_vects()

int GV_num_vects ( void  )

Get number of available vector sets.

Returns
number of vector sets

Definition at line 84 of file gv2.c.

References gv_num_vects().

◆ GV_select_surf()

int GV_select_surf ( int  hv,
int  hs 
)

Select surface identified by hs to have vector identified by hv draped over it.

Parameters
hvvector set id
hssurface id
Returns
1 on success
-1 on error

Definition at line 393 of file gv2.c.

References g_vect::drape_surf_id, GS_surf_exists(), gv_get_vect(), GV_surf_is_selected(), and g_vect::n_surfs.

◆ GV_Set_ClientData()

int GV_Set_ClientData ( int  id,
void *  clientd 
)

Set client data.

Parameters
idvector set id
clientdpointer to client data
Returns
1 on success
-1 on error

Definition at line 568 of file gv2.c.

References g_vect::clientdata, and gv_get_vect().

◆ GV_set_style()

int GV_set_style ( int  id,
int  mem,
int  color,
int  width,
int  use_z 
)

Set vector style.

Parameters
idvector set id
memnon-zero for use memory
colorcolor value
widthline width
use_znon-zero for 3d mode
Returns
-1 on error (invalid vector set id)
1 on success

Definition at line 229 of file gv2.c.

◆ GV_set_style_thematic()

int GV_set_style_thematic ( int  id,
int  layer,
const char *  color,
const char *  width,
struct Colors color_rules 
)

Set vector set style for thematic mapping.

Updates also style for each geoline.

Parameters
idvector set id
layerlayer number for thematic mapping
colorcolor column name
widthwidth column name
colorspointer to Colors structure or NULL
Returns
1 on success
-1 on error (point set not found)

Definition at line 287 of file gv2.c.

◆ GV_set_trans()

void GV_set_trans ( int  id,
float  xtrans,
float  ytrans,
float  ztrans 
)

Set trans ?

Parameters
idvector set id
xtrans,ytrans,ztransx/y/z trans values

Definition at line 343 of file gv2.c.

References G_debug(), gv_get_vect(), g_vect::x_trans, g_vect::y_trans, and g_vect::z_trans.

◆ GV_surf_is_selected()

int GV_surf_is_selected ( int  hv,
int  hs 
)

Check if surface is selected.

Parameters
hvvector set id
hssurface id
Returns
1 selected
0 not selected

Definition at line 459 of file gv2.c.

References g_vect::drape_surf_id, gv_get_vect(), and g_vect::n_surfs.

Referenced by GV_select_surf(), and GV_unselect_surf().

◆ GV_unselect_surf()

int GV_unselect_surf ( int  hv,
int  hs 
)

Unselect surface.

Parameters
hvvector set id
hssurface id
Returns
1 on success
-1 on error

Definition at line 422 of file gv2.c.

References g_vect::drape_surf_id, gv_get_vect(), GV_surf_is_selected(), and g_vect::n_surfs.

◆ GV_unset_style_thematic()

int GV_unset_style_thematic ( int  id)

Make style for thematic mapping inactive.

Parameters
idvector set id
Returns
1 on success
-1 on error (point set not found)

Definition at line 320 of file gv2.c.

References g_vect_style_thematic::active, G_debug(), gv_get_vect(), NULL, and g_vect::tstyle.

◆ GV_vect_exists()

int GV_vect_exists ( int  id)

Check if vector set exists.

Parameters
idvector set id
Returns
0 not found
1 found

Definition at line 36 of file gv2.c.

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

Referenced by GV_delete_vector().