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

SMESHGUI_SewingDlg Class Reference

#include <SMESHGUI_SewingDlg.h>

Inheritance diagram for SMESHGUI_SewingDlg:
Inheritance graph
[legend]

Public Member Functions

 SMESHGUI_SewingDlg (SMESHGUI *)
 ~SMESHGUI_SewingDlg ()

Private Slots

void ConstructorsClicked (int)
void ClickOnOk ()
void ClickOnCancel ()
bool ClickOnApply ()
void ClickOnHelp ()
void SetEditCurrentArgument ()
void SelectionIntoArgument (bool=true)
void DeactivateActiveDialog ()
void ActivateThisDialog ()
void onTextChange (const QString &)

Private Member Functions

void Init ()
void closeEvent (QCloseEvent *)
void enterEvent (QEvent *)
void hideEvent (QHideEvent *)
void keyPressEvent (QKeyEvent *)
int GetConstructorId ()
bool IsValid ()

Private Attributes

SMESHGUImySMESHGUI
LightApp_SelectionMgr * mySelectionMgr
int myOk1
int myOk2
int myOk3
int myOk4
int myOk5
int myOk6
QLineEdit * myEditCurrentArgument
SVTK_Selector * mySelector
bool myBusy
SMESH::SMESH_Mesh_var myMesh
SMESH_ActormyActor
QGroupBoxConstructorsBox
QButtonGroup * GroupConstructors
QRadioButton * RadioButton1
QRadioButton * RadioButton2
QRadioButton * RadioButton3
QRadioButton * RadioButton4
QGroupBoxGroupButtons
QPushButton * buttonOk
QPushButton * buttonCancel
QPushButton * buttonApply
QPushButton * buttonHelp
QGroupBoxGroupArguments
QGroupBoxSubGroup1
QGroupBoxSubGroup2
QLabel * TextLabel1
QLabel * TextLabel2
QLabel * TextLabel3
QLabel * TextLabel4
QLabel * TextLabel5
QLabel * TextLabel6
QPushButton * SelectButton1
QPushButton * SelectButton2
QPushButton * SelectButton3
QPushButton * SelectButton4
QPushButton * SelectButton5
QPushButton * SelectButton6
QLineEdit * LineEdit1
QLineEdit * LineEdit2
QLineEdit * LineEdit3
QLineEdit * LineEdit4
QLineEdit * LineEdit5
QLineEdit * LineEdit6
QCheckBox * CheckBoxMerge
QCheckBox * CheckBoxPolygons
QCheckBox * CheckBoxPolyedrs
QString myHelpFileName

Detailed Description

Definition at line 56 of file SMESHGUI_SewingDlg.h.


Constructor & Destructor Documentation

SMESHGUI_SewingDlg::SMESHGUI_SewingDlg ( SMESHGUI theModule)

Definition at line 81 of file SMESHGUI_SewingDlg.cxx.

References buttonApply, buttonCancel, buttonHelp, buttonOk, CheckBoxMerge, CheckBoxPolyedrs, CheckBoxPolygons, ClickOnApply(), ClickOnCancel(), ClickOnHelp(), ClickOnOk(), ConstructorsBox, ConstructorsClicked(), DeactivateActiveDialog(), SMESH.GetResourceMgr(), SMESH.GetSelector(), SMESH.GetViewWindow(), GroupArguments, GroupButtons, GroupConstructors, Init(), LineEdit1, LineEdit2, LineEdit3, LineEdit4, LineEdit5, LineEdit6, MARGIN, myHelpFileName, mySelectionMgr, mySelector, mySMESHGUI, onTextChange(), RadioButton1, RadioButton2, RadioButton3, RadioButton4, SelectButton1, SelectButton2, SelectButton3, SelectButton4, SelectButton5, SelectButton6, SelectionIntoArgument(), SMESHGUI.SetActiveDialogBox(), SetEditCurrentArgument(), SPACING, SubGroup1, SubGroup2, TextLabel1, TextLabel2, TextLabel3, TextLabel4, TextLabel5, and TextLabel6.

  : QDialog( SMESH::GetDesktop( theModule ) ),
    mySMESHGUI( theModule ),
    mySelectionMgr( SMESH::GetSelectionMgr( theModule ) )
{
  SUIT_ResourceMgr* mgr = SMESH::GetResourceMgr( mySMESHGUI );
  QPixmap image0 (mgr->loadPixmap("SMESH", tr("ICON_SMESH_SEWING_FREEBORDERS")));
  QPixmap image1 (mgr->loadPixmap("SMESH", tr("ICON_SMESH_SEWING_CONFORM_FREEBORDERS")));
  QPixmap image2 (mgr->loadPixmap("SMESH", tr("ICON_SMESH_SEWING_BORDERTOSIDE")));
  QPixmap image3 (mgr->loadPixmap("SMESH", tr("ICON_SMESH_SEWING_SIDEELEMENTS")));
  QPixmap image4 (mgr->loadPixmap("SMESH", tr("ICON_SELECT")));

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

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

  /***************************************************************/
  ConstructorsBox = new QGroupBox(tr("SMESH_SEWING"), this);
  GroupConstructors = new QButtonGroup(this);
  QHBoxLayout* ConstructorsBoxLayout = new QHBoxLayout(ConstructorsBox);
  ConstructorsBoxLayout->setSpacing(SPACING);
  ConstructorsBoxLayout->setMargin(MARGIN);

  RadioButton1 = new QRadioButton(ConstructorsBox);
  RadioButton1->setIcon(image0);
  RadioButton2 = new QRadioButton(ConstructorsBox);
  RadioButton2->setIcon(image1);
  RadioButton3 = new QRadioButton(ConstructorsBox);
  RadioButton3->setIcon(image2);
  RadioButton4 = new QRadioButton(ConstructorsBox);
  RadioButton4->setIcon(image3);

  ConstructorsBoxLayout->addWidget(RadioButton1);
  ConstructorsBoxLayout->addWidget(RadioButton2);
  ConstructorsBoxLayout->addWidget(RadioButton3);
  ConstructorsBoxLayout->addWidget(RadioButton4);
  GroupConstructors->addButton(RadioButton1, 0);
  GroupConstructors->addButton(RadioButton2, 1);
  GroupConstructors->addButton(RadioButton3, 2);
  GroupConstructors->addButton(RadioButton4, 3);

  /***************************************************************/
  GroupArguments = new QGroupBox(this);
  QVBoxLayout* GroupArgumentsLayout = new QVBoxLayout(GroupArguments);
  GroupArgumentsLayout->setSpacing(SPACING);
  GroupArgumentsLayout->setMargin(MARGIN);

  // First subgroup
  SubGroup1 = new QGroupBox(GroupArguments);
  QGridLayout* SubGroup1Layout = new QGridLayout(SubGroup1);
  SubGroup1Layout->setSpacing(SPACING);
  SubGroup1Layout->setMargin(MARGIN);

  // Controls of the first subgroup
  TextLabel1 = new QLabel(SubGroup1);
  SelectButton1  = new QPushButton(SubGroup1);
  SelectButton1->setIcon(image4);
  LineEdit1 = new QLineEdit(SubGroup1);

  TextLabel2 = new QLabel(SubGroup1);
  SelectButton2  = new QPushButton(SubGroup1);
  SelectButton2->setIcon(image4);
  LineEdit2 = new QLineEdit(SubGroup1);

  TextLabel3 = new QLabel(SubGroup1);
  SelectButton3  = new QPushButton(SubGroup1);
  SelectButton3->setIcon(image4);
  LineEdit3 = new QLineEdit(SubGroup1);

  SubGroup1Layout->addWidget(TextLabel1,    0, 0);
  SubGroup1Layout->addWidget(SelectButton1, 0, 1);
  SubGroup1Layout->addWidget(LineEdit1,     0, 2);
  SubGroup1Layout->addWidget(TextLabel2,    1, 0);
  SubGroup1Layout->addWidget(SelectButton2, 1, 1);
  SubGroup1Layout->addWidget(LineEdit2,     1, 2);
  SubGroup1Layout->addWidget(TextLabel3,    2, 0);
  SubGroup1Layout->addWidget(SelectButton3, 2, 1);
  SubGroup1Layout->addWidget(LineEdit3,     2, 2);

  // Second subgroup
  SubGroup2 = new QGroupBox(GroupArguments);
  QGridLayout* SubGroup2Layout = new QGridLayout(SubGroup2);
  SubGroup2Layout->setSpacing(SPACING);
  SubGroup2Layout->setMargin(MARGIN);

  // Controls of the first subgroup
  TextLabel4 = new QLabel(SubGroup2);
  SelectButton4  = new QPushButton(SubGroup2);
  SelectButton4->setIcon(image4);
  LineEdit4 = new QLineEdit(SubGroup2);

  TextLabel5 = new QLabel(SubGroup2);
  SelectButton5  = new QPushButton(SubGroup2);
  SelectButton5->setIcon(image4);
  LineEdit5 = new QLineEdit(SubGroup2);

  TextLabel6 = new QLabel(SubGroup2);
  SelectButton6  = new QPushButton(SubGroup2);
  SelectButton6->setIcon(image4);
  LineEdit6 = new QLineEdit(SubGroup2);

  SubGroup2Layout->addWidget(TextLabel4,    0, 0);
  SubGroup2Layout->addWidget(SelectButton4, 0, 1);
  SubGroup2Layout->addWidget(LineEdit4,     0, 2);
  SubGroup2Layout->addWidget(TextLabel5,    1, 0);
  SubGroup2Layout->addWidget(SelectButton5, 1, 1);
  SubGroup2Layout->addWidget(LineEdit5,     1, 2);
  SubGroup2Layout->addWidget(TextLabel6,    2, 0);
  SubGroup2Layout->addWidget(SelectButton6, 2, 1);
  SubGroup2Layout->addWidget(LineEdit6,     2, 2);

  // Control for the merging equal elements
  CheckBoxMerge = new QCheckBox(tr("MERGE_EQUAL_ELEMENTS"), GroupArguments);

  // Control for the polygons creation instead of splitting
  CheckBoxPolygons = new QCheckBox(tr("CREATE_POLYGONS_INSTEAD_SPLITTING"), GroupArguments);
  
  // Control for the polyedres creation to obtain conform mesh
  CheckBoxPolyedrs = new QCheckBox(tr("CREATE_POLYEDRS_NEAR_BOUNDARY"), GroupArguments);

  // layout
  GroupArgumentsLayout->addWidget(SubGroup1);
  GroupArgumentsLayout->addWidget(SubGroup2);
  GroupArgumentsLayout->addWidget(CheckBoxMerge);
  GroupArgumentsLayout->addWidget(CheckBoxPolygons);
  GroupArgumentsLayout->addWidget(CheckBoxPolyedrs);

  /***************************************************************/
  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_SewingDlgLayout->addWidget(ConstructorsBox);
  SMESHGUI_SewingDlgLayout->addWidget(GroupArguments);
  SMESHGUI_SewingDlgLayout->addWidget(GroupButtons);

  /* Initialisations */
  RadioButton1->setChecked(true);

  LineEdit2->setValidator(new SMESHGUI_IdValidator(this, 1));
  LineEdit3->setValidator(new SMESHGUI_IdValidator(this, 1));
  LineEdit5->setValidator(new SMESHGUI_IdValidator(this, 1));
  LineEdit6->setValidator(new SMESHGUI_IdValidator(this, 1));

  mySelector = (SMESH::GetViewWindow( mySMESHGUI ))->GetSelector();

  mySMESHGUI->SetActiveDialogBox((QDialog*)this);

  myHelpFileName = "sewing_meshes_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(GroupConstructors, SIGNAL(buttonClicked(int)), SLOT(ConstructorsClicked(int)));

  connect(SelectButton1, SIGNAL (clicked()),   this, SLOT(SetEditCurrentArgument()));
  connect(SelectButton2, SIGNAL (clicked()),   this, SLOT(SetEditCurrentArgument()));
  connect(SelectButton3, SIGNAL (clicked()),   this, SLOT(SetEditCurrentArgument()));
  connect(SelectButton4, SIGNAL (clicked()),   this, SLOT(SetEditCurrentArgument()));
  connect(SelectButton5, SIGNAL (clicked()),   this, SLOT(SetEditCurrentArgument()));
  connect(SelectButton6, 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(LineEdit1, SIGNAL(textChanged(const QString&)), SLOT(onTextChange(const QString&)));
  connect(LineEdit2, SIGNAL(textChanged(const QString&)), SLOT(onTextChange(const QString&)));
  connect(LineEdit3, SIGNAL(textChanged(const QString&)), SLOT(onTextChange(const QString&)));
  connect(LineEdit4, SIGNAL(textChanged(const QString&)), SLOT(onTextChange(const QString&)));
  connect(LineEdit5, SIGNAL(textChanged(const QString&)), SLOT(onTextChange(const QString&)));
  connect(LineEdit6, SIGNAL(textChanged(const QString&)), SLOT(onTextChange(const QString&)));

  ConstructorsClicked(0);
}
SMESHGUI_SewingDlg::~SMESHGUI_SewingDlg ( )

Definition at line 291 of file SMESHGUI_SewingDlg.cxx.

{
}

Member Function Documentation

void SMESHGUI_SewingDlg::ActivateThisDialog ( ) [private, slot]
bool SMESHGUI_SewingDlg::ClickOnApply ( ) [private, slot]

Definition at line 450 of file SMESHGUI_SewingDlg.cxx.

References CheckBoxMerge, CheckBoxPolyedrs, CheckBoxPolygons, ConstructorsClicked(), GetConstructorId(), Handle(), Init(), SMESHGUI.isActiveStudyLocked(), IsValid(), LineEdit1, LineEdit2, LineEdit3, LineEdit4, LineEdit5, LineEdit6, SMESHGUI.Modified(), myActor, myMesh, mySelectionMgr, mySMESHGUI, SMESH.SMESH_MeshEditor.SEW_OK, and SMESH.UpdateView().

Referenced by ClickOnOk(), and SMESHGUI_SewingDlg().

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

  bool aResult = false;

  if (IsValid()) {
    bool toMerge = CheckBoxMerge->isChecked();
    bool toCreatePolygons = CheckBoxPolygons->isChecked();
    bool toCreatePolyedrs = CheckBoxPolyedrs->isChecked();

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

      int aConstructorId = GetConstructorId();
      SMESH::SMESH_MeshEditor::Sew_Error anError;

      if (aConstructorId == 0)
        anError = aMeshEditor->SewFreeBorders(LineEdit1->text().toLong(),
                                              LineEdit2->text().toLong(),
                                              LineEdit3->text().toLong(),
                                              LineEdit4->text().toLong(),
                                              LineEdit5->text().toLong(),
                                              LineEdit6->text().toLong(),
                                              toCreatePolygons,
                                              toCreatePolyedrs);
      else if (aConstructorId == 1)
        anError = aMeshEditor->SewConformFreeBorders(LineEdit1->text().toLong(),
                                                     LineEdit2->text().toLong(),
                                                     LineEdit3->text().toLong(),
                                                     LineEdit4->text().toLong(),
                                                     LineEdit5->text().toLong());
      else if (aConstructorId == 2)
        anError = aMeshEditor->SewBorderToSide(LineEdit1->text().toLong(),
                                               LineEdit2->text().toLong(),
                                               LineEdit3->text().toLong(),
                                               LineEdit4->text().toLong(),
                                               LineEdit6->text().toLong(),
                                               toCreatePolygons,
                                               toCreatePolyedrs);
      else if (aConstructorId == 3) {
        QStringList aListElementsId1 = LineEdit1->text().split(" ", QString::SkipEmptyParts);
        QStringList aListElementsId2 = LineEdit4->text().split(" ", QString::SkipEmptyParts);

        SMESH::long_array_var anElementsId1 = new SMESH::long_array;
        SMESH::long_array_var anElementsId2 = new SMESH::long_array;

        anElementsId1->length(aListElementsId1.count());
        anElementsId2->length(aListElementsId2.count());

        for (int i = 0; i < aListElementsId1.count(); i++)
          anElementsId1[i] = aListElementsId1[i].toInt();
        for (int i = 0; i < aListElementsId2.count(); i++)
          anElementsId2[i] = aListElementsId2[i].toInt();

        anError = aMeshEditor->SewSideElements(anElementsId1.inout(),
                                               anElementsId2.inout(),
                                               LineEdit2->text().toLong(),
                                               LineEdit5->text().toLong(),
                                               LineEdit3->text().toLong(),
                                               LineEdit6->text().toLong());
      }
      aResult = (anError == SMESH::SMESH_MeshEditor::SEW_OK);

      if (toMerge && aResult)
        aMeshEditor->MergeEqualElements();

      if (!aResult) {
        QString msg = tr(QString("ERROR_%1").arg(anError).toLatin1().data());
        SUIT_MessageBox::warning(this, tr("SMESH_WRN_WARNING"), msg);
      }
    } catch (...) {
    }

    if (aResult) {
      Handle(SALOME_InteractiveObject) anIO = myActor->getIO();

      SALOME_ListIO aList;
      aList.Append(anIO);
      mySelectionMgr->setSelectedObjects(aList, false);
      SMESH::UpdateView();

      Init();
      ConstructorsClicked(GetConstructorId());

      SMESHGUI::Modified();
    }
  }

  return aResult;
}
void SMESHGUI_SewingDlg::ClickOnCancel ( ) [private, slot]

Definition at line 558 of file SMESHGUI_SewingDlg.cxx.

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

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

{
  //mySelectionMgr->clearSelected();
  SMESH::SetPointRepresentation(false);
  if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
    aViewWindow->SetSelectionMode(ActorSelection);
  disconnect(mySelectionMgr, 0, this, 0);
  mySMESHGUI->ResetState();
  reject();
}
void SMESHGUI_SewingDlg::ClickOnHelp ( ) [private, slot]

Definition at line 573 of file SMESHGUI_SewingDlg.cxx.

References myHelpFileName, and mySMESHGUI.

Referenced by keyPressEvent(), and SMESHGUI_SewingDlg().

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

Definition at line 548 of file SMESHGUI_SewingDlg.cxx.

References ClickOnApply(), and ClickOnCancel().

Referenced by SMESHGUI_SewingDlg().

void SMESHGUI_SewingDlg::closeEvent ( QCloseEvent *  ) [private]

Definition at line 880 of file SMESHGUI_SewingDlg.cxx.

References ClickOnCancel().

{
  /* same than click on cancel button */
  ClickOnCancel();
}
void SMESHGUI_SewingDlg::ConstructorsClicked ( int  constructorId) [private, slot]

Definition at line 317 of file SMESHGUI_SewingDlg.cxx.

References CheckBoxPolyedrs, CheckBoxPolygons, SMESH.GetViewWindow(), GroupArguments, LineEdit1, LineEdit2, LineEdit3, LineEdit4, LineEdit5, LineEdit6, myEditCurrentArgument, myOk1, myOk2, myOk3, myOk4, myOk5, myOk6, mySelectionMgr, mySMESHGUI, SelectButton5, SelectButton6, SelectionIntoArgument(), SMESH.SetPointRepresentation(), SubGroup1, SubGroup2, TextLabel1, TextLabel2, TextLabel3, TextLabel4, TextLabel5, and TextLabel6.

Referenced by ActivateThisDialog(), ClickOnApply(), and SMESHGUI_SewingDlg().

{
  disconnect(mySelectionMgr, 0, this, 0);
  SALOME_ListIO io;
  mySelectionMgr->selectedObjects( io );
  mySelectionMgr->clearSelected();
  LineEdit1->setText("");
  LineEdit2->setText("");
  LineEdit3->setText("");
  LineEdit4->setText("");
  LineEdit5->setText("");
  LineEdit6->setText("");
  myOk1 = myOk2 = myOk3 = myOk4 = myOk5 = myOk6 = false;
  myEditCurrentArgument = LineEdit1;
  myEditCurrentArgument->setFocus();

  if (!TextLabel5->isEnabled()) {
    TextLabel5->setEnabled(true);
    SelectButton5->setEnabled(true);
    LineEdit5->setEnabled(true);
  } else if (!TextLabel6->isEnabled()) {
    TextLabel6->setEnabled(true);
    SelectButton6->setEnabled(true);
    LineEdit6->setEnabled(true);
  }

  if (constructorId == 1 || constructorId == 3) {
    if (CheckBoxPolygons->isVisible())
      CheckBoxPolygons->hide();
    if (CheckBoxPolyedrs->isVisible())
      CheckBoxPolyedrs->hide();
  }

  switch (constructorId) {
  case 0:
    {
      GroupArguments->setTitle(tr("SEW_FREE_BORDERS"));
      SubGroup1->setTitle(tr("BORDER_1"));
      SubGroup2->setTitle(tr("BORDER_2"));

        if (!CheckBoxPolygons->isVisible())
          CheckBoxPolygons->show();
        if (!CheckBoxPolyedrs->isVisible())
          CheckBoxPolyedrs->show();

      break;
    }
  case 1:
    {
      GroupArguments->setTitle(tr("SEW_CONFORM_FREE_BORDERS"));
      SubGroup1->setTitle(tr("BORDER_1"));
      SubGroup2->setTitle(tr("BORDER_2"));

      TextLabel6->setEnabled(false);
      SelectButton6->setEnabled(false);
      LineEdit6->setEnabled(false);

      myOk6 = true;

      break;
    }
  case 2:
    {
      GroupArguments->setTitle(tr("SEW_BORDER_TO_SIDE"));
      SubGroup1->setTitle(tr("BORDER"));
      SubGroup2->setTitle(tr("SIDE"));

      TextLabel5->setEnabled(false);
      SelectButton5->setEnabled(false);
      LineEdit5->setEnabled(false);

      if (!CheckBoxPolygons->isVisible())
        CheckBoxPolygons->show();
      if (!CheckBoxPolyedrs->isVisible())
        CheckBoxPolyedrs->show();
      
      myOk5 = true;

      break;
    }
  case 3:
    {
      GroupArguments->setTitle(tr("SEW_SIDE_ELEMENTS"));
      SubGroup1->setTitle(tr("SIDE_1"));
      SubGroup2->setTitle(tr("SIDE_2"));

      TextLabel1->setText(tr("SMESH_ID_ELEMENTS"));
      TextLabel2->setText(tr("NODE1_TO_MERGE"));
      TextLabel3->setText(tr("NODE2_TO_MERGE"));
      TextLabel4->setText(tr("SMESH_ID_ELEMENTS"));
      TextLabel5->setText(tr("NODE1_TO_MERGE"));
      TextLabel6->setText(tr("NODE2_TO_MERGE"));

      LineEdit1->setValidator(new SMESHGUI_IdValidator(this));
      LineEdit4->setValidator(new SMESHGUI_IdValidator(this));

      SMESH::SetPointRepresentation(false);

      if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
        aViewWindow->SetSelectionMode(CellSelection);
      break;
    }
  }

  if (constructorId != 3) {
    TextLabel1->setText(tr("FIRST_NODE_ID"));
    TextLabel2->setText(tr("SECOND_NODE_ID"));
    TextLabel3->setText(tr("LAST_NODE_ID"));
    TextLabel4->setText(tr("FIRST_NODE_ID"));
    TextLabel5->setText(tr("SECOND_NODE_ID"));
    TextLabel6->setText(tr("LAST_NODE_ID"));

    LineEdit1->setValidator(new SMESHGUI_IdValidator(this, 1));
    LineEdit4->setValidator(new SMESHGUI_IdValidator(this, 1));

    SMESH::SetPointRepresentation(true);

    if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
      aViewWindow->SetSelectionMode(NodeSelection);
  }

  connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
  mySelectionMgr->setSelectedObjects( io );

  QApplication::instance()->processEvents();
  updateGeometry();
  resize(100,100);
}
void SMESHGUI_SewingDlg::DeactivateActiveDialog ( ) [private, slot]

Definition at line 837 of file SMESHGUI_SewingDlg.cxx.

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

Referenced by SMESHGUI_SewingDlg().

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

Definition at line 870 of file SMESHGUI_SewingDlg.cxx.

References ActivateThisDialog(), and ConstructorsBox.

{
  if (!ConstructorsBox->isEnabled())
    ActivateThisDialog();
}
int SMESHGUI_SewingDlg::GetConstructorId ( ) [private]
void SMESHGUI_SewingDlg::hideEvent ( QHideEvent *  ) [private]

Definition at line 890 of file SMESHGUI_SewingDlg.cxx.

References ClickOnCancel().

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

Definition at line 299 of file SMESHGUI_SewingDlg.cxx.

References CheckBoxMerge, CheckBoxPolyedrs, CheckBoxPolygons, LineEdit1, myActor, myBusy, myEditCurrentArgument, myMesh, and SelectionIntoArgument().

Referenced by ClickOnApply(), and SMESHGUI_SewingDlg().

{
  myBusy = false;

  myEditCurrentArgument = LineEdit1;
  LineEdit1->setFocus();
  myActor = 0;
  myMesh = SMESH::SMESH_Mesh::_nil();
  CheckBoxMerge->setChecked(false);
  CheckBoxPolygons->setChecked(false);
  CheckBoxPolyedrs->setChecked(false);
  SelectionIntoArgument();
}
bool SMESHGUI_SewingDlg::IsValid ( ) [private]

Definition at line 909 of file SMESHGUI_SewingDlg.cxx.

References myOk1, myOk2, myOk3, myOk4, myOk5, and myOk6.

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

{
  return (myOk1 && myOk2 && myOk3 && myOk4 && myOk5 && myOk6);
}
void SMESHGUI_SewingDlg::keyPressEvent ( QKeyEvent *  e) [private]

Definition at line 918 of file SMESHGUI_SewingDlg.cxx.

References ClickOnHelp().

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

  if ( e->key() == Qt::Key_F1 ) {
    e->accept();
    ClickOnHelp();
  }
}
void SMESHGUI_SewingDlg::onTextChange ( const QString &  theNewText) [private, slot]

Definition at line 597 of file SMESHGUI_SewingDlg.cxx.

References buttonApply, buttonOk, SMDS_Mesh.FindElement(), SMDS_Mesh.FindNode(), GetConstructorId(), SMDS_MeshElement.GetID(), SMESH_Actor.GetObject(), SMESH.GetViewWindow(), IsValid(), LineEdit1, LineEdit2, LineEdit3, LineEdit4, LineEdit5, LineEdit6, myActor, myBusy, myEditCurrentArgument, myOk1, myOk2, myOk3, myOk4, myOk5, myOk6, mySelector, mySMESHGUI, and SMESH.SetPointRepresentation().

Referenced by SMESHGUI_SewingDlg().

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

  if (myBusy) return;
  myBusy = true;

  if (send)
    myEditCurrentArgument = send;

  if      (send == LineEdit1)
    myOk1 = false;
  else if (send == LineEdit2)
    myOk2 = false;
  else if (send == LineEdit3)
    myOk3 = false;
  else if (send == LineEdit4)
    myOk4 = false;
  else if (send == LineEdit5)
    myOk5 = false;
  else if (send == LineEdit6)
    myOk6 = false;

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

  // hilight entered elements/nodes
  SMDS_Mesh* aMesh = 0;

  if (myActor)
    aMesh = myActor->GetObject()->GetMesh();
  else
    send->clear();

  if (aMesh) {
    TColStd_MapOfInteger newIndices;
    
    if (GetConstructorId() != 3 || (send != LineEdit1 && send != LineEdit4)) {
      SMESH::SetPointRepresentation(true);

      if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
        aViewWindow->SetSelectionMode(NodeSelection);

      const SMDS_MeshNode * n = aMesh->FindNode(theNewText.toInt());
      if (n) {
        newIndices.Add(n->GetID());
        mySelector->AddOrRemoveIndex(myActor->getIO(), newIndices, false);
        if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
          aViewWindow->highlight( myActor->getIO(), true, true );
        
        if      (send == LineEdit1)
          myOk1 = true;
        else if (send == LineEdit2)
          myOk2 = true;
        else if (send == LineEdit3)
          myOk3 = true;
        else if (send == LineEdit4)
          myOk4 = true;
        else if (send == LineEdit5)
          myOk5 = true;
        else if (send == LineEdit6)
          myOk6 = true;
      }
    } else {
      SMESH::SetPointRepresentation(false);

      if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
        aViewWindow->SetSelectionMode(CellSelection);

      QStringList aListId = theNewText.split(" ", QString::SkipEmptyParts);

      bool isEvenOneExists = false;

      for (int i = 0; i < aListId.count(); i++) {
        const SMDS_MeshElement * e = aMesh->FindElement(aListId[ i ].toInt());
        if (e) 
          newIndices.Add(e->GetID());
        
          if (!isEvenOneExists)
            isEvenOneExists = true;
      }
      

      mySelector->AddOrRemoveIndex(myActor->getIO(), newIndices, false);
      if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
        aViewWindow->highlight( myActor->getIO(), true, true );
      
      if (isEvenOneExists) {
        if (send == LineEdit1)
          myOk1 = true;
        else if(send == LineEdit4)
          myOk4 = true;
      } else {
        send->clear();
      }
    }
  }

  if (IsValid()) {
    buttonOk->setEnabled(true);
    buttonApply->setEnabled(true);
  }

  myBusy = false;
}
void SMESHGUI_SewingDlg::SelectionIntoArgument ( bool  isSelectionChanged = true) [private, slot]

Definition at line 707 of file SMESHGUI_SewingDlg.cxx.

References buttonApply, buttonOk, SMESH.FindActorByEntry(), GetConstructorId(), SMESH.GetMeshByIO(), SMESH.GetNameOfSelectedElements(), SMESH.GetNameOfSelectedNodes(), GroupButtons, Handle(), IsValid(), LineEdit1, LineEdit2, LineEdit3, LineEdit4, LineEdit5, LineEdit6, myActor, myBusy, myEditCurrentArgument, myMesh, myOk1, myOk2, myOk3, myOk4, myOk5, myOk6, mySelectionMgr, and mySelector.

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

{
  if (myBusy) return;

  // clear
  if (isSelectionChanged)
    myActor = 0;

  QString aString = "";

  myBusy = true;
  myEditCurrentArgument->setText(aString);
  myBusy = false;

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

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

  // 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();
  myMesh = SMESH::GetMeshByIO(IO); //@ SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(IO);
  myActor = SMESH::FindActorByEntry(aList.First()->getEntry());

  if (myMesh->_is_nil() || !myActor)
    return;

  // get selected elements/nodes
  int aNbUnits = 0;

  if (GetConstructorId() != 3 ||
      (myEditCurrentArgument != LineEdit1 && myEditCurrentArgument != LineEdit4)) {
    aNbUnits = SMESH::GetNameOfSelectedNodes(mySelector, IO, aString);
    if (aNbUnits != 1)
      return;
  } else {
    aNbUnits = SMESH::GetNameOfSelectedElements(mySelector, IO, aString);
    if (aNbUnits < 1)
      return;
  }

  myBusy = true;
  myEditCurrentArgument->setText(aString);
  myBusy = false;

  // OK
  if (myEditCurrentArgument == LineEdit1)
    myOk1 = true;
  else if (myEditCurrentArgument == LineEdit2)
    myOk2 = true;
  else if (myEditCurrentArgument == LineEdit3)
    myOk3 = true;
  else if (myEditCurrentArgument == LineEdit4)
    myOk4 = true;
  else if (myEditCurrentArgument == LineEdit5)
    myOk5 = true;
  else if (myEditCurrentArgument == LineEdit6)
    myOk6 = true;

  if (IsValid()) {
    buttonOk->setEnabled(true);
    buttonApply->setEnabled(true);
  }
}
void SMESHGUI_SewingDlg::SetEditCurrentArgument ( ) [private, slot]

Definition at line 784 of file SMESHGUI_SewingDlg.cxx.

References GetConstructorId(), SMESH.GetViewWindow(), LineEdit1, LineEdit2, LineEdit3, LineEdit4, LineEdit5, LineEdit6, myEditCurrentArgument, myOk1, myOk2, myOk3, myOk4, myOk5, myOk6, mySelectionMgr, mySMESHGUI, SelectButton1, SelectButton2, SelectButton3, SelectButton4, SelectButton5, SelectButton6, SelectionIntoArgument(), and SMESH.SetPointRepresentation().

Referenced by SMESHGUI_SewingDlg().

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

  disconnect(mySelectionMgr, 0, this, 0);
  mySelectionMgr->clearSelected();

  if (send == SelectButton1) {
    myEditCurrentArgument = LineEdit1;
    myOk1 = false;
  }
  else if (send == SelectButton2) {
    myEditCurrentArgument = LineEdit2;
    myOk2 = false;
  }
  else if (send == SelectButton3) {
    myEditCurrentArgument = LineEdit3;
    myOk3 = false;
  }
  else if (send == SelectButton4) {
    myEditCurrentArgument = LineEdit4;
    myOk4 = false;
  }
  else if (send == SelectButton5) {
    myEditCurrentArgument = LineEdit5;
    myOk5 = false;
  }
  else if (send == SelectButton6) {
    myEditCurrentArgument = LineEdit6;
    myOk6 = false;
  }

  if (GetConstructorId() != 3 || (send != SelectButton1 && send != SelectButton4)) {
    SMESH::SetPointRepresentation(true);

    if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
      aViewWindow->SetSelectionMode(NodeSelection);

  } else {
    SMESH::SetPointRepresentation(false);
    if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
      aViewWindow->SetSelectionMode(CellSelection);
  }

  myEditCurrentArgument->setFocus();
  connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
  SelectionIntoArgument(false);
}

Field Documentation

QPushButton* SMESHGUI_SewingDlg.buttonApply [private]

Definition at line 92 of file SMESHGUI_SewingDlg.h.

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

QPushButton* SMESHGUI_SewingDlg.buttonCancel [private]

Definition at line 91 of file SMESHGUI_SewingDlg.h.

Referenced by SMESHGUI_SewingDlg().

QPushButton* SMESHGUI_SewingDlg.buttonHelp [private]

Definition at line 93 of file SMESHGUI_SewingDlg.h.

Referenced by SMESHGUI_SewingDlg().

QPushButton* SMESHGUI_SewingDlg.buttonOk [private]

Definition at line 90 of file SMESHGUI_SewingDlg.h.

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

QCheckBox* SMESHGUI_SewingDlg.CheckBoxMerge [private]

Definition at line 115 of file SMESHGUI_SewingDlg.h.

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

Definition at line 117 of file SMESHGUI_SewingDlg.h.

Referenced by ClickOnApply(), ConstructorsClicked(), Init(), and SMESHGUI_SewingDlg().

Definition at line 116 of file SMESHGUI_SewingDlg.h.

Referenced by ClickOnApply(), ConstructorsClicked(), Init(), and SMESHGUI_SewingDlg().

QButtonGroup* SMESHGUI_SewingDlg.GroupConstructors [private]

Definition at line 84 of file SMESHGUI_SewingDlg.h.

Referenced by GetConstructorId(), and SMESHGUI_SewingDlg().

QLineEdit* SMESHGUI_SewingDlg.LineEdit1 [private]
QLineEdit* SMESHGUI_SewingDlg.LineEdit2 [private]
QLineEdit* SMESHGUI_SewingDlg.LineEdit3 [private]
QLineEdit* SMESHGUI_SewingDlg.LineEdit4 [private]
QLineEdit* SMESHGUI_SewingDlg.LineEdit5 [private]
QLineEdit* SMESHGUI_SewingDlg.LineEdit6 [private]

Definition at line 81 of file SMESHGUI_SewingDlg.h.

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

Definition at line 79 of file SMESHGUI_SewingDlg.h.

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

Definition at line 119 of file SMESHGUI_SewingDlg.h.

Referenced by ClickOnHelp(), and SMESHGUI_SewingDlg().

SMESH::SMESH_Mesh_var SMESHGUI_SewingDlg.myMesh [private]

Definition at line 80 of file SMESHGUI_SewingDlg.h.

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

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

Definition at line 77 of file SMESHGUI_SewingDlg.h.

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

QRadioButton* SMESHGUI_SewingDlg.RadioButton1 [private]

Definition at line 85 of file SMESHGUI_SewingDlg.h.

Referenced by SMESHGUI_SewingDlg().

QRadioButton* SMESHGUI_SewingDlg.RadioButton2 [private]

Definition at line 86 of file SMESHGUI_SewingDlg.h.

Referenced by SMESHGUI_SewingDlg().

QRadioButton* SMESHGUI_SewingDlg.RadioButton3 [private]

Definition at line 87 of file SMESHGUI_SewingDlg.h.

Referenced by SMESHGUI_SewingDlg().

QRadioButton* SMESHGUI_SewingDlg.RadioButton4 [private]

Definition at line 88 of file SMESHGUI_SewingDlg.h.

Referenced by SMESHGUI_SewingDlg().

QPushButton* SMESHGUI_SewingDlg.SelectButton1 [private]

Definition at line 103 of file SMESHGUI_SewingDlg.h.

Referenced by SetEditCurrentArgument(), and SMESHGUI_SewingDlg().

QPushButton* SMESHGUI_SewingDlg.SelectButton2 [private]

Definition at line 104 of file SMESHGUI_SewingDlg.h.

Referenced by SetEditCurrentArgument(), and SMESHGUI_SewingDlg().

QPushButton* SMESHGUI_SewingDlg.SelectButton3 [private]

Definition at line 105 of file SMESHGUI_SewingDlg.h.

Referenced by SetEditCurrentArgument(), and SMESHGUI_SewingDlg().

QPushButton* SMESHGUI_SewingDlg.SelectButton4 [private]

Definition at line 106 of file SMESHGUI_SewingDlg.h.

Referenced by SetEditCurrentArgument(), and SMESHGUI_SewingDlg().

QPushButton* SMESHGUI_SewingDlg.SelectButton5 [private]
QPushButton* SMESHGUI_SewingDlg.SelectButton6 [private]

Definition at line 95 of file SMESHGUI_SewingDlg.h.

Referenced by ConstructorsClicked(), and SMESHGUI_SewingDlg().

Definition at line 96 of file SMESHGUI_SewingDlg.h.

Referenced by ConstructorsClicked(), and SMESHGUI_SewingDlg().

QLabel* SMESHGUI_SewingDlg.TextLabel1 [private]

Definition at line 97 of file SMESHGUI_SewingDlg.h.

Referenced by ConstructorsClicked(), and SMESHGUI_SewingDlg().

QLabel* SMESHGUI_SewingDlg.TextLabel2 [private]

Definition at line 98 of file SMESHGUI_SewingDlg.h.

Referenced by ConstructorsClicked(), and SMESHGUI_SewingDlg().

QLabel* SMESHGUI_SewingDlg.TextLabel3 [private]

Definition at line 99 of file SMESHGUI_SewingDlg.h.

Referenced by ConstructorsClicked(), and SMESHGUI_SewingDlg().

QLabel* SMESHGUI_SewingDlg.TextLabel4 [private]

Definition at line 100 of file SMESHGUI_SewingDlg.h.

Referenced by ConstructorsClicked(), and SMESHGUI_SewingDlg().

QLabel* SMESHGUI_SewingDlg.TextLabel5 [private]

Definition at line 101 of file SMESHGUI_SewingDlg.h.

Referenced by ConstructorsClicked(), and SMESHGUI_SewingDlg().

QLabel* SMESHGUI_SewingDlg.TextLabel6 [private]

Definition at line 102 of file SMESHGUI_SewingDlg.h.

Referenced by ConstructorsClicked(), and SMESHGUI_SewingDlg().

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