Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-13 09:16:08

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   //! Constructor
0026   Draw_View(int             theId,
0027             Draw_Viewer*    theViewer,
0028             int             theX,
0029             int             theY,
0030             int             theWidth,
0031             int             theHeight,
0032             Aspect_Drawable theWindow = 0);
0033 
0034   //! Constructor.
0035   Draw_View(int theId, Draw_Viewer* theViewer, const char* theTitle);
0036 
0037   //! Destructor.
0038   ~Draw_View() override;
0039 
0040 public: // @name getters and setters
0041   //! Gets horizontal offset.
0042   int GetDx() const { return myDx; }
0043 
0044   //! Sets horizontal offset.
0045   void SetDx(const int theDx) { myDx = theDx; }
0046 
0047   //! Gets vertical offset.
0048   int GetDy() const { return myDy; }
0049 
0050   //! Sets vertical offset.
0051   void SetDy(const int theDy) { myDy = theDy; }
0052 
0053   //! Gets parameter of zoom.
0054   double GetZoom() const { return myZoom; }
0055 
0056   //! Sets parameter of zoom.
0057   void SetZoom(const double theZoom) { myZoom = theZoom; }
0058 
0059   //! Gets matrix of view.
0060   const gp_Trsf& GetMatrix() const { return myMatrix; }
0061 
0062   //! Sets view matrix.
0063   void SetMatrix(const gp_Trsf& theMatrix) { myMatrix = theMatrix; }
0064 
0065   //! Gets focal distance.
0066   double GetFocalDistance() const { return myFocalDistance; }
0067 
0068   //! Sets focal distance.
0069   void SetFocalDistance(const double theDistance) { myFocalDistance = theDistance; }
0070 
0071   //! Returns type of view.
0072   const char* Type() { return myType; }
0073 
0074   //! Returns true value if current view in 2D mode.
0075   bool Is2D() const { return myIs2D; }
0076 
0077   //! Returns true value if current view in perspective mode.
0078   double IsPerspective() const { return myIsPers; }
0079 
0080 public: //! @name view API
0081   //! Initialize view by the type.
0082   bool Init(const char* theType);
0083 
0084   //! Transform view matrix.
0085   void Transform(const gp_Trsf& theTransformation);
0086 
0087   //! Resets frame of current view.
0088   void ResetFrame();
0089 
0090   //! Returns parameters of frame corners.
0091   void GetFrame(int& theX0, int& theY0, int& theX1, int& theY1);
0092 
0093   //! Perform window exposing.
0094   void WExpose() override;
0095 
0096 protected:
0097   int          myId;
0098   Draw_Viewer* myViewer;
0099   char         myType[5];
0100   bool         myIsPers;
0101   bool         myIs2D;
0102   double       myFocalDistance;
0103   double       myZoom;
0104   gp_Trsf      myMatrix;
0105   int          myDx;
0106   int          myDy;
0107   int          myFrameX0;
0108   int          myFrameY0;
0109   int          myFrameX1;
0110   int          myFrameY1;
0111 };
0112 
0113 #endif