GRASS GIS 7 Programmer's Manual  7.5.svn(2018)-r72871
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
map_obj.c File Reference

Nviz library – Define creation and interface functions for map objects. More...

#include <stdlib.h>
#include <time.h>
#include <grass/glocale.h>
#include <grass/nviz.h>
Include dependency graph for map_obj.c:

Go to the source code of this file.

Functions

int Nviz_new_map_obj (int type, const char *name, double value, nv_data *data)
 Create a new map object which can be one of surf, vect, vol or site. More...
 
int Nviz_set_attr (int id, int type, int desc, int src, const char *str_value, double num_value, nv_data *data)
 
void Nviz_set_surface_attr_default ()
 Set default surface attributes. More...
 
int Nviz_set_vpoint_attr_default (int id)
 Set default vector point attributes. More...
 
int Nviz_set_volume_attr_default (int id)
 Set default volume attributes. More...
 
int Nviz_unset_attr (int id, int type, int desc)
 

Detailed Description

Nviz library – Define creation and interface functions for map objects.

Map objects are considered to be surfaces, vector plots, or site files.

Based on visualization/nviz/src/map_obj.c

(C) 2008, 2010 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
Updated/modified by Martin Landa <landa.martin gmail.com> (Google SoC 2008/2010)

Definition in file map_obj.c.

Function Documentation

int Nviz_new_map_obj ( int  type,
const char *  name,
double  value,
nv_data data 
)

Create a new map object which can be one of surf, vect, vol or site.

This routine creates the object internally in the gsf libraryb. Optionally, a logical name may be specified for the new map object. If no name is specified, a logical name is assigned to the new object automatically. Note that maintaining unique logical names is not the responsibility of the library (currently).

Initially map objects contain no data, use the attribute commands to set attributes such as topology, color, etc.

Parameters
typemap object type
namemap name (NULL for constant)
valueconstant (used if name is NULL)
datanviz data
Returns
map object id
-1 on error

Definition at line 44 of file map_obj.c.

References _, ATT_TOPO, CONST_ATT, G_free(), G_warning(), GP_delete_site(), GP_load_site(), GP_new_site(), GP_num_sites(), GP_select_surf(), GP_set_style(), GS_get_surf_list(), GS_new_surface(), GS_num_surfs(), GV_delete_vector(), GV_load_vector(), GV_new_vector(), GV_num_vects(), GV_select_surf(), GV_set_style(), GVL_delete_vol(), GVL_load_vol(), GVL_new_vol(), GVL_num_vols(), MAP_ATT, MAP_OBJ_SITE, MAP_OBJ_SURF, MAP_OBJ_VECT, MAP_OBJ_VOL, MAX_SITES, MAX_SURFS, MAX_VECTS, MAX_VOLS, NULL, Nviz_set_attr(), Nviz_set_volume_attr_default(), Nviz_set_vpoint_attr_default(), and ST_X.

int Nviz_set_attr ( int  id,
int  type,
int  desc,
int  src,
const char *  str_value,
double  num_value,
nv_data data 
)

Set map object attribute

Parameters
idmap object id
typemap object type (MAP_OBJ_SURF, MAP_OBJ_VECT, ...)
descattribute descriptor
srcattribute source
str_valueattribute value as string (if NULL, check for num_value)
num_valueattribute value as double
Returns
1 on success
0 on failure

Definition at line 180 of file map_obj.c.

References ATT_COLOR, ATT_TOPO, CONST_ATT, DM_GOURAUD, DM_GRID_SURF, DM_POLY, GS_get_dims(), GS_load_att_map(), GS_set_att_const(), GS_set_drawmode(), GS_set_drawres(), MAP_ATT, MAP_OBJ_SURF, max, and Nviz_update_ranges().

Referenced by Nviz_new_map_obj().

void Nviz_set_surface_attr_default ( )

Set default surface attributes.

Definition at line 276 of file map_obj.c.

References ATT_COLOR, ATT_EMIT, ATT_MASK, ATT_SHINE, ATT_TOPO, ATT_TRANSP, DEFAULT_SURF_COLOR, GS_set_att_defaults(), and MAX_ATTS.

int Nviz_set_volume_attr_default ( int  id)

Set default volume attributes.

Parameters
idvolume set id
Returns
1 on success
0 on failure

Definition at line 320 of file map_obj.c.

References DM_GOURAUD, DM_POLY, GVL_get_dims(), GVL_isosurf_set_drawmode(), GVL_isosurf_set_drawres(), GVL_slice_set_drawmode(), GVL_slice_set_drawres(), and max.

Referenced by Nviz_new_map_obj().

int Nviz_set_vpoint_attr_default ( int  id)

Set default vector point attributes.

Parameters
idvector point set id
Returns
1 on success
0 on failure

Definition at line 300 of file map_obj.c.

References gp_get_site().

Referenced by Nviz_new_map_obj().

int Nviz_unset_attr ( int  id,
int  type,
int  desc 
)

Unset map object attribute

Parameters
idmap object id
typemap object type (MAP_OBJ_SURF, MAP_OBJ_VECT, ...)
descattribute descriptor
Returns
1 on success
0 on failure

Definition at line 360 of file map_obj.c.

References GS_unset_att(), and MAP_OBJ_SURF.