Back to index

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

#include <BasicGUI_PointDlg.h>

List of all members.

Public Member Functions

 BasicGUI_PointDlg (GeometryGUI *, QWidget *=0, bool=false, Qt::WindowFlags=0)
 ~BasicGUI_PointDlg ()
bool acceptMouseEvent () const
void OnPointSelected (const gp_Pnt &)

Protected Member Functions

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

Private Slots

void ClickOnOk ()
bool ClickOnApply ()
void ActivateThisDialog ()
void DeactivateActiveDialog ()
void SelectionIntoArgument ()
void SetEditCurrentArgument ()
void ConstructorsClicked (int)
void ValueChangedInSpinBox (double)
void SetDoubleSpinBoxStep (double)
void ClickParamCoord (int)
void CheckBoxClicked (int)
void onBtnPopup (QAction *)
void updateSize ()

Private Member Functions

void Init ()
void enterEvent (QEvent *)
double getParameter () const
double getUParameter () const
double getVParameter () const
void updateParamCoord (bool theIsUpdate)

Private Attributes

GEOM::GeomObjPtr myEdge
GEOM::GeomObjPtr myFace
GEOM::GeomObjPtr myRefPoint
GEOM::GeomObjPtr myLine1
GEOM::GeomObjPtr myLine2
bool myBusy
DlgRef_3Spin * GroupXYZ
DlgRef_1Sel3Spin * GroupRefPoint
DlgRef_2Sel1Spin * GroupOnCurve
DlgRef_2Sel * GroupLineIntersection
DlgRef_1Sel2Spin * GroupOnSurface
QGroupBox * myCoordGrp
QLineEdit * myX
QLineEdit * myY
QLineEdit * myZ
QGroupBox * myParamGroup
QButtonGroup * myParamCoord
QMenu * myBtnPopup
QMap< QAction *, int > myActions
TopAbs_ShapeEnum myNeedType

Detailed Description

Definition at line 52 of file BasicGUI_PointDlg.h.


Constructor & Destructor Documentation

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

Definition at line 80 of file BasicGUI_PointDlg.cxx.

  : GEOMBase_Skeleton(theGeometryGUI, parent, modal, fl),
    myBusy (false)
{
  SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
  QPixmap image0 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_POINT")));
  QPixmap image1 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_POINT_EDGE")));
  QPixmap image2 (aResMgr->loadPixmap("GEOM", tr("ICON_SELECT")));
  QPixmap image3 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_POINT_REF")));
  QPixmap image4 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_POINT_LINES")));
  QPixmap image5 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_POINT_FACE")));
  QPixmap image6 (aResMgr->loadPixmap("GEOM", tr("ICO_LINE")));
  QPixmap image7 (aResMgr->loadPixmap("GEOM", tr("ICO_WIRE")));

  setWindowTitle(tr("GEOM_POINT_TITLE"));

  /***************************************************************/
  mainFrame()->GroupConstructors->setTitle(tr("GEOM_POINTS"));
  mainFrame()->RadioButton1->setIcon(image0);
  mainFrame()->RadioButton2->setIcon(image3);
  mainFrame()->RadioButton3->setIcon(image1);
  mainFrame()->RadioButton4->show();
  mainFrame()->RadioButton4->setIcon(image4);
  mainFrame()->RadioButton5->show();
  mainFrame()->RadioButton5->setIcon(image5);

  myParamGroup = new QGroupBox(centralWidget());
  myParamCoord = new QButtonGroup(myParamGroup);
  QHBoxLayout* boxLayout = new QHBoxLayout(myParamGroup);
  boxLayout->setMargin(MARGIN); boxLayout->setSpacing(SPACING);
  QRadioButton* btn = new QRadioButton(tr("GEOM_PARAM_VALUE"), myParamGroup);
  myParamCoord->addButton(btn, PARAM_VALUE);
  boxLayout->addWidget(btn);
  btn = new QRadioButton(tr("GEOM_LENGTH_VALUE"), myParamGroup);
  myParamCoord->addButton(btn, LENGTH_VALUE);
  boxLayout->addWidget(btn);
  btn = new QRadioButton(tr("GEOM_COORD_VALUE"), myParamGroup);
  myParamCoord->addButton(btn, COORD_VALUE);
  boxLayout->addWidget(btn);
  myParamCoord->setExclusive(true);
  myParamCoord->button(PARAM_VALUE)->setChecked(true);

  GroupXYZ = new DlgRef_3Spin(centralWidget());
  GroupXYZ->GroupBox1->setTitle(tr("GEOM_COORDINATES"));
  GroupXYZ->TextLabel1->setText(tr("GEOM_X"));
  GroupXYZ->TextLabel2->setText(tr("GEOM_Y"));
  GroupXYZ->TextLabel3->setText(tr("GEOM_Z"));

  GroupOnCurve = new DlgRef_2Sel1Spin(centralWidget());
  GroupOnCurve->GroupBox1->setTitle(tr("GEOM_POINT_ON_EDGE"));
  GroupOnCurve->TextLabel1->setText(tr("GEOM_EDGE"));
  GroupOnCurve->TextLabel2->setText(tr("GEOM_START_POINT"));
  GroupOnCurve->TextLabel3->setText(tr("GEOM_PARAMETER"));
  GroupOnCurve->PushButton1->setIcon(image2);
  GroupOnCurve->PushButton2->setIcon(image2);

  GroupOnSurface = new DlgRef_1Sel2Spin(centralWidget());
  GroupOnSurface->GroupBox1->setTitle(tr("GEOM_POINT_ON_FACE"));
  GroupOnSurface->TextLabel1->setText(tr("GEOM_FACE"));
  GroupOnSurface->TextLabel2->setText(tr("GEOM_UPARAMETER"));
  GroupOnSurface->TextLabel3->setText(tr("GEOM_VPARAMETER"));
  GroupOnSurface->PushButton1->setIcon(image2);

  GroupRefPoint = new DlgRef_1Sel3Spin(centralWidget());
  GroupRefPoint->GroupBox1->setTitle(tr("GEOM_REF_POINT"));
  GroupRefPoint->TextLabel1->setText(tr("GEOM_POINT"));
  GroupRefPoint->PushButton1->setIcon(image2);
  GroupRefPoint->TextLabel2->setText(tr("GEOM_DX"));
  GroupRefPoint->TextLabel3->setText(tr("GEOM_DY"));
  GroupRefPoint->TextLabel4->setText(tr("GEOM_DZ"));

  /* popup menu for line intersect buttons */
  myBtnPopup = new QMenu(this);
  QIcon ico_line = QIcon(image6);
  QIcon ico_wire = QIcon(image7);
  myActions[myBtnPopup->addAction(ico_line, tr("GEOM_EDGE"))] = SelectEdge;
  myActions[myBtnPopup->addAction(ico_wire, tr("GEOM_WIRE"))] = SelectWire;

  GroupLineIntersection = new DlgRef_2Sel(centralWidget());
  GroupLineIntersection->GroupBox1->setTitle(tr("GEOM_LINE_INTERSECTION"));
  GroupLineIntersection->TextLabel1->setText(tr("GEOM_LINE1"));
  GroupLineIntersection->TextLabel2->setText(tr("GEOM_LINE2"));
  GroupLineIntersection->PushButton1->setIcon(image2);
  GroupLineIntersection->PushButton1->setMenu(myBtnPopup);
  GroupLineIntersection->PushButton2->setIcon(image2);
  GroupLineIntersection->PushButton2->setMenu(myBtnPopup);
  GroupLineIntersection->LineEdit2->setEnabled(false);

  myCoordGrp = new QGroupBox(tr("GEOM_COORDINATES_RES"), centralWidget());
  QGridLayout* myCoordGrpLayout = new QGridLayout(myCoordGrp);
  myCoordGrpLayout->addWidget(new QLabel(tr("GEOM_X"), myCoordGrp), 0, 0);
  myX = new QLineEdit(myCoordGrp);
  myCoordGrpLayout->addWidget(myX, 0, 1);
  myCoordGrpLayout->addWidget(new QLabel(tr("GEOM_Y"), myCoordGrp), 1, 0);
  myY = new QLineEdit(myCoordGrp);
  myCoordGrpLayout->addWidget(myY, 1, 1);
  myCoordGrpLayout->addWidget(new QLabel(tr("GEOM_Z"), myCoordGrp), 2, 0);
  myZ = new QLineEdit(myCoordGrp);
  myCoordGrpLayout->addWidget(myZ, 2, 1);

  QVBoxLayout* layout = new QVBoxLayout(centralWidget());
  layout->setMargin(0); layout->setSpacing(6);
  layout->addWidget(myParamGroup);
  layout->addWidget(GroupXYZ);
  layout->addWidget(GroupOnCurve);
  layout->addWidget(GroupOnSurface);
  layout->addWidget(GroupRefPoint);
  layout->addWidget(GroupLineIntersection);
  layout->addWidget(myCoordGrp);

  myX->setReadOnly(true);
  myY->setReadOnly(true);
  myZ->setReadOnly(true);

  myX->setEnabled(false);
  myY->setEnabled(false);
  myZ->setEnabled(false);

  QPalette aPal = myX->palette();
  aPal.setColor(QPalette::Disabled, QPalette::Text, QColor(0, 0, 0));
  myX->setPalette(aPal);
  myY->setPalette(aPal);
  myZ->setPalette(aPal);

  setHelpFileName("create_point_page.html");

  Init();
}

Here is the call graph for this function:

Definition at line 215 of file BasicGUI_PointDlg.cxx.

{
}

Member Function Documentation

bool BasicGUI_PointDlg::acceptMouseEvent ( ) const [inline]

Definition at line 61 of file BasicGUI_PointDlg.h.

{ return ( getConstructorId() == 0 );  }

Here is the caller graph for this function:

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

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

Definition at line 921 of file BasicGUI_PointDlg.cxx.

{
  switch (getConstructorId()) {
  case GEOM_POINT_REF:
    GEOMBase::PublishSubObject(myRefPoint.get());
    break;
  case GEOM_POINT_EDGE:
    GEOMBase::PublishSubObject(myEdge.get());
    break;
  case GEOM_POINT_INTINT:
    GEOMBase::PublishSubObject(myLine1.get());
    GEOMBase::PublishSubObject(myLine2.get());
    break;
  case GEOM_POINT_SURF:
    GEOMBase::PublishSubObject(myFace.get());
    break;
  default:
    break;
  }
}

Here is the call graph for this function:

void BasicGUI_PointDlg::CheckBoxClicked ( int  State) [private, slot]

Definition at line 678 of file BasicGUI_PointDlg.cxx.

{
  displayPreview(true);
}
bool BasicGUI_PointDlg::ClickOnApply ( ) [private, slot]

Definition at line 462 of file BasicGUI_PointDlg.cxx.

{
  if (!onAccept())
    return false;

  initName();
  ConstructorsClicked(getConstructorId());
  return true;
}

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 451 of file BasicGUI_PointDlg.cxx.

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

Here is the caller graph for this function:

void BasicGUI_PointDlg::ClickParamCoord ( int  id) [private, slot]

Definition at line 946 of file BasicGUI_PointDlg.cxx.

{
  updateParamCoord(true);
  displayPreview(true);
}

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 332 of file BasicGUI_PointDlg.cxx.

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

      GroupRefPoint->hide();
      GroupOnCurve->hide();
      GroupLineIntersection->hide();
      GroupOnSurface->hide();
      myCoordGrp->hide();
      myParamGroup->hide();
      GroupXYZ->show();
      break;
    }
  case GEOM_POINT_REF:
    {
      globalSelection(); // close local contexts, if any
      myNeedType = TopAbs_VERTEX;
      localSelection(GEOM::GEOM_Object::_nil(), myNeedType);

      myEditCurrentArgument = GroupRefPoint->LineEdit1;
      myEditCurrentArgument->setText("");
      myRefPoint.nullify();
      GroupRefPoint->PushButton1->setDown(true);
      myParamGroup->hide();
      GroupXYZ->hide();
      GroupOnCurve->hide();
      GroupLineIntersection->hide();
      GroupOnSurface->hide();
      GroupRefPoint->show();
      myCoordGrp->show();
      break;
    }
  case GEOM_POINT_EDGE:
    {
      globalSelection(); // close local contexts, if any
      myNeedType = TopAbs_EDGE;
      localSelection(GEOM::GEOM_Object::_nil(), myNeedType);

      myEditCurrentArgument = GroupOnCurve->LineEdit1;
      myEditCurrentArgument->setText("");
      myEdge.nullify();
      myRefPoint.nullify();
      GroupOnCurve->PushButton1->setDown(true);
      GroupRefPoint->hide();
      GroupLineIntersection->hide();
      GroupOnSurface->hide();
      myParamGroup->show();
      myParamCoord->button(LENGTH_VALUE)->show();
      myParamCoord->button(PARAM_VALUE)->setChecked(true);
      GroupOnCurve->show();
      myCoordGrp->show();
      updateParamCoord(false);
      break;
    }
  case GEOM_POINT_INTINT:
    {
      globalSelection(); // close local contexts, if any
      myNeedType = TopAbs_EDGE;
      localSelection(GEOM::GEOM_Object::_nil(), myNeedType);

      myEditCurrentArgument = GroupLineIntersection->LineEdit1;
      GroupLineIntersection->LineEdit1->setText("");
      GroupLineIntersection->LineEdit2->setText("");
      GroupLineIntersection->LineEdit1->setEnabled(true);
      GroupLineIntersection->LineEdit2->setEnabled(false);
      myLine1.nullify();
      myLine2.nullify();
      GroupLineIntersection->PushButton1->setDown(true);
      GroupLineIntersection->PushButton2->setDown(false);
      myParamGroup->hide();
      GroupXYZ->hide();
      GroupRefPoint->hide();
      GroupOnCurve->hide();
      GroupOnSurface->hide();
      myCoordGrp->hide();
      GroupLineIntersection->show();
      break;
    }
  case GEOM_POINT_SURF:
    {
      globalSelection(); // close local contexts, if any
      myNeedType = TopAbs_FACE;
      localSelection(GEOM::GEOM_Object::_nil(), myNeedType);

      myEditCurrentArgument = GroupOnSurface->LineEdit1;
      myEditCurrentArgument->setText("");
      myFace.nullify();
      GroupOnSurface->PushButton1->setDown(true);
      GroupRefPoint->hide();
      GroupOnCurve->hide();
      GroupLineIntersection->hide();
      myParamGroup->show();
      myParamCoord->button(LENGTH_VALUE)->hide();
      myParamCoord->button(PARAM_VALUE)->setChecked(true);
      GroupOnSurface->show();
      myCoordGrp->show();
      updateParamCoord(false);
      break;
    }
  }

  myX->setText("");
  myY->setText("");
  myZ->setText("");

  QTimer::singleShot(50, this, SLOT(updateSize()));

  SelectionIntoArgument();
}

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 733 of file BasicGUI_PointDlg.cxx.

{
  return myGeomGUI->GetGeomGen()->GetIBasicOperations(getStudyId());
}

Definition at line 658 of file BasicGUI_PointDlg.cxx.

{
  // myGeomGUI->SetState(-1);
  GEOMBase_Skeleton::DeactivateActiveDialog();
}

Here is the caller graph for this function:

void BasicGUI_PointDlg::enterEvent ( QEvent *  ) [private]

Definition at line 632 of file BasicGUI_PointDlg.cxx.

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

Here is the call graph for this function:

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

Definition at line 789 of file BasicGUI_PointDlg.cxx.

{
  bool res = false;

  GEOM::GEOM_Object_var anObj;
  QStringList aParameters;

  GEOM::GEOM_IBasicOperations_var anOper = GEOM::GEOM_IBasicOperations::_narrow(getOperation());

  switch (getConstructorId()) {
  case GEOM_POINT_XYZ :
    {
      double x = GroupXYZ->SpinBox_DX->value();
      double y = GroupXYZ->SpinBox_DY->value();
      double z = GroupXYZ->SpinBox_DZ->value();

      aParameters << GroupXYZ->SpinBox_DX->text();
      aParameters << GroupXYZ->SpinBox_DY->text();
      aParameters << GroupXYZ->SpinBox_DZ->text();

      anObj = anOper->MakePointXYZ(x, y, z);
      res = true;
      break;
    }
  case GEOM_POINT_REF :
    {
      double dx = GroupRefPoint->SpinBox_DX->value();
      double dy = GroupRefPoint->SpinBox_DY->value();
      double dz = GroupRefPoint->SpinBox_DZ->value();

      aParameters << GroupRefPoint->SpinBox_DX->text();
      aParameters << GroupRefPoint->SpinBox_DY->text();
      aParameters << GroupRefPoint->SpinBox_DZ->text();

      anObj = anOper->MakePointWithReference(myRefPoint.get(), dx, dy, dz);
      res = true;
      break;
    }
  case GEOM_POINT_EDGE :
    {
      if (myParamCoord->checkedId() == PARAM_VALUE) {
        anObj = anOper->MakePointOnCurve(myEdge.get(), getParameter());
        aParameters<<GroupOnCurve->SpinBox_DX->text();
      }
      else if (myParamCoord->checkedId() == LENGTH_VALUE) {
        anObj = anOper->MakePointOnCurveByLength(myEdge.get(), getParameter(), myRefPoint.get());
        aParameters<<GroupOnCurve->SpinBox_DX->text();
      }
      else if (myParamCoord->checkedId() == COORD_VALUE) {
        double x = GroupXYZ->SpinBox_DX->value();
        double y = GroupXYZ->SpinBox_DY->value();
        double z = GroupXYZ->SpinBox_DZ->value();

        aParameters << GroupXYZ->SpinBox_DX->text();
        aParameters << GroupXYZ->SpinBox_DY->text();
        aParameters << GroupXYZ->SpinBox_DZ->text();

        anObj = anOper->MakePointOnCurveByCoord(myEdge.get(), x, y, z);
      }
      res = true;
      break;
    }
  case GEOM_POINT_INTINT :
    anObj = anOper->MakePointOnLinesIntersection(myLine1.get(), myLine2.get());
    if (!anObj->_is_nil()) {
      QString aName = getNewObjectName();
      if (anObj->GetShapeType() == GEOM::COMPOUND && aName.startsWith("Vertex"))
        initName(tr("GEOM_COMPOUND"));
      else if (anObj->GetShapeType() == GEOM::VERTEX && aName.startsWith("Compound"))
        initName(tr("GEOM_VERTEX"));
    }
    res = true;
    break;
  case GEOM_POINT_SURF :
    {
      if (myParamCoord->checkedId() == PARAM_VALUE) {
        anObj = anOper->MakePointOnSurface(myFace.get(), getUParameter(), getVParameter());
        aParameters<<GroupOnSurface->SpinBox_DX->text();
        aParameters<<GroupOnSurface->SpinBox_DY->text();
      } else {
        double x = GroupXYZ->SpinBox_DX->value();
        double y = GroupXYZ->SpinBox_DY->value();
        double z = GroupXYZ->SpinBox_DZ->value();

        aParameters << GroupXYZ->SpinBox_DX->text();
        aParameters << GroupXYZ->SpinBox_DY->text();
        aParameters << GroupXYZ->SpinBox_DZ->text();

        anObj = anOper->MakePointOnSurfaceByCoord(myFace.get(), x, y, z);
      }
      res = true;
      break;
    }
  }

  const int id = getConstructorId();
  if(!anObj->_is_nil() && !IsPreview() && (id == GEOM_POINT_XYZ ||
                                           id == GEOM_POINT_REF ||
                                           id == GEOM_POINT_EDGE ||
                                           id == GEOM_POINT_SURF)) {
      anObj->SetParameters(aParameters.join(":").toLatin1().constData());
  }

  if (id == GEOM_POINT_REF || id == GEOM_POINT_EDGE || id == GEOM_POINT_SURF) {
    TopoDS_Shape aShape;
    if (GEOMBase::GetShape(anObj, aShape) && !aShape.IsNull() &&
         aShape.ShapeType() == TopAbs_VERTEX) {
      gp_Pnt aPnt = BRep_Tool::Pnt(TopoDS::Vertex(aShape));
      SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
      int aPrecision = resMgr->integerValue("Geometry", "length_precision", 6);
      myX->setText(DlgRef::PrintDoubleValue(aPnt.X(), aPrecision));
      myY->setText(DlgRef::PrintDoubleValue(aPnt.Y(), aPrecision));
      myZ->setText(DlgRef::PrintDoubleValue(aPnt.Z(), aPrecision));
    }
    else {
      myX->setText("");
      myY->setText("");
      myZ->setText("");
    }
  }

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

  return res;
}

Here is the call graph for this function:

double BasicGUI_PointDlg::getParameter ( ) const [private]

Definition at line 688 of file BasicGUI_PointDlg.cxx.

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

Here is the caller graph for this function:

double BasicGUI_PointDlg::getUParameter ( ) const [private]

Definition at line 698 of file BasicGUI_PointDlg.cxx.

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

Here is the caller graph for this function:

double BasicGUI_PointDlg::getVParameter ( ) const [private]

Definition at line 708 of file BasicGUI_PointDlg.cxx.

{
  return GroupOnSurface->SpinBox_DY->value();
}

Here is the caller graph for this function:

void BasicGUI_PointDlg::Init ( ) [private]

Definition at line 224 of file BasicGUI_PointDlg.cxx.

{
  GroupOnCurve->LineEdit1->setReadOnly(true);
  GroupOnCurve->LineEdit2->setReadOnly(true);
  GroupOnSurface->LineEdit1->setReadOnly(true);
  GroupRefPoint->LineEdit1->setReadOnly(true);
  GroupLineIntersection->LineEdit1->setReadOnly(true);
  GroupLineIntersection->LineEdit2->setReadOnly(true);
  GroupLineIntersection->LineEdit1->setEnabled(true);
  GroupLineIntersection->LineEdit2->setEnabled(false);

  myEdge.nullify();
  myFace.nullify();
  myRefPoint.nullify();
  myLine1.nullify();
  myLine2.nullify();
  myNeedType = TopAbs_VERTEX;

  myEditCurrentArgument = 0;

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

  /* min, max, step and decimals for spin boxes */
  initSpinBox(GroupXYZ->SpinBox_DX, COORD_MIN, COORD_MAX, step, "length_precision");
  initSpinBox(GroupXYZ->SpinBox_DY, COORD_MIN, COORD_MAX, step, "length_precision");
  initSpinBox(GroupXYZ->SpinBox_DZ, COORD_MIN, COORD_MAX, step, "length_precision");
  GroupXYZ->SpinBox_DX->setValue(0.0);
  GroupXYZ->SpinBox_DY->setValue(0.0);
  GroupXYZ->SpinBox_DZ->setValue(0.0);

  initSpinBox(GroupRefPoint->SpinBox_DX, COORD_MIN, COORD_MAX, step, "length_precision");
  initSpinBox(GroupRefPoint->SpinBox_DY, COORD_MIN, COORD_MAX, step, "length_precision");
  initSpinBox(GroupRefPoint->SpinBox_DZ, COORD_MIN, COORD_MAX, step, "length_precision");
  GroupRefPoint->SpinBox_DX->setValue(0.0);
  GroupRefPoint->SpinBox_DY->setValue(0.0);
  GroupRefPoint->SpinBox_DZ->setValue(0.0);

  step = 0.1;

  initSpinBox(GroupOnCurve->SpinBox_DX, 0., 1., step, "parametric_precision");
  GroupOnCurve->SpinBox_DX->setValue(0.5);

  initSpinBox(GroupOnSurface->SpinBox_DX, 0., 1., step, "parametric_precision");
  GroupOnSurface->SpinBox_DX->setValue(0.5);
  initSpinBox(GroupOnSurface->SpinBox_DY, 0., 1., step, "parametric_precision");
  GroupOnSurface->SpinBox_DY->setValue(0.5);

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

  connect(buttonOk(),     SIGNAL(clicked()), this, SLOT(ClickOnOk()));
  connect(buttonApply(),  SIGNAL(clicked()), this, SLOT(ClickOnApply()));

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

  connect(myParamCoord,   SIGNAL(buttonClicked(int)), this, SLOT(ClickParamCoord(int)));

  connect(GroupOnCurve->PushButton1,          SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
  connect(GroupOnCurve->PushButton2,          SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
  connect(GroupOnSurface->PushButton1,        SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
  connect(GroupLineIntersection->PushButton1, SIGNAL(pressed()), this, SLOT(SetEditCurrentArgument()));
  connect(GroupLineIntersection->PushButton2, SIGNAL(pressed()), this, SLOT(SetEditCurrentArgument()));

  connect(myBtnPopup, SIGNAL(triggered(QAction*)), this, SLOT(onBtnPopup(QAction*)));

  connect(GroupOnCurve->SpinBox_DX,   SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
  connect(GroupOnSurface->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
  connect(GroupOnSurface->SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
  connect(GroupXYZ->SpinBox_DX,       SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
  connect(GroupXYZ->SpinBox_DY,       SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
  connect(GroupXYZ->SpinBox_DZ,       SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
  connect(GroupRefPoint->SpinBox_DX,  SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
  connect(GroupRefPoint->SpinBox_DY,  SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
  connect(GroupRefPoint->SpinBox_DZ,  SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));

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

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

  initName(tr("GEOM_VERTEX"));

  ConstructorsClicked(0);
}

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 742 of file BasicGUI_PointDlg.cxx.

{
  bool ok = false;
  switch (getConstructorId()) {
  case GEOM_POINT_XYZ :
    ok = GroupXYZ->SpinBox_DX->isValid(msg, !IsPreview()) &&
         GroupXYZ->SpinBox_DY->isValid(msg, !IsPreview()) &&
         GroupXYZ->SpinBox_DZ->isValid(msg, !IsPreview());
    break;
  case GEOM_POINT_REF:
    ok = GroupRefPoint->SpinBox_DX->isValid(msg, !IsPreview()) &&
         GroupRefPoint->SpinBox_DY->isValid(msg, !IsPreview()) &&
         GroupRefPoint->SpinBox_DZ->isValid(msg, !IsPreview()) &&
         myRefPoint;
    break;
  case GEOM_POINT_EDGE:
    if (myParamCoord->checkedId() == PARAM_VALUE || myParamCoord->checkedId() == LENGTH_VALUE)
      ok = GroupOnCurve->SpinBox_DX->isValid(msg, !IsPreview());
    else
      ok = GroupXYZ->SpinBox_DX->isValid(msg, !IsPreview()) &&
           GroupXYZ->SpinBox_DY->isValid(msg, !IsPreview()) &&
           GroupXYZ->SpinBox_DZ->isValid(msg, !IsPreview());
    ok = myEdge && ok;
    break;
  case GEOM_POINT_INTINT:
    ok = myLine1 && myLine2;
    break;
  case GEOM_POINT_SURF:
    if (myParamCoord->checkedId() == PARAM_VALUE)
      ok = GroupOnSurface->SpinBox_DX->isValid(msg, !IsPreview()) &&
           GroupOnSurface->SpinBox_DY->isValid(msg, !IsPreview());
    else
      ok = GroupXYZ->SpinBox_DX->isValid(msg, !IsPreview()) &&
           GroupXYZ->SpinBox_DY->isValid(msg, !IsPreview()) &&
           GroupXYZ->SpinBox_DZ->isValid(msg, !IsPreview());
    ok = myFace && ok;
    break;
  default:
    break;
  }
  return ok;
}
void BasicGUI_PointDlg::onBtnPopup ( QAction *  a) [private, slot]

Definition at line 999 of file BasicGUI_PointDlg.cxx.

{
  globalSelection(); // close local contexts, if any
  myNeedType = myActions[a] == SelectEdge ? TopAbs_EDGE : TopAbs_WIRE;
  localSelection(GEOM::GEOM_Object::_nil(), myNeedType);
}

Here is the caller graph for this function:

void BasicGUI_PointDlg::OnPointSelected ( const gp_Pnt &  thePnt)

Definition at line 718 of file BasicGUI_PointDlg.cxx.

{
  if (getConstructorId() == GEOM_POINT_XYZ) {
    GroupXYZ->SpinBox_DX->setValue(thePnt.X());
    GroupXYZ->SpinBox_DY->setValue(thePnt.Y());
    GroupXYZ->SpinBox_DZ->setValue(thePnt.Z());

    displayPreview(true);
  }
}

Here is the caller graph for this function:

void BasicGUI_PointDlg::SelectionIntoArgument ( ) [private, slot]

Definition at line 477 of file BasicGUI_PointDlg.cxx.

{
  erasePreview();
  const int id = getConstructorId();

  if ((id == GEOM_POINT_REF || id == GEOM_POINT_EDGE || id == GEOM_POINT_SURF)
       && myEditCurrentArgument != 0)
  {
    myEditCurrentArgument->setText("");
    myX->setText("");
    myY->setText("");
    myZ->setText("");
    myFace.nullify();
    if (myEditCurrentArgument == GroupOnCurve->LineEdit1)
      myEdge.nullify();
    else if (myEditCurrentArgument == GroupOnCurve->LineEdit2)
      myRefPoint.nullify();
  }
  else if (id == GEOM_POINT_INTINT) {
    myEditCurrentArgument->setText("");
    if (myEditCurrentArgument == GroupLineIntersection->LineEdit1)
      myLine1.nullify();
    else if (myEditCurrentArgument == GroupLineIntersection->LineEdit2)
      myLine2.nullify();
  }

  GEOM::GeomObjPtr aSelectedObject = getSelected(myNeedType);
  TopoDS_Shape aShape;
  if (aSelectedObject && GEOMBase::GetShape(aSelectedObject.get(), aShape) && !aShape.IsNull()) {
    QString aName = GEOMBase::GetName(aSelectedObject.get());
    myBusy = true;
    if (id == GEOM_POINT_XYZ) {
      gp_Pnt aPnt = BRep_Tool::Pnt(TopoDS::Vertex(aShape));
      GroupXYZ->SpinBox_DX->setValue(aPnt.X());
      GroupXYZ->SpinBox_DY->setValue(aPnt.Y());
      GroupXYZ->SpinBox_DZ->setValue(aPnt.Z());
    }
    else if (id == GEOM_POINT_REF) {
      myRefPoint = aSelectedObject;
      GroupRefPoint->LineEdit1->setText(aName);
    }
    else if (id == GEOM_POINT_EDGE) {
      myEditCurrentArgument->setText(aName);
      if (myEditCurrentArgument == GroupOnCurve->LineEdit1) {
        myEdge = aSelectedObject;
        if (myEdge && !myRefPoint) {
          GroupOnCurve->PushButton2->click();
        }
      }
      else if (myEditCurrentArgument == GroupOnCurve->LineEdit2) {
        myRefPoint = aSelectedObject;
        if (myRefPoint && !myEdge) {
          GroupOnCurve->PushButton1->click();
        }
      }
    }
    else if (id == GEOM_POINT_INTINT) {
      myEditCurrentArgument->setText(aName);
      if (myEditCurrentArgument == GroupLineIntersection->LineEdit1) {
        myLine1 = aSelectedObject;
        if (myLine1 && !myLine2) {
          GroupLineIntersection->PushButton2->setMenu(0);
          GroupLineIntersection->PushButton2->click();
          GroupLineIntersection->PushButton2->setDown(true);
          GroupLineIntersection->PushButton2->setMenu(myBtnPopup);
        }
      }
      else if (myEditCurrentArgument == GroupLineIntersection->LineEdit2) {
        myLine2 = aSelectedObject;
        if (myLine2 && !myLine1) {
          GroupLineIntersection->PushButton1->setMenu(0);
          GroupLineIntersection->PushButton1->click();
          GroupLineIntersection->PushButton1->setDown(true);
          GroupLineIntersection->PushButton1->setMenu(myBtnPopup);
        }
      }
    }
    else if (id == GEOM_POINT_SURF) {
      myFace = aSelectedObject;
      GroupOnSurface->LineEdit1->setText(aName);
    }
    myBusy = false;
  }

  displayPreview(true);
}

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 316 of file BasicGUI_PointDlg.cxx.

{
  GroupOnCurve->SpinBox_DX->setSingleStep(step);
  GroupXYZ->SpinBox_DX->setSingleStep(step);
  GroupXYZ->SpinBox_DY->setSingleStep(step);
  GroupXYZ->SpinBox_DZ->setSingleStep(step);
  GroupRefPoint->SpinBox_DX->setSingleStep(step);
  GroupRefPoint->SpinBox_DY->setSingleStep(step);
  GroupRefPoint->SpinBox_DZ->setSingleStep(step);
}

Here is the caller graph for this function:

Definition at line 569 of file BasicGUI_PointDlg.cxx.

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

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

  if ((send == GroupLineIntersection->PushButton1 ||
         send == GroupLineIntersection->PushButton2) && !myBusy)
    SelectionIntoArgument();
}

Here is the call graph for this function:

Here is the caller graph for this function:

void BasicGUI_PointDlg::updateParamCoord ( bool  theIsUpdate) [private]

Definition at line 956 of file BasicGUI_PointDlg.cxx.

{
  bool isParam = myParamCoord->checkedId() == PARAM_VALUE;
  bool isLength = myParamCoord->checkedId() == LENGTH_VALUE;

  SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
  double step = resMgr->doubleValue("Geometry", "SettingsGeomStep", 100);

  const int id = getConstructorId();
  if (id == GEOM_POINT_EDGE) {
    GroupOnCurve->TextLabel2->setVisible(isLength);
    GroupOnCurve->PushButton2->setVisible(isLength);
    GroupOnCurve->LineEdit2->setVisible(isLength);
    GroupOnCurve->TextLabel3->setVisible(isParam || isLength);
    GroupOnCurve->SpinBox_DX->setVisible(isParam || isLength);
    if (isParam){
      initSpinBox(GroupOnCurve->SpinBox_DX, 0., 1., 0.1, "parametric_precision");
      GroupOnCurve->SpinBox_DX->setValue(0.5);
      GroupOnCurve->TextLabel3->setText(tr("GEOM_PARAMETER"));
    }
    else if (isLength){
      initSpinBox(GroupOnCurve->SpinBox_DX, COORD_MIN, COORD_MAX, step, "length_precision");
      GroupOnCurve->SpinBox_DX->setValue(0.0);
      GroupOnCurve->TextLabel3->setText(tr("GEOM_LENGTH"));
    }
  }
  else if (id == GEOM_POINT_SURF) {
    GroupOnSurface->TextLabel2->setShown(isParam);
    GroupOnSurface->TextLabel3->setShown(isParam);
    GroupOnSurface->SpinBox_DX->setShown(isParam);
    GroupOnSurface->SpinBox_DY->setShown(isParam);
  }

  GroupXYZ->setShown(!isParam && !isLength);

  if (theIsUpdate)
    QTimer::singleShot(50, this, SLOT(updateSize()));
}

Here is the call graph for this function:

Here is the caller graph for this function:

void BasicGUI_PointDlg::updateSize ( ) [private, slot]

Definition at line 1010 of file BasicGUI_PointDlg.cxx.

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

Here is the caller graph for this function:

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

Definition at line 669 of file BasicGUI_PointDlg.cxx.

{
  displayPreview(true);
}

Here is the caller graph for this function:


Member Data Documentation

Definition at line 91 of file BasicGUI_PointDlg.h.

DlgRef_2Sel1Spin* BasicGUI_PointDlg::GroupOnCurve [private]

Definition at line 90 of file BasicGUI_PointDlg.h.

DlgRef_1Sel2Spin* BasicGUI_PointDlg::GroupOnSurface [private]

Definition at line 92 of file BasicGUI_PointDlg.h.

DlgRef_1Sel3Spin* BasicGUI_PointDlg::GroupRefPoint [private]

Definition at line 89 of file BasicGUI_PointDlg.h.

DlgRef_3Spin* BasicGUI_PointDlg::GroupXYZ [private]

Definition at line 88 of file BasicGUI_PointDlg.h.

QMap<QAction*, int> BasicGUI_PointDlg::myActions [private]

Definition at line 103 of file BasicGUI_PointDlg.h.

Definition at line 102 of file BasicGUI_PointDlg.h.

bool BasicGUI_PointDlg::myBusy [private]

Definition at line 86 of file BasicGUI_PointDlg.h.

QGroupBox* BasicGUI_PointDlg::myCoordGrp [private]

Definition at line 94 of file BasicGUI_PointDlg.h.

Definition at line 80 of file BasicGUI_PointDlg.h.

Definition at line 81 of file BasicGUI_PointDlg.h.

Definition at line 83 of file BasicGUI_PointDlg.h.

Definition at line 84 of file BasicGUI_PointDlg.h.

TopAbs_ShapeEnum BasicGUI_PointDlg::myNeedType [private]

Definition at line 105 of file BasicGUI_PointDlg.h.

QButtonGroup* BasicGUI_PointDlg::myParamCoord [private]

Definition at line 100 of file BasicGUI_PointDlg.h.

QGroupBox* BasicGUI_PointDlg::myParamGroup [private]

Definition at line 99 of file BasicGUI_PointDlg.h.

Definition at line 82 of file BasicGUI_PointDlg.h.

QLineEdit* BasicGUI_PointDlg::myX [private]

Definition at line 95 of file BasicGUI_PointDlg.h.

QLineEdit* BasicGUI_PointDlg::myY [private]

Definition at line 96 of file BasicGUI_PointDlg.h.

QLineEdit* BasicGUI_PointDlg::myZ [private]

Definition at line 97 of file BasicGUI_PointDlg.h.


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