! Calculated the scale maps for rendering the canvas \param plot Plot widget \param canvasRect Target rectangle \param maps Scale maps to be calculated */
| 967 | \param maps Scale maps to be calculated |
| 968 | */ |
| 969 | void 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 | |
| 1026 | bool QwtPlotRenderer::updateCanvasMargins( QwtPlot* plot, |
nothing calls this directly
no test coverage detected