Main Page | Class Hierarchy | Alphabetical List | Compound List | File List | Compound Members | File Members | Related Pages

QwtCompass Class Reference

A Compass Widget. More...

#include <qwt_compass.h>

Inheritance diagram for QwtCompass:

QwtDial QwtSliderBase QwtDblRange List of all members.

Public Member Functions

 QwtCompass (QWidget *parent=0, const char *name=0)
virtual ~QwtCompass ()
void setRose (QwtCompassRose *rose)
const QwtCompassRoserose () const
QwtCompassRoserose ()
const QMap< double, QString > & labelMap () const
QMap< double, QString > & labelMap ()
void setLabelMap (const QMap< double, QString > &map)

Protected Member Functions

virtual QString scaleLabel (double value) const
virtual void drawRose (QPainter *, const QPoint &center, int radius, double north, QPalette::ColorGroup) const
virtual void drawScaleContents (QPainter *, const QPoint &center, int radius) const
virtual void keyPressEvent (QKeyEvent *)

Private Attributes

QwtCompassRosed_rose
QMap< double, QString > d_labelMap

Detailed Description

A Compass Widget.

QwtCompass is a widget to display and enter directions. It consists of a scale and an optional needle and rose. The azimuth is the difference between the direction of the needle and north, where one of them is fixed and the other is rotating.

compass1.gif
compass2.gif

Definition at line 37 of file qwt_compass.h.


Constructor & Destructor Documentation

QwtCompass::QwtCompass QWidget *  parent = 0,
const char *  name = 0
 

Constructor.

Parameters:
parent Parent widget
name Widget name
Create a compass widget with a scale, no needle and no rose. The default origin is 270.0 with no valid value. It accepts mouse and keyboard inputs and has no step size. The default mode is QwtDial::RotateNeedle.

Definition at line 32 of file qwt_compass.cpp.

References d_labelMap, QwtScaleDraw::options(), QwtDial::scaleDraw(), QwtScaleDraw::setOptions(), QwtDial::setOrigin(), QwtScaleDraw::setTickLength(), and QwtDial::setWrapping().

QwtCompass::~QwtCompass  )  [virtual]
 

Destructor.

Definition at line 68 of file qwt_compass.cpp.

References d_rose.


Member Function Documentation

void QwtCompass::drawRose QPainter *  ,
const QPoint &  center,
int  radius,
double  north,
QPalette::ColorGroup 
const [protected, virtual]
 

Definition at line 93 of file qwt_compass.cpp.

References d_rose, and QwtCompassRose::draw().

Referenced by drawScaleContents().

void QwtCompass::drawScaleContents QPainter *  painter,
const QPoint &  center,
int  radius
const [protected, virtual]
 

Draw the contents inside the scale

Parameters:
painter Painter
center Center of the contents circle
radius Radius of the contents circle

Reimplemented from QwtDial.

Definition at line 73 of file qwt_compass.cpp.

References drawRose(), QwtDblRange::isValid(), QwtDial::mode(), QwtDial::origin(), QwtDial::RotateScale, and QwtDblRange::value().

void QwtCompass::keyPressEvent QKeyEvent *   )  [protected, virtual]
 

Reimplemented from QwtSliderBase.

Definition at line 140 of file qwt_compass.cpp.

References QwtSliderBase::isReadOnly(), QwtSliderBase::keyPressEvent(), QwtDial::mode(), QwtDial::origin(), QwtDial::RotateNeedle, QwtSliderBase::setValue(), and QwtDblRange::value().

QMap< double, QString > & QwtCompass::labelMap  ) 
 

Returns:
map, mapping values to labels
See also:
QwtCompass::setLabelMap

Definition at line 211 of file qwt_compass.cpp.

References d_labelMap.

const QMap< double, QString > & QwtCompass::labelMap  )  const
 

Returns:
map, mapping values to labels
See also:
QwtCompass::setLabelMap

Definition at line 201 of file qwt_compass.cpp.

References d_labelMap.

QwtCompassRose * QwtCompass::rose  ) 
 

Returns:
rose
See also:
QwtCompass::setRose

Definition at line 135 of file qwt_compass.cpp.

References d_rose.

const QwtCompassRose * QwtCompass::rose  )  const
 

Returns:
rose
See also:
QwtCompass::setRose

Definition at line 125 of file qwt_compass.cpp.

References d_rose.

QString QwtCompass::scaleLabel double  value  )  const [protected, virtual]
 

Map a value to a corresponding label

Parameters:
value Value that will be mapped
Returns:
Label, or QString::null
label() looks in a map for a corresponding label for value or return QString::null.
See also:
QwtCompass::labelMap, QwtCompass::setLabelMap

Reimplemented from QwtDial.

Definition at line 244 of file qwt_compass.cpp.

References d_labelMap.

void QwtCompass::setLabelMap const QMap< double, QString > &  map  ) 
 

Set a map, mapping values to labels.

Parameters:
map value to label map
The values of the major ticks are found by looking into this map. The default map consists of the labels N, NE, E, SE, S, SW, W, NW.

Warning:
The map will have no effect for values that are no major tick values. Major ticks can be changed by QwtScaleDraw::setScale
See also:
QwtCompass::labelMap, QwtCompass::scaleDraw, QwtScaleDraw::setScale

Definition at line 229 of file qwt_compass.cpp.

References d_labelMap.

void QwtCompass::setRose QwtCompassRose rose  ) 
 

Set a rose for the compass

Parameters:
rose Compass rose
Warning:
The rose will be deleted, when a different rose is set or in ~QwtCompass
See also:
QwtCompass::rose

Definition at line 108 of file qwt_compass.cpp.

References d_rose.


Member Data Documentation

QMap<double, QString> QwtCompass::d_labelMap [private]
 

Definition at line 66 of file qwt_compass.h.

Referenced by labelMap(), QwtCompass(), scaleLabel(), and setLabelMap().

QwtCompassRose* QwtCompass::d_rose [private]
 

Definition at line 65 of file qwt_compass.h.

Referenced by drawRose(), rose(), setRose(), and ~QwtCompass().


The documentation for this class was generated from the following files:
Generated on Fri Nov 7 14:11:47 2003 for Qwt Developer's Guide by doxygen 1.3.2