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

SMESHGUI_SmoothingDlg Class Reference

#include <SMESHGUI_SmoothingDlg.h>

Inheritance diagram for SMESHGUI_SmoothingDlg:
Inheritance graph
[legend]

Public Member Functions

 SMESHGUI_SmoothingDlg (SMESHGUI *)
 ~SMESHGUI_SmoothingDlg ()

Private Slots

void ClickOnOk ()
void ClickOnCancel ()
bool ClickOnApply ()
void ClickOnHelp ()
void SetEditCurrentArgument ()
void SelectionIntoArgument ()
void DeactivateActiveDialog ()
void ActivateThisDialog ()
void onTextChange (const QString &)
void onSelectMesh (bool)
void setElemFilters ()
void setNodeFilters ()

Private Member Functions

void Init ()
void closeEvent (QCloseEvent *)
void enterEvent (QEvent *)
void hideEvent (QHideEvent *)
void keyPressEvent (QKeyEvent *)
void setFilters (const bool theIsElem)
bool isValid ()
 Handle (SALOME_InteractiveObject) myIO

Private Attributes

SMESHGUImySMESHGUI
SMESHGUI_IdValidatormyIdValidator
LightApp_SelectionMgr * mySelectionMgr
int myNbOkElements
int myNbOkNodes
int myConstructorId
QLineEdit * myEditCurrentArgument
SVTK_Selector * mySelector
SMESH::SMESH_IDSource_var mySelectedObject
bool myBusy
SMESH::SMESH_Mesh_var myMesh
SMESH_ActormyActor
SMESH_LogicalFiltermyMeshOrSubMeshOrGroupFilter
QGroupBoxGroupConstructors
QRadioButton * Constructor1
QGroupBoxGroupButtons
QPushButton * buttonOk
QPushButton * buttonCancel
QPushButton * buttonApply
QPushButton * buttonHelp
QGroupBoxGroupArguments
QLabel * TextLabelElements
QPushButton * SelectElementsButton
QLineEdit * LineEditElements
QCheckBox * CheckBoxMesh
QLabel * TextLabelNodes
QPushButton * SelectNodesButton
QLineEdit * LineEditNodes
QLabel * TextLabelMethod
QComboBox * ComboBoxMethod
QLabel * TextLabelLimit
SalomeApp_IntSpinBox * SpinBox_IterationLimit
QLabel * TextLabelAspectRatio
SMESHGUI_SpinBoxSpinBox_AspectRatio
QCheckBox * CheckBoxParametric
QString myHelpFileName
QPushButton * myElemFilterBtn
SMESHGUI_FilterDlgmyFilterDlg

Detailed Description

Definition at line 64 of file SMESHGUI_SmoothingDlg.h.


Constructor & Destructor Documentation

SMESHGUI_SmoothingDlg::SMESHGUI_SmoothingDlg ( SMESHGUI theModule)

Definition at line 110 of file SMESHGUI_SmoothingDlg.cxx.

References buttonApply, buttonCancel, buttonHelp, buttonOk, CheckBoxMesh, CheckBoxParametric, ClickOnApply(), ClickOnCancel(), ClickOnHelp(), ClickOnOk(), ComboBoxMethod, Constructor1, DeactivateActiveDialog(), SMESH.GetResourceMgr(), SMESH.GetSelector(), SMESH.GetViewWindow(), GROUP, GroupArguments, GroupButtons, GroupConstructors, Init(), LineEditElements, LineEditNodes, SMESH_LogicalFilter.LO_OR, MARGIN, MESHorSUBMESH, myConstructorId, myElemFilterBtn, myHelpFileName, myIdValidator, myMeshOrSubMeshOrGroupFilter, mySelectionMgr, mySelector, mySMESHGUI, onSelectMesh(), onTextChange(), SMESHGUI_SpinBox.RangeStepAndValidator(), SelectElementsButton, SelectionIntoArgument(), SelectNodesButton, SMESHGUI.SetActiveDialogBox(), SetEditCurrentArgument(), setElemFilters(), setNodeFilters(), SMESHGUI_SpinBox.SetValue(), SPACING, SpinBox_AspectRatio, SpinBox_IterationLimit, TextLabelAspectRatio, TextLabelElements, TextLabelLimit, TextLabelMethod, and TextLabelNodes.

  : QDialog( SMESH::GetDesktop( theModule ) ),
    mySMESHGUI( theModule ),
    mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),
    myFilterDlg(0),
    mySelectedObject(SMESH::SMESH_IDSource::_nil())
{
  QPixmap image0 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_DLG_SMOOTHING")));
  QPixmap image1 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SELECT")));

  setModal(false);
  setAttribute(Qt::WA_DeleteOnClose, true);
  setWindowTitle(tr("SMESH_SMOOTHING"));
  setSizeGripEnabled(true);

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

  /***************************************************************/
  GroupConstructors = new QGroupBox(tr("SMESH_SMOOTHING"), 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);

  /***************************************************************/
  GroupArguments = new QGroupBox(tr("SMESH_ARGUMENTS"), this);
  QGridLayout* GroupArgumentsLayout = new QGridLayout(GroupArguments);
  GroupArgumentsLayout->setSpacing(SPACING);
  GroupArgumentsLayout->setMargin(MARGIN);

  myIdValidator = new SMESHGUI_IdValidator(this);

  // Controls for elements selection
  TextLabelElements = new QLabel(tr("SMESH_ID_ELEMENTS"), GroupArguments);

  SelectElementsButton = new QPushButton(GroupArguments);
  SelectElementsButton->setIcon(image1);

  LineEditElements = new QLineEdit(GroupArguments);
  LineEditElements->setValidator(myIdValidator);
  LineEditElements->setMaxLength(-1);
  myElemFilterBtn = new QPushButton( tr( "SMESH_BUT_FILTER" ), GroupArguments );
  connect(myElemFilterBtn,   SIGNAL(clicked()), this, SLOT(setElemFilters()));

  // Control for the whole mesh selection
  CheckBoxMesh = new QCheckBox(tr("SMESH_SELECT_WHOLE_MESH"), GroupArguments);

  // Controls for nodes selection
  TextLabelNodes = new QLabel(tr("FIXED_NODES_IDS"), GroupArguments);

  SelectNodesButton  = new QPushButton(GroupArguments);
  SelectNodesButton->setIcon(image1);

  LineEditNodes  = new QLineEdit(GroupArguments);
  LineEditNodes->setValidator(myIdValidator);
  LineEditNodes->setMaxLength(-1);
  QPushButton* filterNodeBtn = new QPushButton( tr( "SMESH_BUT_FILTER" ), GroupArguments );
  connect(filterNodeBtn,   SIGNAL(clicked()), this, SLOT(setNodeFilters()));

  // Controls for method selection
  TextLabelMethod = new QLabel(tr("METHOD"), GroupArguments);

  ComboBoxMethod = new QComboBox(GroupArguments);

  // Controls for iteration limit defining
  TextLabelLimit = new QLabel(tr("ITERATION_LIMIT"), GroupArguments);

  SpinBox_IterationLimit = new SalomeApp_IntSpinBox(GroupArguments);

  // Controls for max. aspect ratio defining
  TextLabelAspectRatio = new QLabel(tr("MAX_ASPECT_RATIO"), GroupArguments);

  SpinBox_AspectRatio = new SMESHGUI_SpinBox(GroupArguments);

  // Check box "Is Parametric"
  CheckBoxParametric = new QCheckBox( tr("IS_PARAMETRIC"), GroupArguments );

  GroupArgumentsLayout->addWidget(TextLabelElements,      0, 0);
  GroupArgumentsLayout->addWidget(SelectElementsButton,   0, 1);
  GroupArgumentsLayout->addWidget(LineEditElements,       0, 2);
  GroupArgumentsLayout->addWidget(myElemFilterBtn,        0, 3);
  GroupArgumentsLayout->addWidget(CheckBoxMesh,           1, 0, 1, 4);
  GroupArgumentsLayout->addWidget(TextLabelNodes,         2, 0);
  GroupArgumentsLayout->addWidget(SelectNodesButton,      2, 1);
  GroupArgumentsLayout->addWidget(LineEditNodes,          2, 2);
  GroupArgumentsLayout->addWidget(filterNodeBtn,          2, 3);
  GroupArgumentsLayout->addWidget(TextLabelMethod,        3, 0);
  GroupArgumentsLayout->addWidget(ComboBoxMethod,         3, 2, 1, 2);
  GroupArgumentsLayout->addWidget(TextLabelLimit,         4, 0);
  GroupArgumentsLayout->addWidget(SpinBox_IterationLimit, 4, 2, 1, 2);
  GroupArgumentsLayout->addWidget(TextLabelAspectRatio,   5, 0);
  GroupArgumentsLayout->addWidget(SpinBox_AspectRatio,    5, 2, 1, 2);
  GroupArgumentsLayout->addWidget(CheckBoxParametric,     6, 0, 1, 4);

  /***************************************************************/
  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_SmoothingDlgLayout->addWidget(GroupConstructors);
  SMESHGUI_SmoothingDlgLayout->addWidget(GroupArguments);
  SMESHGUI_SmoothingDlgLayout->addWidget(GroupButtons);

  /***************************************************************/
  /* Initialisations */
  ComboBoxMethod->addItem(tr("LAPLACIAN"));
  ComboBoxMethod->addItem(tr("CENTROIDAL"));

  ComboBoxMethod->setCurrentIndex(0);

  CheckBoxParametric->setChecked( true );
  
  SpinBox_IterationLimit->setRange(1, 999999);
  SpinBox_IterationLimit->setValue(20);
  SpinBox_AspectRatio->RangeStepAndValidator(0.0, +999999.999, 0.1, "parametric_precision");
  SpinBox_AspectRatio->SetValue(1.1);

  GroupArguments->show();
  myConstructorId = 0;
  Constructor1->setChecked(true);
  
  mySelector = (SMESH::GetViewWindow( mySMESHGUI ))->GetSelector();

  mySMESHGUI->SetActiveDialogBox(this);

  // Costruction of the logical filter for the elements: mesh/sub-mesh/group
  QList<SUIT_SelectionFilter*> aListOfFilters;
  aListOfFilters << new SMESH_TypeFilter(MESHorSUBMESH) << new SMESH_TypeFilter(GROUP);

  myMeshOrSubMeshOrGroupFilter =
    new SMESH_LogicalFilter (aListOfFilters, SMESH_LogicalFilter::LO_OR);

  myHelpFileName = "smoothing_page.html";

  Init();

  /***************************************************************/
  // 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(SelectElementsButton, SIGNAL (clicked()), this, SLOT(SetEditCurrentArgument()));
  connect(SelectNodesButton, 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(LineEditElements, SIGNAL(textChanged(const QString&)),
           SLOT(onTextChange(const QString&)));
  connect(LineEditNodes, SIGNAL(textChanged(const QString&)),
           SLOT(onTextChange(const QString&)));
  connect(CheckBoxMesh, SIGNAL(toggled(bool)),
           SLOT(onSelectMesh(bool)));
}
SMESHGUI_SmoothingDlg::~SMESHGUI_SmoothingDlg ( )

Definition at line 300 of file SMESHGUI_SmoothingDlg.cxx.

References myFilterDlg.

{
  // no need to delete child widgets, Qt does it all for us
  if ( myFilterDlg != 0 ) {
    myFilterDlg->setParent( 0 );
    delete myFilterDlg;
  }
}

Member Function Documentation

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

Definition at line 683 of file SMESHGUI_SmoothingDlg.cxx.

References SMESHGUI.EmitSignalDeactivateDialog(), SMESH.GetViewWindow(), GroupArguments, GroupButtons, GroupConstructors, mySMESHGUI, SelectionIntoArgument(), and SMESHGUI.SetActiveDialogBox().

Referenced by enterEvent().

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

  mySMESHGUI->SetActiveDialogBox(this);
  if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
    aViewWindow->SetSelectionMode(FaceSelection);
  SelectionIntoArgument();
}
bool SMESHGUI_SmoothingDlg::ClickOnApply ( ) [private, slot]

Definition at line 340 of file SMESHGUI_SmoothingDlg.cxx.

References SMESH.SMESH_MeshEditor.CENTROIDAL_SMOOTH, CheckBoxMesh, CheckBoxParametric, ComboBoxMethod, SMESH.eDisplay, SMESHGUI_SpinBox.GetValue(), Init(), SMESHGUI.isActiveStudyLocked(), isValid(), smeshDC.LAPLACIAN_SMOOTH, LineEditElements, LineEditNodes, SMESHGUI.Modified(), myMesh, myNbOkElements, myNbOkNodes, mySelectedObject, mySMESHGUI, SpinBox_AspectRatio, SpinBox_IterationLimit, and SMESH.Update().

Referenced by ClickOnOk(), and SMESHGUI_SmoothingDlg().

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

  if (!isValid())
    return false;

  if (myNbOkElements && (myNbOkNodes || LineEditNodes->text().trimmed().isEmpty())) {
    QStringList aListElementsId = LineEditElements->text().split(" ", QString::SkipEmptyParts);
    QStringList aListNodesId    = LineEditNodes->text().split(" ", QString::SkipEmptyParts);

    SMESH::long_array_var anElementsId = new SMESH::long_array;
    SMESH::long_array_var aNodesId = new SMESH::long_array;

    anElementsId->length(aListElementsId.count());
    for (int i = 0; i < aListElementsId.count(); i++)
      anElementsId[i] = aListElementsId[i].toInt();

    if ( myNbOkNodes && aListNodesId.count() > 0 ) {
      aNodesId->length(aListNodesId.count());
      for (int i = 0; i < aListNodesId.count(); i++)
        aNodesId[i] = aListNodesId[i].toInt();
    } else {
      aNodesId->length(0);
    }

    long anIterationLimit = (long)SpinBox_IterationLimit->value();
    double aMaxAspectRatio = SpinBox_AspectRatio->GetValue();

    QStringList aParameters;
    aParameters << SpinBox_IterationLimit->text();
    aParameters << SpinBox_AspectRatio->text();

    SMESH::SMESH_MeshEditor::Smooth_Method aMethod = SMESH::SMESH_MeshEditor::LAPLACIAN_SMOOTH;
    if (ComboBoxMethod->currentIndex() > 0)
      aMethod =  SMESH::SMESH_MeshEditor::CENTROIDAL_SMOOTH;

    bool aResult = false;
    try {
      SUIT_OverrideCursor aWaitCursor;
      SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();

      if ( CheckBoxParametric->isChecked() ) {
        if(CheckBoxMesh->isChecked())
          aResult = aMeshEditor->SmoothParametricObject(mySelectedObject, aNodesId.inout(),
                                                        anIterationLimit, aMaxAspectRatio, aMethod);
        else
          aResult = aMeshEditor->SmoothParametric(anElementsId.inout(), aNodesId.inout(),
                                                  anIterationLimit, aMaxAspectRatio, aMethod);
      }
      else {
        if(CheckBoxMesh->isChecked())
          aResult = aMeshEditor->SmoothObject(mySelectedObject, aNodesId.inout(),
                                              anIterationLimit, aMaxAspectRatio, aMethod);
        else
          aResult = aMeshEditor->Smooth(anElementsId.inout(), aNodesId.inout(),
                                        anIterationLimit, aMaxAspectRatio, aMethod);
      }

      myMesh->SetParameters( aParameters.join(":").toLatin1().constData() );

    } catch (...) {
    }

    if (aResult) {
      SMESH::Update(myIO, SMESH::eDisplay);
      SMESHGUI::Modified();
      Init();

      mySelectedObject = SMESH::SMESH_IDSource::_nil();
    }
  }

  return true;
}
void SMESHGUI_SmoothingDlg::ClickOnCancel ( ) [private, slot]

Definition at line 431 of file SMESHGUI_SmoothingDlg.cxx.

References SMESH.GetCurrentVtkView(), SMESH.GetViewWindow(), mySelectionMgr, mySMESHGUI, SMESH.RemoveFilters(), SMESHGUI.ResetState(), SMESH.SetPickable(), and SMESH.SetPointRepresentation().

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

{
  disconnect(mySelectionMgr, 0, this, 0);
  mySelectionMgr->clearFilters();
  //mySelectionMgr->clearSelected();
  if (SMESH::GetCurrentVtkView()) {
    SMESH::RemoveFilters(); // PAL6938 -- clean all mesh entity filters
    SMESH::SetPointRepresentation(false);
    SMESH::SetPickable();
  }
  if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
    aViewWindow->SetSelectionMode(ActorSelection);
  mySMESHGUI->ResetState();
  reject();
}
void SMESHGUI_SmoothingDlg::ClickOnHelp ( ) [private, slot]

Definition at line 451 of file SMESHGUI_SmoothingDlg.cxx.

References myHelpFileName, and mySMESHGUI.

Referenced by keyPressEvent(), and SMESHGUI_SmoothingDlg().

{
  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_SmoothingDlg::ClickOnOk ( ) [private, slot]

Definition at line 421 of file SMESHGUI_SmoothingDlg.cxx.

References ClickOnApply(), and ClickOnCancel().

Referenced by SMESHGUI_SmoothingDlg().

{
  if( ClickOnApply() )
    ClickOnCancel();
}
void SMESHGUI_SmoothingDlg::closeEvent ( QCloseEvent *  ) [private]

Definition at line 711 of file SMESHGUI_SmoothingDlg.cxx.

References ClickOnCancel().

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

Definition at line 668 of file SMESHGUI_SmoothingDlg.cxx.

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

Referenced by SMESHGUI_SmoothingDlg().

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

Definition at line 701 of file SMESHGUI_SmoothingDlg.cxx.

References ActivateThisDialog(), and GroupConstructors.

{
  if (!GroupConstructors->isEnabled())
    ActivateThisDialog();
}
SMESHGUI_SmoothingDlg.Handle ( SALOME_InteractiveObject  ) [private]

Referenced by SelectionIntoArgument().

void SMESHGUI_SmoothingDlg::hideEvent ( QHideEvent *  ) [private]

Definition at line 721 of file SMESHGUI_SmoothingDlg.cxx.

References ClickOnCancel().

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

Definition at line 313 of file SMESHGUI_SmoothingDlg.cxx.

References CheckBoxMesh, LineEditElements, LineEditNodes, myActor, myBusy, myEditCurrentArgument, myMesh, myNbOkElements, myNbOkNodes, and onSelectMesh().

Referenced by ClickOnApply(), and SMESHGUI_SmoothingDlg().

{
  myBusy = false;

//   ComboBoxMethod->setCurrentItem(0);

//   SpinBox_IterationLimit->setValue(20);
//   SpinBox_AspectRatio->SetValue(1.1);

  myEditCurrentArgument = LineEditElements;
  LineEditElements->setFocus();
  LineEditElements->clear();
  LineEditNodes->clear();
  myNbOkElements = 0;
  myNbOkNodes = 0;
  myActor     = 0;
  myIO.Nullify();
  myMesh = SMESH::SMESH_Mesh::_nil();

  CheckBoxMesh->setChecked(false);
  onSelectMesh(false);
}
bool SMESHGUI_SmoothingDlg::isValid ( ) [private]

Definition at line 834 of file SMESHGUI_SmoothingDlg.cxx.

References SpinBox_AspectRatio, and SpinBox_IterationLimit.

Referenced by ClickOnApply().

{
  QString msg;
  bool ok = true;
  ok = SpinBox_IterationLimit->isValid( msg, true ) && ok;
  ok = SpinBox_AspectRatio->isValid( msg, true ) && ok;

  if( !ok ) {
    QString str( tr( "SMESH_INCORRECT_INPUT" ) );
    if ( !msg.isEmpty() )
      str += "\n" + msg;
    SUIT_MessageBox::critical( this, tr( "SMESH_ERROR" ), str );
    return false;
  }
  return true;
}
void SMESHGUI_SmoothingDlg::keyPressEvent ( QKeyEvent *  e) [private]

Definition at line 772 of file SMESHGUI_SmoothingDlg.cxx.

References ClickOnHelp().

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

  if ( e->key() == Qt::Key_F1 ) {
    e->accept();
    ClickOnHelp();
  }
}
void SMESHGUI_SmoothingDlg::onSelectMesh ( bool  toSelectMesh) [private, slot]

Definition at line 731 of file SMESHGUI_SmoothingDlg.cxx.

References SMESH.GetViewWindow(), LineEditElements, LineEditNodes, myEditCurrentArgument, myElemFilterBtn, myIdValidator, myMeshOrSubMeshOrGroupFilter, mySelectionMgr, mySMESHGUI, onTextChange(), SelectionIntoArgument(), SMESH.SetPointRepresentation(), and TextLabelElements.

Referenced by Init(), and SMESHGUI_SmoothingDlg().

{
  if (toSelectMesh)
    TextLabelElements->setText(tr("SMESH_NAME"));
  else
    TextLabelElements->setText(tr("SMESH_ID_ELEMENTS"));
  myElemFilterBtn->setEnabled(!toSelectMesh);

  if (myEditCurrentArgument != LineEditElements &&
      myEditCurrentArgument != LineEditNodes) {
    LineEditElements->clear();
    LineEditNodes->clear();
    return;
  }

  mySelectionMgr->clearFilters();
  SMESH::SetPointRepresentation(false);

  if (toSelectMesh) {
    if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
      aViewWindow->SetSelectionMode(ActorSelection);
    //    mySelectionMgr->setSelectionModes(ActorSelection);
    mySelectionMgr->installFilter(myMeshOrSubMeshOrGroupFilter);
    myEditCurrentArgument->setReadOnly(true);
    myEditCurrentArgument->setValidator(0);
  } else {
    if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
      aViewWindow->SetSelectionMode(myEditCurrentArgument == LineEditElements ? FaceSelection 
                                                                              : NodeSelection );
    myEditCurrentArgument->setReadOnly(false);
    LineEditElements->setValidator(myIdValidator);
    onTextChange(myEditCurrentArgument->text());
  }

  SelectionIntoArgument();
}
void SMESHGUI_SmoothingDlg::onTextChange ( const QString &  theNewText) [private, slot]

Definition at line 475 of file SMESHGUI_SmoothingDlg.cxx.

References buttonApply, buttonOk, EDGE, SMDS_Mesh.FindElement(), SMDS_Mesh.FindNode(), SMESH_Actor.GetObject(), SMESH.GetViewWindow(), LineEditElements, LineEditNodes, myActor, myBusy, myMesh, myNbOkElements, myNbOkNodes, mySelector, and mySMESHGUI.

Referenced by onSelectMesh(), and SMESHGUI_SmoothingDlg().

{
  QLineEdit* send = (QLineEdit*)sender();

  // return if busy
  if (myBusy || myIO.IsNull()) return;

  // set busy flag
  BusyLocker lock( myBusy );

  if (send == LineEditElements)
    myNbOkElements = 0;
  else if (send == LineEditNodes)
    myNbOkNodes = 0;

  buttonOk->setEnabled(false);
  buttonApply->setEnabled(false);

  // hilight entered elements/nodes
  SMDS_Mesh* aMesh = myActor ? myActor->GetObject()->GetMesh() : 0;
  QStringList aListId = theNewText.split(" ", QString::SkipEmptyParts);

  if (send == LineEditElements) {
    TColStd_MapOfInteger newIndices;
    for (int i = 0; i < aListId.count(); i++) {
      int id = aListId[ i ].toInt();
      if ( id > 0 ) {
        bool validId = aMesh ? ( aMesh->FindElement( id ) != 0 ) : ( myMesh->GetElementType( id, true ) != SMESH::EDGE );
        if ( validId ) 
          newIndices.Add( id );
      }
      myNbOkElements = newIndices.Extent();
      mySelector->AddOrRemoveIndex(myIO, newIndices, false);
      if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
        aViewWindow->highlight( myIO, true, true );
    }
  }
  else if (send == LineEditNodes) {
    TColStd_MapOfInteger newIndices;
    for (int i = 0; i < aListId.count(); i++) {
      int id = aListId[ i ].toInt();
      if ( id > 0 ) {
        bool validId = aMesh ? ( aMesh->FindNode( id ) != 0 ) : ( myMesh->GetElementType( id, false ) != SMESH::EDGE );
        if ( validId ) 
          newIndices.Add( id );
      }
      myNbOkNodes = newIndices.Extent();
      mySelector->AddOrRemoveIndex(myIO, newIndices, false);
      if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
        aViewWindow->highlight( myIO, true, true );
    }
  }

  if (myNbOkElements && (myNbOkNodes || LineEditNodes->text().trimmed().isEmpty())) {
    buttonOk->setEnabled(true);
    buttonApply->setEnabled(true);
  }
}
void SMESHGUI_SmoothingDlg::SelectionIntoArgument ( ) [private, slot]

Definition at line 538 of file SMESHGUI_SmoothingDlg.cxx.

References buttonApply, buttonOk, CheckBoxMesh, SMESH.FindActorByObject(), SMESH.GetMeshByIO(), SMESH.GetNameOfSelectedIObjects(), SMESH.GetNameOfSelectedNodes(), GroupButtons, Handle(), LineEditElements, LineEditNodes, myActor, myBusy, myEditCurrentArgument, myMesh, myNbOkElements, myNbOkNodes, mySelectedObject, mySelectionMgr, and mySelector.

Referenced by ActivateThisDialog(), onSelectMesh(), SetEditCurrentArgument(), and SMESHGUI_SmoothingDlg().

{
  if (myBusy) return;

  // clear
  QString aString = "";

  // set busy flag
  BusyLocker lock( myBusy );

  if (myEditCurrentArgument == LineEditElements ||
      myEditCurrentArgument == LineEditNodes) {
    myEditCurrentArgument->setText(aString);
    if (myEditCurrentArgument == LineEditElements) {
      myNbOkElements = 0;
      myActor = 0;
      myIO.Nullify();
    }
    else {
      myNbOkNodes = 0;
    }
    buttonOk->setEnabled(false);
    buttonApply->setEnabled(false);
  }

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

  // get selected mesh
  SALOME_ListIO aList;
  mySelectionMgr->selectedObjects(aList,SVTK_Viewer::Type());
  int nbSel = aList.Extent();
  if (nbSel != 1)
    return;

  Handle(SALOME_InteractiveObject) IO = aList.First();

  if (myEditCurrentArgument == LineEditElements) {
    myMesh = SMESH::GetMeshByIO(IO);
    if (myMesh->_is_nil())
      return;
    myIO = IO;
    myActor = SMESH::FindActorByObject(myMesh);

    if (CheckBoxMesh->isChecked()) {
      SMESH::GetNameOfSelectedIObjects(mySelectionMgr, aString);

      SMESH::SMESH_IDSource_var obj = SMESH::IObjectToInterface<SMESH::SMESH_IDSource>( myIO );
      if ( !CORBA::is_nil( obj ) )
        mySelectedObject = obj;
      else
        return;
      myNbOkElements = true;
    } else {
      // get indices of selected elements
      TColStd_IndexedMapOfInteger aMapIndex;
      mySelector->GetIndex(IO,aMapIndex);
      myNbOkElements = aMapIndex.Extent();

      if (myNbOkElements < 1)
        return;
      
      QStringList elements;
      for ( int i = 0; i < myNbOkElements; ++i )
        elements << QString::number( aMapIndex( i+1 ) );
      aString = elements.join(" ");
    }
  } else if (myEditCurrentArgument == LineEditNodes && !myMesh->_is_nil() && myIO == IO ) {
    myNbOkNodes = SMESH::GetNameOfSelectedNodes(mySelector, IO, aString);
  }

  myEditCurrentArgument->setText(aString);
  myEditCurrentArgument->repaint();
  myEditCurrentArgument->setEnabled(false); // to update lineedit IPAL 19809
  myEditCurrentArgument->setEnabled(true); 

  if (myNbOkElements && (myNbOkNodes || LineEditNodes->text().trimmed().isEmpty())) {
    buttonOk->setEnabled(true);
    buttonApply->setEnabled(true);
  }
}
void SMESHGUI_SmoothingDlg::SetEditCurrentArgument ( ) [private, slot]

Definition at line 624 of file SMESHGUI_SmoothingDlg.cxx.

References CheckBoxMesh, SMESH.GetViewWindow(), LineEditElements, LineEditNodes, myConstructorId, myEditCurrentArgument, myMeshOrSubMeshOrGroupFilter, mySelectionMgr, mySMESHGUI, SelectElementsButton, SelectionIntoArgument(), SelectNodesButton, and SMESH.SetPointRepresentation().

Referenced by SMESHGUI_SmoothingDlg().

{
  QPushButton* send = (QPushButton*)sender();

  switch (myConstructorId) {
  case 0: /* default constructor */
    {
      disconnect(mySelectionMgr, 0, this, 0);
      mySelectionMgr->clearSelected();
      mySelectionMgr->clearFilters();

      if (send == SelectElementsButton) {
        myEditCurrentArgument = LineEditElements;
        SMESH::SetPointRepresentation(false);
        if (CheckBoxMesh->isChecked()) {
          //          mySelectionMgr->setSelectionModes(ActorSelection);
          if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
            aViewWindow->SetSelectionMode(ActorSelection);
          mySelectionMgr->installFilter(myMeshOrSubMeshOrGroupFilter);
        } else {
          if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
            aViewWindow->SetSelectionMode(FaceSelection);
        }
      } else if (send == SelectNodesButton) {
        LineEditNodes->clear();
        myEditCurrentArgument = LineEditNodes;
        SMESH::SetPointRepresentation(true);
        if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) {
          aViewWindow->SetSelectionMode(NodeSelection);
        }
      }

      myEditCurrentArgument->setFocus();
      connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
      SelectionIntoArgument();
      break;
    }
  }
}
void SMESHGUI_SmoothingDlg::setElemFilters ( ) [private, slot]

Definition at line 816 of file SMESHGUI_SmoothingDlg.cxx.

References setFilters().

Referenced by SMESHGUI_SmoothingDlg().

{
  setFilters( true );
}
void SMESHGUI_SmoothingDlg::setFilters ( const bool  theIsElem) [private]

Definition at line 788 of file SMESHGUI_SmoothingDlg.cxx.

References SMESH.ALL, SMESHGUI_FilterDlg.Init(), LineEditElements, LineEditNodes, myFilterDlg, myMesh, mySMESHGUI, SMESH.NODE, SMESHGUI_FilterDlg.SetMesh(), SMESHGUI_FilterDlg.SetSelection(), and SMESHGUI_FilterDlg.SetSourceWg().

Referenced by setElemFilters(), and setNodeFilters().

{
  if(myMesh->_is_nil()) {
    SUIT_MessageBox::critical(this,
                              tr("SMESH_ERROR"),
                              tr("NO_MESH_SELECTED"));
   return;
  }
  if ( !myFilterDlg )
  {
    QList<int> types;  
    types.append( SMESH::NODE );
    types.append( SMESH::ALL );
    myFilterDlg = new SMESHGUI_FilterDlg( mySMESHGUI, types );
  }
  myFilterDlg->Init( theIsElem ? SMESH::ALL : SMESH::NODE );

  myFilterDlg->SetSelection();
  myFilterDlg->SetMesh( myMesh );
  myFilterDlg->SetSourceWg( theIsElem ? LineEditElements : LineEditNodes );

  myFilterDlg->show();
}
void SMESHGUI_SmoothingDlg::setNodeFilters ( ) [private, slot]

Definition at line 825 of file SMESHGUI_SmoothingDlg.cxx.

References setFilters().

Referenced by SMESHGUI_SmoothingDlg().

{
  setFilters( false );
}

Field Documentation

QPushButton* SMESHGUI_SmoothingDlg.buttonApply [private]
QPushButton* SMESHGUI_SmoothingDlg.buttonCancel [private]

Definition at line 103 of file SMESHGUI_SmoothingDlg.h.

Referenced by SMESHGUI_SmoothingDlg().

QPushButton* SMESHGUI_SmoothingDlg.buttonHelp [private]

Definition at line 105 of file SMESHGUI_SmoothingDlg.h.

Referenced by SMESHGUI_SmoothingDlg().

QPushButton* SMESHGUI_SmoothingDlg.buttonOk [private]
QCheckBox* SMESHGUI_SmoothingDlg.CheckBoxMesh [private]

Definition at line 120 of file SMESHGUI_SmoothingDlg.h.

Referenced by ClickOnApply(), and SMESHGUI_SmoothingDlg().

Definition at line 115 of file SMESHGUI_SmoothingDlg.h.

Referenced by ClickOnApply(), and SMESHGUI_SmoothingDlg().

QRadioButton* SMESHGUI_SmoothingDlg.Constructor1 [private]

Definition at line 100 of file SMESHGUI_SmoothingDlg.h.

Referenced by SMESHGUI_SmoothingDlg().

Definition at line 95 of file SMESHGUI_SmoothingDlg.h.

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

Definition at line 93 of file SMESHGUI_SmoothingDlg.h.

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

Definition at line 87 of file SMESHGUI_SmoothingDlg.h.

Referenced by SetEditCurrentArgument(), and SMESHGUI_SmoothingDlg().

QPushButton* SMESHGUI_SmoothingDlg.myElemFilterBtn [private]

Definition at line 124 of file SMESHGUI_SmoothingDlg.h.

Referenced by onSelectMesh(), and SMESHGUI_SmoothingDlg().

Definition at line 125 of file SMESHGUI_SmoothingDlg.h.

Referenced by setFilters(), and ~SMESHGUI_SmoothingDlg().

Definition at line 122 of file SMESHGUI_SmoothingDlg.h.

Referenced by ClickOnHelp(), and SMESHGUI_SmoothingDlg().

Definition at line 83 of file SMESHGUI_SmoothingDlg.h.

Referenced by onSelectMesh(), and SMESHGUI_SmoothingDlg().

SMESH::SMESH_Mesh_var SMESHGUI_SmoothingDlg.myMesh [private]

Definition at line 85 of file SMESHGUI_SmoothingDlg.h.

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

Definition at line 86 of file SMESHGUI_SmoothingDlg.h.

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

SMESH::SMESH_IDSource_var SMESHGUI_SmoothingDlg.mySelectedObject [private]

Definition at line 91 of file SMESHGUI_SmoothingDlg.h.

Referenced by ClickOnApply(), and SelectionIntoArgument().

LightApp_SelectionMgr* SMESHGUI_SmoothingDlg.mySelectionMgr [private]
SVTK_Selector* SMESHGUI_SmoothingDlg.mySelector [private]

Definition at line 108 of file SMESHGUI_SmoothingDlg.h.

Referenced by SetEditCurrentArgument(), and SMESHGUI_SmoothingDlg().

Definition at line 112 of file SMESHGUI_SmoothingDlg.h.

Referenced by SetEditCurrentArgument(), and SMESHGUI_SmoothingDlg().

Definition at line 119 of file SMESHGUI_SmoothingDlg.h.

Referenced by ClickOnApply(), isValid(), and SMESHGUI_SmoothingDlg().

SalomeApp_IntSpinBox* SMESHGUI_SmoothingDlg.SpinBox_IterationLimit [private]

Definition at line 117 of file SMESHGUI_SmoothingDlg.h.

Referenced by ClickOnApply(), isValid(), and SMESHGUI_SmoothingDlg().

Definition at line 118 of file SMESHGUI_SmoothingDlg.h.

Referenced by SMESHGUI_SmoothingDlg().

Definition at line 107 of file SMESHGUI_SmoothingDlg.h.

Referenced by onSelectMesh(), and SMESHGUI_SmoothingDlg().

Definition at line 116 of file SMESHGUI_SmoothingDlg.h.

Referenced by SMESHGUI_SmoothingDlg().

Definition at line 114 of file SMESHGUI_SmoothingDlg.h.

Referenced by SMESHGUI_SmoothingDlg().

Definition at line 111 of file SMESHGUI_SmoothingDlg.h.

Referenced by SMESHGUI_SmoothingDlg().

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