X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=blobdiff_plain;f=src%2FSMESHGUI%2FSMESHGUI_ExtrusionDlg.cxx;h=a950917c714a44abe6bf3f4ae7564c2c1cc3c9af;hp=4860baeef08822edc19346087fbc58336f50cc9d;hb=b0105f0f9d05ef09ad770cf0d343901589cba620;hpb=a2f0f70d5912ea83c868916f06eaefb58a32ec2e diff --git a/src/SMESHGUI/SMESHGUI_ExtrusionDlg.cxx b/src/SMESHGUI/SMESHGUI_ExtrusionDlg.cxx index 4860baeef..a950917c7 100644 --- a/src/SMESHGUI/SMESHGUI_ExtrusionDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_ExtrusionDlg.cxx @@ -88,9 +88,7 @@ SMESHGUI_ExtrusionDlg::SMESHGUI_ExtrusionDlg (SMESHGUI* theModule, : QDialog( SMESH::GetDesktop( theModule ), "SMESHGUI_ExtrusionDlg", modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | Qt::WDestructiveClose), mySMESHGUI( theModule ), - mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ), - myViewWindow( SMESH::GetViewWindow( theModule ) ), - mySelector( myViewWindow->GetSelector() ) + mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ) { QPixmap image0 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_DLG_EDGE"))); QPixmap image1 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_DLG_TRIANGLE"))); @@ -233,6 +231,8 @@ SMESHGUI_ExtrusionDlg::SMESHGUI_ExtrusionDlg (SMESHGUI* theModule, GroupArguments->show(); RadioButton1->setChecked(TRUE); + mySelector = (SMESH::GetViewWindow( mySMESHGUI ))->GetSelector(); + mySMESHGUI->SetActiveDialogBox(this); // Costruction of the logical filter for the elements: mesh/sub-mesh/group @@ -271,6 +271,7 @@ SMESHGUI_ExtrusionDlg::SMESHGUI_ExtrusionDlg (SMESHGUI* theModule, this->show(); // displays Dialog ConstructorsClicked(0); + SelectionIntoArgument(); } //================================================================================= @@ -324,14 +325,20 @@ void SMESHGUI_ExtrusionDlg::ConstructorsClicked (int constructorId) { GroupArguments->setTitle(tr("EXTRUSION_1D")); if (!CheckBoxMesh->isChecked()) - myViewWindow->SetSelectionMode(EdgeSelection); + { + if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) + aViewWindow->SetSelectionMode(EdgeSelection); + } break; } case 1: { GroupArguments->setTitle(tr("EXTRUSION_2D")); if (!CheckBoxMesh->isChecked()) - myViewWindow->SetSelectionMode(FaceSelection); + { + if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) + aViewWindow->SetSelectionMode(FaceSelection); + } break; } } @@ -378,10 +385,10 @@ bool SMESHGUI_ExtrusionDlg::ClickOnApply() } catch (...) { } - mySelectionMgr->clearSelected(); SMESH::UpdateView(); Init(false); ConstructorsClicked(GetConstructorId()); + SelectionIntoArgument(); } return true; } @@ -407,7 +414,8 @@ void SMESHGUI_ExtrusionDlg::ClickOnCancel() mySelectionMgr->clearSelected(); SMESH::SetPickable(); // ??? SMESH::SetPointRepresentation(false); - myViewWindow->SetSelectionMode(ActorSelection); + if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) + aViewWindow->SetSelectionMode(ActorSelection); mySMESHGUI->ResetState(); reject(); } @@ -438,34 +446,20 @@ void SMESHGUI_ExtrusionDlg::onTextChange (const QString& theNewText) aMesh = myActor->GetObject()->GetMesh(); if (aMesh) { - //mySelectionMgr->clearSelected(); - //mySelectionMgr->AddIObject(myActor->getIO()); - SALOME_ListIO aList; - aList.Append(myActor->getIO()); - mySelectionMgr->setSelectedObjects(aList, false); - QStringList aListId = QStringList::split(" ", theNewText, false); if (send == LineEditElements) { const Handle(SALOME_InteractiveObject)& anIO = myActor->getIO(); - TColStd_IndexedMapOfInteger selectedIndices; TColStd_MapOfInteger newIndices; - mySelector->GetIndex(anIO, selectedIndices); for (int i = 0; i < aListId.count(); i++) { const SMDS_MeshElement * e = aMesh->FindElement(aListId[ i ].toInt()); - if (e) { - //if (!mySelectionMgr->IsIndexSelected(myActor->getIO(), e->GetID())) { - if (selectedIndices.Add(e->GetID())) { - //mySelectionMgr->AddOrRemoveIndex(myActor->getIO(), e->GetID(), true); - newIndices.Add(e->GetID()); - } - myNbOkElements++; - } - } - if (newIndices.Extent() > 0) { - mySelector->AddOrRemoveIndex(anIO, newIndices, true); - myViewWindow->highlight( anIO, true, true ); + if (e) + newIndices.Add(e->GetID()); + myNbOkElements++; } + mySelector->AddOrRemoveIndex(anIO, newIndices, false); + if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) + aViewWindow->highlight( anIO, true, true ); myElementsId = theNewText; } } @@ -623,14 +617,21 @@ void SMESHGUI_ExtrusionDlg::SetEditCurrentArgument() if (send == SelectElementsButton) { myEditCurrentArgument = LineEditElements; if (CheckBoxMesh->isChecked()) { - myViewWindow->SetSelectionMode(ActorSelection); + if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) + aViewWindow->SetSelectionMode(ActorSelection); mySelectionMgr->installFilter(myMeshOrSubMeshOrGroupFilter); } else { int aConstructorId = GetConstructorId(); if (aConstructorId == 0) - myViewWindow->SetSelectionMode(EdgeSelection); + { + if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) + aViewWindow->SetSelectionMode(EdgeSelection); + } else if (aConstructorId == 1) - myViewWindow->SetSelectionMode(FaceSelection); + { + if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) + aViewWindow->SetSelectionMode(FaceSelection); + } } } @@ -721,15 +722,22 @@ void SMESHGUI_ExtrusionDlg::onSelectMesh (bool toSelectMesh) mySelectionMgr->clearFilters(); if (toSelectMesh) { - myViewWindow->SetSelectionMode(ActorSelection); + if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) + aViewWindow->SetSelectionMode(ActorSelection); mySelectionMgr->installFilter(myMeshOrSubMeshOrGroupFilter); LineEditElements->setReadOnly(true); } else { int aConstructorId = GetConstructorId(); if (aConstructorId == 0) - myViewWindow->SetSelectionMode(EdgeSelection); + { + if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) + aViewWindow->SetSelectionMode(EdgeSelection); + } else if (aConstructorId == 0) - myViewWindow->SetSelectionMode(FaceSelection); + { + if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) + aViewWindow->SetSelectionMode(FaceSelection); + } LineEditElements->setReadOnly(false); onTextChange(LineEditElements->text());