Salome HOME
Update from BR_V5_DEV 13Feb2009
[modules/gui.git] / src / OCCViewer / OCCViewer_ViewPort3d.h
1 //  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 //  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
6 //  This library is free software; you can redistribute it and/or
7 //  modify it under the terms of the GNU Lesser General Public
8 //  License as published by the Free Software Foundation; either
9 //  version 2.1 of the License.
10 //
11 //  This library is distributed in the hope that it will be useful,
12 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
13 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 //  Lesser General Public License for more details.
15 //
16 //  You should have received a copy of the GNU Lesser General Public
17 //  License along with this library; if not, write to the Free Software
18 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
19 //
20 //  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22 #ifndef OCCVIEWER_VIEWPORT3D_H
23 #define OCCVIEWER_VIEWPORT3D_H
24
25 #include "OCCViewer_ViewPort.h"
26
27 #include <V3d_View.hxx>
28
29 class QColor;
30 class QRect;
31
32 class Handle(V3d_Viewer);
33
34 #ifdef WIN32
35 #pragma warning ( disable:4251 )
36 #endif
37
38 class OCCVIEWER_EXPORT OCCViewer_ViewPort3d: public OCCViewer_ViewPort
39 {
40   Q_OBJECT
41
42   friend class OCCViewer_ViewTransformer;
43
44 public:
45   OCCViewer_ViewPort3d( QWidget*, const Handle(V3d_Viewer)&, V3d_TypeOfView = V3d_ORTHOGRAPHIC );
46   virtual ~OCCViewer_ViewPort3d();
47
48 public:
49   Handle(V3d_View)        getView() const;
50   Handle(V3d_View)        setView( const Handle(V3d_View)& );
51   Handle(V3d_Viewer)      getViewer() const;
52
53   void setAnimationMode(bool theDegenerated);
54
55   virtual void          setBackgroundColor( const QColor& color);
56   virtual QColor        backgroundColor() const;
57
58 //   void         setActive( V3d_TypeOfView );
59   virtual bool syncronize( const OCCViewer_ViewPort3d* );
60
61   double getZSize() const;
62   void   setZSize( double );
63
64   virtual void onUpdate();
65
66   // TRANSFORMATIONS
67   virtual void          reset();
68   virtual void          pan( int , int );
69   virtual void          setCenter( int , int );
70   virtual void          fitRect( const QRect& );
71   virtual void          zoom( int, int, int, int );
72   virtual void          fitAll( bool keepScale = false, bool withZ = true, bool upd = true );
73
74   void                  startRotation( int, int, int, const gp_Pnt& );
75   void                  rotate( int, int, int, const gp_Pnt& );
76   void                  endRotation();
77   bool                  isBusy() {return myBusy;} // check that View Port is fully initialized
78
79 protected:
80     // EVENTS
81   virtual void          paintEvent( QPaintEvent* );
82   virtual void          resizeEvent( QResizeEvent* );
83
84 private:
85   Handle(V3d_View) activeView() const;
86   Handle(V3d_View) inactiveView() const;
87   bool             mapView( const Handle(V3d_View)& );
88   bool             setWindow( const Handle(V3d_View)& );
89   bool             mapped( const Handle(V3d_View)& ) const;
90
91 private:
92   Handle(V3d_View)      myOrthoView;
93   Handle(V3d_View)      myPerspView;
94   Handle(V3d_View)      myActiveView;
95   bool                  myDegenerated;
96   bool                  myAnimate;
97   bool                  myBusy;
98   double                myScale;
99 };
100
101 #ifdef WIN32
102 #pragma warning ( default:4251 )
103 #endif
104
105 #endif