mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2025-01-07 15:20:34 +05:00
0020898: EDF 1429 SMESH: Remove elements using "Set Filters" fails
This commit is contained in:
parent
8774b2b4ec
commit
c5b8df021f
@ -2517,31 +2517,18 @@ void SMESHGUI_FilterDlg::setIdsToWg (QWidget* theWg, const QList<int>& theIds)
|
|||||||
if (theWg == 0)
|
if (theWg == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
QStringList aStrList;
|
||||||
|
foreach(int id, theIds)
|
||||||
|
aStrList << QString::number(id);
|
||||||
|
|
||||||
if (theWg->inherits("QListWidget"))
|
if (theWg->inherits("QListWidget"))
|
||||||
{
|
{
|
||||||
QListWidget* aListBox = qobject_cast<QListWidget*>( theWg );
|
qobject_cast<QListWidget*>(theWg)->clear();
|
||||||
aListBox->clear();
|
qobject_cast<QListWidget*>(theWg)->addItems(aStrList);
|
||||||
|
|
||||||
QStringList aStrList;
|
|
||||||
QList<int>::const_iterator anIter;
|
|
||||||
for (anIter = theIds.begin(); anIter != theIds.end(); ++anIter)
|
|
||||||
aStrList.append(QString("%1").arg(*anIter));
|
|
||||||
|
|
||||||
aListBox->addItems(aStrList);
|
|
||||||
}
|
}
|
||||||
else if (theWg->inherits("QLineEdit"))
|
else if (theWg->inherits("QLineEdit"))
|
||||||
{
|
{
|
||||||
QLineEdit* aLineEdit = qobject_cast<QLineEdit*>( theWg );
|
qobject_cast<QLineEdit*>( theWg )->setText(aStrList.join(" "));
|
||||||
QString aStr;
|
|
||||||
QList<int>::const_iterator anIter;
|
|
||||||
|
|
||||||
for (anIter = theIds.begin(); anIter != theIds.end(); ++ anIter)
|
|
||||||
aStr += QString("%1 ").arg(*anIter);
|
|
||||||
|
|
||||||
if (!aStr.isEmpty())
|
|
||||||
aStr.remove(aStr.length() - 1, 1);
|
|
||||||
|
|
||||||
aLineEdit->setText(aStr);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -123,6 +123,7 @@ SMESHGUI_RemoveElementsDlg
|
|||||||
SelectButtonC1A1->setIcon(image1);
|
SelectButtonC1A1->setIcon(image1);
|
||||||
LineEditC1A1 = new QLineEdit(GroupC1);
|
LineEditC1A1 = new QLineEdit(GroupC1);
|
||||||
LineEditC1A1->setValidator(new SMESHGUI_IdValidator(this));
|
LineEditC1A1->setValidator(new SMESHGUI_IdValidator(this));
|
||||||
|
LineEditC1A1->setMaxLength(-1);
|
||||||
QPushButton* filterBtn = new QPushButton( tr( "SMESH_BUT_FILTER" ), GroupC1 );
|
QPushButton* filterBtn = new QPushButton( tr( "SMESH_BUT_FILTER" ), GroupC1 );
|
||||||
connect(filterBtn, SIGNAL(clicked()), this, SLOT(setFilters()));
|
connect(filterBtn, SIGNAL(clicked()), this, SLOT(setFilters()));
|
||||||
|
|
||||||
@ -232,7 +233,7 @@ void SMESHGUI_RemoveElementsDlg::ClickOnApply()
|
|||||||
bool aResult = false;
|
bool aResult = false;
|
||||||
try {
|
try {
|
||||||
SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
|
SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
|
||||||
aResult = aMeshEditor->RemoveElements(anArrayOfIdeces.inout());
|
aResult = aMeshEditor->RemoveElements(anArrayOfIdeces.in());
|
||||||
} catch (const SALOME::SALOME_Exception& S_ex) {
|
} catch (const SALOME::SALOME_Exception& S_ex) {
|
||||||
SalomeApp_Tools::QtCatchCorbaException(S_ex);
|
SalomeApp_Tools::QtCatchCorbaException(S_ex);
|
||||||
myEditCurrentArgument->clear();
|
myEditCurrentArgument->clear();
|
||||||
@ -311,9 +312,6 @@ void SMESHGUI_RemoveElementsDlg::onTextChange(const QString& theNewText)
|
|||||||
|
|
||||||
myNbOkElements = 0;
|
myNbOkElements = 0;
|
||||||
|
|
||||||
buttonOk->setEnabled(false);
|
|
||||||
buttonApply->setEnabled(false);
|
|
||||||
|
|
||||||
// hilight entered elements
|
// hilight entered elements
|
||||||
if(myActor){
|
if(myActor){
|
||||||
if(SMDS_Mesh* aMesh = myActor->GetObject()->GetMesh()){
|
if(SMDS_Mesh* aMesh = myActor->GetObject()->GetMesh()){
|
||||||
@ -335,12 +333,8 @@ void SMESHGUI_RemoveElementsDlg::onTextChange(const QString& theNewText)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (myNbOkElements) {
|
|
||||||
buttonOk->setEnabled(true);
|
|
||||||
buttonApply->setEnabled(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
myBusy = false;
|
myBusy = false;
|
||||||
|
updateButtons();
|
||||||
}
|
}
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
@ -349,56 +343,52 @@ void SMESHGUI_RemoveElementsDlg::onTextChange(const QString& theNewText)
|
|||||||
//=================================================================================
|
//=================================================================================
|
||||||
void SMESHGUI_RemoveElementsDlg::SelectionIntoArgument()
|
void SMESHGUI_RemoveElementsDlg::SelectionIntoArgument()
|
||||||
{
|
{
|
||||||
if (myBusy) return;
|
if (myBusy) return; // busy
|
||||||
|
if (myFilterDlg && myFilterDlg->isVisible()) return; // filter digl active
|
||||||
|
if (!GroupButtons->isEnabled()) return; // inactive
|
||||||
|
|
||||||
// clear
|
// clear
|
||||||
|
|
||||||
myNbOkElements = false;
|
myNbOkElements = 0;
|
||||||
myActor = 0;
|
myActor = 0;
|
||||||
|
|
||||||
myBusy = true;
|
myBusy = true;
|
||||||
myEditCurrentArgument->setText("");
|
myEditCurrentArgument->setText("");
|
||||||
myBusy = false;
|
myBusy = false;
|
||||||
|
|
||||||
if (!GroupButtons->isEnabled()) // inactive
|
|
||||||
return;
|
|
||||||
|
|
||||||
buttonOk->setEnabled(false);
|
|
||||||
buttonApply->setEnabled(false);
|
|
||||||
|
|
||||||
// get selected mesh
|
// get selected mesh
|
||||||
|
|
||||||
SALOME_ListIO aList;
|
SALOME_ListIO aList;
|
||||||
mySelectionMgr->selectedObjects(aList,SVTK_Viewer::Type());
|
mySelectionMgr->selectedObjects(aList,SVTK_Viewer::Type());
|
||||||
|
|
||||||
int nbSel = aList.Extent();
|
int nbSel = aList.Extent();
|
||||||
if (nbSel != 1)
|
if (nbSel == 1) {
|
||||||
return;
|
|
||||||
|
|
||||||
Handle(SALOME_InteractiveObject) anIO = aList.First();
|
Handle(SALOME_InteractiveObject) anIO = aList.First();
|
||||||
myMesh = SMESH::GetMeshByIO(anIO);
|
myMesh = SMESH::GetMeshByIO(anIO);
|
||||||
if (myMesh->_is_nil())
|
|
||||||
return;
|
|
||||||
|
|
||||||
myActor = SMESH::FindActorByEntry(anIO->getEntry());
|
if (!myMesh->_is_nil()) {
|
||||||
if (!myActor)
|
|
||||||
return;
|
|
||||||
|
|
||||||
// get selected nodes
|
myActor = SMESH::FindActorByEntry(anIO->getEntry());
|
||||||
QString aString = "";
|
if (myActor) {
|
||||||
int nbElems = SMESH::GetNameOfSelectedElements(mySelector,anIO,aString);
|
|
||||||
if(nbElems < 1)
|
// get selected nodes
|
||||||
return;
|
QString aString = "";
|
||||||
myBusy = true;
|
int nbElems = SMESH::GetNameOfSelectedElements(mySelector,anIO,aString);
|
||||||
myEditCurrentArgument->setText(aString);
|
if (nbElems > 0) {
|
||||||
myBusy = false;
|
myBusy = true;
|
||||||
|
myEditCurrentArgument->setText(aString);
|
||||||
|
myBusy = false;
|
||||||
|
|
||||||
|
// OK
|
||||||
|
|
||||||
|
myNbOkElements = nbElems;
|
||||||
|
} // if (nbElems > 0)
|
||||||
|
} // if (myActor)
|
||||||
|
} // if (!myMesh->_is_nil())
|
||||||
|
} // if (nbSel == 1) {
|
||||||
|
|
||||||
// OK
|
updateButtons();
|
||||||
|
|
||||||
myNbOkElements = nbElems;
|
|
||||||
|
|
||||||
buttonOk->setEnabled(true);
|
|
||||||
buttonApply->setEnabled(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
@ -524,3 +514,13 @@ void SMESHGUI_RemoveElementsDlg::setFilters()
|
|||||||
|
|
||||||
myFilterDlg->show();
|
myFilterDlg->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=================================================================================
|
||||||
|
// function : updateButtons
|
||||||
|
// purpose : enable / disable control buttons
|
||||||
|
//=================================================================================
|
||||||
|
void SMESHGUI_RemoveElementsDlg::updateButtons()
|
||||||
|
{
|
||||||
|
buttonOk->setEnabled(myNbOkElements > 0);
|
||||||
|
buttonApply->setEnabled(myNbOkElements > 0);
|
||||||
|
}
|
||||||
|
@ -107,6 +107,7 @@ private slots:
|
|||||||
void ActivateThisDialog();
|
void ActivateThisDialog();
|
||||||
void onTextChange( const QString& );
|
void onTextChange( const QString& );
|
||||||
void setFilters();
|
void setFilters();
|
||||||
|
void updateButtons();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // SMESHGUI_REMOVEELEMENTSDLG_H
|
#endif // SMESHGUI_REMOVEELEMENTSDLG_H
|
||||||
|
@ -123,6 +123,7 @@ SMESHGUI_RemoveNodesDlg
|
|||||||
SelectButtonC1A1->setIcon(image1);
|
SelectButtonC1A1->setIcon(image1);
|
||||||
LineEditC1A1 = new QLineEdit(GroupC1);
|
LineEditC1A1 = new QLineEdit(GroupC1);
|
||||||
LineEditC1A1->setValidator(new SMESHGUI_IdValidator(this));
|
LineEditC1A1->setValidator(new SMESHGUI_IdValidator(this));
|
||||||
|
LineEditC1A1->setMaxLength(-1);
|
||||||
QPushButton* filterBtn = new QPushButton( tr( "SMESH_BUT_FILTER" ), GroupC1 );
|
QPushButton* filterBtn = new QPushButton( tr( "SMESH_BUT_FILTER" ), GroupC1 );
|
||||||
connect(filterBtn, SIGNAL(clicked()), this, SLOT(setFilters()));
|
connect(filterBtn, SIGNAL(clicked()), this, SLOT(setFilters()));
|
||||||
|
|
||||||
@ -234,7 +235,7 @@ void SMESHGUI_RemoveNodesDlg::ClickOnApply()
|
|||||||
bool aResult = false;
|
bool aResult = false;
|
||||||
try {
|
try {
|
||||||
SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
|
SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
|
||||||
aResult = aMeshEditor->RemoveNodes(anArrayOfIdeces.inout());
|
aResult = aMeshEditor->RemoveNodes(anArrayOfIdeces.in());
|
||||||
} catch (const SALOME::SALOME_Exception& S_ex) {
|
} catch (const SALOME::SALOME_Exception& S_ex) {
|
||||||
SalomeApp_Tools::QtCatchCorbaException(S_ex);
|
SalomeApp_Tools::QtCatchCorbaException(S_ex);
|
||||||
myEditCurrentArgument->clear();
|
myEditCurrentArgument->clear();
|
||||||
@ -317,9 +318,6 @@ void SMESHGUI_RemoveNodesDlg::onTextChange(const QString& theNewText)
|
|||||||
|
|
||||||
myNbOkNodes = 0;
|
myNbOkNodes = 0;
|
||||||
|
|
||||||
buttonOk->setEnabled(false);
|
|
||||||
buttonApply->setEnabled(false);
|
|
||||||
|
|
||||||
// hilight entered nodes
|
// hilight entered nodes
|
||||||
if(myActor){
|
if(myActor){
|
||||||
if(SMDS_Mesh* aMesh = myActor->GetObject()->GetMesh()){
|
if(SMDS_Mesh* aMesh = myActor->GetObject()->GetMesh()){
|
||||||
@ -341,12 +339,8 @@ void SMESHGUI_RemoveNodesDlg::onTextChange(const QString& theNewText)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (myNbOkNodes) {
|
|
||||||
buttonOk->setEnabled(true);
|
|
||||||
buttonApply->setEnabled(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
myBusy = false;
|
myBusy = false;
|
||||||
|
updateButtons();
|
||||||
}
|
}
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
@ -355,56 +349,51 @@ void SMESHGUI_RemoveNodesDlg::onTextChange(const QString& theNewText)
|
|||||||
//=================================================================================
|
//=================================================================================
|
||||||
void SMESHGUI_RemoveNodesDlg::SelectionIntoArgument()
|
void SMESHGUI_RemoveNodesDlg::SelectionIntoArgument()
|
||||||
{
|
{
|
||||||
if (myBusy) return;
|
if (myBusy) return; // busy
|
||||||
|
if (myFilterDlg && myFilterDlg->isVisible()) return; // filter dlg active
|
||||||
|
if (!GroupButtons->isEnabled()) return; // inactive
|
||||||
|
|
||||||
// clear
|
// clear
|
||||||
|
|
||||||
myNbOkNodes = false;
|
myNbOkNodes = 0;
|
||||||
myActor = 0;
|
myActor = 0;
|
||||||
|
|
||||||
myBusy = true;
|
myBusy = true;
|
||||||
myEditCurrentArgument->setText("");
|
myEditCurrentArgument->setText("");
|
||||||
myBusy = false;
|
myBusy = false;
|
||||||
|
|
||||||
if (!GroupButtons->isEnabled()) // inactive
|
|
||||||
return;
|
|
||||||
|
|
||||||
buttonOk->setEnabled(false);
|
|
||||||
buttonApply->setEnabled(false);
|
|
||||||
|
|
||||||
// get selected mesh
|
// get selected mesh
|
||||||
SALOME_ListIO aList;
|
SALOME_ListIO aList;
|
||||||
mySelectionMgr->selectedObjects(aList,SVTK_Viewer::Type());
|
mySelectionMgr->selectedObjects(aList,SVTK_Viewer::Type());
|
||||||
|
|
||||||
int nbSel = aList.Extent();
|
int nbSel = aList.Extent();
|
||||||
if (nbSel != 1)
|
if (nbSel == 1) {
|
||||||
return;
|
|
||||||
|
|
||||||
Handle(SALOME_InteractiveObject) anIO = aList.First();
|
Handle(SALOME_InteractiveObject) anIO = aList.First();
|
||||||
myMesh = SMESH::GetMeshByIO(anIO);
|
myMesh = SMESH::GetMeshByIO(anIO);
|
||||||
if (myMesh->_is_nil())
|
|
||||||
return;
|
|
||||||
|
|
||||||
myActor = SMESH::FindActorByEntry(anIO->getEntry());
|
if (!myMesh->_is_nil()) {
|
||||||
if (!myActor)
|
|
||||||
return;
|
|
||||||
|
|
||||||
// get selected nodes
|
myActor = SMESH::FindActorByEntry(anIO->getEntry());
|
||||||
|
if (myActor) {
|
||||||
|
|
||||||
QString aString = "";
|
// get selected nodes
|
||||||
int nbNodes = SMESH::GetNameOfSelectedNodes(mySelector,anIO,aString);
|
QString aString = "";
|
||||||
if(nbNodes < 1)
|
int nbNodes = SMESH::GetNameOfSelectedNodes(mySelector,anIO,aString);
|
||||||
return;
|
if (nbNodes > 0) {
|
||||||
myBusy = true;
|
myBusy = true;
|
||||||
myEditCurrentArgument->setText(aString);
|
myEditCurrentArgument->setText(aString);
|
||||||
myBusy = false;
|
myBusy = false;
|
||||||
|
|
||||||
|
// OK
|
||||||
|
|
||||||
|
myNbOkNodes = nbNodes;
|
||||||
|
} // if (nbNodes > 0)
|
||||||
|
} // if (myActor)
|
||||||
|
} // if (!myMesh->_is_nil())
|
||||||
|
} // if (nbSel == 1)
|
||||||
|
|
||||||
// OK
|
updateButtons();
|
||||||
|
|
||||||
myNbOkNodes = true;
|
|
||||||
|
|
||||||
buttonOk->setEnabled(true);
|
|
||||||
buttonApply->setEnabled(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
@ -531,3 +520,13 @@ void SMESHGUI_RemoveNodesDlg::setFilters()
|
|||||||
|
|
||||||
myFilterDlg->show();
|
myFilterDlg->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=================================================================================
|
||||||
|
// function : updateButtons
|
||||||
|
// purpose : enable / disable control buttons
|
||||||
|
//=================================================================================
|
||||||
|
void SMESHGUI_RemoveNodesDlg::updateButtons()
|
||||||
|
{
|
||||||
|
buttonOk->setEnabled(myNbOkNodes > 0);
|
||||||
|
buttonApply->setEnabled(myNbOkNodes > 0);
|
||||||
|
}
|
||||||
|
@ -107,6 +107,7 @@ private slots:
|
|||||||
void ActivateThisDialog();
|
void ActivateThisDialog();
|
||||||
void onTextChange( const QString& );
|
void onTextChange( const QString& );
|
||||||
void setFilters();
|
void setFilters();
|
||||||
|
void updateButtons();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // SMESHGUI_REMOVENODESDLG_H
|
#endif // SMESHGUI_REMOVENODESDLG_H
|
||||||
|
Loading…
Reference in New Issue
Block a user