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 | |
42cf5bc1 |
14 | #include <Aspect_Grid.hxx> |
7fd59977 |
15 | |
25e59720 |
16 | IMPLEMENT_STANDARD_RTTIEXT(Aspect_Grid,Standard_Transient) |
92efcf78 |
17 | |
475c2302 |
18 | Aspect_Grid::Aspect_Grid (const Standard_Real theXOrigin, |
19 | const Standard_Real theYOrigin, |
20 | const Standard_Real theAngle, |
21 | const Quantity_Color& theColor, |
22 | const Quantity_Color& theTenthColor) |
23 | : myRotationAngle (theAngle), |
24 | myXOrigin (theXOrigin), |
25 | myYOrigin (theYOrigin), |
26 | myColor (theColor), |
27 | myTenthColor (theTenthColor), |
28 | myIsActive (Standard_False), |
29 | myDrawMode (Aspect_GDM_Lines) |
7fd59977 |
30 | { |
475c2302 |
31 | // |
7fd59977 |
32 | } |
33 | |
475c2302 |
34 | void Aspect_Grid::SetXOrigin (const Standard_Real theOrigin) |
35 | { |
36 | myXOrigin = theOrigin; |
7fd59977 |
37 | Init(); |
38 | UpdateDisplay(); |
39 | } |
40 | |
475c2302 |
41 | void Aspect_Grid::SetYOrigin (const Standard_Real theOrigin) |
42 | { |
43 | myYOrigin = theOrigin; |
7fd59977 |
44 | Init(); |
45 | UpdateDisplay(); |
46 | } |
47 | |
475c2302 |
48 | void Aspect_Grid::SetRotationAngle (const Standard_Real theAngle) |
49 | { |
50 | myRotationAngle = theAngle; |
7fd59977 |
51 | Init(); |
52 | UpdateDisplay(); |
53 | } |
475c2302 |
54 | |
55 | void Aspect_Grid::Rotate (const Standard_Real theAngle) |
56 | { |
57 | myRotationAngle += theAngle; |
7fd59977 |
58 | Init(); |
59 | UpdateDisplay(); |
60 | } |
475c2302 |
61 | |
62 | void Aspect_Grid::Translate (const Standard_Real theDx, |
63 | const Standard_Real theDy) |
64 | { |
65 | myXOrigin += theDx; |
66 | myYOrigin += theDy; |
7fd59977 |
67 | Init(); |
68 | UpdateDisplay(); |
69 | } |
70 | |
475c2302 |
71 | void Aspect_Grid::SetColors (const Quantity_Color& theColor, |
72 | const Quantity_Color& theTenthColor) |
73 | { |
74 | myColor = theColor; |
75 | myTenthColor = theTenthColor; |
7fd59977 |
76 | UpdateDisplay(); |
77 | } |
78 | |
475c2302 |
79 | void Aspect_Grid::Colors (Quantity_Color& theColor, |
80 | Quantity_Color& theTenthColor) const |
81 | { |
82 | theColor = myColor; |
83 | theTenthColor = myTenthColor; |
7fd59977 |
84 | } |
85 | |
475c2302 |
86 | void Aspect_Grid::Hit (const Standard_Real theX, |
87 | const Standard_Real theY, |
88 | Standard_Real& theGridX, |
89 | Standard_Real& theGridY) const |
90 | { |
91 | if (myIsActive) |
92 | { |
93 | Compute (theX, theY, theGridX, theGridY); |
94 | } |
95 | else |
96 | { |
97 | theGridX = theX; |
98 | theGridY = theY; |
7fd59977 |
99 | } |
7fd59977 |
100 | } |
7fd59977 |
101 | |
475c2302 |
102 | void Aspect_Grid::SetDrawMode (const Aspect_GridDrawMode theDrawMode) |
103 | { |
104 | myDrawMode = theDrawMode; |
7fd59977 |
105 | UpdateDisplay(); |
106 | } |