9#include "qwt_polar_marker.h"
11#include "qwt_scale_map.h"
12#include "qwt_symbol.h"
17static const int LabelDist = 2;
19class QwtPolarMarker::PrivateData
23 : align( Qt::AlignCenter )
45 m_data =
new PrivateData;
72 if ( m_data->pos != pos )
91 const QPointF& pole,
double radius,
92 const QRectF& canvasRect )
const
95 Q_UNUSED( canvasRect );
100 const QPointF pos = qwtPolar2Pos( pole, r, a );
107 sSym = m_data->symbol->
size();
112 if ( !m_data->label.
isEmpty() )
114 int xlw = qMax(
int( m_data->pen.width() ), 1 );
117 int xlw1 = qMax( ( xlw + 1 ) / 2, ( sSym.width() + 1 ) / 2 ) + LabelDist;
118 xlw = qMax( xlw / 2, ( sSym.width() + 1 ) / 2 ) + LabelDist;
119 int ylw1 = qMax( ( ylw + 1 ) / 2, ( sSym.height() + 1 ) / 2 ) + LabelDist;
120 ylw = qMax( ylw / 2, ( sSym.height() + 1 ) / 2 ) + LabelDist;
122 QRect tr( QPoint( 0, 0 ), m_data->label.
textSize( painter->font() ).toSize() );
123 tr.moveCenter( QPoint( 0, 0 ) );
128 if ( m_data->align & Qt::AlignTop )
130 else if ( m_data->align & Qt::AlignBottom )
133 if ( m_data->align & Qt::AlignLeft )
135 else if ( m_data->align & Qt::AlignRight )
138 tr.translate( dx, dy );
139 m_data->label.
draw( painter, tr );
150 if ( m_data->symbol !=
symbol )
152 delete m_data->symbol;
164 return m_data->symbol;
174 if (
label != m_data->label )
176 m_data->label =
label;
187 return m_data->label;
203 if ( align == m_data->align )
206 m_data->align = align;
216 return m_data->align;
230 const double v = ( scaleId == QwtPolar::ScaleRadius )
A class representing an interval.
A point in polar coordinates.
double radius() const
Returns the radius.
double azimuth() const
Returns the azimuth.
Base class for items on a polar plot.
virtual void itemChanged()
@ Rtti_PolarMarker
For QwtPolarMarker.
void setItemAttribute(ItemAttribute, bool on=true)
void setZ(double z)
Set the z value.
virtual ~QwtPolarMarker()
Destructor.
virtual int rtti() const override
void setLabelAlignment(Qt::Alignment)
Set the alignment of the label.
void setSymbol(const QwtSymbol *s)
Assign a symbol.
void setLabel(const QwtText &)
Set the label.
virtual QwtInterval boundingInterval(int scaleId) const override
QwtPointPolar position() const
Qt::Alignment labelAlignment() const
void setPosition(const QwtPointPolar &)
Change the position of the marker.
QwtPolarMarker()
Sets alignment to Qt::AlignCenter, and style to NoLine.
virtual void draw(QPainter *painter, const QwtScaleMap &azimuthMap, const QwtScaleMap &radialMap, const QPointF &pole, double radius, const QRectF &canvasRect) const override
const QwtSymbol * symbol() const
double transform(double s) const
A class for drawing symbols.
void drawSymbol(QPainter *, const QRectF &) const
Draw the symbol into a rectangle.
@ NoSymbol
No Style. The symbol cannot be drawn.
const QSize & size() const
A class representing a text.
void draw(QPainter *painter, const QRectF &rect) const