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

Method buildCanvasMaps

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

! Calculated the scale maps for rendering the canvas \param plot Plot widget \param canvasRect Target rectangle \param maps Scale maps to be calculated */

Source from the content-addressed store, hash-verified

967 \param maps Scale maps to be calculated
968 */
969void QwtPlotRenderer::buildCanvasMaps( const QwtPlot* plot,
970 const QRectF& canvasRect, QwtScaleMap maps[] ) const
971{
972 for ( int axisPos = 0; axisPos < QwtAxis::AxisPositions; axisPos++ )
973 {
974 {
975 const QwtAxisId axisId( axisPos );
976
977 QwtScaleMap& scaleMap = maps[axisId];
978
979 scaleMap.setTransformation(
980 plot->axisScaleEngine( axisId )->transformation() );
981
982 const QwtScaleDiv& scaleDiv = plot->axisScaleDiv( axisId );
983 scaleMap.setScaleInterval(
984 scaleDiv.lowerBound(), scaleDiv.upperBound() );
985
986 double from, to;
987 if ( plot->isAxisVisible( axisId ) )
988 {
989 const int sDist = plot->axisWidget( axisId )->startBorderDist();
990 const int eDist = plot->axisWidget( axisId )->endBorderDist();
991 const QRectF scaleRect = plot->plotLayout()->scaleRect( axisId );
992
993 if ( QwtAxis::isXAxis( axisPos ) )
994 {
995 from = scaleRect.left() + sDist;
996 to = scaleRect.right() - eDist;
997 }
998 else
999 {
1000 from = scaleRect.bottom() - eDist;
1001 to = scaleRect.top() + sDist;
1002 }
1003 }
1004 else
1005 {
1006 int margin = 0;
1007 if ( !plot->plotLayout()->alignCanvasToScale( axisPos ) )
1008 margin = plot->plotLayout()->canvasMargin( axisPos );
1009
1010 if ( QwtAxis::isYAxis( axisPos ) )
1011 {
1012 from = canvasRect.bottom() - margin;
1013 to = canvasRect.top() + margin;
1014 }
1015 else
1016 {
1017 from = canvasRect.left() + margin;
1018 to = canvasRect.right() - margin;
1019 }
1020 }
1021 scaleMap.setPaintInterval( from, to );
1022 }
1023 }
1024}
1025
1026bool QwtPlotRenderer::updateCanvasMargins( QwtPlot* plot,

Callers

nothing calls this directly

Calls 15

axisScaleEngineMethod · 0.80
setScaleIntervalMethod · 0.80
startBorderDistMethod · 0.80
axisWidgetMethod · 0.80
endBorderDistMethod · 0.80
alignCanvasToScaleMethod · 0.80
setPaintIntervalMethod · 0.80
setTransformationMethod · 0.45
transformationMethod · 0.45
lowerBoundMethod · 0.45
upperBoundMethod · 0.45
isAxisVisibleMethod · 0.45

Tested by

no test coverage detected