Don't show arrow if edge too short.

--HG--
branch : develop
This commit is contained in:
dismine 2015-01-23 17:05:23 +02:00
parent 878cc2d573
commit 245c6f522b

View File

@ -662,15 +662,21 @@ QVector<QPointF> VPosition::Triplet(const QLineF &edge) const
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QPainterPath VPosition::ShowDirection(const QLineF &edge) QPainterPath VPosition::ShowDirection(const QLineF &edge)
{ {
const int arrowLength = 14;
QPainterPath path;
if (edge.length()/arrowLength < 5)
{
return path;
}
QLineF arrow = edge; QLineF arrow = edge;
arrow.setLength(edge.length()/2.0); arrow.setLength(edge.length()/2.0);
//Reverse line because we want start arrow from this point //Reverse line because we want start arrow from this point
arrow = QLineF(arrow.p2(), arrow.p1()); arrow = QLineF(arrow.p2(), arrow.p1());
const qreal angle = arrow.angle();//we each time change line angle, better save original angle value const qreal angle = arrow.angle();//we each time change line angle, better save original angle value
arrow.setLength(14);//arrow length in pixels arrow.setLength(arrowLength);//arrow length in pixels
QPainterPath path;
arrow.setAngle(angle-35); arrow.setAngle(angle-35);
path.moveTo(arrow.p1()); path.moveTo(arrow.p1());
path.lineTo(arrow.p2()); path.lineTo(arrow.p2());