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 |
|
---|
31 | The QwtPlotMarker::setSymbol() member assigns a symbol to the marker.
|
---|
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.
|
---|
42 | */
|
---|
43 |
|
---|
44 | class QWT_EXPORT QwtPlotMarker: public QwtPlotItem
|
---|
45 | {
|
---|
46 | public:
|
---|
47 |
|
---|
48 | /*!
|
---|
49 | Line styles.
|
---|
50 | \sa setLineStyle(), lineStyle()
|
---|
51 | */
|
---|
52 | enum LineStyle
|
---|
53 | {
|
---|
54 | //! No line
|
---|
55 | NoLine,
|
---|
56 |
|
---|
57 | //! A horizontal line
|
---|
58 | HLine,
|
---|
59 |
|
---|
60 | //! A vertical line
|
---|
61 | VLine,
|
---|
62 |
|
---|
63 | //! A crosshair
|
---|
64 | Cross
|
---|
65 | };
|
---|
66 |
|
---|
67 | explicit QwtPlotMarker();
|
---|
68 | virtual ~QwtPlotMarker();
|
---|
69 |
|
---|
70 | virtual int rtti() const;
|
---|
71 |
|
---|
72 | double xValue() const;
|
---|
73 | double yValue() const;
|
---|
74 | QPointF value() const;
|
---|
75 |
|
---|
76 | void setXValue( double );
|
---|
77 | void setYValue( double );
|
---|
78 | void setValue( double, double );
|
---|
79 | void setValue( const QPointF & );
|
---|
80 |
|
---|
81 | void setLineStyle( LineStyle st );
|
---|
82 | LineStyle lineStyle() const;
|
---|
83 |
|
---|
84 | void setLinePen( const QPen &p );
|
---|
85 | const QPen &linePen() const;
|
---|
86 |
|
---|
87 | void setSymbol( const QwtSymbol * );
|
---|
88 | const QwtSymbol *symbol() const;
|
---|
89 |
|
---|
90 | void setLabel( const QwtText& );
|
---|
91 | QwtText label() const;
|
---|
92 |
|
---|
93 | void setLabelAlignment( Qt::Alignment );
|
---|
94 | Qt::Alignment labelAlignment() const;
|
---|
95 |
|
---|
96 | void setLabelOrientation( Qt::Orientation );
|
---|
97 | Qt::Orientation labelOrientation() const;
|
---|
98 |
|
---|
99 | void setSpacing( int );
|
---|
100 | int spacing() const;
|
---|
101 |
|
---|
102 | virtual void draw( QPainter *p,
|
---|
103 | const QwtScaleMap &xMap, const QwtScaleMap &yMap,
|
---|
104 | const QRectF & ) const;
|
---|
105 |
|
---|
106 | virtual QRectF boundingRect() const;
|
---|
107 |
|
---|
108 | virtual void updateLegend( QwtLegend * ) const;
|
---|
109 | virtual void drawLegendIdentifier( QPainter *, const QRectF & ) const;
|
---|
110 |
|
---|
111 | protected:
|
---|
112 | virtual void drawLines( QPainter *,
|
---|
113 | const QRectF &, const QPointF & ) const;
|
---|
114 |
|
---|
115 | virtual void drawLabel( QPainter *,
|
---|
116 | const QRectF &, const QPointF & ) const;
|
---|
117 |
|
---|
118 | private:
|
---|
119 |
|
---|
120 | class PrivateData;
|
---|
121 | PrivateData *d_data;
|
---|
122 | };
|
---|
123 |
|
---|
124 | #endif
|
---|