0024002: Overall code and build procedure refactoring -- automatic
[occt.git] / src / Aspect / Aspect_Grid.cxx
CommitLineData
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
42cf5bc1 15#include <Aspect_Grid.hxx>
16#include <Quantity_Color.hxx>
17#include <Standard_Type.hxx>
7fd59977 18
19Aspect_Grid::Aspect_Grid(
20 const Quantity_Length anXOrigin,
21 const Quantity_Length anYOrigin,
22 const Quantity_PlaneAngle anAngle,
23 const Quantity_Color& aColor,
24 const Quantity_Color& aTenthColor)
25: myRotationAngle(anAngle),
26 myXOrigin(anXOrigin),
27 myYOrigin(anYOrigin),
28 myColor(aColor),
29 myTenthColor(aTenthColor),
30 myIsActive(Standard_False),
31 myDrawMode(Aspect_GDM_Lines)
32{
33}
34
35
36void Aspect_Grid::SetXOrigin(const Quantity_Length anOrigin) {
37 myXOrigin = anOrigin;
38 Init();
39 UpdateDisplay();
40}
41
42void Aspect_Grid::SetYOrigin(const Quantity_Length anOrigin) {
43 myYOrigin = anOrigin;
44 Init();
45 UpdateDisplay();
46}
47
48void Aspect_Grid::SetRotationAngle(const Quantity_Length anAngle){
49
50
51 myRotationAngle = anAngle;
52 Init();
53 UpdateDisplay();
54}
55void Aspect_Grid::Rotate(const Quantity_PlaneAngle anAngle) {
56 myRotationAngle += anAngle;
57 Init();
58 UpdateDisplay();
59}
60void Aspect_Grid::Translate(const Quantity_Length aDx,
61 const Quantity_Length aDy) {
62 myXOrigin += aDx;
63 myYOrigin += aDy;
64 Init();
65 UpdateDisplay();
66}
67
68void Aspect_Grid::SetColors(const Quantity_Color& aColor,
69 const Quantity_Color& aTenthColor) {
70 myColor = aColor;
71 myTenthColor = aTenthColor;
72 UpdateDisplay();
73}
74
75void Aspect_Grid::Colors(Quantity_Color& aColor,
76 Quantity_Color& aTenthColor) const {
77 aColor = myColor;
78 aTenthColor = myTenthColor;
79}
80
81void Aspect_Grid::Hit(const Quantity_Length X,
82 const Quantity_Length Y,
83 Quantity_Length& gridX,
84 Quantity_Length& gridY) const {
85 if (myIsActive) {
86 Compute(X,Y,gridX,gridY);}
87 else{
88 gridX = X;
89 gridY = Y;
90 }
91 }
92void Aspect_Grid::Activate () {
93 myIsActive = Standard_True;
94}
95
96void Aspect_Grid::Deactivate () {
97 myIsActive = Standard_False;
98}
99
100Quantity_Length Aspect_Grid::XOrigin() const {
101 return myXOrigin;
102}
103
104Quantity_Length Aspect_Grid::YOrigin() const {
105 return myYOrigin;
106}
107
108Quantity_Length Aspect_Grid::RotationAngle() const {
109 return myRotationAngle;
110}
111
112Standard_Boolean Aspect_Grid::IsActive() const {
113 return myIsActive;
114}
115void Aspect_Grid::Display() {}
116
117void Aspect_Grid::Erase () const {}
118
119void Aspect_Grid::UpdateDisplay () {}
120
121
122Standard_Boolean Aspect_Grid::IsDisplayed() const {
123 return Standard_False;}
124
125void Aspect_Grid::SetDrawMode(const Aspect_GridDrawMode aDrawMode) {
126 myDrawMode = aDrawMode;
127 UpdateDisplay();
128}
129Aspect_GridDrawMode Aspect_Grid::DrawMode() const {
130 return myDrawMode;
131}