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 <Standard_Real.hxx> 24 #include <Aspect_Grid.hxx> 25 #include <Standard_Boolean.hxx> 26 27 class Aspect_RectangularGrid : public Aspect_Grid 28 { 29 DEFINE_STANDARD_RTTIEXT(Aspect_RectangularGrid, Aspect_Grid) 30 public: 31 32 //! creates a new grid. By default this grid is not 33 //! active. 34 //! The first angle is given relatively to the horizontal. 35 //! The second angle is given relatively to the vertical. 36 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); 37 38 //! defines the x step of the grid. 39 Standard_EXPORT void SetXStep (const Standard_Real aStep); 40 41 //! defines the y step of the grid. 42 Standard_EXPORT void SetYStep (const Standard_Real aStep); 43 44 //! defines the angle of the second network 45 //! the fist angle is given relatively to the horizontal. 46 //! the second angle is given relatively to the vertical. 47 Standard_EXPORT void SetAngle (const Standard_Real anAngle1, const Standard_Real anAngle2); 48 49 Standard_EXPORT void SetGridValues (const Standard_Real XOrigin, const Standard_Real YOrigin, const Standard_Real XStep, const Standard_Real YStep, const Standard_Real RotationAngle); 50 51 //! returns the point of the grid the closest to the point X,Y 52 Standard_EXPORT virtual void Compute (const Standard_Real X, const Standard_Real Y, Standard_Real& gridX, Standard_Real& gridY) const Standard_OVERRIDE; 53 54 //! returns the x step of the grid. 55 Standard_EXPORT Standard_Real XStep() const; 56 57 //! returns the x step of the grid. 58 Standard_EXPORT Standard_Real YStep() const; 59 60 //! returns the x Angle of the grid, relatively to the horizontal. 61 Standard_EXPORT Standard_Real FirstAngle() const; 62 63 //! returns the y Angle of the grid, relatively to the vertical. 64 Standard_EXPORT Standard_Real SecondAngle() const; 65 66 Standard_EXPORT virtual void Init() Standard_OVERRIDE; 67 68 //! Dumps the content of me into the stream 69 Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const Standard_OVERRIDE; 70 71 private: 72 73 Standard_EXPORT Standard_Boolean CheckAngle (const Standard_Real alpha, const Standard_Real beta) const; 74 75 private: 76 77 Standard_Real myXStep; 78 Standard_Real myYStep; 79 Standard_Real myFirstAngle; 80 Standard_Real mySecondAngle; 81 Standard_Real a1; 82 Standard_Real b1; 83 Standard_Real c1; 84 Standard_Real a2; 85 Standard_Real b2; 86 Standard_Real c2; 87 88 }; 89 90 DEFINE_STANDARD_HANDLE(Aspect_RectangularGrid, Aspect_Grid) 91 92 #endif // _Aspect_RectangularGrid_HeaderFile 93