Back to index

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

#include <TransformationGUI_PositionDlg.h>

List of all members.

Public Member Functions

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

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)
virtual void addSubshapesToStudy ()

Private Slots

void ClickOnOk ()
bool ClickOnApply ()
void ActivateThisDialog ()
void SelectionIntoArgument ()
void SetEditCurrentArgument ()
void ConstructorsClicked (int)
void CreateCopyModeChanged ()
void ValueChangedInSpinBox ()
void SelectionTypeButtonClicked ()

Private Member Functions

void Init ()
void enterEvent (QEvent *)

Private Attributes

GEOM::GeomObjPtr myStartLCS
GEOM::GeomObjPtr myEndLCS
QList< GEOM::GeomObjPtrmyObjects
GEOM::GeomObjPtr myPath
bool myInitial
DlgRef_4Sel1Spin3Check * Group1

Detailed Description

Definition at line 39 of file TransformationGUI_PositionDlg.h.


Constructor & Destructor Documentation

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

Definition at line 52 of file TransformationGUI_PositionDlg.cxx.

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

  setWindowTitle(tr("GEOM_POSITION_TITLE"));

  /***************************************************************/
  mainFrame()->GroupConstructors->setTitle(tr("GEOM_POSITION"));
  mainFrame()->RadioButton1->setIcon(image0);
  mainFrame()->RadioButton2->setIcon(image1);
  mainFrame()->RadioButton3->setIcon(image2);

  Group1 = new DlgRef_4Sel1Spin3Check(centralWidget());
  Group1->GroupBox1->setTitle(tr("GEOM_ARGUMENTS"));
  Group1->TextLabel1->setText(tr("GEOM_OBJECTS"));
  Group1->TextLabel2->setText(tr("GEOM_START_LCS"));
  Group1->TextLabel3->setText(tr("GEOM_DISTANCE"));
  Group1->TextLabel4->setText(tr("GEOM_END_LCS"));
  Group1->TextLabel5->setText(tr("GEOM_PATH_OBJECT"));
  Group1->PushButton1->setIcon(imageselect);
  Group1->PushButton2->setIcon(imageselect);
  Group1->PushButton4->setIcon(imageselect);
  Group1->PushButton5->setIcon(imageselect);
  Group1->CheckButton1->setText(tr("GEOM_CREATE_COPY"));
  Group1->CheckButton2->setText(tr("SELECT_UNPUBLISHED_EDGES"));
  Group1->CheckButton3->setText(tr("GEOM_REVERSE_DIRECTION"));

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

  setHelpFileName("modify_location_operation_page.html");

  // Activate Create a Copy mode
  Group1->CheckButton1->setChecked(true);
  CreateCopyModeChanged();

  Init();
}

Definition at line 103 of file TransformationGUI_PositionDlg.cxx.

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

Member Function Documentation

Definition at line 468 of file TransformationGUI_PositionDlg.cxx.

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

  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 606 of file TransformationGUI_PositionDlg.cxx.

{
  if ( getConstructorId() == 2 )
    GEOMBase::PublishSubObject( myPath.get() );
}

Here is the call graph for this function:

Definition at line 295 of file TransformationGUI_PositionDlg.cxx.

{
  if (!onAccept(Group1->CheckButton1->isChecked()))
    return false;

  initName();

  // activate selection and connect selection manager
  ConstructorsClicked(getConstructorId());
  SelectionIntoArgument();

  return true;
}

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 284 of file TransformationGUI_PositionDlg.cxx.

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

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 163 of file TransformationGUI_PositionDlg.cxx.

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

  Group1->LineEdit2->clear();
  Group1->LineEdit4->clear();
  Group1->LineEdit5->clear();
  myStartLCS.nullify();
  myEndLCS.nullify();
  myPath.nullify();

  switch (constructorId) {
  case 0:
    {
      Group1->LineEdit2->hide();
      Group1->TextLabel2->hide();
      Group1->PushButton2->hide();

      Group1->LineEdit5->hide();
      Group1->TextLabel5->hide();
      Group1->PushButton5->hide();

      Group1->SpinBox_DX->hide();
      Group1->TextLabel3->hide();

      Group1->LineEdit4->show();
      Group1->TextLabel4->show();
      Group1->PushButton4->show();

      Group1->PushButton1->click();

      Group1->CheckButton2->hide();
      Group1->CheckButton3->hide();
    }
    break;
  case 1:
    {
      Group1->LineEdit2->show();
      Group1->TextLabel2->show();
      Group1->PushButton2->show();

      Group1->LineEdit5->hide();
      Group1->TextLabel5->hide();
      Group1->PushButton5->hide();

      Group1->SpinBox_DX->hide();
      Group1->TextLabel3->hide();

      Group1->PushButton1->click();

      Group1->CheckButton2->hide();
      Group1->CheckButton3->hide();
    }
    break;
  case 2:
    {
      Group1->LineEdit4->hide();
      Group1->TextLabel4->hide();
      Group1->PushButton4->hide();

      Group1->LineEdit2->hide();
      Group1->TextLabel2->hide();
      Group1->PushButton2->hide();

      Group1->LineEdit5->show();
      Group1->TextLabel5->show();
      Group1->PushButton5->show();

      Group1->SpinBox_DX->show();
      Group1->TextLabel3->show();

      Group1->PushButton1->click();

      Group1->CheckButton2->show();
      Group1->CheckButton3->show();
    }
    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:

Definition at line 597 of file TransformationGUI_PositionDlg.cxx.

{
  mainFrame()->GroupBoxName->setEnabled(Group1->CheckButton1->isChecked());
}

Here is the caller graph for this function:

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

Definition at line 494 of file TransformationGUI_PositionDlg.cxx.

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

Definition at line 484 of file TransformationGUI_PositionDlg.cxx.

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

Here is the call graph for this function:

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

Definition at line 526 of file TransformationGUI_PositionDlg.cxx.

{
  bool res = false;
  bool toCreateCopy = IsPreview() || Group1->CheckButton1->isChecked();
  GEOM::GEOM_Object_var anObj;

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

  switch (getConstructorId()) {
  case 0:
    {
      for (int i = 0; i < myObjects.count(); i++) {
        anObj = toCreateCopy ? 
          anOper->PositionShapeCopy(myObjects[i].get(), myObjects[i].get(), myEndLCS.get()) :
          anOper->PositionShape(myObjects[i].get(), myObjects[i].get(), myEndLCS.get());

        if (!anObj->_is_nil())
          objects.push_back(anObj._retn());
      }
      res = true;
      break;
    }
  case 1:
    {
      for (int i = 0; i < myObjects.count(); i++) {
          anObj = toCreateCopy ? 
            anOper->PositionShapeCopy(myObjects[i].get(), myStartLCS.get(), myEndLCS.get()) :
            anOper->PositionShape(myObjects[i].get(), myStartLCS.get(), myEndLCS.get());
        if (!anObj->_is_nil())
          objects.push_back(anObj._retn());
      }
      res = true;
      break;
    }
  case 2:
    {
      double aDistance = Group1->SpinBox_DX->value();
      bool toReverse = Group1->CheckButton3->isChecked();
      for (int i = 0; i < myObjects.count(); i++) {
        anObj = anOper->PositionAlongPath(myObjects[i].get(), myPath.get(), aDistance, toCreateCopy, toReverse);
        if (!anObj->_is_nil())
          objects.push_back(anObj._retn());
      }
      res = true;
      break;
    }
  }

  return res;
}

Here is the call graph for this function:

Definition at line 112 of file TransformationGUI_PositionDlg.cxx.

{
  // init variables
  Group1->LineEdit1->setReadOnly(true);
  Group1->LineEdit2->setReadOnly(true);
  Group1->LineEdit4->setReadOnly(true);
  Group1->LineEdit5->setReadOnly(true);

  Group1->LineEdit1->setText("");
  Group1->LineEdit2->setText("");
  Group1->LineEdit4->setText("");
  Group1->LineEdit5->setText("");

  initSpinBox(Group1->SpinBox_DX, 0, 1, 0.05, "parametric_precision" );
  Group1->SpinBox_DX->setValue(0);

  Group1->CheckButton2->setEnabled(false);

  myObjects.clear();
  myStartLCS.nullify();
  myEndLCS.nullify();
  myPath.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(Group1->PushButton1, SIGNAL(clicked()),       this, SLOT(SetEditCurrentArgument()));
  connect(Group1->PushButton2, SIGNAL(clicked()),       this, SLOT(SetEditCurrentArgument()));
  connect(Group1->PushButton4, SIGNAL(clicked()),       this, SLOT(SetEditCurrentArgument()));
  connect(Group1->PushButton5, SIGNAL(clicked()),       this, SLOT(SetEditCurrentArgument()));

  connect(Group1->CheckButton1,   SIGNAL(toggled(bool)), this, SLOT(CreateCopyModeChanged()));
  connect(Group1->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox()));

  connect(Group1->CheckButton2,   SIGNAL(toggled(bool)), this, SLOT(SelectionTypeButtonClicked()));
  connect(Group1->CheckButton3,   SIGNAL(toggled(bool)), this, SLOT(ValueChangedInSpinBox()));

  initName(tr("GEOM_POSITION"));

  ConstructorsClicked(0);
}

Here is the call graph for this function:

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

Definition at line 503 of file TransformationGUI_PositionDlg.cxx.

{
  bool ok = false;
  switch (getConstructorId()) {
  case 0:
    ok = !myObjects.isEmpty() && myEndLCS;
    break;
  case 1:
    ok = !myObjects.isEmpty() && myStartLCS && myEndLCS;
    break;
  case 2:
    ok = !myObjects.isEmpty() && myPath;
    break;
  default:
    break;
  }
  return ok;
}
void TransformationGUI_PositionDlg::restoreSubShapes ( SALOMEDS::Study_ptr  theStudy,
SALOMEDS::SObject_ptr  theSObject 
) [protected, virtual]

Definition at line 581 of file TransformationGUI_PositionDlg.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_Transformed,
                                        /*theInheritFirstArg=*/true,
                                        mainFrame()->CheckBoxAddPrefix->isChecked());
  }
}

Definition at line 313 of file TransformationGUI_PositionDlg.cxx.

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

  if ( myEditCurrentArgument == Group1->LineEdit1 ) {
    myObjects = getSelected( TopAbs_SHAPE, -1 );
    if ( !myObjects.isEmpty() ) {
      QString aName = myObjects.count() > 1 ? QString( "%1_objects").arg( myObjects.count() ) : GEOMBase::GetName( myObjects[0].get() );
      myEditCurrentArgument->setText( aName );
    }
  }
  else if ( myEditCurrentArgument == Group1->LineEdit5 ) {
    QList<TopAbs_ShapeEnum> types;
    types << TopAbs_EDGE << TopAbs_WIRE;
    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 );
      myPath = aSelectedObject;
      if ( myObjects.isEmpty() )
       Group1->PushButton1->click();
    }
    else {
      myPath.nullify();
    }
  }
  else {
    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 );
      if ( myEditCurrentArgument == Group1->LineEdit2 ) {
       myStartLCS = aSelectedObject;
       if ( !myEndLCS )
         Group1->PushButton4->click();
       else if ( myObjects.isEmpty() )
         Group1->PushButton1->click();
      }
      else if ( myEditCurrentArgument == Group1->LineEdit4 ) {
       myEndLCS = aSelectedObject;
       if ( myObjects.isEmpty() )
         Group1->PushButton1->click();
       else if ( getConstructorId() == 1 && !myStartLCS )
         Group1->PushButton2->click();
      }
    }
    else {
      if ( myEditCurrentArgument == Group1->LineEdit2 )
       myStartLCS.nullify();
      else if ( myEditCurrentArgument == Group1->LineEdit4 )
       myEndLCS.nullify();
    }
  }

  processPreview();
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 259 of file TransformationGUI_PositionDlg.cxx.

{
  if ( Group1->CheckButton2->isChecked() ) {
    localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
  } else {
    TColStd_MapOfInteger aMap;
    aMap.Add(GEOM_WIRE);
    aMap.Add(GEOM_LINE);
    globalSelection(aMap);
  }
}

Here is the caller graph for this function:

Definition at line 377 of file TransformationGUI_PositionDlg.cxx.

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

  disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
  if (send == Group1->PushButton1) {
    myEditCurrentArgument = Group1->LineEdit1;

    globalSelection();

    Group1->PushButton2->setDown(false);
    Group1->PushButton4->setDown(false);
    Group1->PushButton5->setDown(false);
    Group1->LineEdit2->setEnabled(false);
    Group1->LineEdit4->setEnabled(false);
    Group1->LineEdit5->setEnabled(false);

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

    TColStd_MapOfInteger aMap;
    aMap.Add(GEOM_PLANE);
    aMap.Add(GEOM_MARKER);
    globalSelection(aMap);

    Group1->PushButton1->setDown(false);
    Group1->PushButton4->setDown(false);
    Group1->PushButton5->setDown(false);
    Group1->LineEdit1->setEnabled(false);
    Group1->LineEdit4->setEnabled(false);
    Group1->LineEdit5->setEnabled(false);

    Group1->CheckButton2->setEnabled(false);
  }
  else if (send == Group1->PushButton4) {
    myEditCurrentArgument = Group1->LineEdit4;

    TColStd_MapOfInteger aMap;
    aMap.Add(GEOM_PLANE);
    aMap.Add(GEOM_MARKER);
    globalSelection(aMap);

    Group1->PushButton1->setDown(false);
    Group1->PushButton2->setDown(false);
    Group1->PushButton5->setDown(false);
    Group1->LineEdit1->setEnabled(false);
    Group1->LineEdit2->setEnabled(false);
    Group1->LineEdit5->setEnabled(false);

    Group1->CheckButton2->setEnabled(false);
  }
  else if (send == Group1->PushButton5) {
    myEditCurrentArgument = Group1->LineEdit5;

    Group1->CheckButton2->setEnabled(true);

    if ( Group1->CheckButton2->isChecked() ) {
      localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
    } else {
      TColStd_MapOfInteger aMap;
      aMap.Add(GEOM_WIRE);
      aMap.Add(GEOM_LINE);
      globalSelection(aMap);
    }

    Group1->PushButton1->setDown(false);
    Group1->PushButton2->setDown(false);
    Group1->PushButton4->setDown(false);
    Group1->LineEdit1->setEnabled(false);
    Group1->LineEdit2->setEnabled(false);
    Group1->LineEdit4->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:

Definition at line 275 of file TransformationGUI_PositionDlg.cxx.

{
  processPreview();
}

Here is the caller graph for this function:


Member Data Documentation

DlgRef_4Sel1Spin3Check* TransformationGUI_PositionDlg::Group1 [private]

Definition at line 69 of file TransformationGUI_PositionDlg.h.

Definition at line 62 of file TransformationGUI_PositionDlg.h.

Definition at line 67 of file TransformationGUI_PositionDlg.h.

Definition at line 63 of file TransformationGUI_PositionDlg.h.

Definition at line 64 of file TransformationGUI_PositionDlg.h.

Definition at line 61 of file TransformationGUI_PositionDlg.h.


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