diff --git a/src/StdMeshersGUI/StdMeshersGUI_SubShapeSelectorWdg.cxx b/src/StdMeshersGUI/StdMeshersGUI_SubShapeSelectorWdg.cxx index 9a8e3827c..a51d6a16d 100644 --- a/src/StdMeshersGUI/StdMeshersGUI_SubShapeSelectorWdg.cxx +++ b/src/StdMeshersGUI/StdMeshersGUI_SubShapeSelectorWdg.cxx @@ -50,7 +50,7 @@ // GEOM Includes #include -#include +#include #include // Qt includes @@ -82,7 +82,7 @@ //================================================================================ StdMeshersGUI_SubShapeSelectorWdg -::StdMeshersGUI_SubShapeSelectorWdg( QWidget * parent ): +::StdMeshersGUI_SubShapeSelectorWdg( QWidget * parent, TopAbs_ShapeEnum aSubShType ): QWidget( parent ), myPreviewActor( 0 ), myMaxSize( -1 ) @@ -108,7 +108,7 @@ StdMeshersGUI_SubShapeSelectorWdg setLayout( edgesLayout ); setMinimumWidth( 300 ); - mySubShType = TopAbs_EDGE; + mySubShType = aSubShType; init(); } @@ -166,15 +166,8 @@ void StdMeshersGUI_SubShapeSelectorWdg::init() if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) aViewWindow->SetSelectionMode( ActorSelection ); - - SalomeApp_Study* study = mySMESHGUI->activeStudy(); - GEOM_EdgeFilter* edgeFilter = new GEOM_EdgeFilter(study,StdSelect_AnyEdge); - GEOM_CompoundFilter* gpoupFilter = new GEOM_CompoundFilter(study); - gpoupFilter->addSubType( TopAbs_EDGE ); - myGeomFilters.append( edgeFilter ); - myGeomFilters.append( gpoupFilter ); - myFilter = new SMESH_LogicalFilter( myGeomFilters, SMESH_LogicalFilter::LO_OR ); - mySelectionMgr->installFilter( myFilter ); + myFilter=0; + //setFilter(); connect( myAddButton, SIGNAL(clicked()), SLOT(onAdd())); connect( myRemoveButton, SIGNAL(clicked()), SLOT(onRemove())); @@ -185,6 +178,24 @@ void StdMeshersGUI_SubShapeSelectorWdg::init() updateState(); } +//================================================================================ +/*! + * \brief Install filters to select sub-shapes of mySubShType or their groups + */ +//================================================================================ + +void StdMeshersGUI_SubShapeSelectorWdg::setFilter() +{ + SalomeApp_Study* study = mySMESHGUI->activeStudy(); + GEOM_TypeFilter* typeFilter = new GEOM_TypeFilter(study, mySubShType, /*isShapeType=*/true ); + GEOM_CompoundFilter* gpoupFilter = new GEOM_CompoundFilter(study); + gpoupFilter->addSubType( mySubShType ); + myGeomFilters.append( typeFilter ); + myGeomFilters.append( gpoupFilter ); + myFilter = new SMESH_LogicalFilter( myGeomFilters, SMESH_LogicalFilter::LO_OR ); + mySelectionMgr->installFilter( myFilter ); +} + //================================================================================ /*! * Create a layout, initialize fields @@ -371,7 +382,7 @@ void StdMeshersGUI_SubShapeSelectorWdg::onListSelectionChanged() //================================================================================= // function : setGeomShape -// purpose : Called to set geometry +// purpose : Called to set geometry whose sub-shapes are selected //================================================================================ void StdMeshersGUI_SubShapeSelectorWdg::SetGeomShapeEntry( const QString& theEntry ) { @@ -484,7 +495,7 @@ void StdMeshersGUI_SubShapeSelectorWdg::SetListOfIDs( SMESH::long_array_var theI //================================================================================= // function : SetMainShapeEntry -// purpose : Called to set the Main Object Entry +// purpose : Called to set the Entry of main shape of the mesh //================================================================================= void StdMeshersGUI_SubShapeSelectorWdg::SetMainShapeEntry( const QString& theEntry ) { diff --git a/src/StdMeshersGUI/StdMeshersGUI_SubShapeSelectorWdg.h b/src/StdMeshersGUI/StdMeshersGUI_SubShapeSelectorWdg.h index 591d28b6f..e18f32e08 100644 --- a/src/StdMeshersGUI/StdMeshersGUI_SubShapeSelectorWdg.h +++ b/src/StdMeshersGUI/StdMeshersGUI_SubShapeSelectorWdg.h @@ -52,7 +52,8 @@ class STDMESHERSGUI_EXPORT StdMeshersGUI_SubShapeSelectorWdg : public QWidget Q_OBJECT public: - StdMeshersGUI_SubShapeSelectorWdg( QWidget* parent = 0 ); + StdMeshersGUI_SubShapeSelectorWdg( QWidget* parent = 0, + TopAbs_ShapeEnum aSubShType = TopAbs_EDGE ); ~StdMeshersGUI_SubShapeSelectorWdg(); SMESH::long_array_var GetListOfIDs(); @@ -79,10 +80,11 @@ public: int GetListSize() { return myListOfIDs.size(); } void SetMaxSize(int aMaxSize) { myMaxSize = aMaxSize; } - void SetSubShType(TopAbs_ShapeEnum aSubShType) { mySubShType = aSubShType; } + //void SetSubShType(TopAbs_ShapeEnum aSubShType) { mySubShType = aSubShType; } private: void updateState(); + void setFilter(); private slots: void onAdd(); @@ -98,8 +100,8 @@ private: LightApp_SelectionMgr* mySelectionMgr; /* User shape selection */ SVTK_Selector* mySelector; SMESH::SMESH_Mesh_var myMesh; - TopoDS_Shape myGeomShape; - TopoDS_Shape myMainShape; + TopoDS_Shape myGeomShape; // shape whose sub-shapes are selected + TopoDS_Shape myMainShape; // main shape of the mesh QString myEntry; QString myMainEntry; vtkRenderer* myRenderer;