0022792: Globally defined symbol PI conflicts with VTK definition (Intel compiler)
[occt.git] / src / OpenGl / OpenGl_togl_text.cxx
CommitLineData
7fd59977 1
2#include <math.h>
3#include <OpenGl_tgl_all.hxx>
4#include <InterfaceGraphic_Graphic3d.hxx>
5#include <OpenGl_tgl.hxx>
6#include <OpenGl_tgl_funcs.hxx>
7#include <OpenGl_tgl_utilgr.hxx>
8
9void EXPORT
10call_togl_text
11(
12 CALL_DEF_GROUP * agroup,
13 CALL_DEF_TEXT * atext
14 )
15{
16 Tint path;
17 Tfloat up_vect[2];
18 TEL_POINT text_pt;
19 Tint hor_align, ver_align;
20
21 up_vect[0] = ( float )cos (atext->Angle);
22 up_vect[1] = ( float )sin (atext->Angle);
23
24 switch (atext->Path) {
25 case 0: /* Graphic3d_TP_UP */
26 path = CALL_PHIGS_PATH_UP;
27 break;
28 case 1: /* Graphic3d_TP_DOWN */
29 path = CALL_PHIGS_PATH_DOWN;
30 break;
31 case 2: /* Graphic3d_TP_LEFT */
32 path = CALL_PHIGS_PATH_LEFT;
33 break;
34 case 3: /* Graphic3d_TP_RIGHT */
35 path = CALL_PHIGS_PATH_RIGHT;
36 break;
37 default:
38 path = CALL_PHIGS_PATH_RIGHT;
39 break;
40 }
41
42 switch (atext->HAlign) {
43 case 0: /* Graphic3d_HTA_LEFT */
44 hor_align = CALL_PHIGS_HOR_LEFT;
45 break;
46 case 1: /* Graphic3d_HTA_CENTER */
47 hor_align = CALL_PHIGS_HOR_CENTER;
48 break;
49 case 2: /* Graphic3d_HTA_RIGHT */
50 hor_align = CALL_PHIGS_HOR_RIGHT;
51 break;
52 default:
53 hor_align = CALL_PHIGS_HOR_LEFT;
54 break;
55 }
56
57 switch (atext->VAlign) {
58 case 0: /* Graphic3d_VTA_BOTTOM */
59 ver_align = CALL_PHIGS_VERT_BOTTOM;
60 break;
61 case 1: /* Graphic3d_VTA_CENTER */
62 ver_align = CALL_PHIGS_VERT_CENTER;
63 break;
64 case 2: /* Graphic3d_VTA_TOP */
65 ver_align = CALL_PHIGS_VERT_TOP;
66 break;
67 default:
68 ver_align = CALL_PHIGS_VERT_BOTTOM;
69 break;
70 }
71
72 text_pt.xyz[0] = atext->Position.x;
73 text_pt.xyz[1] = atext->Position.y;
74 text_pt.xyz[2] = atext->Position.z;
75
76 if (! agroup->IsOpen) call_togl_opengroup (agroup);
77 call_func_set_anno_char_ht (atext->Height);
78 call_func_set_anno_char_up_vec (up_vect);
79 call_func_set_anno_path (path);
80 call_func_set_anno_align (hor_align, ver_align);
13a22457 81 call_func_anno_text_rel3 (&text_pt, (Techar*)atext->string);
7fd59977 82 if (! agroup->IsOpen) call_togl_closegroup (agroup);
7fd59977 83}