| 1 | /******************************************************************************
|
|---|
| 2 | * Qwt Widget Library
|
|---|
| 3 | * Copyright (C) 1997 Josef Wilgen
|
|---|
| 4 | * Copyright (C) 2002 Uwe Rathmann
|
|---|
| 5 | *
|
|---|
| 6 | * This library is free software; you can redistribute it and/or
|
|---|
| 7 | * modify it under the terms of the Qwt License, Version 1.0
|
|---|
| 8 | *****************************************************************************/
|
|---|
| 9 |
|
|---|
| 10 | #ifndef QWT_VECTOR_FIELD_SYMBOL_H
|
|---|
| 11 | #define QWT_VECTOR_FIELD_SYMBOL_H
|
|---|
| 12 |
|
|---|
| 13 | #include "qwt_global.h"
|
|---|
| 14 |
|
|---|
| 15 | class QPainter;
|
|---|
| 16 | class QPainterPath;
|
|---|
| 17 |
|
|---|
| 18 | /*!
|
|---|
| 19 | Defines abstract interface for arrow drawing routines.
|
|---|
| 20 |
|
|---|
| 21 | Arrow needs to be drawn horizontally with arrow tip at coordinate 0,0.
|
|---|
| 22 | arrowLength() shall return the entire length of the arrow (needed
|
|---|
| 23 | to translate the arrow for tail/centered alignment).
|
|---|
| 24 | setArrowLength() defines arror length in pixels (screen coordinates). It
|
|---|
| 25 | can be implemented to adjust other geometric properties such as
|
|---|
| 26 | the head size and width of the arrow. It is _always_ called before
|
|---|
| 27 | paint().
|
|---|
| 28 |
|
|---|
| 29 | A new arrow implementation can be set with QwtPlotVectorField::setArrowSymbol(), whereby
|
|---|
| 30 | ownership is transferred to the plot field.
|
|---|
| 31 | */
|
|---|
| 32 | class QWT_EXPORT QwtVectorFieldSymbol
|
|---|
| 33 | {
|
|---|
| 34 | public:
|
|---|
| 35 | QwtVectorFieldSymbol();
|
|---|
| 36 | virtual ~QwtVectorFieldSymbol();
|
|---|
| 37 |
|
|---|
| 38 | /*!
|
|---|
| 39 | Set the length of the symbol/arrow
|
|---|
| 40 | \sa length()
|
|---|
| 41 | */
|
|---|
| 42 | virtual void setLength( qreal length ) = 0;
|
|---|
| 43 |
|
|---|
| 44 | /*!
|
|---|
| 45 | \return length of the symbol/arrow
|
|---|
| 46 | \sa setLength()
|
|---|
| 47 | */
|
|---|
| 48 | virtual qreal length() const = 0;
|
|---|
| 49 |
|
|---|
| 50 | //! Draw the symbol/arrow
|
|---|
| 51 | virtual void paint( QPainter* ) const = 0;
|
|---|
| 52 |
|
|---|
| 53 | private:
|
|---|
| 54 | Q_DISABLE_COPY(QwtVectorFieldSymbol)
|
|---|
| 55 | };
|
|---|
| 56 |
|
|---|
| 57 | /*!
|
|---|
| 58 | Arrow implementation that draws a filled arrow with outline, using
|
|---|
| 59 | a triangular head of constant width.
|
|---|
| 60 | */
|
|---|
| 61 | class QWT_EXPORT QwtVectorFieldArrow : public QwtVectorFieldSymbol
|
|---|
| 62 | {
|
|---|
| 63 | public:
|
|---|
| 64 | QwtVectorFieldArrow( qreal headWidth = 6.0, qreal tailWidth = 1.0 );
|
|---|
| 65 | virtual ~QwtVectorFieldArrow() QWT_OVERRIDE;
|
|---|
| 66 |
|
|---|
| 67 | virtual void setLength( qreal length ) QWT_OVERRIDE;
|
|---|
| 68 | virtual qreal length() const QWT_OVERRIDE;
|
|---|
| 69 |
|
|---|
| 70 | virtual void paint( QPainter* ) const QWT_OVERRIDE;
|
|---|
| 71 |
|
|---|
| 72 | private:
|
|---|
| 73 | class PrivateData;
|
|---|
| 74 | PrivateData* m_data;
|
|---|
| 75 | };
|
|---|
| 76 |
|
|---|
| 77 | /*!
|
|---|
| 78 | Arrow implementation that only used lines, with optionally a filled arrow or only
|
|---|
| 79 | lines.
|
|---|
| 80 | */
|
|---|
| 81 | class QWT_EXPORT QwtVectorFieldThinArrow : public QwtVectorFieldSymbol
|
|---|
| 82 | {
|
|---|
| 83 | public:
|
|---|
| 84 | QwtVectorFieldThinArrow( qreal headWidth = 6.0 );
|
|---|
| 85 | virtual ~QwtVectorFieldThinArrow() QWT_OVERRIDE;
|
|---|
| 86 |
|
|---|
| 87 | virtual void setLength( qreal length ) QWT_OVERRIDE;
|
|---|
| 88 | virtual qreal length() const QWT_OVERRIDE;
|
|---|
| 89 |
|
|---|
| 90 | virtual void paint( QPainter* ) const QWT_OVERRIDE;
|
|---|
| 91 |
|
|---|
| 92 | private:
|
|---|
| 93 | class PrivateData;
|
|---|
| 94 | PrivateData* m_data;
|
|---|
| 95 | };
|
|---|
| 96 |
|
|---|
| 97 | #endif
|
|---|