The selections of elements corrected.

This commit is contained in:
mzn 2005-06-24 12:24:06 +00:00
parent 255ab4e2ee
commit 783b5a717c
9 changed files with 75 additions and 183 deletions

View File

@ -438,34 +438,19 @@ void SMESHGUI_ExtrusionDlg::onTextChange (const QString& theNewText)
aMesh = myActor->GetObject()->GetMesh(); aMesh = myActor->GetObject()->GetMesh();
if (aMesh) { 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); QStringList aListId = QStringList::split(" ", theNewText, false);
if (send == LineEditElements) { if (send == LineEditElements) {
const Handle(SALOME_InteractiveObject)& anIO = myActor->getIO(); const Handle(SALOME_InteractiveObject)& anIO = myActor->getIO();
TColStd_IndexedMapOfInteger selectedIndices;
TColStd_MapOfInteger newIndices; TColStd_MapOfInteger newIndices;
mySelector->GetIndex(anIO, 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) { 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()); newIndices.Add(e->GetID());
}
myNbOkElements++; myNbOkElements++;
} }
} mySelector->AddOrRemoveIndex(anIO, newIndices, false);
if (newIndices.Extent() > 0) {
mySelector->AddOrRemoveIndex(anIO, newIndices, true);
myViewWindow->highlight( anIO, true, true ); myViewWindow->highlight( anIO, true, true );
}
myElementsId = theNewText; myElementsId = theNewText;
} }
} }

View File

@ -261,9 +261,7 @@ void SMESHGUI_RemoveElementsDlg::ClickOnApply()
} }
if (aResult) { if (aResult) {
SALOME_ListIO aList; myEditCurrentArgument->clear();
aList.Append(myActor->getIO());
mySelectionMgr->setSelectedObjects(aList, false);
SMESH::UpdateView(); SMESH::UpdateView();
} }
} }
@ -314,30 +312,21 @@ void SMESHGUI_RemoveElementsDlg::onTextChange (const QString& theNewText)
if(myActor){ if(myActor){
if(SMDS_Mesh* aMesh = myActor->GetObject()->GetMesh()){ if(SMDS_Mesh* aMesh = myActor->GetObject()->GetMesh()){
Handle(SALOME_InteractiveObject) anIO = myActor->getIO(); Handle(SALOME_InteractiveObject) anIO = myActor->getIO();
SALOME_ListIO aList;
aList.Append(anIO);
mySelectionMgr->setSelectedObjects(aList, false);
TColStd_IndexedMapOfInteger selectedIndices;
TColStd_MapOfInteger newIndices; TColStd_MapOfInteger newIndices;
mySelector->GetIndex(anIO,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_MeshElement *anElem = aMesh->FindElement(aListId[i].toInt())) { if(const SMDS_MeshElement *anElem = aMesh->FindElement(aListId[i].toInt())) {
if (selectedIndices.Add(anElem->GetID())) {
newIndices.Add(anElem->GetID()); newIndices.Add(anElem->GetID());
}
myNbOkElements++; myNbOkElements++;
} }
} }
if (newIndices.Extent() > 0){ mySelector->AddOrRemoveIndex(anIO,newIndices,false);
mySelector->AddOrRemoveIndex(anIO,newIndices,true);
myViewWindow->highlight(anIO,true,true); myViewWindow->highlight(anIO,true,true);
} }
} }
}
if (myNbOkElements) { if (myNbOkElements) {
buttonOk->setEnabled(true); buttonOk->setEnabled(true);

View File

@ -214,6 +214,10 @@ void SMESHGUI_RemoveNodesDlg::Init()
connect(SelectButtonC1A1, SIGNAL (clicked()), this, SLOT(SetEditCurrentArgument())); connect(SelectButtonC1A1, SIGNAL (clicked()), this, SLOT(SetEditCurrentArgument()));
connect(mySMESHGUI, SIGNAL (SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog())); connect(mySMESHGUI, SIGNAL (SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog()));
connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
/* to close dialog if study change */
connect(mySMESHGUI, SIGNAL (SignalCloseAllDialogs()), this, SLOT(ClickOnCancel()));
connect(myEditCurrentArgument, SIGNAL(textChanged(const QString&)),
SLOT(onTextChange(const QString&)));
/* Move widget on the botton right corner of main widget */ /* Move widget on the botton right corner of main widget */
int x, y; int x, y;
@ -259,9 +263,7 @@ void SMESHGUI_RemoveNodesDlg::ClickOnApply()
} }
if (aResult) { if (aResult) {
SALOME_ListIO aList; myEditCurrentArgument->clear();
aList.Append(myActor->getIO());
mySelectionMgr->setSelectedObjects(aList, false);
SMESH::UpdateView(); SMESH::UpdateView();
} }
@ -311,30 +313,21 @@ void SMESHGUI_RemoveNodesDlg::onTextChange (const QString& theNewText)
if(myActor){ if(myActor){
if(SMDS_Mesh* aMesh = myActor->GetObject()->GetMesh()){ if(SMDS_Mesh* aMesh = myActor->GetObject()->GetMesh()){
Handle(SALOME_InteractiveObject) anIO = myActor->getIO(); Handle(SALOME_InteractiveObject) anIO = myActor->getIO();
SALOME_ListIO aList;
aList.Append(anIO);
mySelectionMgr->setSelectedObjects(aList, false);
TColStd_IndexedMapOfInteger selectedIndices;
TColStd_MapOfInteger newIndices; TColStd_MapOfInteger newIndices;
mySelector->GetIndex(anIO,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 *aNode = aMesh->FindNode(aListId[ i ].toInt())) { if (const SMDS_MeshNode *aNode = aMesh->FindNode(aListId[i].toInt())) {
if (selectedIndices.Add(aNode->GetID())) {
newIndices.Add(aNode->GetID()); newIndices.Add(aNode->GetID());
}
myNbOkNodes++; myNbOkNodes++;
} }
} }
if(newIndices.Extent() > 0){ mySelector->AddOrRemoveIndex(anIO,newIndices,false);
mySelector->AddOrRemoveIndex(anIO,newIndices,true);
myViewWindow->highlight(anIO,true,true); myViewWindow->highlight(anIO,true,true);
} }
} }
}
if (myNbOkNodes) { if (myNbOkNodes) {
buttonOk->setEnabled(true); buttonOk->setEnabled(true);

View File

@ -522,34 +522,21 @@ void SMESHGUI_RevolutionDlg::onTextChange (const QString& theNewText)
if (aMesh) { if (aMesh) {
if (send == LineEditElements) { if (send == LineEditElements) {
//mySelectionMgr->clearSelected(); Handle(SALOME_InteractiveObject) anIO = myActor->getIO();
//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);
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_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())) {
if (selectedIndices.Add(e->GetID())) {
//mySelectionMgr->AddOrRemoveIndex (myActor->getIO(), e->GetID(), true);
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 );
}
myElementsId = theNewText; myElementsId = theNewText;
} }

View File

@ -479,33 +479,20 @@ void SMESHGUI_RotationDlg::onTextChange (const QString& theNewText)
if (aMesh) { if (aMesh) {
if (send == LineEditElements) { if (send == LineEditElements) {
//mySelectionMgr->clearSelected(); Handle(SALOME_InteractiveObject) anIO = myActor->getIO();
//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);
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_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())) {
if (selectedIndices.Add(e->GetID())) {
//mySelectionMgr->AddOrRemoveIndex (myActor->getIO(), e->GetID(), true);
newIndices.Add(e->GetID()); newIndices.Add(e->GetID());
}
myNbOkElements++; myNbOkElements++;
} }
}
if (newIndices.Extent() > 0){ mySelector->AddOrRemoveIndex( anIO, newIndices, false );
mySelector->AddOrRemoveIndex( myActor->getIO(), newIndices, true ); myViewWindow->highlight( anIO, true, true );
myViewWindow->highlight( myActor->getIO(), true, true );
}
myElementsId = theNewText; myElementsId = theNewText;
} }

View File

@ -86,9 +86,9 @@ QtxValue SMESHGUI_Selection::param( const int ind, const QString& p ) const
else if ( p=="hasReference" ) val = QtxValue( hasReference( ind ) ); else if ( p=="hasReference" ) val = QtxValue( hasReference( ind ) );
else if ( p=="isVisible" ) val = QtxValue( isVisible( ind ) ); else if ( p=="isVisible" ) val = QtxValue( isVisible( ind ) );
// printf( "--> param() : [%s] = %s (%s)\n", p.latin1(), val.toString().latin1(), val.typeName() ); printf( "--> param() : [%s] = %s (%s)\n", p.latin1(), val.toString().latin1(), val.typeName() );
// if ( val.type() == QVariant::List ) if ( val.type() == QVariant::List )
// cout << "size: " << val.toList().count() << endl; cout << "size: " << val.toList().count() << endl;
return val; return val;
} }

View File

@ -321,6 +321,7 @@ void SMESHGUI_SmoothingDlg::Init()
myEditCurrentArgument = LineEditElements; myEditCurrentArgument = LineEditElements;
LineEditElements->setFocus(); LineEditElements->setFocus();
LineEditElements->clear();
LineEditNodes->clear(); LineEditNodes->clear();
myElementsId = ""; myElementsId = "";
myNbOkElements = 0; myNbOkElements = 0;
@ -456,59 +457,35 @@ void SMESHGUI_SmoothingDlg::onTextChange (const QString& theNewText)
aMesh = myActor->GetObject()->GetMesh(); aMesh = myActor->GetObject()->GetMesh();
if (aMesh) { 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); QStringList aListId = QStringList::split(" ", theNewText, false);
if (send == LineEditElements) { if (send == LineEditElements) {
const Handle(SALOME_InteractiveObject)& anIO = myActor->getIO(); const Handle(SALOME_InteractiveObject)& anIO = myActor->getIO();
TColStd_IndexedMapOfInteger selectedIndices;
TColStd_MapOfInteger newIndices; TColStd_MapOfInteger newIndices;
mySelector->GetIndex( anIO, 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) { 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()); newIndices.Add(e->GetID());
}
myNbOkElements++; myNbOkElements++;
} }
} mySelector->AddOrRemoveIndex(anIO, newIndices, false);
if (newIndices.Extent() > 0) {
mySelector->AddOrRemoveIndex(anIO, newIndices, true);
myViewWindow->highlight( anIO, true, true ); myViewWindow->highlight( anIO, true, true );
}
myElementsId = theNewText; myElementsId = theNewText;
} else if (send == LineEditNodes) { } else if (send == LineEditNodes) {
TColStd_IndexedMapOfInteger selectedIndices;
TColStd_MapOfInteger newIndices; TColStd_MapOfInteger newIndices;
mySelector->GetIndex(myActor->getIO(), selectedIndices);
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 (!mySelectionMgr->IsIndexSelected(myActor->getIO(), n->GetID())) {
if (selectedIndices.Add(n->GetID())) {
//mySelectionMgr->AddOrRemoveIndex (myActor->getIO(), n->GetID(), true);
newIndices.Add(n->GetID()); newIndices.Add(n->GetID());
}
myNbOkNodes++; myNbOkNodes++;
} }
} mySelector->AddOrRemoveIndex(myActor->getIO(), newIndices, false);
if (newIndices.Extent() > 0)
{
mySelector->AddOrRemoveIndex(myActor->getIO(), newIndices, true);
myViewWindow->highlight( myActor->getIO(), true, true ); myViewWindow->highlight( myActor->getIO(), true, true );
} }
} }
}
if (myNbOkElements && (myNbOkNodes || LineEditNodes->text().stripWhiteSpace().isEmpty())) { if (myNbOkElements && (myNbOkNodes || LineEditNodes->text().stripWhiteSpace().isEmpty())) {
buttonOk->setEnabled(true); buttonOk->setEnabled(true);

View File

@ -537,35 +537,22 @@ void SMESHGUI_SymmetryDlg::onTextChange (const QString& theNewText)
aMesh = myActor->GetObject()->GetMesh(); aMesh = myActor->GetObject()->GetMesh();
if (aMesh) { if (aMesh) {
//mySelectionMgr->clearSelected(); Handle(SALOME_InteractiveObject) anIO = myActor->getIO();
//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);
QStringList aListId = QStringList::split(" ", theNewText, false); QStringList aListId = QStringList::split(" ", theNewText, false);
if (send == LineEditElements) { if (send == LineEditElements) {
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())) {
if (selectedIndices.Add(e->GetID())) {
//mySelectionMgr->AddOrRemoveIndex (myActor->getIO(), e->GetID(), true);
newIndices.Add(e->GetID()); newIndices.Add(e->GetID());
}
myNbOkElements++; myNbOkElements++;
} }
}
if (newIndices.Extent() > 0){ mySelector->AddOrRemoveIndex( anIO, newIndices, false );
mySelector->AddOrRemoveIndex( myActor->getIO(), newIndices, true ); myViewWindow->highlight( anIO, true, true );
myViewWindow->highlight( myActor->getIO(), true, true );
}
myElementsId = theNewText; myElementsId = theNewText;
} }

View File

@ -502,39 +502,26 @@ void SMESHGUI_TranslationDlg::onTextChange (const QString& theNewText)
aMesh = myActor->GetObject()->GetMesh(); aMesh = myActor->GetObject()->GetMesh();
if (aMesh) { if (aMesh) {
//mySelectionMgr->clearSelected(); Handle(SALOME_InteractiveObject) anIO = myActor->getIO();
//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 );
QStringList aListId = QStringList::split(" ", theNewText, false); QStringList aListId = QStringList::split(" ", theNewText, false);
if (send == LineEditElements) { if (send == LineEditElements) {
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())) {
if (selectedIndices.Add(e->GetID())) {
//mySelectionMgr->AddOrRemoveIndex (myActor->getIO(), e->GetID(), true);
newIndices.Add(e->GetID()); newIndices.Add(e->GetID());
}
myNbOkElements++; myNbOkElements++;
} }
} }
if (newIndices.Extent() > 0){ mySelector->AddOrRemoveIndex( anIO, newIndices, false );
mySelector->AddOrRemoveIndex( myActor->getIO(), newIndices, true ); myViewWindow->highlight( anIO, true, true );
myViewWindow->highlight( myActor->getIO(), true, true );
}
myElementsId = theNewText; myElementsId = theNewText;
} }
}
if (myNbOkElements) { if (myNbOkElements) {
buttonOk->setEnabled(true); buttonOk->setEnabled(true);