From b5b677e66cf305f88ef6099cfb630d6f75968600 Mon Sep 17 00:00:00 2001 From: dmv Date: Fri, 26 Jun 2009 12:10:16 +0000 Subject: [PATCH] Issue 0019928: EDF 771 SMESH : Extrusion (Revolution) with normal to a face Additional modifications --- src/SMESHGUI/SMESHGUI_RevolutionDlg.cxx | 61 ++++++++++++------------- src/SMESHGUI/SMESHGUI_RevolutionDlg.h | 7 ++- 2 files changed, 36 insertions(+), 32 deletions(-) diff --git a/src/SMESHGUI/SMESHGUI_RevolutionDlg.cxx b/src/SMESHGUI/SMESHGUI_RevolutionDlg.cxx index dd3f2af30..e9e7fef05 100644 --- a/src/SMESHGUI/SMESHGUI_RevolutionDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_RevolutionDlg.cxx @@ -93,7 +93,8 @@ SMESHGUI_RevolutionDlg::SMESHGUI_RevolutionDlg( SMESHGUI* theModule ) mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ), myVectorDefinition(NONE_SELECT), myFilterDlg( 0 ), - mySelectedObject(SMESH::SMESH_IDSource::_nil()) + mySelectedObject(SMESH::SMESH_IDSource::_nil()), + myActor(0) { mySimulation = new SMESHGUI_MeshEditPreview(SMESH::GetViewWindow( mySMESHGUI )); @@ -548,6 +549,7 @@ bool SMESHGUI_RevolutionDlg::ClickOnApply() } SMESH::UpdateView(); + SMESH::Update(myIO, SMESH::eDisplay); if ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() ) mySMESHGUI->updateObjBrowser(true); // new groups may appear Init(false); @@ -575,19 +577,14 @@ void SMESHGUI_RevolutionDlg::ClickOnOk() //================================================================================= void SMESHGUI_RevolutionDlg::ClickOnCancel() { - disconnect(mySelectionMgr, 0, this, 0); - mySelectionMgr->clearFilters(); - //mySelectionMgr->clearSelected(); - if (SMESH::GetCurrentVtkView()) { - SMESH::RemoveFilters(); // PAL6938 -- clean all mesh entity filters - SMESH::SetPointRepresentation(false); - } - if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) - aViewWindow->SetSelectionMode(ActorSelection); - mySMESHGUI->ResetState(); reject(); } +void SMESHGUI_RevolutionDlg::reject() +{ + close(); +} + //================================================================================= // function : ClickOnHelp() // purpose : @@ -688,7 +685,6 @@ void SMESHGUI_RevolutionDlg::SelectionIntoArgument() if (myBusy) return; // clear - myActor = 0; QString aString = ""; myBusy = true; @@ -711,20 +707,23 @@ void SMESHGUI_RevolutionDlg::SelectionIntoArgument() return; Handle(SALOME_InteractiveObject) IO = aList.First(); - myMesh = SMESH::GetMeshByIO(IO); - if (myMesh->_is_nil()) + SMESH::SMESH_Mesh_var aMeshVar = SMESH::GetMeshByIO(IO); + if (aMeshVar->_is_nil()) return; - myActor = SMESH::FindActorByObject(myMesh); - if (!myActor) - myActor = SMESH::FindActorByEntry(IO->getEntry()); - if (!myActor) + SMESH_Actor* anActor = SMESH::FindActorByObject(aMeshVar); + if (!anActor) + anActor = SMESH::FindActorByEntry(IO->getEntry()); + if (!anActor) return; int aNbUnits = 0; if (myEditCurrentArgument == (QWidget*)LineEditElements) { myElementsId = ""; + myMesh = aMeshVar; + myActor = anActor; + myIO = IO; // MakeGroups is available if there are groups if ( myMesh->NbGroups() == 0 ) { @@ -750,7 +749,7 @@ void SMESHGUI_RevolutionDlg::SelectionIntoArgument() myNbOkElements = true; } else { - SMDS_Mesh* aMesh = myActor->GetObject()->GetMesh(); + SMDS_Mesh* aMesh = anActor->GetObject()->GetMesh(); if (!aMesh) return; @@ -839,7 +838,6 @@ void SMESHGUI_RevolutionDlg::SetEditCurrentArgument() mySelectionMgr->installFilter(myMeshOrSubMeshOrGroupFilter); } else { int aConstructorId = GetConstructorId(); - myEditCurrentArgument = (QWidget*)SpinBox_X; if (aConstructorId == 0) { if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) @@ -913,17 +911,16 @@ void SMESHGUI_RevolutionDlg::enterEvent (QEvent*) void SMESHGUI_RevolutionDlg::closeEvent (QCloseEvent*) { /* same than click on cancel button */ - ClickOnCancel(); -} - -//======================================================================= -// function : hideEvent() -// purpose : caused by ESC key -//======================================================================= -void SMESHGUI_RevolutionDlg::hideEvent (QHideEvent*) -{ - if (!isMinimized()) - ClickOnCancel(); + disconnect(mySelectionMgr, 0, this, 0); + mySelectionMgr->clearFilters(); + //mySelectionMgr->clearSelected(); + if (SMESH::GetCurrentVtkView()) { + SMESH::RemoveFilters(); // PAL6938 -- clean all mesh entity filters + SMESH::SetPointRepresentation(false); + } + if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) + aViewWindow->SetSelectionMode(ActorSelection); + mySMESHGUI->ResetState(); } //======================================================================= @@ -1127,6 +1124,8 @@ void SMESHGUI_RevolutionDlg::onSelectVectorMenu( QAction* action){ if(!action) return; + disconnect(mySelectionMgr, 0, this, 0); + switch(myMenuActions[action]) { case POINT_SELECT: SMESH::SetPointRepresentation(true); diff --git a/src/SMESHGUI/SMESHGUI_RevolutionDlg.h b/src/SMESHGUI/SMESHGUI_RevolutionDlg.h index f21974975..4d0c51693 100644 --- a/src/SMESHGUI/SMESHGUI_RevolutionDlg.h +++ b/src/SMESHGUI/SMESHGUI_RevolutionDlg.h @@ -29,6 +29,9 @@ // SMESH includes #include "SMESH_SMESHGUI.hxx" +// SALOME GUI includes +#include + // Qt includes #include #include @@ -70,13 +73,14 @@ public: SMESHGUI_RevolutionDlg( SMESHGUI* ); ~SMESHGUI_RevolutionDlg(); + void reject(); + private: enum {NONE_SELECT, POINT_SELECT, FACE_SELECT}; void Init( bool = true); void closeEvent( QCloseEvent* ); void enterEvent( QEvent* ); /* mouse enter the QWidget */ - void hideEvent( QHideEvent* ); /* ESC key */ void keyPressEvent( QKeyEvent* ); int GetConstructorId(); bool IsAxisOk(); @@ -90,6 +94,7 @@ private: QString myElementsId; QWidget* myEditCurrentArgument; /* Current argument */ SVTK_Selector* mySelector; + Handle(SALOME_InteractiveObject) myIO; SMESH::SMESH_IDSource_var mySelectedObject; -- 2.39.2