0022792: Globally defined symbol PI conflicts with VTK definition (Intel compiler)
[occt.git] / src / OpenGl / OpenGl_edgewid.cxx
CommitLineData
7fd59977 1
2#include <OpenGl_tgl_all.hxx>
3
4#include <stddef.h>
5#include <stdio.h>
6
7#include <OpenGl_cmn_varargs.hxx>
8#include <OpenGl_telem_attri.hxx>
9#include <OpenGl_tsm.hxx>
10#include <OpenGl_telem.hxx>
11#include <OpenGl_telem_inquire.hxx>
12
13static TStatus EdgeWidthDisplay( TSM_ELEM_DATA, Tint, cmn_key* );
14static TStatus EdgeWidthAdd( TSM_ELEM_DATA, Tint, cmn_key* );
15static TStatus EdgeWidthDelete( TSM_ELEM_DATA, Tint, cmn_key* );
16static TStatus EdgeWidthPrint( TSM_ELEM_DATA, Tint, cmn_key* );
17static TStatus EdgeWidthInquire( TSM_ELEM_DATA, Tint, cmn_key* );
18
19static TStatus (*MtdTbl[])( TSM_ELEM_DATA, Tint, cmn_key* ) =
20{
21 0, /* PickTraverse */
22 EdgeWidthDisplay,
23 EdgeWidthAdd,
24 EdgeWidthDelete,
25 EdgeWidthPrint,
26 EdgeWidthInquire
27};
28
29
30MtblPtr
31TelEdgeWidthInitClass( TelType *el )
32{
33 *el = TelEdgeWidth;
34 return MtdTbl;
35}
36
37static TStatus
38EdgeWidthAdd( TSM_ELEM_DATA d, Tint n, cmn_key *k )
39{
40 Tfloat *data = new Tfloat();
41
42 //cmn_memreserve( data, 1, 0 );
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
55EdgeWidthDisplay( TSM_ELEM_DATA data, Tint n, cmn_key *k )
56{
57 CMN_KEY key;
58
59 key.id = TelEdgeWidth;
60 key.data.fdata = *(Tfloat*)(data.pdata);
61 TsmSetAttri( 1, &key );
62
63 return TSuccess;
64}
65
66
67static TStatus
68EdgeWidthDelete( TSM_ELEM_DATA data, Tint n, cmn_key *k )
69{
70 //cmn_freemem( data.pdata );
71 if (data.pdata)
72 delete data.pdata;
73 return TSuccess;
74}
75
76
77static TStatus
78EdgeWidthPrint( TSM_ELEM_DATA data, Tint n, cmn_key *k )
79{
80 fprintf( stdout, "TelEdgeWidth. Value = %g\n", *(Tfloat *)(data.pdata));
81 fprintf( stdout, "\n" );
82
83 return TSuccess;
84}
85
86
87static TStatus
88EdgeWidthInquire( TSM_ELEM_DATA data, Tint n, cmn_key *k )
89{
90 Tint i;
91 Tfloat *f = (Tfloat *)data.pdata;
92
93 for( i = 0; i < n; i++ )
94 {
95 switch( k[i]->id )
96 {
97 case INQ_GET_SIZE_ID:
98 {
99 k[i]->data.ldata = sizeof( Tint );
100 break;
101 }
102 case INQ_GET_CONTENT_ID:
103 {
104 TEL_INQ_CONTENT *c;
105 Teldata *w;
106
107 c = (tel_inq_content)k[i]->data.pdata;
108 w = c->data;
109 c->act_size = 0;
110 w->fdata = *f;
111 break;
112 }
113 }
114 }
115
116 return TSuccess;
117}