00001 // Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE 00002 // 00003 // This library is free software; you can redistribute it and/or 00004 // modify it under the terms of the GNU Lesser General Public 00005 // License as published by the Free Software Foundation; either 00006 // version 2.1 of the License. 00007 // 00008 // This library is distributed in the hope that it will be useful, 00009 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00010 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00011 // Lesser General Public License for more details. 00012 // 00013 // You should have received a copy of the GNU Lesser General Public 00014 // License along with this library; if not, write to the Free Software 00015 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00016 // 00017 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com 00018 // 00019 00020 // File : StdMeshersGUI_SubShapeSelectorWdg.h 00021 // Author : Open CASCADE S.A.S. (dmv) 00022 // 00023 #ifndef STDMESHERSGUI_SUBSHAPESELECTORWDG_H 00024 #define STDMESHERSGUI_SUBSHAPESELECTORWDG_H 00025 00026 // SMESH includes 00027 #include <SMESHGUI.h> 00028 #include "SMESH_StdMeshersGUI.hxx" 00029 #include "SMESH_SMESHGUI.hxx" 00030 00031 // Qt includes 00032 #include <QWidget> 00033 #include <QStringList> 00034 #include <TopoDS_Shape.hxx> 00035 00036 #include <SMESHGUI_VTKUtils.h> 00037 00038 class SMESHGUI; 00039 class LightApp_SelectionMgr; 00040 class SVTK_Selector; 00041 class QPushButton; 00042 class QLineEdit; 00043 class QCheckBox; 00044 class QListWidget; 00045 class SMESH_Actor; 00046 class SMESH_PreviewActorsCollection; 00047 class vtkRenderer; 00048 class SUIT_SelectionFilter; 00049 00050 class STDMESHERSGUI_EXPORT StdMeshersGUI_SubShapeSelectorWdg : public QWidget 00051 { 00052 Q_OBJECT 00053 00054 public: 00055 StdMeshersGUI_SubShapeSelectorWdg( QWidget* parent = 0, 00056 TopAbs_ShapeEnum aSubShType = TopAbs_EDGE ); 00057 ~StdMeshersGUI_SubShapeSelectorWdg(); 00058 00059 SMESH::long_array_var GetListOfIDs(); 00060 void SetListOfIDs( SMESH::long_array_var ); 00061 00062 void SetGeomShapeEntry( const QString& theEntry ); 00063 const char* GetGeomShapeEntry() { return myEntry.toLatin1().data();} 00064 00065 void SetMainShapeEntry( const QString& theEntry ); 00066 const char* GetMainShapeEntry(); 00067 00068 TopoDS_Shape GetGeomShape() { return myGeomShape; } 00069 TopoDS_Shape GetMainShape() { return myMainShape; } 00070 00071 QList<int> GetCorrectedListOfIDs( bool fromSubshapeToMainshape = true ); 00072 00073 static GEOM::GEOM_Object_var GetGeomObjectByEntry( const QString& ); 00074 static TopoDS_Shape GetTopoDSByEntry( const QString& ); 00075 00076 QString GetValue() const { return myParamValue; } 00077 00078 void showPreview ( bool ); 00079 00080 int GetListSize() { return myListOfIDs.size(); } 00081 00082 void SetMaxSize(int aMaxSize) { myMaxSize = aMaxSize; } 00083 //void SetSubShType(TopAbs_ShapeEnum aSubShType) { mySubShType = aSubShType; } 00084 00085 private: 00086 void updateState(); 00087 void setFilter(); 00088 00089 private slots: 00090 void onAdd(); 00091 void onRemove(); 00092 void SelectionIntoArgument(); 00093 void onListSelectionChanged(); 00094 00095 private: 00096 void init(); 00097 00098 private: 00099 SMESHGUI* mySMESHGUI; 00100 LightApp_SelectionMgr* mySelectionMgr; /* User shape selection */ 00101 SVTK_Selector* mySelector; 00102 SMESH::SMESH_Mesh_var myMesh; 00103 TopoDS_Shape myGeomShape; // shape whose sub-shapes are selected 00104 TopoDS_Shape myMainShape; // main shape of the mesh 00105 QString myEntry; 00106 QString myMainEntry; 00107 vtkRenderer* myRenderer; 00108 00109 QListWidget* myListWidget; 00110 QPushButton* myAddButton; 00111 QPushButton* myRemoveButton; 00112 QList<int> mySelectedIDs; 00113 QList<int> myListOfIDs; 00114 00115 QString myParamValue; 00116 bool myIsShown; 00117 bool myIsNotCorrected; 00118 00119 // for manage possible size of myListOfIDs 00120 int myMaxSize; 00121 // for manage type of selected subshape 00122 TopAbs_ShapeEnum mySubShType; 00123 00124 SMESH_PreviewActorsCollection* myPreviewActor; 00125 QList<SUIT_SelectionFilter*> myGeomFilters; 00126 SUIT_SelectionFilter* myFilter; 00127 }; 00128 00129 #endif // STDMESHERSGUI_SUBSHAPESELECTORWDG_H