cb31b0f438612c5d2f494c775cf4ac663d493d05
[occt.git] / src / Aspect / Aspect_RectangularGrid.hxx
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_RectangularGrid_HeaderFile
18 #define _Aspect_RectangularGrid_HeaderFile
19
20 #include <Standard.hxx>
21 #include <Standard_Type.hxx>
22
23 #include <Quantity_Length.hxx>
24 #include <Quantity_PlaneAngle.hxx>
25 #include <Standard_Real.hxx>
26 #include <Aspect_Grid.hxx>
27 #include <Standard_Boolean.hxx>
28 class Standard_NegativeValue;
29 class Standard_NullValue;
30 class Standard_NumericError;
31
32
33 class Aspect_RectangularGrid;
34 DEFINE_STANDARD_HANDLE(Aspect_RectangularGrid, Aspect_Grid)
35
36
37 class Aspect_RectangularGrid : public Aspect_Grid
38 {
39
40 public:
41
42   
43   //! creates a new grid. By default this grid is not
44   //! active.
45   //! The first angle is given relatively to the horizontal.
46   //! The second angle is given relatively to the vertical.
47   Standard_EXPORT Aspect_RectangularGrid(const Quantity_Length aXStep, const Quantity_Length aYStep, const Quantity_Length anXOrigin = 0, const Quantity_Length anYOrigin = 0, const Quantity_PlaneAngle aFirstAngle = 0, const Quantity_PlaneAngle aSecondAngle = 0, const Quantity_PlaneAngle aRotationAngle = 0);
48   
49   //! defines the x step of the grid.
50   Standard_EXPORT void SetXStep (const Quantity_Length aStep);
51   
52   //! defines the y step of the grid.
53   Standard_EXPORT void SetYStep (const Quantity_Length aStep);
54   
55   //! defines the angle of the second network
56   //! the fist angle is given relatively to the horizontal.
57   //! the second angle is given relatively to the vertical.
58   Standard_EXPORT void SetAngle (const Quantity_PlaneAngle anAngle1, const Quantity_PlaneAngle anAngle2);
59   
60   Standard_EXPORT void SetGridValues (const Quantity_Length XOrigin, const Quantity_Length YOrigin, const Quantity_Length XStep, const Quantity_Length YStep, const Quantity_PlaneAngle RotationAngle);
61   
62   //! returns the point of the grid the closest to the point X,Y
63   Standard_EXPORT void Compute (const Quantity_Length X, const Quantity_Length Y, Quantity_Length& gridX, Quantity_Length& gridY) const Standard_OVERRIDE;
64   
65   //! returns the x step of the grid.
66   Standard_EXPORT Quantity_Length XStep() const;
67   
68   //! returns the x step of the grid.
69   Standard_EXPORT Quantity_Length YStep() const;
70   
71   //! returns the x Angle of the grid, relatively to the horizontal.
72   Standard_EXPORT Quantity_PlaneAngle FirstAngle() const;
73   
74   //! returns the y Angle of the grid, relatively to the vertical.
75   Standard_EXPORT Quantity_PlaneAngle SecondAngle() const;
76   
77   Standard_EXPORT void Init() Standard_OVERRIDE;
78
79
80
81
82   DEFINE_STANDARD_RTTIEXT(Aspect_RectangularGrid,Aspect_Grid)
83
84 protected:
85
86
87
88
89 private:
90
91   
92   Standard_EXPORT Standard_Boolean CheckAngle (const Quantity_PlaneAngle alpha, const Quantity_PlaneAngle beta) const;
93
94   Quantity_Length myXStep;
95   Quantity_Length myYStep;
96   Quantity_PlaneAngle myFirstAngle;
97   Quantity_PlaneAngle mySecondAngle;
98   Standard_Real a1;
99   Standard_Real b1;
100   Standard_Real c1;
101   Standard_Real a2;
102   Standard_Real b2;
103   Standard_Real c2;
104
105
106 };
107
108
109
110
111
112
113
114 #endif // _Aspect_RectangularGrid_HeaderFile