X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=blobdiff_plain;f=src%2FSMESHGUI%2FSMESHGUI_ExtrusionDlg.cxx;h=5dba32360f703511d8bb65eb19559ffd724f2acf;hp=c75af4f45bfd259a32b7b205f1a5f5d02ef2a2ce;hb=ea8a0289f14641c23d515de68aa4fdc24a6208ba;hpb=bd4e115a78b52e3fbc016e5e30bb0e19b2a9e7d6 diff --git a/src/SMESHGUI/SMESHGUI_ExtrusionDlg.cxx b/src/SMESHGUI/SMESHGUI_ExtrusionDlg.cxx index c75af4f45..5dba32360 100644 --- a/src/SMESHGUI/SMESHGUI_ExtrusionDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_ExtrusionDlg.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either -// version 2.1 of the License. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -91,6 +91,7 @@ SMESHGUI_ExtrusionDlg::SMESHGUI_ExtrusionDlg (SMESHGUI* theModule) : SMESHGUI_PreviewDlg( theModule ), mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ), + myEditCurrentArgument(0), myFilterDlg( 0 ), mySelectedObject(SMESH::SMESH_IDSource::_nil()) { @@ -280,15 +281,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 (SMESH::MESH)); + aListOfFilters.append(new SMESH_TypeFilter (SMESH::SUBMESH_VERTEX)); + aListOfFilters.append(new SMESH_TypeFilter (SMESH::GROUP_NODE)); + myMeshOrSubMeshOrGroupFilter0D = + new SMESH_LogicalFilter (aListOfFilters, SMESH_LogicalFilter::LO_OR, /*takeOwnership=*/true); + aListOfFilters[0] = new SMESH_TypeFilter (SMESH::MESH); + aListOfFilters[1] = new SMESH_TypeFilter (SMESH::SUBMESH_EDGE); + aListOfFilters[2] = new SMESH_TypeFilter (SMESH::GROUP_EDGE); + myMeshOrSubMeshOrGroupFilter1D = + new SMESH_LogicalFilter (aListOfFilters, SMESH_LogicalFilter::LO_OR, /*takeOwnership=*/true); + aListOfFilters[0] = new SMESH_TypeFilter (SMESH::MESH); + aListOfFilters[1] = new SMESH_TypeFilter (SMESH::SUBMESH_FACE); + aListOfFilters[2] = new SMESH_TypeFilter (SMESH::GROUP_FACE); + myMeshOrSubMeshOrGroupFilter2D = + new SMESH_LogicalFilter (aListOfFilters, SMESH_LogicalFilter::LO_OR, /*takeOwnership=*/true); myHelpFileName = "extrusion_page.html"; @@ -297,7 +305,7 @@ SMESHGUI_ExtrusionDlg::SMESHGUI_ExtrusionDlg (SMESHGUI* theModule) /***************************************************************/ // signals and slots connections connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); - connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel())); + connect(buttonCancel, SIGNAL(clicked()), this, SLOT(reject())); connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); connect(buttonHelp, SIGNAL(clicked()), this, SLOT(ClickOnHelp())); @@ -318,7 +326,7 @@ SMESHGUI_ExtrusionDlg::SMESHGUI_ExtrusionDlg (SMESHGUI* theModule) connect(mySMESHGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog())); connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); /* to close dialog if study change */ - connect(mySMESHGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(ClickOnCancel())); + connect(mySMESHGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(reject())); connect(LineEditElements, SIGNAL(textChanged(const QString&)), SLOT(onTextChange(const QString&))); connect(CheckBoxMesh, SIGNAL(toggled(bool)), SLOT(onSelectMesh(bool))); @@ -351,6 +359,9 @@ SMESHGUI_ExtrusionDlg::~SMESHGUI_ExtrusionDlg() myFilterDlg->setParent( 0 ); delete myFilterDlg; } + if ( myMeshOrSubMeshOrGroupFilter0D ) delete myMeshOrSubMeshOrGroupFilter0D; + if ( myMeshOrSubMeshOrGroupFilter1D ) delete myMeshOrSubMeshOrGroupFilter1D; + if ( myMeshOrSubMeshOrGroupFilter2D ) delete myMeshOrSubMeshOrGroupFilter2D; } //================================================================================= @@ -476,6 +487,9 @@ void SMESHGUI_ExtrusionDlg::ConstructorsClicked (int constructorId) if (CheckBoxMesh->isChecked()) onSelectMesh(true); + myEditCurrentArgument->hide(); + myEditCurrentArgument->show(); + connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); } @@ -653,16 +667,28 @@ bool SMESHGUI_ExtrusionDlg::ClickOnApply() void SMESHGUI_ExtrusionDlg::ClickOnOk() { if (ClickOnApply()) - ClickOnCancel(); + reject(); } //================================================================================= -// function : ClickOnCancel() +// function : reject() // purpose : Called when dialog box is closed //================================================================================= -void SMESHGUI_ExtrusionDlg::ClickOnCancel() +void SMESHGUI_ExtrusionDlg::reject() { - reject(); + disconnect(mySelectionMgr, 0, this, 0); + mySelectionMgr->clearFilters(); + //mySelectionMgr->clearSelected(); + if (SMESH::GetCurrentVtkView()) { + SMESH::RemoveFilters(); // PAL6938 -- clean all mesh entity filters + SMESH::SetPointRepresentation(false); + SMESH::SetPickable(); + } + if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) + aViewWindow->SetSelectionMode(ActorSelection); + mySMESHGUI->ResetState(); + + QDialog::reject(); } //================================================================================= @@ -800,7 +826,7 @@ void SMESHGUI_ExtrusionDlg::SelectionIntoArgument() } // get selected mesh SALOME_ListIO aList; - mySelectionMgr->selectedObjects(aList, SVTK_Viewer::Type()); + mySelectionMgr->selectedObjects(aList); int nbSel = SMESH::GetNameOfSelectedIObjects(mySelectionMgr, aString); if (nbSel != 1) return; @@ -898,31 +924,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; + } } } } @@ -980,32 +1013,6 @@ void SMESHGUI_ExtrusionDlg::enterEvent (QEvent*) ActivateThisDialog(); } -//================================================================================= -// function : closeEvent() -// purpose : -//================================================================================= -void SMESHGUI_ExtrusionDlg::closeEvent( QCloseEvent* ) -{ - /* same than click on cancel button */ - disconnect(mySelectionMgr, 0, this, 0); - mySelectionMgr->clearFilters(); - //mySelectionMgr->clearSelected(); - if (SMESH::GetCurrentVtkView()) { - SMESH::RemoveFilters(); // PAL6938 -- clean all mesh entity filters - SMESH::SetPointRepresentation(false); - SMESH::SetPickable(); - } - if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) - aViewWindow->SetSelectionMode(ActorSelection); - mySMESHGUI->ResetState(); -} - -void SMESHGUI_ExtrusionDlg::reject() -{ - QDialog::reject(); - close(); -} - //================================================================================= // function : onSelectMesh() // purpose : @@ -1028,13 +1035,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: