Back to index

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

#include <OperationGUI_ExtrudedFeatureDlg.h>

List of all members.

Public Member Functions

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

Protected Member Functions

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

Private Slots

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

Private Member Functions

void Init ()
void enterEvent (QEvent *)

Private Attributes

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

Detailed Description

Definition at line 51 of file OperationGUI_ExtrudedFeatureDlg.h.


Constructor & Destructor Documentation

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

Definition at line 54 of file OperationGUI_ExtrudedFeatureDlg.cxx.

  : GEOMBase_Skeleton(theGeometryGUI, parent, modal, fl),
    myOperation(theOperation)
{
  SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
  QPixmap image0;
  QPixmap image1 (aResMgr->loadPixmap("GEOM", tr("ICON_SELECT")));
  QPixmap image2 (aResMgr->loadPixmap("GEOM", tr("ICO_DRAFT")));
  QPixmap image3 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_CHANGE_DIRECTION")));
  QString aTitle;
  switch (myOperation) 
  {
    case OperationGUI::BOSS:
      image0 = QPixmap(aResMgr->loadPixmap("GEOM", tr("ICO_EXTRUDED_BOSS")));
      aTitle = tr("GEOM_EXTRUDED_BOSS_TITLE");
      setHelpFileName("extruded_boss_operation_page.html");
      break;
    case OperationGUI::CUT:
      image0 = QPixmap( aResMgr->loadPixmap("GEOM", tr("ICO_EXTRUDED_CUT")));
      aTitle = tr("GEOM_EXTRUDED_CUT_TITLE");
      setHelpFileName("extruded_cut_operation_page.html");
      break;
  }
    
  setWindowTitle(aTitle);
  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();
  
  mainFrame()->RadioButton1->setChecked(true);
  
  myGroup = new DlgRef_2Sel2Spin2Push(centralWidget());
  
  myGroup->GroupBox1->setTitle(tr("GEOM_ARGUMENTS"));
  
  myGroup->PushButton1->setIcon(image1);
  myGroup->PushButton2->setIcon(image1);
  myGroup->PushButton3->setIcon(image2);
  myGroup->PushButton4->setIcon(image3);
  myGroup->LineEdit1->setReadOnly(true);
  myGroup->LineEdit2->setReadOnly(true);
  myGroup->TextLabel1->setText(tr("GEOM_INIT_SHAPE"));
  myGroup->TextLabel2->setText(tr("GEOM_PROFILE"));
  myGroup->TextLabel3->setText(tr("GEOM_HEIGHT"));
  myGroup->TextLabel4->setText(tr("GEOM_DRAFT_ANGLE"));
  myGroup->TextLabel5->setText(tr("GEOM_CHANGE_DIRECTION"));
 
  
  QVBoxLayout* layout = new QVBoxLayout(centralWidget());
  layout->setMargin(0); 
  layout->setSpacing(6);
  layout->addWidget(myGroup);

  Init();
   
}

Here is the call graph for this function:

Definition at line 121 of file OperationGUI_ExtrudedFeatureDlg.cxx.

{
}

Member Function Documentation

Definition at line 296 of file OperationGUI_ExtrudedFeatureDlg.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:

void OperationGUI_ExtrudedFeatureDlg::ButtonClicked ( bool  checked) [private, slot]

Definition at line 329 of file OperationGUI_ExtrudedFeatureDlg.cxx.

{
  QPushButton* send = (QPushButton*)sender();
  if (send == myGroup->PushButton3)
    myGroup->SpinBox_DY->setEnabled(checked);
 
  displayPreview(true);
}

Here is the caller graph for this function:

Definition at line 199 of file OperationGUI_ExtrudedFeatureDlg.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:

Definition at line 188 of file OperationGUI_ExtrudedFeatureDlg.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 OperationGUI_ExtrudedFeatureDlg::createOperation ( ) [protected, virtual]

Definition at line 342 of file OperationGUI_ExtrudedFeatureDlg.cxx.

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

Definition at line 310 of file OperationGUI_ExtrudedFeatureDlg.cxx.

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

Here is the call graph for this function:

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

Definition at line 360 of file OperationGUI_ExtrudedFeatureDlg.cxx.

{
  GEOM::GEOM_I3DPrimOperations_var anOper = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation());
  
  double angle=0.0;
  double aHeight = myGroup->SpinBox_DX->value();
  
  if (myGroup->PushButton3->isChecked())
    angle=myGroup->SpinBox_DY->value();
  
  if (myGroup->PushButton4->isChecked())
  {
    aHeight = -aHeight;
    angle   = -angle;
  }
    
  bool isProtrusion = (myOperation == OperationGUI::BOSS);  
  
  // Hide the initial shape in order to see the modifications on the preview
  erase(myObject1.get(),false); 
  
  GEOM::GEOM_Object_var anObj = anOper->MakeDraftPrism(myObject1.get(), myObject2.get(), 
                                                       aHeight,
                                                       angle,
                                                       isProtrusion);
  if (!anObj->_is_nil())
    objects.push_back(anObj._retn());

  return true;
}

Here is the call graph for this function:

Definition at line 129 of file OperationGUI_ExtrudedFeatureDlg.cxx.

{
  // init variables
  myEditCurrentArgument = myGroup->LineEdit1;
  
  // Get setting of step value from file configuration
  SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
  double step = resMgr->doubleValue("Geometry", "SettingsGeomStep", 100);
  
  initSpinBox(myGroup->SpinBox_DX, COORD_MIN, COORD_MAX, step, "length_precision" );
  initSpinBox(myGroup->SpinBox_DY, COORD_MIN, COORD_MAX, step, "length_precision" );

  myGroup->LineEdit1->setText("");
  myGroup->LineEdit2->setText("");
  myGroup->SpinBox_DX->setValue(10.0);
  myGroup->SpinBox_DY->setValue(10.0);
  myGroup->SpinBox_DY->setEnabled(false);
  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(myGroup->PushButton3, SIGNAL(clicked(bool)), this, SLOT(ButtonClicked(bool)));
  connect(myGroup->PushButton4, SIGNAL(clicked(bool)), this, SLOT(ButtonClicked(bool)));
  connect(myGroup->SpinBox_DX,  SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox()));
  connect(myGroup->SpinBox_DY,  SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox()));
  

  connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
           SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
  
  switch (myOperation) 
  {
    case OperationGUI::BOSS:
      initName(tr("GEOM_EXTRUDED_BOSS"));     
      break;
    case OperationGUI::CUT:
      initName(tr("GEOM_EXTRUDED_CUT"));  
      break;
  }
  
  mainFrame()->RadioButton1->setFocus();
  
  globalSelection(GEOM_ALLSHAPES);
  
  myGroup->PushButton1->click();
  SelectionIntoArgument();
  
  resize(minimumSizeHint());
}

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 351 of file OperationGUI_ExtrudedFeatureDlg.cxx.

{
  return myObject1 && myObject2; 
}

Definition at line 243 of file OperationGUI_ExtrudedFeatureDlg.cxx.

{
  myEditCurrentArgument->setText("");

  QList<TopAbs_ShapeEnum> types;
  types<<TopAbs_SHAPE;
  
  if (myEditCurrentArgument == myGroup->LineEdit1)
  {
    types.clear();
    types<<TopAbs_COMPOUND<<TopAbs_SOLID;
  }
  if (myEditCurrentArgument == myGroup->LineEdit2)
  {
    types.clear();
    types << TopAbs_EDGE << TopAbs_WIRE << TopAbs_FACE;
  }

  GEOM::GeomObjPtr aSelectedObject = getSelected( types );
  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();
    }
    
    displayPreview(true);
  }
  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 214 of file OperationGUI_ExtrudedFeatureDlg.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:

Definition at line 320 of file OperationGUI_ExtrudedFeatureDlg.cxx.

{
  displayPreview(true);
}

Here is the caller graph for this function:


Member Data Documentation

DlgRef_2Sel2Spin2Push* OperationGUI_ExtrudedFeatureDlg::myGroup [private]

Definition at line 76 of file OperationGUI_ExtrudedFeatureDlg.h.

Definition at line 73 of file OperationGUI_ExtrudedFeatureDlg.h.

Definition at line 74 of file OperationGUI_ExtrudedFeatureDlg.h.

Definition at line 71 of file OperationGUI_ExtrudedFeatureDlg.h.


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