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;
49 #include <vtkDataSet.h>
52 #include <TColStd_MapOfInteger.hxx>
53 #include <TColStd_MapIteratorOfMapOfInteger.hxx>
54 #include "SALOME_ListIteratorOfListIO.hxx"
63 class DeformedShape_i;
75 // ======================================================================
77 // ======================================================================
80 class VisuGUI : public QObject{
86 static VISU::VISU_Gen_i* GetVisuGen();
88 static QAD_Desktop* GetDesktop();
89 static QAD_Study* GetActiveStudy();
90 static vtkRenderer* GetRenderer();
91 static VTKViewer_ViewFrame* GetVtkViewFrame();
92 static SALOMEDS::Study_var GetStudyDocument();
93 static SALOMEDS::StudyBuilder_var NewBuilder();
94 static VISU::Storable::TRestoringMap getMapOfValue(SALOMEDS::SObject_var theSObject);
96 static VISU::Result_i* CreatePresent(SALOMEDS::SObject_var theField, VISU::Result_var& theResult);
98 enum CameraOrient {e3D, eFront, eLeft, eTop};
99 static CameraOrient SetFitAll( VTKViewer_ViewFrame* vf);
101 bool CreateScalarMap(SALOMEDS::SObject_var theField);
102 static VISU::ScalarMap_i* CreateScalarMapPrs(SALOMEDS::SObject_var theField,
103 const char* theMeshName, VISU::Entity theEntity,
104 const char* theFieldName, int theTimeId);
105 bool CreateDeformedShape(SALOMEDS::SObject_var theField);
106 static VISU::DeformedShape_i* CreateDeformedShapePrs(SALOMEDS::SObject_var theField,
107 const char* theMeshName, VISU::Entity theEntity,
108 const char* theFieldName, int theTimeId);
109 bool CreateVectors(SALOMEDS::SObject_var theField);
110 static VISU::Vectors_i* CreateVectorsPrs(SALOMEDS::SObject_var theField,
111 const char* theMeshName, VISU::Entity theEntity,
112 const char* theFieldName, int theTimeId);
113 bool CreateIsoSurfaces(SALOMEDS::SObject_var theField);
114 static VISU::IsoSurfaces_i* CreateIsoSurfacesPrs(SALOMEDS::SObject_var theField,
115 const char* theMeshName, VISU::Entity theEntity,
116 const char* theFieldName, int theTimeId);
117 bool CreateCutPlanes(SALOMEDS::SObject_var theField);
118 static VISU::CutPlanes_i* CreateCutPlanesPrs(SALOMEDS::SObject_var theField,
119 const char* theMeshName, VISU::Entity theEntity,
120 const char* theFieldName, int theTimeId);
121 bool CreateCutLines(SALOMEDS::SObject_var theField);
122 static VISU::CutLines_i* CreateCutLinesPrs(SALOMEDS::SObject_var theField,
123 const char* theMeshName, VISU::Entity theEntity,
124 const char* theFieldName, int theTimeId);
125 bool CreateStreamLines(SALOMEDS::SObject_var theField);
126 static VISU::StreamLines_i* CreateStreamLinesPrs(SALOMEDS::SObject_var theField,
127 const char* theMeshName, VISU::Entity theEntity,
128 const char* theFieldName, int theTimeId);
129 bool TestObjectBrowser(SALOMEDS::SObject_var& objVisu);
131 typedef void (*TGetInfoFun)(QAD_Study *theActiveStudy, vtkDataSet *theDataSet, int theId);
132 void GetInfo(int theSelectionMode, TGetInfoFun theGetInfoFun);
134 typedef int (vtkDataSet::* TSelectFun)();
135 void Select(int theSelectionMode, TSelectFun theSelectFun,
136 const char* theTitle, const char* theRequest);
138 static void ShowTrihedron(bool Show);
139 static void ChangeViewer(int theType);
141 static void NewColor(VISU_Actor *Actor);
142 static void NewWireframeColor(VISU_MeshAct *Actor);
143 static void NewOpacity(VISU_Actor *Actor);
144 static void NewLinewidth(VISU_Actor *Actor);
146 static void ChangeScalarBar();
147 static void SetSweepingPreferences();
149 static void PlotTable( VISU::Table_i* table, int theDisplaying );
150 static void PlotCurve( VISU::Curve_i* curve, int theDisplaying );
151 static void PlotContainer( VISU::Container_i* container, int theDisplaying );
153 static QString getVisuInputDir();
154 static QString getVisuOutputDir();
156 static QString getValue(SALOMEDS::SObject_var theSObject, QString theKey);
157 static int checkHomoSelection();
159 VISU_Actor* UpdateViewer(VISU::Prs3d_i* thePrs, bool theDispOnly=false);
160 bool IsDisplayed(VISU::Prs3d_i* thePrs);
161 void ErasePrs(VISU::Prs3d_i* thePrs);
163 static VISU::Prs3d_i* GetSelectedPrs3d(Handle(SALOME_InteractiveObject)* theIO = NULL);
164 static void RecreateActor(VISU::Prs3d_i* thePrs);
165 static void CreateActor(VISU::Prs3d_i* thePrs);
166 static VISU_Actor* GetActor(VISU::Prs3d_i* thePrs, VTKViewer_ViewFrame* theViewFrame = NULL);
168 void VisuGUI::ChangeRepresentation(VISU::PresentationType theType);
169 void DeletePresentation(VISU::Prs3d_i* thePrs);
171 void SetState(int aState );
173 void EmitSignalDeactivateDialog();
174 void EmitSignalCloseAllDialogs();
175 QDialog* GetActiveDialogBox();
176 void SetActiveDialogBox(QDialog* aDlg);
178 // ----------------------------------------
179 // All method of standard EXPORT
180 // ----------------------------------------
181 Standard_EXPORT static bool OnGUIEvent(int theCommandID, QAD_Desktop* parent);
182 Standard_EXPORT static bool setSettings(QAD_Desktop* parent);
183 Standard_EXPORT static void DefinePopup(QString & theContext,
185 QString & theObject ) ;
186 Standard_EXPORT static bool CustomPopup(QAD_Desktop* parent,
188 const QString & theContext,
189 const QString & theParent,
190 const QString & theObject);
191 Standard_EXPORT static void BuildPresentation(const Handle(SALOME_InteractiveObject)&);
192 Standard_EXPORT static bool OnMousePress(QMouseEvent* pe ,
194 QAD_StudyFrame* studyFrame);
195 Standard_EXPORT static bool OnMouseMove(QMouseEvent* pe ,
197 QAD_StudyFrame* studyFrame);
198 Standard_EXPORT static bool OnKeyPress(QKeyEvent* pe,
200 QAD_StudyFrame* studyFrame);
202 void ImportTablesFromFile();
203 void ImportFromFile();
206 void CreateScalarMap();
207 void CreateDeformedShape();
208 void CreateVectors();
209 void CreateIsoSurfaces();
210 void CreateCutPlanes();
211 void CreateCutLines();
212 void CreateStreamLines();
213 void CreateManyMesh();
216 void DisplayOnlyPrs();
219 void EditScalarBar();
220 void DisplayManyPrs();
221 void DisplayOnlyManyPrs();
224 void MakeSurfaceframe();
225 void MakeInsideframe();
226 void MakeWireframe();
232 void ChangeWireframeColor();
233 void ChangeOpacity();
239 void CurveProperties();
240 void ClearContainer();
242 void SaveViewParams();
243 void RestoreViewParams();
248 void RenameContainer();
250 void TimeAnimation();
252 void ImportMedField();
253 //void ImportMedMesh();
255 void DeleteViewParams();
256 void CopyPresentation();
265 QDialog* myActiveDialogBox;
269 void SignalDeactivateActiveDialog();
270 void SignalCloseAllDialogs();