0023024: Update headers of OCCT files
[occt.git] / src / Aspect / Aspect_Grid.cxx
1 // Copyright (c) 1999-2012 OPEN CASCADE SAS
2 //
3 // The content of this file is subject to the Open CASCADE Technology Public
4 // License Version 6.5 (the "License"). You may not use the content of this file
5 // except in compliance with the License. Please obtain a copy of the License
6 // at http://www.opencascade.org and read it completely before using this file.
7 //
8 // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
9 // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
10 //
11 // The Original Code and all software distributed under the License is
12 // distributed on an "AS IS" basis, without warranty of any kind, and the
13 // Initial Developer hereby disclaims all such warranties, including without
14 // limitation, any warranties of merchantability, fitness for a particular
15 // purpose or non-infringement. Please see the License for the specific terms
16 // and conditions governing the rights and limitations under the License.
17
18 // Updated:     GG IMP230300 Add grid color parameters in constructor
19 //              and add new methods SetColors() & Colors()
20
21 #include <Aspect_Grid.ixx>
22
23
24 Aspect_Grid::Aspect_Grid(
25                                const Quantity_Length anXOrigin,
26                                const Quantity_Length anYOrigin,
27                                const Quantity_PlaneAngle anAngle,
28                                const Quantity_Color& aColor,
29                                const Quantity_Color& aTenthColor)
30 : myRotationAngle(anAngle),
31   myXOrigin(anXOrigin),
32   myYOrigin(anYOrigin),
33   myColor(aColor),
34   myTenthColor(aTenthColor),
35   myIsActive(Standard_False),
36   myDrawMode(Aspect_GDM_Lines)
37 {
38 }
39
40
41 void Aspect_Grid::SetXOrigin(const Quantity_Length anOrigin) {
42   myXOrigin = anOrigin;
43   Init();
44   UpdateDisplay();
45 }
46
47 void Aspect_Grid::SetYOrigin(const Quantity_Length anOrigin) {
48   myYOrigin = anOrigin;
49   Init();
50   UpdateDisplay();
51 }
52
53 void Aspect_Grid::SetRotationAngle(const Quantity_Length anAngle){
54
55
56   myRotationAngle = anAngle;
57   Init();
58   UpdateDisplay();
59 }
60 void Aspect_Grid::Rotate(const Quantity_PlaneAngle anAngle) {
61   myRotationAngle += anAngle;
62   Init();
63   UpdateDisplay();
64 }
65 void Aspect_Grid::Translate(const Quantity_Length aDx,
66                                   const Quantity_Length aDy) {
67   myXOrigin += aDx;
68   myYOrigin += aDy;
69   Init();
70   UpdateDisplay();
71 }
72
73 void Aspect_Grid::SetColors(const Quantity_Color& aColor,
74                             const Quantity_Color& aTenthColor) {
75   myColor = aColor;
76   myTenthColor = aTenthColor;
77   UpdateDisplay();
78 }
79
80 void Aspect_Grid::Colors(Quantity_Color& aColor,
81                          Quantity_Color& aTenthColor) const {
82   aColor = myColor;
83   aTenthColor = myTenthColor;
84 }
85
86 void Aspect_Grid::Hit(const Quantity_Length X,
87                          const Quantity_Length Y,
88                          Quantity_Length& gridX,
89                          Quantity_Length& gridY) const {
90    if (myIsActive) {
91      Compute(X,Y,gridX,gridY);}
92    else{
93     gridX = X;
94     gridY = Y;
95   }
96  }
97 void Aspect_Grid::Activate () {
98   myIsActive = Standard_True;
99 }
100
101 void Aspect_Grid::Deactivate () {
102   myIsActive = Standard_False;
103 }
104
105 Quantity_Length Aspect_Grid::XOrigin() const {
106   return myXOrigin;
107 }
108
109 Quantity_Length Aspect_Grid::YOrigin() const {
110   return myYOrigin;
111 }
112
113 Quantity_Length Aspect_Grid::RotationAngle() const {
114   return myRotationAngle;
115 }
116
117 Standard_Boolean Aspect_Grid::IsActive() const {
118   return myIsActive;
119 }
120 void Aspect_Grid::Display() {}
121
122 void Aspect_Grid::Erase () const {}
123
124 void Aspect_Grid::UpdateDisplay () {}
125
126
127 Standard_Boolean Aspect_Grid::IsDisplayed() const {
128   return Standard_False;}
129
130 void Aspect_Grid::SetDrawMode(const Aspect_GridDrawMode aDrawMode) {
131   myDrawMode = aDrawMode; 
132   UpdateDisplay();
133 }
134 Aspect_GridDrawMode Aspect_Grid::DrawMode() const {
135   return myDrawMode;
136 }