Qwt User's Guide  6.0.2
Public Member Functions | Protected Member Functions
QwtRoundScaleDraw Class Reference

#include <qwt_round_scale_draw.h>

Inheritance diagram for QwtRoundScaleDraw:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 QwtRoundScaleDraw ()
virtual ~QwtRoundScaleDraw ()
QPointF center () const
virtual double extent (const QFont &) const
void moveCenter (double x, double y)
void moveCenter (const QPointF &)
int radius () const
void setAngleRange (double angle1, double angle2)
void setRadius (int radius)
- Public Member Functions inherited from QwtAbstractScaleDraw
 QwtAbstractScaleDraw ()
virtual ~QwtAbstractScaleDraw ()
virtual void draw (QPainter *, const QPalette &) const
void enableComponent (ScaleComponent, bool enable=true)
bool hasComponent (ScaleComponent) const
virtual QwtText label (double) const
double maxTickLength () const
double minimumExtent () const
int penWidth () const
const QwtScaleDivscaleDiv () const
const QwtScaleMapscaleMap () const
QwtScaleMapscaleMap ()
void setMinimumExtent (double)
void setPenWidth (int width)
void setScaleDiv (const QwtScaleDiv &s)
void setSpacing (double margin)
void setTickLength (QwtScaleDiv::TickType, double length)
void setTransformation (QwtScaleTransformation *)
double spacing () const
double tickLength (QwtScaleDiv::TickType) const

Protected Member Functions

virtual void drawBackbone (QPainter *p) const
virtual void drawLabel (QPainter *p, double val) const
virtual void drawTick (QPainter *p, double val, double len) const
- Protected Member Functions inherited from QwtAbstractScaleDraw
void invalidateCache ()
const QwtTexttickLabel (const QFont &, double value) const

Additional Inherited Members

- Public Types inherited from QwtAbstractScaleDraw
enum  ScaleComponent {
  Backbone = 0x01,
  Ticks = 0x02,
  Labels = 0x04
}
typedef QFlags< ScaleComponentScaleComponents

Detailed Description

A class for drawing round scales.

QwtRoundScaleDraw can be used to draw round scales. The circle segment can be adjusted by QwtRoundScaleDraw::setAngleRange(). The geometry of the scale can be specified with QwtRoundScaleDraw::moveCenter() and QwtRoundScaleDraw::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.


Constructor & Destructor Documentation

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].


Member Function Documentation

void QwtRoundScaleDraw::drawBackbone ( QPainter *  painter) const
protectedvirtual

Draws the baseline of the scale

Parameters:
painterPainter
See also:
drawTick(), drawLabel()

Implements QwtAbstractScaleDraw.

void QwtRoundScaleDraw::drawLabel ( QPainter *  painter,
double  value 
) const
protectedvirtual

Draws the label for a major scale tick

Parameters:
painterPainter
valueValue
See also:
drawTick(), drawBackbone()

Implements QwtAbstractScaleDraw.

void QwtRoundScaleDraw::drawTick ( QPainter *  painter,
double  value,
double  len 
) const
protectedvirtual

Draw a tick

Parameters:
painterPainter
valueValue of the tick
lenLenght of the tick
See also:
drawBackbone(), drawLabel()

Implements QwtAbstractScaleDraw.

double QwtRoundScaleDraw::extent ( const QFont &  font) const
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.

Parameters:
fontFont used for painting the labels
See also:
setMinimumExtent(), minimumExtent()
Warning:
The implemented algo is not too smart and calculates only an upper limit, that might be a few pixels too large

Implements QwtAbstractScaleDraw.

void QwtRoundScaleDraw::moveCenter ( const QPointF &  center)

Move the center of the scale draw, leaving the radius unchanged

Parameters:
centerNew center
See also:
setRadius()
int QwtRoundScaleDraw::radius ( ) const

Get the radius

Radius is the radius of the backbone without ticks and labels.

See also:
setRadius(), extent()
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.

Parameters:
angle1
angle2boundaries of the angle interval in degrees.
Warning:
  • The angle range is limited to [-360, 360] degrees. Angles exceeding this range will be clipped.
  • For angles more than 359 degrees above or below min(angle1, angle2), scale marks will not be drawn.
  • If you need a counterclockwise scale, use QwtScaleDiv::setRange
void QwtRoundScaleDraw::setRadius ( int  radius)

Change of radius the scale

Radius is the radius of the backbone without ticks and labels.

Parameters:
radiusNew Radius
See also:
moveCenter()