[8127] | 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_COMPASS_H
|
---|
| 11 | #define QWT_COMPASS_H 1
|
---|
| 12 |
|
---|
| 13 | #include "qwt_global.h"
|
---|
| 14 | #include "qwt_dial.h"
|
---|
| 15 | #include "qwt_round_scale_draw.h"
|
---|
| 16 | #include <qstring.h>
|
---|
| 17 | #include <qmap.h>
|
---|
| 18 |
|
---|
| 19 | class QwtCompassRose;
|
---|
| 20 |
|
---|
| 21 | /*!
|
---|
| 22 | \brief A special scale draw made for QwtCompass
|
---|
| 23 |
|
---|
| 24 | QwtCompassScaleDraw maps values to strings using
|
---|
| 25 | a special map, that can be modified by the application
|
---|
| 26 |
|
---|
| 27 | The default map consists of the labels N, NE, E, SE, S, SW, W, NW.
|
---|
| 28 |
|
---|
| 29 | \sa QwtCompass
|
---|
| 30 | */
|
---|
| 31 | class QWT_EXPORT QwtCompassScaleDraw: public QwtRoundScaleDraw
|
---|
| 32 | {
|
---|
| 33 | public:
|
---|
| 34 | explicit QwtCompassScaleDraw();
|
---|
| 35 | explicit QwtCompassScaleDraw( const QMap<double, QString> &map );
|
---|
| 36 |
|
---|
| 37 | void setLabelMap( const QMap<double, QString> &map );
|
---|
| 38 | QMap<double, QString> labelMap() const;
|
---|
| 39 |
|
---|
| 40 | virtual QwtText label( double value ) const;
|
---|
| 41 |
|
---|
| 42 | private:
|
---|
| 43 | QMap<double, QString> d_labelMap;
|
---|
| 44 | };
|
---|
| 45 |
|
---|
| 46 | /*!
|
---|
| 47 | \brief A Compass Widget
|
---|
| 48 |
|
---|
| 49 | QwtCompass is a widget to display and enter directions. It consists
|
---|
| 50 | of a scale, an optional needle and rose.
|
---|
| 51 |
|
---|
| 52 | \image html dials1.png
|
---|
| 53 |
|
---|
| 54 | \note The examples/dials example shows how to use QwtCompass.
|
---|
| 55 | */
|
---|
| 56 |
|
---|
| 57 | class QWT_EXPORT QwtCompass: public QwtDial
|
---|
| 58 | {
|
---|
| 59 | Q_OBJECT
|
---|
| 60 |
|
---|
| 61 | public:
|
---|
| 62 | explicit QwtCompass( QWidget* parent = NULL );
|
---|
| 63 | virtual ~QwtCompass();
|
---|
| 64 |
|
---|
| 65 | void setRose( QwtCompassRose *rose );
|
---|
| 66 | const QwtCompassRose *rose() const;
|
---|
| 67 | QwtCompassRose *rose();
|
---|
| 68 |
|
---|
| 69 | protected:
|
---|
| 70 | virtual void drawRose( QPainter *, const QPointF ¢er,
|
---|
| 71 | double radius, double north, QPalette::ColorGroup ) const;
|
---|
| 72 |
|
---|
| 73 | virtual void drawScaleContents( QPainter *,
|
---|
| 74 | const QPointF ¢er, double radius ) const;
|
---|
| 75 |
|
---|
| 76 | virtual void keyPressEvent( QKeyEvent * );
|
---|
| 77 |
|
---|
| 78 | private:
|
---|
| 79 | class PrivateData;
|
---|
| 80 | PrivateData *d_data;
|
---|
| 81 | };
|
---|
| 82 |
|
---|
| 83 | #endif
|
---|