OCC22354 Bug in Overlay Text rendering
[occt.git] / src / OpenGl / OpenGl_mrkrtype.cxx
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
15 static  TStatus  PolymarkerTypeDisplay( TSM_ELEM_DATA, Tint, cmn_key* );
16 static  TStatus  PolymarkerTypeAdd( TSM_ELEM_DATA, Tint, cmn_key* );
17 static  TStatus  PolymarkerTypePrint( TSM_ELEM_DATA, Tint, cmn_key* );
18 static  TStatus  PolymarkerTypeInquire( TSM_ELEM_DATA, Tint, cmn_key* );
19
20 static  TStatus  (*MtdTbl[])( TSM_ELEM_DATA, Tint, cmn_key* ) =
21 {
22   PolymarkerTypeDisplay,             /* PickTraverse */
23   PolymarkerTypeDisplay,
24   PolymarkerTypeAdd,
25   0,             /* Delete */
26   PolymarkerTypePrint,
27   PolymarkerTypeInquire
28 };
29
30
31 MtblPtr
32 TelPolymarkerTypeInitClass( TelType *el )
33 {
34   *el = TelPolymarkerType;
35   return MtdTbl;
36 }
37
38 static  TStatus
39 PolymarkerTypeAdd( 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
47 static  TStatus
48 PolymarkerTypeDisplay( TSM_ELEM_DATA data, Tint n, cmn_key *k )
49 {
50   CMN_KEY     key;
51
52   key.id = TelPolymarkerType;
53   key.data.ldata = data.ldata;
54   TsmSetAttri( 1, &key );
55
56   return TSuccess;
57 }
58
59
60 static  TStatus
61 PolymarkerTypePrint( TSM_ELEM_DATA data, Tint n, cmn_key *k )
62 {
63   switch( data.ldata )
64   {
65   case TEL_PM_PLUS:
66     fprintf( stdout, "TelPolymarkerType. Value = PLUS\n" );
67     break;
68
69   case TEL_PM_STAR:
70     fprintf( stdout, "TelPolymarkerType. Value = STAR\n" );
71     break;
72
73   case TEL_PM_CROSS:
74     fprintf( stdout, "TelPolymarkerType. Value = CROSS\n" );
75     break;
76
77   case TEL_PM_CIRC:
78     fprintf( stdout, "TelPolymarkerType. Value = CIRC\n" );
79     break;
80
81   case TEL_PM_DOT:
82     fprintf( stdout, "TelPolymarkerType. Value = DOT\n" );
83     break;
84
85   case TEL_PM_USERDEFINED:
86     fprintf( stdout, "TelPolymarkerType. Value = USERDEFINED\n" );
87     break;
88
89   default:
90     fprintf( stdout, "TelPolymarkerType. Value = %d (UNKNOWN)",
91       data.ldata );
92   }
93   fprintf( stdout, "\n" );
94
95   return TSuccess;
96 }
97
98 static TStatus
99 PolymarkerTypeInquire( TSM_ELEM_DATA data, Tint n, cmn_key *k )
100 {
101   Tint i;
102
103   for( i = 0; i < n; i++ )
104   {
105     switch( k[i]->id )
106     {
107     case INQ_GET_SIZE_ID:
108       {
109         k[i]->data.ldata = sizeof( Tint );
110         break;
111       }
112     case INQ_GET_CONTENT_ID:
113       {
114         TEL_INQ_CONTENT *c;
115         Teldata         *w;
116
117         c = (tel_inq_content)k[i]->data.pdata;
118         w = c->data;
119         c->act_size = 0;
120         w->idata = data.ldata;
121         break;
122       }
123     }
124   }
125
126   return TSuccess;
127 }