0024624: Lost word in license statement in source files
[occt.git] / src / Aspect / Aspect_Grid.cxx
1 // Copyright (c) 1999-2014 OPEN CASCADE SAS
2 //
3 // This file is part of Open CASCADE Technology software library.
4 //
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
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.
10 //
11 // Alternatively, this file may be used under the terms of Open CASCADE
12 // commercial license or contractual agreement.
13
14 // Updated:     GG IMP230300 Add grid color parameters in constructor
15 //              and add new methods SetColors() & Colors()
16
17 #include <Aspect_Grid.ixx>
18
19
20 Aspect_Grid::Aspect_Grid(
21                                const Quantity_Length anXOrigin,
22                                const Quantity_Length anYOrigin,
23                                const Quantity_PlaneAngle anAngle,
24                                const Quantity_Color& aColor,
25                                const Quantity_Color& aTenthColor)
26 : myRotationAngle(anAngle),
27   myXOrigin(anXOrigin),
28   myYOrigin(anYOrigin),
29   myColor(aColor),
30   myTenthColor(aTenthColor),
31   myIsActive(Standard_False),
32   myDrawMode(Aspect_GDM_Lines)
33 {
34 }
35
36
37 void Aspect_Grid::SetXOrigin(const Quantity_Length anOrigin) {
38   myXOrigin = anOrigin;
39   Init();
40   UpdateDisplay();
41 }
42
43 void Aspect_Grid::SetYOrigin(const Quantity_Length anOrigin) {
44   myYOrigin = anOrigin;
45   Init();
46   UpdateDisplay();
47 }
48
49 void Aspect_Grid::SetRotationAngle(const Quantity_Length anAngle){
50
51
52   myRotationAngle = anAngle;
53   Init();
54   UpdateDisplay();
55 }
56 void Aspect_Grid::Rotate(const Quantity_PlaneAngle anAngle) {
57   myRotationAngle += anAngle;
58   Init();
59   UpdateDisplay();
60 }
61 void Aspect_Grid::Translate(const Quantity_Length aDx,
62                                   const Quantity_Length aDy) {
63   myXOrigin += aDx;
64   myYOrigin += aDy;
65   Init();
66   UpdateDisplay();
67 }
68
69 void Aspect_Grid::SetColors(const Quantity_Color& aColor,
70                             const Quantity_Color& aTenthColor) {
71   myColor = aColor;
72   myTenthColor = aTenthColor;
73   UpdateDisplay();
74 }
75
76 void Aspect_Grid::Colors(Quantity_Color& aColor,
77                          Quantity_Color& aTenthColor) const {
78   aColor = myColor;
79   aTenthColor = myTenthColor;
80 }
81
82 void Aspect_Grid::Hit(const Quantity_Length X,
83                          const Quantity_Length Y,
84                          Quantity_Length& gridX,
85                          Quantity_Length& gridY) const {
86    if (myIsActive) {
87      Compute(X,Y,gridX,gridY);}
88    else{
89     gridX = X;
90     gridY = Y;
91   }
92  }
93 void Aspect_Grid::Activate () {
94   myIsActive = Standard_True;
95 }
96
97 void Aspect_Grid::Deactivate () {
98   myIsActive = Standard_False;
99 }
100
101 Quantity_Length Aspect_Grid::XOrigin() const {
102   return myXOrigin;
103 }
104
105 Quantity_Length Aspect_Grid::YOrigin() const {
106   return myYOrigin;
107 }
108
109 Quantity_Length Aspect_Grid::RotationAngle() const {
110   return myRotationAngle;
111 }
112
113 Standard_Boolean Aspect_Grid::IsActive() const {
114   return myIsActive;
115 }
116 void Aspect_Grid::Display() {}
117
118 void Aspect_Grid::Erase () const {}
119
120 void Aspect_Grid::UpdateDisplay () {}
121
122
123 Standard_Boolean Aspect_Grid::IsDisplayed() const {
124   return Standard_False;}
125
126 void Aspect_Grid::SetDrawMode(const Aspect_GridDrawMode aDrawMode) {
127   myDrawMode = aDrawMode; 
128   UpdateDisplay();
129 }
130 Aspect_GridDrawMode Aspect_Grid::DrawMode() const {
131   return myDrawMode;
132 }