23 static inline bool isClose(
double value1,
double value2 )
25 return qAbs( value1 - value2 ) < DBL_EPSILON;
55 , isMinorVisible( false )
100 axis.isVisible =
true;
109 axis.isVisible =
false;
118 axis.isVisible =
true;
127 axis.isVisible =
false;
136 axis.isVisible =
true;
241 if ( axisData.pen != pen )
260 if ( grid.isVisible !=
show )
262 grid.isVisible =
show;
296 if ( grid.isMinorVisible !=
show )
298 grid.isMinorVisible =
show;
330 if ( axisData.isVisible !=
show )
332 axisData.isVisible =
show;
359 bool isChanged =
false;
364 if ( grid.majorPen != pen || grid.minorPen != pen )
374 if ( axis.pen != pen )
392 bool isChanged =
false;
396 if ( axis.font != font )
414 bool isChanged =
false;
419 if ( grid.majorPen != pen )
442 if ( grid.majorPen != pen )
460 return grid.majorPen;
471 bool isChanged =
false;
476 if ( grid.minorPen != pen )
499 if ( grid.minorPen != pen )
516 return grid.minorPen;
545 if ( axisData.font != font )
547 axisData.font = font;
576 const QPointF& pole,
double radius,
577 const QRectF& canvasRect )
const
585 QRegion clipRegion( canvasRect.toRect() );
596 for (
int i = 0; i <
int( ticks.size() ); i++ )
604 const int margin = 2;
605 labelRect.adjust( -margin, -margin, margin, margin );
607 if ( labelRect.isValid() )
608 clipRegion -= QRegion( labelRect );
613 painter->setClipRegion( clipRegion );
619 if ( radialGrid.isVisible && radialGrid.isMinorVisible )
621 painter->setPen( radialGrid.minorPen );
628 if ( radialGrid.isVisible )
630 painter->setPen( radialGrid.majorPen );
638 const GridData& azimuthGrid =
641 if ( azimuthGrid.isVisible && azimuthGrid.isMinorVisible )
643 painter->setPen( azimuthGrid.minorPen );
645 drawRays( painter, canvasRect, pole, radius, azimuthMap,
647 drawRays( painter, canvasRect, pole, radius, azimuthMap,
650 if ( azimuthGrid.isVisible )
652 painter->setPen( azimuthGrid.majorPen );
654 drawRays( painter, canvasRect, pole, radius, azimuthMap,
662 if ( axis.isVisible )
682 QPainter* painter,
const QRectF& canvasRect,
683 const QPointF& pole,
double radius,
686 for (
int i = 0; i <
int( values.size() ); i++ )
688 double azimuth = azimuthMap.
transform( values[i] );
689 azimuth = ::fmod( azimuth, 2 *
M_PI );
691 bool skipLine =
false;
699 if ( axis.isVisible && axis.scaleDraw->hasComponent( bone ) )
705 if ( axis.isVisible && axis.scaleDraw->hasComponent( bone ) )
711 if ( axis.isVisible && axis.scaleDraw->hasComponent( bone ) )
717 if ( axis.isVisible && axis.scaleDraw->hasComponent( bone ) )
723 const QPointF pos =
qwtPolar2Pos( pole, radius, azimuth );
730 QPolygonF polygon( 2 );
731 polygon[0] = pole.toPoint();
732 polygon[1] = pos.toPoint();
752 QPainter* painter,
const QRectF& canvasRect,
756 for (
int i = 0; i <
int( values.size() ); i++ )
758 const double val = values[i];
760 const GridData& gridData =
763 bool skipLine =
false;
767 if ( axis.isVisible &&
770 if (
isClose( val, gridData.scaleDiv.upperBound() ) )
775 if (
isClose( val, gridData.scaleDiv.lowerBound() ) )
780 const double radius = radialMap.
transform( val );
782 QRectF outerRect( 0, 0, 2 * radius, 2 * radius );
783 outerRect.moveCenter( pole );
796 for (
int j = 0; j < angles.size(); j++ )
809 double span = to - from;
813 painter->drawArc( outerRect,
814 qRound( from * 16 ), qRound( span * 16 ) );
839 painter->setPen( axis.pen );
840 painter->setFont( axis.font );
843 pal.setColor( QPalette::WindowText, axis.pen.color() );
844 pal.setColor( QPalette::Text, axis.pen.color() );
846 axis.scaleDraw->draw( painter, pal );
861 const QPointF& pole,
double radius )
const
863 const QPoint p = pole.toPoint();
870 const int l = max - min;
881 scaleDraw->setRadius( qRound( radius ) );
884 double from = ::fmod( 90.0 -
qwtDegrees( azimuthMap.
p1() ), 360.0 );
888 scaleDraw->setAngleRange( from, from - 360.0 );
968 if ( radialGrid.scaleDiv != radialScaleDiv )
969 radialGrid.scaleDiv = radialScaleDiv;
973 if ( azimuthGrid.scaleDiv != azimuthScaleDiv )
975 azimuthGrid.scaleDiv = azimuthScaleDiv;
978 bool hasOrigin =
false;
982 if ( axis.isVisible && axis.scaleDraw )
986 axis.scaleDraw->setScaleDiv( azimuthGrid.scaleDiv );
989 axis.scaleDraw->enableComponent(
1001 bool skipOrigin = hasOrigin;
1016 if ( ticks.size() > 0 && ticks.first() == sd.
lowerBound() )
1019 ticks.removeFirst();
1027 if ( ticks.size() > 0 && ticks.last() == sd.
upperBound() )
1032 axis.scaleDraw->setScaleDiv( sd );
1036 axis.scaleDraw->enableComponent(
1052 if ( axis.isVisible )
1054 const int extent = axis.scaleDraw->extent( axis.font );
1107 delete axisData.scaleDraw;
1144 delete axisData.scaleDraw;