0012121: Optimization of existing selection classes
[occt.git] / src / OpenGl / OpenGl_pickid.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
11#include <OpenGl_telem_attri.hxx>
12#include <OpenGl_tsm.hxx>
13#include <OpenGl_telem.hxx>
14#include <OpenGl_telem_inquire.hxx>
15
16static TStatus PickIdAdd( TSM_ELEM_DATA, Tint, cmn_key* );
17static TStatus PickIdPrint( TSM_ELEM_DATA, Tint, cmn_key* );
18static TStatus PickIdInquire( TSM_ELEM_DATA, Tint, cmn_key* );
19
20static TStatus (*MtdTbl[])( TSM_ELEM_DATA, Tint, cmn_key* ) =
21{
22 0, /* PickTraverse */
23 0, /* Display */
24 PickIdAdd,
25 0, /* Delete */
26 PickIdPrint,
27 PickIdInquire
28};
29
30
31MtblPtr
32TelPickIdInitClass( TelType *el )
33{
34 *el = TelPickId;
35 return MtdTbl;
36}
37
38
39static TStatus
40PickIdAdd( TSM_ELEM_DATA d, Tint n, cmn_key *k )
41{
42 ((tsm_elem_data)(d.pdata))->ldata = k[0]->data.ldata;
43
44 return TSuccess;
45}
46
47
48static TStatus
49PickIdPrint( TSM_ELEM_DATA data, Tint n, cmn_key *k )
50{
51 fprintf( stdout, "TelPickId. Value = %d\n", data.ldata);
52 fprintf( stdout, "\n" );
53
54 return TSuccess;
55}
56
57static TStatus
58PickIdInquire( TSM_ELEM_DATA data, Tint n, cmn_key *k )
59{
60 Tint i;
61
62 for( i = 0; i < n; i++ )
63 {
64 switch( k[i]->id )
65 {
66 case INQ_GET_SIZE_ID:
67 {
68 k[i]->data.ldata = sizeof( Tint );
69 break;
70 }
71 case INQ_GET_CONTENT_ID:
72 {
73 TEL_INQ_CONTENT *c;
74 Teldata *w;
75
76 c = (tel_inq_content)k[i]->data.pdata;
77 w = c->data;
78 c->act_size = 0;
79 w->idata = data.ldata;
80 break;
81 }
82 }
83 }
84
85 return TSuccess;
86}