Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-06-01 08:32:02

0001 // Created on: 1995-03-02
0002 // Created by: Jean-Louis Frenkel
0003 // Copyright (c) 1995-1999 Matra Datavision
0004 // Copyright (c) 1999-2014 OPEN CASCADE SAS
0005 //
0006 // This file is part of Open CASCADE Technology software library.
0007 //
0008 // This library is free software; you can redistribute it and/or modify it under
0009 // the terms of the GNU Lesser General Public License version 2.1 as published
0010 // by the Free Software Foundation, with special exception defined in the file
0011 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0012 // distribution for complete text of the license and disclaimer of any warranty.
0013 //
0014 // Alternatively, this file may be used under the terms of Open CASCADE
0015 // commercial license or contractual agreement.
0016 
0017 #ifndef _Aspect_Grid_HeaderFile
0018 #define _Aspect_Grid_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 
0022 #include <Quantity_Color.hxx>
0023 #include <Aspect_GridDrawMode.hxx>
0024 #include <Standard_Transient.hxx>
0025 
0026 class Aspect_Grid : public Standard_Transient
0027 {
0028   DEFINE_STANDARD_RTTIEXT(Aspect_Grid, Standard_Transient)
0029 public:
0030   //! defines the x Origin of the grid.
0031   Standard_EXPORT void SetXOrigin(const Standard_Real anOrigin);
0032 
0033   //! defines the y Origin of the grid.
0034   Standard_EXPORT void SetYOrigin(const Standard_Real anOrigin);
0035 
0036   //! defines the orientation of the grid.
0037   Standard_EXPORT void SetRotationAngle(const Standard_Real anAngle);
0038 
0039   //! Rotate the grid from a relative angle.
0040   Standard_EXPORT void Rotate(const Standard_Real anAngle);
0041 
0042   //! Translate the grid from a relative distance.
0043   Standard_EXPORT void Translate(const Standard_Real aDx, const Standard_Real aDy);
0044 
0045   //! Change the colors of the grid
0046   Standard_EXPORT virtual void SetColors(const Quantity_Color& aColor,
0047                                          const Quantity_Color& aTenthColor);
0048 
0049   //! returns the point of the grid the closest to the point X,Y
0050   //! if the grid is active. If the grid is not active returns
0051   //! X,Y.
0052   Standard_EXPORT void Hit(const Standard_Real X,
0053                            const Standard_Real Y,
0054                            Standard_Real&      gridX,
0055                            Standard_Real&      gridY) const;
0056 
0057   //! returns the point of the grid the closest to the point X,Y
0058   Standard_EXPORT virtual void Compute(const Standard_Real X,
0059                                        const Standard_Real Y,
0060                                        Standard_Real&      gridX,
0061                                        Standard_Real&      gridY) const = 0;
0062 
0063   //! activates the grid. The Hit method will return
0064   //! gridx and gridx computed according to the steps
0065   //! of the grid.
0066   void Activate() { myIsActive = Standard_True; }
0067 
0068   //! deactivates the grid. The hit method will return
0069   //! gridx and gridx as the enter value X & Y.
0070   void Deactivate() { myIsActive = Standard_False; }
0071 
0072   //! returns the x Origin of the grid.
0073   Standard_Real XOrigin() const { return myXOrigin; }
0074 
0075   //! returns the x Origin of the grid.
0076   Standard_Real YOrigin() const { return myYOrigin; }
0077 
0078   //! returns the x Angle of the grid.
0079   Standard_Real RotationAngle() const { return myRotationAngle; }
0080 
0081   //! Returns TRUE when the grid is active.
0082   Standard_Boolean IsActive() const { return myIsActive; }
0083 
0084   //! Returns the colors of the grid.
0085   Standard_EXPORT void Colors(Quantity_Color& aColor, Quantity_Color& aTenthColor) const;
0086 
0087   //! Change the grid aspect.
0088   Standard_EXPORT void SetDrawMode(const Aspect_GridDrawMode aDrawMode);
0089 
0090   //! Returns the grid aspect.
0091   Aspect_GridDrawMode DrawMode() const { return myDrawMode; }
0092 
0093   //! Display the grid at screen.
0094   Standard_EXPORT virtual void Display() = 0;
0095 
0096   //! Erase the grid from screen.
0097   Standard_EXPORT virtual void Erase() const = 0;
0098 
0099   //! Returns TRUE when the grid is displayed at screen.
0100   Standard_EXPORT virtual Standard_Boolean IsDisplayed() const = 0;
0101 
0102   Standard_EXPORT virtual void Init() = 0;
0103 
0104   //! Dumps the content of me into the stream
0105   Standard_EXPORT virtual void DumpJson(Standard_OStream& theOStream,
0106                                         Standard_Integer  theDepth = -1) const;
0107 
0108 protected:
0109   //! Creates a new grid. By default this grid is not active.
0110   Standard_EXPORT Aspect_Grid(const Standard_Real   theXOrigin       = 0.0,
0111                               const Standard_Real   theYOrigin       = 0.0,
0112                               const Standard_Real   theRotationAngle = 0,
0113                               const Quantity_Color& theColor         = Quantity_NOC_GRAY50,
0114                               const Quantity_Color& theTenthColor    = Quantity_NOC_GRAY70);
0115 
0116   //! Updates the grid parameters.
0117   Standard_EXPORT virtual void UpdateDisplay() = 0;
0118 
0119 protected:
0120   Standard_Real       myRotationAngle;
0121   Standard_Real       myXOrigin;
0122   Standard_Real       myYOrigin;
0123   Quantity_Color      myColor;
0124   Quantity_Color      myTenthColor;
0125   Standard_Boolean    myIsActive;
0126   Aspect_GridDrawMode myDrawMode;
0127 };
0128 
0129 DEFINE_STANDARD_HANDLE(Aspect_Grid, Standard_Transient)
0130 
0131 #endif // _Aspect_Grid_HeaderFile