Salome HOME
0020082: EDF 869 GEOM : Edges Orientation indicator/reverse
[modules/smesh.git] / src / StdMeshersGUI / StdMeshersGUI_SubShapeSelectorWdg.h
1 //  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 //  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
6 //  This library is free software; you can redistribute it and/or
7 //  modify it under the terms of the GNU Lesser General Public
8 //  License as published by the Free Software Foundation; either
9 //  version 2.1 of the License.
10 //
11 //  This library is distributed in the hope that it will be useful,
12 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
13 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 //  Lesser General Public License for more details.
15 //
16 //  You should have received a copy of the GNU Lesser General Public
17 //  License along with this library; if not, write to the Free Software
18 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
19 //
20 //  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22 // File   : StdMeshersGUI_SubShapeSelectorWdg.h
23 // Author : Open CASCADE S.A.S. (dmv)
24 //
25 #ifndef STDMESHERSGUI_SUBSHAPESELECTORWDG_H
26 #define STDMESHERSGUI_SUBSHAPESELECTORWDG_H
27
28 // SMESH includes
29 #include <SMESHGUI.h>
30 #include "SMESH_StdMeshersGUI.hxx"
31 #include "SMESH_SMESHGUI.hxx"
32
33 // Qt includes
34 #include <QWidget>
35 #include <QStringList>
36 #include <TopoDS_Shape.hxx>
37
38 #include <SMESHGUI_VTKUtils.h>
39
40 class SMESHGUI;
41 class LightApp_SelectionMgr;
42 class SVTK_Selector;
43 class QPushButton;
44 class QLineEdit;
45 class QCheckBox;
46 class QListWidget;
47 class SMESH_Actor;
48 class SMESH_PreviewActorsCollection;
49 class vtkRenderer;
50
51 class STDMESHERSGUI_EXPORT StdMeshersGUI_SubShapeSelectorWdg : public QWidget
52 {
53   Q_OBJECT
54
55 public:
56   StdMeshersGUI_SubShapeSelectorWdg( QWidget* parent = 0 );
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   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