Classes | Public Member Functions | Protected Member Functions | Private Attributes | List of all members
QwtRoundScaleDraw Class Reference

A class for drawing round scales. More...

#include <qwt_round_scale_draw.h>

Inheritance diagram for QwtRoundScaleDraw:
Inheritance graph
[legend]

Classes

class  PrivateData
 

Public Member Functions

QPointF center () const
 Get the center of the scale. More...
 
virtual double extent (const QFont &) const QWT_OVERRIDE
 
void moveCenter (const QPointF &)
 
void moveCenter (double x, double y)
 Move the center of the scale draw, leaving the radius unchanged. More...
 
 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
 
qreal penWidthF () const
 
 QwtAbstractScaleDraw ()
 Constructor. More...
 
const QwtScaleDivscaleDiv () const
 
QwtScaleMapscaleMap ()
 
const QwtScaleMapscaleMap () const
 
void setMinimumExtent (double)
 Set a minimum for the extent. More...
 
void setPenWidthF (qreal width)
 Specify the width of the scale pen. More...
 
void setScaleDiv (const QwtScaleDiv &)
 
void setSpacing (double)
 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 QWT_OVERRIDE
 
virtual void drawLabel (QPainter *, double value) const QWT_OVERRIDE
 
virtual void drawTick (QPainter *, double value, double len) const QWT_OVERRIDE
 
- Protected Member Functions inherited from QwtAbstractScaleDraw
const QwtTexttickLabel (const QFont &, double value) const
 Convert a value into its representing label and cache it. More...
 

Private Attributes

PrivateDatam_data
 

Additional Inherited Members

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

Detailed Description

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 31 of file qwt_round_scale_draw.h.

Constructor & Destructor Documentation

◆ QwtRoundScaleDraw()

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 44 of file qwt_round_scale_draw.cpp.

◆ ~QwtRoundScaleDraw()

QwtRoundScaleDraw::~QwtRoundScaleDraw ( )
virtual

Destructor.

Definition at line 53 of file qwt_round_scale_draw.cpp.

Member Function Documentation

◆ center()

QPointF QwtRoundScaleDraw::center ( ) const

Get the center of the scale.

Definition at line 96 of file qwt_round_scale_draw.cpp.

◆ drawBackbone()

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

Draws the baseline of the scale

Parameters
painterPainter
See also
drawTick(), drawLabel()

Implements QwtAbstractScaleDraw.

Definition at line 224 of file qwt_round_scale_draw.cpp.

◆ drawLabel()

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.

Definition at line 145 of file qwt_round_scale_draw.cpp.

◆ drawTick()

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

Draw a tick

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

Implements QwtAbstractScaleDraw.

Definition at line 190 of file qwt_round_scale_draw.cpp.

◆ extent()

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
Returns
Calculated extent
See also
setMinimumExtent(), minimumExtent()
Warning
The implemented algorithm is not too smart and calculates only an upper limit, that might be a few pixels too large

Implements QwtAbstractScaleDraw.

Definition at line 255 of file qwt_round_scale_draw.cpp.

◆ moveCenter() [1/2]

void QwtRoundScaleDraw::moveCenter ( const QPointF &  center)

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

Parameters
centerNew center
See also
setRadius()

Definition at line 90 of file qwt_round_scale_draw.cpp.

◆ moveCenter() [2/2]

void QwtRoundScaleDraw::moveCenter ( double  x,
double  y 
)
inline

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

Definition at line 64 of file qwt_round_scale_draw.h.

◆ radius()

double QwtRoundScaleDraw::radius ( ) const

Get the radius

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

Returns
Radius of the scale
See also
setRadius(), extent()

Definition at line 79 of file qwt_round_scale_draw.cpp.

◆ setAngleRange()

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 or equal than 360 degrees above or below min(angle1, angle2), scale marks will not be drawn.
  • If you need a counterclockwise scale, use QwtScaleDiv::setInterval()

Definition at line 118 of file qwt_round_scale_draw.cpp.

◆ setRadius()

void QwtRoundScaleDraw::setRadius ( double  radius)

Change of radius the scale

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

Parameters
radiusNew Radius
See also
moveCenter()

Definition at line 66 of file qwt_round_scale_draw.cpp.

Member Data Documentation

◆ m_data

PrivateData* QwtRoundScaleDraw::m_data
private

Definition at line 66 of file qwt_round_scale_draw.h.


The documentation for this class was generated from the following files:


plotjuggler
Author(s): Davide Faconti
autogenerated on Mon Nov 11 2024 03:23:51