42cf5bc1 |
1 | // Created on: 1995-03-02 |
2 | // Created by: Jean-Louis Frenkel |
3 | // Copyright (c) 1995-1999 Matra Datavision |
4 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
5 | // |
6 | // This file is part of Open CASCADE Technology software library. |
7 | // |
8 | // This library is free software; you can redistribute it and/or modify it under |
9 | // the terms of the GNU Lesser General Public License version 2.1 as published |
10 | // by the Free Software Foundation, with special exception defined in the file |
11 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
12 | // distribution for complete text of the license and disclaimer of any warranty. |
13 | // |
14 | // Alternatively, this file may be used under the terms of Open CASCADE |
15 | // commercial license or contractual agreement. |
16 | |
17 | #ifndef _Aspect_Grid_HeaderFile |
18 | #define _Aspect_Grid_HeaderFile |
19 | |
20 | #include <Standard.hxx> |
21 | #include <Standard_Type.hxx> |
22 | |
23 | #include <Quantity_PlaneAngle.hxx> |
24 | #include <Quantity_Length.hxx> |
25 | #include <Quantity_Color.hxx> |
26 | #include <Standard_Boolean.hxx> |
27 | #include <Aspect_GridDrawMode.hxx> |
28 | #include <MMgt_TShared.hxx> |
29 | class Quantity_Color; |
30 | |
31 | |
32 | class Aspect_Grid; |
33 | DEFINE_STANDARD_HANDLE(Aspect_Grid, MMgt_TShared) |
34 | |
35 | |
36 | class Aspect_Grid : public MMgt_TShared |
37 | { |
38 | |
39 | public: |
40 | |
41 | |
42 | //! defines the x Origin of the grid. |
43 | Standard_EXPORT void SetXOrigin (const Quantity_Length anOrigin); |
44 | |
45 | //! defines the y Origin of the grid. |
46 | Standard_EXPORT void SetYOrigin (const Quantity_Length anOrigin); |
47 | |
48 | //! defines the orientation of the the grid. |
49 | Standard_EXPORT void SetRotationAngle (const Quantity_PlaneAngle anAngle); |
50 | |
51 | //! Rotate the grid from a relative angle. |
52 | Standard_EXPORT void Rotate (const Quantity_PlaneAngle anAngle); |
53 | |
54 | //! Translate the grid from a relative distance. |
55 | Standard_EXPORT void Translate (const Quantity_Length aDx, const Quantity_Length aDy); |
56 | |
57 | //! Change the colors of the grid |
58 | Standard_EXPORT virtual void SetColors (const Quantity_Color& aColor, const Quantity_Color& aTenthColor); |
59 | |
60 | //! returns the point of the grid the closest to the point X,Y |
61 | //! if the grid is active. If the grid is not active returns |
62 | //! X,Y. |
63 | Standard_EXPORT void Hit (const Quantity_Length X, const Quantity_Length Y, Quantity_Length& gridX, Quantity_Length& gridY) const; |
64 | |
65 | //! returns the point of the grid the closest to the point X,Y |
66 | Standard_EXPORT virtual void Compute (const Quantity_Length X, const Quantity_Length Y, Quantity_Length& gridX, Quantity_Length& gridY) const = 0; |
67 | |
68 | //! activates the grid. The Hit method will return |
69 | //! gridx and gridx computed according to the steps |
70 | //! of the grid. |
71 | Standard_EXPORT void Activate(); |
72 | |
73 | //! deactivates the grid. The hit method will return |
74 | //! gridx and gridx as the enter value X & Y. |
75 | Standard_EXPORT void Deactivate(); |
76 | |
77 | //! returns the x Origin of the grid. |
78 | Standard_EXPORT Quantity_Length XOrigin() const; |
79 | |
80 | //! returns the x Origin of the grid. |
81 | Standard_EXPORT Quantity_Length YOrigin() const; |
82 | |
83 | //! returns the x Angle of the grid. |
84 | Standard_EXPORT Quantity_PlaneAngle RotationAngle() const; |
85 | |
86 | //! Returns TRUE when the grid is active. |
87 | Standard_EXPORT Standard_Boolean IsActive() const; |
88 | |
89 | //! Returns the colors of the grid. |
90 | Standard_EXPORT void Colors (Quantity_Color& aColor, Quantity_Color& aTenthColor) const; |
91 | |
92 | //! Change the grid aspect. |
93 | Standard_EXPORT void SetDrawMode (const Aspect_GridDrawMode aDrawMode); |
94 | |
95 | //! Returns the grid aspect. |
96 | Standard_EXPORT Aspect_GridDrawMode DrawMode() const; |
97 | |
98 | //! Display the grid at screen. |
99 | Standard_EXPORT virtual void Display(); |
100 | |
101 | //! Erase the grid from screen. |
102 | Standard_EXPORT virtual void Erase() const; |
103 | |
104 | //! Returns TRUE when the grid is displayed at screen. |
105 | Standard_EXPORT virtual Standard_Boolean IsDisplayed() const; |
106 | |
107 | Standard_EXPORT virtual void Init() = 0; |
108 | |
109 | |
110 | |
111 | |
92efcf78 |
112 | DEFINE_STANDARD_RTTIEXT(Aspect_Grid,MMgt_TShared) |
42cf5bc1 |
113 | |
114 | protected: |
115 | |
116 | |
117 | //! creates a new grid. By default this grid is not |
118 | //! active. |
119 | Standard_EXPORT Aspect_Grid(const Quantity_Length anXOrigin = 0.0, const Quantity_Length anYOrigin = 0.0, const Quantity_PlaneAngle aRotationAngle = 0, const Quantity_Color& aColor = Quantity_NOC_GRAY50, const Quantity_Color& aTenthColor = Quantity_NOC_GRAY70); |
120 | |
121 | //! Updates the grid parameters. |
122 | Standard_EXPORT virtual void UpdateDisplay(); |
123 | |
124 | Quantity_PlaneAngle myRotationAngle; |
125 | Quantity_Length myXOrigin; |
126 | Quantity_Length myYOrigin; |
127 | Quantity_Color myColor; |
128 | Quantity_Color myTenthColor; |
129 | |
130 | |
131 | private: |
132 | |
133 | |
134 | Standard_Boolean myIsActive; |
135 | Aspect_GridDrawMode myDrawMode; |
136 | |
137 | |
138 | }; |
139 | |
140 | |
141 | |
142 | |
143 | |
144 | |
145 | |
146 | #endif // _Aspect_Grid_HeaderFile |