From 733a71000ed51149e1f9c58b220f2eb0fb84cdd8 Mon Sep 17 00:00:00 2001 From: eap Date: Tue, 21 Aug 2012 15:26:19 +0000 Subject: [PATCH] 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 --- src/SMESHGUI/SMESHGUI_ExtrusionDlg.cxx | 86 ++++++++++++++++---------- src/SMESHGUI/SMESHGUI_ExtrusionDlg.h | 4 +- 2 files changed, 58 insertions(+), 32 deletions(-) diff --git a/src/SMESHGUI/SMESHGUI_ExtrusionDlg.cxx b/src/SMESHGUI/SMESHGUI_ExtrusionDlg.cxx index c75af4f45..fa367fd51 100644 --- a/src/SMESHGUI/SMESHGUI_ExtrusionDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_ExtrusionDlg.cxx @@ -280,15 +280,22 @@ SMESHGUI_ExtrusionDlg::SMESHGUI_ExtrusionDlg (SMESHGUI* theModule) mySMESHGUI->SetActiveDialogBox(this); // 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 aListOfFilters; - if (aMeshOrSubMeshFilter) aListOfFilters.append(aMeshOrSubMeshFilter); - if (aSmeshGroupFilter) aListOfFilters.append(aSmeshGroupFilter); - - myMeshOrSubMeshOrGroupFilter = - new SMESH_LogicalFilter (aListOfFilters, SMESH_LogicalFilter::LO_OR); + aListOfFilters.append(new SMESH_TypeFilter (MESH)); + aListOfFilters.append(new SMESH_TypeFilter (SUBMESH_VERTEX)); + aListOfFilters.append(new SMESH_TypeFilter (GROUP_NODE)); + myMeshOrSubMeshOrGroupFilter0D = + 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"; @@ -351,6 +358,9 @@ SMESHGUI_ExtrusionDlg::~SMESHGUI_ExtrusionDlg() myFilterDlg->setParent( 0 ); 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) { myEditCurrentArgument = (QWidget*)LineEditElements; - if (CheckBoxMesh->isChecked()) { + if (CheckBoxMesh->isChecked()) + { if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) aViewWindow->SetSelectionMode(ActorSelection); - mySelectionMgr->installFilter(myMeshOrSubMeshOrGroupFilter); - } else { + switch( GetConstructorId() ) { + case 0: mySelectionMgr->installFilter(myMeshOrSubMeshOrGroupFilter0D); break; + case 1: mySelectionMgr->installFilter(myMeshOrSubMeshOrGroupFilter1D); break; + case 2: mySelectionMgr->installFilter(myMeshOrSubMeshOrGroupFilter2D); break; + } + } + else + { int aConstructorId = GetConstructorId(); switch(aConstructorId) { - case 0: - { - if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) - aViewWindow->SetSelectionMode(NodeSelection); - break; - } - case 1: - { - if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) - aViewWindow->SetSelectionMode(EdgeSelection); - break; - } - case 2: - { - if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) + case 0: + { + if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) + aViewWindow->SetSelectionMode(NodeSelection); + break; + } + case 1: + { + if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) + aViewWindow->SetSelectionMode(EdgeSelection); + break; + } + case 2: + { + if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) aViewWindow->SetSelectionMode(FaceSelection); - break; - } + break; + } } } } @@ -1028,13 +1045,20 @@ void SMESHGUI_ExtrusionDlg::onSelectMesh (bool toSelectMesh) mySelectionMgr->clearFilters(); - if (toSelectMesh) { + if (toSelectMesh) + { if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) 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->setValidator(0); - } else { + } + else + { int aConstructorId = GetConstructorId(); switch(aConstructorId) { case 0: diff --git a/src/SMESHGUI/SMESHGUI_ExtrusionDlg.h b/src/SMESHGUI/SMESHGUI_ExtrusionDlg.h index dd0b741a0..330951397 100644 --- a/src/SMESHGUI/SMESHGUI_ExtrusionDlg.h +++ b/src/SMESHGUI/SMESHGUI_ExtrusionDlg.h @@ -94,7 +94,9 @@ private: SMESH::long_array_var myElementsId; SMESH_Actor* myActor; Handle(SALOME_InteractiveObject) myIO; - SUIT_SelectionFilter* myMeshOrSubMeshOrGroupFilter; + SUIT_SelectionFilter* myMeshOrSubMeshOrGroupFilter0D; + SUIT_SelectionFilter* myMeshOrSubMeshOrGroupFilter1D; + SUIT_SelectionFilter* myMeshOrSubMeshOrGroupFilter2D; // widgets QGroupBox* ConstructorsBox; -- 2.39.2