1 // VISU VISUGUI : GUI of VISU component
3 // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
25 // Author : Laurent CORNABE & Hubert ROLLAND
29 #ifndef VisuGUI_HeaderFile
30 #define VisuGUI_HeaderFile
32 #ifndef _Standard_HeaderFile
33 #include <Standard.hxx>
36 #include <SALOMEconfig.h>
37 #include CORBA_SERVER_HEADER(VISU_Gen)
38 #include CORBA_SERVER_HEADER(SALOMEDS)
39 #include CORBA_SERVER_HEADER(SALOMEDS_Attributes)
41 #include "QAD_Desktop.h"
42 class VTKViewer_ViewFrame;
44 #include "VISUConfig.hh"
47 class VISU_ScalarMapAct;
48 class VisuGUI_SelectionDlg;
50 #include <vtkDataSet.h>
53 #include <TColStd_MapOfInteger.hxx>
54 #include <TColStd_MapIteratorOfMapOfInteger.hxx>
55 #include "SALOME_ListIteratorOfListIO.hxx"
57 #include "SALOMEGUI.h"
66 class DeformedShape_i;
78 // ======================================================================
80 // ======================================================================
83 class VisuGUI : public SALOMEGUI{
86 VisuGUI( const QString& name = "", QObject* parent = 0 );
89 static VISU::VISU_Gen_i* GetVisuGen();
91 static QAD_Desktop* GetDesktop();
92 static QAD_Study* GetActiveStudy();
93 static vtkRenderer* GetRenderer();
94 static VTKViewer_ViewFrame* GetVtkViewFrame();
95 static SALOMEDS::Study_var GetStudyDocument();
96 static SALOMEDS::StudyBuilder_var NewBuilder();
97 static VISU::Storable::TRestoringMap getMapOfValue(SALOMEDS::SObject_var theSObject);
99 static VISU::Result_i* CreatePresent(SALOMEDS::SObject_var theField, VISU::Result_var& theResult);
101 enum CameraOrient {e3D, eFront, eLeft, eTop};
102 static CameraOrient SetFitAll( VTKViewer_ViewFrame* vf);
104 typedef VISU::Result_ptr (VISU::VISU_Gen_i::* TImportFun)(const char*);
105 void ImportFromFile(TImportFun theImportFun);
107 bool CreateScalarMap(SALOMEDS::SObject_var theField);
108 static VISU::ScalarMap_i* CreateScalarMapPrs(SALOMEDS::SObject_var theField,
109 const char* theMeshName, VISU::Entity theEntity,
110 const char* theFieldName, int theTimeId);
111 bool CreateDeformedShape(SALOMEDS::SObject_var theField);
112 static VISU::DeformedShape_i* CreateDeformedShapePrs(SALOMEDS::SObject_var theField,
113 const char* theMeshName, VISU::Entity theEntity,
114 const char* theFieldName, int theTimeId);
115 bool CreateVectors(SALOMEDS::SObject_var theField);
116 static VISU::Vectors_i* CreateVectorsPrs(SALOMEDS::SObject_var theField,
117 const char* theMeshName, VISU::Entity theEntity,
118 const char* theFieldName, int theTimeId);
119 bool CreateIsoSurfaces(SALOMEDS::SObject_var theField);
120 static VISU::IsoSurfaces_i* CreateIsoSurfacesPrs(SALOMEDS::SObject_var theField,
121 const char* theMeshName, VISU::Entity theEntity,
122 const char* theFieldName, int theTimeId);
123 bool CreateCutPlanes(SALOMEDS::SObject_var theField);
124 static VISU::CutPlanes_i* CreateCutPlanesPrs(SALOMEDS::SObject_var theField,
125 const char* theMeshName, VISU::Entity theEntity,
126 const char* theFieldName, int theTimeId);
127 bool CreateCutLines(SALOMEDS::SObject_var theField);
128 static VISU::CutLines_i* CreateCutLinesPrs(SALOMEDS::SObject_var theField,
129 const char* theMeshName, VISU::Entity theEntity,
130 const char* theFieldName, int theTimeId);
131 bool CreateStreamLines(SALOMEDS::SObject_var theField);
132 static VISU::StreamLines_i* CreateStreamLinesPrs(SALOMEDS::SObject_var theField,
133 const char* theMeshName, VISU::Entity theEntity,
134 const char* theFieldName, int theTimeId);
135 bool TestObjectBrowser(SALOMEDS::SObject_var& objVisu);
137 static void ShowTrihedron(bool Show);
138 static void ChangeViewer(int theType);
140 static void NewColor(VISU_Actor *Actor);
141 static void NewWireframeColor(VISU_MeshAct *Actor);
142 static void NewOpacity(VISU_Actor *Actor);
143 static void NewLinewidth(VISU_Actor *Actor);
145 static void ChangeScalarBar();
146 static void SetSweepingPreferences();
148 static void PlotTable( VISU::Table_i* table, int theDisplaying );
149 static void PlotCurve( VISU::Curve_i* curve, int theDisplaying );
150 static void PlotContainer( VISU::Container_i* container, int theDisplaying );
152 static QString getVisuInputDir();
153 static QString getVisuOutputDir();
155 static QString getValue(SALOMEDS::SObject_var theSObject, QString theKey);
156 static int checkHomoSelection();
158 static VISU_Actor* UpdateViewer(VISU::Prs3d_i* thePrs, bool theDispOnly=false);
159 static bool IsDisplayed(VISU::Prs3d_i* thePrs);
160 static void ErasePrs(VISU::Prs3d_i* thePrs);
162 static VISU::Prs3d_i* GetSelectedPrs3d(Handle(SALOME_InteractiveObject)* theIO = NULL);
163 static void RecreateActor(VISU::Prs3d_i* thePrs);
164 static void CreateActor(VISU::Prs3d_i* thePrs);
165 static VISU_Actor* GetActor(VISU::Prs3d_i* thePrs, VTKViewer_ViewFrame* theViewFrame = NULL);
167 void VisuGUI::ChangeRepresentation(VISU::PresentationType theType);
168 void DeletePresentation(VISU::Prs3d_i* thePrs);
169 void DeletePresentation(VISU::Curve_i* theCurve);
171 void SetState(int aState );
173 void EmitSignalDeactivateDialog();
174 void EmitSignalCloseAllDialogs();
175 QDialog* GetActiveDialogBox();
176 void SetActiveDialogBox(QDialog* aDlg);
178 void CreatePlot(SALOMEDS::SObject_var theTableSO);
180 // ----------------------------------------
181 // All method of standard EXPORT
182 // ----------------------------------------
183 virtual bool OnGUIEvent(int theCommandID, QAD_Desktop* parent);
184 virtual bool SetSettings(QAD_Desktop* parent);
185 virtual void DefinePopup(QString & theContext,
187 QString & theObject ) ;
188 virtual bool CustomPopup(QAD_Desktop* parent,
190 const QString & theContext,
191 const QString & theParent,
192 const QString & theObject);
193 virtual void BuildPresentation( const Handle(SALOME_InteractiveObject)&,
194 QAD_ViewFrame* = 0 );
195 virtual bool OnMousePress(QMouseEvent* pe ,
197 QAD_StudyFrame* studyFrame);
198 virtual bool OnMouseMove(QMouseEvent* pe ,
200 QAD_StudyFrame* studyFrame);
201 virtual bool OnKeyPress(QKeyEvent* pe,
203 QAD_StudyFrame* studyFrame);
204 virtual void SupportedViewType (int* buffer, int bufferSize);
207 void ImportTablesFromFile();
208 void ExportTableToFile();
211 void CopyAndImportFile();
216 void CreateScalarMap();
217 void CreateDeformedShape();
218 void CreateVectors();
219 void CreateIsoSurfaces();
220 void CreateCutPlanes();
221 void CreateCutLines();
222 void CreateStreamLines();
223 void CreateManyMesh();
224 void CreatePlot2dView();
227 void DisplayOnlyPrs();
230 void DisplayManyPrs();
231 void DisplayOnlyManyPrs();
233 void EditContainer();
235 void MakeSurfaceframe();
236 void MakeInsideframe();
237 void MakeWireframe();
243 void ChangeWireframeColor();
244 void ChangeOpacity();
251 void CurveProperties();
252 void ClearContainer();
254 void SaveViewParams();
255 void RestoreViewParams();
260 void RenameContainer();
262 void TimeAnimation();
264 void ImportMedField();
265 //void ImportMedMesh();
267 void DeleteViewParams();
268 void CopyPresentation();
270 void SelectionInfo();
273 QDialog* myActiveDialogBox;
275 VisuGUI_SelectionDlg* mySelectionDlg;