b311480e |
1 | // Created on: 1992-04-29 |
2 | // Created by: Remi LEQUETTE |
3 | // Copyright (c) 1992-1999 Matra Datavision |
973c2be1 |
4 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
b311480e |
5 | // |
973c2be1 |
6 | // This file is part of Open CASCADE Technology software library. |
b311480e |
7 | // |
d5f74e42 |
8 | // This library is free software; you can redistribute it and/or modify it under |
9 | // the terms of the GNU Lesser General Public License version 2.1 as published |
973c2be1 |
10 | // by the Free Software Foundation, with special exception defined in the file |
11 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
12 | // distribution for complete text of the license and disclaimer of any warranty. |
b311480e |
13 | // |
973c2be1 |
14 | // Alternatively, this file may be used under the terms of Open CASCADE |
15 | // commercial license or contractual agreement. |
7fd59977 |
16 | |
42cf5bc1 |
17 | |
18 | #include <Draw_Axis3D.hxx> |
19 | #include <Draw_Color.hxx> |
20 | #include <Draw_Display.hxx> |
7fd59977 |
21 | #include <gp.hxx> |
42cf5bc1 |
22 | #include <gp_Ax3.hxx> |
23 | #include <gp_Pnt.hxx> |
24 | #include <gp_Vec.hxx> |
25 | #include <Standard_Type.hxx> |
7fd59977 |
26 | |
92efcf78 |
27 | IMPLEMENT_STANDARD_RTTIEXT(Draw_Axis3D,Draw_Drawable3D) |
28 | |
7fd59977 |
29 | extern Standard_Boolean Draw_Bounds; |
30 | |
31 | |
32 | //======================================================================= |
33 | //function : Draw_Axis3D |
34 | //purpose : |
35 | //======================================================================= |
36 | |
37 | Draw_Axis3D::Draw_Axis3D (const Draw_Color& col, |
38 | const Standard_Integer Size) : |
39 | myAxes(gp::XOY()),myColor(col), mySize(Size) |
40 | { |
41 | } |
42 | |
43 | //======================================================================= |
44 | //function : Draw_Axis3D |
45 | //purpose : |
46 | //======================================================================= |
47 | |
48 | Draw_Axis3D::Draw_Axis3D (const gp_Pnt& p, |
49 | const Draw_Color& col, |
50 | const Standard_Integer Size) : |
51 | myAxes(p,gp::DZ(),gp::DX()), myColor(col), mySize(Size) |
52 | { |
53 | } |
54 | |
55 | //======================================================================= |
56 | //function : Draw_Axis3D |
57 | //purpose : |
58 | //======================================================================= |
59 | |
60 | Draw_Axis3D::Draw_Axis3D (const gp_Ax3& a, |
61 | const Draw_Color& col, |
62 | const Standard_Integer Size) : |
63 | myAxes(a), myColor(col), mySize(Size) |
64 | { |
65 | } |
66 | |
67 | //======================================================================= |
68 | //function : DrawOn |
69 | //purpose : |
70 | //======================================================================= |
71 | |
72 | void Draw_Axis3D::DrawOn (Draw_Display& dis) const |
73 | { |
74 | Draw_Bounds = Standard_False; |
75 | dis.SetColor(myColor); |
76 | Standard_Real z = dis.Zoom(); |
77 | z = (Standard_Real)mySize / z; |
78 | gp_Pnt P,P0 = myAxes.Location(); |
79 | P = P0.Translated(gp_Vec(myAxes.XDirection()) * z); |
80 | dis.Draw(P0,P); |
81 | dis.DrawString(P,"X"); |
82 | P = P0.Translated(gp_Vec(myAxes.YDirection()) * z); |
83 | dis.Draw(P0,P); |
84 | dis.DrawString(P,"Y"); |
85 | P = P0.Translated(gp_Vec(myAxes.Direction()) * z); |
86 | dis.Draw(P0,P); |
87 | dis.DrawString(P,"Z"); |
88 | Draw_Bounds = Standard_True; |
89 | } |
90 | |