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 | |
42cf5bc1 |
23 | #include <Quantity_Color.hxx> |
24 | #include <Standard_Boolean.hxx> |
25 | #include <Aspect_GridDrawMode.hxx> |
26 | #include <MMgt_TShared.hxx> |
42cf5bc1 |
27 | |
28 | class Aspect_Grid; |
29 | DEFINE_STANDARD_HANDLE(Aspect_Grid, MMgt_TShared) |
30 | |
42cf5bc1 |
31 | class Aspect_Grid : public MMgt_TShared |
32 | { |
33 | |
34 | public: |
35 | |
42cf5bc1 |
36 | //! defines the x Origin of the grid. |
ee2be2a8 |
37 | Standard_EXPORT void SetXOrigin (const Standard_Real anOrigin); |
42cf5bc1 |
38 | |
39 | //! defines the y Origin of the grid. |
ee2be2a8 |
40 | Standard_EXPORT void SetYOrigin (const Standard_Real anOrigin); |
42cf5bc1 |
41 | |
42 | //! defines the orientation of the the grid. |
ee2be2a8 |
43 | Standard_EXPORT void SetRotationAngle (const Standard_Real anAngle); |
42cf5bc1 |
44 | |
45 | //! Rotate the grid from a relative angle. |
ee2be2a8 |
46 | Standard_EXPORT void Rotate (const Standard_Real anAngle); |
42cf5bc1 |
47 | |
48 | //! Translate the grid from a relative distance. |
ee2be2a8 |
49 | Standard_EXPORT void Translate (const Standard_Real aDx, const Standard_Real aDy); |
42cf5bc1 |
50 | |
51 | //! Change the colors of the grid |
52 | Standard_EXPORT virtual void SetColors (const Quantity_Color& aColor, const Quantity_Color& aTenthColor); |
53 | |
54 | //! returns the point of the grid the closest to the point X,Y |
55 | //! if the grid is active. If the grid is not active returns |
56 | //! X,Y. |
ee2be2a8 |
57 | Standard_EXPORT void Hit (const Standard_Real X, const Standard_Real Y, Standard_Real& gridX, Standard_Real& gridY) const; |
42cf5bc1 |
58 | |
59 | //! returns the point of the grid the closest to the point X,Y |
ee2be2a8 |
60 | Standard_EXPORT virtual void Compute (const Standard_Real X, const Standard_Real Y, Standard_Real& gridX, Standard_Real& gridY) const = 0; |
42cf5bc1 |
61 | |
62 | //! activates the grid. The Hit method will return |
63 | //! gridx and gridx computed according to the steps |
64 | //! of the grid. |
65 | Standard_EXPORT void Activate(); |
66 | |
67 | //! deactivates the grid. The hit method will return |
68 | //! gridx and gridx as the enter value X & Y. |
69 | Standard_EXPORT void Deactivate(); |
70 | |
71 | //! returns the x Origin of the grid. |
ee2be2a8 |
72 | Standard_EXPORT Standard_Real XOrigin() const; |
42cf5bc1 |
73 | |
74 | //! returns the x Origin of the grid. |
ee2be2a8 |
75 | Standard_EXPORT Standard_Real YOrigin() const; |
42cf5bc1 |
76 | |
77 | //! returns the x Angle of the grid. |
ee2be2a8 |
78 | Standard_EXPORT Standard_Real RotationAngle() const; |
42cf5bc1 |
79 | |
80 | //! Returns TRUE when the grid is active. |
81 | Standard_EXPORT Standard_Boolean IsActive() const; |
82 | |
83 | //! Returns the colors of the grid. |
84 | Standard_EXPORT void Colors (Quantity_Color& aColor, Quantity_Color& aTenthColor) const; |
85 | |
86 | //! Change the grid aspect. |
87 | Standard_EXPORT void SetDrawMode (const Aspect_GridDrawMode aDrawMode); |
88 | |
89 | //! Returns the grid aspect. |
90 | Standard_EXPORT Aspect_GridDrawMode DrawMode() const; |
91 | |
92 | //! Display the grid at screen. |
93 | Standard_EXPORT virtual void Display(); |
94 | |
95 | //! Erase the grid from screen. |
96 | Standard_EXPORT virtual void Erase() const; |
97 | |
98 | //! Returns TRUE when the grid is displayed at screen. |
99 | Standard_EXPORT virtual Standard_Boolean IsDisplayed() const; |
100 | |
101 | Standard_EXPORT virtual void Init() = 0; |
102 | |
92efcf78 |
103 | DEFINE_STANDARD_RTTIEXT(Aspect_Grid,MMgt_TShared) |
42cf5bc1 |
104 | |
105 | protected: |
106 | |
42cf5bc1 |
107 | //! creates a new grid. By default this grid is not |
108 | //! active. |
ee2be2a8 |
109 | Standard_EXPORT Aspect_Grid(const Standard_Real anXOrigin = 0.0, const Standard_Real anYOrigin = 0.0, const Standard_Real aRotationAngle = 0, const Quantity_Color& aColor = Quantity_NOC_GRAY50, const Quantity_Color& aTenthColor = Quantity_NOC_GRAY70); |
42cf5bc1 |
110 | |
111 | //! Updates the grid parameters. |
112 | Standard_EXPORT virtual void UpdateDisplay(); |
113 | |
ee2be2a8 |
114 | Standard_Real myRotationAngle; |
115 | Standard_Real myXOrigin; |
116 | Standard_Real myYOrigin; |
42cf5bc1 |
117 | Quantity_Color myColor; |
118 | Quantity_Color myTenthColor; |
119 | |
42cf5bc1 |
120 | private: |
121 | |
42cf5bc1 |
122 | Standard_Boolean myIsActive; |
123 | Aspect_GridDrawMode myDrawMode; |
124 | |
42cf5bc1 |
125 | }; |
126 | |
42cf5bc1 |
127 | #endif // _Aspect_Grid_HeaderFile |