0032308: Configuration - make Xlib dependency optional
[occt.git] / src / Aspect / Aspect_RectangularGrid.hxx
CommitLineData
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_RectangularGrid_HeaderFile
18#define _Aspect_RectangularGrid_HeaderFile
19
20#include <Standard.hxx>
21#include <Standard_Type.hxx>
22
42cf5bc1 23#include <Standard_Real.hxx>
24#include <Aspect_Grid.hxx>
25#include <Standard_Boolean.hxx>
26class Standard_NegativeValue;
27class Standard_NullValue;
28class Standard_NumericError;
29
42cf5bc1 30class Aspect_RectangularGrid : public Aspect_Grid
31{
475c2302 32 DEFINE_STANDARD_RTTIEXT(Aspect_RectangularGrid, Aspect_Grid)
42cf5bc1 33public:
34
42cf5bc1 35 //! creates a new grid. By default this grid is not
36 //! active.
37 //! The first angle is given relatively to the horizontal.
38 //! The second angle is given relatively to the vertical.
ee2be2a8 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);
42cf5bc1 40
41 //! defines the x step of the grid.
ee2be2a8 42 Standard_EXPORT void SetXStep (const Standard_Real aStep);
42cf5bc1 43
44 //! defines the y step of the grid.
ee2be2a8 45 Standard_EXPORT void SetYStep (const Standard_Real aStep);
42cf5bc1 46
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.
ee2be2a8 50 Standard_EXPORT void SetAngle (const Standard_Real anAngle1, const Standard_Real anAngle2);
42cf5bc1 51
ee2be2a8 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);
42cf5bc1 53
54 //! returns the point of the grid the closest to the point X,Y
475c2302 55 Standard_EXPORT virtual void Compute (const Standard_Real X, const Standard_Real Y, Standard_Real& gridX, Standard_Real& gridY) const Standard_OVERRIDE;
42cf5bc1 56
57 //! returns the x step of the grid.
ee2be2a8 58 Standard_EXPORT Standard_Real XStep() const;
42cf5bc1 59
60 //! returns the x step of the grid.
ee2be2a8 61 Standard_EXPORT Standard_Real YStep() const;
42cf5bc1 62
63 //! returns the x Angle of the grid, relatively to the horizontal.
ee2be2a8 64 Standard_EXPORT Standard_Real FirstAngle() const;
42cf5bc1 65
66 //! returns the y Angle of the grid, relatively to the vertical.
ee2be2a8 67 Standard_EXPORT Standard_Real SecondAngle() const;
42cf5bc1 68
475c2302 69 Standard_EXPORT virtual void Init() Standard_OVERRIDE;
a5162275 70
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;
42cf5bc1 73
42cf5bc1 74private:
75
ee2be2a8 76 Standard_EXPORT Standard_Boolean CheckAngle (const Standard_Real alpha, const Standard_Real beta) const;
42cf5bc1 77
475c2302 78private:
79
ee2be2a8 80 Standard_Real myXStep;
81 Standard_Real myYStep;
82 Standard_Real myFirstAngle;
83 Standard_Real mySecondAngle;
42cf5bc1 84 Standard_Real a1;
85 Standard_Real b1;
86 Standard_Real c1;
87 Standard_Real a2;
88 Standard_Real b2;
89 Standard_Real c2;
90
42cf5bc1 91};
92
475c2302 93DEFINE_STANDARD_HANDLE(Aspect_RectangularGrid, Aspect_Grid)
94
42cf5bc1 95#endif // _Aspect_RectangularGrid_HeaderFile