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