0022337: V3d_View::Print crashes in OCCT 6.5.0
[occt.git] / src / OpenGl / OpenGl_intstyle.cxx
1 /***********************************************************************
2
3 FONCTION :
4 ----------
5 Fichier OpenGl_intstyle.c
6
7
8 REMARQUES:
9 ---------- 
10
11
12 HISTORIQUE DES MODIFICATIONS   :
13 --------------------------------
14 ??-??-?? : PCT ; creation
15 15-01-98 : FMN ; Ajout Hidden line
16
17 ************************************************************************/
18
19 /*----------------------------------------------------------------------*/
20 /*
21 * Includes
22 */
23
24 #include <OpenGl_tgl_all.hxx>
25
26 #include <stddef.h>
27 #include <stdio.h>
28 #include <GL/gl.h>
29 #include <GL/glu.h>
30
31 #include <OpenGl_cmn_varargs.hxx>
32 #include <OpenGl_telem_attri.hxx>
33 #include <OpenGl_tsm.hxx>
34 #include <OpenGl_telem.hxx>
35 #include <OpenGl_telem_inquire.hxx>
36
37 /*----------------------------------------------------------------------*/
38
39 static  TStatus  InteriorStyleDisplay( TSM_ELEM_DATA, Tint, cmn_key* );
40 static  TStatus  InteriorStyleAdd( TSM_ELEM_DATA, Tint, cmn_key* );
41 static  TStatus  InteriorStylePrint( TSM_ELEM_DATA, Tint, cmn_key* );
42 static  TStatus  InteriorStyleInquire( TSM_ELEM_DATA, Tint, cmn_key* );
43
44 static  TStatus  (*MtdTbl[])( TSM_ELEM_DATA, Tint, cmn_key* ) =
45 {
46   0,             /* PickTraverse */
47   InteriorStyleDisplay,
48   InteriorStyleAdd,
49   0,             /* Delete */
50   InteriorStylePrint,
51   InteriorStyleInquire
52 };
53
54
55 MtblPtr
56 TelInteriorStyleInitClass( TelType *el )
57 {
58   *el = TelInteriorStyle;
59   return MtdTbl;
60 }
61
62 static  TStatus
63 InteriorStyleAdd( TSM_ELEM_DATA d, Tint n, cmn_key *k )
64 {
65   ((tsm_elem_data)(d.pdata))->ldata = k[0]->data.ldata;
66
67   return TSuccess;
68 }
69
70
71 static  TStatus
72 InteriorStyleDisplay( TSM_ELEM_DATA data, Tint n, cmn_key *k )
73 {
74   CMN_KEY     key;
75
76   key.id = TelInteriorStyle;
77   key.data.ldata = data.ldata;
78   TsmSetAttri( 1, &key );
79
80   return TSuccess;
81 }
82
83
84 static  TStatus
85 InteriorStylePrint( TSM_ELEM_DATA data, Tint n, cmn_key *k )
86 {
87   switch( data.ldata )
88   {
89   case TSM_SOLID:
90     fprintf( stdout, "TelInteriorStyle. Value = SOLID\n" );
91     break;
92
93   case TSM_HOLLOW:
94     fprintf( stdout, "TelInteriorStyle. Value = HOLLOW\n" );
95     break;
96
97   case TSM_EMPTY:
98     fprintf( stdout, "TelInteriorStyle. Value = EMPTY\n" );
99     break;
100
101   case TSM_HATCH:
102     fprintf( stdout, "TelInteriorStyle. Value = HATCH\n" );
103     break;
104
105   case TSM_POINT:
106     fprintf( stdout, "TelInteriorStyle. Value = POINT\n" );
107     break;
108
109   case TSM_HIDDENLINE:
110     fprintf( stdout, "TelInteriorStyle. Value = HIDDENLINE\n" );
111     break;
112
113
114   }
115   fprintf( stdout, "\n" );
116
117   return TSuccess;
118 }
119
120
121 static TStatus
122 InteriorStyleInquire( TSM_ELEM_DATA data, Tint n, cmn_key *k )
123 {
124   Tint i;
125
126   for( i = 0; i < n; i++ )
127   {
128     switch( k[i]->id )
129     {
130     case INQ_GET_SIZE_ID:
131       {
132         k[i]->data.ldata = sizeof( Tint );
133         break;
134       }
135     case INQ_GET_CONTENT_ID:
136       {
137         TEL_INQ_CONTENT *c;
138         Teldata         *w;
139
140         c = (tel_inq_content)k[i]->data.pdata;
141         w = c->data;
142         c->act_size = 0;
143         w->idata = data.ldata;
144         break;
145       }
146     }
147   }
148
149   return TSuccess;
150 }