Version: 6.3.1

src/SVTK/SVTK_View.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_VIEW_H
00024 #define SVTK_VIEW_H
00025 
00026 #ifdef WIN32
00027 #pragma warning( disable:4251 )
00028 #endif
00029 
00030 #include "SVTK.h"
00031 
00032 #include <SALOME_InteractiveObject.hxx>
00033 #include <SALOME_ListIO.hxx>
00034 
00035 #include <QObject>
00036 
00037 class vtkActorCollection;
00038 class vtkRenderer;
00039 
00040 class SVTK_ViewWindow;
00041 class SVTK_Renderer;
00042 
00043 class SALOME_Actor;
00044 
00045 class QMouseEvent;
00046 class QWheelEvent;
00047 class QKeyEvent;
00048 class QContextMenuEvent;
00049 class QColor;
00050 
00051 
00053 
00060 class SVTK_EXPORT SVTK_SignalHandler : public QObject
00061 {
00062   Q_OBJECT;
00063 
00064 public:
00065   SVTK_SignalHandler(SVTK_ViewWindow* theMainWindow);
00066 
00067   virtual
00068   ~SVTK_SignalHandler();
00069 
00071   SVTK_ViewWindow*
00072   GetMainWindow();
00073 
00074   //----------------------------------------------------------------------------
00076   void
00077   Repaint(bool theUpdateTrihedron = true);
00078 
00079   //----------------------------------------------------------------------------
00081   SVTK_Renderer* 
00082   GetRenderer();
00083 
00085   vtkRenderer* 
00086   getRenderer();
00087 
00088   //----------------------------------------------------------------------------
00089  public slots:
00090   void onSelectionChanged();
00091 
00092  public:
00093  signals:
00094   void MouseMove( QMouseEvent* );
00095   void MouseButtonPressed( QMouseEvent* );
00096   void MouseButtonReleased( QMouseEvent* );
00097   void MouseDoubleClicked( QMouseEvent* );
00098   void ButtonPressed(const QMouseEvent *event);
00099   void ButtonReleased(const QMouseEvent *event);
00100   void WheelMoved( QWheelEvent* );
00101   void KeyPressed( QKeyEvent* );
00102   void KeyReleased( QKeyEvent* );
00103   void contextMenuRequested( QContextMenuEvent *e );
00104   void selectionChanged();
00105 
00106  protected:
00107   SVTK_ViewWindow* myMainWindow;
00108 };
00109 
00110 
00112 
00117 class SVTK_EXPORT SVTK_View : public SVTK_SignalHandler
00118 {
00119   Q_OBJECT;
00120 
00121 public:
00122   SVTK_View(SVTK_ViewWindow* theMainWindow);
00123 
00124   virtual
00125   ~SVTK_View();
00126   
00127   /*  interactive object management */
00129   void
00130   highlight(const Handle(SALOME_InteractiveObject)& IObject, 
00131             bool highlight, 
00132             bool immediatly = true);
00133 
00135   void
00136   unHighlightAll();
00137 
00139   Handle(SALOME_InteractiveObject) 
00140   FindIObject(const char* Entry);
00141 
00143   bool
00144   isInViewer(const Handle(SALOME_InteractiveObject)& IObject);
00145 
00147   bool
00148   isVisible(const Handle(SALOME_InteractiveObject)& IObject);
00149 
00150   void
00151   rename(const Handle(SALOME_InteractiveObject)& IObject, 
00152          const QString& newName);
00153   
00154   //----------------------------------------------------------------------------
00155   // Displaymode management
00157   int 
00158   GetDisplayMode();
00159 
00161   void
00162   SetDisplayMode(int);
00163 
00165   void
00166   SetDisplayMode(const Handle(SALOME_InteractiveObject)& IObject, 
00167                  int theMode);
00168 
00170   void 
00171   ChangeRepresentationToWireframe();
00172 
00174   void
00175   ChangeRepresentationToSurface();
00176 
00178   void
00179   ChangeRepresentationToWireframe(vtkActorCollection* theListofActors);
00180 
00182   void
00183   ChangeRepresentationToSurface(vtkActorCollection* theListofActors);
00184 
00186   void
00187   SetTransparency(const Handle(SALOME_InteractiveObject)& theIObject,
00188                   float trans);
00189 
00191   float 
00192   GetTransparency(const Handle(SALOME_InteractiveObject)& theIObject);
00193 
00195   void
00196   SetColor(const Handle(SALOME_InteractiveObject)& theIObject,
00197            const QColor& theColor);
00198 
00200   QColor
00201   GetColor(const Handle(SALOME_InteractiveObject)& theIObject);
00202 
00203   //----------------------------------------------------------------------------
00204   // Erase Display functions
00206   void
00207   EraseAll();
00208 
00210   void
00211   DisplayAll();
00212 
00214   void
00215   RemoveAll( const bool immediatly );
00216 
00218   void
00219   Erase(const Handle(SALOME_InteractiveObject)& IObject, 
00220         bool immediatly = true);
00221   void
00222   Remove(const Handle(SALOME_InteractiveObject)& IObject, 
00223          bool immediatly = true);
00224 
00226   void
00227   Display(const Handle(SALOME_InteractiveObject)& IObject, 
00228           bool immediatly = true);
00229 
00231   void
00232   DisplayOnly(const Handle(SALOME_InteractiveObject)& IObject);
00233 
00235   void
00236   Display(SALOME_Actor* SActor, 
00237           bool immediatly = true);
00238 
00240   void
00241   Erase(SALOME_Actor* SActor, 
00242         bool immediatly = true);
00243 
00245   void
00246   Remove(SALOME_Actor* SActor, 
00247          bool updateViewer = true);
00248 
00250   void
00251   GetVisible( SALOME_ListIO& theList );
00252 
00253   //----------------------------------------------------------------------------
00255   void
00256   SetSelectionProp(const double& theRed = 1, 
00257                    const double& theGreen = 1,
00258                    const double& theBlue = 0, 
00259                    const int& theWidth = 5);
00260 
00262   void
00263   SetPreselectionProp(const double& theRed = 0, 
00264                       const double& theGreen = 1,
00265                       const double& theBlue = 1, 
00266                       const int& theWidth = 5);
00267 
00269   void
00270   SetSelectionTolerance(const double& theTolNodes = 0.025, 
00271                         const double& theTolCell = 0.001,
00272                         const double& theTolObjects = 0.025);
00273 
00274  protected:  
00275   int myDisplayMode;
00276 };
00277 
00278 #ifdef WIN32
00279 #pragma warning( default:4251 )
00280 #endif
00281 
00282 #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