0012121: Optimization of existing selection classes
[occt.git] / src / OpenGl / OpenGl_intstyleind.cxx
CommitLineData
7fd59977 1
2#include <OpenGl_tgl_all.hxx>
3
4#include <stddef.h>
5#include <stdio.h>
6#include <GL/gl.h>
7#include <GL/glu.h>
8
9#include <OpenGl_cmn_varargs.hxx>
10#include <OpenGl_telem_attri.hxx>
11#include <OpenGl_tsm.hxx>
12#include <OpenGl_telem.hxx>
13#include <OpenGl_telem_inquire.hxx>
14
15static TStatus InteriorStyleIndexDisplay( TSM_ELEM_DATA, Tint, cmn_key* );
16static TStatus InteriorStyleIndexAdd( TSM_ELEM_DATA, Tint, cmn_key* );
17static TStatus InteriorStyleIndexPrint( TSM_ELEM_DATA, Tint, cmn_key* );
18static TStatus InteriorStyleIndexInquire( TSM_ELEM_DATA, Tint, cmn_key* );
19
20static TStatus (*MtdTbl[])( TSM_ELEM_DATA, Tint, cmn_key* ) =
21{
22 0, /* PickTraverse */
23 InteriorStyleIndexDisplay,
24 InteriorStyleIndexAdd,
25 0, /* Delete */
26 InteriorStyleIndexPrint,
27 InteriorStyleIndexInquire
28};
29
30
31MtblPtr
32TelInteriorStyleIndexInitClass( TelType *el )
33{
34 *el = TelInteriorStyleIndex;
35 return MtdTbl;
36}
37
38static TStatus
39InteriorStyleIndexAdd( TSM_ELEM_DATA d, Tint n, cmn_key *k )
40{
41 ((tsm_elem_data)(d.pdata))->ldata = k[0]->data.ldata;
42
43 return TSuccess;
44}
45
46
47static TStatus
48InteriorStyleIndexDisplay( TSM_ELEM_DATA data, Tint n, cmn_key *k )
49{
50 CMN_KEY key;
51
52 key.id = TelInteriorStyleIndex;
53 key.data.ldata = data.ldata;
54 TsmSetAttri( 1, &key );
55
56 return TSuccess;
57}
58
59
60static TStatus
61InteriorStyleIndexPrint( TSM_ELEM_DATA data, Tint n, cmn_key *k )
62{
63 switch( data.ldata )
64 {
65 case TEL_HS_SOLID:
66 fprintf( stdout, "TelInteriorStyleIndex. Value = SOLID\n" );
67 break;
68
69 case TEL_HS_CROSS:
70 fprintf( stdout, "TelInteriorStyleIndex. Value = CROSS\n" );
71 break;
72
73 case TEL_HS_CROSS_SPARSE:
74 fprintf( stdout, "TelInteriorStyleIndex. Value = CROSS_SPARSE\n");
75 break;
76
77 case TEL_HS_GRID:
78 fprintf( stdout, "TelInteriorStyleIndex. Value = GRID\n" );
79 break;
80
81 case TEL_HS_GRID_SPARSE:
82 fprintf( stdout, "TelInteriorStyleIndex. Value = GRID_SPARSE\n" );
83 break;
84
85 case TEL_HS_DIAG_45:
86 fprintf( stdout, "TelInteriorStyleIndex. Value = DIAG_45\n" );
87 break;
88
89 case TEL_HS_DIAG_135:
90 fprintf( stdout, "TelInteriorStyleIndex. Value = DIAG_135\n" );
91 break;
92
93 case TEL_HS_HORIZONTAL:
94 fprintf( stdout, "TelInteriorStyleIndex. Value = HORIZONTAL\n" );
95 break;
96
97 case TEL_HS_VERTICAL:
98 fprintf( stdout, "TelInteriorStyleIndex. Value = VERTICAL\n" );
99 break;
100
101 case TEL_HS_DIAG_45_SPARSE:
102 fprintf(stdout,"TelInteriorStyleIndex. Value = DIAG_45_SPARSE\n");
103 break;
104
105 case TEL_HS_DIAG_135_SPARSE:
106 fprintf( stdout, "TelInteriorStyleIndex. Value = DIAG_135_SPARSE\n" );
107 break;
108
109 case TEL_HS_HORIZONTAL_SPARSE:
110 fprintf( stdout,"TelInteriorStyleIndex. Value = HORIZONTAL_SPARSE\n");
111 break;
112
113 case TEL_HS_VERTICAL_SPARSE:
114 fprintf( stdout, "TelInteriorStyleIndex. Value = VERTICAL_SPARSE\n" );
115 break;
116
117 }
118 fprintf( stdout, "\n" );
119
120 return TSuccess;
121}
122
123
124static TStatus
125InteriorStyleIndexInquire( TSM_ELEM_DATA data, Tint n, cmn_key *k )
126{
127 Tint i;
128
129 for( i = 0; i < n; i++ )
130 {
131 switch( k[i]->id )
132 {
133 case INQ_GET_SIZE_ID:
134 {
135 k[i]->data.ldata = sizeof( Tint );
136 break;
137 }
138 case INQ_GET_CONTENT_ID:
139 {
140 TEL_INQ_CONTENT *c;
141 Teldata *w;
142
143 c = (tel_inq_content)k[i]->data.pdata;
144 w = c->data;
145 c->act_size = 0;
146 w->idata = data.ldata;
147 break;
148 }
149 }
150 }
151
152 return TSuccess;
153}