Salome HOME
IPAL54529: Hexahedron(ijk) fails on a block with composite sides if Viscous Layers...
[modules/smesh.git] / src / SMESHGUI / SMESHGUI_MeshDlg.h
1 // Copyright (C) 2007-2019  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_MeshDlg.h
25 // Author : Sergey LITONIN, Open CASCADE S.A.S.
26 //
27 #ifndef SMESHGUI_MESHDLG_H
28 #define SMESHGUI_MESHDLG_H
29
30 // SMESH includes
31 #include "SMESH_SMESHGUI.hxx"
32
33 #include "SMESHGUI_Dialog.h"
34
35 // Qt includes
36 #include <QFrame>
37 #include <QStringList>
38 #include <QMap>
39
40 class SMESHGUI_MeshTab;
41 class QAction;
42 class QComboBox;
43 class QListWidget;
44 class QMenu;
45 class QTabWidget;
46 class QToolButton;
47 class QtxToolButton;
48
49 /*!
50  * \brief Dialog for mech creation or editing
51  *
52  *  This dialog is used for mech creation or editing. 
53 */
54 class SMESHGUI_EXPORT SMESHGUI_MeshDlg : public SMESHGUI_Dialog
55
56   Q_OBJECT       
57       
58 public:
59   
60   enum Controls { Obj, Mesh, Geom };
61   
62   /*! Describes dimensions */
63   enum Dimensions { Dim0D = 0, Dim1D, Dim2D, Dim3D };      
64   
65 public:
66   SMESHGUI_MeshDlg( const bool, const bool );
67   virtual ~SMESHGUI_MeshDlg();
68   
69   void                         reset();
70   void                         setTitile( const bool, const bool );
71   void                         setHypoSets( const QStringList& );
72   void                         setGeomPopupEnabled( const bool );
73   int                          getActiveObject();
74
75   SMESHGUI_MeshTab*            tab( const int ) const;
76   void                         enableTab(const int);
77   void                         disableTab(const int);
78   bool                         isTabEnabled(const int) const;
79   void                         setCurrentTab( const int );
80   int                          currentTab() const;
81   void                         setMaxHypoDim( const int );
82
83   void                         setAvailableMeshType(const QStringList& );
84   void                         setCurrentMeshType( const int );
85   int                          currentMeshType();
86
87 signals:
88   void                         hypoSet( const QString& );
89   void                         geomSelectionByMesh( bool );
90   void                         selectMeshType( const int, const int );
91
92 private slots:  
93   void                         onHypoSetPopup( QAction* );
94   void                         onGeomPopup( QAction* );
95   void                         onGeomSelectionButton( bool );
96   void                         onChangedMeshType( const int );
97
98  private:
99   QMap<int, SMESHGUI_MeshTab*> myTabs;
100   QTabWidget*                  myTabWg;
101   QToolButton*                 myHypoSetButton;
102   QMenu*                       myGeomPopup;
103   QComboBox*                   myMeshType;
104 };
105
106 /*!
107  * \brief Tab for tab widget containing controls for definition of
108  * algorithms and hypotheses
109  */
110
111 class SMESHGUI_EXPORT SMESHGUI_MeshTab : public QFrame
112 {
113   Q_OBJECT
114
115     public:
116   /*! To differ main algorithms, hypotheses and additional ones*/
117   enum HypType
118   {
119     Algo = 0, //!< algorithms
120     MainHyp,  //!< main hypothesis
121     AddHyp,    //!< additional hypothesis
122     MoreAddHyp //! since several additional hypothesis are possible, the 2-nd, 3-d etc
123     // additional hypotheses are coded as being of HypType (AddHyp + 1), (AddHyp + 2) etc.
124     // Nb of HypType's after MainHyp is returned by SMESHGUI_MeshTab::nbAddHypTypes()
125   };
126
127 public:      
128   SMESHGUI_MeshTab( QWidget* );
129   virtual ~SMESHGUI_MeshTab();
130   
131   void                         setAvailableHyps( const int, const QStringList& );
132   void                         setExistingHyps( const int, const QStringList&, bool=false);
133   void                         addHyp( const int, const QString& );
134   //void                         renameHyp( const int, const int, const QString& );
135   void                         setCurrentHyp( const int, const int );
136   int                          currentHyp( const int ) const;
137   int                          nbAddHypTypes() const;
138   void                         reset();
139
140 signals:  
141   void                         createHyp( const int, const int );
142   //!< Emitted when "Create hypothesis" button clicked
143   void                         editHyp( const int, const int );
144   //!< Emitted when "Edit hypothesis" button clicked
145   void                         selectAlgo( const int );
146   //!< Emitted when an algorithm is selected
147   
148 private slots:  
149   void                         onCreateHyp();  
150   void                         onEditHyp();
151   void                         onHyp( int );
152   void                         onMoreAddHyp();
153   void                         onLessAddHyp();
154
155 private:
156
157   void                         addItem( const QString& txt, const int type, const int index, const bool isGroup=false );
158   int                          getCurrentIndex( const int type, const bool curByType=false) const;
159
160   QMap<int, QStringList>       myAvailableHypTypes;
161
162   QMap<int, QtxToolButton*>    myHypCombo;
163   QMap<int, QToolButton*>      myCreateHypBtn;
164   QMap<int, QToolButton*>      myEditHypBtn;
165
166   QToolButton*                 myMoreAddHypBtn;
167   QToolButton*                 myLessAddHypBtn;
168   QListWidget*                 myAddHypList; // 2-nd, etc. additional hyps
169 };
170
171 #endif // SMESHGUI_MESHDLG_H