| 99 | } |
| 100 | |
| 101 | void PlotBufferPreviewer::updateBufferPreviewer() |
| 102 | { |
| 103 | PlotAxis *xAxis = (m_plot->selectedChannel()) ? m_plot->selectedChannel()->xAxis() : m_plot->xAxis(); |
| 104 | |
| 105 | // Time interval within the plot canvas |
| 106 | double left = xAxis->visibleMin(); |
| 107 | double right = xAxis->visibleMax(); |
| 108 | QwtInterval plotInterval(std::min(left, right), std::max(left, right)); |
| 109 | |
| 110 | // Time interval that represents the captured data |
| 111 | if(!m_manualDataLimits) { |
| 112 | m_bufferDataLimitMin = xAxis->min(); |
| 113 | m_bufferDataLimitMax = xAxis->max(); |
| 114 | } |
| 115 | QwtInterval dataInterval(std::min(m_bufferDataLimitMin, m_bufferDataLimitMax), |
| 116 | std::fmax(m_bufferDataLimitMin, m_bufferDataLimitMax)); |
| 117 | |
| 118 | // Use the two intervals to determine the width and position of the |
| 119 | // waveform and of the highlighted area |
| 120 | QwtInterval fullInterval = plotInterval | dataInterval; |
| 121 | double wPos = 1 - (fullInterval.maxValue() - dataInterval.minValue()) / fullInterval.width(); |
| 122 | double wWidth = dataInterval.width() / fullInterval.width(); |
| 123 | |
| 124 | double hPos = 1 - (fullInterval.maxValue() - plotInterval.minValue()) / fullInterval.width(); |
| 125 | double hWidth = plotInterval.width() / fullInterval.width(); |
| 126 | |
| 127 | if(left > right) { |
| 128 | hPos = wWidth - hPos - hWidth; |
| 129 | } |
| 130 | |
| 131 | m_bufferPreviewer->setWaveformWidth(wWidth); |
| 132 | m_bufferPreviewer->setWaveformPos(wPos); |
| 133 | m_bufferPreviewer->setHighlightWidth(hWidth); |
| 134 | m_bufferPreviewer->setHighlightPos(hPos); |
| 135 | } |
| 136 | |
| 137 | #include "moc_plotbufferpreviewer.cpp" |
nothing calls this directly
no test coverage detected