X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSVTK%2FSVTK_View.h;h=3859802d51fc2f1c2cbbbdb8ad72ce9cd05d6b08;hb=refs%2Fheads%2Fngr%2Fpython3_dev_pv5.4;hp=4c25de9bcead69118b2ec683f2c0e43b6774733a;hpb=399155730966dfc225fbb24f66204b05664385f2;p=modules%2Fgui.git diff --git a/src/SVTK/SVTK_View.h b/src/SVTK/SVTK_View.h index 4c25de9bc..3859802d5 100644 --- a/src/SVTK/SVTK_View.h +++ b/src/SVTK/SVTK_View.h @@ -1,11 +1,14 @@ -// Copyright (C) 2005 CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA R&D +// Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE +// +// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either -// version 2.1 of the License. +// version 2.1 of the License, or (at your option) any later version. // -// This library is distributed in the hope that it will be useful +// This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -16,6 +19,7 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #ifndef SVTK_VIEW_H #define SVTK_VIEW_H @@ -24,24 +28,34 @@ #endif #include "SVTK.h" -#include "SALOME_InteractiveObject.hxx" -#include +#include +#include + +#include class vtkActorCollection; class vtkRenderer; +class vtkProperty; -class SVTK_MainWindow; +class SVTK_ViewWindow; class SVTK_Renderer; class SALOME_Actor; -//! Main purpose of the class is to provide a way to customize #SVTK_MainWindow. +class QMouseEvent; +class QWheelEvent; +class QKeyEvent; +class QContextMenuEvent; +class QColor; + + +//! Main purpose of the class is to provide a way to customize #SVTK_ViewWindow. /*! - This class is initialized by #SVTK_MainWindow and just pass Qt signals from - corresponding #SVTK_RenderWindowInteractor of the #SVTK_MainWindow. - Its main purpose is to provide a simple and flexible way to customize the #SVTK_MainWindow. - So, in your own viewer it is possible to derive new #SVTK_MainWindow and + This class is initialized by #SVTK_ViewWindow and just pass Qt signals from + corresponding #SVTK_RenderWindowInteractor of the #SVTK_ViewWindow. + Its main purpose is to provide a simple and flexible way to customize the #SVTK_ViewWindow. + So, in your own viewer it is possible to derive new #SVTK_ViewWindow and use existing functionality without any modifications. */ class SVTK_EXPORT SVTK_SignalHandler : public QObject @@ -49,26 +63,26 @@ class SVTK_EXPORT SVTK_SignalHandler : public QObject Q_OBJECT; public: - SVTK_SignalHandler(SVTK_MainWindow* theMainWindow); + SVTK_SignalHandler(SVTK_ViewWindow* theMainWindow); virtual ~SVTK_SignalHandler(); - //! Get reference to its #SVTK_MainWindow - SVTK_MainWindow* + //! Get reference to its #SVTK_ViewWindow + SVTK_ViewWindow* GetMainWindow(); //---------------------------------------------------------------------------- - //! Redirect the request to #SVTK_MainWindow::Repaint (just for flexibility) + //! Redirect the request to #SVTK_ViewWindow::Repaint (just for flexibility) void Repaint(bool theUpdateTrihedron = true); //---------------------------------------------------------------------------- - //! Redirect the request to #SVTK_MainWindow::GetRenderer (just for flexibility) + //! Redirect the request to #SVTK_ViewWindow::GetRenderer (just for flexibility) SVTK_Renderer* GetRenderer(); - //! Redirect the request to #SVTK_MainWindow::getRenderer (just for flexibility) + //! Redirect the request to #SVTK_ViewWindow::getRenderer (just for flexibility) vtkRenderer* getRenderer(); @@ -91,7 +105,7 @@ public: void selectionChanged(); protected: - SVTK_MainWindow* myMainWindow; + SVTK_ViewWindow* myMainWindow; }; @@ -106,7 +120,7 @@ class SVTK_EXPORT SVTK_View : public SVTK_SignalHandler Q_OBJECT; public: - SVTK_View(SVTK_MainWindow* theMainWindow); + SVTK_View(SVTK_ViewWindow* theMainWindow); virtual ~SVTK_View(); @@ -115,8 +129,8 @@ public: //! To highlight a VTK presentation with the same #SALOME_InteractiveObject void highlight(const Handle(SALOME_InteractiveObject)& IObject, - bool highlight, - bool immediatly = true); + bool highlight, + bool immediatly = true); //! To unhighlight all VTK presentations void @@ -136,7 +150,7 @@ public: void rename(const Handle(SALOME_InteractiveObject)& IObject, - const QString& newName); + const QString& newName); //---------------------------------------------------------------------------- // Displaymode management @@ -151,7 +165,7 @@ public: //! Switch representation wireframe/shading void SetDisplayMode(const Handle(SALOME_InteractiveObject)& IObject, - int theMode); + int theMode); //! Change all actors to wireframe void @@ -161,6 +175,10 @@ public: void ChangeRepresentationToSurface(); + //! Change all actors to surface with edges + void + ChangeRepresentationToSurfaceWithEdges(); + //! Change to wireframe a list of vtkactor void ChangeRepresentationToWireframe(vtkActorCollection* theListofActors); @@ -169,10 +187,14 @@ public: void ChangeRepresentationToSurface(vtkActorCollection* theListofActors); + //! Change to surface with edges a list of vtkactor + void + ChangeRepresentationToSurfaceWithEdges(vtkActorCollection* theListofActors); + //! Change transparency void SetTransparency(const Handle(SALOME_InteractiveObject)& theIObject, - float trans); + float trans); //! Get current transparency float @@ -181,12 +203,25 @@ public: //! Change color void SetColor(const Handle(SALOME_InteractiveObject)& theIObject, - const QColor& theColor); + const QColor& theColor); //! Get current color QColor GetColor(const Handle(SALOME_InteractiveObject)& theIObject); + //! Change material + void + SetMaterial(const Handle(SALOME_InteractiveObject)& theIObject, + vtkProperty* thePropF, vtkProperty* thePropB); + + //! Get current front material + vtkProperty* + GetFrontMaterial(const Handle(SALOME_InteractiveObject)& theIObject); + + //! Get current back material + vtkProperty* + GetBackMaterial(const Handle(SALOME_InteractiveObject)& theIObject); + //---------------------------------------------------------------------------- // Erase Display functions //! To erase all existing VTK presentations @@ -204,15 +239,15 @@ public: //! To erase VTK presentation with defined #SALOME_InteractiveObject void Erase(const Handle(SALOME_InteractiveObject)& IObject, - bool immediatly = true); + bool immediatly = true); void Remove(const Handle(SALOME_InteractiveObject)& IObject, - bool immediatly = true); + bool immediatly = true); //! To display VTK presentation with defined #SALOME_InteractiveObject void Display(const Handle(SALOME_InteractiveObject)& IObject, - bool immediatly = true); + bool immediatly = true); //! To display VTK presentation with defined #SALOME_InteractiveObject and erase all anothers void @@ -221,37 +256,42 @@ public: //! To display the VTK presentation void Display(SALOME_Actor* SActor, - bool immediatly = true); + bool immediatly = true); //! To erase the VTK presentation void Erase(SALOME_Actor* SActor, - bool immediatly = true); + bool immediatly = true); //! To remove the VTK presentation void Remove(SALOME_Actor* SActor, - bool updateViewer = true); + bool updateViewer = true); + + //! Collect objects visible in viewer + void + GetVisible( SALOME_ListIO& theList ); //---------------------------------------------------------------------------- //! Redirect the request to #SVTK_Renderer::SetPreselectionProp void SetSelectionProp(const double& theRed = 1, - const double& theGreen = 1, - const double& theBlue = 0, - const int& theWidth = 5); + const double& theGreen = 1, + const double& theBlue = 0, + const int& theWidth = 5); //! Redirect the request to #SVTK_Renderer::SetPreselectionProp void SetPreselectionProp(const double& theRed = 0, - const double& theGreen = 1, - const double& theBlue = 1, - const int& theWidth = 5); + const double& theGreen = 1, + const double& theBlue = 1, + const int& theWidth = 5); //! Redirect the request to #SVTK_Renderer::SetPreselectionProp void SetSelectionTolerance(const double& theTolNodes = 0.025, - const double& theTolCell = 0.001); + const double& theTolCell = 0.001, + const double& theTolObjects = 0.025); protected: int myDisplayMode;