A class for drawing round scales. More...
#include <qwt_round_scale_draw.h>
Classes | |
class | PrivateData |
Public Member Functions | |
QPointF | center () const |
Get the center of the scale. More... | |
virtual double | extent (const QFont &) const |
void | moveCenter (double x, double y) |
Move the center of the scale draw, leaving the radius unchanged. More... | |
void | moveCenter (const QPointF &) |
QwtRoundScaleDraw () | |
Constructor. More... | |
double | radius () const |
void | setAngleRange (double angle1, double angle2) |
Adjust the baseline circle segment for round scales. More... | |
void | setRadius (double radius) |
virtual | ~QwtRoundScaleDraw () |
Destructor. More... | |
Public Member Functions inherited from QwtAbstractScaleDraw | |
virtual void | draw (QPainter *, const QPalette &) const |
Draw the scale. More... | |
void | enableComponent (ScaleComponent, bool enable=true) |
bool | hasComponent (ScaleComponent) const |
void | invalidateCache () |
virtual QwtText | label (double) const |
Convert a value into its representing label. More... | |
double | maxTickLength () const |
double | minimumExtent () const |
int | penWidth () const |
QwtAbstractScaleDraw () | |
Constructor. More... | |
const QwtScaleDiv & | scaleDiv () const |
const QwtScaleMap & | scaleMap () const |
QwtScaleMap & | scaleMap () |
void | setMinimumExtent (double) |
Set a minimum for the extent. More... | |
void | setPenWidth (int width) |
Specify the width of the scale pen. More... | |
void | setScaleDiv (const QwtScaleDiv &s) |
void | setSpacing (double margin) |
Set the spacing between tick and labels. More... | |
void | setTickLength (QwtScaleDiv::TickType, double length) |
void | setTransformation (QwtTransform *) |
double | spacing () const |
Get the spacing. More... | |
double | tickLength (QwtScaleDiv::TickType) const |
virtual | ~QwtAbstractScaleDraw () |
Destructor. More... | |
Protected Member Functions | |
virtual void | drawBackbone (QPainter *) const |
virtual void | drawLabel (QPainter *, double val) const |
virtual void | drawTick (QPainter *, double val, double len) const |
Protected Member Functions inherited from QwtAbstractScaleDraw | |
const QwtText & | tickLabel (const QFont &, double value) const |
Convert a value into its representing label and cache it. More... | |
Private Attributes | |
PrivateData * | d_data |
Additional Inherited Members | |
Public Types inherited from QwtAbstractScaleDraw | |
enum | ScaleComponent { Backbone = 0x01, Ticks = 0x02, Labels = 0x04 } |
typedef QFlags< ScaleComponent > | ScaleComponents |
Scale components. More... | |
A class for drawing round scales.
QwtRoundScaleDraw can be used to draw round scales. The circle segment can be adjusted by setAngleRange(). The geometry of the scale can be specified with moveCenter() and setRadius().
After a scale division has been specified as a QwtScaleDiv object using QwtAbstractScaleDraw::setScaleDiv(const QwtScaleDiv &s), the scale can be drawn with the QwtAbstractScaleDraw::draw() member.
Definition at line 30 of file qwt_round_scale_draw.h.
QwtRoundScaleDraw::QwtRoundScaleDraw | ( | ) |
Constructor.
The range of the scale is initialized to [0, 100], The center is set to (50, 50) with a radius of 50. The angle range is set to [-135, 135].
Definition at line 45 of file qwt_round_scale_draw.cpp.
|
virtual |
Destructor.
Definition at line 54 of file qwt_round_scale_draw.cpp.
QPointF QwtRoundScaleDraw::center | ( | ) | const |
Get the center of the scale.
Definition at line 97 of file qwt_round_scale_draw.cpp.
|
protectedvirtual |
Draws the baseline of the scale
painter | Painter |
Implements QwtAbstractScaleDraw.
Definition at line 225 of file qwt_round_scale_draw.cpp.
|
protectedvirtual |
Draws the label for a major scale tick
painter | Painter |
value | Value |
Implements QwtAbstractScaleDraw.
Definition at line 146 of file qwt_round_scale_draw.cpp.
|
protectedvirtual |
Draw a tick
painter | Painter |
value | Value of the tick |
len | Lenght of the tick |
Implements QwtAbstractScaleDraw.
Definition at line 191 of file qwt_round_scale_draw.cpp.
|
virtual |
Calculate the extent of the scale
The extent is the distance between the baseline to the outermost pixel of the scale draw. radius() + extent() is an upper limit for the radius of the bounding circle.
font | Font used for painting the labels |
Implements QwtAbstractScaleDraw.
Definition at line 256 of file qwt_round_scale_draw.cpp.
|
inline |
Move the center of the scale draw, leaving the radius unchanged.
Definition at line 58 of file qwt_round_scale_draw.h.
void QwtRoundScaleDraw::moveCenter | ( | const QPointF & | center | ) |
Move the center of the scale draw, leaving the radius unchanged
center | New center |
Definition at line 91 of file qwt_round_scale_draw.cpp.
double QwtRoundScaleDraw::radius | ( | ) | const |
Get the radius
Radius is the radius of the backbone without ticks and labels.
Definition at line 80 of file qwt_round_scale_draw.cpp.
void QwtRoundScaleDraw::setAngleRange | ( | double | angle1, |
double | angle2 | ||
) |
Adjust the baseline circle segment for round scales.
The baseline will be drawn from min(angle1,angle2) to max(angle1, angle2). The default setting is [ -135, 135 ]. An angle of 0 degrees corresponds to the 12 o'clock position, and positive angles count in a clockwise direction.
angle1 | |
angle2 | boundaries of the angle interval in degrees. |
Definition at line 119 of file qwt_round_scale_draw.cpp.
void QwtRoundScaleDraw::setRadius | ( | double | radius | ) |
Change of radius the scale
Radius is the radius of the backbone without ticks and labels.
radius | New Radius |
Definition at line 67 of file qwt_round_scale_draw.cpp.
|
private |
Definition at line 53 of file qwt_round_scale_draw.h.