void LineDiagram::LineDiagramType::paintValueTracker( PaintContext* ctx, const ValueTrackerAttributes& vt, const QPointF& at ) { CartesianCoordinatePlane* plane = qobject_cast<CartesianCoordinatePlane*>( ctx->coordinatePlane() ); if( !plane ) return; DataDimensionsList gridDimensions = ctx->coordinatePlane()->gridDimensionsList(); const QPointF bottomLeft( ctx->coordinatePlane()->translate( QPointF( plane->isHorizontalRangeReversed() ? gridDimensions.at( 0 ).end : gridDimensions.at( 0 ).start, plane->isVerticalRangeReversed() ? gridDimensions.at( 1 ).end : gridDimensions.at( 1 ).start ) ) ); const QPointF markerPoint = at; const QPointF ordinatePoint( bottomLeft.x(), at.y() ); const QPointF abscissaPoint( at.x(), bottomLeft.y() ); const QSizeF markerSize = vt.markerSize(); const QRectF ellipseMarker = QRectF( at.x() - markerSize.width() / 2, at.y() - markerSize.height() / 2, markerSize.width(), markerSize.height() ); const QPointF ordinateMarker[3] = { QPointF( ordinatePoint.x(), at.y() + markerSize.height() / 2 ), QPointF( ordinatePoint.x() + markerSize.width() / 2, at.y() ), QPointF( ordinatePoint.x(), at.y() - markerSize.height() / 2 ) }; const QPointF abscissaMarker[3] = { QPointF( at.x() + markerSize.width() / 2, abscissaPoint.y() ), QPointF( at.x(), abscissaPoint.y() - markerSize.height() / 2 ), QPointF( at.x() - markerSize.width() / 2, abscissaPoint.y() ) }; QPointF topLeft = ordinatePoint; QPointF bottomRightOffset = abscissaPoint - topLeft; QSizeF size( bottomRightOffset.x(), bottomRightOffset.y() ); QRectF area( topLeft, size ); PainterSaver painterSaver( ctx->painter() ); ctx->painter()->setPen( PrintingParameters::scalePen( vt.pen() ) ); ctx->painter()->setBrush( QBrush() ); ctx->painter()->drawLine( markerPoint, ordinatePoint ); ctx->painter()->drawLine( markerPoint, abscissaPoint ); ctx->painter()->fillRect( area, vt.areaBrush() ); ctx->painter()->drawEllipse( ellipseMarker ); ctx->painter()->setBrush( vt.pen().color() ); ctx->painter()->drawPolygon( ordinateMarker, 3 ); ctx->painter()->drawPolygon( abscissaMarker, 3 ); }
bool ValueTrackerAttributes::operator==( const ValueTrackerAttributes& r ) const { return ( pen() == r.pen() && areaBrush() == r.areaBrush() && markerSize() == r.markerSize() && isEnabled() == r.isEnabled() ); }