OCC22250 Windows lost focus with DRAWEXE launched in 'virtual windows' mode
[occt.git] / src / Draw / Draw_Axis3D.cxx
1 // File:        Draw_Axis3D.cxx
2 // Created:     Wed Apr 29 15:24:18 1992
3 // Author:      Remi LEQUETTE
4 //              <rle@sdsun1>
5
6 #include <Draw_Axis3D.ixx>
7 #include <gp_Vec.hxx>
8 #include <gp.hxx>
9
10 extern Standard_Boolean Draw_Bounds;
11
12
13 //=======================================================================
14 //function : Draw_Axis3D
15 //purpose  : 
16 //=======================================================================
17
18 Draw_Axis3D::Draw_Axis3D (const Draw_Color& col, 
19                           const Standard_Integer Size) :
20        myAxes(gp::XOY()),myColor(col), mySize(Size)
21 {
22 }
23
24 //=======================================================================
25 //function : Draw_Axis3D
26 //purpose  : 
27 //=======================================================================
28
29 Draw_Axis3D::Draw_Axis3D (const gp_Pnt& p, 
30                           const Draw_Color& col, 
31                           const Standard_Integer Size) :
32        myAxes(p,gp::DZ(),gp::DX()), myColor(col), mySize(Size)
33 {
34 }
35
36 //=======================================================================
37 //function : Draw_Axis3D
38 //purpose  : 
39 //=======================================================================
40
41 Draw_Axis3D::Draw_Axis3D (const gp_Ax3& a, 
42                           const Draw_Color& col, 
43                           const Standard_Integer Size) :
44        myAxes(a), myColor(col), mySize(Size)
45 {
46 }
47
48 //=======================================================================
49 //function : DrawOn
50 //purpose  : 
51 //=======================================================================
52
53 void Draw_Axis3D::DrawOn (Draw_Display& dis) const
54 {
55   Draw_Bounds = Standard_False;
56   dis.SetColor(myColor);
57   Standard_Real z = dis.Zoom();
58   z = (Standard_Real)mySize / z;
59   gp_Pnt P,P0 = myAxes.Location();
60   P = P0.Translated(gp_Vec(myAxes.XDirection()) * z);
61   dis.Draw(P0,P);
62   dis.DrawString(P,"X");
63   P = P0.Translated(gp_Vec(myAxes.YDirection()) * z);
64   dis.Draw(P0,P);
65   dis.DrawString(P,"Y");
66   P = P0.Translated(gp_Vec(myAxes.Direction()) * z);
67   dis.Draw(P0,P);
68   dis.DrawString(P,"Z");
69   Draw_Bounds = Standard_True;
70 }
71