23 static inline bool isClose(
double value1,
double value2 )
25 return qAbs( value1 - value2 ) < DBL_EPSILON;
52 isMinorVisible( false )
237 if ( axisData.
pen != pen )
355 bool isChanged =
false;
370 if ( axis.
pen != pen )
388 bool isChanged =
false;
392 if ( axis.
font != font )
410 bool isChanged =
false;
467 bool isChanged =
false;
541 if ( axisData.
font != font )
543 axisData.
font = font;
572 const QPointF &pole,
double radius,
573 const QRectF &canvasRect )
const 581 QRegion clipRegion( canvasRect.toRect() );
592 for (
int i = 0; i < int( ticks.size() ); i++ )
600 const int margin = 2;
601 labelRect.adjust( -margin, -margin, margin, margin );
603 if ( labelRect.isValid() )
604 clipRegion -= QRegion( labelRect );
609 painter->setClipRegion( clipRegion );
617 painter->setPen( radialGrid.
minorPen );
626 painter->setPen( radialGrid.
majorPen );
637 if ( azimuthGrid.isVisible && azimuthGrid.isMinorVisible )
639 painter->setPen( azimuthGrid.minorPen );
641 drawRays( painter, canvasRect, pole, radius, azimuthMap,
643 drawRays( painter, canvasRect, pole, radius, azimuthMap,
646 if ( azimuthGrid.isVisible )
648 painter->setPen( azimuthGrid.majorPen );
650 drawRays( painter, canvasRect, pole, radius, azimuthMap,
678 QPainter *painter,
const QRectF &canvasRect,
679 const QPointF &pole,
double radius,
682 for (
int i = 0; i < int( values.size() ); i++ )
684 double azimuth = azimuthMap.
transform( values[i] );
685 azimuth = ::fmod( azimuth, 2 *
M_PI );
687 bool skipLine =
false;
719 const QPointF pos =
qwtPolar2Pos( pole, radius, azimuth );
726 QPolygonF polygon( 2 );
727 polygon[0] = pole.toPoint();
728 polygon[1] = pos.toPoint();
748 QPainter *painter,
const QRectF &canvasRect,
752 for (
int i = 0; i < int( values.size() ); i++ )
754 const double val = values[i];
759 bool skipLine =
false;
776 const double radius = radialMap.
transform( val );
778 QRectF outerRect( 0, 0, 2 * radius, 2 * radius );
779 outerRect.moveCenter( pole );
792 for (
int j = 0; j < angles.size(); j++ )
805 double span = to - from;
809 painter->drawArc( outerRect,
810 qRound( from * 16 ), qRound( span * 16 ) );
835 painter->setPen( axis.
pen );
836 painter->setFont( axis.
font );
839 pal.setColor( QPalette::WindowText, axis.
pen.color() );
840 pal.setColor( QPalette::Text, axis.
pen.color() );
857 const QPointF &pole,
double radius )
const 859 const QPoint p = pole.toPoint();
866 const int l = max -
min;
877 scaleDraw->
setRadius( qRound( radius ) );
880 double from = ::fmod( 90.0 -
qwtDegrees( azimuthMap.
p1() ), 360.0 );
901 scaleDraw->
move( p.x() -
min, p.y() );
907 scaleDraw->
move( p.x() +
min, p.y() );
913 scaleDraw->
move( p.x(), p.y() -
max );
919 scaleDraw->
move( p.x(), p.y() +
max );
964 if ( radialGrid.
scaleDiv != radialScaleDiv )
965 radialGrid.
scaleDiv = radialScaleDiv;
969 if ( azimuthGrid.
scaleDiv != azimuthScaleDiv )
971 azimuthGrid.
scaleDiv = azimuthScaleDiv;
974 bool hasOrigin =
false;
997 bool skipOrigin = hasOrigin;
1012 if ( ticks.size() > 0 && ticks.first() == sd.
lowerBound() )
1015 ticks.removeFirst();
1023 if ( ticks.size() > 0 && ticks.last() == sd.
upperBound() )
A abstract base class for drawing scales.
QwtPolarGrid::GridAttributes attributes
void drawAxis(QPainter *, int axisId) const
void showAxis(int axisId, bool show=true)
A plotting widget, displaying a polar coordinate system.
AxisData axisData[QwtPolar::AxesCount]
virtual int marginHint() const QWT_OVERRIDE
void drawCircles(QPainter *, const QRectF &, const QPointF &pole, const QwtScaleMap &radialMap, const QList< double > &) const
void setAlignment(Alignment)
void setLength(double length)
void setAzimuthScaleDraw(QwtRoundScaleDraw *)
Set a scale draw for the azimuth scale.
void drawRays(QPainter *, const QRectF &, const QPointF &pole, double radius, const QwtScaleMap &azimuthMap, const QList< double > &) const
void setPen(const QPen &p)
bool isMinorGridVisible(int scaleId) const
A class representing an interval.
void showGrid(int scaleId, bool show=true)
QPoint qwtPolar2Pos(const QPoint &pole, double radius, double angle)
virtual int rtti() const QWT_OVERRIDE
QwtAbstractScaleDraw * scaleDraw
void setTicks(int tickType, const QList< double > &)
double qwtDegrees(double degrees)
Translate radians into degrees.
QwtPolarPlot * plot() const
QFont axisFont(int axisId) const
virtual void draw(QPainter *p, const QwtScaleMap &azimuthMap, const QwtScaleMap &radialMap, const QPointF &pole, double radius, const QRectF &rect) const QWT_OVERRIDE
void setMajorGridPen(const QPen &p)
A class representing a scale division.
QPen axisPen(int axisId) const
void setAxisPen(int axisId, const QPen &p)
const QwtScaleDraw * scaleDraw(int axisId) const
double upperBound() const
QRect boundingLabelRect(const QFont &, double value) const
Find the bounding rectangle for the label.
bool isGridVisible(int scaleId) const
QwtScaleEngine * scaleEngine(int scaleId)
void moveCenter(double x, double y)
Move the center of the scale draw, leaving the radius unchanged.
Base class for items on a polar plot.
void setFont(const QFont &)
QwtPolarGrid::DisplayFlags displayFlags
void updateScaleDraws(const QwtScaleMap &azimuthMap, const QwtScaleMap &radialMap, const QPointF &pole, const double radius) const
GridData gridData[QwtPolar::ScaleCount]
bool contains(double value) const
void setGridAttribute(GridAttribute, bool on=true)
Specify an attribute for the grid.
void setAxisFont(int axisId, const QFont &p)
const QwtScaleDiv & scaleDiv() const
double lowerBound() const
void setZ(double z)
Set the z value.
static void clipPolygonF(const QRectF &, QPolygonF &, bool closePolygon=false)
void setDisplayFlag(DisplayFlag, bool on=true)
A class representing a text.
void setScaleDiv(const QwtScaleDiv &)
QwtPolarGrid()
Constructor.
Backbone = the line where the ticks are located.
const QwtTransform * transformation() const
Get the transformation.
static void drawEllipse(QPainter *, const QRectF &)
Wrapper for QPainter::drawEllipse()
void setAngleRange(double angle1, double angle2)
Adjust the baseline circle segment for round scales.
static bool isClose(double value1, double value2)
void setTickLength(QwtScaleDiv::TickType, double length)
Number of available axis.
void enableComponent(ScaleComponent, bool enable=true)
void showMinorGrid(int scaleId, bool show=true)
A class for drawing round scales.
void show()
Show the item.
static void drawPolyline(QPainter *, const QPolygonF &)
Wrapper for QPainter::drawPolyline()
virtual double extent(const QFont &font) const =0
virtual void draw(QPainter *, const QPalette &) const
Draw the scale.
int scaleMaxMajor(int scaleId) const
QFlags< GridAttribute > GridAttributes
Grid attributes.
bool testDisplayFlag(DisplayFlag) const
static QVector< QwtInterval > clipCircle(const QRectF &, const QPointF &, double radius)
QwtInterval interval() const
virtual void updateScaleDiv(const QwtScaleDiv &azimuthMap, const QwtScaleDiv &radialMap, const QwtInterval &) QWT_OVERRIDE
Update the item to changes of the axes scale division.
bool hasComponent(ScaleComponent) const
void setTransformation(QwtTransform *)
QFlags< DisplayFlag > DisplayFlags
Display flags.
bool isAxisVisible(int axisId) const
virtual ~QwtPolarGrid()
Destructor.
QPen minorGridPen(int scaleId) const
A class for drawing scales.
GridAttribute
Grid attributes.
QPen majorGridPen(int scaleId) const
void setRadius(double radius)
bool testGridAttribute(GridAttribute) const
double transform(double s) const
virtual QwtScaleDiv divideScale(double x1, double x2, int maxMajorSteps, int maxMinorSteps, double stepSize=0.0) const =0
Calculate a scale division.
void setScaleDraw(int axisId, QwtScaleDraw *)
Set a scale draw.
virtual void itemChanged()
QList< double > ticks(int tickType) const
const QwtRoundScaleDraw * azimuthScaleDraw() const
void setMinorGridPen(const QPen &p)
Base class for scale engines.
void move(double x, double y)
int scaleMaxMinor(int scaleId) const
void setRenderHint(RenderHint, bool on=true)