Version: 6.3.1
Public Member Functions | Private Slots | Private Member Functions | Private Attributes

SMESHGUI_RenumberingDlg Class Reference

#include <SMESHGUI_RenumberingDlg.h>

Inheritance diagram for SMESHGUI_RenumberingDlg:
Inheritance graph
[legend]

Public Member Functions

 SMESHGUI_RenumberingDlg (SMESHGUI *, const int=0)
 ~SMESHGUI_RenumberingDlg ()

Private Slots

void ClickOnOk ()
void ClickOnCancel ()
void ClickOnApply ()
void ClickOnHelp ()
void SetEditCurrentArgument ()
void SelectionIntoArgument ()
void DeactivateActiveDialog ()
void ActivateThisDialog ()

Private Member Functions

void Init ()
void closeEvent (QCloseEvent *)
void enterEvent (QEvent *)
void hideEvent (QHideEvent *)
void keyPressEvent (QKeyEvent *)

Private Attributes

SMESHGUImySMESHGUI
LightApp_SelectionMgr * mySelectionMgr
int myConstructorId
QLineEdit * myEditCurrentArgument
int myUnit
SMESH::SMESH_Mesh_var myMesh
SUIT_SelectionFiltermyMeshFilter
QGroupBoxGroupConstructors
QRadioButton * Constructor1
QGroupBoxGroupButtons
QPushButton * buttonOk
QPushButton * buttonCancel
QPushButton * buttonApply
QPushButton * buttonHelp
QGroupBoxGroupMesh
QLabel * TextLabelMesh
QPushButton * SelectButton
QLineEdit * LineEditMesh
QString myHelpFileName

Detailed Description

Definition at line 53 of file SMESHGUI_RenumberingDlg.h.


Constructor & Destructor Documentation

SMESHGUI_RenumberingDlg::SMESHGUI_RenumberingDlg ( SMESHGUI theModule,
const int  unit = 0 
)

Definition at line 72 of file SMESHGUI_RenumberingDlg.cxx.

References buttonApply, buttonCancel, buttonHelp, buttonOk, Constructor1, SMESH.GetResourceMgr(), GroupButtons, GroupConstructors, GroupMesh, Init(), LineEditMesh, MARGIN, myHelpFileName, mySMESHGUI, myUnit, SelectButton, SPACING, and TextLabelMesh.

  : QDialog( SMESH::GetDesktop( theModule ) ),
    mySMESHGUI( theModule ),
    mySelectionMgr( SMESH::GetSelectionMgr( theModule ) )
{
  myUnit = unit;

  setModal(false);
  setAttribute(Qt::WA_DeleteOnClose, true);
  setWindowTitle(unit == 0 ? 
                 tr("SMESH_RENUMBERING_NODES_TITLE") : 
                 tr("SMESH_RENUMBERING_ELEMENTS_TITLE"));
  setSizeGripEnabled(true);

  SUIT_ResourceMgr* resMgr = SMESH::GetResourceMgr( mySMESHGUI );
  QPixmap image0(resMgr->loadPixmap("SMESH", unit == 0 ? 
                                    tr("ICON_DLG_RENUMBERING_NODES") : 
                                    tr("ICON_DLG_RENUMBERING_ELEMENTS")));
  QPixmap image1(resMgr->loadPixmap("SMESH",tr("ICON_SELECT")));

  QVBoxLayout* SMESHGUI_RenumberingDlgLayout = new QVBoxLayout(this);
  SMESHGUI_RenumberingDlgLayout->setSpacing(SPACING);
  SMESHGUI_RenumberingDlgLayout->setMargin(MARGIN);

  /***************************************************************/
  GroupConstructors = new QGroupBox(unit == 0 ? 
                                    tr("SMESH_NODES") :
                                    tr("SMESH_ELEMENTS"), 
                                    this);
  myHelpFileName = unit == 0 ? 
    "renumbering_nodes_and_elements_page.html#renumbering_nodes_anchor" :
    "renumbering_nodes_and_elements_page.html#renumbering_elements_anchor";

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

  /***************************************************************/
  GroupMesh = new QGroupBox(tr("SMESH_RENUMBERING"), this);
  QHBoxLayout* GroupMeshLayout = new QHBoxLayout(GroupMesh);
  GroupMeshLayout->setMargin(MARGIN);
  GroupMeshLayout->setSpacing(SPACING);

  TextLabelMesh = new QLabel(tr("SMESH_MESH"), GroupMesh);
  SelectButton = new QPushButton(GroupMesh);
  SelectButton->setIcon(image1);
  LineEditMesh = new QLineEdit(GroupMesh);
  LineEditMesh->setReadOnly(true);

  GroupMeshLayout->addWidget(TextLabelMesh);
  GroupMeshLayout->addWidget(SelectButton);
  GroupMeshLayout->addWidget(LineEditMesh);

  /***************************************************************/
  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_RenumberingDlgLayout->addWidget(GroupConstructors);
  SMESHGUI_RenumberingDlgLayout->addWidget(GroupMesh);
  SMESHGUI_RenumberingDlgLayout->addWidget(GroupButtons);

  Init(); /* Initialisations */
}
SMESHGUI_RenumberingDlg::~SMESHGUI_RenumberingDlg ( )

Definition at line 169 of file SMESHGUI_RenumberingDlg.cxx.

{
}

Member Function Documentation

void SMESHGUI_RenumberingDlg::ActivateThisDialog ( ) [private, slot]

Definition at line 372 of file SMESHGUI_RenumberingDlg.cxx.

References SMESHGUI.EmitSignalDeactivateDialog(), GroupButtons, GroupConstructors, GroupMesh, mySMESHGUI, SelectionIntoArgument(), and SMESHGUI.SetActiveDialogBox().

Referenced by enterEvent().

{
  /* Emit a signal to deactivate the active dialog */
  mySMESHGUI->EmitSignalDeactivateDialog();
  GroupConstructors->setEnabled(true);
  GroupMesh->setEnabled(true);
  GroupButtons->setEnabled(true);

  mySMESHGUI->SetActiveDialogBox((QDialog*)this);
  SelectionIntoArgument();
}
void SMESHGUI_RenumberingDlg::ClickOnApply ( ) [private, slot]

Definition at line 211 of file SMESHGUI_RenumberingDlg.cxx.

References SMESH.FindActorByObject(), SMESH_Actor.GetCellsLabeled(), SMESH_Actor.GetPointsLabeled(), SMESHGUI.isActiveStudyLocked(), SMESHGUI.Modified(), myMesh, mySMESHGUI, myUnit, SMESH_Actor.SetCellsLabeled(), SMESH_Actor.SetPointsLabeled(), and SMESH.UpdateView().

Referenced by ClickOnOk(), and Init().

{
  if (mySMESHGUI->isActiveStudyLocked())
    return;

  if (!myMesh->_is_nil()) {
    try {
      SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
      SMESH_Actor* anActor = SMESH::FindActorByObject(myMesh);
      bool isUnitsLabeled = false;
      
      if (myUnit == 0 && anActor) {
        isUnitsLabeled = anActor->GetPointsLabeled();
        if (isUnitsLabeled)  anActor->SetPointsLabeled(false);
      }
      else if (myUnit == 1 && anActor) {
        isUnitsLabeled = anActor->GetCellsLabeled();
        if (isUnitsLabeled)  anActor->SetCellsLabeled(false);
      }
      
      SUIT_OverrideCursor aWaitCursor;
      if (myUnit == 0) {
        aMeshEditor->RenumberNodes();
        if (isUnitsLabeled && anActor) anActor->SetPointsLabeled(true);
      }
      else if (myUnit == 1) {
        aMeshEditor->RenumberElements();
        if (isUnitsLabeled && anActor) anActor->SetCellsLabeled(true);
      }
    }
    catch(...) {
    }
    
    //mySelectionMgr->clearSelected();
    SMESH::UpdateView();
    SMESHGUI::Modified();
  }
}
void SMESHGUI_RenumberingDlg::ClickOnCancel ( ) [private, slot]

Definition at line 264 of file SMESHGUI_RenumberingDlg.cxx.

References mySelectionMgr, mySMESHGUI, and SMESHGUI.ResetState().

Referenced by ClickOnOk(), closeEvent(), hideEvent(), and Init().

{
  //mySelectionMgr->clearSelected();
  mySelectionMgr->clearFilters();
  disconnect(mySelectionMgr, 0, this, 0);
  mySMESHGUI->ResetState();
  reject();
}
void SMESHGUI_RenumberingDlg::ClickOnHelp ( ) [private, slot]

Definition at line 277 of file SMESHGUI_RenumberingDlg.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_RenumberingDlg::ClickOnOk ( ) [private, slot]

Definition at line 254 of file SMESHGUI_RenumberingDlg.cxx.

References ClickOnApply(), and ClickOnCancel().

Referenced by Init().

void SMESHGUI_RenumberingDlg::closeEvent ( QCloseEvent *  e) [private]

Definition at line 399 of file SMESHGUI_RenumberingDlg.cxx.

References ClickOnCancel().

{
  /* same than click on cancel button */
  ClickOnCancel();
}
void SMESHGUI_RenumberingDlg::DeactivateActiveDialog ( ) [private, slot]

Definition at line 357 of file SMESHGUI_RenumberingDlg.cxx.

References GroupButtons, GroupConstructors, GroupMesh, mySMESHGUI, SMESHGUI.ResetState(), and SMESHGUI.SetActiveDialogBox().

Referenced by Init().

{
  if (GroupConstructors->isEnabled()) {
    GroupConstructors->setEnabled(false);
    GroupMesh->setEnabled(false);
    GroupButtons->setEnabled(false);
    mySMESHGUI->ResetState();
    mySMESHGUI->SetActiveDialogBox(0);
  }
}
void SMESHGUI_RenumberingDlg::enterEvent ( QEvent *  e) [private]

Definition at line 388 of file SMESHGUI_RenumberingDlg.cxx.

References ActivateThisDialog(), and GroupConstructors.

{
  if (GroupConstructors->isEnabled())
    return;
  ActivateThisDialog();
}
void SMESHGUI_RenumberingDlg::hideEvent ( QHideEvent *  e) [private]

Definition at line 409 of file SMESHGUI_RenumberingDlg.cxx.

References ClickOnCancel().

{
  if (!isMinimized())
    ClickOnCancel();
}
void SMESHGUI_RenumberingDlg::Init ( ) [private]

Definition at line 177 of file SMESHGUI_RenumberingDlg.cxx.

References buttonApply, buttonCancel, buttonHelp, buttonOk, ClickOnApply(), ClickOnCancel(), ClickOnHelp(), ClickOnOk(), Constructor1, DeactivateActiveDialog(), LineEditMesh, myConstructorId, myEditCurrentArgument, myMesh, myMeshFilter, mySelectionMgr, mySMESHGUI, SelectButton, SelectionIntoArgument(), SMESHGUI.SetActiveDialogBox(), and SetEditCurrentArgument().

Referenced by SMESHGUI_RenumberingDlg().

{
  myConstructorId = 0;
  Constructor1->setChecked(true);
  mySMESHGUI->SetActiveDialogBox((QDialog*)this);

  myMesh = SMESH::SMESH_Mesh::_nil();

  myMeshFilter = new SMESH_TypeFilter (MESH);

  /* 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(SelectButton, 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()));

  myEditCurrentArgument = LineEditMesh;
  LineEditMesh->setFocus();
  mySelectionMgr->clearFilters();
  mySelectionMgr->installFilter(myMeshFilter);

  SelectionIntoArgument();
}
void SMESHGUI_RenumberingDlg::keyPressEvent ( QKeyEvent *  e) [private]

Definition at line 419 of file SMESHGUI_RenumberingDlg.cxx.

References ClickOnHelp().

{
  QDialog::keyPressEvent( e );
  if ( e->isAccepted() )
    return;

  if ( e->key() == Qt::Key_F1 ) {
    e->accept();
    ClickOnHelp();
  }
}
void SMESHGUI_RenumberingDlg::SelectionIntoArgument ( ) [private, slot]

Definition at line 301 of file SMESHGUI_RenumberingDlg.cxx.

References buttonApply, buttonOk, SMESH.GetNameOfSelectedIObjects(), GroupButtons, Handle(), LineEditMesh, myEditCurrentArgument, myMesh, and mySelectionMgr.

Referenced by ActivateThisDialog(), Init(), and SetEditCurrentArgument().

{
  if (!GroupButtons->isEnabled()) // inactive
    return;

  QString aString = "";

  SALOME_ListIO aList;
  mySelectionMgr->selectedObjects(aList);
  int nbSel = SMESH::GetNameOfSelectedIObjects(mySelectionMgr, aString);

  if (myEditCurrentArgument == LineEditMesh) {
    // mesh
    if (nbSel != 1) {
      myMesh = SMESH::SMESH_Mesh::_nil();
      aString = "";
    } else {
      Handle(SALOME_InteractiveObject) IO = aList.First();
      myMesh = SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(IO);
      if (myMesh->_is_nil())
        aString = "";
    }
  }

  myEditCurrentArgument->setText(aString);

  bool isEnabled = (!myMesh->_is_nil());
  buttonOk->setEnabled(isEnabled);
  buttonApply->setEnabled(isEnabled);
}
void SMESHGUI_RenumberingDlg::SetEditCurrentArgument ( ) [private, slot]

Definition at line 336 of file SMESHGUI_RenumberingDlg.cxx.

References LineEditMesh, myConstructorId, myEditCurrentArgument, SelectButton, and SelectionIntoArgument().

Referenced by Init().

{
  QPushButton* send = (QPushButton*)sender();
  switch (myConstructorId)
    {
    case 0: /* default constructor */
      {
        if(send == SelectButton) {
          LineEditMesh->setFocus();
          myEditCurrentArgument = LineEditMesh;
        }
        SelectionIntoArgument();
        break;
      }
    }
}

Field Documentation

QPushButton* SMESHGUI_RenumberingDlg.buttonApply [private]

Definition at line 83 of file SMESHGUI_RenumberingDlg.h.

Referenced by Init(), SelectionIntoArgument(), and SMESHGUI_RenumberingDlg().

QPushButton* SMESHGUI_RenumberingDlg.buttonCancel [private]

Definition at line 82 of file SMESHGUI_RenumberingDlg.h.

Referenced by Init(), and SMESHGUI_RenumberingDlg().

QPushButton* SMESHGUI_RenumberingDlg.buttonHelp [private]

Definition at line 84 of file SMESHGUI_RenumberingDlg.h.

Referenced by Init(), and SMESHGUI_RenumberingDlg().

QPushButton* SMESHGUI_RenumberingDlg.buttonOk [private]

Definition at line 81 of file SMESHGUI_RenumberingDlg.h.

Referenced by Init(), SelectionIntoArgument(), and SMESHGUI_RenumberingDlg().

QRadioButton* SMESHGUI_RenumberingDlg.Constructor1 [private]

Definition at line 79 of file SMESHGUI_RenumberingDlg.h.

Referenced by Init(), and SMESHGUI_RenumberingDlg().

Definition at line 70 of file SMESHGUI_RenumberingDlg.h.

Referenced by Init(), and SetEditCurrentArgument().

Definition at line 71 of file SMESHGUI_RenumberingDlg.h.

Referenced by Init(), SelectionIntoArgument(), and SetEditCurrentArgument().

Definition at line 90 of file SMESHGUI_RenumberingDlg.h.

Referenced by ClickOnHelp(), and SMESHGUI_RenumberingDlg().

SMESH::SMESH_Mesh_var SMESHGUI_RenumberingDlg.myMesh [private]

Definition at line 74 of file SMESHGUI_RenumberingDlg.h.

Referenced by ClickOnApply(), Init(), and SelectionIntoArgument().

Definition at line 76 of file SMESHGUI_RenumberingDlg.h.

Referenced by Init().

LightApp_SelectionMgr* SMESHGUI_RenumberingDlg.mySelectionMgr [private]

Definition at line 69 of file SMESHGUI_RenumberingDlg.h.

Referenced by ClickOnCancel(), Init(), and SelectionIntoArgument().

Definition at line 73 of file SMESHGUI_RenumberingDlg.h.

Referenced by ClickOnApply(), and SMESHGUI_RenumberingDlg().

QPushButton* SMESHGUI_RenumberingDlg.SelectButton [private]

Definition at line 87 of file SMESHGUI_RenumberingDlg.h.

Referenced by Init(), SetEditCurrentArgument(), and SMESHGUI_RenumberingDlg().

Definition at line 86 of file SMESHGUI_RenumberingDlg.h.

Referenced by SMESHGUI_RenumberingDlg().

Copyright © 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
Copyright © 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS