Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:02:58

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 
0031   //! defines the x Origin of the grid.
0032   Standard_EXPORT void SetXOrigin (const Standard_Real anOrigin);
0033   
0034   //! defines the y Origin of the grid.
0035   Standard_EXPORT void SetYOrigin (const Standard_Real anOrigin);
0036   
0037   //! defines the orientation of the grid.
0038   Standard_EXPORT void SetRotationAngle (const Standard_Real anAngle);
0039   
0040   //! Rotate the grid from a relative angle.
0041   Standard_EXPORT void Rotate (const Standard_Real anAngle);
0042   
0043   //! Translate the grid from a relative distance.
0044   Standard_EXPORT void Translate (const Standard_Real aDx, const Standard_Real aDy);
0045   
0046   //! Change the colors of the grid
0047   Standard_EXPORT virtual void SetColors (const Quantity_Color& aColor, 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, const Standard_Real Y, Standard_Real& gridX, Standard_Real& gridY) const;
0053   
0054   //! returns the point of the grid the closest to the point X,Y
0055   Standard_EXPORT virtual void Compute (const Standard_Real X, const Standard_Real Y, Standard_Real& gridX, Standard_Real& gridY) const = 0;
0056   
0057   //! activates the grid. The Hit method will return
0058   //! gridx and gridx computed according to the steps
0059   //! of the grid.
0060   void Activate() { myIsActive = Standard_True; }
0061   
0062   //! deactivates the grid. The hit method will return
0063   //! gridx and gridx as the enter value X & Y.
0064   void Deactivate() { myIsActive = Standard_False; }
0065   
0066   //! returns the x Origin of the grid.
0067   Standard_Real XOrigin() const { return myXOrigin; }
0068   
0069   //! returns the x Origin of the grid.
0070   Standard_Real YOrigin() const { return myYOrigin; }
0071   
0072   //! returns the x Angle of the grid.
0073   Standard_Real RotationAngle() const { return myRotationAngle; }
0074   
0075   //! Returns TRUE when the grid is active.
0076   Standard_Boolean IsActive() const { return myIsActive; }
0077   
0078   //! Returns the colors of the grid.
0079   Standard_EXPORT void Colors (Quantity_Color& aColor, Quantity_Color& aTenthColor) const;
0080   
0081   //! Change the grid aspect.
0082   Standard_EXPORT void SetDrawMode (const Aspect_GridDrawMode aDrawMode);
0083   
0084   //! Returns the grid aspect.
0085   Aspect_GridDrawMode DrawMode() const { return myDrawMode; }
0086 
0087   //! Display the grid at screen.
0088   Standard_EXPORT virtual void Display() = 0;
0089   
0090   //! Erase the grid from screen.
0091   Standard_EXPORT virtual void Erase() const = 0;
0092   
0093   //! Returns TRUE when the grid is displayed at screen.
0094   Standard_EXPORT virtual Standard_Boolean IsDisplayed() const = 0;
0095   
0096   Standard_EXPORT virtual void Init() = 0;
0097   
0098   //! Dumps the content of me into the stream
0099   Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const;
0100 
0101 protected:
0102 
0103   //! Creates a new grid. By default this grid is not active.
0104   Standard_EXPORT Aspect_Grid (const Standard_Real theXOrigin = 0.0,
0105                                const Standard_Real theYOrigin = 0.0,
0106                                const Standard_Real theRotationAngle = 0,
0107                                const Quantity_Color& theColor = Quantity_NOC_GRAY50,
0108                                const Quantity_Color& theTenthColor = Quantity_NOC_GRAY70);
0109   
0110   //! Updates the grid parameters.
0111   Standard_EXPORT virtual void UpdateDisplay() = 0;
0112 
0113 protected:
0114 
0115   Standard_Real myRotationAngle;
0116   Standard_Real myXOrigin;
0117   Standard_Real myYOrigin;
0118   Quantity_Color myColor;
0119   Quantity_Color myTenthColor;
0120   Standard_Boolean myIsActive;
0121   Aspect_GridDrawMode myDrawMode;
0122 
0123 };
0124 
0125 DEFINE_STANDARD_HANDLE(Aspect_Grid, Standard_Transient)
0126 
0127 #endif // _Aspect_Grid_HeaderFile