GRASS Programmer's Manual
6.4.2(2012)
Main Page
Related Pages
Namespaces
Data Structures
Files
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Pages
position.c
Go to the documentation of this file.
1
15
#include <grass/glocale.h>
16
#include <grass/nviz.h>
17
23
void
Nviz_init_view
(nv_data *
data
)
24
{
25
GS_init_view
();
26
Nviz_set_focus_state
(1);
/* center of view */
27
28
/* set default lights (1 & 2) */
29
Nviz_set_light_position
(data, 1, 0.68, -0.68, 0.80, 0.0);
30
Nviz_set_light_bright
(data, 1, 0.8);
31
Nviz_set_light_color
(data, 1, 255, 255, 255);
32
Nviz_set_light_ambient
(data, 1, 0.2);
33
Nviz_set_light_position
(data, 2, 0.0, 0.0, 1.0, 0.0);
34
Nviz_set_light_bright
(data, 2, 0.5);
35
Nviz_set_light_color
(data, 2, 255, 255, 255);
36
Nviz_set_light_ambient
(data, 2, 0.3);
37
38
return
;
39
}
40
49
int
Nviz_set_focus_state
(
int
state_flag)
50
{
51
if
(state_flag == 1)
52
GS_set_infocus
();
/* return center of view */
53
else
if
(state_flag == 0)
54
GS_set_nofocus
();
/* no center of view -- use viewdir */
55
else
{
56
G_warning
(_(
"Unable to set focus"
));
57
return
0;
58
}
59
60
return
1;
61
}
62
75
int
Nviz_set_focus_map
(
int
type
,
int
id
)
76
{
77
if
(
GS_num_surfs
() < 0 &&
GVL_num_vols
() < 0) {
78
GS_set_nofocus
();
79
return
0;
80
}
81
82
if
(type == MAP_OBJ_UNDEFINED) {
83
int
*surf_list, num_surfs, *vol_list;
84
85
if
(
GS_num_surfs
() > 0) {
86
surf_list =
GS_get_surf_list
(&num_surfs);
87
id
= surf_list[0];
88
G_free
(surf_list);
89
90
GS_set_focus_center_map
(
id
);
91
}
92
93
if
(
GVL_num_vols
() > 0) {
94
vol_list =
GVL_get_vol_list
(&num_surfs);
95
id
= vol_list[0];
96
G_free
(vol_list);
97
98
GVL_set_focus_center_map
(
id
);
99
}
100
return
id;
101
}
102
103
if
(type == MAP_OBJ_SURF) {
104
GS_set_focus_center_map
(
id
);
105
}
106
else
if
(type == MAP_OBJ_VOL) {
107
GVL_set_focus_center_map
(
id
);
108
}
109
110
return
id;
111
}
lib
nviz
position.c
Generated on Sun Mar 16 2014 05:07:47 for GRASS Programmer's Manual by
1.8.1.2