For tool Cubic Bezier curve show connection to control points.
--HG-- branch : feature
This commit is contained in:
parent
2c4312046c
commit
037e91484a
|
@ -39,14 +39,16 @@ VisToolCubicBezier::VisToolCubicBezier(const VContainer *data, QGraphicsItem *pa
|
||||||
point2(nullptr),
|
point2(nullptr),
|
||||||
point3(nullptr),
|
point3(nullptr),
|
||||||
point4(nullptr),
|
point4(nullptr),
|
||||||
helpLine(nullptr)
|
helpLine1(nullptr),
|
||||||
|
helpLine2(nullptr)
|
||||||
{
|
{
|
||||||
|
helpLine1 = InitItem<QGraphicsLineItem>(mainColor, this);
|
||||||
|
helpLine2 = InitItem<QGraphicsLineItem>(mainColor, this);
|
||||||
|
|
||||||
point1 = InitPoint(supportColor, this);
|
point1 = InitPoint(supportColor, this);
|
||||||
point2 = InitPoint(supportColor, this); //-V656
|
point2 = InitPoint(supportColor, this); //-V656
|
||||||
point3 = InitPoint(supportColor, this); //-V656
|
point3 = InitPoint(supportColor, this); //-V656
|
||||||
point4 = InitPoint(supportColor, this); //-V656
|
point4 = InitPoint(supportColor, this); //-V656
|
||||||
|
|
||||||
helpLine = InitItem<QGraphicsLineItem>(mainColor, this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -65,14 +67,13 @@ void VisToolCubicBezier::RefreshGeometry()
|
||||||
if (object2Id <= NULL_ID)
|
if (object2Id <= NULL_ID)
|
||||||
{
|
{
|
||||||
const QLineF line = QLineF(first->toQPointF(), Visualization::scenePos);
|
const QLineF line = QLineF(first->toQPointF(), Visualization::scenePos);
|
||||||
DrawLine(helpLine, line, mainColor, lineStyle);
|
DrawLine(helpLine1, line, mainColor, Qt::DashLine);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
helpLine->setVisible(false);
|
|
||||||
|
|
||||||
const auto second = Visualization::data->GeometricObject<VPointF>(object2Id);
|
const auto second = Visualization::data->GeometricObject<VPointF>(object2Id);
|
||||||
DrawPoint(point2, second->toQPointF(), supportColor);
|
DrawPoint(point2, second->toQPointF(), supportColor);
|
||||||
|
DrawLine(helpLine1, QLineF(first->toQPointF(), second->toQPointF()), mainColor, Qt::DashLine);
|
||||||
|
|
||||||
if (object3Id <= NULL_ID)
|
if (object3Id <= NULL_ID)
|
||||||
{
|
{
|
||||||
|
@ -94,6 +95,7 @@ void VisToolCubicBezier::RefreshGeometry()
|
||||||
{
|
{
|
||||||
const auto fourth = Visualization::data->GeometricObject<VPointF>(object4Id);
|
const auto fourth = Visualization::data->GeometricObject<VPointF>(object4Id);
|
||||||
DrawPoint(point4, fourth->toQPointF(), supportColor);
|
DrawPoint(point4, fourth->toQPointF(), supportColor);
|
||||||
|
DrawLine(helpLine2, QLineF(fourth->toQPointF(), third->toQPointF()), mainColor, Qt::DashLine);
|
||||||
|
|
||||||
VCubicBezier spline(*first, *second, *third, *fourth);
|
VCubicBezier spline(*first, *second, *third, *fourth);
|
||||||
DrawPath(this, spline.GetPath(PathDirection::Show), mainColor, Qt::SolidLine, Qt::RoundCap);
|
DrawPath(this, spline.GetPath(PathDirection::Show), mainColor, Qt::SolidLine, Qt::RoundCap);
|
||||||
|
|
|
@ -56,7 +56,8 @@ protected:
|
||||||
QGraphicsEllipseItem *point2;
|
QGraphicsEllipseItem *point2;
|
||||||
QGraphicsEllipseItem *point3;
|
QGraphicsEllipseItem *point3;
|
||||||
QGraphicsEllipseItem *point4;
|
QGraphicsEllipseItem *point4;
|
||||||
QGraphicsLineItem *helpLine;
|
QGraphicsLineItem *helpLine1;
|
||||||
|
QGraphicsLineItem *helpLine2;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // VISTOOLCUBICBEZIER_H
|
#endif // VISTOOLCUBICBEZIER_H
|
||||||
|
|
Loading…
Reference in New Issue
Block a user