0020832: EDF 1359 SMESH : Automatic meshing of boundary layers

-  StdMeshersGUI_SubShapeSelectorWdg( QWidget* parent = 0 );
+  StdMeshersGUI_SubShapeSelectorWdg( QWidget* parent = 0,
+                                     TopAbs_ShapeEnum aSubShType = TopAbs_EDGE );

+  void                           setFilter();
This commit is contained in:
eap 2011-01-18 12:20:13 +00:00
parent b01dba1ff2
commit b0cd839dd0
2 changed files with 31 additions and 18 deletions

View File

@ -50,7 +50,7 @@
// GEOM Includes // GEOM Includes
#include <GEOMBase.h> #include <GEOMBase.h>
#include <GEOM_EdgeFilter.h> #include <GEOM_TypeFilter.h>
#include <GEOM_CompoundFilter.h> #include <GEOM_CompoundFilter.h>
// Qt includes // Qt includes
@ -82,7 +82,7 @@
//================================================================================ //================================================================================
StdMeshersGUI_SubShapeSelectorWdg StdMeshersGUI_SubShapeSelectorWdg
::StdMeshersGUI_SubShapeSelectorWdg( QWidget * parent ): ::StdMeshersGUI_SubShapeSelectorWdg( QWidget * parent, TopAbs_ShapeEnum aSubShType ):
QWidget( parent ), QWidget( parent ),
myPreviewActor( 0 ), myPreviewActor( 0 ),
myMaxSize( -1 ) myMaxSize( -1 )
@ -108,7 +108,7 @@ StdMeshersGUI_SubShapeSelectorWdg
setLayout( edgesLayout ); setLayout( edgesLayout );
setMinimumWidth( 300 ); setMinimumWidth( 300 );
mySubShType = TopAbs_EDGE; mySubShType = aSubShType;
init(); init();
} }
@ -166,15 +166,8 @@ void StdMeshersGUI_SubShapeSelectorWdg::init()
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
aViewWindow->SetSelectionMode( ActorSelection ); aViewWindow->SetSelectionMode( ActorSelection );
myFilter=0;
SalomeApp_Study* study = mySMESHGUI->activeStudy(); //setFilter();
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 );
connect( myAddButton, SIGNAL(clicked()), SLOT(onAdd())); connect( myAddButton, SIGNAL(clicked()), SLOT(onAdd()));
connect( myRemoveButton, SIGNAL(clicked()), SLOT(onRemove())); connect( myRemoveButton, SIGNAL(clicked()), SLOT(onRemove()));
@ -185,6 +178,24 @@ void StdMeshersGUI_SubShapeSelectorWdg::init()
updateState(); 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 * Create a layout, initialize fields
@ -371,7 +382,7 @@ void StdMeshersGUI_SubShapeSelectorWdg::onListSelectionChanged()
//================================================================================= //=================================================================================
// function : setGeomShape // function : setGeomShape
// purpose : Called to set geometry // purpose : Called to set geometry whose sub-shapes are selected
//================================================================================ //================================================================================
void StdMeshersGUI_SubShapeSelectorWdg::SetGeomShapeEntry( const QString& theEntry ) void StdMeshersGUI_SubShapeSelectorWdg::SetGeomShapeEntry( const QString& theEntry )
{ {
@ -484,7 +495,7 @@ void StdMeshersGUI_SubShapeSelectorWdg::SetListOfIDs( SMESH::long_array_var theI
//================================================================================= //=================================================================================
// function : SetMainShapeEntry // 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 ) void StdMeshersGUI_SubShapeSelectorWdg::SetMainShapeEntry( const QString& theEntry )
{ {

View File

@ -52,7 +52,8 @@ class STDMESHERSGUI_EXPORT StdMeshersGUI_SubShapeSelectorWdg : public QWidget
Q_OBJECT Q_OBJECT
public: public:
StdMeshersGUI_SubShapeSelectorWdg( QWidget* parent = 0 ); StdMeshersGUI_SubShapeSelectorWdg( QWidget* parent = 0,
TopAbs_ShapeEnum aSubShType = TopAbs_EDGE );
~StdMeshersGUI_SubShapeSelectorWdg(); ~StdMeshersGUI_SubShapeSelectorWdg();
SMESH::long_array_var GetListOfIDs(); SMESH::long_array_var GetListOfIDs();
@ -79,10 +80,11 @@ public:
int GetListSize() { return myListOfIDs.size(); } int GetListSize() { return myListOfIDs.size(); }
void SetMaxSize(int aMaxSize) { myMaxSize = aMaxSize; } void SetMaxSize(int aMaxSize) { myMaxSize = aMaxSize; }
void SetSubShType(TopAbs_ShapeEnum aSubShType) { mySubShType = aSubShType; } //void SetSubShType(TopAbs_ShapeEnum aSubShType) { mySubShType = aSubShType; }
private: private:
void updateState(); void updateState();
void setFilter();
private slots: private slots:
void onAdd(); void onAdd();
@ -98,8 +100,8 @@ private:
LightApp_SelectionMgr* mySelectionMgr; /* User shape selection */ LightApp_SelectionMgr* mySelectionMgr; /* User shape selection */
SVTK_Selector* mySelector; SVTK_Selector* mySelector;
SMESH::SMESH_Mesh_var myMesh; SMESH::SMESH_Mesh_var myMesh;
TopoDS_Shape myGeomShape; TopoDS_Shape myGeomShape; // shape whose sub-shapes are selected
TopoDS_Shape myMainShape; TopoDS_Shape myMainShape; // main shape of the mesh
QString myEntry; QString myEntry;
QString myMainEntry; QString myMainEntry;
vtkRenderer* myRenderer; vtkRenderer* myRenderer;