From: mzn Date: Fri, 24 Jun 2005 13:54:25 +0000 (+0000) Subject: The selections of elements corrected. X-Git-Tag: T3_0_0_a4~4 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=0e020f2e93a8acfb51faccf221116530c23871ad;p=modules%2Fsmesh.git The selections of elements corrected. --- diff --git a/src/SMESHGUI/SMESHGUI_AddMeshElementDlg.cxx b/src/SMESHGUI/SMESHGUI_AddMeshElementDlg.cxx index 8226cdc6a..263758674 100644 --- a/src/SMESHGUI/SMESHGUI_AddMeshElementDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_AddMeshElementDlg.cxx @@ -524,28 +524,20 @@ void SMESHGUI_AddMeshElementDlg::onTextChange (const QString& theNewText) aMesh = myActor->GetObject()->GetMesh(); if (aMesh) { - SALOME_ListIO aList; aList.Append( myActor->getIO() ); - mySelectionMgr->setSelectedObjects( aList, false ); - - TColStd_IndexedMapOfInteger selectedIndices; TColStd_MapOfInteger newIndices; - mySelector->GetIndex(myActor->getIO(), selectedIndices); - + QStringList aListId = QStringList::split(" ", theNewText, false); for (int i = 0; i < aListId.count(); i++) { if( const SMDS_MeshNode * n = aMesh->FindNode( aListId[ i ].toInt() ) ) { - if( selectedIndices.Add( n->GetID() ) ) - newIndices.Add( n->GetID() ); + newIndices.Add( n->GetID() ); myNbOkNodes++; } } - if( newIndices.Extent()>0 ) - { - mySelector->AddOrRemoveIndex( myActor->getIO(), newIndices, true ); - myViewWindow->highlight( myActor->getIO(), true, true ); - } + mySelector->AddOrRemoveIndex( myActor->getIO(), newIndices, false ); + myViewWindow->highlight( myActor->getIO(), true, true ); + bool aNodesOK = false; if (myIsPoly && myElementType == SMDSAbs_Face && aListId.count() >=3 ){ myNbOkNodes = aListId.count(); diff --git a/src/SMESHGUI/SMESHGUI_CreatePolyhedralVolumeDlg.cxx b/src/SMESHGUI/SMESHGUI_CreatePolyhedralVolumeDlg.cxx index 6e7223ed4..abf447e17 100644 --- a/src/SMESHGUI/SMESHGUI_CreatePolyhedralVolumeDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_CreatePolyhedralVolumeDlg.cxx @@ -583,28 +583,20 @@ void SMESHGUI_CreatePolyhedralVolumeDlg::onTextChange(const QString& theNewText) if (GetConstructorId() == 0) { if ( aMesh ) { - SALOME_ListIO aList; aList.Append( myActor->getIO() ); - mySelectionMgr->setSelectedObjects( aList ); - - TColStd_IndexedMapOfInteger selectedIndices; TColStd_MapOfInteger newIndices; - mySelector->GetIndex( myActor->getIO(), selectedIndices); - + QStringList aListId = QStringList::split( " ", theNewText, false); for ( int i = 0; i < aListId.count(); i++ ) { const SMDS_MeshNode * n = aMesh->FindNode( aListId[ i ].toInt() ); if ( n ) { - if (selectedIndices.Add(n->GetID())) - newIndices.Add(n->GetID()); + newIndices.Add(n->GetID()); myNbOkElements++; } } - if (newIndices.Extent() > 0){ - mySelector->AddOrRemoveIndex( myActor->getIO(), newIndices, true ); - myViewWindow->highlight( myActor->getIO(), true, true ); - } - + mySelector->AddOrRemoveIndex( myActor->getIO(), newIndices, false ); + myViewWindow->highlight( myActor->getIO(), true, true ); + if ( myNbOkElements>0 && aListId.count()>=3) AddButton->setEnabled(true); else @@ -621,29 +613,21 @@ void SMESHGUI_CreatePolyhedralVolumeDlg::onTextChange(const QString& theNewText) // check entered ids of faces and hilight them QStringList aListId; if ( aMesh ) { - SALOME_ListIO aList; aList.Append( myActor->getIO() ); - mySelectionMgr->setSelectedObjects( aList ); - - TColStd_IndexedMapOfInteger selectedIndices; TColStd_MapOfInteger newIndices; - mySelector->GetIndex( myActor->getIO(), selectedIndices); - + aListId = QStringList::split( " ", theNewText, false); for ( int i = 0; i < aListId.count(); i++ ) { const SMDS_MeshElement * e = aMesh->FindElement( aListId[ i ].toInt() ); if ( e ) { - if (selectedIndices.Add(e->GetID())) - newIndices.Add(e->GetID()); + newIndices.Add(e->GetID()); myNbOkElements++; } } - if (newIndices.Extent() > 0){ - mySelector->AddOrRemoveIndex( myActor->getIO(), newIndices, true ); - myViewWindow->highlight( myActor->getIO(), true, true ); - } - + mySelector->AddOrRemoveIndex( myActor->getIO(), newIndices, false ); + myViewWindow->highlight( myActor->getIO(), true, true ); + if ( myNbOkElements ) { if (aListId.count()>1){ buttonOk->setEnabled( true ); diff --git a/src/SMESHGUI/SMESHGUI_MeshPatternDlg.cxx b/src/SMESHGUI/SMESHGUI_MeshPatternDlg.cxx index cab4a47a2..047781d20 100755 --- a/src/SMESHGUI/SMESHGUI_MeshPatternDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_MeshPatternDlg.cxx @@ -1256,28 +1256,16 @@ void SMESHGUI_MeshPatternDlg::onTextChanged (const QString& theNewText) if (aMesh) { QStringList aListId = QStringList::split(" ", theNewText, false); - - SALOME_ListIO aList; - aList.Append(anActor->getIO()); - mySelectionMgr->setSelectedObjects(aList, false); - - TColStd_IndexedMapOfInteger selectedIndices; + TColStd_MapOfInteger newIndices; - mySelector->GetIndex(anActor->getIO(), selectedIndices); - + for (int i = 0; i < aListId.count(); i++) { const SMDS_MeshElement * e = aMesh->FindElement(aListId[ i ].toInt()); - if (e && e->GetType() == (myType == Type_2d ? SMDSAbs_Face : SMDSAbs_Volume)) { - if (selectedIndices.Add(e->GetID())) { - newIndices.Add(e->GetID()); - } - } - } - if (newIndices.Extent() > 0) - { - mySelector->AddOrRemoveIndex( anActor->getIO(), newIndices, true); - myViewWindow->highlight( anActor->getIO(), true, true ); + if (e && e->GetType() == (myType == Type_2d ? SMDSAbs_Face : SMDSAbs_Volume)) + newIndices.Add(e->GetID()); } + mySelector->AddOrRemoveIndex( anActor->getIO(), newIndices, false); + myViewWindow->highlight( anActor->getIO(), true, true ); } myBusy = false; diff --git a/src/SMESHGUI/SMESHGUI_MoveNodesDlg.cxx b/src/SMESHGUI/SMESHGUI_MoveNodesDlg.cxx index 12ad1b684..f249535c8 100644 --- a/src/SMESHGUI/SMESHGUI_MoveNodesDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_MoveNodesDlg.cxx @@ -355,8 +355,10 @@ void SMESHGUI_MoveNodesDlg::onTextChange (const QString& theNewText) if(const SMDS_MeshElement *anElem = aMesh->FindElement(theNewText.toInt())) { TColStd_MapOfInteger aListInd; aListInd.Add(anElem->GetID()); - mySelector->AddOrRemoveIndex(anIO,aListInd, true); + mySelector->AddOrRemoveIndex(anIO,aListInd, false); myViewWindow->highlight(anIO,true,true); + + onSelectionDone(); } } } diff --git a/src/SMESHGUI/SMESHGUI_SewingDlg.cxx b/src/SMESHGUI/SMESHGUI_SewingDlg.cxx index dab2df032..6bbc5c7b1 100644 --- a/src/SMESHGUI/SMESHGUI_SewingDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_SewingDlg.cxx @@ -638,16 +638,8 @@ void SMESHGUI_SewingDlg::onTextChange (const QString& theNewText) send->clear(); if (aMesh) { - //mySelectionMgr->clearSelected(); - //mySelectionMgr->AddIObject(myActor->getIO()); - SALOME_ListIO aList; - aList.Append(myActor->getIO()); - mySelectionMgr->setSelectedObjects(aList, false); - - TColStd_IndexedMapOfInteger selectedIndices; TColStd_MapOfInteger newIndices; - mySelector->GetIndex( myActor->getIO(), selectedIndices); - + if (GetConstructorId() != 3 || (send != LineEdit1 && send != LineEdit4)) { SMESH::SetPointRepresentation(true); @@ -655,14 +647,10 @@ void SMESHGUI_SewingDlg::onTextChange (const QString& theNewText) const SMDS_MeshNode * n = aMesh->FindNode(theNewText.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()); - mySelector->AddOrRemoveIndex(myActor->getIO(), newIndices, true); - myViewWindow->highlight( myActor->getIO(), true, true ); - } - + newIndices.Add(n->GetID()); + mySelector->AddOrRemoveIndex(myActor->getIO(), newIndices, false); + myViewWindow->highlight( myActor->getIO(), true, true ); + if (send == LineEdit1) myOk1 = true; else if (send == LineEdit2) @@ -687,23 +675,17 @@ void SMESHGUI_SewingDlg::onTextChange (const QString& theNewText) 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()); - } + if (e) + newIndices.Add(e->GetID()); + if (!isEvenOneExists) isEvenOneExists = true; - } - } - - if (newIndices.Extent() > 0) - { - mySelector->AddOrRemoveIndex(myActor->getIO(), newIndices, true); - myViewWindow->highlight( myActor->getIO(), true, true ); } + + mySelector->AddOrRemoveIndex(myActor->getIO(), newIndices, false); + myViewWindow->highlight( myActor->getIO(), true, true ); + if (isEvenOneExists) { if (send == LineEdit1) myOk1 = true;