Version: 6.3.1

src/SVTK/SVTK_ViewModel.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 SVTK_VIEWMODEL_H
00024 #define SVTK_VIEWMODEL_H
00025 
00026 #include "SVTK.h"
00027 #include "SVTK_ViewModelBase.h"
00028 
00029 #include <SALOME_Prs.h>
00030 #include <SALOME_InteractiveObject.hxx>
00031 #include <SALOME_ListIO.hxx>
00032 
00033 #include <QColor>
00034 #include <QMap>
00035 
00036 class QMouseEvent;
00037 
00038 class SVTK_ViewWindow;
00039 class VTKViewer_Actor;
00040 
00042 class SVTK_EXPORT SVTK_Viewer : public SVTK_ViewModelBase, public SALOME_View 
00043 {
00044   Q_OBJECT;
00045 
00046 public:
00047   typedef SVTK_ViewWindow TViewWindow;
00048   
00050   static QString Type() { return "VTKViewer"; }
00051 
00052   SVTK_Viewer();
00053   virtual ~SVTK_Viewer();
00054 
00056   virtual SUIT_ViewWindow* createView(SUIT_Desktop*);
00057 
00059   virtual void setViewManager(SUIT_ViewManager* theViewManager);
00060 
00062   virtual void contextMenuPopup( QMenu* );
00063 
00065   virtual QString getType() const { return Type(); }
00066 
00068   QColor backgroundColor() const;
00069 
00071   void setBackgroundColor( const QColor& );
00072 
00074   vtkFloatingPointType trihedronSize() const;
00075 
00077   bool trihedronRelative() const;
00078 
00080   void setTrihedronSize( const vtkFloatingPointType, const bool = true );
00081 
00083   bool isStaticTrihedronVisible() const;
00084 
00086   void setStaticTrihedronVisible( const bool );
00087 
00089   int projectionMode() const;
00090 
00092   void setProjectionMode( const int );
00093 
00095   int interactionStyle() const;
00096 
00098   void setInteractionStyle( const int );
00099 
00101   int zoomingStyle() const;
00102 
00104   void setZoomingStyle( const int );
00105 
00107   int incrementalSpeed() const;
00108 
00110   int incrementalSpeedMode() const;
00111 
00113   void setIncrementalSpeed( const int, const int = 0 );
00114 
00116   int spacemouseBtn( const int ) const;
00117 
00119   void setSpacemouseButtons( const int, const int, const int );
00120 
00121 public:
00122   void enableSelection(bool isEnabled);
00123   bool isSelectionEnabled() const { return mySelectionEnabled; }
00124 
00125   void enableMultiselection(bool isEnable);
00126   bool isMultiSelectionEnabled() const { return myMultiSelectionEnabled; }
00127 
00128   int  getSelectionCount() const;
00129 
00130   /* Reimplemented from SALOME_View */
00131 
00133   void Display( const SALOME_VTKPrs* ); 
00134 
00136   void Erase( const SALOME_VTKPrs*, const bool = false );
00137 
00139   void EraseAll( const bool = false );
00140 
00142   virtual void GetVisible( SALOME_ListIO& );
00143 
00145   SALOME_Prs* CreatePrs( const char* entry = 0 );
00146 
00148   virtual bool isVisible( const Handle(SALOME_InteractiveObject)& );
00149 
00151   virtual void Repaint();
00152 
00153  signals:
00154   void actorAdded(SVTK_ViewWindow*, VTKViewer_Actor*);
00155   void actorRemoved(SVTK_ViewWindow*, VTKViewer_Actor*);
00156 
00157 protected slots:
00158   void onMousePress(SUIT_ViewWindow*, QMouseEvent*);
00159   void onMouseMove(SUIT_ViewWindow*, QMouseEvent*);
00160   void onMouseRelease(SUIT_ViewWindow*, QMouseEvent*);
00161 
00162   void onDumpView();
00163   void onChangeBgColor();
00164 
00165   void onActorAdded(VTKViewer_Actor*);
00166   void onActorRemoved(VTKViewer_Actor*);
00167 
00168 private:
00169   void updateToolBars();
00170 
00171 
00172   QColor myBgColor;
00173   vtkFloatingPointType myTrihedronSize;
00174   bool   myTrihedronRelative;
00175   bool   myIsStaticTrihedronVisible;
00176   bool   mySelectionEnabled;
00177   bool   myMultiSelectionEnabled;
00178   int    myIncrementSpeed;
00179   int    myIncrementMode;
00180   int    myProjMode;
00181   int    myStyle;
00182   int    myZoomingStyle;
00183   int    mySpaceBtn[3];
00184 };
00185 
00186 #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