7fd59977 |
1 | /*********************************************************************** |
2 | |
3 | FONCTION : |
4 | ---------- |
5 | File OpenGl_linecontextgroup : |
6 | |
7 | |
8 | REMARQUES: |
9 | ---------- |
10 | |
11 | HISTORIQUE DES MODIFICATIONS : |
12 | -------------------------------- |
13 | xx-xx-xx : xxx ; Creation. |
14 | 03-09-97 : FMN ; Ajout traitement Begin/EndPrimitives() |
15 | 03-03-98 : CAL ; Modification des structures CALL_DEF_GROUP et STRUCTURE |
16 | |
17 | ************************************************************************/ |
18 | |
19 | /*----------------------------------------------------------------------*/ |
20 | /* |
21 | * Includes |
22 | */ |
23 | |
24 | #include <OpenGl_tgl_all.hxx> |
25 | #include <InterfaceGraphic_Graphic3d.hxx> |
26 | #include <OpenGl_tgl.hxx> |
27 | #include <OpenGl_tgl_funcs.hxx> |
28 | #include <OpenGl_tgl_subrs.hxx> |
29 | #include <OpenGl_tgl_utilgr.hxx> |
30 | |
31 | /*----------------------------------------------------------------------*/ |
32 | |
33 | void EXPORT |
34 | call_togl_linecontextgroup |
35 | ( |
36 | CALL_DEF_GROUP * agroup, |
37 | int noinsert |
38 | ) |
39 | { |
40 | /* for the group */ |
41 | Tfloat liner, lineg, lineb; |
42 | Tint linetype=0; |
43 | Tfloat linewidth; |
44 | |
45 | /* for the structure */ |
46 | Tfloat Liner, Lineg, Lineb; |
47 | Tint Linetype=0; |
48 | Tfloat Linewidth; |
49 | |
50 | /* |
51 | * Si le groupe est ouvert cela signifie que BeginPrimitives |
52 | * a ete utilise. |
53 | * Dans le cas des markers composes, il faut refermer temporairement |
54 | * le groupe pour eviter des insertions d'attributs aleatoires. |
55 | */ |
56 | if (agroup->IsOpen) call_togl_closegroup (agroup); |
57 | |
58 | if( agroup->ContextLine.IsDef ) |
59 | { |
60 | liner = agroup->ContextLine.Color.r; |
61 | lineg = agroup->ContextLine.Color.g; |
62 | lineb = agroup->ContextLine.Color.b; |
63 | |
64 | switch( agroup->ContextLine.LineType ) |
65 | { |
66 | case 0 : /* Aspect_TOL_SOLID */ |
67 | linetype = CALL_PHIGS_LINE_SOLID; |
68 | break; |
69 | case 1 : /* Aspect_DASH */ |
70 | linetype = CALL_PHIGS_LINE_DASH; |
71 | break; |
72 | case 2 : /* Aspect_TOL_DOT */ |
73 | linetype = CALL_PHIGS_LINE_DOT; |
74 | break; |
75 | case 3 : /* Aspect_TOL_DOTDASH */ |
76 | linetype = CALL_PHIGS_LINE_DASH_DOT; |
77 | break; |
78 | default : |
79 | break; |
80 | } |
81 | linewidth = (Tfloat)agroup->ContextLine.Width; |
82 | |
83 | Liner = agroup->Struct->ContextLine.Color.r; |
84 | Lineg = agroup->Struct->ContextLine.Color.g; |
85 | Lineb = agroup->Struct->ContextLine.Color.b; |
86 | |
87 | switch( agroup->Struct->ContextLine.LineType ) |
88 | { |
89 | case 0 : /* Aspect_TOL_SOLID */ |
90 | Linetype = CALL_PHIGS_LINE_SOLID; |
91 | break; |
92 | case 1 : /* Aspect_DASH */ |
93 | Linetype = CALL_PHIGS_LINE_DASH; |
94 | break; |
95 | case 2 : /* Aspect_TOL_DOT */ |
96 | Linetype = CALL_PHIGS_LINE_DOT; |
97 | break; |
98 | case 3 : /* Aspect_TOL_DOTDASH */ |
99 | Linetype = CALL_PHIGS_LINE_DASH_DOT; |
100 | break; |
101 | default : |
102 | break; |
103 | } |
104 | Linewidth = (Tfloat)agroup->Struct->ContextLine.Width; |
105 | |
106 | /*TransPers = agroup->TransformPersistenceFlag;*/ |
107 | |
108 | if( noinsert ) |
109 | { |
110 | if( agroup->ContextLine.IsSet ) |
111 | call_func_set_edit_mode( CALL_PHIGS_EDIT_REPLACE ); |
112 | else |
113 | call_func_set_edit_mode( CALL_PHIGS_EDIT_INSERT ); |
114 | call_func_open_struct( agroup->Struct->Id ); |
115 | |
116 | call_func_set_elem_ptr( 0 ); |
117 | call_func_set_elem_ptr_label( agroup->LabelBegin ); |
118 | if( agroup->PickId.IsSet ) |
119 | call_func_offset_elem_ptr( 1 ); |
120 | if( agroup->ContextLine.IsSet ) |
121 | call_func_offset_elem_ptr( 1 ); |
122 | call_subr_set_line_colr( liner, lineg, lineb ); |
123 | if( agroup->ContextLine.IsSet ) |
124 | call_func_offset_elem_ptr( 1 ); |
125 | call_func_set_linetype( linetype ); |
126 | if( agroup->ContextLine.IsSet ) |
127 | call_func_offset_elem_ptr( 1 ); |
128 | call_func_set_linewidth( linewidth ); |
129 | |
130 | call_func_set_elem_ptr_label( agroup->LabelEnd ); |
131 | call_func_offset_elem_ptr( -call_util_context_group_place( agroup ) |
132 | - 1 ); |
133 | if( agroup->ContextLine.IsSet ) |
134 | call_func_offset_elem_ptr( 1 ); |
135 | call_subr_set_line_colr( Liner, Lineg, Lineb ); |
136 | if( agroup->ContextLine.IsSet ) |
137 | call_func_offset_elem_ptr( 1 ); |
138 | call_func_set_linetype( Linetype ); |
139 | if( agroup->ContextLine.IsSet ) |
140 | call_func_offset_elem_ptr( 1 ); |
141 | call_func_set_linewidth( Linewidth ); |
142 | call_func_close_struct( ); |
143 | } /* no insert */ |
144 | |
145 | if( noinsert == 0 ) |
146 | { |
147 | call_func_set_edit_mode( CALL_PHIGS_EDIT_INSERT ); |
148 | call_func_open_struct( agroup->Struct->Id ); |
149 | |
150 | call_func_set_elem_ptr( 0 ); |
151 | call_func_set_elem_ptr_label( agroup->LabelEnd ); |
152 | call_func_offset_elem_ptr( -call_util_context_group_place( agroup ) |
153 | - 1 ); |
154 | call_subr_set_line_colr( liner, lineg, lineb ); |
155 | call_func_set_linetype( linetype ); |
156 | call_func_set_linewidth( linewidth ); |
157 | |
158 | if( !agroup->ContextLine.IsSet ) |
159 | { |
160 | call_subr_set_line_colr( Liner, Lineg, Lineb ); |
161 | call_func_set_linetype( Linetype ); |
162 | call_func_set_linewidth( Linewidth ); |
163 | } |
164 | call_func_close_struct(); |
165 | } /* insert */ |
166 | } |
167 | /* Voir commentaire en debut de fonction */ |
168 | if (agroup->IsOpen) call_togl_opengroup (agroup); |
169 | return; |
170 | } |