Back to index

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

#include <BooleanGUI_Dialog.h>

List of all members.

Public Member Functions

 BooleanGUI_Dialog (const int, GeometryGUI *, QWidget *=0, bool=false, Qt::WindowFlags=0)
 ~BooleanGUI_Dialog ()

Protected Member Functions

virtual GEOM::GEOM_IOperations_ptr createOperation ()
virtual bool isValid (QString &)
virtual bool execute (ObjectList &)
virtual void restoreSubShapes (SALOMEDS::Study_ptr, SALOMEDS::SObject_ptr)

Private Slots

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

Private Member Functions

void Init ()
void enterEvent (QEvent *)

Private Attributes

int myOperation
GEOM::GeomObjPtr myObject1
GEOM::GeomObjPtr myObject2
DlgRef_2Sel * myGroup

Detailed Description

Definition at line 39 of file BooleanGUI_Dialog.h.


Constructor & Destructor Documentation

BooleanGUI_Dialog::BooleanGUI_Dialog ( const int  theOperation,
GeometryGUI *  theGeometryGUI,
QWidget *  parent = 0,
bool  modal = false,
Qt::WindowFlags  fl = 0 
)

Definition at line 46 of file BooleanGUI_Dialog.cxx.

  : GEOMBase_Skeleton(theGeometryGUI, parent, modal, fl),
    myOperation(theOperation)
{
  QPixmap image0;
  QString aTitle, aCaption;
  switch (myOperation) {
  case BooleanGUI::COMMON:
    image0 = QPixmap(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_DLG_COMMON")));
    aTitle = tr("GEOM_COMMON");
    aCaption = tr("GEOM_COMMON_TITLE");
    setHelpFileName("common_operation_page.html");
    break;
  case BooleanGUI::CUT:
    image0 = QPixmap(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_DLG_CUT")));
    aTitle = tr("GEOM_CUT");
    aCaption = tr("GEOM_CUT_TITLE");
    setHelpFileName("cut_operation_page.html");
    break;
  case BooleanGUI::FUSE:
    image0 = QPixmap(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_DLG_FUSE")));
    aTitle = tr("GEOM_FUSE");
    aCaption = tr("GEOM_FUSE_TITLE");
    setHelpFileName("fuse_operation_page.html");
    break;
  case BooleanGUI::SECTION:
    image0 = QPixmap(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_DLG_SECTION")));
    aTitle = tr("GEOM_SECTION");
    aCaption = tr("GEOM_SECTION_TITLE");
    setHelpFileName("section_opeartion_page.html");
    break;
  }
  QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_SELECT")));

  setWindowTitle(aCaption);

  /***************************************************************/
  mainFrame()->GroupConstructors->setTitle(aTitle);
  mainFrame()->RadioButton1->setIcon(image0);
  mainFrame()->RadioButton2->setAttribute(Qt::WA_DeleteOnClose);
  mainFrame()->RadioButton2->close();
  mainFrame()->RadioButton3->setAttribute(Qt::WA_DeleteOnClose);
  mainFrame()->RadioButton3->close();

  myGroup = new DlgRef_2Sel(centralWidget());

  myGroup->GroupBox1->setTitle(tr("GEOM_ARGUMENTS"));
  if (myOperation != BooleanGUI::CUT) {
    myGroup->TextLabel1->setText(tr("GEOM_OBJECT_I").arg(1));
    myGroup->TextLabel2->setText(tr("GEOM_OBJECT_I").arg(2));
  }
  else {
    myGroup->TextLabel1->setText(tr("GEOM_MAIN_OBJECT"));
    myGroup->TextLabel2->setText(tr("GEOM_TOOL_OBJECT"));
  }

  myGroup->PushButton1->setIcon(image1);
  myGroup->PushButton2->setIcon(image1);
  myGroup->LineEdit1->setReadOnly(true);
  myGroup->LineEdit2->setReadOnly(true);

  QVBoxLayout* layout = new QVBoxLayout(centralWidget());
  layout->setMargin(0); layout->setSpacing(6);
  layout->addWidget(myGroup);
  /***************************************************************/

  // Initialisation
  Init();
}

Here is the call graph for this function:

Definition at line 121 of file BooleanGUI_Dialog.cxx.

{
}

Member Function Documentation

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

Definition at line 261 of file BooleanGUI_Dialog.cxx.

{
  GEOMBase_Skeleton::ActivateThisDialog();

  connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ),
           this, SLOT( SelectionIntoArgument() ) );
  processPreview();
}

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 181 of file BooleanGUI_Dialog.cxx.

{
  if (!onAccept())
    return false;

  initName();
  // activate selection and connect selection manager
  myGroup->PushButton1->click();
  return true;
}

Here is the caller graph for this function:

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

Definition at line 170 of file BooleanGUI_Dialog.cxx.

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

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 284 of file BooleanGUI_Dialog.cxx.

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

Definition at line 274 of file BooleanGUI_Dialog.cxx.

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

Here is the call graph for this function:

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

Definition at line 302 of file BooleanGUI_Dialog.cxx.

{
  GEOM::GEOM_Object_var anObj;

  GEOM::GEOM_IBooleanOperations_var anOper = GEOM::GEOM_IBooleanOperations::_narrow(getOperation());
  anObj = anOper->MakeBoolean(myObject1.get(), myObject2.get(), myOperation);
  if (!anObj->_is_nil())
    objects.push_back(anObj._retn());

  return true;
}

Here is the call graph for this function:

void BooleanGUI_Dialog::Init ( ) [private]

Definition at line 129 of file BooleanGUI_Dialog.cxx.

{
  mainFrame()->GroupBoxPublish->show();

  // init variables
  myEditCurrentArgument = myGroup->LineEdit1;

  myGroup->LineEdit1->setText("");
  myGroup->LineEdit2->setText("");
  myObject1.nullify();
  myObject2.nullify();
 
  // signals and slots connections
  connect(buttonOk(),    SIGNAL(clicked()), this, SLOT(ClickOnOk()));
  connect(buttonApply(), SIGNAL(clicked()), this, SLOT(ClickOnApply()));

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

  connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
           SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));

  initName(mainFrame()->GroupConstructors->title());

  setTabOrder(mainFrame()->GroupConstructors, mainFrame()->GroupBoxName);
  setTabOrder(mainFrame()->GroupBoxName, mainFrame()->GroupMedium);
  setTabOrder(mainFrame()->GroupMedium, mainFrame()->GroupButtons);

  mainFrame()->RadioButton1->setFocus();

  globalSelection(GEOM_ALLSHAPES);

  myGroup->PushButton1->click();
  SelectionIntoArgument();
  resize(100,100);
}

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 293 of file BooleanGUI_Dialog.cxx.

{
  return myObject1 && myObject2;
}
void BooleanGUI_Dialog::restoreSubShapes ( SALOMEDS::Study_ptr  theStudy,
SALOMEDS::SObject_ptr  theSObject 
) [protected, virtual]

Definition at line 318 of file BooleanGUI_Dialog.cxx.

{
  if (mainFrame()->CheckBoxRestoreSS->isChecked()) {
    // empty list of arguments means that all arguments should be restored
    getGeomEngine()->RestoreSubShapesSO(theStudy, theSObject, GEOM::ListOfGO(),
                                         /*theFindMethod=*/GEOM::FSM_GetInPlace, // ? GEOM::FSM_GetSame
                                         /*theInheritFirstArg=*/myOperation == BooleanGUI::CUT,
                                         mainFrame()->CheckBoxAddPrefix->isChecked()); // ? false
  }
}
void BooleanGUI_Dialog::SelectionIntoArgument ( ) [private, slot]

Definition at line 196 of file BooleanGUI_Dialog.cxx.

{
  myEditCurrentArgument->setText("");

  GEOM::GeomObjPtr aSelectedObject = getSelected( TopAbs_SHAPE );
  TopoDS_Shape aShape;
  if ( aSelectedObject && GEOMBase::GetShape( aSelectedObject.get(), aShape ) && !aShape.IsNull() ) {
    QString aName = GEOMBase::GetName( aSelectedObject.get() );
    myEditCurrentArgument->setText( aName );

    // clear selection
    disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
    myGeomGUI->getApp()->selectionMgr()->clearSelected();
    connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
            this, SLOT(SelectionIntoArgument()));

    if (myEditCurrentArgument == myGroup->LineEdit1) {
      myObject1 = aSelectedObject;
      if (!myObject2)
        myGroup->PushButton2->click();
    }
    else if (myEditCurrentArgument == myGroup->LineEdit2) {
      myObject2 = aSelectedObject;
      if (!myObject1)
        myGroup->PushButton1->click();
    }
  }
  else {
    if      (myEditCurrentArgument == myGroup->LineEdit1) myObject1.nullify();
    else if (myEditCurrentArgument == myGroup->LineEdit2) myObject2.nullify();
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 233 of file BooleanGUI_Dialog.cxx.

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

  if (send == myGroup->PushButton1) {
    myEditCurrentArgument = myGroup->LineEdit1;

    myGroup->PushButton2->setDown(false);
    myGroup->LineEdit2->setEnabled(false);
  }
  else if (send == myGroup->PushButton2) {
    myEditCurrentArgument = myGroup->LineEdit2;

    myGroup->PushButton1->setDown(false);
    myGroup->LineEdit1->setEnabled(false);
  }

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

Here is the caller graph for this function:


Member Data Documentation

DlgRef_2Sel* BooleanGUI_Dialog::myGroup [private]

Definition at line 65 of file BooleanGUI_Dialog.h.

Definition at line 62 of file BooleanGUI_Dialog.h.

Definition at line 63 of file BooleanGUI_Dialog.h.

Definition at line 60 of file BooleanGUI_Dialog.h.


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