10#include "qwt_vectorfield_symbol.h"
13#include <qpainterpath.h>
25class QwtVectorFieldArrow::PrivateData
28 PrivateData( qreal headW, qreal tailW )
31 , length( headW + 4.0 )
38 path.lineTo( -headWidth, headWidth );
39 path.lineTo( -headWidth, tailWidth );
40 path.lineTo( -length, tailWidth );
41 path.lineTo( -length, -tailWidth );
42 path.lineTo( -headWidth, -tailWidth );
43 path.lineTo( -headWidth, -headWidth );
48 void setLength( qreal l )
50 length = qMax( l, headWidth );
52 path.setElementPositionAt( 3, -length, tailWidth );
53 path.setElementPositionAt( 4, -length, -tailWidth );
56 const qreal headWidth;
57 const qreal tailWidth;
76 m_data =
new PrivateData( headWidth, tailWidth );
87 m_data->setLength(
length );
92 return m_data->length;
97 painter->drawPath( m_data->path );
100class QwtVectorFieldThinArrow::PrivateData
103 PrivateData( qreal headW )
105 , length( headW + 4.0 )
107 path.lineTo( -headWidth, headWidth * 0.6 );
109 path.lineTo( -headWidth, -headWidth * 0.6 );
111 path.lineTo( -length, 0 );
114 const qreal headWidth;
130 m_data =
new PrivateData( headWidth );
143 const qreal headWidth = qMin( m_data->headWidth,
length / 3.0 );
145 QPainterPath& path = m_data->path;
147 path.setElementPositionAt( 1, -headWidth, headWidth * 0.6 );
148 path.setElementPositionAt( 3, -headWidth, -headWidth * 0.6 );
149 path.setElementPositionAt( 5, -
length, 0 );
154 return m_data->length;
159 p->drawPath( m_data->path );
virtual void paint(QPainter *) const override
Draw the symbol/arrow.
QwtVectorFieldArrow(qreal headWidth=6.0, qreal tailWidth=1.0)
Constructor.
virtual void setLength(qreal length) override
virtual qreal length() const override
virtual ~QwtVectorFieldArrow() override
Destructor.
QwtVectorFieldSymbol()
Constructor.
virtual ~QwtVectorFieldSymbol()
Destructor.
QwtVectorFieldThinArrow(qreal headWidth=6.0)
Constructor.
virtual void setLength(qreal length) override
virtual void paint(QPainter *) const override
Draw the symbol/arrow.
virtual ~QwtVectorFieldThinArrow() override
Destructor.
virtual qreal length() const override