0021374: EDF 1898 SMESH: Extrusion of a node to have an edge

Set a filter to select groups and sub-meshes corresponding to a constructor id
This commit is contained in:
eap 2012-08-21 15:26:19 +00:00
parent 9767e4ad3e
commit 733a71000e
2 changed files with 58 additions and 32 deletions

View File

@ -280,15 +280,22 @@ SMESHGUI_ExtrusionDlg::SMESHGUI_ExtrusionDlg (SMESHGUI* theModule)
mySMESHGUI->SetActiveDialogBox(this); mySMESHGUI->SetActiveDialogBox(this);
// Costruction of the logical filter for the elements: mesh/sub-mesh/group // Costruction of the logical filter for the elements: mesh/sub-mesh/group
SMESH_TypeFilter* aMeshOrSubMeshFilter = new SMESH_TypeFilter (MESHorSUBMESH);
SMESH_TypeFilter* aSmeshGroupFilter = new SMESH_TypeFilter (GROUP);
QList<SUIT_SelectionFilter*> aListOfFilters; QList<SUIT_SelectionFilter*> aListOfFilters;
if (aMeshOrSubMeshFilter) aListOfFilters.append(aMeshOrSubMeshFilter); aListOfFilters.append(new SMESH_TypeFilter (MESH));
if (aSmeshGroupFilter) aListOfFilters.append(aSmeshGroupFilter); aListOfFilters.append(new SMESH_TypeFilter (SUBMESH_VERTEX));
aListOfFilters.append(new SMESH_TypeFilter (GROUP_NODE));
myMeshOrSubMeshOrGroupFilter = myMeshOrSubMeshOrGroupFilter0D =
new SMESH_LogicalFilter (aListOfFilters, SMESH_LogicalFilter::LO_OR); new SMESH_LogicalFilter (aListOfFilters, SMESH_LogicalFilter::LO_OR, /*takeOwnership=*/true);
aListOfFilters[0] = new SMESH_TypeFilter (MESH);
aListOfFilters[1] = new SMESH_TypeFilter (SUBMESH_EDGE);
aListOfFilters[2] = new SMESH_TypeFilter (GROUP_EDGE);
myMeshOrSubMeshOrGroupFilter1D =
new SMESH_LogicalFilter (aListOfFilters, SMESH_LogicalFilter::LO_OR, /*takeOwnership=*/true);
aListOfFilters[0] = new SMESH_TypeFilter (MESH);
aListOfFilters[1] = new SMESH_TypeFilter (SUBMESH_FACE);
aListOfFilters[2] = new SMESH_TypeFilter (GROUP_FACE);
myMeshOrSubMeshOrGroupFilter2D =
new SMESH_LogicalFilter (aListOfFilters, SMESH_LogicalFilter::LO_OR, /*takeOwnership=*/true);
myHelpFileName = "extrusion_page.html"; myHelpFileName = "extrusion_page.html";
@ -351,6 +358,9 @@ SMESHGUI_ExtrusionDlg::~SMESHGUI_ExtrusionDlg()
myFilterDlg->setParent( 0 ); myFilterDlg->setParent( 0 );
delete myFilterDlg; delete myFilterDlg;
} }
if ( myMeshOrSubMeshOrGroupFilter0D ) delete myMeshOrSubMeshOrGroupFilter0D;
if ( myMeshOrSubMeshOrGroupFilter1D ) delete myMeshOrSubMeshOrGroupFilter1D;
if ( myMeshOrSubMeshOrGroupFilter2D ) delete myMeshOrSubMeshOrGroupFilter2D;
} }
//================================================================================= //=================================================================================
@ -898,31 +908,38 @@ void SMESHGUI_ExtrusionDlg::SetEditCurrentArgument()
if (send == SelectElementsButton) { if (send == SelectElementsButton) {
myEditCurrentArgument = (QWidget*)LineEditElements; myEditCurrentArgument = (QWidget*)LineEditElements;
if (CheckBoxMesh->isChecked()) { if (CheckBoxMesh->isChecked())
{
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
aViewWindow->SetSelectionMode(ActorSelection); aViewWindow->SetSelectionMode(ActorSelection);
mySelectionMgr->installFilter(myMeshOrSubMeshOrGroupFilter); switch( GetConstructorId() ) {
} else { case 0: mySelectionMgr->installFilter(myMeshOrSubMeshOrGroupFilter0D); break;
case 1: mySelectionMgr->installFilter(myMeshOrSubMeshOrGroupFilter1D); break;
case 2: mySelectionMgr->installFilter(myMeshOrSubMeshOrGroupFilter2D); break;
}
}
else
{
int aConstructorId = GetConstructorId(); int aConstructorId = GetConstructorId();
switch(aConstructorId) { switch(aConstructorId) {
case 0: case 0:
{ {
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
aViewWindow->SetSelectionMode(NodeSelection); aViewWindow->SetSelectionMode(NodeSelection);
break; break;
} }
case 1: case 1:
{ {
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
aViewWindow->SetSelectionMode(EdgeSelection); aViewWindow->SetSelectionMode(EdgeSelection);
break; break;
} }
case 2: case 2:
{ {
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
aViewWindow->SetSelectionMode(FaceSelection); aViewWindow->SetSelectionMode(FaceSelection);
break; break;
} }
} }
} }
} }
@ -1028,13 +1045,20 @@ void SMESHGUI_ExtrusionDlg::onSelectMesh (bool toSelectMesh)
mySelectionMgr->clearFilters(); mySelectionMgr->clearFilters();
if (toSelectMesh) { if (toSelectMesh)
{
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
aViewWindow->SetSelectionMode(ActorSelection); aViewWindow->SetSelectionMode(ActorSelection);
mySelectionMgr->installFilter(myMeshOrSubMeshOrGroupFilter); switch( GetConstructorId() ) {
case 0: mySelectionMgr->installFilter(myMeshOrSubMeshOrGroupFilter0D); break;
case 1: mySelectionMgr->installFilter(myMeshOrSubMeshOrGroupFilter1D); break;
case 2: mySelectionMgr->installFilter(myMeshOrSubMeshOrGroupFilter2D); break;
}
LineEditElements->setReadOnly(true); LineEditElements->setReadOnly(true);
LineEditElements->setValidator(0); LineEditElements->setValidator(0);
} else { }
else
{
int aConstructorId = GetConstructorId(); int aConstructorId = GetConstructorId();
switch(aConstructorId) { switch(aConstructorId) {
case 0: case 0:

View File

@ -94,7 +94,9 @@ private:
SMESH::long_array_var myElementsId; SMESH::long_array_var myElementsId;
SMESH_Actor* myActor; SMESH_Actor* myActor;
Handle(SALOME_InteractiveObject) myIO; Handle(SALOME_InteractiveObject) myIO;
SUIT_SelectionFilter* myMeshOrSubMeshOrGroupFilter; SUIT_SelectionFilter* myMeshOrSubMeshOrGroupFilter0D;
SUIT_SelectionFilter* myMeshOrSubMeshOrGroupFilter1D;
SUIT_SelectionFilter* myMeshOrSubMeshOrGroupFilter2D;
// widgets // widgets
QGroupBox* ConstructorsBox; QGroupBox* ConstructorsBox;