The selections of elements corrected.

This commit is contained in:
mzn 2005-06-24 13:54:25 +00:00
parent 81248260b7
commit 0e020f2e93
5 changed files with 36 additions and 88 deletions

View File

@ -524,28 +524,20 @@ void SMESHGUI_AddMeshElementDlg::onTextChange (const QString& theNewText)
aMesh = myActor->GetObject()->GetMesh(); aMesh = myActor->GetObject()->GetMesh();
if (aMesh) { if (aMesh) {
SALOME_ListIO aList; aList.Append( myActor->getIO() );
mySelectionMgr->setSelectedObjects( aList, false );
TColStd_IndexedMapOfInteger selectedIndices;
TColStd_MapOfInteger newIndices; TColStd_MapOfInteger newIndices;
mySelector->GetIndex(myActor->getIO(), selectedIndices);
QStringList aListId = QStringList::split(" ", theNewText, false); QStringList aListId = QStringList::split(" ", theNewText, false);
for (int i = 0; i < aListId.count(); i++) { for (int i = 0; i < aListId.count(); i++) {
if( const SMDS_MeshNode * n = aMesh->FindNode( aListId[ i ].toInt() ) ) if( const SMDS_MeshNode * n = aMesh->FindNode( aListId[ i ].toInt() ) )
{ {
if( selectedIndices.Add( n->GetID() ) ) newIndices.Add( n->GetID() );
newIndices.Add( n->GetID() );
myNbOkNodes++; myNbOkNodes++;
} }
} }
if( newIndices.Extent()>0 ) mySelector->AddOrRemoveIndex( myActor->getIO(), newIndices, false );
{ myViewWindow->highlight( myActor->getIO(), true, true );
mySelector->AddOrRemoveIndex( myActor->getIO(), newIndices, true );
myViewWindow->highlight( myActor->getIO(), true, true );
}
bool aNodesOK = false; bool aNodesOK = false;
if (myIsPoly && myElementType == SMDSAbs_Face && aListId.count() >=3 ){ if (myIsPoly && myElementType == SMDSAbs_Face && aListId.count() >=3 ){
myNbOkNodes = aListId.count(); myNbOkNodes = aListId.count();

View File

@ -583,28 +583,20 @@ void SMESHGUI_CreatePolyhedralVolumeDlg::onTextChange(const QString& theNewText)
if (GetConstructorId() == 0) if (GetConstructorId() == 0)
{ {
if ( aMesh ) { if ( aMesh ) {
SALOME_ListIO aList; aList.Append( myActor->getIO() );
mySelectionMgr->setSelectedObjects( aList );
TColStd_IndexedMapOfInteger selectedIndices;
TColStd_MapOfInteger newIndices; TColStd_MapOfInteger newIndices;
mySelector->GetIndex( myActor->getIO(), selectedIndices);
QStringList aListId = QStringList::split( " ", theNewText, false); QStringList aListId = QStringList::split( " ", theNewText, false);
for ( int i = 0; i < aListId.count(); i++ ) { for ( int i = 0; i < aListId.count(); i++ ) {
const SMDS_MeshNode * n = aMesh->FindNode( aListId[ i ].toInt() ); const SMDS_MeshNode * n = aMesh->FindNode( aListId[ i ].toInt() );
if ( n ) { if ( n ) {
if (selectedIndices.Add(n->GetID())) newIndices.Add(n->GetID());
newIndices.Add(n->GetID());
myNbOkElements++; myNbOkElements++;
} }
} }
if (newIndices.Extent() > 0){ mySelector->AddOrRemoveIndex( myActor->getIO(), newIndices, false );
mySelector->AddOrRemoveIndex( myActor->getIO(), newIndices, true ); myViewWindow->highlight( myActor->getIO(), true, true );
myViewWindow->highlight( myActor->getIO(), true, true );
}
if ( myNbOkElements>0 && aListId.count()>=3) if ( myNbOkElements>0 && aListId.count()>=3)
AddButton->setEnabled(true); AddButton->setEnabled(true);
else else
@ -621,29 +613,21 @@ void SMESHGUI_CreatePolyhedralVolumeDlg::onTextChange(const QString& theNewText)
// check entered ids of faces and hilight them // check entered ids of faces and hilight them
QStringList aListId; QStringList aListId;
if ( aMesh ) { if ( aMesh ) {
SALOME_ListIO aList; aList.Append( myActor->getIO() );
mySelectionMgr->setSelectedObjects( aList );
TColStd_IndexedMapOfInteger selectedIndices;
TColStd_MapOfInteger newIndices; TColStd_MapOfInteger newIndices;
mySelector->GetIndex( myActor->getIO(), selectedIndices);
aListId = QStringList::split( " ", theNewText, false); aListId = QStringList::split( " ", theNewText, false);
for ( int i = 0; i < aListId.count(); i++ ) { for ( int i = 0; i < aListId.count(); i++ ) {
const SMDS_MeshElement * e = aMesh->FindElement( aListId[ i ].toInt() ); const SMDS_MeshElement * e = aMesh->FindElement( aListId[ i ].toInt() );
if ( e ) { if ( e ) {
if (selectedIndices.Add(e->GetID())) newIndices.Add(e->GetID());
newIndices.Add(e->GetID());
myNbOkElements++; myNbOkElements++;
} }
} }
if (newIndices.Extent() > 0){ mySelector->AddOrRemoveIndex( myActor->getIO(), newIndices, false );
mySelector->AddOrRemoveIndex( myActor->getIO(), newIndices, true ); myViewWindow->highlight( myActor->getIO(), true, true );
myViewWindow->highlight( myActor->getIO(), true, true );
}
if ( myNbOkElements ) { if ( myNbOkElements ) {
if (aListId.count()>1){ if (aListId.count()>1){
buttonOk->setEnabled( true ); buttonOk->setEnabled( true );

View File

@ -1256,28 +1256,16 @@ void SMESHGUI_MeshPatternDlg::onTextChanged (const QString& theNewText)
if (aMesh) { if (aMesh) {
QStringList aListId = QStringList::split(" ", theNewText, false); QStringList aListId = QStringList::split(" ", theNewText, false);
SALOME_ListIO aList;
aList.Append(anActor->getIO());
mySelectionMgr->setSelectedObjects(aList, false);
TColStd_IndexedMapOfInteger selectedIndices;
TColStd_MapOfInteger newIndices; TColStd_MapOfInteger newIndices;
mySelector->GetIndex(anActor->getIO(), selectedIndices);
for (int i = 0; i < aListId.count(); i++) { for (int i = 0; i < aListId.count(); i++) {
const SMDS_MeshElement * e = aMesh->FindElement(aListId[ i ].toInt()); const SMDS_MeshElement * e = aMesh->FindElement(aListId[ i ].toInt());
if (e && e->GetType() == (myType == Type_2d ? SMDSAbs_Face : SMDSAbs_Volume)) { if (e && e->GetType() == (myType == Type_2d ? SMDSAbs_Face : SMDSAbs_Volume))
if (selectedIndices.Add(e->GetID())) { newIndices.Add(e->GetID());
newIndices.Add(e->GetID());
}
}
}
if (newIndices.Extent() > 0)
{
mySelector->AddOrRemoveIndex( anActor->getIO(), newIndices, true);
myViewWindow->highlight( anActor->getIO(), true, true );
} }
mySelector->AddOrRemoveIndex( anActor->getIO(), newIndices, false);
myViewWindow->highlight( anActor->getIO(), true, true );
} }
myBusy = false; myBusy = false;

View File

@ -355,8 +355,10 @@ void SMESHGUI_MoveNodesDlg::onTextChange (const QString& theNewText)
if(const SMDS_MeshElement *anElem = aMesh->FindElement(theNewText.toInt())) { if(const SMDS_MeshElement *anElem = aMesh->FindElement(theNewText.toInt())) {
TColStd_MapOfInteger aListInd; TColStd_MapOfInteger aListInd;
aListInd.Add(anElem->GetID()); aListInd.Add(anElem->GetID());
mySelector->AddOrRemoveIndex(anIO,aListInd, true); mySelector->AddOrRemoveIndex(anIO,aListInd, false);
myViewWindow->highlight(anIO,true,true); myViewWindow->highlight(anIO,true,true);
onSelectionDone();
} }
} }
} }

View File

@ -638,16 +638,8 @@ void SMESHGUI_SewingDlg::onTextChange (const QString& theNewText)
send->clear(); send->clear();
if (aMesh) { 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; TColStd_MapOfInteger newIndices;
mySelector->GetIndex( myActor->getIO(), selectedIndices);
if (GetConstructorId() != 3 || (send != LineEdit1 && send != LineEdit4)) { if (GetConstructorId() != 3 || (send != LineEdit1 && send != LineEdit4)) {
SMESH::SetPointRepresentation(true); SMESH::SetPointRepresentation(true);
@ -655,14 +647,10 @@ void SMESHGUI_SewingDlg::onTextChange (const QString& theNewText)
const SMDS_MeshNode * n = aMesh->FindNode(theNewText.toInt()); const SMDS_MeshNode * n = aMesh->FindNode(theNewText.toInt());
if (n) { if (n) {
//if (!mySelectionMgr->IsIndexSelected(myActor->getIO(), n->GetID())) { newIndices.Add(n->GetID());
if (selectedIndices.Add(n->GetID())) { mySelector->AddOrRemoveIndex(myActor->getIO(), newIndices, false);
//mySelectionMgr->AddOrRemoveIndex (myActor->getIO(), n->GetID(), true); myViewWindow->highlight( myActor->getIO(), true, true );
newIndices.Add(n->GetID());
mySelector->AddOrRemoveIndex(myActor->getIO(), newIndices, true);
myViewWindow->highlight( myActor->getIO(), true, true );
}
if (send == LineEdit1) if (send == LineEdit1)
myOk1 = true; myOk1 = true;
else if (send == LineEdit2) else if (send == LineEdit2)
@ -687,23 +675,17 @@ void SMESHGUI_SewingDlg::onTextChange (const QString& theNewText)
for (int i = 0; i < aListId.count(); i++) { for (int i = 0; i < aListId.count(); i++) {
const SMDS_MeshElement * e = aMesh->FindElement(aListId[ i ].toInt()); const SMDS_MeshElement * e = aMesh->FindElement(aListId[ i ].toInt());
if (e) { if (e)
//if (!mySelectionMgr->IsIndexSelected(myActor->getIO(), e->GetID())) { newIndices.Add(e->GetID());
if (selectedIndices.Add(e->GetID())) {
//mySelectionMgr->AddOrRemoveIndex (myActor->getIO(), e->GetID(), true);
newIndices.Add(e->GetID());
}
if (!isEvenOneExists) if (!isEvenOneExists)
isEvenOneExists = true; 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 (isEvenOneExists) {
if (send == LineEdit1) if (send == LineEdit1)
myOk1 = true; myOk1 = true;