Salome HOME
#23999 EDF 22760 - integration of dev in SMESH (from branch '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_ADAPTGUI.hxx"
47
48 #include CORBA_SERVER_HEADER(MG_ADAPT)
49
50 class SUIT_ViewWindow;
51 class SUIT_Desktop;
52 class SUIT_Study;
53 class SUIT_ResourceMgr;
54
55 class CAM_Module;
56
57 class SALOMEDSClient_Study;
58 class SALOMEDSClient_SObject;
59
60 class SalomeApp_Study;
61 class SalomeApp_Module;
62 class LightApp_SelectionMgr;
63 class SUIT_SelectionFilter;
64
65
66 class QButtonGroup;
67 class QLineEdit;
68 class QGroupBox;
69 class QRadioButton;
70 class QLabel;
71 class QCheckBox;
72 class QGridLayout;
73 class QTabWidget;
74 class QDoubleSpinBox;
75 class QSpinBox;
76 class QTreeWidget;
77 class QTreeWidgetItem;
78 class QSpacerItem;
79 class QHBoxLayout;
80 class QItemDelegate;
81 class QComboBox;
82 class QObject;
83
84
85 // IDL includes
86 #include <SALOMEconfig.h>
87 #include CORBA_SERVER_HEADER(SMESH_Mesh)
88 #include CORBA_SERVER_HEADER(SMESH_Gen)
89 class SMESHGUI;
90 class SMESHGUI_MgAdaptDlg;
91 class SMESHGUI_IdValidator;
92 class SMESHGUI_FilterDlg;
93 class MgAdapt;
94 class QHeaderView;
95 class QFileDialog;
96
97
98 int IObjectCount();
99 const SALOME_ListIO& selectedIO();
100 _PTR(Study) getStudy();
101 Handle(SALOME_InteractiveObject) firstIObject();
102 bool createAndPublishMed(QString fileName);
103 bool createMgAdaptObject(MgAdapt* myMgAdapt = 0);
104
105
106 class  SMESHGUI_MG_ADAPTDRIVER : public SMESHGUI_MgAdaptDlg
107 {
108     Q_OBJECT;
109
110 public :
111     SMESHGUI_MG_ADAPTDRIVER( SMESHGUI*, SMESH::MG_ADAPT_ptr, bool isCreation = true );
112     void setMyMesh(SMESH::SMESH_Mesh_var);
113     SMESH::SMESH_Mesh_var getMyMesh() ;
114
115 private :
116
117     SMESHGUI*                     mySMESHGUI;              /* Current SMESHGUI object */
118     LightApp_SelectionMgr* selMgr ;
119     SUIT_ResourceMgr* resMgr;
120     SUIT_ResourceMgr* resourceMgr();
121     LightApp_SelectionMgr* selectionMgr();
122     SMESH::SMESH_Mesh_var myMesh ;
123
124
125
126     void                   Init( bool = true );
127     void                   enterEvent( QEvent* );           /* mouse enter the QWidget */
128     void                   keyPressEvent( QKeyEvent* );
129     QString                getErrorMsg( SMESH::string_array_var invalidEntries,
130                                         QStringList &           entriesToBrowse );
131
132     bool                   isValid();
133     bool                   createMeshInObjectBrowser();
134     void                   setIsApplyAndClose( const bool theFlag );
135     bool                   isApplyAndClose() const;
136     bool                   execute();
137     SMESHGUI_IdValidator*  myIdValidator;
138     int                    myNbOkElements;          /* to check when elements are defined */
139
140     SVTK_Selector*         mySelector;
141
142     bool                   myBusy;
143     GEOM::GEOM_Object_var  myNewGeometry;
144     //~SMESH_Actor*           myActor;  //
145     SUIT_SelectionFilter*  myIdSourceFilter;
146
147     SMESH::SMESH_IDSource_var mySelectedObject;
148
149     QTabWidget*           myTabWidget;
150     QButtonGroup*          GroupConstructors;
151
152     QGroupBox*             ConstructorsBox;
153     QGroupBox*             GroupArguments;
154     QGroupBox*             GroupButtons;
155
156     QPushButton*           buttonOk;
157     QPushButton*           buttonCancel;
158     QPushButton*           buttonApply;
159     QPushButton*           buttonHelp;
160
161     QLabel*                myTextLabelElements;
162     QLabel*                myGeomLabel;
163     QLineEdit*             myLineEditElements;
164     QLineEdit*             myMeshNameEdit;
165     QLineEdit*             myGeomNameEdit;
166     QCheckBox*             myIdSourceCheck;
167     QCheckBox*             myCopyGroupsCheck;
168     QCheckBox*             myReuseHypCheck;
169     QCheckBox*             myCopyElementsCheck;
170     QCheckBox*             myKeepIdsCheck;
171
172     QPushButton*           myFilterBtn;
173     SMESHGUI_FilterDlg*    myFilterDlg;
174
175     QString                myHelpFileName;
176
177     bool                   myIsApplyAndClose;
178
179     QString             inputMeshName;
180     QString           outputMeshName;
181 private slots:
182     void selectionChanged();
183     void updateSelection();
184
185 protected slots :
186
187 private slots:
188
189     void exportMED(const char* );
190
191     virtual bool PushOnApply();
192     virtual void PushOnOK();
193     virtual void PushOnHelp();
194
195     void                   deactivateActiveDialog();
196     void                   activateThisDialog();
197     void                   onConstructor( int );
198     //~void                   onTextChange( const QString& );
199     //~void                   onSelectIdSource( bool );
200     void                   setFilters();
201     void                   onOpenView();
202     void                   onCloseView();
203
204
205 };
206
207
208
209
210 #endif // SMESHGUI_MG_ADAPTDRIVER_H