[4271] | 1 | /* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
|
---|
| 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_PLOT_MARKER_H
|
---|
| 11 | #define QWT_PLOT_MARKER_H
|
---|
| 12 |
|
---|
| 13 | #include <qpen.h>
|
---|
| 14 | #include <qfont.h>
|
---|
| 15 | #include <qstring.h>
|
---|
| 16 | #include <qbrush.h>
|
---|
| 17 | #include "qwt_global.h"
|
---|
| 18 | #include "qwt_plot_item.h"
|
---|
| 19 |
|
---|
| 20 | class QRectF;
|
---|
| 21 | class QwtText;
|
---|
| 22 | class QwtSymbol;
|
---|
| 23 |
|
---|
| 24 | /*!
|
---|
| 25 | \brief A class for drawing markers
|
---|
| 26 |
|
---|
| 27 | A marker can be a horizontal line, a vertical line,
|
---|
| 28 | a symbol, a label or any combination of them, which can
|
---|
| 29 | be drawn around a center point inside a bounding rectangle.
|
---|
| 30 |
|
---|
[8127] | 31 | The setSymbol() member assigns a symbol to the marker.
|
---|
[4271] | 32 | The symbol is drawn at the specified point.
|
---|
| 33 |
|
---|
| 34 | With setLabel(), a label can be assigned to the marker.
|
---|
| 35 | The setLabelAlignment() member specifies where the label is
|
---|
| 36 | drawn. All the Align*-constants in Qt::AlignmentFlags (see Qt documentation)
|
---|
| 37 | are valid. The interpretation of the alignment depends on the marker's
|
---|
| 38 | line style. The alignment refers to the center point of
|
---|
| 39 | the marker, which means, for example, that the label would be printed
|
---|
| 40 | left above the center point if the alignment was set to
|
---|
| 41 | Qt::AlignLeft | Qt::AlignTop.
|
---|
[8127] | 42 |
|
---|
| 43 | \note QwtPlotTextLabel is intended to align a text label
|
---|
| 44 | according to the geometry of canvas
|
---|
| 45 | ( unrelated to plot coordinates )
|
---|
[4271] | 46 | */
|
---|
| 47 |
|
---|
| 48 | class QWT_EXPORT QwtPlotMarker: public QwtPlotItem
|
---|
| 49 | {
|
---|
| 50 | public:
|
---|
| 51 |
|
---|
| 52 | /*!
|
---|
| 53 | Line styles.
|
---|
| 54 | \sa setLineStyle(), lineStyle()
|
---|
| 55 | */
|
---|
| 56 | enum LineStyle
|
---|
| 57 | {
|
---|
| 58 | //! No line
|
---|
| 59 | NoLine,
|
---|
| 60 |
|
---|
| 61 | //! A horizontal line
|
---|
| 62 | HLine,
|
---|
| 63 |
|
---|
| 64 | //! A vertical line
|
---|
| 65 | VLine,
|
---|
| 66 |
|
---|
| 67 | //! A crosshair
|
---|
| 68 | Cross
|
---|
| 69 | };
|
---|
| 70 |
|
---|
[8127] | 71 | explicit QwtPlotMarker( const QString &title = QString::null );
|
---|
| 72 | explicit QwtPlotMarker( const QwtText &title );
|
---|
| 73 |
|
---|
[4271] | 74 | virtual ~QwtPlotMarker();
|
---|
| 75 |
|
---|
| 76 | virtual int rtti() const;
|
---|
| 77 |
|
---|
| 78 | double xValue() const;
|
---|
| 79 | double yValue() const;
|
---|
| 80 | QPointF value() const;
|
---|
| 81 |
|
---|
| 82 | void setXValue( double );
|
---|
| 83 | void setYValue( double );
|
---|
| 84 | void setValue( double, double );
|
---|
| 85 | void setValue( const QPointF & );
|
---|
| 86 |
|
---|
| 87 | void setLineStyle( LineStyle st );
|
---|
| 88 | LineStyle lineStyle() const;
|
---|
| 89 |
|
---|
[8127] | 90 | void setLinePen( const QColor &, qreal width = 0.0, Qt::PenStyle = Qt::SolidLine );
|
---|
[4271] | 91 | void setLinePen( const QPen &p );
|
---|
| 92 | const QPen &linePen() const;
|
---|
| 93 |
|
---|
| 94 | void setSymbol( const QwtSymbol * );
|
---|
| 95 | const QwtSymbol *symbol() const;
|
---|
| 96 |
|
---|
| 97 | void setLabel( const QwtText& );
|
---|
| 98 | QwtText label() const;
|
---|
| 99 |
|
---|
| 100 | void setLabelAlignment( Qt::Alignment );
|
---|
| 101 | Qt::Alignment labelAlignment() const;
|
---|
| 102 |
|
---|
| 103 | void setLabelOrientation( Qt::Orientation );
|
---|
| 104 | Qt::Orientation labelOrientation() const;
|
---|
| 105 |
|
---|
| 106 | void setSpacing( int );
|
---|
| 107 | int spacing() const;
|
---|
| 108 |
|
---|
| 109 | virtual void draw( QPainter *p,
|
---|
| 110 | const QwtScaleMap &xMap, const QwtScaleMap &yMap,
|
---|
| 111 | const QRectF & ) const;
|
---|
| 112 |
|
---|
| 113 | virtual QRectF boundingRect() const;
|
---|
| 114 |
|
---|
[8127] | 115 | virtual QwtGraphic legendIcon( int index, const QSizeF & ) const;
|
---|
[4271] | 116 |
|
---|
| 117 | protected:
|
---|
| 118 | virtual void drawLines( QPainter *,
|
---|
| 119 | const QRectF &, const QPointF & ) const;
|
---|
| 120 |
|
---|
| 121 | virtual void drawLabel( QPainter *,
|
---|
| 122 | const QRectF &, const QPointF & ) const;
|
---|
| 123 |
|
---|
| 124 | private:
|
---|
| 125 |
|
---|
| 126 | class PrivateData;
|
---|
| 127 | PrivateData *d_data;
|
---|
| 128 | };
|
---|
| 129 |
|
---|
| 130 | #endif
|
---|