Back to index

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

#include <BlocksGUI_QuadFaceDlg.h>

List of all members.

Public Member Functions

 BlocksGUI_QuadFaceDlg (GeometryGUI *, QWidget *)
 ~BlocksGUI_QuadFaceDlg ()

Protected Member Functions

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

Private Types

enum  {
  Vertex1, Vertex2, Vertex3, Vertex4,
  Edge12, Edge22, Edge14, Edge24,
  Edge34, Edge44
}

Private Slots

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

Private Member Functions

void Init ()
void enterEvent (QEvent *)
void createSelWg (const QString &, QPixmap &, QWidget *, const int)
void activateSelection ()

Private Attributes

int myConstructorId
GEOM::GeomObjPtr myShape1
GEOM::GeomObjPtr myShape2
GEOM::GeomObjPtr myShape3
GEOM::GeomObjPtr myShape4
bool myInitial
QGroupBox * myGrp1
QGroupBox * myGrp2
QGroupBox * myGrp3
QMap< int, QPushButton * > mySelBtn
QMap< int, QLineEdit * > mySelName

Detailed Description

Definition at line 43 of file BlocksGUI_QuadFaceDlg.h.


Member Enumeration Documentation

anonymous enum [private]
Enumerator:
Vertex1 
Vertex2 
Vertex3 
Vertex4 
Edge12 
Edge22 
Edge14 
Edge24 
Edge34 
Edge44 

Definition at line 47 of file BlocksGUI_QuadFaceDlg.h.


Constructor & Destructor Documentation

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

Definition at line 51 of file BlocksGUI_QuadFaceDlg.cxx.

  : GEOMBase_Skeleton(theGeometryGUI, parent),
    myInitial(true)
{
  SUIT_ResourceMgr* aResMgr = myGeomGUI->getApp()->resourceMgr();
  QPixmap image1 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_QUAD_FACE_4_VERT")));
  QPixmap image2 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_QUAD_FACE_2_EDGE")));
  QPixmap image3 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_QUAD_FACE_4_EDGE")));
  QPixmap imageS (aResMgr->loadPixmap("GEOM", tr("ICON_SELECT")));

  setWindowTitle(tr("GEOM_QUAD_FACE_TITLE"));

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

  mainFrame()->RadioButton1->setIcon(image1);
  mainFrame()->RadioButton2->setIcon(image2);
  mainFrame()->RadioButton3->setIcon(image3);

  // Create first group
  myGrp1 = new QGroupBox(tr("GEOM_ARGUMENTS"), centralWidget());

  createSelWg(tr("VERTEX_1"), imageS, myGrp1, Vertex1);
  createSelWg(tr("VERTEX_2"), imageS, myGrp1, Vertex2);
  createSelWg(tr("VERTEX_3"), imageS, myGrp1, Vertex3);
  createSelWg(tr("VERTEX_4"), imageS, myGrp1, Vertex4);

  // Create second group
  myGrp2 = new QGroupBox(tr("GEOM_ARGUMENTS"), centralWidget());

  createSelWg(tr("EDGE_1"), imageS, myGrp2, Edge12);
  createSelWg(tr("EDGE_2"), imageS, myGrp2, Edge22);

  // Create fird group
  myGrp3 = new QGroupBox(tr("GEOM_ARGUMENTS"), centralWidget());

  createSelWg(tr("EDGE_1"), imageS, myGrp3, Edge14);
  createSelWg(tr("EDGE_2"), imageS, myGrp3, Edge24);
  createSelWg(tr("EDGE_3"), imageS, myGrp3, Edge34);
  createSelWg(tr("EDGE_4"), imageS, myGrp3, Edge44);

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

  setHelpFileName("build_by_blocks_page.html#quad_face_anchor");

  Init();
}

Here is the call graph for this function:

Definition at line 109 of file BlocksGUI_QuadFaceDlg.cxx.

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

Member Function Documentation

Definition at line 461 of file BlocksGUI_QuadFaceDlg.cxx.

{
  globalSelection(); // close local contexts, if any
  if (myEditCurrentArgument == mySelName[Vertex1] ||
      myEditCurrentArgument == mySelName[Vertex2] ||
      myEditCurrentArgument == mySelName[Vertex3] ||
      myEditCurrentArgument == mySelName[Vertex4])
  {
    localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX); //Select Vertices on All Shapes
  }
  else
  {
    localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE); //Select Edges 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:

Definition at line 409 of file BlocksGUI_QuadFaceDlg.cxx.

{
  GEOMBase_Skeleton::ActivateThisDialog();
  activateSelection();

  // ??
  displayPreview(true);
}

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 550 of file BlocksGUI_QuadFaceDlg.cxx.

{
  switch (getConstructorId()) {
  case 0:
    GEOMBase::PublishSubObject( myShape1.get() );
    GEOMBase::PublishSubObject( myShape2.get() );
    GEOMBase::PublishSubObject( myShape3.get() );
    GEOMBase::PublishSubObject( myShape4.get() );
    break;
  case 1:
    GEOMBase::PublishSubObject( myShape1.get() );
    GEOMBase::PublishSubObject( myShape2.get() );
    break;
  case 2:
    GEOMBase::PublishSubObject( myShape1.get() );
    GEOMBase::PublishSubObject( myShape2.get() );
    GEOMBase::PublishSubObject( myShape3.get() );
    GEOMBase::PublishSubObject( myShape4.get() );
    break;
  default:
    break;
  }
}

Here is the call graph for this function:

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

Definition at line 205 of file BlocksGUI_QuadFaceDlg.cxx.

{
  if (!onAccept())
    return false;

  initName();
  return true;
}

Here is the caller graph for this function:

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

Definition at line 194 of file BlocksGUI_QuadFaceDlg.cxx.

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

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 141 of file BlocksGUI_QuadFaceDlg.cxx.

{
  if (myConstructorId == constructorId)
    return;

  myConstructorId = constructorId;

  // init fields
  myShape1.nullify();
  myShape2.nullify();
  myShape3.nullify();
  myShape4.nullify();

  // clear line edits
  QMap<int, QLineEdit*>::iterator anIterLE;
  for (anIterLE = mySelName.begin(); anIterLE != mySelName.end(); ++anIterLE)
    anIterLE.value()->setText("");

  switch (constructorId) {
  case 0:
    myGrp2->hide();
    myGrp3->hide();
    myGrp1->show();
    mySelBtn[Vertex1]->click();
    break;
  case 1:
    myGrp1->hide();
    myGrp3->hide();
    myGrp2->show();
    mySelBtn[Edge12]->click();
    break;
  case 2:
    myGrp1->hide();
    myGrp2->hide();
    myGrp3->show();
    mySelBtn[Edge14]->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_QuadFaceDlg::createOperation ( ) [protected, virtual]

Definition at line 483 of file BlocksGUI_QuadFaceDlg.cxx.

{
  return getGeomEngine()->GetIBlocksOperations(getStudyId());
}
void BlocksGUI_QuadFaceDlg::createSelWg ( const QString &  theLbl,
QPixmap &  thePix,
QWidget *  theParent,
const int  theId 
) [private]

Definition at line 432 of file BlocksGUI_QuadFaceDlg.cxx.

{
  QLabel* lab = new QLabel(theLbl, theParent);
  mySelBtn[theId] = new QPushButton(theParent);
  mySelBtn[theId]->setIcon(thePix);
  mySelBtn[theId]->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
  mySelName[theId] = new QLineEdit(theParent);
  mySelName[theId]->setReadOnly(true);
  QGridLayout* l = 0;
  if (!theParent->layout()) {
    l = new QGridLayout(theParent);
    l->setMargin(9); l->setSpacing(6);
  }
  else {
    l = qobject_cast<QGridLayout*>(theParent->layout());
  }
  int row = l->rowCount();
  l->addWidget(lab,              row, 0);
  l->addWidget(mySelBtn[theId],  row, 1);
  l->addWidget(mySelName[theId], row, 2);
}

Here is the caller graph for this function:

void BlocksGUI_QuadFaceDlg::enterEvent ( QEvent *  ) [private]

Definition at line 422 of file BlocksGUI_QuadFaceDlg.cxx.

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

Here is the call graph for this function:

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

Definition at line 515 of file BlocksGUI_QuadFaceDlg.cxx.

{
  bool res = false;

  GEOM::GEOM_Object_var anObj;

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

  switch (getConstructorId()) {
  case 0:
    anObj = anOper->MakeQuad4Vertices(myShape1.get(), myShape2.get(), myShape3.get(), myShape4.get());
    res = true;
    break;
  case 1:
    anObj = anOper->MakeQuad2Edges(myShape1.get(), myShape2.get());
    res = true;
    break;
  case 2:
    anObj = anOper->MakeQuad(myShape1.get(), myShape2.get(), myShape3.get(), myShape4.get());
    res = true;
    break;
  default:
    break;
  }

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

  return res;
}

Here is the call graph for this function:

void BlocksGUI_QuadFaceDlg::Init ( ) [private]

Definition at line 118 of file BlocksGUI_QuadFaceDlg.cxx.

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

  QMap<int, QPushButton*>::iterator anIterBtn;
  for (anIterBtn = mySelBtn.begin(); anIterBtn != mySelBtn.end(); ++anIterBtn)
    connect(anIterBtn.value(), SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));

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

  myConstructorId = -1;
  ConstructorsClicked(0);
}

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 492 of file BlocksGUI_QuadFaceDlg.cxx.

{
  bool ok = false;
  switch (getConstructorId()) {
  case 0:
    ok = myShape1 && myShape2 && myShape3 && myShape4;
    break;
  case 1:
    ok = myShape1 && myShape2;
    break;
  case 2:
    ok = myShape1 && myShape2 && myShape3 && myShape4;
    break;
  default:
    break;
  }
  return ok;
}

Definition at line 218 of file BlocksGUI_QuadFaceDlg.cxx.

{
  erasePreview();

  // Get index of current selection focus
  int aCurrFocus = -1;
  QMap<int, QLineEdit*>::iterator anIter;
  for (anIter = mySelName.begin(); anIter != mySelName.end(); ++anIter) {
    if (myEditCurrentArgument == anIter.value()) {
      aCurrFocus = anIter.key();
      break;
    }
  }

  TopAbs_ShapeEnum aType = TopAbs_EDGE;
  if (aCurrFocus == Vertex1 || aCurrFocus == Vertex2 ||
      aCurrFocus == Vertex3 || aCurrFocus == Vertex4)
    aType = TopAbs_VERTEX;

  GEOM::GeomObjPtr aSelectedObject = getSelected( aType );
  TopoDS_Shape aShape;
  if ( aSelectedObject && GEOMBase::GetShape( aSelectedObject.get(), aShape ) && !aShape.IsNull() ) {
    QString aName = GEOMBase::GetName( aSelectedObject.get() );
    myEditCurrentArgument->setText( aName );
    switch (aCurrFocus) {
      // four vertices
    case Vertex1:
      myShape1 = aSelectedObject;
      if      (!myShape2) mySelBtn[Vertex2]->click();
      else if (!myShape3) mySelBtn[Vertex3]->click();
      else if (!myShape4) mySelBtn[Vertex4]->click();
      break;
    case Vertex2:
      myShape2 = aSelectedObject;
      if      (!myShape3) mySelBtn[Vertex3]->click();
      else if (!myShape4) mySelBtn[Vertex4]->click();
      else if (!myShape1) mySelBtn[Vertex1]->click();
      break;
    case Vertex3:
      myShape3 = aSelectedObject;
      if      (!myShape4) mySelBtn[Vertex4]->click();
      else if (!myShape1) mySelBtn[Vertex1]->click();
      else if (!myShape2) mySelBtn[Vertex2]->click();
      break;
    case Vertex4:
      myShape4 = aSelectedObject;
      if      (!myShape1) mySelBtn[Vertex1]->click();
      else if (!myShape2) mySelBtn[Vertex2]->click();
      else if (!myShape3) mySelBtn[Vertex3]->click();
      break;
      // two edges
    case Edge12:
      myShape1 = aSelectedObject;
      if      (!myShape2) mySelBtn[Edge22]->click();
      break;
    case Edge22:
      myShape2 = aSelectedObject;
      if      (!myShape1) mySelBtn[Edge12]->click();
      break;
      // four edges
    case Edge14:
      myShape1 = aSelectedObject;
      if      (!myShape2) mySelBtn[Edge24]->click();
      else if (!myShape3) mySelBtn[Edge34]->click();
      else if (!myShape4) mySelBtn[Edge44]->click();
      break;
    case Edge24:
      myShape2 = aSelectedObject;
      if      (!myShape3) mySelBtn[Edge34]->click();
      else if (!myShape4) mySelBtn[Edge44]->click();
      else if (!myShape1) mySelBtn[Edge14]->click();
      break;
    case Edge34:
      myShape3 = aSelectedObject;
      if      (!myShape4) mySelBtn[Edge44]->click();
      else if (!myShape1) mySelBtn[Edge14]->click();
      else if (!myShape2) mySelBtn[Edge24]->click();
      break;
    case Edge44:
      myShape4 = aSelectedObject;
      if      (!myShape1) mySelBtn[Edge14]->click();
      else if (!myShape2) mySelBtn[Edge24]->click();
      else if (!myShape3) mySelBtn[Edge34]->click();
      break;
    default:
      break;
    }
  }
  else {
    switch (aCurrFocus) {
    case Vertex1:
    case Edge12:
    case Edge14:
      myShape1.nullify();
      break;
    case Vertex2:
    case Edge22:
    case Edge24:
      myShape2.nullify();
      break;
    case Vertex3:
    case Edge34:
      myShape3.nullify();
      break;
    case Vertex4:
    case Edge44:
      myShape4.nullify();
      break;
    default:
      break;
    }
    myEditCurrentArgument->setText( "" );
  }

  displayPreview(true);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 339 of file BlocksGUI_QuadFaceDlg.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:
    mySelBtn[Vertex1]->setDown(false);
    mySelBtn[Vertex2]->setDown(false);
    mySelBtn[Vertex3]->setDown(false);
    mySelBtn[Vertex4]->setDown(false);

    mySelName[Vertex1]->setEnabled(false);
    mySelName[Vertex2]->setEnabled(false);
    mySelName[Vertex3]->setEnabled(false);
    mySelName[Vertex4]->setEnabled(false);
    break;
  case 1:
    mySelBtn[Edge12]->setDown(false);
    mySelBtn[Edge22]->setDown(false);

    mySelName[Edge12]->setEnabled(false);
    mySelName[Edge22]->setEnabled(false);
    break;
  case 2:
    mySelBtn[Edge14]->setDown(false);
    mySelBtn[Edge24]->setDown(false);
    mySelBtn[Edge34]->setDown(false);
    mySelBtn[Edge44]->setDown(false);

    mySelName[Edge14]->setEnabled(false);
    mySelName[Edge24]->setEnabled(false);
    mySelName[Edge34]->setEnabled(false);
    mySelName[Edge44]->setEnabled(false);
    break;
  default:
    break;
  }

  // set line edit as current argument
  QMap<int, QPushButton*>::iterator anIter;
  for (anIter = mySelBtn.begin(); anIter != mySelBtn.end(); ++anIter) {
    if (anIter.value() == aSender) {
      myEditCurrentArgument = mySelName[anIter.key()];
      break;
    }
  }

  // enable line edit
  myEditCurrentArgument->setEnabled(true);
  myEditCurrentArgument->setFocus();

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

  activateSelection();
}

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Definition at line 71 of file BlocksGUI_QuadFaceDlg.h.

QGroupBox* BlocksGUI_QuadFaceDlg::myGrp1 [private]

Definition at line 81 of file BlocksGUI_QuadFaceDlg.h.

QGroupBox* BlocksGUI_QuadFaceDlg::myGrp2 [private]

Definition at line 82 of file BlocksGUI_QuadFaceDlg.h.

QGroupBox* BlocksGUI_QuadFaceDlg::myGrp3 [private]

Definition at line 83 of file BlocksGUI_QuadFaceDlg.h.

Definition at line 79 of file BlocksGUI_QuadFaceDlg.h.

QMap<int, QPushButton*> BlocksGUI_QuadFaceDlg::mySelBtn [private]

Definition at line 85 of file BlocksGUI_QuadFaceDlg.h.

QMap<int, QLineEdit*> BlocksGUI_QuadFaceDlg::mySelName [private]

Definition at line 86 of file BlocksGUI_QuadFaceDlg.h.

Definition at line 73 of file BlocksGUI_QuadFaceDlg.h.

Definition at line 74 of file BlocksGUI_QuadFaceDlg.h.

Definition at line 75 of file BlocksGUI_QuadFaceDlg.h.

Definition at line 76 of file BlocksGUI_QuadFaceDlg.h.


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