Back to index

salome-smesh  6.5.0
SMESHGUI_VTKUtils.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 // SMESH SMESHGUI : GUI for SMESH component
00024 // File   : SMESHGUI_VTKUtils.h
00025 // Author : Open CASCADE S.A.S.
00026 //
00027 #ifndef SMESHGUI_VTKUTILS_H
00028 #define SMESHGUI_VTKUTILS_H
00029 
00030 // SMESH includes
00031 #include "SMESH_SMESHGUI.hxx"
00032 
00033 #include "SMESHGUI_Utils.h"
00034 #include <SMESH_Object.h>
00035 
00036 // SALOME KERNEL includes
00037 #include <SALOMEDSClient_definitions.hxx>
00038 
00039 // SALOME GUI includes
00040 #include <SALOME_InteractiveObject.hxx>
00041 #include <VTKViewer_Filter.h>
00042 
00043 class TColStd_IndexedMapOfInteger;
00044 
00045 class SALOMEDSClient_Study;
00046 
00047 class SUIT_ViewWindow;
00048 class SUIT_ViewManager;
00049 
00050 class SVTK_ViewWindow;
00051 class SVTK_Selector;
00052 
00053 class LightApp_SelectionMgr;
00054 class SalomeApp_Module;
00055 
00056 class SMESHGUI;
00057 class SMESH_Actor;
00058 class SALOME_Actor;
00059 
00060 class vtkActor;
00061 
00062 namespace SMESH
00063 {
00064   //----------------------------------------------------------------------------
00065   typedef std::pair<int,std::string> TKeyOfVisualObj;
00066   
00067 SMESHGUI_EXPORT
00068   TVisualObjPtr GetVisualObj( int, const char*, bool nulData =false );
00069 SMESHGUI_EXPORT
00070   void OnVisuException(); // PAL16631
00071 
00072   //----------------------------------------------------------------------------
00073 SMESHGUI_EXPORT
00074   SVTK_ViewWindow* GetViewWindow( const SalomeApp_Module* = 0,
00075                                   bool = false );
00076 SMESHGUI_EXPORT
00077   SVTK_ViewWindow* FindVtkViewWindow( SUIT_ViewManager*, SUIT_ViewWindow* );
00078 SMESHGUI_EXPORT
00079   SVTK_ViewWindow* GetVtkViewWindow( SUIT_ViewWindow* );
00080 
00081 SMESHGUI_EXPORT
00082   SVTK_ViewWindow* GetCurrentVtkView();
00083 
00084   //----------------------------------------------------------------------------
00085 SMESHGUI_EXPORT
00086   void RepaintCurrentView();
00087 SMESHGUI_EXPORT
00088   void RepaintViewWindow( SVTK_ViewWindow* );
00089 SMESHGUI_EXPORT
00090   void RenderViewWindow( SVTK_ViewWindow* );
00091 SMESHGUI_EXPORT
00092   void FitAll();
00093 
00094   //----------------------------------------------------------------------------
00095 SMESHGUI_EXPORT
00096   SMESH_Actor* FindActorByEntry( SUIT_ViewWindow*, const char* );
00097 SMESHGUI_EXPORT
00098   SMESH_Actor* FindActorByEntry( const char* );
00099 
00100 SMESHGUI_EXPORT
00101   SMESH_Actor* FindActorByObject( CORBA::Object_ptr );
00102 
00103   //----------------------------------------------------------------------------
00104 SMESHGUI_EXPORT  
00105   SMESH_Actor* CreateActor( _PTR(Study), const char*, int = false );
00106 SMESHGUI_EXPORT
00107   void DisplayActor( SUIT_ViewWindow*, SMESH_Actor* );
00108 SMESHGUI_EXPORT
00109   void RemoveActor( SUIT_ViewWindow*, SMESH_Actor* );
00110 SMESHGUI_EXPORT
00111   void RemoveVisuData( int );
00112 
00113   //----------------------------------------------------------------------------
00114   enum EDisplaing { eDisplayAll, eDisplay, eDisplayOnly, eErase, eEraseAll };
00115 
00116 SMESHGUI_EXPORT
00117   bool UpdateView( SUIT_ViewWindow*, EDisplaing, const char* = "" );
00118 SMESHGUI_EXPORT            
00119   bool UpdateView( EDisplaing, const char* = "" );
00120 
00121 SMESHGUI_EXPORT
00122   void UpdateView();
00123 
00124 SMESHGUI_EXPORT
00125   bool UpdateNulData( const Handle(SALOME_InteractiveObject)& theIO, bool theDisplay);
00126 
00127 SMESHGUI_EXPORT
00128   bool Update( const Handle(SALOME_InteractiveObject)& theIO, bool theDisplay);
00129 
00130   //----------------------------------------------------------------------------
00131 SMESHGUI_EXPORT  
00132   void SetPointRepresentation( bool );
00133 
00134 SMESHGUI_EXPORT
00135   void SetPickable( SMESH_Actor* = 0 );
00136 
00137 SMESHGUI_EXPORT
00138   void UpdateSelectionProp( SMESHGUI* );
00139 
00140   //----------------------------------------------------------------------------
00141 SMESHGUI_EXPORT
00142   SVTK_Selector* GetSelector( SUIT_ViewWindow* = GetActiveWindow() );
00143 
00144 SMESHGUI_EXPORT
00145   void SetFilter( const Handle(VTKViewer_Filter)&, SVTK_Selector* = GetSelector() );
00146 SMESHGUI_EXPORT
00147   Handle(VTKViewer_Filter) GetFilter( int, SVTK_Selector* = GetSelector() );
00148 SMESHGUI_EXPORT
00149   bool IsFilterPresent( int, SVTK_Selector* = GetSelector() );
00150 SMESHGUI_EXPORT
00151   void RemoveFilter( int, SVTK_Selector* = GetSelector() );
00152 
00153 SMESHGUI_EXPORT
00154   void RemoveFilters( SVTK_Selector* = GetSelector());
00155 
00156 SMESHGUI_EXPORT
00157   bool IsValid( SALOME_Actor*, int, SVTK_Selector* = GetSelector() );
00158 
00159   //----------------------------------------------------------------------------
00160 SMESHGUI_EXPORT  
00161   int GetNameOfSelectedNodes( SVTK_Selector*,
00162                               const Handle(SALOME_InteractiveObject)&,
00163                               QString& );
00164 SMESHGUI_EXPORT
00165   int GetNameOfSelectedElements( SVTK_Selector*,
00166                                  const Handle(SALOME_InteractiveObject)&,
00167                                  QString& );
00168 SMESHGUI_EXPORT
00169   int GetEdgeNodes( SVTK_Selector*, const TVisualObjPtr&, int&, int& );
00170 
00171   //----------------------------------------------------------------------------
00172 SMESHGUI_EXPORT  
00173   int GetNameOfSelectedNodes( LightApp_SelectionMgr*,
00174                               const Handle(SALOME_InteractiveObject)&,
00175                               QString& );
00176 SMESHGUI_EXPORT
00177   int GetNameOfSelectedNodes( LightApp_SelectionMgr*, QString& );
00178 SMESHGUI_EXPORT
00179   int GetNameOfSelectedElements( LightApp_SelectionMgr*,
00180                                  const Handle(SALOME_InteractiveObject)&,
00181                                  QString& );
00182 SMESHGUI_EXPORT
00183   int GetNameOfSelectedElements( LightApp_SelectionMgr*, QString& );
00184 SMESHGUI_EXPORT
00185   int GetSelected( LightApp_SelectionMgr*, TColStd_IndexedMapOfInteger&, 
00186                    const bool = true );
00187 
00188 SMESHGUI_EXPORT
00189   int GetEdgeNodes( LightApp_SelectionMgr*, int&, int& );
00190 
00191 SMESHGUI_EXPORT
00192   void SetControlsPrecision( const long );
00193 
00194 #ifndef DISABLE_PLOT2DVIEWER
00195 SMESHGUI_EXPORT
00196   void ClearPlot2Viewers( SUIT_ViewWindow* theWindow );
00197 #endif
00198 
00199   //----------------------------------------------------------------------------
00200 SMESHGUI_EXPORT
00201   bool ComputeClippingPlaneParameters( std::list<vtkActor*> theActorList,
00202                                        vtkFloatingPointType theNormal[3],
00203                                        vtkFloatingPointType theDist,
00204                                        vtkFloatingPointType theBounds[6],
00205                                        vtkFloatingPointType theOrigin[3] );
00206  SMESHGUI_EXPORT
00207    void RemoveVisualObjectWithActors( const char* theEntry, bool fromAllViews = false );
00208 };
00209 
00210 #endif // SMESHGUI_VTKUTILS_H