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