[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_PICKER_H
|
---|
| 11 | #define QWT_PLOT_PICKER_H
|
---|
| 12 |
|
---|
| 13 | #include "qwt_global.h"
|
---|
| 14 | #include "qwt_plot_canvas.h"
|
---|
| 15 | #include "qwt_picker.h"
|
---|
| 16 | #include <qvector.h>
|
---|
| 17 |
|
---|
| 18 | class QwtPlot;
|
---|
| 19 |
|
---|
| 20 | /*!
|
---|
| 21 | \brief QwtPlotPicker provides selections on a plot canvas
|
---|
| 22 |
|
---|
| 23 | QwtPlotPicker is a QwtPicker tailored for selections on
|
---|
| 24 | a plot canvas. It is set to a x-Axis and y-Axis and
|
---|
| 25 | translates all pixel coordinates into this coodinate system.
|
---|
| 26 | */
|
---|
| 27 |
|
---|
| 28 | class QWT_EXPORT QwtPlotPicker: public QwtPicker
|
---|
| 29 | {
|
---|
| 30 | Q_OBJECT
|
---|
| 31 |
|
---|
| 32 | public:
|
---|
| 33 | explicit QwtPlotPicker( QwtPlotCanvas * );
|
---|
| 34 | virtual ~QwtPlotPicker();
|
---|
| 35 |
|
---|
| 36 | explicit QwtPlotPicker( int xAxis, int yAxis, QwtPlotCanvas * );
|
---|
| 37 |
|
---|
| 38 | explicit QwtPlotPicker( int xAxis, int yAxis,
|
---|
| 39 | RubberBand rubberBand, DisplayMode trackerMode,
|
---|
| 40 | QwtPlotCanvas * );
|
---|
| 41 |
|
---|
| 42 | virtual void setAxis( int xAxis, int yAxis );
|
---|
| 43 |
|
---|
| 44 | int xAxis() const;
|
---|
| 45 | int yAxis() const;
|
---|
| 46 |
|
---|
| 47 | QwtPlot *plot();
|
---|
| 48 | const QwtPlot *plot() const;
|
---|
| 49 |
|
---|
| 50 | QwtPlotCanvas *canvas();
|
---|
| 51 | const QwtPlotCanvas *canvas() const;
|
---|
| 52 |
|
---|
| 53 | Q_SIGNALS:
|
---|
| 54 |
|
---|
| 55 | /*!
|
---|
| 56 | A signal emitted in case of selectionFlags() & PointSelection.
|
---|
| 57 | \param pos Selected point
|
---|
| 58 | */
|
---|
| 59 | void selected( const QPointF &pos );
|
---|
| 60 |
|
---|
| 61 | /*!
|
---|
| 62 | A signal emitted in case of selectionFlags() & RectSelection.
|
---|
| 63 | \param rect Selected rectangle
|
---|
| 64 | */
|
---|
| 65 | void selected( const QRectF &rect );
|
---|
| 66 |
|
---|
| 67 | /*!
|
---|
| 68 | A signal emitting the selected points,
|
---|
| 69 | at the end of a selection.
|
---|
| 70 |
|
---|
| 71 | \param pa Selected points
|
---|
| 72 | */
|
---|
| 73 | void selected( const QVector<QPointF> &pa );
|
---|
| 74 |
|
---|
| 75 | /*!
|
---|
| 76 | A signal emitted when a point has been appended to the selection
|
---|
| 77 |
|
---|
| 78 | \param pos Position of the appended point.
|
---|
| 79 | \sa append(). moved()
|
---|
| 80 | */
|
---|
| 81 | void appended( const QPointF &pos );
|
---|
| 82 |
|
---|
| 83 | /*!
|
---|
| 84 | A signal emitted whenever the last appended point of the
|
---|
| 85 | selection has been moved.
|
---|
| 86 |
|
---|
| 87 | \param pos Position of the moved last point of the selection.
|
---|
| 88 | \sa move(), appended()
|
---|
| 89 | */
|
---|
| 90 | void moved( const QPointF &pos );
|
---|
| 91 |
|
---|
| 92 | protected:
|
---|
| 93 | QRectF scaleRect() const;
|
---|
| 94 |
|
---|
| 95 | QRectF invTransform( const QRect & ) const;
|
---|
| 96 | QRect transform( const QRectF & ) const;
|
---|
| 97 |
|
---|
| 98 | QPointF invTransform( const QPoint & ) const;
|
---|
| 99 | QPoint transform( const QPointF & ) const;
|
---|
| 100 |
|
---|
| 101 | virtual QwtText trackerText( const QPoint & ) const;
|
---|
| 102 | virtual QwtText trackerTextF( const QPointF & ) const;
|
---|
| 103 |
|
---|
| 104 | virtual void move( const QPoint & );
|
---|
| 105 | virtual void append( const QPoint & );
|
---|
| 106 | virtual bool end( bool ok = true );
|
---|
| 107 |
|
---|
| 108 | private:
|
---|
| 109 | int d_xAxis;
|
---|
| 110 | int d_yAxis;
|
---|
| 111 | };
|
---|
| 112 |
|
---|
| 113 | #endif
|
---|