From c23d4596799c724bd08026c80c0be1e1dcbf503c Mon Sep 17 00:00:00 2001 From: asl Date: Mon, 10 Dec 2007 07:47:59 +0000 Subject: [PATCH] PAL17644: automatic actor's entity mode --- src/SMESHGUI/SMESHGUI_GroupDlg.cxx | 40 +++++++++++++++++++++++++++--- src/SMESHGUI/SMESHGUI_GroupDlg.h | 2 ++ 2 files changed, 38 insertions(+), 4 deletions(-) diff --git a/src/SMESHGUI/SMESHGUI_GroupDlg.cxx b/src/SMESHGUI/SMESHGUI_GroupDlg.cxx index 3a575049c..8bab9ee23 100644 --- a/src/SMESHGUI/SMESHGUI_GroupDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_GroupDlg.cxx @@ -104,7 +104,8 @@ SMESHGUI_GroupDlg::SMESHGUI_GroupDlg( SMESHGUI* theModule, const char* name, mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ), mySelector(SMESH::GetViewWindow( theModule )->GetSelector()), myIsBusy( false ), - myActor( 0 ) + myActor( 0 ), + myOldActorMode( -1 ) { if (!name) setName("SMESHGUI_GroupDlg"); initDialog(true); @@ -491,6 +492,7 @@ void SMESHGUI_GroupDlg::init (SMESH::SMESH_Mesh_ptr theMesh) myActor = SMESH::FindActorByObject(myMesh); SMESH::SetPickable(myActor); + storeMode(); SALOME_ListIO aList; mySelectionMgr->selectedObjects( aList ); @@ -540,7 +542,8 @@ void SMESHGUI_GroupDlg::init (SMESH::SMESH_GroupBase_ptr theGroup) if ( !myActor ) myActor = SMESH::FindActorByObject(myGroup); SMESH::SetPickable(myActor); - + storeMode(); + myGrpTypeGroup->setButton(0); onGrpTypeChanged(0); @@ -570,6 +573,7 @@ void SMESHGUI_GroupDlg::init (SMESH::SMESH_GroupBase_ptr theGroup) if ( !myActor ) myActor = SMESH::FindActorByObject(myGroup); SMESH::SetPickable(myActor); + storeMode(); myGrpTypeGroup->setButton(1); onGrpTypeChanged(1); @@ -638,8 +642,27 @@ void SMESHGUI_GroupDlg::onNbColorsChanged (const QString& text) //================================================================================= void SMESHGUI_GroupDlg::onTypeChanged (int id) { - if (myTypeId != id) { + if (myTypeId != id) + { myElements->clear(); + unsigned int aMode = -1; + switch( id ) + { + case 0://node + aMode = SMESH_Actor::eAllEntity; + break; + case 1://edge + aMode = SMESH_Actor::eEdges; + break; + case 2://face + aMode = SMESH_Actor::eFaces; + break; + case 3://volume + aMode = SMESH_Actor::eVolumes; + break; + } + if( myActor && aMode>=0 ) + myActor->SetEntityMode( aMode ); if (myCurrentLineEdit == 0) setSelectionMode(id); } @@ -1011,6 +1034,7 @@ void SMESHGUI_GroupDlg::onObjectSelectionChanged() myActor = SMESH::FindActorByObject(myMesh); SMESH::SetPickable(myActor); + storeMode(); aString = aList.First()->getName(); myMeshGroupLine->setText(aString) ; @@ -1185,6 +1209,7 @@ void SMESHGUI_GroupDlg::onObjectSelectionChanged() myActor = SMESH::FindActorByObject(myGroupOnGeom); else myActor = SMESH::FindActorByObject(myMesh); + storeMode(); } myIsBusy = false; @@ -1695,7 +1720,8 @@ void SMESHGUI_GroupDlg::onClose() aViewWindow->SetSelectionMode(ActorSelection); mySelectionMgr->clearFilters(); mySMESHGUI->ResetState(); - + if( myActor && myOldActorMode>=0 ) + myActor->SetEntityMode( myOldActorMode ); reject(); } @@ -1894,3 +1920,9 @@ void SMESHGUI_GroupDlg::onCloseShapeByMeshDlg(SUIT_Operation* op) setSelectionMode(7); } } + +void SMESHGUI_GroupDlg::storeMode() +{ + if( myActor ) + myOldActorMode = myActor->GetEntityMode(); +} diff --git a/src/SMESHGUI/SMESHGUI_GroupDlg.h b/src/SMESHGUI/SMESHGUI_GroupDlg.h index 7d39e4248..80e2370b4 100644 --- a/src/SMESHGUI/SMESHGUI_GroupDlg.h +++ b/src/SMESHGUI/SMESHGUI_GroupDlg.h @@ -130,6 +130,7 @@ private: void setSelectionMode(int theMode); void updateButtons(); void updateGeomPopup(); + void storeMode(); SMESHGUI* mySMESHGUI; /* Current SMESHGUI object */ LightApp_SelectionMgr* mySelectionMgr; /* User shape selection */ @@ -190,6 +191,7 @@ private: bool myCreate, myIsBusy; QString myHelpFileName; + int myOldActorMode; }; #endif // DIALOGBOX_GROUP_H -- 2.39.2