MCPcopy Create free account
hub / github.com/PlotJuggler/PlotJuggler / renderScale

Method renderScale

3rdparty/qwt/src/qwt_plot_renderer.cpp:733–821  ·  view source on GitHub ↗

! \brief Paint a scale into a given rectangle. Paint the scale into a given rectangle. \param plot Plot widget \param painter Painter \param axisId Axis \param startDist Start border distance \param endDist End border distance \param baseDist Base distance \param scaleRect Bounding rectangle for the scale */

Source from the content-addressed store, hash-verified

731 \param scaleRect Bounding rectangle for the scale
732 */
733void QwtPlotRenderer::renderScale( const QwtPlot* plot, QPainter* painter,
734 QwtAxisId axisId, int startDist, int endDist, int baseDist,
735 const QRectF& scaleRect ) const
736{
737 if ( !plot->isAxisVisible( axisId ) )
738 return;
739
740 const QwtScaleWidget* scaleWidget = plot->axisWidget( axisId );
741 if ( scaleWidget->isColorBarEnabled()
742 && scaleWidget->colorBarWidth() > 0 )
743 {
744 scaleWidget->drawColorBar( painter, scaleWidget->colorBarRect( scaleRect ) );
745 baseDist += scaleWidget->colorBarWidth() + scaleWidget->spacing();
746 }
747
748 painter->save();
749
750 QwtScaleDraw::Alignment align;
751 double x, y, w;
752
753 qreal off = 0.0;
754 if ( m_data->layoutFlags & FrameWithScales )
755 off = qwtScalePenWidth( plot );
756
757 switch ( axisId )
758 {
759 case QwtAxis::YLeft:
760 {
761 x = scaleRect.right() - 1.0 - baseDist - off;
762 y = scaleRect.y() + startDist;
763 w = scaleRect.height() - startDist - endDist;
764 align = QwtScaleDraw::LeftScale;
765 break;
766 }
767 case QwtAxis::YRight:
768 {
769 x = scaleRect.left() + baseDist + off;
770 y = scaleRect.y() + startDist;
771 w = scaleRect.height() - startDist - endDist;
772 align = QwtScaleDraw::RightScale;
773 break;
774 }
775 case QwtAxis::XTop:
776 {
777 x = scaleRect.left() + startDist;
778 y = scaleRect.bottom() - 1.0 - baseDist - off;
779 w = scaleRect.width() - startDist - endDist;
780 align = QwtScaleDraw::TopScale;
781 break;
782 }
783 case QwtAxis::XBottom:
784 {
785 x = scaleRect.left() + startDist;
786 y = scaleRect.top() + baseDist + off;
787 w = scaleRect.width() - startDist - endDist;
788 align = QwtScaleDraw::BottomScale;
789 break;
790 }

Callers

nothing calls this directly

Calls 15

qwtScalePenWidthFunction · 0.85
qwtResolvedFontFunction · 0.85
axisWidgetMethod · 0.80
isColorBarEnabledMethod · 0.80
colorBarWidthMethod · 0.80
colorBarRectMethod · 0.80
yMethod · 0.80
heightMethod · 0.80
drawTitleMethod · 0.80
hasComponentMethod · 0.80
enableComponentMethod · 0.80
paletteMethod · 0.80

Tested by

no test coverage detected