X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSMESHGUI%2FSMESHGUI_SmoothingDlg.cxx;h=40400d4996e97f249e12a2143e1fe31b7e6de466;hb=ea3e3193e3d50a44a4b3a069fc4fc1239c22f27b;hp=caec59a2c5dcb99d14da9f98eb80c246a0d897b4;hpb=a2f0f70d5912ea83c868916f06eaefb58a32ec2e;p=modules%2Fsmesh.git diff --git a/src/SMESHGUI/SMESHGUI_SmoothingDlg.cxx b/src/SMESHGUI/SMESHGUI_SmoothingDlg.cxx index caec59a2c..40400d499 100644 --- a/src/SMESHGUI/SMESHGUI_SmoothingDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_SmoothingDlg.cxx @@ -89,9 +89,7 @@ SMESHGUI_SmoothingDlg::SMESHGUI_SmoothingDlg( SMESHGUI* theModule, const char* n : 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_DLG_SMOOTHING"))); QPixmap image1 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SELECT"))); @@ -253,6 +251,8 @@ SMESHGUI_SmoothingDlg::SMESHGUI_SmoothingDlg( SMESHGUI* theModule, const char* n GroupArguments->show(); myConstructorId = 0; Constructor1->setChecked(TRUE); + + mySelector = (SMESH::GetViewWindow( mySMESHGUI ))->GetSelector(); mySMESHGUI->SetActiveDialogBox(this); @@ -321,6 +321,7 @@ void SMESHGUI_SmoothingDlg::Init() myEditCurrentArgument = LineEditElements; LineEditElements->setFocus(); + LineEditElements->clear(); LineEditNodes->clear(); myElementsId = ""; myNbOkElements = 0; @@ -423,7 +424,8 @@ void SMESHGUI_SmoothingDlg::ClickOnCancel() mySelectionMgr->clearSelected(); SMESH::SetPickable(); // ??? SMESH::SetPointRepresentation(false); - myViewWindow->SetSelectionMode(ActorSelection); + if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) + aViewWindow->SetSelectionMode(ActorSelection); mySMESHGUI->ResetState(); reject(); } @@ -456,57 +458,35 @@ void SMESHGUI_SmoothingDlg::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; } else if (send == LineEditNodes) { - TColStd_IndexedMapOfInteger selectedIndices; TColStd_MapOfInteger newIndices; - mySelector->GetIndex(myActor->getIO(), selectedIndices); - + for (int i = 0; i < aListId.count(); i++) { const SMDS_MeshNode * n = aMesh->FindNode(aListId[ i ].toInt()); - if (n) { - //if (!mySelectionMgr->IsIndexSelected(myActor->getIO(), n->GetID())) { - if (selectedIndices.Add(n->GetID())) { - //mySelectionMgr->AddOrRemoveIndex (myActor->getIO(), n->GetID(), true); - newIndices.Add(n->GetID()); - } - myNbOkNodes++; - } - } - if (newIndices.Extent() > 0) - { - mySelector->AddOrRemoveIndex(myActor->getIO(), newIndices, true); - myViewWindow->highlight( myActor->getIO(), true, true ); + if (n) + newIndices.Add(n->GetID()); + myNbOkNodes++; } + mySelector->AddOrRemoveIndex(myActor->getIO(), newIndices, false); + if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) + aViewWindow->highlight( myActor->getIO(), true, true ); } } @@ -656,12 +636,14 @@ void SMESHGUI_SmoothingDlg::SetEditCurrentArgument() mySelectionMgr->setSelectionModes(ActorSelection); mySelectionMgr->installFilter(myMeshOrSubMeshOrGroupFilter); } else { - myViewWindow->SetSelectionMode(CellSelection); + if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) + aViewWindow->SetSelectionMode(CellSelection); } } else if (send == SelectNodesButton) { myEditCurrentArgument = LineEditNodes; SMESH::SetPointRepresentation(true); - myViewWindow->SetSelectionMode(NodeSelection); + if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) + aViewWindow->SetSelectionMode(NodeSelection); } myEditCurrentArgument->setFocus(); @@ -700,7 +682,8 @@ void SMESHGUI_SmoothingDlg::ActivateThisDialog() GroupButtons->setEnabled(true); mySMESHGUI->SetActiveDialogBox(this); - myViewWindow->SetSelectionMode(CellSelection); + if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) + aViewWindow->SetSelectionMode(CellSelection); SelectionIntoArgument(); } @@ -758,7 +741,8 @@ void SMESHGUI_SmoothingDlg::onSelectMesh (bool toSelectMesh) 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()); }