Back to index

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

#include <TransformationGUI_MultiRotationDlg.h>

List of all members.

Public Member Functions

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

Protected Member Functions

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

Private Slots

void ClickOnOk ()
bool ClickOnApply ()
void ActivateThisDialog ()
void SelectionIntoArgument ()
void SetEditCurrentArgument ()
void ReverseAngle ()
void ValueChangedInSpinBox (double)
void ValueChangedInSpinBox (int)
void TextValueChangedInSpinBox (const QString &)
void ConstructorsClicked (int)
void SetDoubleSpinBoxStep (double)

Private Member Functions

void Init ()
void enterEvent (QEvent *)

Private Attributes

GEOM::GeomObjPtr myBase
GEOM::GeomObjPtr myVector
int myNbTimes1
int myNbTimes2
Standard_Real myAng
Standard_Real myStep
bool myInitial
DlgRef_2Sel1SpinInt * GroupPoints
DlgRef_2Sel4Spin1Check * GroupDimensions

Detailed Description

Definition at line 40 of file TransformationGUI_MultiRotationDlg.h.


Constructor & Destructor Documentation

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

Definition at line 54 of file TransformationGUI_MultiRotationDlg.cxx.

  : GEOMBase_Skeleton(theGeometryGUI, parent, modal, fl),
    myInitial(true)
{
  SUIT_ResourceMgr* aResMgr = myGeomGUI->getApp()->resourceMgr();
  QPixmap image0 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_MULTIROTATION_SIMPLE")));
  QPixmap image1 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_MULTIROTATION_DOUBLE")));
  QPixmap image2 (aResMgr->loadPixmap("GEOM", tr("ICON_SELECT")));

  setWindowTitle(tr("GEOM_MULTIROTATION_TITLE"));

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

  GroupPoints = new DlgRef_2Sel1SpinInt(centralWidget());
  GroupPoints->GroupBox1->setTitle(tr("GEOM_MULTIROTATION_SIMPLE"));
  GroupPoints->TextLabel1->setText(tr("GEOM_MAIN_OBJECT"));
  GroupPoints->TextLabel2->setText(tr("GEOM_VECTOR"));
  GroupPoints->TextLabel3->setText(tr("GEOM_NB_TIMES"));
  GroupPoints->PushButton1->setIcon(image2);
  GroupPoints->PushButton2->setIcon(image2);
  GroupPoints->LineEdit1->setReadOnly(true);
  GroupPoints->LineEdit2->setReadOnly(true);

  GroupDimensions = new DlgRef_2Sel4Spin1Check(centralWidget());
  GroupDimensions->GroupBox1->setTitle(tr("GEOM_MULTIROTATION_DOUBLE"));
  GroupDimensions->TextLabel1->setText(tr("GEOM_MAIN_OBJECT"));
  GroupDimensions->TextLabel2->setText(tr("GEOM_VECTOR"));
  GroupDimensions->TextLabel3->setText(tr("GEOM_ANGLE"));
  GroupDimensions->TextLabel4->setText(tr("GEOM_NB_TIMES"));
  GroupDimensions->TextLabel5->setText(tr("GEOM_STEP"));
  GroupDimensions->TextLabel6->setText(tr("GEOM_NB_TIMES"));
  GroupDimensions->CheckButton1->setText(tr("GEOM_REVERSE"));
  GroupDimensions->PushButton1->setIcon(image2);
  GroupDimensions->PushButton2->setIcon(image2);
  GroupDimensions->LineEdit1->setReadOnly(true);
  GroupDimensions->LineEdit2->setReadOnly(true);

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

  setHelpFileName("multi_rotation_operation_page.html");

  Init();
}

Definition at line 111 of file TransformationGUI_MultiRotationDlg.cxx.

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

Member Function Documentation

Definition at line 396 of file TransformationGUI_MultiRotationDlg.cxx.

{
  GEOMBase_Skeleton::ActivateThisDialog();
  connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ),
           this, SLOT( SelectionIntoArgument() ) );

  ConstructorsClicked( getConstructorId() );
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 557 of file TransformationGUI_MultiRotationDlg.cxx.

{
  switch (getConstructorId()) {
  case 0:
  case 1:
    GEOMBase::PublishSubObject( myVector.get() );
    break;
  default:
    break;
  }
}

Here is the call graph for this function:

Definition at line 273 of file TransformationGUI_MultiRotationDlg.cxx.

{
  if (!onAccept())
    return false;

  initName();
  // activate selection and connect selection manager
  ConstructorsClicked(getConstructorId());
  return true;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 262 of file TransformationGUI_MultiRotationDlg.cxx.

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

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 205 of file TransformationGUI_MultiRotationDlg.cxx.

{
  disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);

  switch (constructorId) {
  case 0: // Rotate simple
    {
      GroupDimensions->hide();
      GroupPoints->show();

      GroupPoints->LineEdit1->setText("");
      GroupPoints->LineEdit2->setText("");
      myBase.nullify();
      myVector.nullify();

      GroupPoints->SpinBox_DX->setValue(myNbTimes1);

      GroupPoints->PushButton1->click();
    }
    break;
  case 1: // Rotate double
    {
      GroupPoints->hide();
      GroupDimensions->show();

      GroupDimensions->LineEdit1->setText("");
      GroupDimensions->LineEdit2->setText("");
      myBase.nullify();
      myVector.nullify();

      GroupDimensions->SpinBox_DX1->setValue(myAng);
      GroupDimensions->SpinBox_DY1->setValue(myNbTimes1);
      GroupDimensions->SpinBox_DX2->setValue(myStep);
      GroupDimensions->SpinBox_DY2->setValue(myNbTimes2);

      GroupDimensions->PushButton1->click();
    }
    break;
  }

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

  if (myInitial) {
    myInitial = false;
    SelectionIntoArgument();
  }
  else {
    processPreview();
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 479 of file TransformationGUI_MultiRotationDlg.cxx.

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

Definition at line 409 of file TransformationGUI_MultiRotationDlg.cxx.

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

Here is the call graph for this function:

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

Definition at line 512 of file TransformationGUI_MultiRotationDlg.cxx.

{
  bool res = false;

  GEOM::GEOM_Object_var anObj;
  QStringList aParameters;

  GEOM::GEOM_ITransformOperations_var anOper = GEOM::GEOM_ITransformOperations::_narrow(getOperation());

  switch (getConstructorId()) {
  case 0:
    if ( myBase && myVector ) {
      anObj = anOper->MultiRotate1D(myBase.get(), myVector.get(), myNbTimes1);
      if(!IsPreview())
        aParameters<<GroupPoints->SpinBox_DX->text();
      res = true;
    }
    break;
  case 1:
    if ( myBase && myVector ) {
      anObj = anOper->MultiRotate2D(myBase.get(), myVector.get(), myAng, myNbTimes1, myStep, myNbTimes2);
      if(!IsPreview()) {
        aParameters<<GroupDimensions->SpinBox_DX1->text();
        aParameters<<GroupDimensions->SpinBox_DY1->text();
        aParameters<<GroupDimensions->SpinBox_DX2->text();
        aParameters<<GroupDimensions->SpinBox_DY2->text();
      }
      res = true;
    }
    break;
  }

  if (!anObj->_is_nil()) {
    if(!IsPreview())
      anObj->SetParameters(aParameters.join(":").toLatin1().constData());
    objects.push_back(anObj._retn());
  }

  return res;
}

Here is the call graph for this function:

Definition at line 120 of file TransformationGUI_MultiRotationDlg.cxx.

{
  // Get setting of step value from file configuration
  SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
  double step = resMgr->doubleValue("Geometry", "SettingsGeomStep", 100);

  int SpecificStep1 = 5;
  int SpecificStep2 = 1;
  // init variables
  myAng = 45.0;
  myStep = 50.0;
  myNbTimes1 = myNbTimes2 = 2;

  // min, max, step and decimals for spin boxes & initial values
  initSpinBox(GroupPoints->SpinBox_DX, 1, 999, SpecificStep2);
  GroupPoints->SpinBox_DX->setValue(myNbTimes1);

  initSpinBox(GroupDimensions->SpinBox_DX1, COORD_MIN, COORD_MAX, SpecificStep1, "angle_precision" );
  initSpinBox(GroupDimensions->SpinBox_DY1, 1, 999, SpecificStep2);
  initSpinBox(GroupDimensions->SpinBox_DX2, COORD_MIN, COORD_MAX, step,"length_precision" );
  initSpinBox(GroupDimensions->SpinBox_DY2, 1, 999, SpecificStep2);
  GroupDimensions->SpinBox_DX1->setValue(myAng);
  GroupDimensions->SpinBox_DY1->setValue(myNbTimes1);
  GroupDimensions->SpinBox_DX2->setValue(myStep);
  GroupDimensions->SpinBox_DY2->setValue(myNbTimes2);

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

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

  myBase.nullify();
  myVector.nullify();

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

  // 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(GroupPoints->PushButton1,     SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
  connect(GroupPoints->PushButton2,     SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
  connect(GroupDimensions->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
  connect(GroupDimensions->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));

  connect(GroupPoints->SpinBox_DX,      SIGNAL(valueChanged(int)),    this, SLOT(ValueChangedInSpinBox(int)));
  connect(GroupDimensions->SpinBox_DX1, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
  connect(GroupDimensions->SpinBox_DY1, SIGNAL(valueChanged(int)),    this, SLOT(ValueChangedInSpinBox(int)));
  connect(GroupDimensions->SpinBox_DX2, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
  connect(GroupDimensions->SpinBox_DY2, SIGNAL(valueChanged(int)),    this, SLOT(ValueChangedInSpinBox(int)));

  connect(GroupDimensions->SpinBox_DX1,SIGNAL(textChanged( const QString& )),
          this, SLOT(TextValueChangedInSpinBox( const QString& )));

  connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), this, SLOT(SetDoubleSpinBoxStep(double)));

  connect(GroupDimensions->CheckButton1, SIGNAL(toggled(bool)), this, SLOT(ReverseAngle()));

  initName(tr("GEOM_MULTIROTATION"));

  ConstructorsClicked(0);
}

Here is the call graph for this function:

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

Definition at line 488 of file TransformationGUI_MultiRotationDlg.cxx.

{
  bool ok = false;
  switch(getConstructorId()){
  case 0:
    ok = GroupPoints->SpinBox_DX->isValid( msg, !IsPreview() ) &&  myBase && myVector;
    break;
  case 1:
    ok = GroupDimensions->SpinBox_DX1->isValid( msg, !IsPreview() ) &&
         GroupDimensions->SpinBox_DY1->isValid( msg, !IsPreview() ) &&
         GroupDimensions->SpinBox_DX2->isValid( msg, !IsPreview() ) &&
         GroupDimensions->SpinBox_DY2->isValid( msg, !IsPreview() ) &&
         myBase && myVector;
    break;
  default:
    break;
  }
  return ok;
}
void TransformationGUI_MultiRotationDlg::restoreSubShapes ( SALOMEDS::Study_ptr  theStudy,
SALOMEDS::SObject_ptr  theSObject 
) [protected, virtual]

Definition at line 573 of file TransformationGUI_MultiRotationDlg.cxx.

{
  if (mainFrame()->CheckBoxRestoreSS->isChecked()) {
    // we pass here the first operation argument (object) through the list of arguments
    // because the rotation operation place its arguments in the data structure in another order,
    // and we need to point the first argument directly
    GEOM::ListOfGO_var anArgs = new GEOM::ListOfGO;
    anArgs->length(1);
    anArgs[0] = myBase.copy();
    getGeomEngine()->RestoreSubShapesSO(theStudy, theSObject, anArgs,
                                        /*theFindMethod=*/GEOM::FSM_MultiTransformed,
                                        /*theInheritFirstArg=*/true,
                                        mainFrame()->CheckBoxAddPrefix->isChecked());
  }
}

Here is the call graph for this function:

Definition at line 463 of file TransformationGUI_MultiRotationDlg.cxx.

{
  myAng = -myAng;

  int aConstructorId = getConstructorId();

  if (aConstructorId == 1)
    GroupDimensions->SpinBox_DX1->setValue(myAng);

  processPreview();
}

Here is the caller graph for this function:

Definition at line 288 of file TransformationGUI_MultiRotationDlg.cxx.

{
  erasePreview();

  TopAbs_ShapeEnum aNeedType = ( myEditCurrentArgument == GroupPoints->LineEdit2 ||
                             myEditCurrentArgument == GroupDimensions->LineEdit2 ) ?
    TopAbs_EDGE : TopAbs_SHAPE;
  GEOM::GeomObjPtr aSelectedObject = getSelected( aNeedType );
  TopoDS_Shape aShape;
  if ( aSelectedObject && GEOMBase::GetShape( aSelectedObject.get(), aShape ) && !aShape.IsNull() ) {
    QString aName = GEOMBase::GetName( aSelectedObject.get() );
    myEditCurrentArgument->setText( aName );
    if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) {
      myBase = aSelectedObject;
      if ( !myVector )
       GroupPoints->PushButton2->click();
    }
    else if ( myEditCurrentArgument == GroupPoints->LineEdit2)  {
      myVector = aSelectedObject;
      if ( !myBase )
       GroupPoints->PushButton1->click();
    }
    else if ( myEditCurrentArgument == GroupDimensions->LineEdit1 ) {
      myBase = aSelectedObject;
      if ( !myVector )
       GroupDimensions->PushButton2->click();
    }
    else if ( myEditCurrentArgument == GroupDimensions->LineEdit2 ) {
      myVector = aSelectedObject;
      if ( !myBase )
       GroupDimensions->PushButton1->click();
    }
    
    // clear selection
    disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
    myGeomGUI->getApp()->selectionMgr()->clearSelected();
    connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
           this, SLOT(SelectionIntoArgument()));
  }
  else {
    if ( myEditCurrentArgument == GroupPoints->LineEdit1 ||
        myEditCurrentArgument == GroupDimensions->LineEdit1 )
      myBase.nullify();
    else if ( myEditCurrentArgument == GroupPoints->LineEdit2 ||
             myEditCurrentArgument == GroupDimensions->LineEdit2 )
      myVector.nullify();
    myEditCurrentArgument->setText("");
  }

  processPreview();
}

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 190 of file TransformationGUI_MultiRotationDlg.cxx.

{
  GroupDimensions->SpinBox_DX2->setSingleStep(step);

  // san: Commented so as not to override specific step settings
  //GroupPoints->SpinBox_DX->setSingleStep((int)step);
  //GroupDimensions->SpinBox_DX1->setSingleStep(step);
  //GroupDimensions->SpinBox_DY1->setSingleStep((int)step);
  //GroupDimensions->SpinBox_DY2->setSingleStep((int)step);
}

Here is the caller graph for this function:

Definition at line 344 of file TransformationGUI_MultiRotationDlg.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;

    localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE);

    GroupPoints->PushButton1->setDown(false);
    GroupPoints->LineEdit1->setEnabled(false);
  }
  else if (send == GroupDimensions->PushButton1) {
    myEditCurrentArgument = GroupDimensions->LineEdit1;

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

    localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE);

    GroupDimensions->PushButton1->setDown(false);
    GroupDimensions->LineEdit1->setEnabled(false);
  }
  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:

void TransformationGUI_MultiRotationDlg::TextValueChangedInSpinBox ( const QString &  s) [private, slot]

Definition at line 419 of file TransformationGUI_MultiRotationDlg.cxx.

                                                                                  {
  bool isDigit;
  s.toDouble(&isDigit);
  if(!isDigit)
    GroupDimensions->CheckButton1->setChecked(false);
  GroupDimensions->CheckButton1->setEnabled(isDigit);
}

Here is the caller graph for this function:

void TransformationGUI_MultiRotationDlg::ValueChangedInSpinBox ( double  newValue) [private, slot]

Definition at line 431 of file TransformationGUI_MultiRotationDlg.cxx.

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

  if (send == GroupDimensions->SpinBox_DX1)
    myAng = newValue;
  else if (send == GroupDimensions->SpinBox_DX2)
    myStep = newValue;

  processPreview();
}

Here is the caller graph for this function:

void TransformationGUI_MultiRotationDlg::ValueChangedInSpinBox ( int  newValue) [private, slot]

Definition at line 447 of file TransformationGUI_MultiRotationDlg.cxx.

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

  if (send == GroupPoints->SpinBox_DX || send == GroupDimensions->SpinBox_DY1)
    myNbTimes1 = newValue;
  else if (send == GroupDimensions->SpinBox_DY2)
    myNbTimes2 = newValue;

  processPreview();
}

Member Data Documentation

DlgRef_2Sel4Spin1Check* TransformationGUI_MultiRotationDlg::GroupDimensions [private]

Definition at line 72 of file TransformationGUI_MultiRotationDlg.h.

DlgRef_2Sel1SpinInt* TransformationGUI_MultiRotationDlg::GroupPoints [private]

Definition at line 71 of file TransformationGUI_MultiRotationDlg.h.

Definition at line 65 of file TransformationGUI_MultiRotationDlg.h.

Definition at line 62 of file TransformationGUI_MultiRotationDlg.h.

Definition at line 69 of file TransformationGUI_MultiRotationDlg.h.

Definition at line 63 of file TransformationGUI_MultiRotationDlg.h.

Definition at line 64 of file TransformationGUI_MultiRotationDlg.h.

Definition at line 66 of file TransformationGUI_MultiRotationDlg.h.

Definition at line 62 of file TransformationGUI_MultiRotationDlg.h.


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