Visialization. Highlight first and last point of main path.

--HG--
branch : feature
This commit is contained in:
Roman Telezhynskyi 2016-11-05 14:08:26 +02:00
parent bf306f6101
commit b7def444ef
2 changed files with 17 additions and 1 deletions

View File

@ -32,8 +32,13 @@
VisToolPiece::VisToolPiece(const VContainer *data, QGraphicsItem *parent)
: VisPath(data, parent),
m_points(),
m_line1(nullptr),
m_line2(nullptr),
m_piece()
{}
{
m_line1 = InitItem<QGraphicsLineItem>(supportColor, this);
m_line2 = InitItem<QGraphicsLineItem>(supportColor, this);
}
//---------------------------------------------------------------------------------------------------------------------
VisToolPiece::~VisToolPiece()
@ -53,6 +58,14 @@ void VisToolPiece::RefreshGeometry()
QGraphicsEllipseItem *point = GetPoint(static_cast<quint32>(i), supportColor);
DrawPoint(point, nodes.at(i), supportColor);
}
const QVector<QPointF> points = m_piece.MainPathPoints(Visualization::data);
DrawLine(m_line1, QLineF(points.first(), Visualization::scenePos), supportColor, Qt::DashLine);
if (points.size() > 1)
{
DrawLine(m_line2, QLineF(points.last(), Visualization::scenePos), supportColor, Qt::DashLine);
}
}
}

View File

@ -49,6 +49,9 @@ public:
private:
Q_DISABLE_COPY(VisToolPiece)
QVector<QGraphicsEllipseItem *> m_points;
QGraphicsLineItem *m_line1;
QGraphicsLineItem *m_line2;
VPiece m_piece;
QGraphicsEllipseItem* GetPoint(quint32 i, const QColor &color);