#include <SMESHGUI_RemoveElementsDlg.h>

Definition at line 56 of file SMESHGUI_RemoveElementsDlg.h.
| SMESHGUI_RemoveElementsDlg::SMESHGUI_RemoveElementsDlg | ( | SMESHGUI * | theModule | ) |
Definition at line 81 of file SMESHGUI_RemoveElementsDlg.cxx.
References SMESH.GetResourceMgr(), batchmode_smesh.Init(), MARGIN, and SPACING.
: QDialog(SMESH::GetDesktop(theModule)), mySelector(SMESH::GetViewWindow(theModule)->GetSelector()), mySelectionMgr(SMESH::GetSelectionMgr(theModule)), mySMESHGUI(theModule), myBusy(false), myFilterDlg(0) { setModal( false ); setAttribute( Qt::WA_DeleteOnClose, true ); setWindowTitle(tr("SMESH_REMOVE_ELEMENTS_TITLE")); setSizeGripEnabled(true); QPixmap image0 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_DLG_REM_ELEMENT"))); QPixmap image1 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SELECT"))); QVBoxLayout* SMESHGUI_RemoveElementsDlgLayout = new QVBoxLayout(this); SMESHGUI_RemoveElementsDlgLayout->setSpacing(SPACING); SMESHGUI_RemoveElementsDlgLayout->setMargin(MARGIN); /***************************************************************/ GroupConstructors = new QGroupBox(tr("SMESH_ELEMENTS"), this); QButtonGroup* ButtonGroup = new QButtonGroup(this); QHBoxLayout* GroupConstructorsLayout = new QHBoxLayout(GroupConstructors); GroupConstructorsLayout->setSpacing(SPACING); GroupConstructorsLayout->setMargin(MARGIN); Constructor1 = new QRadioButton(GroupConstructors); Constructor1->setIcon(image0); Constructor1->setChecked(true); GroupConstructorsLayout->addWidget(Constructor1); ButtonGroup->addButton(Constructor1, 0); /***************************************************************/ GroupC1 = new QGroupBox(tr("SMESH_REMOVE"), this); QHBoxLayout* GroupC1Layout = new QHBoxLayout(GroupC1); GroupC1Layout->setSpacing(SPACING); GroupC1Layout->setMargin(MARGIN); TextLabelC1A1 = new QLabel(tr("SMESH_ID_ELEMENTS"), GroupC1); SelectButtonC1A1 = new QPushButton(GroupC1); SelectButtonC1A1->setIcon(image1); LineEditC1A1 = new QLineEdit(GroupC1); LineEditC1A1->setValidator(new SMESHGUI_IdValidator(this)); LineEditC1A1->setMaxLength(-1); QPushButton* filterBtn = new QPushButton( tr( "SMESH_BUT_FILTER" ), GroupC1 ); connect(filterBtn, SIGNAL(clicked()), this, SLOT(setFilters())); GroupC1Layout->addWidget(TextLabelC1A1); GroupC1Layout->addWidget(SelectButtonC1A1); GroupC1Layout->addWidget(LineEditC1A1); GroupC1Layout->addWidget(filterBtn ); /***************************************************************/ GroupButtons = new QGroupBox(this); QHBoxLayout* GroupButtonsLayout = new QHBoxLayout(GroupButtons); GroupButtonsLayout->setSpacing(SPACING); GroupButtonsLayout->setMargin(MARGIN); buttonOk = new QPushButton(tr("SMESH_BUT_APPLY_AND_CLOSE"), GroupButtons); buttonOk->setAutoDefault(true); buttonOk->setDefault(true); buttonApply = new QPushButton(tr("SMESH_BUT_APPLY"), GroupButtons); buttonApply->setAutoDefault(true); buttonCancel = new QPushButton(tr("SMESH_BUT_CLOSE"), GroupButtons); buttonCancel->setAutoDefault(true); buttonHelp = new QPushButton(tr("SMESH_BUT_HELP"), GroupButtons); buttonHelp->setAutoDefault(true); GroupButtonsLayout->addWidget(buttonOk); GroupButtonsLayout->addSpacing(10); GroupButtonsLayout->addWidget(buttonApply); GroupButtonsLayout->addSpacing(10); GroupButtonsLayout->addStretch(); GroupButtonsLayout->addWidget(buttonCancel); GroupButtonsLayout->addWidget(buttonHelp); /***************************************************************/ SMESHGUI_RemoveElementsDlgLayout->addWidget(GroupConstructors); SMESHGUI_RemoveElementsDlgLayout->addWidget(GroupC1); SMESHGUI_RemoveElementsDlgLayout->addWidget(GroupButtons); myHelpFileName = "removing_nodes_and_elements_page.html#removing_elements_anchor"; Init(); /* Initialisations */ }
| SMESHGUI_RemoveElementsDlg::~SMESHGUI_RemoveElementsDlg | ( | ) |
Definition at line 173 of file SMESHGUI_RemoveElementsDlg.cxx.
References myFilterDlg.
{
if ( myFilterDlg ) {
myFilterDlg->setParent( 0 );
delete myFilterDlg;
myFilterDlg = 0;
}
}
| void SMESHGUI_RemoveElementsDlg::ActivateThisDialog | ( | ) | [private, slot] |
Definition at line 433 of file SMESHGUI_RemoveElementsDlg.cxx.
References SMESHGUI.EmitSignalDeactivateDialog(), SMESH.GetViewWindow(), GroupButtons, GroupC1, GroupConstructors, mySMESHGUI, SelectionIntoArgument(), and SMESHGUI.SetActiveDialogBox().
Referenced by enterEvent().
{
/* Emit a signal to deactivate the active dialog */
mySMESHGUI->EmitSignalDeactivateDialog();
GroupConstructors->setEnabled(true);
GroupC1->setEnabled(true);
GroupButtons->setEnabled(true);
mySMESHGUI->SetActiveDialogBox((QDialog*)this); // ??
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
aViewWindow->SetSelectionMode(CellSelection);
SelectionIntoArgument(); // ??
}
| void SMESHGUI_RemoveElementsDlg::ClickOnApply | ( | ) | [private, slot] |
Definition at line 221 of file SMESHGUI_RemoveElementsDlg.cxx.
References SMESHGUI.isActiveStudyLocked(), SMESHGUI.Modified(), myEditCurrentArgument, myMesh, myNbOkElements, mySelector, mySMESHGUI, and SMESH.UpdateView().
Referenced by ClickOnOk(), and Init().
{
if (mySMESHGUI->isActiveStudyLocked())
return;
if (myNbOkElements) {
QStringList aListId = myEditCurrentArgument->text().split(" ", QString::SkipEmptyParts);
SMESH::long_array_var anArrayOfIdeces = new SMESH::long_array;
anArrayOfIdeces->length(aListId.count());
for (int i = 0; i < aListId.count(); i++)
anArrayOfIdeces[i] = aListId[ i ].toInt();
bool aResult = false;
try {
SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
aResult = aMeshEditor->RemoveElements(anArrayOfIdeces.in());
} catch (const SALOME::SALOME_Exception& S_ex) {
SalomeApp_Tools::QtCatchCorbaException(S_ex);
myEditCurrentArgument->clear();
} catch (...){
myEditCurrentArgument->clear();
}
if (aResult) {
myEditCurrentArgument->clear();
mySelector->ClearIndex();
SMESH::UpdateView();
SMESHGUI::Modified();
}
}
}
| void SMESHGUI_RemoveElementsDlg::ClickOnCancel | ( | ) | [private, slot] |
Definition at line 267 of file SMESHGUI_RemoveElementsDlg.cxx.
References SMESH.GetCurrentVtkView(), SMESH.GetViewWindow(), mySelectionMgr, mySMESHGUI, SMESH.RemoveFilters(), and SMESHGUI.ResetState().
Referenced by ClickOnOk(), closeEvent(), hideEvent(), and Init().
{
if (SMESH::GetCurrentVtkView())
SMESH::RemoveFilters(); // PAL6938 -- clean all mesh entity filters
//mySelectionMgr->clearSelected();
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
aViewWindow->SetSelectionMode(ActorSelection);
disconnect(mySelectionMgr, 0, this, 0);
mySelectionMgr->clearFilters();
mySMESHGUI->ResetState();
reject();
}
| void SMESHGUI_RemoveElementsDlg::ClickOnHelp | ( | ) | [private, slot] |
Definition at line 284 of file SMESHGUI_RemoveElementsDlg.cxx.
References myHelpFileName, and mySMESHGUI.
Referenced by Init(), and keyPressEvent().
{
LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication());
if (app)
app->onHelpContextModule(mySMESHGUI ? app->moduleName(mySMESHGUI->moduleName()) : QString(""), myHelpFileName);
else {
QString platform;
#ifdef WIN32
platform = "winapplication";
#else
platform = "application";
#endif
SUIT_MessageBox::warning(this, tr("WRN_WARNING"),
tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
arg(app->resourceMgr()->stringValue("ExternalBrowser",
platform)).
arg(myHelpFileName));
}
}
| void SMESHGUI_RemoveElementsDlg::ClickOnOk | ( | ) | [private, slot] |
Definition at line 257 of file SMESHGUI_RemoveElementsDlg.cxx.
References ClickOnApply(), and ClickOnCancel().
Referenced by Init().
{
ClickOnApply();
ClickOnCancel();
}
| void SMESHGUI_RemoveElementsDlg::closeEvent | ( | QCloseEvent * | ) | [private] |
Definition at line 464 of file SMESHGUI_RemoveElementsDlg.cxx.
References ClickOnCancel().
{
/* same than click on cancel button */
ClickOnCancel();
}
| void SMESHGUI_RemoveElementsDlg::DeactivateActiveDialog | ( | ) | [private, slot] |
Definition at line 418 of file SMESHGUI_RemoveElementsDlg.cxx.
References GroupButtons, GroupC1, GroupConstructors, mySMESHGUI, SMESHGUI.ResetState(), and SMESHGUI.SetActiveDialogBox().
Referenced by Init().
{
if (GroupConstructors->isEnabled()) {
GroupConstructors->setEnabled(false);
GroupC1->setEnabled(false);
GroupButtons->setEnabled(false);
mySMESHGUI->ResetState(); // ??
mySMESHGUI->SetActiveDialogBox(0); // ??
}
}
| void SMESHGUI_RemoveElementsDlg::enterEvent | ( | QEvent * | ) | [private] |
Definition at line 454 of file SMESHGUI_RemoveElementsDlg.cxx.
References ActivateThisDialog(), and GroupConstructors.
{
if (!GroupConstructors->isEnabled())
ActivateThisDialog();
}
| void SMESHGUI_RemoveElementsDlg::hideEvent | ( | QHideEvent * | ) | [private] |
Definition at line 474 of file SMESHGUI_RemoveElementsDlg.cxx.
References ClickOnCancel().
{
if (!isMinimized())
ClickOnCancel();
}
| void SMESHGUI_RemoveElementsDlg::Init | ( | ) | [private] |
Definition at line 186 of file SMESHGUI_RemoveElementsDlg.cxx.
References buttonApply, buttonCancel, buttonHelp, buttonOk, ClickOnApply(), ClickOnCancel(), ClickOnHelp(), ClickOnOk(), Constructor1, DeactivateActiveDialog(), SMESH.GetViewWindow(), LineEditC1A1, myActor, myBusy, myConstructorId, myEditCurrentArgument, myNbOkElements, mySelectionMgr, mySMESHGUI, onTextChange(), SelectButtonC1A1, SelectionIntoArgument(), SMESHGUI.SetActiveDialogBox(), and SetEditCurrentArgument().
{
myConstructorId = 0;
Constructor1->setChecked(true);
myEditCurrentArgument = LineEditC1A1;
myNbOkElements = 0;
mySMESHGUI->SetActiveDialogBox((QDialog*)this);
myActor = 0;
myBusy = false;
/* signals and slots connections */
connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk()));
connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel()));
connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply()));
connect(buttonHelp, SIGNAL(clicked()), this, SLOT(ClickOnHelp()));
connect(SelectButtonC1A1, SIGNAL (clicked()), this, SLOT(SetEditCurrentArgument()));
connect(mySMESHGUI, SIGNAL (SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog()));
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&)));
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
aViewWindow->SetSelectionMode(CellSelection);
SelectionIntoArgument();
}
| void SMESHGUI_RemoveElementsDlg::keyPressEvent | ( | QKeyEvent * | e | ) | [private] |
Definition at line 484 of file SMESHGUI_RemoveElementsDlg.cxx.
References ClickOnHelp().
{
QDialog::keyPressEvent( e );
if ( e->isAccepted() )
return;
if ( e->key() == Qt::Key_F1 ) {
e->accept();
ClickOnHelp();
}
}
| void SMESHGUI_RemoveElementsDlg::onTextChange | ( | const QString & | theNewText | ) | [private, slot] |
Definition at line 308 of file SMESHGUI_RemoveElementsDlg.cxx.
References SMESH_Actor.GetObject(), SMESH.GetViewWindow(), Handle(), myActor, myBusy, myNbOkElements, mySelector, mySMESHGUI, and updateButtons().
Referenced by Init().
{
if (myBusy) return;
myBusy = true;
myNbOkElements = 0;
// hilight entered elements
if(myActor){
if(SMDS_Mesh* aMesh = myActor->GetObject()->GetMesh()){
Handle(SALOME_InteractiveObject) anIO = myActor->getIO();
TColStd_MapOfInteger newIndices;
QStringList aListId = theNewText.split(" ", QString::SkipEmptyParts);
for (int i = 0; i < aListId.count(); i++) {
if(const SMDS_MeshElement *anElem = aMesh->FindElement(aListId[i].toInt())) {
newIndices.Add(anElem->GetID());
myNbOkElements++;
}
}
mySelector->AddOrRemoveIndex(anIO,newIndices,false);
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
aViewWindow->highlight(anIO,true,true);
}
}
myBusy = false;
updateButtons();
}
| void SMESHGUI_RemoveElementsDlg::SelectionIntoArgument | ( | ) | [private, slot] |
Definition at line 344 of file SMESHGUI_RemoveElementsDlg.cxx.
References SMESH.FindActorByEntry(), SMESH.GetMeshByIO(), SMESH.GetNameOfSelectedElements(), GroupButtons, Handle(), myActor, myBusy, myEditCurrentArgument, myFilterDlg, myMesh, myNbOkElements, mySelectionMgr, mySelector, and updateButtons().
Referenced by ActivateThisDialog(), Init(), and SetEditCurrentArgument().
{
if (myBusy) return; // busy
if (myFilterDlg && myFilterDlg->isVisible()) return; // filter digl active
if (!GroupButtons->isEnabled()) return; // inactive
// clear
myNbOkElements = 0;
myActor = 0;
myBusy = true;
myEditCurrentArgument->setText("");
myBusy = false;
// get selected mesh
SALOME_ListIO aList;
mySelectionMgr->selectedObjects(aList,SVTK_Viewer::Type());
int nbSel = aList.Extent();
if (nbSel == 1) {
Handle(SALOME_InteractiveObject) anIO = aList.First();
myMesh = SMESH::GetMeshByIO(anIO);
if (!myMesh->_is_nil()) {
myActor = SMESH::FindActorByEntry(anIO->getEntry());
if (myActor) {
// get selected nodes
QString aString = "";
int nbElems = SMESH::GetNameOfSelectedElements(mySelector,anIO,aString);
if (nbElems > 0) {
myBusy = true;
myEditCurrentArgument->setText(aString);
myBusy = false;
// OK
myNbOkElements = nbElems;
} // if (nbElems > 0)
} // if (myActor)
} // if (!myMesh->_is_nil())
} // if (nbSel == 1) {
updateButtons();
}
| void SMESHGUI_RemoveElementsDlg::SetEditCurrentArgument | ( | ) | [private, slot] |
Definition at line 398 of file SMESHGUI_RemoveElementsDlg.cxx.
References LineEditC1A1, myConstructorId, myEditCurrentArgument, SelectButtonC1A1, and SelectionIntoArgument().
Referenced by Init().
{
QPushButton* send = (QPushButton*)sender();
switch (myConstructorId) {
case 0: /* default constructor */
{
if(send == SelectButtonC1A1) {
LineEditC1A1->setFocus();
myEditCurrentArgument = LineEditC1A1;
}
SelectionIntoArgument();
break;
}
}
}
| void SMESHGUI_RemoveElementsDlg::setFilters | ( | ) | [private, slot] |
Definition at line 500 of file SMESHGUI_RemoveElementsDlg.cxx.
References SMESH.ALL, LineEditC1A1, myFilterDlg, myMesh, mySMESHGUI, SMESHGUI_FilterDlg.SetMesh(), SMESHGUI_FilterDlg.SetSelection(), and SMESHGUI_FilterDlg.SetSourceWg().
{
if(myMesh->_is_nil()) {
SUIT_MessageBox::critical(this,
tr("SMESH_ERROR"),
tr("NO_MESH_SELECTED"));
return;
}
if ( !myFilterDlg )
myFilterDlg = new SMESHGUI_FilterDlg( mySMESHGUI, SMESH::ALL );
myFilterDlg->SetSelection();
myFilterDlg->SetMesh( myMesh );
myFilterDlg->SetSourceWg( LineEditC1A1 );
myFilterDlg->show();
}
| void SMESHGUI_RemoveElementsDlg::updateButtons | ( | ) | [private, slot] |
Definition at line 522 of file SMESHGUI_RemoveElementsDlg.cxx.
References buttonApply, buttonOk, and myNbOkElements.
Referenced by onTextChange(), and SelectionIntoArgument().
{
buttonOk->setEnabled(myNbOkElements > 0);
buttonApply->setEnabled(myNbOkElements > 0);
}
QPushButton* SMESHGUI_RemoveElementsDlg.buttonApply [private] |
Definition at line 88 of file SMESHGUI_RemoveElementsDlg.h.
Referenced by Init(), and updateButtons().
QPushButton* SMESHGUI_RemoveElementsDlg.buttonCancel [private] |
Definition at line 87 of file SMESHGUI_RemoveElementsDlg.h.
Referenced by Init().
QPushButton* SMESHGUI_RemoveElementsDlg.buttonHelp [private] |
Definition at line 89 of file SMESHGUI_RemoveElementsDlg.h.
Referenced by Init().
QPushButton* SMESHGUI_RemoveElementsDlg.buttonOk [private] |
Definition at line 86 of file SMESHGUI_RemoveElementsDlg.h.
Referenced by Init(), and updateButtons().
QRadioButton* SMESHGUI_RemoveElementsDlg.Constructor1 [private] |
Definition at line 84 of file SMESHGUI_RemoveElementsDlg.h.
Referenced by Init().
QGroupBox* SMESHGUI_RemoveElementsDlg.GroupButtons [private] |
Definition at line 85 of file SMESHGUI_RemoveElementsDlg.h.
Referenced by ActivateThisDialog(), DeactivateActiveDialog(), and SelectionIntoArgument().
QGroupBox* SMESHGUI_RemoveElementsDlg.GroupC1 [private] |
Definition at line 90 of file SMESHGUI_RemoveElementsDlg.h.
Referenced by ActivateThisDialog(), and DeactivateActiveDialog().
Definition at line 83 of file SMESHGUI_RemoveElementsDlg.h.
Referenced by ActivateThisDialog(), DeactivateActiveDialog(), and enterEvent().
QLineEdit* SMESHGUI_RemoveElementsDlg.LineEditC1A1 [private] |
Definition at line 93 of file SMESHGUI_RemoveElementsDlg.h.
Referenced by Init(), SetEditCurrentArgument(), and setFilters().
SMESH_Actor* SMESHGUI_RemoveElementsDlg.myActor [private] |
Definition at line 81 of file SMESHGUI_RemoveElementsDlg.h.
Referenced by Init(), onTextChange(), and SelectionIntoArgument().
bool SMESHGUI_RemoveElementsDlg.myBusy [private] |
Definition at line 79 of file SMESHGUI_RemoveElementsDlg.h.
Referenced by Init(), onTextChange(), and SelectionIntoArgument().
Definition at line 76 of file SMESHGUI_RemoveElementsDlg.h.
Referenced by Init(), and SetEditCurrentArgument().
QLineEdit* SMESHGUI_RemoveElementsDlg.myEditCurrentArgument [private] |
Definition at line 77 of file SMESHGUI_RemoveElementsDlg.h.
Referenced by ClickOnApply(), Init(), SelectionIntoArgument(), and SetEditCurrentArgument().
Definition at line 97 of file SMESHGUI_RemoveElementsDlg.h.
Referenced by SelectionIntoArgument(), setFilters(), and ~SMESHGUI_RemoveElementsDlg().
QString SMESHGUI_RemoveElementsDlg.myHelpFileName [private] |
Definition at line 95 of file SMESHGUI_RemoveElementsDlg.h.
Referenced by ClickOnHelp().
SMESH::SMESH_Mesh_var SMESHGUI_RemoveElementsDlg.myMesh [private] |
Definition at line 80 of file SMESHGUI_RemoveElementsDlg.h.
Referenced by ClickOnApply(), SelectionIntoArgument(), and setFilters().
int SMESHGUI_RemoveElementsDlg.myNbOkElements [private] |
Definition at line 75 of file SMESHGUI_RemoveElementsDlg.h.
Referenced by ClickOnApply(), Init(), onTextChange(), SelectionIntoArgument(), and updateButtons().
LightApp_SelectionMgr* SMESHGUI_RemoveElementsDlg.mySelectionMgr [private] |
Definition at line 71 of file SMESHGUI_RemoveElementsDlg.h.
Referenced by ClickOnCancel(), Init(), and SelectionIntoArgument().
SVTK_Selector* SMESHGUI_RemoveElementsDlg.mySelector [private] |
Definition at line 72 of file SMESHGUI_RemoveElementsDlg.h.
Referenced by ClickOnApply(), onTextChange(), and SelectionIntoArgument().
SMESHGUI* SMESHGUI_RemoveElementsDlg.mySMESHGUI [private] |
Definition at line 73 of file SMESHGUI_RemoveElementsDlg.h.
Referenced by ActivateThisDialog(), ClickOnApply(), ClickOnCancel(), ClickOnHelp(), DeactivateActiveDialog(), Init(), onTextChange(), and setFilters().
QPushButton* SMESHGUI_RemoveElementsDlg.SelectButtonC1A1 [private] |
Definition at line 92 of file SMESHGUI_RemoveElementsDlg.h.
Referenced by Init(), and SetEditCurrentArgument().
QLabel* SMESHGUI_RemoveElementsDlg.TextLabelC1A1 [private] |
Definition at line 91 of file SMESHGUI_RemoveElementsDlg.h.