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
6 // This file is part of Open CASCADE Technology software library.
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.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
17 #ifndef _Aspect_RectangularGrid_HeaderFile
18 #define _Aspect_RectangularGrid_HeaderFile
20 #include <Standard.hxx>
21 #include <Standard_Type.hxx>
23 #include <Standard_Real.hxx>
24 #include <Aspect_Grid.hxx>
25 #include <Standard_Boolean.hxx>
26 class Standard_NegativeValue;
27 class Standard_NullValue;
28 class Standard_NumericError;
30 class Aspect_RectangularGrid : public Aspect_Grid
32 DEFINE_STANDARD_RTTIEXT(Aspect_RectangularGrid, Aspect_Grid)
35 //! creates a new grid. By default this grid is not
37 //! The first angle is given relatively to the horizontal.
38 //! The second angle is given relatively to the vertical.
39 Standard_EXPORT Aspect_RectangularGrid(const Standard_Real aXStep, const Standard_Real aYStep, const Standard_Real anXOrigin = 0, const Standard_Real anYOrigin = 0, const Standard_Real aFirstAngle = 0, const Standard_Real aSecondAngle = 0, const Standard_Real aRotationAngle = 0);
41 //! defines the x step of the grid.
42 Standard_EXPORT void SetXStep (const Standard_Real aStep);
44 //! defines the y step of the grid.
45 Standard_EXPORT void SetYStep (const Standard_Real aStep);
47 //! defines the angle of the second network
48 //! the fist angle is given relatively to the horizontal.
49 //! the second angle is given relatively to the vertical.
50 Standard_EXPORT void SetAngle (const Standard_Real anAngle1, const Standard_Real anAngle2);
52 Standard_EXPORT void SetGridValues (const Standard_Real XOrigin, const Standard_Real YOrigin, const Standard_Real XStep, const Standard_Real YStep, const Standard_Real RotationAngle);
54 //! returns the point of the grid the closest to the point X,Y
55 Standard_EXPORT virtual void Compute (const Standard_Real X, const Standard_Real Y, Standard_Real& gridX, Standard_Real& gridY) const Standard_OVERRIDE;
57 //! returns the x step of the grid.
58 Standard_EXPORT Standard_Real XStep() const;
60 //! returns the x step of the grid.
61 Standard_EXPORT Standard_Real YStep() const;
63 //! returns the x Angle of the grid, relatively to the horizontal.
64 Standard_EXPORT Standard_Real FirstAngle() const;
66 //! returns the y Angle of the grid, relatively to the vertical.
67 Standard_EXPORT Standard_Real SecondAngle() const;
69 Standard_EXPORT virtual void Init() Standard_OVERRIDE;
71 //! Dumps the content of me into the stream
72 Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const Standard_OVERRIDE;
76 Standard_EXPORT Standard_Boolean CheckAngle (const Standard_Real alpha, const Standard_Real beta) const;
80 Standard_Real myXStep;
81 Standard_Real myYStep;
82 Standard_Real myFirstAngle;
83 Standard_Real mySecondAngle;
93 DEFINE_STANDARD_HANDLE(Aspect_RectangularGrid, Aspect_Grid)
95 #endif // _Aspect_RectangularGrid_HeaderFile