Salome HOME
020716: EDF 1229 SMESH : Improvement of reversed edges dialog box
[modules/smesh.git] / src / StdMeshersGUI / StdMeshersGUI_SubShapeSelectorWdg.h
1 //  Copyright (C) 2007-2010  CEA/DEN, EDF R&D, OPEN CASCADE
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.
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 // File   : StdMeshersGUI_SubShapeSelectorWdg.h
21 // Author : Open CASCADE S.A.S. (dmv)
22 //
23 #ifndef STDMESHERSGUI_SUBSHAPESELECTORWDG_H
24 #define STDMESHERSGUI_SUBSHAPESELECTORWDG_H
25
26 // SMESH includes
27 #include <SMESHGUI.h>
28 #include "SMESH_StdMeshersGUI.hxx"
29 #include "SMESH_SMESHGUI.hxx"
30
31 // Qt includes
32 #include <QWidget>
33 #include <QStringList>
34 #include <TopoDS_Shape.hxx>
35
36 #include <SMESHGUI_VTKUtils.h>
37
38 class SMESHGUI;
39 class LightApp_SelectionMgr;
40 class SVTK_Selector;
41 class QPushButton;
42 class QLineEdit;
43 class QCheckBox;
44 class QListWidget;
45 class SMESH_Actor;
46 class SMESH_PreviewActorsCollection;
47 class vtkRenderer;
48 class SUIT_SelectionFilter;
49
50 class STDMESHERSGUI_EXPORT StdMeshersGUI_SubShapeSelectorWdg : public QWidget
51 {
52   Q_OBJECT
53
54 public:
55   StdMeshersGUI_SubShapeSelectorWdg( QWidget* parent = 0 );
56   ~StdMeshersGUI_SubShapeSelectorWdg();
57
58   SMESH::long_array_var          GetListOfIDs();
59   void                           SetListOfIDs( SMESH::long_array_var );
60
61   void                           SetGeomShapeEntry( const QString& theEntry );
62   const char*                    GetGeomShapeEntry() { return myEntry.toLatin1().data();}
63
64   void                           SetMainShapeEntry( const QString& theEntry );
65   const char*                    GetMainShapeEntry();
66
67   TopoDS_Shape                   GetGeomShape() { return myGeomShape; }
68   TopoDS_Shape                   GetMainShape() { return myMainShape; }
69
70   QList<int>                     GetCorrectedListOfIDs( bool fromSubshapeToMainshape = true );
71
72   static GEOM::GEOM_Object_var   GetGeomObjectByEntry( const QString& );
73   static TopoDS_Shape            GetTopoDSByEntry( const QString& );
74
75   QString                        GetValue() const { return myParamValue; }
76
77   void                           showPreview ( bool );
78
79   int                            GetListSize() { return myListOfIDs.size(); }
80
81   void SetMaxSize(int aMaxSize) { myMaxSize = aMaxSize; }
82   void SetSubShType(TopAbs_ShapeEnum aSubShType) { mySubShType = aSubShType; }
83
84 private:
85   void                           updateState();
86
87 private slots:
88   void                           onAdd(); 
89   void                           onRemove(); 
90   void                           SelectionIntoArgument();
91   void                           onListSelectionChanged();
92
93 private:
94   void                           init();
95
96 private:
97   SMESHGUI*                      mySMESHGUI;
98   LightApp_SelectionMgr*         mySelectionMgr;          /* User shape selection */
99   SVTK_Selector*                 mySelector;
100   SMESH::SMESH_Mesh_var          myMesh;
101   TopoDS_Shape                   myGeomShape;
102   TopoDS_Shape                   myMainShape;
103   QString                        myEntry;
104   QString                        myMainEntry;
105   vtkRenderer*                   myRenderer;
106   
107   QListWidget*                   myListWidget;
108   QPushButton*                   myAddButton;
109   QPushButton*                   myRemoveButton;
110   QList<int>                     mySelectedIDs;
111   QList<int>                     myListOfIDs;
112   
113   QString                        myParamValue;
114   bool                           myIsShown;
115   bool                           myIsNotCorrected;
116
117   // for manage possible size of myListOfIDs
118   int                            myMaxSize;
119   // for manage type of selected subshape
120   TopAbs_ShapeEnum               mySubShType;
121   
122   SMESH_PreviewActorsCollection* myPreviewActor;
123   QList<SUIT_SelectionFilter*>   myGeomFilters;
124   SUIT_SelectionFilter*          myFilter;
125 };
126
127 #endif // STDMESHERSGUI_SUBSHAPESELECTORWDG_H