Salome HOME
INT PAL 0052683: Parameter "Color group" in the "Create Group" dialog box is empty
[modules/smesh.git] / src / StdMeshersGUI / StdMeshersGUI_SubShapeSelectorWdg.h
1 // Copyright (C) 2007-2015  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, or (at your option) any later version.
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 <string>
37
38 class SMESHGUI;
39 class LightApp_SelectionMgr;
40 class SVTK_Selector;
41 class QPushButton;
42 class QLabel;
43 class QListWidget;
44 class SMESH_PreviewActorsCollection;
45 class vtkRenderer;
46 class SUIT_SelectionFilter;
47
48 class STDMESHERSGUI_EXPORT StdMeshersGUI_SubShapeSelectorWdg : public QWidget
49 {
50   Q_OBJECT
51
52 public:
53   StdMeshersGUI_SubShapeSelectorWdg( QWidget* parent = 0,
54                                      TopAbs_ShapeEnum aSubShType = TopAbs_EDGE );
55   ~StdMeshersGUI_SubShapeSelectorWdg();
56
57   SMESH::long_array_var          GetListOfIDs();
58   bool                           SetListOfIDs( SMESH::long_array_var );
59
60   void                           SetGeomShapeEntry( const QString& theEntry,
61                                                     const QString& theMainShapeEntry);
62   //QString                        GetGeomShapeEntry() { return myEntry; }
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,
71   //                                                       bool* isOK=0);
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
84   vtkRenderer*                   GetRenderer() { return myRenderer; }
85   SMESH_PreviewActorsCollection* GetActorCollection() { return myPreviewActor; }
86   void                           ClearSelected();
87
88 private:
89   void                           updateState();
90   void                           setFilter();
91   void                           updateButtons();
92
93 private slots:
94   void                           onAdd(); 
95   void                           onRemove(); 
96   void                           onPrevious(); 
97   void                           onNext(); 
98   void                           selectionIntoArgument();
99   void                           onListSelectionChanged();
100
101 private:
102   void                           init();
103
104 private:
105   SMESHGUI*                      mySMESHGUI;
106   LightApp_SelectionMgr*         mySelectionMgr;          /* User shape selection */
107   SVTK_Selector*                 mySelector;
108   SMESH::SMESH_Mesh_var          myMesh;
109   TopoDS_Shape                   myGeomShape; // shape whose sub-shapes are selected
110   TopoDS_Shape                   myMainShape; // main shape of the mesh
111   std::string                    myEntry;
112   std::string                    myMainEntry;
113   vtkRenderer*                   myRenderer;
114   
115   QListWidget*                   myListWidget;
116   QPushButton*                   myAddButton;
117   QPushButton*                   myRemoveButton;
118   QLabel*                        myInfoLabel;
119   QPushButton*                   myPrevButton;
120   QPushButton*                   myNextButton;
121   QList<int>                     mySelectedIDs;
122   QList<int>                     myListOfIDs;
123   
124   QString                        myParamValue;
125   bool                           myIsShown;
126   bool                           myIsNotCorrected;
127
128   // for manage possible size of myListOfIDs
129   int                            myMaxSize;
130   // for manage type of selected subshape
131   TopAbs_ShapeEnum               mySubShType;
132   
133   SMESH_PreviewActorsCollection* myPreviewActor;
134   QList<SUIT_SelectionFilter*>   myGeomFilters;
135   SUIT_SelectionFilter*          myFilter;
136 };
137
138 #endif // STDMESHERSGUI_SUBSHAPESELECTORWDG_H