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

QwtRoundScaleDraw Class Reference

Inheritance diagram for QwtRoundScaleDraw:

Inheritance graph
[legend]
Collaboration diagram for QwtRoundScaleDraw:

Collaboration graph
[legend]
List of all members.

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.

Definition at line 32 of file qwt_round_scale_draw.h.

Public Member Functions

 QwtRoundScaleDraw ()
 QwtRoundScaleDraw (const QwtRoundScaleDraw &)
virtual ~QwtRoundScaleDraw ()
QwtRoundScaleDrawoperator= (const QwtRoundScaleDraw &other)
void setRadius (int radius)
int radius () const
void moveCenter (int x, int y)
void moveCenter (const QPoint &)
QPoint center () const
void setAngleRange (double angle1, double angle2)
virtual int extent (const QPen &, const QFont &) const

Protected Member Functions

QPoint labelCenter (const QFont &, double arc, const QwtText &) const
QSize labelSize (const QFont &, double val) const
QRect labelRect (const QFont &, double val) const
virtual void drawTick (QPainter *p, double val, int len) const
virtual void drawBackbone (QPainter *p) const
virtual void drawLabel (QPainter *p, double val) const


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

Definition at line 46 of file qwt_round_scale_draw.cpp.

References QwtAbstractScaleDraw::scaleMap(), QwtScaleMap::setPaintInterval(), and setRadius().

QwtRoundScaleDraw::QwtRoundScaleDraw const QwtRoundScaleDraw  ) 
 

Copy constructor.

Definition at line 55 of file qwt_round_scale_draw.cpp.

References d_data.

QwtRoundScaleDraw::~QwtRoundScaleDraw  )  [virtual]
 

Destructor.

Definition at line 63 of file qwt_round_scale_draw.cpp.


Member Function Documentation

QPoint QwtRoundScaleDraw::center  )  const
 

Get the center of the scale.

Definition at line 113 of file qwt_round_scale_draw.cpp.

void QwtRoundScaleDraw::drawBackbone QPainter *  painter  )  const [protected, virtual]
 

Draws the baseline of the scale

Parameters:
painter Painter
See also:
drawTick(), drawLabel()

Implements QwtAbstractScaleDraw.

Definition at line 226 of file qwt_round_scale_draw.cpp.

References QwtAbstractScaleDraw::map(), qwtMax, qwtMin, and radius().

void QwtRoundScaleDraw::drawLabel QPainter *  painter,
double  value
const [protected, virtual]
 

Draws the label for a major scale tick

Parameters:
painter Painter
value Value
See also:
drawTick(), drawBackbone()

Implements QwtAbstractScaleDraw.

Definition at line 162 of file qwt_round_scale_draw.cpp.

References QwtText::draw(), QwtText::isEmpty(), QwtAbstractScaleDraw::label(), labelCenter(), M_PI, QwtAbstractScaleDraw::map(), QwtText::textSize(), QwtAbstractScaleDraw::tickLabel(), and QwtScaleMap::transform().

void QwtRoundScaleDraw::drawTick QPainter *  painter,
double  value,
int  len
const [protected, virtual]
 

Draw a tick

Parameters:
painter Painter
value Value of the tick
len Lenght of the tick
See also:
drawBackbone(), drawLabel()

Implements QwtAbstractScaleDraw.

Definition at line 192 of file qwt_round_scale_draw.cpp.

References QwtPainter::drawLine(), M_PI, QwtAbstractScaleDraw::map(), radius(), and QwtScaleMap::transform().

int QwtRoundScaleDraw::extent const QPen &  pen,
const QFont &  font
const [virtual]
 

Calculate the extent of the scale

The extent is the distcance 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:
pen Pen that is used for painting backbone and ticks
font Font 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.

Definition at line 254 of file qwt_round_scale_draw.cpp.

References QwtAbstractScaleDraw::Backbone, QwtScaleDiv::contains(), QwtAbstractScaleDraw::hasComponent(), labelRect(), QwtAbstractScaleDraw::majTickLength(), QwtAbstractScaleDraw::minimumExtent(), qwtMax, QwtAbstractScaleDraw::scaleDiv(), and QwtScaleDiv::ticks().

Referenced by QwtKnob::minimumSizeHint().

QPoint QwtRoundScaleDraw::labelCenter const QFont &  font,
double  arc,
const QwtText label
const [protected]
 

Find the position, where to move the center of a label

Definition at line 354 of file qwt_round_scale_draw.cpp.

References QwtAbstractScaleDraw::hasComponent(), QwtAbstractScaleDraw::majTickLength(), radius(), QwtAbstractScaleDraw::spacing(), QwtText::textSize(), and QwtText::usedFont().

Referenced by drawLabel(), and labelRect().

QRect QwtRoundScaleDraw::labelRect const QFont &  font,
double  value
const [protected]
 

Calculate the bounding rect for a tick label

Parameters:
font Font, that will be used to paint the scale draw
value Value of the tick label
See also:
labelSize(), labelCenter()

Definition at line 330 of file qwt_round_scale_draw.cpp.

References QwtText::isEmpty(), QwtAbstractScaleDraw::label(), labelCenter(), M_PI, QwtAbstractScaleDraw::map(), QwtText::textSize(), QwtAbstractScaleDraw::tickLabel(), and QwtScaleMap::transform().

Referenced by extent().

QSize QwtRoundScaleDraw::labelSize const QFont &  font,
double  value
const [protected]
 

Find the size of the label.

Parameters:
font Font
value Value

Definition at line 316 of file qwt_round_scale_draw.cpp.

References QwtText::textSize(), and QwtAbstractScaleDraw::tickLabel().

void QwtRoundScaleDraw::moveCenter const QPoint &  center  ) 
 

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

Parameters:
center New center
See also:
setRadius

Definition at line 107 of file qwt_round_scale_draw.cpp.

QwtRoundScaleDraw & QwtRoundScaleDraw::operator= const QwtRoundScaleDraw other  ) 
 

Assignment operator.

Definition at line 69 of file qwt_round_scale_draw.cpp.

References d_data.

int QwtRoundScaleDraw::radius  )  const
 

Get the radius

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

See also:
setRadius(), extent()

Definition at line 96 of file qwt_round_scale_draw.cpp.

Referenced by drawBackbone(), drawTick(), and labelCenter().

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 
angle2 boundaries 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

Definition at line 135 of file qwt_round_scale_draw.cpp.

References qwtLim(), qwtMax, qwtMin, QwtAbstractScaleDraw::scaleMap(), and QwtScaleMap::setPaintInterval().

Referenced by QwtKnob::setTotalAngle().

void QwtRoundScaleDraw::setRadius int  radius  ) 
 

Change of radius the scale

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

Parameters:
radius New Radius
See also:
moveCenter

Definition at line 84 of file qwt_round_scale_draw.cpp.

Referenced by QwtRoundScaleDraw().


Generated on Mon Jan 30 22:17:38 2006 for Qwt User's Guide by  doxygen 1.4.4