Salome HOME
#19765 EDF 21730 - long time to load med file file with huge amount of groups
[modules/smesh.git] / src / SMESHGUI / SMESHGUI_SewingDlg.h
1 // Copyright (C) 2007-2020  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
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, or (at your option) any later version.
10 //
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.
15 //
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
19 //
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22
23 // SMESH SMESHGUI : GUI for SMESH component
24 // File   : SMESHGUI_SewingDlg.h
25 // Author : Michael ZORIN, Open CASCADE S.A.S.
26 //
27 #ifndef SMESHGUI_SEWINGDLG_H
28 #define SMESHGUI_SEWINGDLG_H
29
30 // SMESH includes
31 #include "SMESH_SMESHGUI.hxx"
32
33 // Qt includes
34 #include <QDialog>
35
36 // IDL includes
37 #include <SALOMEconfig.h>
38 #include CORBA_SERVER_HEADER(SMESH_Mesh)
39 #include CORBA_SERVER_HEADER(SMESH_MeshEditor)
40
41 #include <vector>
42
43 class QButtonGroup;
44 class QGroupBox;
45 class QLabel;
46 class QLineEdit;
47 class QPushButton;
48 class QRadioButton;
49 class QCheckBox;
50 class SMESHGUI;
51 class SMESH_Actor;
52 class SVTK_Selector;
53 class LightApp_SelectionMgr;
54 class SMESHGUI_SpinBox;
55 class SalomeApp_IntSpinBox;
56 class QListWidget;
57 class QListWidgetItem;
58
59 //=================================================================================
60 // class    : SMESHGUI_SewingDlg
61 // purpose  :
62 //=================================================================================
63 class SMESHGUI_EXPORT SMESHGUI_SewingDlg : public QDialog
64
65   Q_OBJECT
66
67 public:
68   SMESHGUI_SewingDlg( SMESHGUI* );
69   ~SMESHGUI_SewingDlg();
70
71 private:
72   void                    Init();
73   void                    enterEvent( QEvent* );                /* mouse enter the QWidget */
74   void                    keyPressEvent( QKeyEvent* );
75   int                     GetConstructorId();
76   bool                    IsValid();
77   void                    UpdateButtons();
78
79   SMESHGUI*               mySMESHGUI;              /* Current SMESHGUI object */
80   LightApp_SelectionMgr*  mySelectionMgr;          /* User shape selection */
81   int                     myOk1, myOk2, myOk3, myOk4, myOk5, myOk6;    
82   QLineEdit*              myEditCurrentArgument;   /* Current  LineEdit */
83   SVTK_Selector*          mySelector;
84   
85   bool                    myBusy;
86   SMESH::SMESH_Mesh_var   myMesh;
87   SMESH_Actor*            myActor;
88   
89   QGroupBox*              ConstructorsBox;
90   QButtonGroup*           GroupConstructors;
91   QRadioButton*           RadioButton1;
92   QRadioButton*           RadioButton2;
93   QRadioButton*           RadioButton3;
94   QRadioButton*           RadioButton4;
95   QGroupBox*              GroupButtons;
96   QPushButton*            buttonOk;
97   QPushButton*            buttonCancel;
98   QPushButton*            buttonApply;
99   QPushButton*            buttonHelp;
100   QGroupBox*              GroupArguments;
101   QGroupBox*              SubGroup1;
102   QGroupBox*              SubGroup2;
103   QLabel*                 TextLabel1;
104   QLabel*                 TextLabel2;
105   QLabel*                 TextLabel3;
106   QLabel*                 TextLabel4;
107   QLabel*                 TextLabel5;
108   QLabel*                 TextLabel6;
109   QPushButton*            SelectButton1;
110   QPushButton*            SelectButton2;
111   QPushButton*            SelectButton3;
112   QPushButton*            SelectButton4;
113   QPushButton*            SelectButton5;
114   QPushButton*            SelectButton6;
115   QLineEdit*              LineEdit1;
116   QLineEdit*              LineEdit2;
117   QLineEdit*              LineEdit3;
118   QLineEdit*              LineEdit4;
119   QLineEdit*              LineEdit5;
120   QLineEdit*              LineEdit6;
121   QCheckBox*              CheckBoxMerge;
122   QCheckBox*              CheckBoxPolygons;
123   QCheckBox*              CheckBoxPolyedrs;
124
125   QWidget*                SewFreeBordersWidget;
126   QGroupBox*              ModeGroup;
127   QButtonGroup*           ModeButGrp;
128   //QPushButton*            SelectMeshButton;
129   QLineEdit*              LineEditMesh;
130
131   SMESHGUI_SpinBox*       SpinBoxTolerance;
132   QCheckBox*              AutoSewCheck;
133
134   QWidget*                GroupCoincidentWidget;
135   QListWidget*            ListCoincident;
136   QPushButton*            DetectButton;
137   QPushButton*            RemoveGroupButton;
138   QCheckBox*              SelectAllCheck;
139
140   QListWidget*            ListEdit;
141   QButtonGroup*           MoveBorderEndsButGrp;
142   QLineEdit*              BorderEndLine[2];
143   QPushButton*            SwapBut;
144   QPushButton*            SetFirstButton;
145   QPushButton*            RemoveElemButton;
146   SalomeApp_IntSpinBox*   StepSpin;
147
148   QString                 myHelpFileName;
149
150
151   struct BorderGroupDisplayer;
152   std::vector< BorderGroupDisplayer* > myBorderDisplayers;
153   SMESH::CoincidentFreeBorders_var     myBorders;
154   int                                  myCurGroupIndex;
155   int                                  myCurPartIndex;
156   int                                  myStoredRepresentation;
157   unsigned int                         myStoredEntityMode;
158
159   bool                    haveBorders();
160   QString                 getGroupText( int groupIndex );
161   QString                 getPartText( const SMESH::FreeBorderPart& part );
162   void                    showGroup( QListWidgetItem* item );
163   bool                    setCurrentGroup();
164   bool                    setCurrentPart();
165   void                    onGroupChange(bool partChange=false);
166   void                    setDisplayMode();
167   void                    restoreDisplayMode();
168
169
170  protected slots:
171   virtual void            reject();
172
173  private slots:
174   void                    ConstructorsClicked( int );
175   void                    onModeChange( int );
176   void                    onAutoSew( int );
177   void                    onDetectClicked();
178   void                    onRemoveGroupClicked();
179   void                    onSelectGroup();
180   void                    onSelectAll(int);
181   void                    onSelectBorderPartFromGroup();
182   void                    onSetFirstClicked();
183   void                    onRemoveElemClicked();
184   void                    onMoveBorderEnd(int);
185   void                    onSwapClicked();
186   void                    ClickOnOk();
187   bool                    ClickOnApply();
188   void                    ClickOnHelp();
189   void                    SetEditCurrentArgument();
190   void                    SelectionIntoArgument( bool = true );
191   void                    DeactivateActiveDialog();
192   void                    ActivateThisDialog();
193   void                    onTextChange( const QString& );
194   void                    onOpenView();
195   void                    onCloseView();
196 };
197
198 #endif // SMESHGUI_SEWINGDLG_H