-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
#include <QRadioButton>
#include <QMenu>
#include <QTimer>
+#include <QList>
#include <gp_Pnt.hxx>
#include <TopoDS_Shape.hxx>
#define SPACING 6
#define MARGIN 9
-enum { SelectEdge, SelectWire };
-
//=================================================================================
// class : BasicGUI_PointDlg()
// purpose : Constructs a BasicGUI_PointDlg which is a child of 'parent', with the
GroupXYZ->TextLabel2->setText(tr("GEOM_Y"));
GroupXYZ->TextLabel3->setText(tr("GEOM_Z"));
- GroupOnCurve = new DlgRef_2Sel1Spin(centralWidget());
+ GroupOnCurve = new DlgRef_2Sel1Spin2Check(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);
+ GroupOnCurve->TextLabel3->setText(tr("GEOM_PARAMETER"));
+ GroupOnCurve->CheckButton1->setText(tr("GEOM_TAKE_ORIENTATION_INTO_ACCOUNT"));
+ GroupOnCurve->CheckButton2->setAttribute( Qt::WA_DeleteOnClose );
+ GroupOnCurve->CheckButton2->close();
GroupOnSurface = new DlgRef_1Sel2Spin(centralWidget());
GroupOnSurface->GroupBox1->setTitle(tr("GEOM_POINT_ON_FACE"));
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());
initSpinBox(GroupOnCurve->SpinBox_DX, 0., 1., step, "parametric_precision");
GroupOnCurve->SpinBox_DX->setValue(0.5);
+ GroupOnCurve->CheckButton1->setChecked(true);
initSpinBox(GroupOnSurface->SpinBox_DX, 0., 1., step, "parametric_precision");
GroupOnSurface->SpinBox_DX->setValue(0.5);
connect(myParamCoord, SIGNAL(buttonClicked(int)), this, SLOT(ClickParamCoord(int)));
+ connect(GroupOnCurve->CheckButton1, SIGNAL(toggled(bool)), this, SLOT(CheckBoxClicked()));
+
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)));
{
globalSelection(); // close local contexts, if any
myNeedType = TopAbs_VERTEX;
- localSelection(GEOM::GEOM_Object::_nil(), myNeedType);
+ localSelection(myNeedType);
GroupRefPoint->hide();
GroupOnCurve->hide();
{
globalSelection(); // close local contexts, if any
myNeedType = TopAbs_VERTEX;
- localSelection(GEOM::GEOM_Object::_nil(), myNeedType);
+ localSelection(myNeedType);
myEditCurrentArgument = GroupRefPoint->LineEdit1;
myEditCurrentArgument->setText("");
{
globalSelection(); // close local contexts, if any
myNeedType = TopAbs_EDGE;
- localSelection(GEOM::GEOM_Object::_nil(), myNeedType);
+ localSelection(myNeedType);
myEditCurrentArgument = GroupOnCurve->LineEdit1;
myEditCurrentArgument->setText("");
case GEOM_POINT_INTINT:
{
globalSelection(); // close local contexts, if any
- myNeedType = TopAbs_EDGE;
- localSelection(GEOM::GEOM_Object::_nil(), myNeedType);
+ std::list<int> needTypes;
+ needTypes.push_back( TopAbs_EDGE ), needTypes.push_back( TopAbs_WIRE );
+ localSelection(needTypes );
myEditCurrentArgument = GroupLineIntersection->LineEdit1;
GroupLineIntersection->LineEdit1->setText("");
{
globalSelection(); // close local contexts, if any
myNeedType = TopAbs_FACE;
- localSelection(GEOM::GEOM_Object::_nil(), myNeedType);
+ localSelection(myNeedType);
myEditCurrentArgument = GroupOnSurface->LineEdit1;
myEditCurrentArgument->setText("");
myLine2.nullify();
}
- GEOM::GeomObjPtr aSelectedObject = getSelected(myNeedType);
+ GEOM::GeomObjPtr aSelectedObject;
+ if (id == GEOM_POINT_INTINT) {
+ QList<TopAbs_ShapeEnum> needTypes;
+ needTypes << TopAbs_EDGE, needTypes << TopAbs_WIRE;
+ aSelectedObject= getSelected(needTypes);
+ }
+ else
+ aSelectedObject= getSelected(myNeedType);
TopoDS_Shape aShape;
if (aSelectedObject && GEOMBase::GetShape(aSelectedObject.get(), aShape) && !aShape.IsNull()) {
QString aName = GEOMBase::GetName(aSelectedObject.get());
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);
}
}
}
GroupRefPoint->LineEdit1->setFocus();
myEditCurrentArgument = GroupRefPoint->LineEdit1;
globalSelection(); // close local contexts, if any
- localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX);
+ localSelection(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);
+ localSelection(myNeedType);
GroupOnCurve->PushButton2->setDown(false);
GroupOnCurve->LineEdit1->setEnabled(true);
GroupOnCurve->LineEdit2->setEnabled(false);
myEditCurrentArgument = GroupOnCurve->LineEdit2;
globalSelection(); // close local contexts, if any
myNeedType = TopAbs_VERTEX;
- localSelection(GEOM::GEOM_Object::_nil(), myNeedType);
+ localSelection(myNeedType);
GroupOnCurve->PushButton1->setDown(false);
GroupOnCurve->LineEdit2->setEnabled(true);
GroupOnCurve->LineEdit1->setEnabled(false);
GroupOnSurface->LineEdit1->setFocus();
myEditCurrentArgument = GroupOnSurface->LineEdit1;
globalSelection(); // close local contexts, if any
- localSelection(GEOM::GEOM_Object::_nil(), TopAbs_FACE);
+ localSelection(TopAbs_FACE);
}
else if (send == GroupLineIntersection->PushButton1) {
GroupLineIntersection->LineEdit1->setFocus();
}
send->setDown(true);
- if ((send == GroupLineIntersection->PushButton1 ||
- send == GroupLineIntersection->PushButton2) && !myBusy)
- SelectionIntoArgument();
+ // if ((send == GroupLineIntersection->PushButton1 ||
+ // send == GroupLineIntersection->PushButton2) && !myBusy)
+ // SelectionIntoArgument();
}
// function : CheckBoxClicked()
// purpose : Check Boxes Management
//=================================================================================
-void BasicGUI_PointDlg::CheckBoxClicked(int State)
+void BasicGUI_PointDlg::CheckBoxClicked()
{
displayPreview(true);
}
//=================================================================================
-// funcion : getParameter()
+// function : getParameter()
// purpose :
//=================================================================================
double BasicGUI_PointDlg::getParameter() const
//=================================================================================
-// funcion : getUParameter()
+// function : getUParameter()
// purpose :
//=================================================================================
double BasicGUI_PointDlg::getUParameter() const
//=================================================================================
-// funcion : getVParameter()
+// function : getVParameter()
// purpose :
//=================================================================================
double BasicGUI_PointDlg::getVParameter() const
case GEOM_POINT_EDGE :
{
if (myParamCoord->checkedId() == PARAM_VALUE) {
- anObj = anOper->MakePointOnCurve(myEdge.get(), getParameter());
+ bool isUseOrientation = GroupOnCurve->CheckButton1->isChecked();
+
+ anObj = anOper->MakePointOnCurve(myEdge.get(), getParameter(), isUseOrientation);
aParameters<<GroupOnCurve->SpinBox_DX->text();
}
else if (myParamCoord->checkedId() == LENGTH_VALUE) {
}
}
+//=================================================================================
+// function : getSourceObjects
+// purpose : virtual method to get source objects
+//=================================================================================
+QList<GEOM::GeomObjPtr> BasicGUI_PointDlg::getSourceObjects()
+{
+ QList<GEOM::GeomObjPtr> res;
+ res << myRefPoint << myEdge << myLine1 << myLine2 << myFace;
+ return res;
+}
+
//=================================================================================
// function : ClickParamCoord()
// purpose :
GroupOnCurve->LineEdit2->setVisible(isLength);
GroupOnCurve->TextLabel3->setVisible(isParam || isLength);
GroupOnCurve->SpinBox_DX->setVisible(isParam || isLength);
+ GroupOnCurve->CheckButton1->setVisible(isParam);
if (isParam){
initSpinBox(GroupOnCurve->SpinBox_DX, 0., 1., 0.1, "parametric_precision");
GroupOnCurve->SpinBox_DX->setValue(0.5);
}
}
else if (id == GEOM_POINT_SURF) {
- GroupOnSurface->TextLabel2->setShown(isParam);
- GroupOnSurface->TextLabel3->setShown(isParam);
- GroupOnSurface->SpinBox_DX->setShown(isParam);
- GroupOnSurface->SpinBox_DY->setShown(isParam);
+ GroupOnSurface->TextLabel2->setVisible(isParam);
+ GroupOnSurface->TextLabel3->setVisible(isParam);
+ GroupOnSurface->SpinBox_DX->setVisible(isParam);
+ GroupOnSurface->SpinBox_DY->setVisible(isParam);
}
- GroupXYZ->setShown(!isParam && !isLength);
+ GroupXYZ->setVisible(!isParam && !isLength);
if (theIsUpdate)
QTimer::singleShot(50, this, SLOT(updateSize()));
}
-//=================================================================================
-// function : onBtnPopup()
-// purpose :
-//=================================================================================
-void BasicGUI_PointDlg::onBtnPopup(QAction* a)
-{
- globalSelection(); // close local contexts, if any
- myNeedType = myActions[a] == SelectEdge ? TopAbs_EDGE : TopAbs_WIRE;
- localSelection(GEOM::GEOM_Object::_nil(), myNeedType);
-}
-
//=================================================================================
// function : updateSize
// purpose : adjust dialog size to minimum