GRASS Programmer's Manual  6.5.svn(2014)-r66266
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
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/gstypes.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...
 
intGV_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_vectmode (int id, int mem, int color, int width, int flat)
 Set vector set mode. More...
 
int GV_get_vectmode (int id, int *mem, int *color, int *width, int *flat)
 Get vector set mode. 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 vector sets. More...
 
void GV_draw_fastvect (int vid)
 Draw vector sets. 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)

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 USACERL, GMSL/University of Illinois
Doxygenized by Martin Landa <landa.martin gmail.com>

Definition in file GV2.c.

Function Documentation

void GV_alldraw_vect ( void  )

Draw all vector sets.

Definition at line 444 of file GV2.c.

References GV_draw_vect(), and tools::id.

Referenced by gk_follow_frames(), GK_show_vect(), Nviz_draw_all_vect(), and Nviz_draw_quick().

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 131 of file GV2.c.

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

Referenced by Nviz_new_map_obj(), and wxnviz.Nviz::UnloadVector().

void GV_draw_fastvect ( int  vid)

Draw vector sets.

Parameters
vidvector set id

Definition at line 460 of file GV2.c.

References gs_get_surf(), gv_get_vect(), and gvd_vect().

void GV_draw_vect ( int  vid)

Draw vector set.

Parameters
vidvector set id

Definition at line 420 of file GV2.c.

References gs_get_surf(), gv_get_vect(), and gvd_vect().

Referenced by GV_alldraw_vect().

void* GV_Get_ClientData ( int  id)

Get client data.

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

Definition at line 512 of file GV2.c.

References gv_get_vect(), and NULL.

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 304 of file GV2.c.

References gv_get_vect().

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 101 of file GV2.c.

References NULL.

int GV_get_vectmode ( int  id,
int mem,
int color,
int width,
int flat 
)

Get vector set mode.

Parameters
idvector set id
[out]mem
[out]colorcolor value
[out]width
[out]flat
Returns
-1 on error (invalid vector set id)
1 on success

Definition at line 259 of file GV2.c.

References gv_get_vect(), and NULL.

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 206 of file GV2.c.

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

Referenced by wxnviz.Nviz::CheckColorTable().

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 174 of file GV2.c.

References G_store(), gv_free_vectmem(), gv_get_vect(), Gv_load_vect(), and NULL.

Referenced by Nviz_new_map_obj().

int GV_new_vector ( void  )

Register new vector set.

Returns
vector set id
-1 on error

Definition at line 63 of file GV2.c.

References G_debug(), gv_get_new_vect(), and gv_set_defaults().

Referenced by Nviz_new_map_obj().

int GV_num_vects ( void  )

Get number of available vector sets.

Returns
number of vector sets

Definition at line 86 of file GV2.c.

References gv_num_vects().

Referenced by Nviz_new_map_obj().

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 331 of file GV2.c.

References GS_surf_exists(), gv_get_vect(), and GV_surf_is_selected().

Referenced by Nviz_new_map_obj(), and wxnviz.Nviz::SetVectorLineSurface().

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 490 of file GV2.c.

References gv_get_vect().

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 281 of file GV2.c.

References G_debug(), and gv_get_vect().

Referenced by wxnviz.Nviz::SetVectorLineHeight().

int GV_set_vectmode ( int  id,
int  mem,
int  color,
int  width,
int  flat 
)

Set vector set mode.

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

Definition at line 231 of file GV2.c.

References tools::color, gv_get_vect(), NULL, and dialogs::width.

Referenced by Nviz_new_map_obj(), and wxnviz.Nviz::SetVectorLineMode().

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 397 of file GV2.c.

References gv_get_vect().

Referenced by GV_select_surf(), GV_unselect_surf(), and wxnviz.Nviz::VectorSurfaceSelected().

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 360 of file GV2.c.

References gv_get_vect(), and GV_surf_is_selected().

Referenced by wxnviz.Nviz::UnsetVectorLineSurface().

int GV_vect_exists ( int  id)

Check if vector set exists.

Parameters
idvector set id
Returns
0 not found
1 found

Definition at line 38 of file GV2.c.

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

Referenced by GV_delete_vector(), wxnviz.Nviz::SetVectorLineHeight(), wxnviz.Nviz::SetVectorLineMode(), wxnviz.Nviz::SetVectorLineSurface(), wxnviz.Nviz::UnloadVector(), and wxnviz.Nviz::UnsetVectorLineSurface().