Version: 6.3.1

src/VTKViewer/VTKViewer_ViewWindow.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 VTKVIEWER_VIEWWINDOW_H
00024 #define VTKVIEWER_VIEWWINDOW_H
00025 
00026 #include "VTKViewer.h"
00027 
00028 #include "SUIT_ViewWindow.h"
00029 
00030 #include "QtxAction.h"
00031 
00032 class vtkRenderer;
00033 class SUIT_Desktop;
00034 class VTKViewer_Viewer;
00035 class VTKViewer_Trihedron;
00036 class VTKViewer_Transform;
00037 class VTKViewer_RenderWindow;
00038 class VTKViewer_InteractorStyle;
00039 class VTKViewer_RenderWindowInteractor;
00040 class VTKViewer_Actor;
00041 
00042 #ifdef WIN32
00043 #pragma warning( disable:4251 )
00044 #endif
00045 
00046 class VTKVIEWER_EXPORT VTKViewer_ViewWindow : public SUIT_ViewWindow
00047 {
00048   Q_OBJECT
00049 
00050 public:
00051   VTKViewer_ViewWindow( SUIT_Desktop*, VTKViewer_Viewer*,
00052                         VTKViewer_InteractorStyle* = 0,
00053                         VTKViewer_RenderWindowInteractor* = 0 );
00054   virtual ~VTKViewer_ViewWindow();
00055   
00057   QToolBar*    getToolBar() { return myToolBar; }
00058   
00059   void         setBackgroundColor( const QColor& );
00060   QColor       backgroundColor() const;
00061 
00063   vtkRenderer*                      getRenderer()     { return myRenderer;     }
00065   VTKViewer_RenderWindow*           getRenderWindow() { return myRenderWindow; }
00067   VTKViewer_RenderWindowInteractor* getRWInteractor() { return myRWInteractor; }
00068   bool                              isTrihedronDisplayed();
00069 
00070   void Repaint( bool theUpdateTrihedron = true );
00071   void onAdjustTrihedron();
00072   void GetScale( double theScale[3] );
00073   void SetScale( double theScale[3] );
00074   void AddActor( VTKViewer_Actor*, bool update = false );
00075   void RemoveActor( VTKViewer_Actor*, bool update = false);
00076 
00077   virtual QString   getVisualParameters();
00078   virtual void      setVisualParameters( const QString& parameters );
00079 
00080 public slots:
00081   void onFrontView();
00082   void onBackView();
00083   void onTopView();
00084   void onBottomView();
00085   void onLeftView();
00086   void onRightView();
00087   void onClockWiseView();
00088   void onAntiClockWiseView();
00089   void onResetView();
00090   void onFitAll();
00091   void activateZoom();
00092   void activateWindowFit();
00093   void activateRotation();
00094   void activatePanning();
00095   void activateGlobalPanning();
00096   void onTrihedronShow();
00097 
00098 protected:
00099   QImage dumpView();
00100 
00101 protected slots:
00102   void onKeyPressed(QKeyEvent* event);
00103   void onKeyReleased(QKeyEvent* event);
00104   void onMousePressed(QMouseEvent* event);
00105   void onMouseDoubleClicked(QMouseEvent* event);
00106   void onMouseReleased(QMouseEvent* event);
00107   void onMouseMoving(QMouseEvent* event);
00108 
00109 private:
00110   void                              InsertActor( VTKViewer_Actor* theActor,
00111                                                  bool theMoveInternalActors = false );
00112   void                              MoveActor( VTKViewer_Actor* theActor );
00113 
00114 private:
00115   enum { DumpId, FitAllId, FitRectId, ZoomId, PanId, GlobalPanId, RotationId,
00116          FrontId, BackId, TopId, BottomId, LeftId, RightId, ClockWiseId, AntiClockWiseId,
00117       ResetId, TrihedronShowId };
00118   typedef QMap<int, QtxAction*> ActionsMap;
00119   
00120   void    createActions();
00121   void    createToolBar();
00122   
00123   VTKViewer_Viewer*                 myModel;
00124  
00125   vtkRenderer*                      myRenderer;
00126   VTKViewer_RenderWindow*           myRenderWindow;
00127   VTKViewer_RenderWindowInteractor* myRWInteractor;
00128   
00129   VTKViewer_Trihedron*              myTrihedron;  
00130   VTKViewer_Transform*              myTransform;
00131   
00132   QToolBar*                         myToolBar;
00133   ActionsMap                        myActionsMap;  
00134   
00135   double                            myCurScale;
00136 
00137   friend class VTKViewer_RenderWindowInteractor;
00138 };
00139 
00140 #ifdef WIN32
00141 #pragma warning( default:4251 )
00142 #endif
00143 
00144 #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