X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=blobdiff_plain;f=src%2FSMESHGUI%2FSMESHGUI_SymmetryDlg.cxx;h=61c91d2d3efb7d8a2893d2ada0ea8799545119ad;hp=225586edd324fce3424c8a663d5573e0467c2f17;hb=d89db6381da9e4b1a7827239bd6997b06992a73d;hpb=a2f0f70d5912ea83c868916f06eaefb58a32ec2e diff --git a/src/SMESHGUI/SMESHGUI_SymmetryDlg.cxx b/src/SMESHGUI/SMESHGUI_SymmetryDlg.cxx index 225586edd..61c91d2d3 100644 --- a/src/SMESHGUI/SMESHGUI_SymmetryDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_SymmetryDlg.cxx @@ -82,9 +82,7 @@ SMESHGUI_SymmetryDlg::SMESHGUI_SymmetryDlg( SMESHGUI* theModule, const char* nam : QDialog( SMESH::GetDesktop( theModule ), name, 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_SMESH_SYMMETRY_POINT"))); QPixmap image1 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SMESH_SYMMETRY_AXIS"))); @@ -281,6 +279,8 @@ SMESHGUI_SymmetryDlg::SMESHGUI_SymmetryDlg( SMESHGUI* theModule, const char* nam GroupArguments->show(); RadioButton1->setChecked(TRUE); + mySelector = (SMESH::GetViewWindow( mySMESHGUI ))->GetSelector(); + mySMESHGUI->SetActiveDialogBox((QDialog*)this); // Costruction of the logical filter @@ -324,6 +324,7 @@ SMESHGUI_SymmetryDlg::SMESHGUI_SymmetryDlg( SMESHGUI* theModule, const char* nam this->show(); /* displays Dialog */ ConstructorsClicked(0); + SelectionIntoArgument(); resize(0,0); // ?? } @@ -420,7 +421,10 @@ void SMESHGUI_SymmetryDlg::ConstructorsClicked (int constructorId) if (myEditCurrentArgument != (QWidget*)LineEditElements) { SMESH::SetPointRepresentation(false); if (!CheckBoxMesh->isChecked()) - myViewWindow->SetSelectionMode(CellSelection); + { + if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) + aViewWindow->SetSelectionMode(CellSelection); + } } myEditCurrentArgument = (QWidget*)LineEditElements; @@ -482,10 +486,10 @@ void SMESHGUI_SymmetryDlg::ClickOnApply() } catch (...) { } - mySelectionMgr->clearSelected(); SMESH::UpdateView(); Init(false); ConstructorsClicked(GetConstructorId()); + SelectionIntoArgument(); } } @@ -509,7 +513,8 @@ void SMESHGUI_SymmetryDlg::ClickOnCancel() mySelectionMgr->clearFilters(); mySelectionMgr->clearSelected(); SMESH::SetPointRepresentation(false); - myViewWindow->SetSelectionMode(ActorSelection); + if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) + aViewWindow->SetSelectionMode(ActorSelection); mySMESHGUI->ResetState(); reject(); } @@ -537,36 +542,24 @@ void SMESHGUI_SymmetryDlg::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); + Handle(SALOME_InteractiveObject) anIO = myActor->getIO(); - TColStd_IndexedMapOfInteger selectedIndices; TColStd_MapOfInteger newIndices; - mySelector->GetIndex(myActor->getIO(), selectedIndices); - + QStringList aListId = QStringList::split(" ", theNewText, false); if (send == LineEditElements) { 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( myActor->getIO(), newIndices, true ); - myViewWindow->highlight( myActor->getIO(), 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; } } @@ -734,20 +727,24 @@ void SMESHGUI_SymmetryDlg::SetEditCurrentArgument() myEditCurrentArgument = (QWidget*)LineEditElements; SMESH::SetPointRepresentation(false); if (CheckBoxMesh->isChecked()) { - myViewWindow->SetSelectionMode(ActorSelection); + if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) + aViewWindow->SetSelectionMode(ActorSelection); mySelectionMgr->installFilter(myMeshOrSubMeshOrGroupFilter); } else { - myViewWindow->SetSelectionMode(CellSelection); + if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) + aViewWindow->SetSelectionMode(CellSelection); } } else if (send == SelectPointButton) { myEditCurrentArgument = (QWidget*)SpinBox_X; SMESH::SetPointRepresentation(true); - myViewWindow->SetSelectionMode(NodeSelection); + if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) + aViewWindow->SetSelectionMode(NodeSelection); } else if (send == SelectVectorButton) { myEditCurrentArgument = (QWidget*)SpinBox_DX; SMESH::SetPointRepresentation(true); - myViewWindow->SetSelectionMode(NodeSelection); + if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) + aViewWindow->SetSelectionMode(NodeSelection); } else { } @@ -785,7 +782,8 @@ void SMESHGUI_SymmetryDlg::ActivateThisDialog() mySMESHGUI->SetActiveDialogBox((QDialog*)this); - myViewWindow->SetSelectionMode(CellSelection); + if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) + aViewWindow->SetSelectionMode(CellSelection); SelectionIntoArgument(); } @@ -839,11 +837,13 @@ void SMESHGUI_SymmetryDlg::onSelectMesh (bool toSelectMesh) SMESH::SetPointRepresentation(false); if (toSelectMesh) { - myViewWindow->SetSelectionMode(ActorSelection); + if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) + aViewWindow->SetSelectionMode(ActorSelection); mySelectionMgr->installFilter(myMeshOrSubMeshOrGroupFilter); LineEditElements->setReadOnly(true); } else { - myViewWindow->SetSelectionMode(CellSelection); + if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) + aViewWindow->SetSelectionMode(CellSelection); LineEditElements->setReadOnly(false); onTextChange(LineEditElements->text()); }