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 #include "VISU_Actor.h"
43 #include "VISU_PrsObject_i.hh"
44 #include "VISU_Table_i.hh"
45 #include "VISU_ViewManager_i.hh"
47 #include <TColStd_MapOfInteger.hxx>
48 #include <TColStd_MapIteratorOfMapOfInteger.hxx>
49 #include "SALOME_ListIteratorOfListIO.hxx"
53 enum RepresentType { POINTS, WIREFRAME, SURFACE, SHRINK };
57 // ======================================================================
59 // ======================================================================
61 class VisuGUI : public QObject{
67 static VISU::VISU_Gen_i* GetVisuGen();
69 static QAD_Desktop* GetDesktop();
70 static QAD_Study* GetActiveStudy();
71 static vtkRenderer* GetRenderer();
72 static VTKViewer_ViewFrame* GetVtkViewFrame();
73 static SALOMEDS::Study_var GetStudyDocument();
74 static SALOMEDS::StudyBuilder_var NewBuilder();
75 static VISU::Storable::TRestoringMap getMapOfValue(SALOMEDS::SObject_var theSObject);
77 static VisuGUI* GetOrCreateVisuGUI(QAD_Desktop* desktop);
78 static VisuGUI* GetVisuGUI() ;
80 static VISU::Result_i* CreatePresent(SALOMEDS::SObject_var theField, VISU::Result_var& theResult);
82 bool CreateScalarMap(SALOMEDS::SObject_var theField);
83 static VISU::ScalarMap_i* CreateScalarMapPrs(SALOMEDS::SObject_var theField,
84 const char* theMeshName, VISU::Entity theEntity,
85 const char* theFieldName, double theTimeId);
86 bool CreateDeformedShape(SALOMEDS::SObject_var theField);
87 static VISU::DeformedShape_i* CreateDeformedShapePrs(SALOMEDS::SObject_var theField,
88 const char* theMeshName, VISU::Entity theEntity,
89 const char* theFieldName, double theTimeId);
90 bool CreateVectors(SALOMEDS::SObject_var theField);
91 static VISU::Vectors_i* CreateVectorsPrs(SALOMEDS::SObject_var theField,
92 const char* theMeshName, VISU::Entity theEntity,
93 const char* theFieldName, double theTimeId);
94 bool CreateIsoSurfaces(SALOMEDS::SObject_var theField);
95 static VISU::IsoSurfaces_i* CreateIsoSurfacesPrs(SALOMEDS::SObject_var theField,
96 const char* theMeshName, VISU::Entity theEntity,
97 const char* theFieldName, double theTimeId);
98 bool CreateCutPlanes(SALOMEDS::SObject_var theField);
99 static VISU::CutPlanes_i* CreateCutPlanesPrs(SALOMEDS::SObject_var theField,
100 const char* theMeshName, VISU::Entity theEntity,
101 const char* theFieldName, double theTimeId);
102 bool CreateCutLines(SALOMEDS::SObject_var theField);
103 static VISU::CutLines_i* CreateCutLinesPrs(SALOMEDS::SObject_var theField,
104 const char* theMeshName, VISU::Entity theEntity,
105 const char* theFieldName, double theTimeId);
106 bool CreateStreamLines(SALOMEDS::SObject_var theField);
107 static VISU::StreamLines_i* CreateStreamLinesPrs(SALOMEDS::SObject_var theField,
108 const char* theMeshName, VISU::Entity theEntity,
109 const char* theFieldName, double theTimeId);
110 bool TestObjectBrowser(SALOMEDS::SObject_var& objVisu);
112 static void ShowTrihedron(bool Show);
113 static void ChangeViewer(int theType);
115 static void NewColor(VISU_Actor *Actor);
116 static void NewOutlineColor(VISUMesh_Actor *Actor);
117 static void NewOpacity(VISU_Actor *Actor);
118 static void NewLinewidth(VISU_Actor *Actor);
120 static void ChangeScalarBar();
121 static void SetSweepingPreferences();
123 static void PlotTable( VISU::Table_i* table, int theDisplaying );
124 static void PlotCurve( VISU::Curve_i* curve, int theDisplaying );
125 static void PlotContainer( VISU::Container_i* container, int theDisplaying );
127 static QString getVisuInputDir();
128 static QString getVisuOutputDir();
130 static QString getValue(SALOMEDS::SObject_var theSObject, QString theKey);
131 static int checkHomoSelection();
133 VISU_Actor* UpdateViewer(VISU::Prs3d_i* thePrs, bool theDispOnly=false);
134 bool IsDisplayed(VISU::Prs3d_i* thePrs);
135 void ErasePrs(VISU::Prs3d_i* thePrs);
137 static VISU::Prs3d_i* GetSelectedPrs3d(Handle(SALOME_InteractiveObject)* theIO = NULL);
138 void RecreateActor(VISU::Prs3d_i* thePrs);
139 static void CreateActor(VISU::Prs3d_i* thePrs);
140 static VISU_Actor *GetActor(int* theSelectionType = NULL);
141 static VISU_Actor* GetActor(VISU::Prs3d_i* thePrs, VTKViewer_ViewFrame* theViewFrame = NULL);
143 void VisuGUI::ChangeRepresentation(RepresentType theType);
144 void DeletePresentation(VISU::Prs3d_i* thePrs);
146 void SetState(int aState );
148 void EmitSignalDeactivateDialog();
149 void EmitSignalCloseAllDialogs();
150 QDialog* GetActiveDialogBox();
151 void SetActiveDialogBox(QDialog* aDlg);
153 // ----------------------------------------
154 // All method of standard EXPORT
155 // ----------------------------------------
156 Standard_EXPORT static bool OnGUIEvent(int theCommandID, QAD_Desktop* parent);
157 Standard_EXPORT static bool setSettings(QAD_Desktop* parent);
158 Standard_EXPORT static void DefinePopup(QString & theContext,
160 QString & theObject ) ;
161 Standard_EXPORT static bool CustomPopup(QAD_Desktop* parent,
163 const QString & theContext,
164 const QString & theParent,
165 const QString & theObject);
166 Standard_EXPORT static void BuildPresentation(const Handle(SALOME_InteractiveObject)&);
167 Standard_EXPORT static bool OnMousePress(QMouseEvent* pe ,
169 QAD_StudyFrame* studyFrame);
170 Standard_EXPORT static bool OnMouseMove(QMouseEvent* pe ,
172 QAD_StudyFrame* studyFrame);
173 Standard_EXPORT static bool OnKeyPress(QKeyEvent* pe,
175 QAD_StudyFrame* studyFrame);
177 void ImportTablesFromFile();
178 void ImportFromFile();
181 void CreateScalarMap();
182 void CreateDeformedShape();
183 void CreateVectors();
184 void CreateIsoSurfaces();
185 void CreateCutPlanes();
186 void CreateCutLines();
187 void CreateStreamLines();
188 void CreateManyMesh();
191 void DisplayOnlyPrs();
194 void EditScalarBar();
195 void DisplayManyPrs();
198 void MakeWireframe();
204 void ChangeOutlineColor();
205 void ChangeOpacity();
211 void CurveProperties();
212 void ClearContainer();
214 void SaveViewParams();
215 void RestoreViewParams();
220 void TimeAnimation();
222 void ImportMedField();
223 //void ImportMedMesh();
225 void DeleteViewParams();
226 void CopyPresentation();
234 QDialog* myActiveDialogBox;
238 void SignalDeactivateActiveDialog();
239 void SignalCloseAllDialogs();