Integration of OCCT 6.5.0 from SVN
[occt.git] / src / OpenGl / OpenGl_mrkrsize.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 PolymarkerSizeDisplay( TSM_ELEM_DATA, Tint, cmn_key* );
16static TStatus PolymarkerSizeAdd( TSM_ELEM_DATA, Tint, cmn_key* );
17static TStatus PolymarkerSizeDelete( TSM_ELEM_DATA, Tint, cmn_key* );
18static TStatus PolymarkerSizePrint( TSM_ELEM_DATA, Tint, cmn_key* );
19static TStatus PolymarkerSizeInquire( TSM_ELEM_DATA, Tint, cmn_key* );
20
21static TStatus (*MtdTbl[])( TSM_ELEM_DATA, Tint, cmn_key* ) =
22{
23 0, /* PickTraverse */
24 PolymarkerSizeDisplay,
25 PolymarkerSizeAdd,
26 PolymarkerSizeDelete,
27 PolymarkerSizePrint,
28 PolymarkerSizeInquire
29};
30
31
32MtblPtr
33TelPolymarkerSizeInitClass( TelType *el )
34{
35 *el = TelPolymarkerSize;
36 return MtdTbl;
37}
38
39static TStatus
40PolymarkerSizeAdd( TSM_ELEM_DATA d, Tint n, cmn_key *k )
41{
42 Tfloat *data = new Tfloat();
43 if( !data )
44 return TFailure;
45
46 *data = k[0]->data.fdata;
47
48 ((tsm_elem_data)(d.pdata))->pdata = data;
49
50 return TSuccess;
51}
52
53
54static TStatus
55PolymarkerSizeDisplay( TSM_ELEM_DATA data, Tint n, cmn_key *k )
56{
57 CMN_KEY key;
58
59 key.id = TelPolymarkerSize;
60 key.data.fdata = *(Tfloat*)(data.pdata);
61 TsmSetAttri( 1, &key );
62
63 return TSuccess;
64}
65
66
67static TStatus
68PolymarkerSizeDelete( TSM_ELEM_DATA data, Tint n, cmn_key *k )
69{
70 if (data.pdata)
71 delete data.pdata;
72 return TSuccess;
73}
74
75
76static TStatus
77PolymarkerSizePrint( TSM_ELEM_DATA data, Tint n, cmn_key *k )
78{
79 fprintf( stdout, "TelPolymarkerSize. Value = %g\n", *(Tfloat *)(data.pdata));
80 fprintf( stdout, "\n" );
81
82 return TSuccess;
83}
84
85
86static TStatus
87PolymarkerSizeInquire( TSM_ELEM_DATA data, Tint n, cmn_key *k )
88{
89 Tint i;
90 Tfloat *f = (Tfloat *)data.pdata;
91
92 for( i = 0; i < n; i++ )
93 {
94 switch( k[i]->id )
95 {
96 case INQ_GET_SIZE_ID:
97 {
98 k[i]->data.ldata = sizeof( Tint );
99 break;
100 }
101 case INQ_GET_CONTENT_ID:
102 {
103 TEL_INQ_CONTENT *c;
104 Teldata *w;
105
106 c = (tel_inq_content)k[i]->data.pdata;
107 w = c->data;
108 c->act_size = 0;
109 w->fdata = *f;
110 break;
111 }
112 }
113 }
114
115 return TSuccess;
116}