Arrow length should follow line width.
--HG-- branch : develop
This commit is contained in:
parent
f4b92b2cf1
commit
89d01f3fe5
|
@ -36,8 +36,7 @@
|
||||||
#include <QtDebug>
|
#include <QtDebug>
|
||||||
|
|
||||||
#include "vabstractcurve_p.h"
|
#include "vabstractcurve_p.h"
|
||||||
|
#include "../vmisc/vabstractapplication.h"
|
||||||
const qreal VAbstractCurve::lengthCurveDirectionArrow = 14;
|
|
||||||
|
|
||||||
VAbstractCurve::VAbstractCurve(const GOType &type, const quint32 &idObject, const Draw &mode)
|
VAbstractCurve::VAbstractCurve(const GOType &type, const quint32 &idObject, const Draw &mode)
|
||||||
:VGObject(type, idObject, mode), d (new VAbstractCurveData())
|
:VGObject(type, idObject, mode), d (new VAbstractCurveData())
|
||||||
|
@ -357,7 +356,7 @@ QVector<DirectionArrow> VAbstractCurve::DirectionArrows() const
|
||||||
//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(lengthCurveDirectionArrow);//arrow length in pixels
|
arrow.setLength(VAbstractCurve::LengthCurveDirectionArrow());
|
||||||
|
|
||||||
DirectionArrow dArrow;
|
DirectionArrow dArrow;
|
||||||
|
|
||||||
|
@ -400,6 +399,12 @@ QPainterPath VAbstractCurve::ShowDirection(const QVector<DirectionArrow> &arrows
|
||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
qreal VAbstractCurve::LengthCurveDirectionArrow()
|
||||||
|
{
|
||||||
|
return qApp->Settings()->GetLineWidth() * 8.0;
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
qreal VAbstractCurve::PathLength(const QVector<QPointF> &path)
|
qreal VAbstractCurve::PathLength(const QVector<QPointF> &path)
|
||||||
{
|
{
|
||||||
|
|
|
@ -100,7 +100,7 @@ public:
|
||||||
virtual QVector<DirectionArrow> DirectionArrows() const;
|
virtual QVector<DirectionArrow> DirectionArrows() const;
|
||||||
static QPainterPath ShowDirection(const QVector<DirectionArrow> &arrows, qreal width);
|
static QPainterPath ShowDirection(const QVector<DirectionArrow> &arrows, qreal width);
|
||||||
|
|
||||||
static const qreal lengthCurveDirectionArrow;
|
static qreal LengthCurveDirectionArrow();
|
||||||
protected:
|
protected:
|
||||||
virtual void CreateName() =0;
|
virtual void CreateName() =0;
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -85,7 +85,7 @@ QPainterPath VAbstractSpline::shape() const
|
||||||
if (m_isHovered || detailsMode)
|
if (m_isHovered || detailsMode)
|
||||||
{
|
{
|
||||||
path.addPath(VAbstractCurve::ShowDirection(curve->DirectionArrows(),
|
path.addPath(VAbstractCurve::ShowDirection(curve->DirectionArrows(),
|
||||||
ScaleWidth(VAbstractCurve::lengthCurveDirectionArrow,
|
ScaleWidth(VAbstractCurve::LengthCurveDirectionArrow(),
|
||||||
SceneScale(scene()))));
|
SceneScale(scene()))));
|
||||||
}
|
}
|
||||||
path.setFillRule(Qt::WindingFill);
|
path.setFillRule(Qt::WindingFill);
|
||||||
|
@ -114,7 +114,7 @@ void VAbstractSpline::paint(QPainter *painter, const QStyleOptionGraphicsItem *o
|
||||||
painter->setBrush(brush());
|
painter->setBrush(brush());
|
||||||
|
|
||||||
painter->drawPath(VAbstractCurve::ShowDirection(curve->DirectionArrows(),
|
painter->drawPath(VAbstractCurve::ShowDirection(curve->DirectionArrows(),
|
||||||
ScaleWidth(VAbstractCurve::lengthCurveDirectionArrow,
|
ScaleWidth(VAbstractCurve::LengthCurveDirectionArrow(),
|
||||||
SceneScale(scene()))));
|
SceneScale(scene()))));
|
||||||
|
|
||||||
painter->restore();
|
painter->restore();
|
||||||
|
|
|
@ -60,7 +60,7 @@ QPainterPath VCurvePathItem::shape() const
|
||||||
}
|
}
|
||||||
|
|
||||||
const QPainterPath arrowsPath = VAbstractCurve::ShowDirection(m_directionArrows,
|
const QPainterPath arrowsPath = VAbstractCurve::ShowDirection(m_directionArrows,
|
||||||
ScaleWidth(VAbstractCurve::lengthCurveDirectionArrow,
|
ScaleWidth(VAbstractCurve::LengthCurveDirectionArrow(),
|
||||||
SceneScale(scene())));
|
SceneScale(scene())));
|
||||||
if (arrowsPath != QPainterPath())
|
if (arrowsPath != QPainterPath())
|
||||||
{
|
{
|
||||||
|
@ -76,7 +76,7 @@ void VCurvePathItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *op
|
||||||
ScalePenWidth();
|
ScalePenWidth();
|
||||||
|
|
||||||
const QPainterPath arrowsPath = VAbstractCurve::ShowDirection(m_directionArrows,
|
const QPainterPath arrowsPath = VAbstractCurve::ShowDirection(m_directionArrows,
|
||||||
ScaleWidth(VAbstractCurve::lengthCurveDirectionArrow,
|
ScaleWidth(VAbstractCurve::LengthCurveDirectionArrow(),
|
||||||
SceneScale(scene())));
|
SceneScale(scene())));
|
||||||
|
|
||||||
if (arrowsPath != QPainterPath())
|
if (arrowsPath != QPainterPath())
|
||||||
|
|
Loading…
Reference in New Issue
Block a user