Back to index

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

#include <GenerationGUI_RevolDlg.h>

List of all members.

Public Member Functions

 GenerationGUI_RevolDlg (GeometryGUI *, QWidget *=0, bool=false, Qt::WindowFlags=0)
 ~GenerationGUI_RevolDlg ()

Protected Member Functions

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

Private Slots

void ClickOnOk ()
bool ClickOnApply ()
void ActivateThisDialog ()
void SelectionIntoArgument ()
void SetEditCurrentArgument ()
void ValueChangedInSpinBox ()
void SetDoubleSpinBoxStep (double)
void onReverse ()
void onBothway ()

Private Member Functions

void Init ()
void enterEvent (QEvent *)
double getAngle () const

Private Attributes

QList< GEOM::GeomObjPtrmyBaseObjects
GEOM::GeomObjPtr myAxis
DlgRef_2Sel1Spin2Check * GroupPoints

Detailed Description

Definition at line 39 of file GenerationGUI_RevolDlg.h.


Constructor & Destructor Documentation

GenerationGUI_RevolDlg::GenerationGUI_RevolDlg ( GeometryGUI *  theGeometryGUI,
QWidget *  parent = 0,
bool  modal = false,
Qt::WindowFlags  fl = 0 
)

Definition at line 55 of file GenerationGUI_RevolDlg.cxx.

  : GEOMBase_Skeleton(theGeometryGUI, parent, modal, fl)
{
  QPixmap image0 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_DLG_REVOL")));
  QPixmap image1 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_SELECT")));

  setWindowTitle(tr("GEOM_REVOLUTION_TITLE"));

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

  GroupPoints = new DlgRef_2Sel1Spin2Check(centralWidget());
  GroupPoints->GroupBox1->setTitle(tr("GEOM_ARGUMENTS"));
  GroupPoints->TextLabel1->setText(tr("GEOM_OBJECTS"));
  GroupPoints->TextLabel2->setText(tr("GEOM_AXIS"));
  GroupPoints->TextLabel3->setText(tr("GEOM_ANGLE"));
  GroupPoints->PushButton1->setIcon(image1);
  GroupPoints->PushButton2->setIcon(image1);
  GroupPoints->LineEdit1->setReadOnly(true);
  GroupPoints->LineEdit2->setReadOnly(true);
  GroupPoints->CheckButton1->setText(tr("GEOM_BOTHWAY"));
  GroupPoints->CheckButton2->setText(tr("GEOM_REVERSE"));

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

  setHelpFileName("create_revolution_page.html");

  // Initialisation
  Init();
}

Here is the call graph for this function:

Definition at line 99 of file GenerationGUI_RevolDlg.cxx.

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

Member Function Documentation

Definition at line 256 of file GenerationGUI_RevolDlg.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 GenerationGUI_RevolDlg::addSubshapesToStudy ( ) [protected, virtual]

Definition at line 365 of file GenerationGUI_RevolDlg.cxx.

{
  GEOMBase::PublishSubObject( myAxis.get() );
}

Here is the call graph for this function:

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

Definition at line 172 of file GenerationGUI_RevolDlg.cxx.

{
  if (!onAccept())
    return false;

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

Here is the caller graph for this function:

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

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

Definition at line 297 of file GenerationGUI_RevolDlg.cxx.

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

Definition at line 269 of file GenerationGUI_RevolDlg.cxx.

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

Here is the call graph for this function:

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

Definition at line 315 of file GenerationGUI_RevolDlg.cxx.

{
  GEOM::GEOM_Object_var anObj;
  GEOM::GEOM_I3DPrimOperations_var anOper = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation());

  for (int i = 0; i < myBaseObjects.count(); i++) {
    if (!GroupPoints->CheckButton1->isChecked())
      anObj = anOper->MakeRevolutionAxisAngle(myBaseObjects[i].get(), myAxis.get(),
                                              getAngle() * M_PI / 180.);
    else
      anObj = anOper->MakeRevolutionAxisAngle2Ways(myBaseObjects[i].get(), myAxis.get(),
                                                   getAngle() * M_PI / 180.);
    
    if (!anObj->_is_nil()) {
      if (!IsPreview()) {
        QStringList aParameters;
        aParameters << GroupPoints->SpinBox_DX->text();
        anObj->SetParameters(aParameters.join(":").toLatin1().constData());
      }
      objects.push_back(anObj._retn());
    }
  }

  return true;
}

Here is the call graph for this function:

bool GenerationGUI_RevolDlg::extractPrefix ( ) const [protected, virtual]

Definition at line 374 of file GenerationGUI_RevolDlg.cxx.

{
  return myBaseObjects.count() > 1;
}
double GenerationGUI_RevolDlg::getAngle ( ) const [private]

Definition at line 288 of file GenerationGUI_RevolDlg.cxx.

{
  return GroupPoints->SpinBox_DX->value();
}

Here is the caller graph for this function:

void GenerationGUI_RevolDlg::Init ( ) [private]

Definition at line 108 of file GenerationGUI_RevolDlg.cxx.

{
  // min, max, step and decimals for spin boxes & initial values
  double SpecificStep = 5;
  initSpinBox(GroupPoints->SpinBox_DX, -360.0, 360.0, SpecificStep, "angle_precision" );
  GroupPoints->SpinBox_DX->setValue(45.0);

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

  GroupPoints->LineEdit1->setText("");
  GroupPoints->LineEdit2->setText("");

  myBaseObjects.clear();
  myAxis.nullify();

  showOnlyPreviewControl();

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

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

  connect(GroupPoints->SpinBox_DX,   SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox()));
  connect(GroupPoints->CheckButton1, SIGNAL(toggled(bool)),        this, SLOT(onBothway()));
  connect(GroupPoints->CheckButton2, SIGNAL(toggled(bool)),        this, SLOT(onReverse()));

  // san: We don't need this, as the default step value is not used in this dialog box
  //connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), this, SLOT(SetDoubleSpinBoxStep(double)));

  initName(tr("GEOM_REVOLUTION"));
  resize(100,100);

  GroupPoints->PushButton1->click();
  SelectionIntoArgument();
}

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 306 of file GenerationGUI_RevolDlg.cxx.

{
  return GroupPoints->SpinBox_DX->isValid( msg, !IsPreview() ) && !myBaseObjects.isEmpty() && myAxis;
}
void GenerationGUI_RevolDlg::onBothway ( ) [private, slot]

Definition at line 355 of file GenerationGUI_RevolDlg.cxx.

{
  GroupPoints->CheckButton2->setEnabled(!GroupPoints->CheckButton1->isChecked());
  processPreview();
}

Here is the caller graph for this function:

void GenerationGUI_RevolDlg::onReverse ( ) [private, slot]

Definition at line 345 of file GenerationGUI_RevolDlg.cxx.

{
  double anOldValue = GroupPoints->SpinBox_DX->value();
  GroupPoints->SpinBox_DX->setValue(-anOldValue);
}

Here is the caller graph for this function:

Definition at line 187 of file GenerationGUI_RevolDlg.cxx.

{
  erasePreview();
  myEditCurrentArgument->setText("");

  if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) {
    myBaseObjects.clear();
    QList<GEOM::GeomObjPtr> objects = getSelected( TopAbs_SHAPE, -1 );
    for ( int i = 0; i < objects.count(); i++ ) {
      GEOM::shape_type stype = objects[i]->GetMaxShapeType();
      if ( stype < GEOM::SHELL || stype > GEOM::VERTEX )
       continue;
      myBaseObjects << objects[i];
    }
    if ( !myBaseObjects.isEmpty() ) {
      QString aName = myBaseObjects.count() > 1 ? QString( "%1_objects").arg( myBaseObjects.count() ) : GEOMBase::GetName( myBaseObjects[0].get() );
      myEditCurrentArgument->setText( aName );
    }
  }
  else if (myEditCurrentArgument == GroupPoints->LineEdit2) {
    myAxis = getSelected( TopAbs_EDGE );
    if ( myAxis ) {
      QString aName = GEOMBase::GetName( myAxis.get() );
      myEditCurrentArgument->setText( aName );
      if ( myBaseObjects.isEmpty() )
       GroupPoints->PushButton1->click();
    }
  }
  processPreview();
}

Here is the call graph for this function:

Here is the caller graph for this function:

void GenerationGUI_RevolDlg::SetDoubleSpinBoxStep ( double  step) [private, slot]

Definition at line 152 of file GenerationGUI_RevolDlg.cxx.

{
  GroupPoints->SpinBox_DX->setSingleStep(step);
}

Definition at line 222 of file GenerationGUI_RevolDlg.cxx.

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

  disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
  globalSelection(GEOM_ALLSHAPES);
  if (send == GroupPoints->PushButton1) {
    myEditCurrentArgument = GroupPoints->LineEdit1;
    GroupPoints->PushButton2->setDown(false);
    GroupPoints->LineEdit2->setEnabled(false);
  }
  else if (send == GroupPoints->PushButton2) {
    myEditCurrentArgument = GroupPoints->LineEdit2;
    GroupPoints->PushButton1->setDown(false);
    GroupPoints->LineEdit1->setEnabled(false);
    localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE);
  }
  connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
          this, SLOT(SelectionIntoArgument()));

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

  // seems we need it only to avoid preview disappearing, caused by selection mode change
  processPreview();
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 279 of file GenerationGUI_RevolDlg.cxx.

{
  processPreview();
}

Here is the caller graph for this function:


Member Data Documentation

DlgRef_2Sel1Spin2Check* GenerationGUI_RevolDlg::GroupPoints [private]

Definition at line 64 of file GenerationGUI_RevolDlg.h.

Definition at line 62 of file GenerationGUI_RevolDlg.h.

Definition at line 61 of file GenerationGUI_RevolDlg.h.


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