Salome HOME
Update copyright
[modules/smesh.git] / src / StdMeshersGUI / StdMeshersGUI_SubShapeSelectorWdg.h
1 // Copyright (C) 2007-2011  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                                      TopAbs_ShapeEnum aSubShType = TopAbs_EDGE );
57   ~StdMeshersGUI_SubShapeSelectorWdg();
58
59   SMESH::long_array_var          GetListOfIDs();
60   void                           SetListOfIDs( SMESH::long_array_var );
61
62   void                           SetGeomShapeEntry( const QString& theEntry );
63   const char*                    GetGeomShapeEntry() { return myEntry.toLatin1().data();}
64
65   void                           SetMainShapeEntry( const QString& theEntry );
66   const char*                    GetMainShapeEntry();
67
68   TopoDS_Shape                   GetGeomShape() { return myGeomShape; }
69   TopoDS_Shape                   GetMainShape() { return myMainShape; }
70
71   QList<int>                     GetCorrectedListOfIDs( bool fromSubshapeToMainshape = true );
72
73   static GEOM::GEOM_Object_var   GetGeomObjectByEntry( const QString& );
74   static TopoDS_Shape            GetTopoDSByEntry( const QString& );
75
76   QString                        GetValue() const { return myParamValue; }
77
78   void                           showPreview ( bool );
79
80   int                            GetListSize() { return myListOfIDs.size(); }
81
82   void SetMaxSize(int aMaxSize) { myMaxSize = aMaxSize; }
83   //void SetSubShType(TopAbs_ShapeEnum aSubShType) { mySubShType = aSubShType; }
84
85 private:
86   void                           updateState();
87   void                           setFilter();
88
89 private slots:
90   void                           onAdd(); 
91   void                           onRemove(); 
92   void                           SelectionIntoArgument();
93   void                           onListSelectionChanged();
94
95 private:
96   void                           init();
97
98 private:
99   SMESHGUI*                      mySMESHGUI;
100   LightApp_SelectionMgr*         mySelectionMgr;          /* User shape selection */
101   SVTK_Selector*                 mySelector;
102   SMESH::SMESH_Mesh_var          myMesh;
103   TopoDS_Shape                   myGeomShape; // shape whose sub-shapes are selected
104   TopoDS_Shape                   myMainShape; // main shape of the mesh
105   QString                        myEntry;
106   QString                        myMainEntry;
107   vtkRenderer*                   myRenderer;
108   
109   QListWidget*                   myListWidget;
110   QPushButton*                   myAddButton;
111   QPushButton*                   myRemoveButton;
112   QList<int>                     mySelectedIDs;
113   QList<int>                     myListOfIDs;
114   
115   QString                        myParamValue;
116   bool                           myIsShown;
117   bool                           myIsNotCorrected;
118
119   // for manage possible size of myListOfIDs
120   int                            myMaxSize;
121   // for manage type of selected subshape
122   TopAbs_ShapeEnum               mySubShType;
123   
124   SMESH_PreviewActorsCollection* myPreviewActor;
125   QList<SUIT_SelectionFilter*>   myGeomFilters;
126   SUIT_SelectionFilter*          myFilter;
127 };
128
129 #endif // STDMESHERSGUI_SUBSHAPESELECTORWDG_H