Back to index

salome-gui  6.5.0
OCCViewer_ViewPort3d.h
Go to the documentation of this file.
00001 // Copyright (C) 2007-2012  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 #include "Qtx.h"
00028 
00029 #include <V3d_View.hxx>
00030 
00031 class QColor;
00032 class QString;
00033 class QRect;
00034 
00035 class Handle(V3d_Viewer);
00036 
00037 #ifdef WIN32
00038 #pragma warning ( disable:4251 )
00039 #endif
00040 
00041 class OCCVIEWER_EXPORT OCCViewer_ViewPort3d: public OCCViewer_ViewPort
00042 {
00043   Q_OBJECT
00044 
00045   friend class OCCViewer_ViewTransformer;
00046 
00047 public:
00048   OCCViewer_ViewPort3d( QWidget*, const Handle(V3d_Viewer)&, V3d_TypeOfView = V3d_ORTHOGRAPHIC );
00049   virtual ~OCCViewer_ViewPort3d();
00050 
00051 public:
00052   Handle(V3d_View)      getView() const;
00053   Handle(V3d_View)      setView( const Handle(V3d_View)& );
00054   Handle(V3d_Viewer)    getViewer() const;
00055 
00056   void                  setAnimationMode(bool theDegenerated);
00057 
00058   virtual void          setBackgroundColor( const QColor& color);    // obsolete
00059   virtual QColor        backgroundColor() const;                     // obsolete
00060   void                  setBackground( const Qtx::BackgroundData& color);
00061   Qtx::BackgroundData   background() const;
00062 
00063   virtual int           getBgImgHeight(){return myBgImgHeight; };
00064   virtual int           getBgImgWidth() {return myBgImgWidth;  };
00065 
00066   virtual void          updateStaticTriedronVisibility();
00067 
00068 //   void         setActive( V3d_TypeOfView );
00069   virtual bool          syncronize( const OCCViewer_ViewPort3d* );
00070 
00071   double                getZSize() const;
00072   void                  setZSize( double );
00073 
00074   void                  getAxialScale( double&, double&, double& );
00075 
00076   virtual void          onUpdate();
00077 
00078   // TRANSFORMATIONS
00079   virtual void          reset();
00080   virtual void          pan( int , int );
00081   virtual void          setCenter( int , int );
00082   virtual void          fitRect( const QRect& );
00083   virtual void          startZoomAtPoint( int, int );
00084   virtual void          zoom( int, int, int, int );
00085   virtual void          fitAll( bool keepScale = false, bool withZ = true, bool upd = true );
00086   virtual void          rotateXY( double );
00087   virtual void          setAxialScale( double, double, double );
00088 
00089   virtual void          startRotation( int, int, int, const gp_Pnt& );
00090   virtual void          rotate( int, int, int, const gp_Pnt& );
00091   virtual void          endRotation();
00092   bool                  isBusy() {return myBusy;} // check that View Port is fully initialized
00093 
00094   void                  setAdvancedZoomingEnabled( const bool theState ) { myIsAdvancedZoomingEnabled = theState; }
00095   bool                  isAdvancedZoomingEnabled() const { return myIsAdvancedZoomingEnabled; }
00096 
00097 signals:
00098   void                  vpChangeBackground( const Qtx::BackgroundData& );
00099 
00100 public slots:
00101   virtual bool          synchronize( OCCViewer_ViewPort* );
00102 
00103 protected:
00104     // EVENTS
00105   virtual void          paintEvent( QPaintEvent* );
00106   virtual void          resizeEvent( QResizeEvent* );
00107 
00108   // initialization
00109   virtual void          attachWindow( const Handle(V3d_View)&, const Handle(Aspect_Window)& );
00110 
00111 private:
00112   Handle(V3d_View)      activeView() const;
00113   Handle(V3d_View)      inactiveView() const;
00114   bool                  mapView( const Handle(V3d_View)& );
00115   bool                  setWindow( const Handle(V3d_View)& );
00116   bool                  mapped( const Handle(V3d_View)& ) const;
00117   void                  updateBackground();
00118   
00119 private:
00120   Handle(V3d_View)      myOrthoView;
00121   Handle(V3d_View)      myPerspView;
00122   Handle(V3d_View)      myActiveView;
00123   bool                  myDegenerated;
00124   bool                  myAnimate;
00125   bool                  myBusy;
00126   double                myScale;
00127   bool                  myIsAdvancedZoomingEnabled;
00128   Qtx::BackgroundData   myBackground;
00129   int                   myBgImgHeight;
00130   int                   myBgImgWidth;
00131 };
00132 
00133 #ifdef WIN32
00134 #pragma warning ( default:4251 )
00135 #endif
00136 
00137 #endif