Fix visualization for tool Point from arc and tangent.

(grafted from 255a8e601166518ee052e642786be61863d61871)

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2019-06-08 19:04:23 +03:00
parent d0cd313df0
commit f1f5806be3
3 changed files with 8 additions and 11 deletions

View File

@ -50,6 +50,7 @@
- German translation for Inno setup script. - German translation for Inno setup script.
- [#971] Group operation do not work with VCubicBezierPath. - [#971] Group operation do not work with VCubicBezierPath.
- Regression in method DialogTool::GetNodeName. - Regression in method DialogTool::GetNodeName.
- Fix visualization for tool Point from arc and tangent.
# Version 0.6.1 October 23, 2018 # Version 0.6.1 October 23, 2018
- [#885] Regression. Broken support for multi size measurements. - [#885] Regression. Broken support for multi size measurements.

View File

@ -49,12 +49,11 @@
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VisToolPointFromArcAndTangent::VisToolPointFromArcAndTangent(const VContainer *data, QGraphicsItem *parent) VisToolPointFromArcAndTangent::VisToolPointFromArcAndTangent(const VContainer *data, QGraphicsItem *parent)
: VisLine(data, parent), arcId(NULL_ID), crossPoint(CrossCirclesPoint::FirstPoint), : VisLine(data, parent), arcId(NULL_ID), crossPoint(CrossCirclesPoint::FirstPoint),
point(nullptr), tangent(nullptr), arcPath(nullptr), tangentLine2(nullptr) point(nullptr), tangent(nullptr), arcPath(nullptr)
{ {
arcPath = InitItem<VCurvePathItem>(Qt::darkGreen, this); arcPath = InitItem<VCurvePathItem>(Qt::darkGreen, this);
point = InitPoint(mainColor, this); point = InitPoint(mainColor, this);
tangent = InitPoint(supportColor, this); tangent = InitPoint(supportColor, this);
tangentLine2 = InitItem<VScaledLine>(supportColor, this);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -73,7 +72,7 @@ void VisToolPointFromArcAndTangent::RefreshGeometry()
FindRays(static_cast<QPointF>(*tan), arc.data()); FindRays(static_cast<QPointF>(*tan), arc.data());
QPointF fPoint; QPointF fPoint;
VToolPointFromArcAndTangent::FindPoint(static_cast<QPointF>(*tan), arc.data(), crossPoint, &fPoint); VToolPointFromArcAndTangent::FindPoint(static_cast<QPointF>(*tan), arc.data(), crossPoint, &fPoint);
DrawPoint(point, fPoint, mainColor); DrawPoint(point, fPoint, mainColor);
} }
} }
@ -110,9 +109,12 @@ void VisToolPointFromArcAndTangent::FindRays(const QPointF &p, const VArc *arc)
case 2: case 2:
{ {
int localRes = 0; int localRes = 0;
bool flagP1 = false;
if (arc->IsIntersectLine(r1Arc)) if (arc->IsIntersectLine(r1Arc))
{ {
++localRes; ++localRes;
flagP1 = true;
} }
if (arc->IsIntersectLine(r2Arc)) if (arc->IsIntersectLine(r2Arc))
@ -123,17 +125,14 @@ void VisToolPointFromArcAndTangent::FindRays(const QPointF &p, const VArc *arc)
switch(localRes) switch(localRes)
{ {
case 2: case 2:
DrawRay(this, p, p1, supportColor, Qt::DashLine); DrawRay(this, p, crossPoint == CrossCirclesPoint::FirstPoint ? p1 : p2, supportColor, Qt::DashLine);
DrawRay(tangentLine2, p, p2, supportColor, Qt::DashLine);
break; break;
case 1: case 1:
DrawRay(this, p, p1, supportColor, Qt::DashLine); DrawRay(this, p, flagP1 ? p1 : p2, supportColor, Qt::DashLine);
tangentLine2->setVisible(false);
break; break;
case 0: case 0:
default: default:
this->setVisible(false); this->setVisible(false);
tangentLine2->setVisible(false);
break; break;
} }
@ -141,13 +140,11 @@ void VisToolPointFromArcAndTangent::FindRays(const QPointF &p, const VArc *arc)
} }
case 1: case 1:
DrawRay(this, p, p1, supportColor, Qt::DashLine); DrawRay(this, p, p1, supportColor, Qt::DashLine);
tangentLine2->setVisible(false);
break; break;
case 3: case 3:
case 0: case 0:
default: default:
this->setVisible(false); this->setVisible(false);
tangentLine2->setVisible(false);
break; break;
} }
} }

View File

@ -64,7 +64,6 @@ private:
VScaledEllipse *point; VScaledEllipse *point;
VScaledEllipse *tangent; VScaledEllipse *tangent;
VCurvePathItem *arcPath; VCurvePathItem *arcPath;
VScaledLine *tangentLine2;
void FindRays(const QPointF &p, const VArc *arc); void FindRays(const QPointF &p, const VArc *arc);
}; };