Only unique points allowed.
--HG-- branch : develop
This commit is contained in:
parent
aa0b73d930
commit
7563446cf9
|
@ -139,10 +139,11 @@ void DialogAlongLine::ChosenObject(quint32 id, const SceneObject &type)
|
|||
{
|
||||
if (type == SceneObject::Point)
|
||||
{
|
||||
const QString toolTip = tr("Select second point of line");
|
||||
switch (number)
|
||||
{
|
||||
case 0:
|
||||
if (SetObject(id, ui->comboBoxFirstPoint, tr("Select second point of line")))
|
||||
if (SetObject(id, ui->comboBoxFirstPoint, toolTip))
|
||||
{
|
||||
number++;
|
||||
line->VisualMode(id);
|
||||
|
@ -151,11 +152,18 @@ void DialogAlongLine::ChosenObject(quint32 id, const SceneObject &type)
|
|||
case 1:
|
||||
if (SetObject(id, ui->comboBoxSecondPoint, ""))
|
||||
{
|
||||
line->setPoint2Id(id);
|
||||
line->RefreshGeometry();
|
||||
prepare = true;
|
||||
this->setModal(true);
|
||||
this->show();
|
||||
if (flagError)
|
||||
{
|
||||
line->setPoint2Id(id);
|
||||
line->RefreshGeometry();
|
||||
prepare = true;
|
||||
this->setModal(true);
|
||||
this->show();
|
||||
}
|
||||
else
|
||||
{
|
||||
emit ToolTip(toolTip);
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -158,22 +158,35 @@ void DialogBisector::ChosenObject(quint32 id, const SceneObject &type)
|
|||
}
|
||||
break;
|
||||
case 1:
|
||||
if (SetObject(id, ui->comboBoxSecondPoint, tr("Select third point of angle")))
|
||||
if (getCurrentObjectId(ui->comboBoxFirstPoint) != id)
|
||||
{
|
||||
number++;
|
||||
line->setPoint2Id(id);
|
||||
line->RefreshGeometry();
|
||||
if (SetObject(id, ui->comboBoxSecondPoint, tr("Select third point of angle")))
|
||||
{
|
||||
number++;
|
||||
line->setPoint2Id(id);
|
||||
line->RefreshGeometry();
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (SetObject(id, ui->comboBoxThirdPoint, ""))
|
||||
{
|
||||
QSet<quint32> set;
|
||||
set.insert(getCurrentObjectId(ui->comboBoxFirstPoint));
|
||||
set.insert(getCurrentObjectId(ui->comboBoxSecondPoint));
|
||||
set.insert(id);
|
||||
|
||||
if (set.size() == 3)
|
||||
{
|
||||
line->setPoint3Id(id);
|
||||
line->RefreshGeometry();
|
||||
prepare = true;
|
||||
this->setModal(true);
|
||||
this->show();
|
||||
if (SetObject(id, ui->comboBoxThirdPoint, ""))
|
||||
{
|
||||
line->setPoint3Id(id);
|
||||
line->RefreshGeometry();
|
||||
prepare = true;
|
||||
this->setModal(true);
|
||||
this->show();
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
|
|
@ -151,22 +151,35 @@ void DialogHeight::ChosenObject(quint32 id, const SceneObject &type)
|
|||
}
|
||||
break;
|
||||
case (1):
|
||||
if (SetObject(id, ui->comboBoxP1Line, tr("Select second point of line")))
|
||||
if (getCurrentObjectId(ui->comboBoxBasePoint) != id)
|
||||
{
|
||||
number++;
|
||||
line->setLineP1Id(id);
|
||||
line->RefreshGeometry();
|
||||
if (SetObject(id, ui->comboBoxP1Line, tr("Select second point of line")))
|
||||
{
|
||||
number++;
|
||||
line->setLineP1Id(id);
|
||||
line->RefreshGeometry();
|
||||
}
|
||||
}
|
||||
break;
|
||||
case (2):
|
||||
if (SetObject(id, ui->comboBoxP2Line, ""))
|
||||
{
|
||||
QSet<quint32> set;
|
||||
set.insert(getCurrentObjectId(ui->comboBoxBasePoint));
|
||||
set.insert(getCurrentObjectId(ui->comboBoxP1Line));
|
||||
set.insert(id);
|
||||
|
||||
if (set.size() == 3)
|
||||
{
|
||||
line->setLineP2Id(id);
|
||||
line->RefreshGeometry();
|
||||
prepare = true;
|
||||
this->setModal(true);
|
||||
this->show();
|
||||
if (SetObject(id, ui->comboBoxP2Line, ""))
|
||||
{
|
||||
line->setLineP2Id(id);
|
||||
line->RefreshGeometry();
|
||||
prepare = true;
|
||||
this->setModal(true);
|
||||
this->show();
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
|
|
@ -99,12 +99,15 @@ void DialogLineIntersect::ChosenObject(quint32 id, const SceneObject &type)
|
|||
}
|
||||
break;
|
||||
case 1:
|
||||
if (SetObject(id, ui->comboBoxP2Line1, tr("Select first point of second line")))
|
||||
if (getCurrentObjectId(ui->comboBoxP1Line1) != id)
|
||||
{
|
||||
number++;
|
||||
p2Line1 = id;
|
||||
line->setLine1P2Id(id);
|
||||
line->RefreshGeometry();
|
||||
if (SetObject(id, ui->comboBoxP2Line1, tr("Select first point of second line")))
|
||||
{
|
||||
number++;
|
||||
p2Line1 = id;
|
||||
line->setLine1P2Id(id);
|
||||
line->RefreshGeometry();
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
|
@ -117,29 +120,40 @@ void DialogLineIntersect::ChosenObject(quint32 id, const SceneObject &type)
|
|||
}
|
||||
break;
|
||||
case 3:
|
||||
if (SetObject(id, ui->comboBoxP2Line2, ""))
|
||||
{
|
||||
QSet<quint32> set;
|
||||
set.insert(getCurrentObjectId(ui->comboBoxP1Line1));
|
||||
set.insert(getCurrentObjectId(ui->comboBoxP2Line1));
|
||||
set.insert(getCurrentObjectId(ui->comboBoxP1Line2));
|
||||
set.insert(id);
|
||||
|
||||
if (set.size() >= 3)
|
||||
{
|
||||
p2Line2 = id;
|
||||
line->setLine2P2Id(id);
|
||||
line->RefreshGeometry();
|
||||
prepare = true;
|
||||
flagPoint = CheckIntersecion();
|
||||
CheckState();
|
||||
this->setModal(true);
|
||||
this->show();
|
||||
connect(ui->comboBoxP1Line1,
|
||||
static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
|
||||
&DialogLineIntersect::P1Line1Changed);
|
||||
connect(ui->comboBoxP2Line1,
|
||||
static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
|
||||
&DialogLineIntersect::P2Line1Changed);
|
||||
connect(ui->comboBoxP1Line2,
|
||||
static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
|
||||
&DialogLineIntersect::P1Line2Changed);
|
||||
connect(ui->comboBoxP2Line2,
|
||||
static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
|
||||
&DialogLineIntersect::P2Line2Changed);
|
||||
if (SetObject(id, ui->comboBoxP2Line2, ""))
|
||||
{
|
||||
p2Line2 = id;
|
||||
line->setLine2P2Id(id);
|
||||
line->RefreshGeometry();
|
||||
prepare = true;
|
||||
flagPoint = CheckIntersecion();
|
||||
CheckState();
|
||||
this->setModal(true);
|
||||
this->show();
|
||||
connect(ui->comboBoxP1Line1,
|
||||
static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
|
||||
&DialogLineIntersect::P1Line1Changed);
|
||||
connect(ui->comboBoxP2Line1,
|
||||
static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
|
||||
&DialogLineIntersect::P2Line1Changed);
|
||||
connect(ui->comboBoxP1Line2,
|
||||
static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
|
||||
&DialogLineIntersect::P1Line2Changed);
|
||||
connect(ui->comboBoxP2Line2,
|
||||
static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
|
||||
&DialogLineIntersect::P2Line2Changed);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
|
|
@ -146,13 +146,16 @@ void DialogNormal::ChosenObject(quint32 id, const SceneObject &type)
|
|||
}
|
||||
break;
|
||||
case 1:
|
||||
if (SetObject(id, ui->comboBoxSecondPoint, ""))
|
||||
if (getCurrentObjectId(ui->comboBoxFirstPoint) != id)
|
||||
{
|
||||
line->setPoint2Id(id);
|
||||
line->RefreshGeometry();
|
||||
prepare = true;
|
||||
this->setModal(true);
|
||||
this->show();
|
||||
if (SetObject(id, ui->comboBoxSecondPoint, ""))
|
||||
{
|
||||
line->setPoint2Id(id);
|
||||
line->RefreshGeometry();
|
||||
prepare = true;
|
||||
this->setModal(true);
|
||||
this->show();
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -171,22 +171,35 @@ void DialogPointOfContact::ChosenObject(quint32 id, const SceneObject &type)
|
|||
}
|
||||
break;
|
||||
case 1:
|
||||
if (SetObject(id, ui->comboBoxSecondPoint, tr("Select point of center of arc")))
|
||||
if (getCurrentObjectId(ui->comboBoxFirstPoint) != id)
|
||||
{
|
||||
number++;
|
||||
line->setLineP2Id(id);
|
||||
line->RefreshGeometry();
|
||||
if (SetObject(id, ui->comboBoxSecondPoint, tr("Select point of center of arc")))
|
||||
{
|
||||
number++;
|
||||
line->setLineP2Id(id);
|
||||
line->RefreshGeometry();
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (SetObject(id, ui->comboBoxCenter, ""))
|
||||
{
|
||||
QSet<quint32> set;
|
||||
set.insert(getCurrentObjectId(ui->comboBoxFirstPoint));
|
||||
set.insert(getCurrentObjectId(ui->comboBoxSecondPoint));
|
||||
set.insert(id);
|
||||
|
||||
if (set.size() == 3)
|
||||
{
|
||||
line->setRadiusId(id);
|
||||
line->RefreshGeometry();
|
||||
prepare = true;
|
||||
this->setModal(true);
|
||||
this->show();
|
||||
if (SetObject(id, ui->comboBoxCenter, ""))
|
||||
{
|
||||
line->setRadiusId(id);
|
||||
line->RefreshGeometry();
|
||||
prepare = true;
|
||||
this->setModal(true);
|
||||
this->show();
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
|
|
@ -104,13 +104,16 @@ void DialogPointOfIntersection::ChosenObject(quint32 id, const SceneObject &type
|
|||
}
|
||||
break;
|
||||
case 1:
|
||||
if (SetObject(id, ui->comboBoxSecondPoint, ""))
|
||||
if (getCurrentObjectId(ui->comboBoxFirstPoint) != id)
|
||||
{
|
||||
line->setPoint2Id(id);
|
||||
line->RefreshGeometry();
|
||||
prepare = true;
|
||||
this->setModal(true);
|
||||
this->show();
|
||||
if (SetObject(id, ui->comboBoxSecondPoint, ""))
|
||||
{
|
||||
line->setPoint2Id(id);
|
||||
line->RefreshGeometry();
|
||||
prepare = true;
|
||||
this->setModal(true);
|
||||
this->show();
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -157,22 +157,35 @@ void DialogShoulderPoint::ChosenObject(quint32 id, const SceneObject &type)
|
|||
}
|
||||
break;
|
||||
case 1:
|
||||
if (SetObject(id, ui->comboBoxP1Line, tr("Select second point of line")))
|
||||
if (getCurrentObjectId(ui->comboBoxP3) != id)
|
||||
{
|
||||
number++;
|
||||
line->setLineP1Id(id);
|
||||
line->RefreshGeometry();
|
||||
if (SetObject(id, ui->comboBoxP1Line, tr("Select second point of line")))
|
||||
{
|
||||
number++;
|
||||
line->setLineP1Id(id);
|
||||
line->RefreshGeometry();
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (SetObject(id, ui->comboBoxP2Line, ""))
|
||||
{
|
||||
QSet<quint32> set;
|
||||
set.insert(getCurrentObjectId(ui->comboBoxP3));
|
||||
set.insert(getCurrentObjectId(ui->comboBoxP1Line));
|
||||
set.insert(id);
|
||||
|
||||
if (set.size() == 3)
|
||||
{
|
||||
line->setLineP2Id(id);
|
||||
line->RefreshGeometry();
|
||||
prepare = true;
|
||||
this->setModal(true);
|
||||
this->show();
|
||||
if (SetObject(id, ui->comboBoxP2Line, ""))
|
||||
{
|
||||
line->setLineP2Id(id);
|
||||
line->RefreshGeometry();
|
||||
prepare = true;
|
||||
this->setModal(true);
|
||||
this->show();
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
|
|
@ -97,29 +97,32 @@ void DialogSpline::ChosenObject(quint32 id, const SceneObject &type)
|
|||
break;
|
||||
case 1:
|
||||
{
|
||||
const QSharedPointer<VPointF> point = data->GeometricObject<VPointF>(id);
|
||||
qint32 index = ui->comboBoxP4->findText(point->name());
|
||||
if ( index != -1 )
|
||||
{ // -1 for not found
|
||||
ui->comboBoxP4->setCurrentIndex(index);
|
||||
emit ToolTip("");
|
||||
index = ui->comboBoxP1->currentIndex();
|
||||
quint32 p1Id = qvariant_cast<quint32>(ui->comboBoxP1->itemData(index));
|
||||
|
||||
QPointF p1 = data->GeometricObject<VPointF>(p1Id)->toQPointF();
|
||||
QPointF p4 = data->GeometricObject<VPointF>(id)->toQPointF();
|
||||
|
||||
ui->spinBoxAngle1->setValue(static_cast<qint32>(QLineF(p1, p4).angle()));
|
||||
ui->spinBoxAngle2->setValue(static_cast<qint32>(QLineF(p4, p1).angle()));
|
||||
|
||||
path->setPoint4Id(id);
|
||||
path->RefreshGeometry();
|
||||
prepare = true;
|
||||
DialogAccepted();
|
||||
}
|
||||
else
|
||||
if (getCurrentObjectId(ui->comboBoxP1) != id)
|
||||
{
|
||||
qWarning()<<"Can't find object by name"<<point->name();
|
||||
const QSharedPointer<VPointF> point = data->GeometricObject<VPointF>(id);
|
||||
qint32 index = ui->comboBoxP4->findText(point->name());
|
||||
if ( index != -1 )
|
||||
{ // -1 for not found
|
||||
ui->comboBoxP4->setCurrentIndex(index);
|
||||
emit ToolTip("");
|
||||
index = ui->comboBoxP1->currentIndex();
|
||||
quint32 p1Id = qvariant_cast<quint32>(ui->comboBoxP1->itemData(index));
|
||||
|
||||
QPointF p1 = data->GeometricObject<VPointF>(p1Id)->toQPointF();
|
||||
QPointF p4 = data->GeometricObject<VPointF>(id)->toQPointF();
|
||||
|
||||
ui->spinBoxAngle1->setValue(static_cast<qint32>(QLineF(p1, p4).angle()));
|
||||
ui->spinBoxAngle2->setValue(static_cast<qint32>(QLineF(p4, p1).angle()));
|
||||
|
||||
path->setPoint4Id(id);
|
||||
path->RefreshGeometry();
|
||||
prepare = true;
|
||||
DialogAccepted();
|
||||
}
|
||||
else
|
||||
{
|
||||
qWarning()<<"Can't find object by name"<<point->name();
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -98,30 +98,54 @@ void DialogTriangle::ChosenObject(quint32 id, const SceneObject &type)
|
|||
}
|
||||
break;
|
||||
case (1):
|
||||
if (SetObject(id, ui->comboBoxAxisP2, tr("Select first point")))
|
||||
if (getCurrentObjectId(ui->comboBoxAxisP1) != id)
|
||||
{
|
||||
number++;
|
||||
line->setPoint2Id(id);
|
||||
line->RefreshGeometry();
|
||||
if (SetObject(id, ui->comboBoxAxisP2, tr("Select first point")))
|
||||
{
|
||||
number++;
|
||||
line->setPoint2Id(id);
|
||||
line->RefreshGeometry();
|
||||
}
|
||||
}
|
||||
break;
|
||||
case (2):
|
||||
if (SetObject(id, ui->comboBoxFirstPoint, tr("Select second point")))
|
||||
{
|
||||
QSet<quint32> set;
|
||||
set.insert(getCurrentObjectId(ui->comboBoxAxisP1));
|
||||
set.insert(getCurrentObjectId(ui->comboBoxAxisP2));
|
||||
set.insert(id);
|
||||
|
||||
if (set.size() == 3)
|
||||
{
|
||||
number++;
|
||||
line->setHypotenuseP1Id(id);
|
||||
line->RefreshGeometry();
|
||||
if (SetObject(id, ui->comboBoxFirstPoint, tr("Select second point")))
|
||||
{
|
||||
number++;
|
||||
line->setHypotenuseP1Id(id);
|
||||
line->RefreshGeometry();
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case (3):
|
||||
if (SetObject(id, ui->comboBoxSecondPoint, ""))
|
||||
{
|
||||
QSet<quint32> set;
|
||||
set.insert(getCurrentObjectId(ui->comboBoxAxisP1));
|
||||
set.insert(getCurrentObjectId(ui->comboBoxAxisP2));
|
||||
set.insert(getCurrentObjectId(ui->comboBoxFirstPoint));
|
||||
set.insert(id);
|
||||
|
||||
if (set.size() == 4)
|
||||
{
|
||||
line->setHypotenuseP2Id(id);
|
||||
line->RefreshGeometry();
|
||||
prepare = true;
|
||||
this->setModal(true);
|
||||
this->show();
|
||||
if (SetObject(id, ui->comboBoxSecondPoint, ""))
|
||||
{
|
||||
line->setHypotenuseP2Id(id);
|
||||
line->RefreshGeometry();
|
||||
prepare = true;
|
||||
this->setModal(true);
|
||||
this->show();
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
|
Loading…
Reference in New Issue
Block a user