Only unique points allowed.

--HG--
branch : develop
This commit is contained in:
dismine 2014-11-09 12:57:49 +02:00
parent aa0b73d930
commit 7563446cf9
10 changed files with 227 additions and 120 deletions

View File

@ -139,10 +139,11 @@ void DialogAlongLine::ChosenObject(quint32 id, const SceneObject &type)
{ {
if (type == SceneObject::Point) if (type == SceneObject::Point)
{ {
const QString toolTip = tr("Select second point of line");
switch (number) switch (number)
{ {
case 0: case 0:
if (SetObject(id, ui->comboBoxFirstPoint, tr("Select second point of line"))) if (SetObject(id, ui->comboBoxFirstPoint, toolTip))
{ {
number++; number++;
line->VisualMode(id); line->VisualMode(id);
@ -150,6 +151,8 @@ void DialogAlongLine::ChosenObject(quint32 id, const SceneObject &type)
break; break;
case 1: case 1:
if (SetObject(id, ui->comboBoxSecondPoint, "")) if (SetObject(id, ui->comboBoxSecondPoint, ""))
{
if (flagError)
{ {
line->setPoint2Id(id); line->setPoint2Id(id);
line->RefreshGeometry(); line->RefreshGeometry();
@ -157,6 +160,11 @@ void DialogAlongLine::ChosenObject(quint32 id, const SceneObject &type)
this->setModal(true); this->setModal(true);
this->show(); this->show();
} }
else
{
emit ToolTip(toolTip);
}
}
break; break;
default: default:
break; break;

View File

@ -158,14 +158,25 @@ void DialogBisector::ChosenObject(quint32 id, const SceneObject &type)
} }
break; break;
case 1: case 1:
if (getCurrentObjectId(ui->comboBoxFirstPoint) != id)
{
if (SetObject(id, ui->comboBoxSecondPoint, tr("Select third point of angle"))) if (SetObject(id, ui->comboBoxSecondPoint, tr("Select third point of angle")))
{ {
number++; number++;
line->setPoint2Id(id); line->setPoint2Id(id);
line->RefreshGeometry(); line->RefreshGeometry();
} }
}
break; break;
case 2: case 2:
{
QSet<quint32> set;
set.insert(getCurrentObjectId(ui->comboBoxFirstPoint));
set.insert(getCurrentObjectId(ui->comboBoxSecondPoint));
set.insert(id);
if (set.size() == 3)
{
if (SetObject(id, ui->comboBoxThirdPoint, "")) if (SetObject(id, ui->comboBoxThirdPoint, ""))
{ {
line->setPoint3Id(id); line->setPoint3Id(id);
@ -174,6 +185,8 @@ void DialogBisector::ChosenObject(quint32 id, const SceneObject &type)
this->setModal(true); this->setModal(true);
this->show(); this->show();
} }
}
}
break; break;
default: default:
break; break;

View File

@ -151,14 +151,25 @@ void DialogHeight::ChosenObject(quint32 id, const SceneObject &type)
} }
break; break;
case (1): case (1):
if (getCurrentObjectId(ui->comboBoxBasePoint) != id)
{
if (SetObject(id, ui->comboBoxP1Line, tr("Select second point of line"))) if (SetObject(id, ui->comboBoxP1Line, tr("Select second point of line")))
{ {
number++; number++;
line->setLineP1Id(id); line->setLineP1Id(id);
line->RefreshGeometry(); line->RefreshGeometry();
} }
}
break; break;
case (2): case (2):
{
QSet<quint32> set;
set.insert(getCurrentObjectId(ui->comboBoxBasePoint));
set.insert(getCurrentObjectId(ui->comboBoxP1Line));
set.insert(id);
if (set.size() == 3)
{
if (SetObject(id, ui->comboBoxP2Line, "")) if (SetObject(id, ui->comboBoxP2Line, ""))
{ {
line->setLineP2Id(id); line->setLineP2Id(id);
@ -167,6 +178,8 @@ void DialogHeight::ChosenObject(quint32 id, const SceneObject &type)
this->setModal(true); this->setModal(true);
this->show(); this->show();
} }
}
}
break; break;
default: default:
break; break;

View File

@ -99,6 +99,8 @@ void DialogLineIntersect::ChosenObject(quint32 id, const SceneObject &type)
} }
break; break;
case 1: case 1:
if (getCurrentObjectId(ui->comboBoxP1Line1) != id)
{
if (SetObject(id, ui->comboBoxP2Line1, tr("Select first point of second line"))) if (SetObject(id, ui->comboBoxP2Line1, tr("Select first point of second line")))
{ {
number++; number++;
@ -106,6 +108,7 @@ void DialogLineIntersect::ChosenObject(quint32 id, const SceneObject &type)
line->setLine1P2Id(id); line->setLine1P2Id(id);
line->RefreshGeometry(); line->RefreshGeometry();
} }
}
break; break;
case 2: case 2:
if (SetObject(id, ui->comboBoxP1Line2, tr("Select second point of second line"))) if (SetObject(id, ui->comboBoxP1Line2, tr("Select second point of second line")))
@ -117,6 +120,15 @@ void DialogLineIntersect::ChosenObject(quint32 id, const SceneObject &type)
} }
break; break;
case 3: case 3:
{
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)
{
if (SetObject(id, ui->comboBoxP2Line2, "")) if (SetObject(id, ui->comboBoxP2Line2, ""))
{ {
p2Line2 = id; p2Line2 = id;
@ -140,6 +152,8 @@ void DialogLineIntersect::ChosenObject(quint32 id, const SceneObject &type)
static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
&DialogLineIntersect::P2Line2Changed); &DialogLineIntersect::P2Line2Changed);
} }
}
}
break; break;
default: default:
break; break;

View File

@ -146,6 +146,8 @@ void DialogNormal::ChosenObject(quint32 id, const SceneObject &type)
} }
break; break;
case 1: case 1:
if (getCurrentObjectId(ui->comboBoxFirstPoint) != id)
{
if (SetObject(id, ui->comboBoxSecondPoint, "")) if (SetObject(id, ui->comboBoxSecondPoint, ""))
{ {
line->setPoint2Id(id); line->setPoint2Id(id);
@ -154,6 +156,7 @@ void DialogNormal::ChosenObject(quint32 id, const SceneObject &type)
this->setModal(true); this->setModal(true);
this->show(); this->show();
} }
}
break; break;
default: default:
break; break;

View File

@ -171,14 +171,25 @@ void DialogPointOfContact::ChosenObject(quint32 id, const SceneObject &type)
} }
break; break;
case 1: case 1:
if (getCurrentObjectId(ui->comboBoxFirstPoint) != id)
{
if (SetObject(id, ui->comboBoxSecondPoint, tr("Select point of center of arc"))) if (SetObject(id, ui->comboBoxSecondPoint, tr("Select point of center of arc")))
{ {
number++; number++;
line->setLineP2Id(id); line->setLineP2Id(id);
line->RefreshGeometry(); line->RefreshGeometry();
} }
}
break; break;
case 2: case 2:
{
QSet<quint32> set;
set.insert(getCurrentObjectId(ui->comboBoxFirstPoint));
set.insert(getCurrentObjectId(ui->comboBoxSecondPoint));
set.insert(id);
if (set.size() == 3)
{
if (SetObject(id, ui->comboBoxCenter, "")) if (SetObject(id, ui->comboBoxCenter, ""))
{ {
line->setRadiusId(id); line->setRadiusId(id);
@ -187,6 +198,8 @@ void DialogPointOfContact::ChosenObject(quint32 id, const SceneObject &type)
this->setModal(true); this->setModal(true);
this->show(); this->show();
} }
}
}
break; break;
default: default:
break; break;

View File

@ -104,6 +104,8 @@ void DialogPointOfIntersection::ChosenObject(quint32 id, const SceneObject &type
} }
break; break;
case 1: case 1:
if (getCurrentObjectId(ui->comboBoxFirstPoint) != id)
{
if (SetObject(id, ui->comboBoxSecondPoint, "")) if (SetObject(id, ui->comboBoxSecondPoint, ""))
{ {
line->setPoint2Id(id); line->setPoint2Id(id);
@ -112,6 +114,7 @@ void DialogPointOfIntersection::ChosenObject(quint32 id, const SceneObject &type
this->setModal(true); this->setModal(true);
this->show(); this->show();
} }
}
break; break;
default: default:
break; break;

View File

@ -157,14 +157,25 @@ void DialogShoulderPoint::ChosenObject(quint32 id, const SceneObject &type)
} }
break; break;
case 1: case 1:
if (getCurrentObjectId(ui->comboBoxP3) != id)
{
if (SetObject(id, ui->comboBoxP1Line, tr("Select second point of line"))) if (SetObject(id, ui->comboBoxP1Line, tr("Select second point of line")))
{ {
number++; number++;
line->setLineP1Id(id); line->setLineP1Id(id);
line->RefreshGeometry(); line->RefreshGeometry();
} }
}
break; break;
case 2: case 2:
{
QSet<quint32> set;
set.insert(getCurrentObjectId(ui->comboBoxP3));
set.insert(getCurrentObjectId(ui->comboBoxP1Line));
set.insert(id);
if (set.size() == 3)
{
if (SetObject(id, ui->comboBoxP2Line, "")) if (SetObject(id, ui->comboBoxP2Line, ""))
{ {
line->setLineP2Id(id); line->setLineP2Id(id);
@ -173,6 +184,8 @@ void DialogShoulderPoint::ChosenObject(quint32 id, const SceneObject &type)
this->setModal(true); this->setModal(true);
this->show(); this->show();
} }
}
}
break; break;
default: default:
break; break;

View File

@ -96,6 +96,8 @@ void DialogSpline::ChosenObject(quint32 id, const SceneObject &type)
} }
break; break;
case 1: case 1:
{
if (getCurrentObjectId(ui->comboBoxP1) != id)
{ {
const QSharedPointer<VPointF> point = data->GeometricObject<VPointF>(id); const QSharedPointer<VPointF> point = data->GeometricObject<VPointF>(id);
qint32 index = ui->comboBoxP4->findText(point->name()); qint32 index = ui->comboBoxP4->findText(point->name());
@ -121,6 +123,7 @@ void DialogSpline::ChosenObject(quint32 id, const SceneObject &type)
{ {
qWarning()<<"Can't find object by name"<<point->name(); qWarning()<<"Can't find object by name"<<point->name();
} }
}
break; break;
} }
default: default:

View File

@ -98,22 +98,44 @@ void DialogTriangle::ChosenObject(quint32 id, const SceneObject &type)
} }
break; break;
case (1): case (1):
if (getCurrentObjectId(ui->comboBoxAxisP1) != id)
{
if (SetObject(id, ui->comboBoxAxisP2, tr("Select first point"))) if (SetObject(id, ui->comboBoxAxisP2, tr("Select first point")))
{ {
number++; number++;
line->setPoint2Id(id); line->setPoint2Id(id);
line->RefreshGeometry(); line->RefreshGeometry();
} }
}
break; break;
case (2): case (2):
{
QSet<quint32> set;
set.insert(getCurrentObjectId(ui->comboBoxAxisP1));
set.insert(getCurrentObjectId(ui->comboBoxAxisP2));
set.insert(id);
if (set.size() == 3)
{
if (SetObject(id, ui->comboBoxFirstPoint, tr("Select second point"))) if (SetObject(id, ui->comboBoxFirstPoint, tr("Select second point")))
{ {
number++; number++;
line->setHypotenuseP1Id(id); line->setHypotenuseP1Id(id);
line->RefreshGeometry(); line->RefreshGeometry();
} }
}
}
break; break;
case (3): case (3):
{
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)
{
if (SetObject(id, ui->comboBoxSecondPoint, "")) if (SetObject(id, ui->comboBoxSecondPoint, ""))
{ {
line->setHypotenuseP2Id(id); line->setHypotenuseP2Id(id);
@ -122,6 +144,8 @@ void DialogTriangle::ChosenObject(quint32 id, const SceneObject &type)
this->setModal(true); this->setModal(true);
this->show(); this->show();
} }
}
}
break; break;
default: default:
break; break;