0012121: Optimization of existing selection classes
[occt.git] / src / OpenGl / OpenGl_intstyle.cxx
CommitLineData
7fd59977 1/***********************************************************************
2
3FONCTION :
4----------
5Fichier OpenGl_intstyle.c
6
7
8REMARQUES:
9----------
10
11
12HISTORIQUE DES MODIFICATIONS :
13--------------------------------
14??-??-?? : PCT ; creation
1515-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
39static TStatus InteriorStyleDisplay( TSM_ELEM_DATA, Tint, cmn_key* );
40static TStatus InteriorStyleAdd( TSM_ELEM_DATA, Tint, cmn_key* );
41static TStatus InteriorStylePrint( TSM_ELEM_DATA, Tint, cmn_key* );
42static TStatus InteriorStyleInquire( TSM_ELEM_DATA, Tint, cmn_key* );
43
44static 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
55MtblPtr
56TelInteriorStyleInitClass( TelType *el )
57{
58 *el = TelInteriorStyle;
59 return MtdTbl;
60}
61
62static TStatus
63InteriorStyleAdd( 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
71static TStatus
72InteriorStyleDisplay( 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
84static TStatus
85InteriorStylePrint( 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
121static TStatus
122InteriorStyleInquire( 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}