Salome HOME
Merge from V5_1_main 14/05/2010
[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
49 class STDMESHERSGUI_EXPORT StdMeshersGUI_SubShapeSelectorWdg : public QWidget
50 {
51   Q_OBJECT
52
53 public:
54   StdMeshersGUI_SubShapeSelectorWdg( QWidget* parent = 0 );
55   ~StdMeshersGUI_SubShapeSelectorWdg();
56
57   SMESH::long_array_var          GetListOfIDs();
58   void                           SetListOfIDs( SMESH::long_array_var );
59
60   void                           SetGeomShapeEntry( const QString& theEntry );
61   const char*                    GetGeomShapeEntry() { return myEntry.toLatin1().data();}
62
63   void                           SetMainShapeEntry( const QString& theEntry );
64   const char*                    GetMainShapeEntry();
65
66   TopoDS_Shape                   GetGeomShape() { return myGeomShape; }
67   TopoDS_Shape                   GetMainShape() { return myMainShape; }
68
69   QList<int>                     GetCorrectedListOfIDs( bool fromSubshapeToMainshape = true );
70
71   static GEOM::GEOM_Object_var   GetGeomObjectByEntry( const QString& );
72   static TopoDS_Shape            GetTopoDSByEntry( const QString& );
73
74   QString                        GetValue() const { return myParamValue; }
75
76   void                           showPreview ( bool );
77
78   int                            GetListSize() { return myListOfIDs.size(); }
79
80   void SetMaxSize(int aMaxSize) { myMaxSize = aMaxSize; }
81   void SetSubShType(TopAbs_ShapeEnum aSubShType) { mySubShType = aSubShType; }
82
83 private:
84   void                           updateState();
85
86 private slots:
87   void                           onAdd(); 
88   void                           onRemove(); 
89   void                           SelectionIntoArgument();
90   void                           onListSelectionChanged();
91
92 private:
93   void                           init();
94
95 private:
96   SMESHGUI*                      mySMESHGUI;
97   LightApp_SelectionMgr*         mySelectionMgr;          /* User shape selection */
98   SVTK_Selector*                 mySelector;
99   SMESH::SMESH_Mesh_var          myMesh;
100   TopoDS_Shape                   myGeomShape;
101   TopoDS_Shape                   myMainShape;
102   QString                        myEntry;
103   QString                        myMainEntry;
104   vtkRenderer*                   myRenderer;
105   
106   QListWidget*                   myListWidget;
107   QPushButton*                   myAddButton;
108   QPushButton*                   myRemoveButton;
109   QList<int>                     mySelectedIDs;
110   QList<int>                     myListOfIDs;
111   
112   QString                        myParamValue;
113   bool                           myIsShown;
114   bool                           myIsNotCorrected;
115
116   // for manage possible size of myListOfIDs
117   int                            myMaxSize;
118   // for manage type of selected subshape
119   TopAbs_ShapeEnum               mySubShType;
120   
121   SMESH_PreviewActorsCollection* myPreviewActor;
122 };
123
124 #endif // STDMESHERSGUI_SUBSHAPESELECTORWDG_H