Salome HOME
Merge remote-tracking branch 'origin/master' into gni/adaptation
[modules/smesh.git] / src / SMESHGUI / SMESHGUI_MG_ADAPTDRIVER.h
1 // Copyright (C) 2011-2020  CEA/DEN, EDF R&D
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19
20 // SMESH SMESHGUI : GUI for the adaptation in the SMESH component
21 // File : SMESHGUI_MG_ADAPTDRIVER.h
22 //
23 #ifndef SMESHGUI_MG_ADAPTDRIVER_H
24 #define SMESHGUI_MG_ADAPTDRIVER_H
25
26 #include <set>
27 // SMESH includes
28 #include "SMESH_SMESHGUI.hxx"
29
30 // Qt includes
31 #include <QDialog>
32 #include <QTreeWidget>
33 #include<QItemDelegate>
34
35 #include <QThread>
36
37 #include "LightApp_DataOwner.h"
38 #include "SalomeApp_Application.h"
39 #include <SALOMEconfig.h>
40 #include <SALOME_ListIO.hxx>
41 #include "SalomeApp_Module.h"
42 #include "SalomeApp_Study.h"
43 #include <med.h>
44 #include <QObject>
45 // model
46 //~#include "MG_ADAPT.h"
47 #include "MG_ADAPTGUI.hxx"
48 #include "MG_ADAPT.hxx"
49
50
51 class SUIT_ViewWindow;
52 class SUIT_Desktop;
53 class SUIT_Study;
54 class SUIT_ResourceMgr;
55
56 class CAM_Module;
57
58 class SALOMEDSClient_Study;
59 class SALOMEDSClient_SObject;
60
61 class SalomeApp_Study;
62 class SalomeApp_Module;
63 class LightApp_SelectionMgr;
64 class SUIT_SelectionFilter;
65
66
67 class QButtonGroup;
68 class QLineEdit;
69 class QGroupBox;
70 class QRadioButton;
71 class QLabel;
72 class QCheckBox;
73 class QGridLayout;
74 class QTabWidget;
75 class QDoubleSpinBox;
76 class QSpinBox;
77 class QTreeWidget;
78 class QTreeWidgetItem;
79 class QSpacerItem;
80 class QHBoxLayout;
81 class QItemDelegate;
82 class QComboBox;
83 class QObject;
84
85
86 // IDL includes
87 #include <SALOMEconfig.h>
88 #include CORBA_SERVER_HEADER(SMESH_Mesh)
89 #include CORBA_SERVER_HEADER(SMESH_Gen)
90 class SMESHGUI;
91 class SMESHGUI_MgAdaptDlg;
92 class SMESHGUI_IdValidator;
93 class SMESHGUI_FilterDlg;
94 class MgAdapt;
95 class QHeaderView;
96 class QFileDialog;
97
98
99 int IObjectCount();
100 const SALOME_ListIO& selectedIO();
101 _PTR(Study) getStudy();
102 Handle(SALOME_InteractiveObject) firstIObject();
103 bool createAndPublishMed(QString fileName);
104 bool createMgAdaptObject(MgAdapt* myMgAdapt = 0);
105
106 class SMESHGUI_EXPORT SMESHGUI_MG_AdaptComputeDlg_QThread : public QThread
107 {
108     Q_OBJECT
109
110 public:
111     SMESHGUI_MG_AdaptComputeDlg_QThread(MgAdapt* model);
112     int                   result();
113     void                   cancel();
114 protected:
115     void run();
116
117 private:
118
119     MgAdapt* model;
120     int                  myResult;
121 };
122
123 class  SMESHGUI_MG_ADAPTDRIVER : public SMESHGUI_MgAdaptDlg
124 {
125     Q_OBJECT;
126
127 public :
128     SMESHGUI_MG_ADAPTDRIVER( SMESHGUI*, MgAdapt*, bool isCreation = true );
129     void setMyMesh(SMESH::SMESH_Mesh_var);
130     SMESH::SMESH_Mesh_var getMyMesh() ;
131
132 private :
133
134     SMESHGUI*                     mySMESHGUI;              /* Current SMESHGUI object */
135     LightApp_SelectionMgr* selMgr ;
136     SUIT_ResourceMgr* resMgr;
137     SUIT_ResourceMgr* resourceMgr();
138     LightApp_SelectionMgr* selectionMgr();
139     SMESH::SMESH_Mesh_var myMesh ;
140
141
142
143     void                   Init( bool = true );
144     void                   enterEvent( QEvent* );           /* mouse enter the QWidget */
145     void                   keyPressEvent( QKeyEvent* );
146     QString                getErrorMsg( SMESH::string_array_var invalidEntries,
147                                         QStringList &           entriesToBrowse );
148
149     bool                   isValid();
150     bool                   createMeshInObjectBrowser();
151     void                   setIsApplyAndClose( const bool theFlag );
152     bool                   isApplyAndClose() const;
153     bool                   execute();
154     SMESHGUI_IdValidator*  myIdValidator;
155     int                    myNbOkElements;          /* to check when elements are defined */
156
157     SVTK_Selector*         mySelector;
158
159     bool                   myBusy;
160     GEOM::GEOM_Object_var  myNewGeometry;
161     //~SMESH_Actor*           myActor;  //
162     SUIT_SelectionFilter*  myIdSourceFilter;
163
164     SMESH::SMESH_IDSource_var mySelectedObject;
165
166     QTabWidget*           myTabWidget;
167     QButtonGroup*          GroupConstructors;
168
169     QGroupBox*             ConstructorsBox;
170     QGroupBox*             GroupArguments;
171     QGroupBox*             GroupButtons;
172
173     QPushButton*           buttonOk;
174     QPushButton*           buttonCancel;
175     QPushButton*           buttonApply;
176     QPushButton*           buttonHelp;
177
178     QLabel*                myTextLabelElements;
179     QLabel*                myGeomLabel;
180     QLineEdit*             myLineEditElements;
181     QLineEdit*             myMeshNameEdit;
182     QLineEdit*             myGeomNameEdit;
183     QCheckBox*             myIdSourceCheck;
184     QCheckBox*             myCopyGroupsCheck;
185     QCheckBox*             myReuseHypCheck;
186     QCheckBox*             myCopyElementsCheck;
187     QCheckBox*             myKeepIdsCheck;
188
189     QPushButton*           myFilterBtn;
190     SMESHGUI_FilterDlg*    myFilterDlg;
191
192     QString                myHelpFileName;
193
194     bool                   myIsApplyAndClose;
195
196     QString             inputMeshName;
197     QString           outputMeshName;
198 private slots:
199     void selectionChanged();
200     void updateSelection();
201
202 protected slots :
203
204 private slots:
205
206     void exportMED(const char* );
207
208     virtual bool clickOnApply();
209     virtual void                   clickOnOk();
210     virtual void           clickOnHelp();
211     //~void                   SelectionIntoArgument();
212     void                   deactivateActiveDialog();
213     void                   activateThisDialog();
214     void                   onConstructor( int );
215     //~void                   onTextChange( const QString& );
216     //~void                   onSelectIdSource( bool );
217     void                   setFilters();
218     void                   onOpenView();
219     void                   onCloseView();
220
221
222 };
223
224
225
226
227 #endif // SMESHGUI_MG_ADAPTDRIVER_H