Version: 6.3.1

src/OCCViewer/OCCViewer_ViewPort3d.h

Go to the documentation of this file.
00001 // Copyright (C) 2007-2011  CEA/DEN, EDF R&D, OPEN CASCADE
00002 //
00003 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
00004 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
00005 //
00006 // This library is free software; you can redistribute it and/or
00007 // modify it under the terms of the GNU Lesser General Public
00008 // License as published by the Free Software Foundation; either
00009 // version 2.1 of the License.
00010 //
00011 // This library is distributed in the hope that it will be useful,
00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014 // Lesser General Public License for more details.
00015 //
00016 // You should have received a copy of the GNU Lesser General Public
00017 // License along with this library; if not, write to the Free Software
00018 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00019 //
00020 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00021 //
00022 
00023 #ifndef OCCVIEWER_VIEWPORT3D_H
00024 #define OCCVIEWER_VIEWPORT3D_H
00025 
00026 #include "OCCViewer_ViewPort.h"
00027 
00028 #include <V3d_View.hxx>
00029 
00030 class QColor;
00031 class QRect;
00032 
00033 class Handle(V3d_Viewer);
00034 
00035 #ifdef WIN32
00036 #pragma warning ( disable:4251 )
00037 #endif
00038 
00039 class OCCVIEWER_EXPORT OCCViewer_ViewPort3d: public OCCViewer_ViewPort
00040 {
00041   Q_OBJECT
00042 
00043   friend class OCCViewer_ViewTransformer;
00044 
00045 public:
00046   OCCViewer_ViewPort3d( QWidget*, const Handle(V3d_Viewer)&, V3d_TypeOfView = V3d_ORTHOGRAPHIC );
00047   virtual ~OCCViewer_ViewPort3d();
00048 
00049 public:
00050   Handle(V3d_View)        getView() const;
00051   Handle(V3d_View)        setView( const Handle(V3d_View)& );
00052   Handle(V3d_Viewer)      getViewer() const;
00053 
00054   void setAnimationMode(bool theDegenerated);
00055 
00056   virtual void          setBackgroundColor( const QColor& color);
00057   virtual QColor        backgroundColor() const;
00058 
00059 //   void         setActive( V3d_TypeOfView );
00060   virtual bool syncronize( const OCCViewer_ViewPort3d* );
00061 
00062   double getZSize() const;
00063   void   setZSize( double );
00064 
00065   virtual void onUpdate();
00066 
00067   // TRANSFORMATIONS
00068   virtual void          reset();
00069   virtual void          pan( int , int );
00070   virtual void          setCenter( int , int );
00071   virtual void          fitRect( const QRect& );
00072   virtual void          startZoomAtPoint( int, int );
00073   virtual void          zoom( int, int, int, int );
00074   virtual void          fitAll( bool keepScale = false, bool withZ = true, bool upd = true );
00075   virtual void          rotateXY( double );
00076 
00077   virtual void          startRotation( int, int, int, const gp_Pnt& );
00078   virtual void          rotate( int, int, int, const gp_Pnt& );
00079   virtual void          endRotation();
00080   bool                  isBusy() {return myBusy;} // check that View Port is fully initialized
00081 
00082   void                  setAdvancedZoomingEnabled( const bool theState ) { myIsAdvancedZoomingEnabled = theState; }
00083   bool                  isAdvancedZoomingEnabled() const { return myIsAdvancedZoomingEnabled; }
00084 
00085 protected:
00086     // EVENTS
00087   virtual void          paintEvent( QPaintEvent* );
00088   virtual void          resizeEvent( QResizeEvent* );
00089 
00090   // initialization
00091   virtual void          attachWindow( const Handle(V3d_View)&, const Handle(Aspect_Window)& );
00092 
00093 private:
00094   Handle(V3d_View) activeView() const;
00095   Handle(V3d_View) inactiveView() const;
00096   bool             mapView( const Handle(V3d_View)& );
00097   bool             setWindow( const Handle(V3d_View)& );
00098   bool             mapped( const Handle(V3d_View)& ) const;
00099 
00100 private:
00101   Handle(V3d_View)      myOrthoView;
00102   Handle(V3d_View)      myPerspView;
00103   Handle(V3d_View)      myActiveView;
00104   bool                  myDegenerated;
00105   bool                  myAnimate;
00106   bool                  myBusy;
00107   double                myScale;
00108   bool                  myIsAdvancedZoomingEnabled;
00109 };
00110 
00111 #ifdef WIN32
00112 #pragma warning ( default:4251 )
00113 #endif
00114 
00115 #endif
Copyright © 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
Copyright © 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS