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