GRASS Programmer's Manual  6.5.svn(2014)-r66266
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
GP2.c File Reference

OGSF library - loading and manipulating point 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 GP2.c:

Go to the source code of this file.

Functions

int GP_site_exists (int id)
 Check if point set exists. More...
 
int GP_new_site (void)
 Create new point set. More...
 
int GP_num_sites (void)
 Get number of loaded point sets. More...
 
intGP_get_site_list (int *numsites)
 Get list of point sets. More...
 
int GP_delete_site (int id)
 Delete registrated point set. More...
 
int GP_load_site (int id, const char *filename)
 Load point set from file. More...
 
int GP_get_sitename (int id, char **filename)
 Get point set filename. More...
 
int GP_get_sitemode (int id, int *atmod, int *color, int *width, float *size, int *marker)
 Get point set mode. More...
 
int GP_set_sitemode (int id, int atmod, int color, int width, float size, int marker)
 Set point set mode. More...
 
int GP_attmode_color (int id, const char *filename)
 Set attribute mode color. More...
 
int GP_attmode_none (int id)
 Set attribute mode to none. More...
 
int GP_set_zmode (int id, int use_z)
 Set z-mode. More...
 
int GP_get_zmode (int id, int *use_z)
 Get z-mode. More...
 
void GP_set_trans (int id, float xtrans, float ytrans, float ztrans)
 Set trans ? More...
 
void GP_get_trans (int id, float *xtrans, float *ytrans, float *ztrans)
 Get trans. More...
 
int GP_select_surf (int hp, int hs)
 Select surface. More...
 
int GP_unselect_surf (int hp, int hs)
 Unselect surface. More...
 
int GP_surf_is_selected (int hp, int hs)
 Check if surface is selected. More...
 
void GP_draw_site (int id)
 Draw point set. More...
 
void GP_alldraw_site (void)
 Draw all available point sets. More...
 
int GP_Set_ClientData (int id, void *clientd)
 Set client data. More...
 
void * GP_Get_ClientData (int id)
 Get client data. More...
 

Detailed Description

OGSF library - loading and manipulating point 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 (January 1994)
Doxygenized by Martin landa <landa.martin gmail.com> (May 2008)

Definition in file GP2.c.

Function Documentation

void GP_alldraw_site ( void  )

Draw all available point sets.

Definition at line 557 of file GP2.c.

References GP_draw_site(), and tools::id.

Referenced by gk_follow_frames(), GK_show_site(), and Nviz_draw_quick().

int GP_attmode_color ( int  id,
const char *  filename 
)

Set attribute mode color.

Todo:
make similar routines for attmode_size, attmode_marker (use transform)
Parameters
idsurface id
filenamefilename
Returns
1 for success
0 for no attribute info
-1 for bad parameter

Definition at line 284 of file GP2.c.

References gp_get_site(), Gp_set_color(), and NULL.

int GP_attmode_none ( int  id)

Set attribute mode to none.

Parameters
idpoint set id
Returns
-1 on error (invalid point set id)
1 on success

Definition at line 312 of file GP2.c.

References gp_get_site(), and NULL.

int GP_delete_site ( int  id)

Delete registrated point set.

Parameters
idpoint set id
Returns
1 on success
-1 on error (point sets not available)

Definition at line 131 of file GP2.c.

References G_debug(), gp_delete_site(), and GP_site_exists().

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

void GP_draw_site ( int  id)

Draw point set.

Parameters
idpoint set id

Definition at line 520 of file GP2.c.

References G_debug(), gp_get_site(), gpd_2dsite(), gpd_3dsite(), GS_get_region(), gs_get_surf(), n, and print_site_fields().

Referenced by GP_alldraw_site(), and Nviz_draw_all_site().

void* GP_Get_ClientData ( int  id)

Get client data.

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

Definition at line 599 of file GP2.c.

References gp_get_site(), and NULL.

int* GP_get_site_list ( int numsites)

Get list of point sets.

Must freed when no longer needed!

Parameters
numsitesnumber of point sets
Returns
pointer to list of points sets
NULL on error

Definition at line 101 of file GP2.c.

References NULL.

Referenced by Nviz_draw_all_site().

int GP_get_sitemode ( int  id,
int atmod,
int color,
int width,
float *  size,
int marker 
)

Get point set mode.

Definition at line 224 of file GP2.c.

References gp_get_site(), and NULL.

int GP_get_sitename ( int  id,
char **  filename 
)

Get point set filename.

Note: char array is allocated by G_store()

Parameters
idpoint set id
[out]&filenamepoint set filename
Returns
-1 on error (point set not found)
1 on success

Definition at line 208 of file GP2.c.

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

Referenced by wxnviz.Nviz::CheckColorTable().

void GP_get_trans ( int  id,
float *  xtrans,
float *  ytrans,
float *  ztrans 
)

Get trans.

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

Definition at line 406 of file GP2.c.

References G_debug(), and gp_get_site().

int GP_get_zmode ( int  id,
int use_z 
)

Get z-mode.

Parameters
idpoint set id
[out]use_zuse z
Returns
-1 on error (invalid point set id)
1 on success

Definition at line 365 of file GP2.c.

References gp_get_site(), and NULL.

int GP_load_site ( int  id,
const char *  filename 
)

Load point set from file.

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
idpoint set id
filenamepoint set filename
Returns
-1 on error
1 on success

Definition at line 173 of file GP2.c.

References G_store(), gp_free_sitemem(), gp_get_site(), Gp_load_sites(), and NULL.

Referenced by Nviz_new_map_obj().

int GP_new_site ( void  )

Create new point set.

Returns
point set id
-1 on error (number of point sets exceeded)

Definition at line 63 of file GP2.c.

References G_debug(), gp_get_new_site(), and gp_set_defaults().

Referenced by Nviz_new_map_obj().

int GP_num_sites ( void  )

Get number of loaded point sets.

Returns
number of point sets

Definition at line 86 of file GP2.c.

References gp_num_sites().

Referenced by Nviz_new_map_obj().

int GP_select_surf ( int  hp,
int  hs 
)

Select surface.

Parameters
hppoint set id
hssurface id
Returns
1 surface selected
-1 on error

Definition at line 433 of file GP2.c.

References gp_get_site(), GP_surf_is_selected(), and GS_surf_exists().

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

int GP_Set_ClientData ( int  id,
void *  clientd 
)

Set client data.

Parameters
idpoint set id
clientdclient data
Returns
1 on success
-1 on error (invalid point set id)

Definition at line 577 of file GP2.c.

References gp_get_site().

int GP_set_sitemode ( int  id,
int  atmod,
int  color,
int  width,
float  size,
int  marker 
)

Set point set mode.

Parameters
idpoint set id
atmod
coloricon color
width
sizeicon size
markericon symbol
Returns
-1 on error (point set not found)

Definition at line 254 of file GP2.c.

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

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

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

Set trans ?

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

Definition at line 383 of file GP2.c.

References G_debug(), and gp_get_site().

Referenced by wxnviz.Nviz::SetVectorPointHeight().

int GP_set_zmode ( int  id,
int  use_z 
)

Set z-mode.

Parameters
idpoin set id
use_zuse z ?
Returns
1 on success
0 no z
-1 on error (invalid point set id)

Definition at line 335 of file GP2.c.

References gp_get_site(), and NULL.

Referenced by wxnviz.Nviz::SetVectorPointZMode().

int GP_site_exists ( int  id)
int GP_surf_is_selected ( int  hp,
int  hs 
)

Check if surface is selected.

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

Definition at line 497 of file GP2.c.

References gp_get_site().

Referenced by GP_select_surf(), and GP_unselect_surf().

int GP_unselect_surf ( int  hp,
int  hs 
)

Unselect surface.

Parameters
hppoint set id
hssurface id
Returns
1 surface unselected
-1 on error

Definition at line 461 of file GP2.c.

References gp_get_site(), and GP_surf_is_selected().

Referenced by wxnviz.Nviz::UnsetVectorPointSurface().