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