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();
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();

View File

@ -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 );

View File

@ -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;

View File

@ -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();
}
}
}

View File

@ -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;