973c2be1 |
1 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
7fd59977 |
2 | // |
973c2be1 |
3 | // This file is part of Open CASCADE Technology software library. |
b311480e |
4 | // |
d5f74e42 |
5 | // This library is free software; you can redistribute it and/or modify it under |
6 | // the terms of the GNU Lesser General Public License version 2.1 as published |
973c2be1 |
7 | // by the Free Software Foundation, with special exception defined in the file |
8 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
9 | // distribution for complete text of the license and disclaimer of any warranty. |
b311480e |
10 | // |
973c2be1 |
11 | // Alternatively, this file may be used under the terms of Open CASCADE |
12 | // commercial license or contractual agreement. |
b311480e |
13 | |
7fd59977 |
14 | #include <Aspect_Grid.ixx> |
15 | |
16 | |
17 | Aspect_Grid::Aspect_Grid( |
18 | const Quantity_Length anXOrigin, |
19 | const Quantity_Length anYOrigin, |
20 | const Quantity_PlaneAngle anAngle, |
21 | const Quantity_Color& aColor, |
22 | const Quantity_Color& aTenthColor) |
23 | : myRotationAngle(anAngle), |
24 | myXOrigin(anXOrigin), |
25 | myYOrigin(anYOrigin), |
26 | myColor(aColor), |
27 | myTenthColor(aTenthColor), |
28 | myIsActive(Standard_False), |
29 | myDrawMode(Aspect_GDM_Lines) |
30 | { |
31 | } |
32 | |
33 | |
34 | void Aspect_Grid::SetXOrigin(const Quantity_Length anOrigin) { |
35 | myXOrigin = anOrigin; |
36 | Init(); |
37 | UpdateDisplay(); |
38 | } |
39 | |
40 | void Aspect_Grid::SetYOrigin(const Quantity_Length anOrigin) { |
41 | myYOrigin = anOrigin; |
42 | Init(); |
43 | UpdateDisplay(); |
44 | } |
45 | |
46 | void Aspect_Grid::SetRotationAngle(const Quantity_Length anAngle){ |
47 | |
48 | |
49 | myRotationAngle = anAngle; |
50 | Init(); |
51 | UpdateDisplay(); |
52 | } |
53 | void Aspect_Grid::Rotate(const Quantity_PlaneAngle anAngle) { |
54 | myRotationAngle += anAngle; |
55 | Init(); |
56 | UpdateDisplay(); |
57 | } |
58 | void Aspect_Grid::Translate(const Quantity_Length aDx, |
59 | const Quantity_Length aDy) { |
60 | myXOrigin += aDx; |
61 | myYOrigin += aDy; |
62 | Init(); |
63 | UpdateDisplay(); |
64 | } |
65 | |
66 | void Aspect_Grid::SetColors(const Quantity_Color& aColor, |
67 | const Quantity_Color& aTenthColor) { |
68 | myColor = aColor; |
69 | myTenthColor = aTenthColor; |
70 | UpdateDisplay(); |
71 | } |
72 | |
73 | void Aspect_Grid::Colors(Quantity_Color& aColor, |
74 | Quantity_Color& aTenthColor) const { |
75 | aColor = myColor; |
76 | aTenthColor = myTenthColor; |
77 | } |
78 | |
79 | void Aspect_Grid::Hit(const Quantity_Length X, |
80 | const Quantity_Length Y, |
81 | Quantity_Length& gridX, |
82 | Quantity_Length& gridY) const { |
83 | if (myIsActive) { |
84 | Compute(X,Y,gridX,gridY);} |
85 | else{ |
86 | gridX = X; |
87 | gridY = Y; |
88 | } |
89 | } |
90 | void Aspect_Grid::Activate () { |
91 | myIsActive = Standard_True; |
92 | } |
93 | |
94 | void Aspect_Grid::Deactivate () { |
95 | myIsActive = Standard_False; |
96 | } |
97 | |
98 | Quantity_Length Aspect_Grid::XOrigin() const { |
99 | return myXOrigin; |
100 | } |
101 | |
102 | Quantity_Length Aspect_Grid::YOrigin() const { |
103 | return myYOrigin; |
104 | } |
105 | |
106 | Quantity_Length Aspect_Grid::RotationAngle() const { |
107 | return myRotationAngle; |
108 | } |
109 | |
110 | Standard_Boolean Aspect_Grid::IsActive() const { |
111 | return myIsActive; |
112 | } |
113 | void Aspect_Grid::Display() {} |
114 | |
115 | void Aspect_Grid::Erase () const {} |
116 | |
117 | void Aspect_Grid::UpdateDisplay () {} |
118 | |
119 | |
120 | Standard_Boolean Aspect_Grid::IsDisplayed() const { |
121 | return Standard_False;} |
122 | |
123 | void Aspect_Grid::SetDrawMode(const Aspect_GridDrawMode aDrawMode) { |
124 | myDrawMode = aDrawMode; |
125 | UpdateDisplay(); |
126 | } |
127 | Aspect_GridDrawMode Aspect_Grid::DrawMode() const { |
128 | return myDrawMode; |
129 | } |