Back to index

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

#include <BuildGUI_EdgeDlg.h>

List of all members.

Public Member Functions

 BuildGUI_EdgeDlg (GeometryGUI *, QWidget *=0)
 ~BuildGUI_EdgeDlg ()

Protected Member Functions

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

Private Slots

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

Private Member Functions

void Init ()
void enterEvent (QEvent *)

Private Attributes

GEOM::GeomObjPtr myPoint1
GEOM::GeomObjPtr myPoint2
GEOM::GeomObjPtr myWire
GEOM::GeomObjPtr myCurve
GEOM::GeomObjPtr myStartPoint
DlgRef_2Sel * GroupPoints
DlgRef_1Sel2Spin * GroupWire
DlgRef_2Sel1Spin * GroupOnCurve

Detailed Description

Definition at line 41 of file BuildGUI_EdgeDlg.h.


Constructor & Destructor Documentation

BuildGUI_EdgeDlg::BuildGUI_EdgeDlg ( GeometryGUI *  theGeometryGUI,
QWidget *  parent = 0 
)

Definition at line 48 of file BuildGUI_EdgeDlg.cxx.

  : GEOMBase_Skeleton(theGeometryGUI, parent)
{
  SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
  QPixmap image0 (aResMgr->loadPixmap("GEOM", tr("ICON_SELECT")));
  QPixmap image1 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_BUILD_EDGE")));
  QPixmap image2 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_BUILD_EDGE_WIRE")));
  QPixmap image3 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_BUILD_EDGE_CURVE")));

  setWindowTitle(tr("GEOM_EDGE_TITLE"));

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

  // two points

  GroupPoints = new DlgRef_2Sel(centralWidget());
  GroupPoints->GroupBox1->setTitle(tr("GEOM_POINTS"));
  GroupPoints->TextLabel1->setText(tr("GEOM_POINT_I").arg(1));
  GroupPoints->TextLabel2->setText(tr("GEOM_POINT_I").arg(2));
  GroupPoints->PushButton1->setIcon(image0);
  GroupPoints->PushButton2->setIcon(image0);
  GroupPoints->LineEdit1->setReadOnly(true);
  GroupPoints->LineEdit2->setReadOnly(true);

  // wire

  GroupWire = new DlgRef_1Sel2Spin(centralWidget());
  GroupWire->GroupBox1->setTitle(tr("GEOM_WIRE"));
  GroupWire->TextLabel1->setText(tr("GEOM_WIRE"));
  GroupWire->PushButton1->setIcon(image0);
  GroupWire->LineEdit1->setReadOnly(true);
  GroupWire->TextLabel2->setText(tr("GEOM_LINEAR_TOLERANCE"));
  GroupWire->TextLabel3->setText(tr("GEOM_ANGULAR_TOLERANCE"));
  double SpecificStep = 0.0001;
  double prec1 = Precision::Confusion();
  double prec2 = Precision::Angular();
  initSpinBox(GroupWire->SpinBox_DX, prec1, MAX_NUMBER, SpecificStep, "len_tol_precision");
  initSpinBox(GroupWire->SpinBox_DY, prec2, MAX_NUMBER, SpecificStep, "ang_tol_precision");
  GroupWire->SpinBox_DX->setValue(prec1);
  GroupWire->SpinBox_DY->setValue(prec2);

  // on curve

  GroupOnCurve = new DlgRef_2Sel1Spin(centralWidget());
  GroupOnCurve->GroupBox1->setTitle(tr("GEOM_ARGUMENTS"));
  GroupOnCurve->TextLabel1->setText(tr("GEOM_EDGE"));
  GroupOnCurve->PushButton1->setIcon(image0);
  GroupOnCurve->LineEdit1->setReadOnly(true);
  GroupOnCurve->TextLabel2->setText(tr("GEOM_START_POINT"));
  GroupOnCurve->PushButton2->setIcon(image0);
  GroupOnCurve->LineEdit2->setReadOnly(true);
  GroupOnCurve->TextLabel3->setText(tr("GEOM_LENGTH"));
  double step = aResMgr->doubleValue("Geometry", "SettingsGeomStep", 100.0);
  initSpinBox(GroupOnCurve->SpinBox_DX, COORD_MIN, COORD_MAX, step, "length_precision");
  GroupOnCurve->SpinBox_DX->setValue(step);

  // layout

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

  setHelpFileName("create_edge_page.html");

  // initialisation
  Init();
}

Here is the call graph for this function:

Definition at line 127 of file BuildGUI_EdgeDlg.cxx.

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

Member Function Documentation

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

Definition at line 384 of file BuildGUI_EdgeDlg.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:

void BuildGUI_EdgeDlg::addSubshapesToStudy ( ) [protected, virtual]

Definition at line 506 of file BuildGUI_EdgeDlg.cxx.

{
  switch (getConstructorId()) {
  case 0:
    GEOMBase::PublishSubObject(myPoint1.get());
    GEOMBase::PublishSubObject(myPoint2.get());
    break;
  case 1:
    GEOMBase::PublishSubObject(myWire.get());
    break;
  case 2:
    GEOMBase::PublishSubObject(myCurve.get());
    GEOMBase::PublishSubObject(myStartPoint.get());
    break;
  default:
    break;
  }
}

Here is the call graph for this function:

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

Definition at line 190 of file BuildGUI_EdgeDlg.cxx.

{
  if (!onAccept())
    return false;

  initName();

  myEditCurrentArgument->setText("");
  ConstructorsClicked(getConstructorId());

  return true;
}

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 179 of file BuildGUI_EdgeDlg.cxx.

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

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 207 of file BuildGUI_EdgeDlg.cxx.

{
  switch (constructorId) {
  case 0:
    {
      globalSelection(); // close local contexts, if any
      localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX);

      myEditCurrentArgument = GroupPoints->LineEdit1;
      GroupPoints->LineEdit1->setText("");
      GroupPoints->LineEdit2->setText("");
      myPoint1.nullify();
      myPoint2.nullify();
      GroupPoints->PushButton1->setDown(true);
      GroupPoints->PushButton2->setDown(false);
      GroupPoints->LineEdit1->setEnabled(true);
      GroupPoints->LineEdit2->setEnabled(false);
      GroupPoints->show();
      GroupWire->hide();
      GroupOnCurve->hide();
      break;
    }
  case 1:
    {
      globalSelection(); // close local contexts, if any
      localSelection(GEOM::GEOM_Object::_nil(), TopAbs_WIRE);

      myEditCurrentArgument = GroupWire->LineEdit1;
      GroupWire->LineEdit1->setText("");
      myWire.nullify();
      GroupWire->PushButton1->setDown(true);
      GroupWire->LineEdit1->setEnabled(true);
      GroupPoints->hide();
      GroupOnCurve->hide();
      GroupWire->show();
      break;
    }
  case 2:
    {
      globalSelection(); // close local contexts, if any
      localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE);

      myEditCurrentArgument = GroupOnCurve->LineEdit1;
      GroupOnCurve->LineEdit1->setText("");
      GroupOnCurve->LineEdit2->setText("");
      myCurve.nullify();
      myStartPoint.nullify();
      GroupOnCurve->PushButton1->setDown(true);
      GroupOnCurve->PushButton2->setDown(false);
      GroupOnCurve->LineEdit1->setEnabled(true);
      GroupOnCurve->LineEdit2->setEnabled(false);
      GroupPoints->hide();
      GroupWire->hide();
      GroupOnCurve->show();
      break;
    }
  }

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

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 417 of file BuildGUI_EdgeDlg.cxx.

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

Definition at line 398 of file BuildGUI_EdgeDlg.cxx.

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

Here is the call graph for this function:

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

Definition at line 452 of file BuildGUI_EdgeDlg.cxx.

{
  bool res = false;
  GEOM::GEOM_Object_var anObj;

  GEOM::GEOM_IShapesOperations_var anOper = GEOM::GEOM_IShapesOperations::_narrow(getOperation());

  switch (getConstructorId()) {
  case 0:
    {
      anObj = anOper->MakeEdge(myPoint1.get(), myPoint2.get());
      res = true;
      break;
    }
  case 1:
    {
      double aLinearTolerance   = GroupWire->SpinBox_DX->value();
      double anAngularTolerance = GroupWire->SpinBox_DY->value();

      QStringList aParameters;
      aParameters << GroupWire->SpinBox_DX->text();
      aParameters << GroupWire->SpinBox_DY->text();

      anObj = anOper->MakeEdgeWire(myWire.get(), aLinearTolerance, anAngularTolerance);

      if (!anObj->_is_nil() && !IsPreview())
        anObj->SetParameters(aParameters.join(":").toLatin1().constData());

      res = true;
      break;
    }
  case 2:
    {
      double aLength = GroupOnCurve->SpinBox_DX->value();

      anObj = anOper->MakeEdgeOnCurveByLength(myCurve.get(), aLength, myStartPoint.get());

      if (!anObj->_is_nil() && !IsPreview())
        anObj->SetParameters(GroupOnCurve->SpinBox_DX->text().toLatin1().constData());

      res = true;
      break;
    }
  }

  if (!anObj->_is_nil()) objects.push_back(anObj._retn());

  return res;
}

Here is the call graph for this function:

void BuildGUI_EdgeDlg::Init ( ) [private]

Definition at line 136 of file BuildGUI_EdgeDlg.cxx.

{
  // init variables
  myPoint1.nullify();
  myPoint2.nullify();
  myWire.nullify();
  myCurve.nullify();
  myStartPoint.nullify();

  myEditCurrentArgument = GroupPoints->LineEdit1;
  GroupPoints->PushButton1->setDown(true);
  globalSelection(); // close local contexts, if any
  localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX);

  // signals and slots connections
  connect(myGeomGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog()));
  connect(myGeomGUI, SIGNAL(SignalCloseAllDialogs()),        this, SLOT(ClickOnCancel()));

  connect(this,      SIGNAL(constructorsClicked(int)), this, SLOT(ConstructorsClicked(int)));

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

  connect(GroupOnCurve->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));

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

  initName(tr("GEOM_EDGE"));

  ConstructorsClicked(0);
}

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 426 of file BuildGUI_EdgeDlg.cxx.

{
  bool ok = false;
  switch (getConstructorId()) {
  case 0:
    ok = myPoint1 && myPoint2;
    break;
  case 1:
    ok = GroupWire->SpinBox_DX->isValid(msg, !IsPreview()) &&
         GroupWire->SpinBox_DY->isValid(msg, !IsPreview()) &&
         myWire;
    break;
  case 2:
    ok = GroupOnCurve->SpinBox_DX->isValid(msg, !IsPreview()) &&
         myCurve;
    break;
  default:
    break;
  }
  return ok;
}
void BuildGUI_EdgeDlg::SelectionIntoArgument ( ) [private, slot]

Definition at line 275 of file BuildGUI_EdgeDlg.cxx.

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

  LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
  SALOME_ListIO aSelList;
  aSelMgr->selectedObjects(aSelList);

  if (aSelList.Extent() != 1) {
    if      (myEditCurrentArgument == GroupPoints->LineEdit1)  myPoint1.nullify();
    else if (myEditCurrentArgument == GroupPoints->LineEdit2)  myPoint2.nullify();
    else if (myEditCurrentArgument == GroupWire->LineEdit1)    myWire.nullify();
    else if (myEditCurrentArgument == GroupOnCurve->LineEdit1) myCurve.nullify();
    else if (myEditCurrentArgument == GroupOnCurve->LineEdit2) myStartPoint.nullify();
    displayPreview(true);
    return;
  }

  TopAbs_ShapeEnum aNeedType = TopAbs_VERTEX;
  if (myEditCurrentArgument == GroupWire->LineEdit1) aNeedType = TopAbs_WIRE;
  else if (myEditCurrentArgument == GroupOnCurve->LineEdit1) aNeedType = TopAbs_EDGE;
  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);

    globalSelection();
    localSelection(GEOM::GEOM_Object::_nil(), aNeedType);

    if (myEditCurrentArgument == GroupPoints->LineEdit1) {
      myPoint1 = aSelectedObject;
      if (myPoint1 && !myPoint2)
        GroupPoints->PushButton2->click();
    }
    else if (myEditCurrentArgument == GroupPoints->LineEdit2) {
      myPoint2 = aSelectedObject;
      if (myPoint2 && !myPoint1)
        GroupPoints->PushButton1->click();
    }
    else if (myEditCurrentArgument == GroupWire->LineEdit1) {
      myWire = aSelectedObject;
    }
    else if (myEditCurrentArgument == GroupOnCurve->LineEdit1) {
      myCurve = aSelectedObject;
      if (myCurve && !myStartPoint)
        GroupOnCurve->PushButton2->click();
    }
    else if (myEditCurrentArgument == GroupOnCurve->LineEdit2) {
      myStartPoint = aSelectedObject;
      if (myStartPoint && !myCurve)
        GroupOnCurve->PushButton1->click();
    }
  }

  displayPreview(true);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void BuildGUI_EdgeDlg::SetEditCurrentArgument ( ) [private, slot]

Definition at line 339 of file BuildGUI_EdgeDlg.cxx.

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

  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);
  }
  else if (send == GroupWire->PushButton1) {
    myEditCurrentArgument = GroupWire->LineEdit1;
  }
  else if (send == GroupOnCurve->PushButton1) {
    myEditCurrentArgument = GroupOnCurve->LineEdit1;
    GroupOnCurve->PushButton2->setDown(false);
    GroupOnCurve->LineEdit2->setEnabled(false);

    globalSelection(); // close local contexts, if any
    localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE);
  }
  else if (send == GroupOnCurve->PushButton2) {
    myEditCurrentArgument = GroupOnCurve->LineEdit2;
    GroupOnCurve->PushButton1->setDown(false);
    GroupOnCurve->LineEdit1->setEnabled(false);

    globalSelection(); // close local contexts, if any
    localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX);
  }

  // enable line edit
  myEditCurrentArgument->setEnabled(true);
  myEditCurrentArgument->setFocus();
  send->setDown(true);
  displayPreview(true);
}

Here is the caller graph for this function:

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

Definition at line 408 of file BuildGUI_EdgeDlg.cxx.

{
  displayPreview(true);
}

Here is the caller graph for this function:


Member Data Documentation

DlgRef_2Sel1Spin* BuildGUI_EdgeDlg::GroupOnCurve [private]

Definition at line 68 of file BuildGUI_EdgeDlg.h.

DlgRef_2Sel* BuildGUI_EdgeDlg::GroupPoints [private]

Definition at line 66 of file BuildGUI_EdgeDlg.h.

DlgRef_1Sel2Spin* BuildGUI_EdgeDlg::GroupWire [private]

Definition at line 67 of file BuildGUI_EdgeDlg.h.

Definition at line 63 of file BuildGUI_EdgeDlg.h.

Definition at line 61 of file BuildGUI_EdgeDlg.h.

Definition at line 61 of file BuildGUI_EdgeDlg.h.

Definition at line 64 of file BuildGUI_EdgeDlg.h.

Definition at line 62 of file BuildGUI_EdgeDlg.h.


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