0022792: Globally defined symbol PI conflicts with VTK definition (Intel compiler)
[occt.git] / src / OpenGl / OpenGl_togl_boundarybox.cxx
1
2 #include <OpenGl_tgl_all.hxx>
3
4 #include <InterfaceGraphic_Labels.hxx>
5 #include <InterfaceGraphic_Graphic3d.hxx>
6
7 #include <OpenGl_tgl.hxx>
8 #include <OpenGl_tgl_funcs.hxx>
9 #include <OpenGl_tgl_subrs.hxx>
10
11 void EXPORT
12 call_togl_boundarybox
13 (
14  CALL_DEF_STRUCTURE * astructure,
15  int create
16  )
17 {
18 #define CALL_MAX_BOUNDBOXSIZE 16
19
20   /* for the group */
21   Tfloat liner, lineg, lineb;
22   Tint linetype;
23   Tfloat linewidth;
24
25   /* for the structure */
26   Tfloat Liner, Lineg, Lineb;
27   Tint Linetype=0;
28   Tfloat Linewidth;
29
30   Tfloat Xm, Ym, Zm, XM, YM, ZM;
31
32   CALL_DEF_LISTPOINTS alpoints;
33   CALL_DEF_POINT points[CALL_MAX_BOUNDBOXSIZE];
34
35   if( create )
36   {
37     Xm = astructure->BoundBox.Pmin.x;
38     Ym = astructure->BoundBox.Pmin.y;
39     Zm = astructure->BoundBox.Pmin.z;
40     XM = astructure->BoundBox.Pmax.x;
41     YM = astructure->BoundBox.Pmax.y;
42     ZM = astructure->BoundBox.Pmax.z;
43     call_func_set_edit_mode( CALL_PHIGS_EDIT_INSERT );
44     call_func_open_struct( astructure->Id );
45     call_func_set_elem_ptr( 0 );
46     call_func_set_elem_ptr_label( Structure_LABHighlight );
47
48     liner = astructure->BoundBox.Color.r;
49     lineg = astructure->BoundBox.Color.g;
50     lineb = astructure->BoundBox.Color.b;
51     linetype = CALL_PHIGS_LINE_SOLID;
52     linewidth = ( float )1.0;
53     call_subr_set_line_colr( liner, lineg, lineb );
54     call_func_set_linetype( linetype );
55     call_func_set_linewidth( linewidth );
56
57     alpoints.NbPoints = CALL_MAX_BOUNDBOXSIZE;
58     alpoints.TypePoints = 1;
59     alpoints.UPoints.Points = points;
60
61     points[ 0].x = Xm; points[ 0].y = Ym; points[ 0].z = Zm;
62     points[ 1].x = Xm; points[ 1].y = Ym; points[ 1].z = ZM;
63     points[ 2].x = Xm; points[ 2].y = YM; points[ 2].z = ZM;
64     points[ 3].x = Xm; points[ 3].y = YM; points[ 3].z = Zm;
65     points[ 4].x = Xm; points[ 4].y = Ym; points[ 4].z = Zm;
66     points[ 5].x = XM; points[ 5].y = Ym; points[ 5].z = Zm;
67     points[ 6].x = XM; points[ 6].y = Ym; points[ 6].z = ZM;
68     points[ 7].x = XM; points[ 7].y = YM; points[ 7].z = ZM;
69     points[ 8].x = XM; points[ 8].y = YM; points[ 8].z = Zm;
70     points[ 9].x = XM; points[ 9].y = Ym; points[ 9].z = Zm;
71     points[10].x = XM; points[10].y = YM; points[10].z = Zm;
72     points[11].x = Xm; points[11].y = YM; points[11].z = Zm;
73     points[12].x = Xm; points[12].y = YM; points[12].z = ZM;
74     points[13].x = XM; points[13].y = YM; points[13].z = ZM;
75     points[14].x = XM; points[14].y = Ym; points[14].z = ZM;
76     points[15].x = Xm; points[15].y = Ym; points[15].z = ZM;
77
78     call_subr_polyline( &alpoints );
79
80     Liner = astructure->ContextLine.Color.r;
81     Lineg = astructure->ContextLine.Color.g;
82     Lineb = astructure->ContextLine.Color.b;
83
84     switch( astructure->ContextLine.LineType )
85     {
86     case 0 : /* Aspect_TOL_SOLID */
87       Linetype = CALL_PHIGS_LINE_SOLID;
88       break;
89     case 1 : /* Aspect_TOL_DASH */
90       Linetype = CALL_PHIGS_LINE_DASH;
91       break;
92     case 2 : /* Aspect_TOL_DOT */
93       Linetype = CALL_PHIGS_LINE_DOT;
94       break;
95     case 3 : /* Aspect_TOL_DOTDASH */
96       Linetype = CALL_PHIGS_LINE_DASH_DOT;
97       break;
98     default :
99       break;
100     }
101
102     Linewidth = (Tfloat)astructure->ContextLine.Width;
103     call_subr_set_line_colr( Liner, Lineg, Lineb );
104     call_func_set_linetype( Linetype );
105     call_func_set_linewidth( Linewidth );
106     call_func_close_struct();
107   }
108   else
109   {
110     call_func_set_edit_mode( CALL_PHIGS_EDIT_REPLACE );
111     call_func_open_struct( astructure->Id );
112     call_func_set_elem_ptr( 0 );
113     call_func_set_elem_ptr_label( Structure_LABHighlight );
114     call_func_offset_elem_ptr( 1 );
115     call_func_del_elem(); /* boundary box linecolor */
116     call_func_offset_elem_ptr( 1 );
117     call_func_del_elem(); /* boundary box linetype */
118     call_func_offset_elem_ptr( 1 );
119     call_func_del_elem(); /* boundary box linewidth */
120     call_func_offset_elem_ptr( 1 );
121     call_func_del_elem(); /* boundary box definition */
122     call_func_offset_elem_ptr( 1 );
123     call_func_del_elem(); /* structure linecolor */
124     call_func_offset_elem_ptr( 1 );
125     call_func_del_elem(); /* structure linetype */
126     call_func_offset_elem_ptr( 1 );
127     call_func_del_elem(); /* structure linewidth */
128     call_func_close_struct();
129   }
130   return;
131 }