Back to index

salome-geom  6.5.0
Public Member Functions | Protected Member Functions | Private Slots | Private Member Functions | Private Attributes
BlocksGUI_BlockDlg Class Reference

#include <BlocksGUI_BlockDlg.h>

List of all members.

Public Member Functions

 BlocksGUI_BlockDlg (GeometryGUI *, QWidget *)
 ~BlocksGUI_BlockDlg ()

Protected Member Functions

virtual GEOM::GEOM_IOperations_ptr createOperation ()
virtual bool isValid (QString &)
virtual bool execute (ObjectList &)
virtual void addSubshapesToStudy ()

Private Slots

void ClickOnOk ()
bool ClickOnApply ()
void ActivateThisDialog ()
void ConstructorsClicked (int)
void SelectionIntoArgument ()
void SetEditCurrentArgument ()

Private Member Functions

void Init ()
void enterEvent (QEvent *)

Private Attributes

int myConstructorId
GEOM::GeomObjPtr myFace1
GEOM::GeomObjPtr myFace2
GEOM::GeomObjPtr myFace3
GEOM::GeomObjPtr myFace4
GEOM::GeomObjPtr myFace5
GEOM::GeomObjPtr myFace6
bool myInitial
DlgRef_2Sel * Group2F
DlgRef_6Sel * Group6F

Detailed Description

Definition at line 40 of file BlocksGUI_BlockDlg.h.


Constructor & Destructor Documentation

BlocksGUI_BlockDlg::BlocksGUI_BlockDlg ( GeometryGUI *  theGeometryGUI,
QWidget *  parent 
)

Definition at line 47 of file BlocksGUI_BlockDlg.cxx.

  : GEOMBase_Skeleton(theGeometryGUI, parent),
    myInitial(true)
{
  QPixmap image0 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_DLG_BLOCK_2F")));
  QPixmap image1 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_DLG_BLOCK_6F")));
  QPixmap imageS (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_SELECT")));

  setWindowTitle(tr("GEOM_BLOCK_TITLE"));

  /***************************************************************/
  mainFrame()->GroupConstructors->setTitle(tr("GEOM_BLOCK"));

  mainFrame()->RadioButton1->setIcon(image0);
  mainFrame()->RadioButton2->setIcon(image1);
  mainFrame()->RadioButton3->setAttribute(Qt::WA_DeleteOnClose);
  mainFrame()->RadioButton3->close();

  // Create first group
  Group2F = new DlgRef_2Sel (centralWidget());
  Group2F->GroupBox1->setTitle(tr("GEOM_ARGUMENTS"));
  Group2F->TextLabel1->setText(tr("FACE_1"));
  Group2F->TextLabel2->setText(tr("FACE_2"));
  Group2F->PushButton1->setIcon(imageS);
  Group2F->PushButton2->setIcon(imageS);

  // Create second group
  Group6F = new DlgRef_6Sel (centralWidget());
  Group6F->GroupBox1->setTitle(tr("GEOM_ARGUMENTS"));
  Group6F->TextLabel1->setText(tr("FACE_1"));
  Group6F->TextLabel2->setText(tr("FACE_2"));
  Group6F->TextLabel3->setText(tr("FACE_3"));
  Group6F->TextLabel4->setText(tr("FACE_4"));
  Group6F->TextLabel5->setText(tr("FACE_5"));
  Group6F->TextLabel6->setText(tr("FACE_6"));
  Group6F->PushButton1->setIcon(imageS);
  Group6F->PushButton2->setIcon(imageS);
  Group6F->PushButton3->setIcon(imageS);
  Group6F->PushButton4->setIcon(imageS);
  Group6F->PushButton5->setIcon(imageS);
  Group6F->PushButton6->setIcon(imageS);

  // Add groups to layout
  QVBoxLayout* layout = new QVBoxLayout (centralWidget());
  layout->setMargin(0);
  layout->setSpacing(6);
  layout->addWidget(Group2F);
  layout->addWidget(Group6F);
  /***************************************************************/

  setHelpFileName("build_by_blocks_page.html#hexa_solid_anchor");

  Init();
}

Here is the call graph for this function:

Definition at line 106 of file BlocksGUI_BlockDlg.cxx.

{
  // no need to delete child widgets, Qt does it all for us
}

Member Function Documentation

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

Definition at line 399 of file BlocksGUI_BlockDlg.cxx.

{
  GEOMBase_Skeleton::ActivateThisDialog();
  globalSelection(); // close local contexts, if any
  localSelection(GEOM::GEOM_Object::_nil(), TopAbs_FACE); //Select Faces on All Shapes
  connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
          this, SLOT(SelectionIntoArgument()));
  displayPreview(true);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void BlocksGUI_BlockDlg::addSubshapesToStudy ( ) [protected, virtual]

Definition at line 485 of file BlocksGUI_BlockDlg.cxx.

{
  switch (getConstructorId()) {
  case 0:
    GEOMBase::PublishSubObject( myFace1.get() );
    GEOMBase::PublishSubObject( myFace2.get() );
    break;
  case 1:
    GEOMBase::PublishSubObject( myFace1.get() );
    GEOMBase::PublishSubObject( myFace2.get() );
    GEOMBase::PublishSubObject( myFace3.get() );
    GEOMBase::PublishSubObject( myFace4.get() );
    GEOMBase::PublishSubObject( myFace5.get() );
    GEOMBase::PublishSubObject( myFace6.get() );
    break;
  default:
    break;
  }
}

Here is the call graph for this function:

bool BlocksGUI_BlockDlg::ClickOnApply ( ) [private, slot]

Definition at line 220 of file BlocksGUI_BlockDlg.cxx.

{
  if (!onAccept())
    return false;

  initName();
  return true;
}

Here is the caller graph for this function:

void BlocksGUI_BlockDlg::ClickOnOk ( ) [private, slot]

Definition at line 209 of file BlocksGUI_BlockDlg.cxx.

{
  setIsApplyAndClose( true );
  if (ClickOnApply())
    ClickOnCancel();
}

Here is the call graph for this function:

Here is the caller graph for this function:

void BlocksGUI_BlockDlg::ConstructorsClicked ( int  constructorId) [private, slot]

Definition at line 155 of file BlocksGUI_BlockDlg.cxx.

{
  if (myConstructorId == constructorId)
    return;

  myConstructorId = constructorId;

  // init fields
  myFace1.nullify();
  myFace2.nullify();
  myFace3.nullify();
  myFace4.nullify();
  myFace5.nullify();
  myFace6.nullify();

  switch (constructorId) {
  case 0:
    Group6F->hide();
    Group2F->show();

    Group2F->LineEdit1->setText(tr(""));
    Group2F->LineEdit2->setText(tr(""));

    Group2F->PushButton1->click();
    break;
  case 1:
    Group2F->hide();
    Group6F->show();

    Group6F->LineEdit1->setText(tr(""));
    Group6F->LineEdit2->setText(tr(""));
    Group6F->LineEdit3->setText(tr(""));
    Group6F->LineEdit4->setText(tr(""));
    Group6F->LineEdit5->setText(tr(""));
    Group6F->LineEdit6->setText(tr(""));

    Group6F->PushButton1->click();
    break;
  default:
    break;
  }

  qApp->processEvents();
  updateGeometry();
  resize(minimumSizeHint());

  // on dialog initialization we init the first field with a selected object (if any)
  SelectionIntoArgument();
}

Here is the call graph for this function:

Here is the caller graph for this function:

GEOM::GEOM_IOperations_ptr BlocksGUI_BlockDlg::createOperation ( ) [protected, virtual]

Definition at line 423 of file BlocksGUI_BlockDlg.cxx.

{
  return getGeomEngine()->GetIBlocksOperations(getStudyId());
}
void BlocksGUI_BlockDlg::enterEvent ( QEvent *  ) [private]

Definition at line 413 of file BlocksGUI_BlockDlg.cxx.

{
  if (!mainFrame()->GroupConstructors->isEnabled())
    ActivateThisDialog();
}

Here is the call graph for this function:

bool BlocksGUI_BlockDlg::execute ( ObjectList objects) [protected, virtual]

Definition at line 452 of file BlocksGUI_BlockDlg.cxx.

{
  bool res = false;

  GEOM::GEOM_Object_var anObj;

  GEOM::GEOM_IBlocksOperations_var anOper = GEOM::GEOM_IBlocksOperations::_narrow(getOperation());

  switch (getConstructorId()) {
  case 0:
    if ( myFace1 && myFace2 ) {
      anObj = anOper->MakeHexa2Faces(myFace1.get(), myFace2.get());
      res = true;
    }
    break;
  case 1:
    if ( myFace1 && myFace2 && myFace3 && myFace4 && myFace5 && myFace6 ) {
      anObj = anOper->MakeHexa(myFace1.get(), myFace2.get(), myFace3.get(), myFace4.get(), myFace5.get(), myFace6.get());
      res = true;
    }
    break;
  }

  if (!anObj->_is_nil())
    objects.push_back(anObj._retn());

  return res;
}

Here is the call graph for this function:

void BlocksGUI_BlockDlg::Init ( ) [private]

Definition at line 115 of file BlocksGUI_BlockDlg.cxx.

{
  // init variables
  Group2F->LineEdit1->setReadOnly(true);
  Group2F->LineEdit2->setReadOnly(true);

  Group6F->LineEdit1->setReadOnly(true);
  Group6F->LineEdit2->setReadOnly(true);
  Group6F->LineEdit3->setReadOnly(true);
  Group6F->LineEdit4->setReadOnly(true);
  Group6F->LineEdit5->setReadOnly(true);
  Group6F->LineEdit6->setReadOnly(true);

  // signals and slots connections
  connect(buttonOk(),    SIGNAL(clicked()), this, SLOT(ClickOnOk()));
  connect(buttonApply(), SIGNAL(clicked()), this, SLOT(ClickOnApply()));

  connect(this, SIGNAL(constructorsClicked(int)), this, SLOT(ConstructorsClicked(int)));

  connect(Group2F->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
  connect(Group2F->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));

  connect(Group6F->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
  connect(Group6F->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
  connect(Group6F->PushButton3, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
  connect(Group6F->PushButton4, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
  connect(Group6F->PushButton5, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
  connect(Group6F->PushButton6, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));

  // init controls and fields
  initName(tr("GEOM_BLOCK"));

  myConstructorId = -1;
  ConstructorsClicked(0);
}

Here is the call graph for this function:

Here is the caller graph for this function:

bool BlocksGUI_BlockDlg::isValid ( QString &  ) [protected, virtual]

Definition at line 432 of file BlocksGUI_BlockDlg.cxx.

{
  bool ok = false;
  switch (getConstructorId()) {
  case 0:
    ok = myFace1 && myFace2;
    break;
  case 1:
    ok = myFace1 && myFace2 && myFace3 && myFace4 && myFace5 && myFace6;
    break;
  default:
    break;
  }
  return ok;
}

Definition at line 233 of file BlocksGUI_BlockDlg.cxx.

{
  erasePreview();

  GEOM::GeomObjPtr aSelectedObject = getSelected( TopAbs_FACE );
  TopoDS_Shape aShape;
  if ( aSelectedObject && GEOMBase::GetShape( aSelectedObject.get(), aShape ) && !aShape.IsNull() ) {
    QString aName = GEOMBase::GetName( aSelectedObject.get() );
    myEditCurrentArgument->setText( aName );
    if ( myEditCurrentArgument == Group2F->LineEdit1 ) {
      myFace1 = aSelectedObject;
      if (!myFace2) Group2F->PushButton2->click();
    }
    else if ( myEditCurrentArgument == Group2F->LineEdit2 ) {
      myFace2 = aSelectedObject;
      if (!myFace1) Group2F->PushButton1->click();
    }
    else if ( myEditCurrentArgument == Group6F->LineEdit1 ) {
      myFace1 = aSelectedObject;
      if      (!myFace2) Group6F->PushButton2->click();
      else if (!myFace3) Group6F->PushButton3->click();
      else if (!myFace4) Group6F->PushButton4->click();
      else if (!myFace5) Group6F->PushButton5->click();
      else if (!myFace6) Group6F->PushButton6->click();
    }
    else if ( myEditCurrentArgument == Group6F->LineEdit2 ) {
      myFace2 = aSelectedObject;
      if      (!myFace3) Group6F->PushButton3->click();
      else if (!myFace4) Group6F->PushButton4->click();
      else if (!myFace5) Group6F->PushButton5->click();
      else if (!myFace6) Group6F->PushButton6->click();
      else if (!myFace1) Group6F->PushButton1->click();
    }
    else if ( myEditCurrentArgument == Group6F->LineEdit3 ) {
      myFace3 = aSelectedObject;
      if      (!myFace4) Group6F->PushButton4->click();
      else if (!myFace5) Group6F->PushButton5->click();
      else if (!myFace6) Group6F->PushButton6->click();
      else if (!myFace1) Group6F->PushButton1->click();
      else if (!myFace2) Group6F->PushButton2->click();
    }
    else if ( myEditCurrentArgument == Group6F->LineEdit4 ) {
      myFace4 = aSelectedObject;
      if      (!myFace5) Group6F->PushButton5->click();
      else if (!myFace6) Group6F->PushButton6->click();
      else if (!myFace1) Group6F->PushButton1->click();
      else if (!myFace2) Group6F->PushButton2->click();
      else if (!myFace3) Group6F->PushButton3->click();
    }
    else if ( myEditCurrentArgument == Group6F->LineEdit5 ) {
      myFace5 = aSelectedObject;
      if      (!myFace6) Group6F->PushButton6->click();
      else if (!myFace1) Group6F->PushButton1->click();
      else if (!myFace2) Group6F->PushButton2->click();
      else if (!myFace3) Group6F->PushButton3->click();
      else if (!myFace4) Group6F->PushButton4->click();
    }
    else if ( myEditCurrentArgument == Group6F->LineEdit6 ) {
      myFace6 = aSelectedObject;
      if      (!myFace1) Group6F->PushButton1->click();
      else if (!myFace2) Group6F->PushButton2->click();
      else if (!myFace3) Group6F->PushButton3->click();
      else if (!myFace4) Group6F->PushButton4->click();
      else if (!myFace5) Group6F->PushButton5->click();
    }
  }
  else {
    if      (myEditCurrentArgument == Group2F->LineEdit1) myFace1.nullify();
    else if (myEditCurrentArgument == Group2F->LineEdit2) myFace2.nullify();
    else if (myEditCurrentArgument == Group6F->LineEdit1) myFace1.nullify();
    else if (myEditCurrentArgument == Group6F->LineEdit2) myFace2.nullify();
    else if (myEditCurrentArgument == Group6F->LineEdit3) myFace3.nullify();
    else if (myEditCurrentArgument == Group6F->LineEdit4) myFace4.nullify();
    else if (myEditCurrentArgument == Group6F->LineEdit5) myFace5.nullify();
    else if (myEditCurrentArgument == Group6F->LineEdit6) myFace6.nullify();
    myEditCurrentArgument->setText( "" );
  }

  displayPreview(true);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 318 of file BlocksGUI_BlockDlg.cxx.

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

  // clear selection
  disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
  if (myInitial)
    myInitial = false;
  else
    myGeomGUI->getApp()->selectionMgr()->clearSelected();

  // disable all
  switch (myConstructorId) {
  case 0:
    Group2F->PushButton1->setDown(false);
    Group2F->PushButton2->setDown(false);

    Group2F->LineEdit1->setEnabled(false);
    Group2F->LineEdit2->setEnabled(false);
    break;
  case 1:
    Group6F->PushButton1->setDown(false);
    Group6F->PushButton2->setDown(false);
    Group6F->PushButton3->setDown(false);
    Group6F->PushButton4->setDown(false);
    Group6F->PushButton5->setDown(false);
    Group6F->PushButton6->setDown(false);

    Group6F->LineEdit1->setEnabled(false);
    Group6F->LineEdit2->setEnabled(false);
    Group6F->LineEdit3->setEnabled(false);
    Group6F->LineEdit4->setEnabled(false);
    Group6F->LineEdit5->setEnabled(false);
    Group6F->LineEdit6->setEnabled(false);
    break;
  default:
    break;
  }

  // set line edit as current argument
  if (aSender == Group2F->PushButton1) {
    myEditCurrentArgument = Group2F->LineEdit1;
  }
  else if (aSender == Group2F->PushButton2) {
    myEditCurrentArgument = Group2F->LineEdit2;
  }
  else if (aSender == Group6F->PushButton1) {
    myEditCurrentArgument = Group6F->LineEdit1;
  }
  else if (aSender == Group6F->PushButton2) {
    myEditCurrentArgument = Group6F->LineEdit2;
  }
  else if (aSender == Group6F->PushButton3) {
    myEditCurrentArgument = Group6F->LineEdit3;
  }
  else if (aSender == Group6F->PushButton4) {
    myEditCurrentArgument = Group6F->LineEdit4;
  }
  else if (aSender == Group6F->PushButton5) {
    myEditCurrentArgument = Group6F->LineEdit5;
  }
  else if (aSender == Group6F->PushButton6) {
    myEditCurrentArgument = Group6F->LineEdit6;
  }

  // enable push button and line edit
  myEditCurrentArgument->setEnabled(true);
  myEditCurrentArgument->setFocus();
  // after setFocus(), because it will be setDown(false) when loses focus
  aSender->setDown(true);

  globalSelection(); // close local contexts, if any
  localSelection(GEOM::GEOM_Object::_nil(), TopAbs_FACE); //Select Faces on All Shapes
  connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
          this, SLOT(SelectionIntoArgument()));
}

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

DlgRef_2Sel* BlocksGUI_BlockDlg::Group2F [private]

Definition at line 68 of file BlocksGUI_BlockDlg.h.

DlgRef_6Sel* BlocksGUI_BlockDlg::Group6F [private]

Definition at line 69 of file BlocksGUI_BlockDlg.h.

Definition at line 60 of file BlocksGUI_BlockDlg.h.

Definition at line 62 of file BlocksGUI_BlockDlg.h.

Definition at line 62 of file BlocksGUI_BlockDlg.h.

Definition at line 63 of file BlocksGUI_BlockDlg.h.

Definition at line 63 of file BlocksGUI_BlockDlg.h.

Definition at line 63 of file BlocksGUI_BlockDlg.h.

Definition at line 63 of file BlocksGUI_BlockDlg.h.

Definition at line 66 of file BlocksGUI_BlockDlg.h.


The documentation for this class was generated from the following files: