GRASS GIS 8 Programmer's Manual
8.5.0dev(2024)-847944e18e
|
Go to the source code of this file.
Functions | |
int | Nviz_resize_window (int, int) |
GL canvas resized. More... | |
int | Nviz_update_ranges (nv_data *) |
Update ranges. More... | |
int | Nviz_set_viewpoint_position (double, double) |
Change position of view. More... | |
void | Nviz_get_viewpoint_position (double *, double *) |
int | Nviz_set_viewpoint_height (double) |
Change viewpoint height. More... | |
void | Nviz_get_viewpoint_height (double *) |
int | Nviz_set_viewpoint_persp (int) |
Change viewpoint perspective (field of view) More... | |
int | Nviz_set_viewpoint_twist (int) |
Change viewpoint twist. More... | |
int | Nviz_change_exag (nv_data *, double) |
Change z-exag value. More... | |
int | Nviz_look_here (double, double) |
Change focused point. More... | |
void | Nviz_get_modelview (double *) |
Get current modelview matrix. More... | |
void | Nviz_set_rotation (double, double, double, double) |
Set rotation parameters. More... | |
void | Nviz_unset_rotation (void) |
Stop scene rotation. More... | |
void | Nviz_init_rotation (void) |
Stop scene rotation. More... | |
void | Nviz_flythrough (nv_data *, float *, int *, int) |
int | Nviz_new_cplane (nv_data *, int) |
Creates a clip plane object. More... | |
int | Nviz_on_cplane (nv_data *, int) |
Turn on (make current) the given clip plane. More... | |
int | Nviz_off_cplane (nv_data *, int) |
Turn off (make inactive) the given clip plane. More... | |
int | Nviz_draw_cplane (nv_data *, int, int) |
Draw the clip plane. More... | |
int | Nviz_num_cplanes (nv_data *) |
Return the number of clip planes objects currently allocated. More... | |
int | Nviz_get_current_cplane (nv_data *) |
Get the current active cutplane. More... | |
int | Nviz_set_cplane_rotation (nv_data *, int, float, float, float) |
Set the rotation for the current clip plane. More... | |
int | Nviz_get_cplane_rotation (nv_data *, int, float *, float *, float *) |
Get the rotation values for the current clip plane. More... | |
int | Nviz_set_cplane_translation (nv_data *, int, float, float, float) |
Set the translation for the current clip plane. More... | |
int | Nviz_get_cplane_translation (nv_data *, int, float *, float *, float *) |
Get the translation values for the current clip plane. More... | |
int | Nviz_set_fence_color (nv_data *, int) |
int | Nviz_set_cplane_here (nv_data *, int, float, float) |
int | Nviz_draw_all_surf (nv_data *) |
Draw all loaded surfaces. More... | |
int | Nviz_draw_all_vect (void) |
Draw all loaded vector sets (lines) More... | |
int | Nviz_draw_all_site (void) |
Draw all loaded vector point sets. More... | |
int | Nviz_draw_all_vol (void) |
Draw all loaded volume sets. More... | |
int | Nviz_draw_all (nv_data *) |
Draw all map objects (in full resolution) and decorations. More... | |
int | Nviz_draw_quick (nv_data *, int) |
Draw all surfaces in wireframe (quick mode) More... | |
int | Nviz_load_image (GLubyte *, int, int, int) |
Load image into texture. More... | |
void | Nviz_draw_image (int, int, int, int, int) |
Draw image as texture. More... | |
void | Nviz_set_2D (int, int) |
Set ortho view for drawing images. More... | |
void | Nviz_del_texture (int) |
Delete texture. More... | |
void | Nviz_get_max_texture (int *) |
Get maximum texture size. More... | |
int | Nviz_get_exag_height (double *, double *, double *) |
Get view height. More... | |
double | Nviz_get_exag (void) |
Get view z-exag value. More... | |
int | Nviz_set_light_position (nv_data *, int, double, double, double, double) |
Set light position. More... | |
int | Nviz_set_light_bright (nv_data *, int, double) |
Set light brightness. More... | |
int | Nviz_set_light_color (nv_data *, int, int, int, int) |
Set light color. More... | |
int | Nviz_set_light_ambient (nv_data *, int, double) |
Set light ambient. More... | |
int | Nviz_init_light (nv_data *, int) |
Init new light. More... | |
int | Nviz_new_light (nv_data *) |
Define new light. More... | |
void | Nviz_draw_model (nv_data *) |
int | Nviz_new_map_obj (int, const char *, double, nv_data *) |
Create a new map object which can be one of surf, vect, vol or site. More... | |
int | Nviz_set_attr (int, int, int, int, const char *, double, nv_data *) |
void | Nviz_set_surface_attr_default (void) |
Set default surface attributes. More... | |
int | Nviz_set_vpoint_attr_default (int) |
Set default vector point attributes. More... | |
int | Nviz_set_volume_attr_default (int) |
Set default volume attributes. More... | |
int | Nviz_unset_attr (int, int, int) |
void | Nviz_init_data (nv_data *) |
Initialize Nviz data. More... | |
void | Nviz_destroy_data (nv_data *) |
Free allocated space by nv_data struct. More... | |
void | Nviz_set_bgcolor (nv_data *, int) |
Set background color. More... | |
int | Nviz_get_bgcolor (nv_data *) |
Get background color. More... | |
int | Nviz_color_from_str (const char *) |
Get color value from color string (name or RGB triplet) More... | |
struct fringe_data * | Nviz_new_fringe (nv_data *, int, unsigned long, double, int, int, int, int) |
struct fringe_data * | Nviz_set_fringe (nv_data *, int, unsigned long, double, int, int, int, int) |
void | Nviz_draw_fringe (nv_data *data) |
int | Nviz_draw_arrow (nv_data *) |
Draws the North Arrow. More... | |
int | Nviz_set_arrow (nv_data *, int, int, float, unsigned int) |
Sets the North Arrow position and return world coords. More... | |
void | Nviz_delete_arrow (nv_data *) |
Deletes the North Arrow. More... | |
struct scalebar_data * | Nviz_new_scalebar (nv_data *, int, float *, float, unsigned int) |
struct scalebar_data * | Nviz_set_scalebar (nv_data *, int, int, int, float, unsigned int) |
Sets the scale bar position and return world coords. More... | |
void | Nviz_draw_scalebar (nv_data *) |
Draws the Scale bar. More... | |
void | Nviz_delete_scalebar (nv_data *, int) |
Deletes scale bar. More... | |
void | Nviz_init_view (nv_data *) |
int | Nviz_set_focus_state (int) |
Set focus state. More... | |
int | Nviz_set_focus_map (int, int) |
Set focus based on loaded map. More... | |
int | Nviz_has_focus (nv_data *) |
int | Nviz_set_focus (nv_data *, float, float, float) |
int | Nviz_get_focus (nv_data *, float *, float *, float *) |
float | Nviz_get_xyrange (nv_data *) |
Get xy range. More... | |
int | Nviz_get_zrange (nv_data *, float *, float *) |
float | Nviz_get_longdim (nv_data *) |
struct render_window * | Nviz_new_render_window (void) |
Allocate memory for render window. More... | |
void | Nviz_init_render_window (struct render_window *) |
Initialize render window. More... | |
void | Nviz_destroy_render_window (struct render_window *) |
Free render window. More... | |
int | Nviz_create_render_window (struct render_window *, void *, int, int) |
int | Nviz_make_current_render_window (const struct render_window *) |
Make window current for rendering. More... | |
int Nviz_change_exag | ( | nv_data * | data, |
double | exag | ||
) |
Change z-exag value.
data | nviz data |
exag | exag value |
Definition at line 238 of file change_view.c.
int Nviz_color_from_str | ( | const char * | color_str | ) |
Get color value from color string (name or RGB triplet)
color_str | color string |
Definition at line 125 of file nviz.c.
References _, BLU_MASK, G_str_to_color(), G_warning(), GRN_MASK, and RED_MASK.
int Nviz_create_render_window | ( | struct render_window * | , |
void * | , | ||
int | , | ||
int | |||
) |
void Nviz_del_texture | ( | int | texture_id | ) |
Delete texture.
texture_id | texture id |
Definition at line 408 of file nviz/draw.c.
References t.
void Nviz_delete_arrow | ( | nv_data * | data | ) |
void Nviz_delete_scalebar | ( | nv_data * | data, |
int | bar_id | ||
) |
void Nviz_destroy_data | ( | nv_data * | data | ) |
void Nviz_destroy_render_window | ( | struct render_window * | rwin | ) |
Free render window.
win | pointer to render_window struct |
Definition at line 123 of file nviz/render.c.
References render_window::contextId, render_window::displayId, G_free(), render_window::pixmap, and render_window::windowId.
int Nviz_draw_all | ( | nv_data * | data | ) |
Draw all map objects (in full resolution) and decorations.
data | nviz data |
Definition at line 204 of file nviz/draw.c.
int Nviz_draw_all_site | ( | void | ) |
Draw all loaded vector point sets.
Definition at line 146 of file nviz/draw.c.
References G_free(), GP_draw_site(), GP_get_site_list(), GS_done_draw(), GS_ready_draw(), GS_set_draw(), GSD_BACK, and GSD_BOTH.
int Nviz_draw_all_surf | ( | nv_data * | dc | ) |
Draw all loaded surfaces.
dc | nviz data |
Definition at line 32 of file nviz/draw.c.
References GS_get_surf_list(), nv_data::light, MAX_SURFS, light_data::x, x, light_data::y, and light_data::z.
int Nviz_draw_all_vect | ( | void | ) |
Draw all loaded vector sets (lines)
Definition at line 121 of file nviz/draw.c.
References GS_done_draw(), GS_ready_draw(), GS_set_draw(), GSD_BACK, GSD_BOTH, and GV_alldraw_vect().
int Nviz_draw_all_vol | ( | void | ) |
Draw all loaded volume sets.
Definition at line 175 of file nviz/draw.c.
References G_free(), GS_done_draw(), GS_ready_draw(), GS_set_draw(), GSD_BACK, GSD_BOTH, GVL_draw_vol(), and GVL_get_vol_list().
int Nviz_draw_arrow | ( | nv_data * | data | ) |
int Nviz_draw_cplane | ( | nv_data * | data, |
int | bound1, | ||
int | bound2 | ||
) |
Draw the clip plane.
data | nviz data |
bound1 | |
bound2 |
Definition at line 78 of file cplanes_obj.c.
void Nviz_draw_fringe | ( | nv_data * | data | ) |
void Nviz_draw_image | ( | int | x, |
int | y, | ||
int | width, | ||
int | height, | ||
int | texture_id | ||
) |
Draw image as texture.
x,y | image coordinates |
width,height | image size |
texture_id | texture id |
Definition at line 379 of file nviz/draw.c.
void Nviz_draw_model | ( | nv_data * | ) |
int Nviz_draw_quick | ( | nv_data * | data, |
int | draw_mode | ||
) |
Draw all surfaces in wireframe (quick mode)
Draw modes:
data | nviz data |
draw_mode | draw mode |
Definition at line 281 of file nviz/draw.c.
void Nviz_draw_scalebar | ( | nv_data * | data | ) |
void Nviz_flythrough | ( | nv_data * | , |
float * | , | ||
int * | , | ||
int | |||
) |
int Nviz_get_bgcolor | ( | nv_data * | data | ) |
int Nviz_get_cplane_rotation | ( | nv_data * | data, |
int | id, | ||
float * | dx, | ||
float * | dy, | ||
float * | dz | ||
) |
Get the rotation values for the current clip plane.
data | nviz data |
id | id of current clip plane |
dx,dy,dz | rotation parameters |
Definition at line 196 of file cplanes_obj.c.
int Nviz_get_cplane_translation | ( | nv_data * | data, |
int | id, | ||
float * | dx, | ||
float * | dy, | ||
float * | dz | ||
) |
Get the translation values for the current clip plane.
data | nviz data |
id | id of current clip plane |
dx,dy,dz | translation parameters |
Definition at line 236 of file cplanes_obj.c.
int Nviz_get_current_cplane | ( | nv_data * | data | ) |
Get the current active cutplane.
data | nviz data |
Definition at line 157 of file cplanes_obj.c.
double Nviz_get_exag | ( | void | ) |
Get view z-exag value.
Call after initial data has been loaded
Definition at line 77 of file exag.c.
References G_debug(), G_free(), GS_get_exag_guess(), and GS_get_surf_list().
int Nviz_get_exag_height | ( | double * | val, |
double * | min, | ||
double * | max | ||
) |
Get view height.
Call after initial data has been loaded
[out] | val | height value |
[out] | min | min value (or NULL) |
[out] | max | max value (or NULL) |
Definition at line 29 of file exag.c.
References G_debug(), GS_get_exag_guess(), GS_get_longdim(), GS_get_surf_list(), GS_get_zrange_nz(), max, and min.
int Nviz_get_focus | ( | nv_data * | , |
float * | , | ||
float * | , | ||
float * | |||
) |
float Nviz_get_longdim | ( | nv_data * | ) |
void Nviz_get_max_texture | ( | int * | size | ) |
Get maximum texture size.
Definition at line 420 of file nviz/draw.c.
References scalebar_data::size.
void Nviz_get_modelview | ( | double * | modelMatrix | ) |
Get current modelview matrix.
Definition at line 272 of file change_view.c.
void Nviz_get_viewpoint_height | ( | double * | height | ) |
Definition at line 181 of file change_view.c.
void Nviz_get_viewpoint_position | ( | double * | x_pos, |
double * | y_pos | ||
) |
Definition at line 131 of file change_view.c.
References G_debug(), GS_get_from(), RANGE, RANGE_OFFSET, X, and Y.
float Nviz_get_xyrange | ( | nv_data * | data | ) |
int Nviz_get_zrange | ( | nv_data * | , |
float * | , | ||
float * | |||
) |
int Nviz_has_focus | ( | nv_data * | ) |
void Nviz_init_data | ( | nv_data * | data | ) |
int Nviz_init_light | ( | nv_data * | data, |
int | num | ||
) |
void Nviz_init_render_window | ( | struct render_window * | rwin | ) |
Initialize render window.
win | pointer to render_window struct |
Definition at line 94 of file nviz/render.c.
References render_window::contextId, render_window::displayId, render_window::height, NULL, render_window::pixmap, render_window::width, and render_window::windowId.
void Nviz_init_rotation | ( | void | ) |
void Nviz_init_view | ( | nv_data * | data | ) |
Initialize view, position, lighting settings (focus)
Set position to center of view
Definition at line 24 of file position.c.
int Nviz_load_image | ( | GLubyte * | image_data, |
int | width, | ||
int | height, | ||
int | alpha | ||
) |
Load image into texture.
image_data | image data |
width,height | image screen size |
alpha | has alpha channel |
Definition at line 318 of file nviz/draw.c.
int Nviz_look_here | ( | double | sx, |
double | sy | ||
) |
Change focused point.
sx,sy | screen coordinates |
Definition at line 262 of file change_view.c.
References G_debug(), and GS_look_here().
int Nviz_make_current_render_window | ( | const struct render_window * | rwin | ) |
Make window current for rendering.
win | pointer to render_window struct |
Definition at line 325 of file nviz/render.c.
References _, render_window::contextId, render_window::displayId, G_warning(), render_window::height, render_window::width, and render_window::windowId.
int Nviz_new_cplane | ( | nv_data * | data, |
int | id | ||
) |
Creates a clip plane object.
The number of clip planes is fixed (MAX_CPLANES) and we'll create them all ahead of time anyway we just let the user decide on the id for each.
data | nviz data |
id |
Definition at line 31 of file cplanes_obj.c.
struct fringe_data* Nviz_new_fringe | ( | nv_data * | data, |
int | id, | ||
unsigned long | color, | ||
double | elev, | ||
int | nw, | ||
int | ne, | ||
int | sw, | ||
int | se | ||
) |
Add new fringe
data | nviz data |
id | surface id |
color | color |
elev | fringe elevation |
nw,ne,sw,se | 1 (turn on) 0 (turn off) |
int Nviz_new_light | ( | nv_data * | data | ) |
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.
type | map object type |
name | map name (NULL for constant) |
value | constant (used if name is NULL) |
data | nviz data |
struct render_window* Nviz_new_render_window | ( | void | ) |
Allocate memory for render window.
Definition at line 79 of file nviz/render.c.
References G_malloc.
struct scalebar_data* Nviz_new_scalebar | ( | nv_data * | data, |
int | bar_id, | ||
float * | coords, | ||
float | size, | ||
unsigned int | color | ||
) |
Add new scalebar
data | nviz data |
bar_id | scale bar id |
coords | real(?) coordinates |
size | scale bar length |
color | scalebar/text color |
int Nviz_num_cplanes | ( | nv_data * | data | ) |
Return the number of clip planes objects currently allocated.
data | nviz data |
Definition at line 147 of file cplanes_obj.c.
int Nviz_off_cplane | ( | nv_data * | data, |
int | id | ||
) |
Turn off (make inactive) the given clip plane.
data | nviz data |
cplane | id |
Definition at line 63 of file cplanes_obj.c.
int Nviz_on_cplane | ( | nv_data * | data, |
int | id | ||
) |
Turn on (make current) the given clip plane.
data | nviz data |
cplane | id |
Definition at line 48 of file cplanes_obj.c.
int Nviz_resize_window | ( | int | width, |
int | height | ||
) |
GL canvas resized.
width | window width |
height | window height |
Definition at line 30 of file change_view.c.
void Nviz_set_2D | ( | int | width, |
int | height | ||
) |
Set ortho view for drawing images.
width,height | image screen size |
Definition at line 355 of file nviz/draw.c.
int Nviz_set_arrow | ( | nv_data * | data, |
int | sx, | ||
int | sy, | ||
float | size, | ||
unsigned int | color | ||
) |
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
id | map object id |
type | map object type (MAP_OBJ_SURF, MAP_OBJ_VECT, ...) |
desc | attribute descriptor |
src | attribute source |
str_value | attribute value as string (if NULL, check for num_value) |
num_value | attribute value as double |
void Nviz_set_bgcolor | ( | nv_data * | data, |
int | color | ||
) |
int Nviz_set_cplane_here | ( | nv_data * | data, |
int | cplane, | ||
float | sx, | ||
float | sy | ||
) |
Definition at line 258 of file cplanes_obj.c.
int Nviz_set_cplane_rotation | ( | nv_data * | data, |
int | id, | ||
float | dx, | ||
float | dy, | ||
float | dz | ||
) |
Set the rotation for the current clip plane.
data | nviz data |
id | id of current clip plane |
dx,dy,dz | rotation parameters |
Definition at line 172 of file cplanes_obj.c.
int Nviz_set_cplane_translation | ( | nv_data * | data, |
int | id, | ||
float | dx, | ||
float | dy, | ||
float | dz | ||
) |
Set the translation for the current clip plane.
data | nviz data |
id | id of current clip plane |
dx,dy,dz | values for setting translation |
Definition at line 215 of file cplanes_obj.c.
int Nviz_set_fence_color | ( | nv_data * | , |
int | |||
) |
int Nviz_set_focus | ( | nv_data * | , |
float | , | ||
float | , | ||
float | |||
) |
int Nviz_set_focus_map | ( | int | type, |
int | id | ||
) |
Set focus based on loaded map.
If map is MAP_OBJ_UNDEFINED, set focus from first surface/volume in the list.
type | map object type |
id | map object id |
Definition at line 76 of file position.c.
int Nviz_set_focus_state | ( | int | state_flag | ) |
Set focus state.
state_flag | 1 for center view, 0 use viewdir |
Definition at line 50 of file position.c.
References _, G_warning(), GS_set_infocus(), and GS_set_nofocus().
struct fringe_data* Nviz_set_fringe | ( | nv_data * | data, |
int | id, | ||
unsigned long | color, | ||
double | elev, | ||
int | nw, | ||
int | ne, | ||
int | sw, | ||
int | se | ||
) |
Set fringe
data | nviz data |
id | surface id |
color | color |
elev | fringe elevation |
nw,ne,sw,se | 1 (turn on) 0 (turn off) |
int Nviz_set_light_ambient | ( | nv_data * | data, |
int | num, | ||
double | value | ||
) |
int Nviz_set_light_bright | ( | nv_data * | data, |
int | num, | ||
double | value | ||
) |
int Nviz_set_light_color | ( | nv_data * | data, |
int | num, | ||
int | red, | ||
int | green, | ||
int | blue | ||
) |
int Nviz_set_light_position | ( | nv_data * | data, |
int | num, | ||
double | x, | ||
double | y, | ||
double | z, | ||
double | w | ||
) |
void Nviz_set_rotation | ( | double | angle, |
double | x, | ||
double | y, | ||
double | z | ||
) |
Set rotation parameters.
Rotate scene by given parameters related to mouse drag event (difference from current state). Coordinates determine the second point of rotation axis, the first point is (0, 0, 0).
angle | angle |
x,y,z | axis coordinate |
Definition at line 288 of file change_view.c.
References G_debug(), GS_set_rotation(), and x.
struct scalebar_data* Nviz_set_scalebar | ( | nv_data * | data, |
int | bar_id, | ||
int | sx, | ||
int | sy, | ||
float | size, | ||
unsigned int | color | ||
) |
Sets the scale bar position and return world coords.
data | nviz data |
bar_id | scale bar id |
sx,sy | screen coordinates |
size | scale bar length |
color | scalebar/text color |
void Nviz_set_surface_attr_default | ( | void | ) |
Set default surface attributes.
Definition at line 278 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_viewpoint_height | ( | double | height | ) |
Change viewpoint height.
height | height value (world coordinates) |
Definition at line 157 of file change_view.c.
int Nviz_set_viewpoint_persp | ( | int | persp | ) |
Change viewpoint perspective (field of view)
persp | perspective value (0-100, in degrees) |
Definition at line 199 of file change_view.c.
References G_debug(), and GS_set_fov().
int Nviz_set_viewpoint_position | ( | double | x_pos, |
double | y_pos | ||
) |
Change position of view.
x_pos | x position (model coordinates) |
y_pos | y position (model coordinates) |
Definition at line 97 of file change_view.c.
References G_debug(), GS_get_from(), GS_moveto(), RANGE, RANGE_OFFSET, X, and Y.
int Nviz_set_viewpoint_twist | ( | int | twist | ) |
Change viewpoint twist.
twist | persp twist value (-180-180, in degrees) |
Definition at line 220 of file change_view.c.
References G_debug(), and GS_set_twist().
int Nviz_set_volume_attr_default | ( | int | id | ) |
Set default volume attributes.
id | volume set id |
Definition at line 322 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.
int Nviz_set_vpoint_attr_default | ( | int | id | ) |
Set default vector point attributes.
id | vector point set id |
Definition at line 302 of file map_obj.c.
References gp_get_site().
int Nviz_unset_attr | ( | int | id, |
int | type, | ||
int | desc | ||
) |
void Nviz_unset_rotation | ( | void | ) |
int Nviz_update_ranges | ( | nv_data * | dc | ) |
Update ranges.
Call whenever a new surface is added, deleted, or exag changes
Definition at line 61 of file change_view.c.
References GS_get_longdim(), GS_get_zrange_nz(), GS_global_exag(), nv_data::xyrange, and nv_data::zrange.