Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:03:24

0001 // Copyright (c) 2015 OPEN CASCADE SAS
0002 //
0003 // This file is part of Open CASCADE Technology software library.
0004 //
0005 // This library is free software; you can redistribute it and/or modify it under
0006 // the terms of the GNU Lesser General Public License version 2.1 as published
0007 // by the Free Software Foundation, with special exception defined in the file
0008 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0009 // distribution for complete text of the license and disclaimer of any warranty.
0010 //
0011 // Alternatively, this file may be used under the terms of Open CASCADE
0012 // commercial license or contractual agreement.
0013 
0014 #ifndef Draw_View_Header
0015 #define Draw_View_Header
0016 
0017 #include <gp_Trsf.hxx>
0018 #include <Draw_Window.hxx>
0019 
0020 class Draw_Viewer;
0021 
0022 class Draw_View : public Draw_Window
0023 {
0024 public:
0025 
0026   //! Constructor
0027   Draw_View(Standard_Integer theId,
0028             Draw_Viewer*     theViewer,
0029             Standard_Integer theX,
0030             Standard_Integer theY,
0031             Standard_Integer theWidth,
0032             Standard_Integer theHeight,
0033             Aspect_Drawable  theWindow = 0);
0034 
0035   //! Constructor.
0036   Draw_View(Standard_Integer theId,
0037             Draw_Viewer*     theViewer,
0038             const char*      theTitle);
0039 
0040   //! Destructor.
0041   ~Draw_View();
0042 
0043 public: // @name getters and setters
0044 
0045   //! Gets horizontal offset.
0046   Standard_Integer GetDx() const { return myDx; }
0047 
0048   //! Sets horizontal offset.
0049   void SetDx (const Standard_Integer theDx) { myDx = theDx; }
0050 
0051   //! Gets vertical offset.
0052   Standard_Integer GetDy() const { return myDy; }
0053 
0054   //! Sets vertical offset.
0055   void SetDy (const Standard_Integer theDy) { myDy = theDy; }
0056 
0057   //! Gets parameter of zoom.
0058   Standard_Real GetZoom() const { return myZoom; }
0059 
0060   //! Sets parameter of zoom.
0061   void SetZoom (const Standard_Real theZoom) { myZoom = theZoom; }
0062 
0063   //! Gets matrix of view.
0064   const gp_Trsf& GetMatrix() const { return myMatrix; }
0065 
0066   //! Sets view matrix.
0067   void SetMatrix (const gp_Trsf& theMatrix) { myMatrix = theMatrix; }
0068 
0069   //! Gets focal distance.
0070   Standard_Real GetFocalDistance() const { return myFocalDistance; }
0071 
0072   //! Sets focal distance.
0073   void SetFocalDistance (const Standard_Real theDistance) { myFocalDistance = theDistance; }
0074 
0075   //! Returns type of view.
0076   const char* Type() { return myType; }
0077 
0078   //! Returns true value if current view in 2D mode.
0079   Standard_Boolean Is2D() const { return myIs2D; }
0080 
0081   //! Returns true value if current view in perspective mode.
0082   Standard_Real IsPerspective() const { return myIsPers; }
0083 
0084 public: //! @name view API
0085 
0086   //! Initialize view by the type.
0087   Standard_Boolean Init(const char* theType);
0088 
0089   //! Transform view matrix.
0090   void Transform(const gp_Trsf& theTransformation);
0091 
0092   //! Resets frame of current view.
0093   void ResetFrame();
0094 
0095   //! Returns parameters of frame corners.
0096   void GetFrame(Standard_Integer& theX0,Standard_Integer& theY0,
0097                 Standard_Integer& theX1,Standard_Integer& theY1);
0098 
0099   //! Perform window exposing.
0100   virtual void WExpose() Standard_OVERRIDE;
0101 
0102 protected:
0103 
0104   Standard_Integer       myId;
0105   Draw_Viewer*           myViewer;
0106   char                   myType[5];
0107   Standard_Boolean       myIsPers;
0108   Standard_Boolean       myIs2D;
0109   Standard_Real          myFocalDistance;
0110   Standard_Real          myZoom;
0111   gp_Trsf                myMatrix;
0112   Standard_Integer       myDx;
0113   Standard_Integer       myDy;
0114   Standard_Integer       myFrameX0;
0115   Standard_Integer       myFrameY0;
0116   Standard_Integer       myFrameX1;
0117   Standard_Integer       myFrameY1;
0118 };
0119 
0120 #endif