Salome HOME
PAL13473 (Build repetitive mesh):
[modules/smesh.git] / src / SMESHGUI / SMESHGUI_ShapeByMeshDlg.h
1 //  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
2 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
3 //
4 //  This library is free software; you can redistribute it and/or
5 //  modify it under the terms of the GNU Lesser General Public
6 //  License as published by the Free Software Foundation; either
7 //  version 2.1 of the License.
8 //
9 //  This library is distributed in the hope that it will be useful,
10 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
11 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12 //  Lesser General Public License for more details.
13 //
14 //  You should have received a copy of the GNU Lesser General Public
15 //  License along with this library; if not, write to the Free Software
16 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
17 //
18 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 //
20 //
21 //
22 //  File   : SMESHGUI_ShapeByMeshDlg.h
23 //  Author : Edward AGAPOV
24 //  Module : SMESH
25
26
27 #ifndef SMESHGUI_ShapeByMeshDlg_H
28 #define SMESHGUI_ShapeByMeshDlg_H
29
30 #include "SMESHGUI_Dialog.h"
31 #include "SMESHGUI_SelectionOp.h"
32
33 // IDL Headers
34 #include <SALOMEconfig.h>
35 #include CORBA_SERVER_HEADER(GEOM_Gen)
36 #include CORBA_SERVER_HEADER(SMESH_Mesh)
37
38 class QCloseEvent;
39 class QFrame;
40 class QLineEdit;
41 class QPushButton;
42 class LightApp_SelectionMgr;
43 class SVTK_ViewWindow;
44 class QButtonGroup;
45 class SMESHGUI;
46
47 /*!
48  * \brief Dialog to publish a sub-shape of the mesh main shape
49  *        by selecting mesh elements
50  */
51
52 class SMESHGUI_ShapeByMeshDlg : public SMESHGUI_Dialog
53 {
54   Q_OBJECT
55
56 public:
57                            SMESHGUI_ShapeByMeshDlg();
58   virtual                  ~SMESHGUI_ShapeByMeshDlg();
59
60 private:
61
62 //   void                     closeEvent (QCloseEvent* e);
63 //   void                     enterEvent (QEvent*);
64
65 private:
66
67   //QFrame*                  createButtonFrame (QWidget*);
68   QFrame*                  createMainFrame   (QWidget*);
69   //void                     displayPreview();
70   //void                     erasePreview();
71 private:
72
73   QButtonGroup*            myElemTypeGroup;
74   QLineEdit*               myElementId;
75   QLineEdit*               myGeomName;
76
77 private:
78   bool                     myIsMultipleAllowed;
79   void                     setMultipleAllowed(bool isAllowed) {myIsMultipleAllowed = isAllowed;};
80
81 //   QPushButton*             myOkBtn;
82 //   QPushButton*             myCloseBtn;
83
84 //   SMESHGUI*                mySMESHGUI;
85 //   LightApp_SelectionMgr*   mySelectionMgr;
86 //   SVTK_ViewWindow*         myViewWindow;
87
88   friend class SMESHGUI_ShapeByMeshOp;
89 };
90
91 class SMESHGUI_ShapeByMeshOp: public SMESHGUI_SelectionOp
92 {
93   Q_OBJECT
94
95 public:
96   SMESHGUI_ShapeByMeshOp(bool isMultipleAllowed = false);
97   virtual ~SMESHGUI_ShapeByMeshOp();
98
99   virtual LightApp_Dialog*       dlg() const;  
100
101   void                     Init();
102   void                     SetMesh (SMESH::SMESH_Mesh_ptr);
103   SMESH::SMESH_Mesh_ptr    GetMesh () { return myMesh; }
104   GEOM::GEOM_Object_ptr    GetShape();
105
106 protected:
107
108   virtual void                   commitOperation();
109   virtual void                   startOperation();
110   //virtual void                   selectionDone();
111   //virtual SUIT_SelectionFilter*  createFilter( const int ) const;
112   //virtual bool                   isValid( SUIT_Operation* ) const;
113
114   void                     activateSelection();
115   void                     setElementID(const QString&);
116
117 /* signals: */
118
119 /*   void                     PublishShape(); */
120 /*   void                     Close(); */
121
122 protected slots:
123
124   virtual bool                   onApply() { return true; }
125 /*   void                           onCreateHyp( const int theHypType, const int theIndex ); */
126 /*   void                           onEditHyp( const int theHypType, const int theIndex ); */
127 /*   void                           onHypoSet( const QString& theSetName ); */
128 /*   void                           onGeomSelectionByMesh( bool ); */
129 /*   void                           onPublishShapeByMeshDlg(); */
130 /*   void                           onCloseShapeByMeshDlg(); */
131
132 private slots:
133
134 //   void                     onOk();
135 //   void                     onClose();
136
137 //   void                     onDeactivate();
138
139   void                     onSelectionDone();
140   void                     onTypeChanged (int);
141   void                     onElemIdChanged (const QString&);
142
143 private:
144
145   SMESHGUI_ShapeByMeshDlg* myDlg;
146   SMESH::SMESH_Mesh_var    myMesh;
147   GEOM::GEOM_Object_var    myGeomObj;
148
149   bool                     myIsManualIdEnter;
150   bool                     myHasSolids;
151   bool                     myIsMultipleAllowed;
152 };
153
154 #endif