MCPcopy Create free account
hub / github.com/analogdevicesinc/scopy / updateBufferPreviewer

Method updateBufferPreviewer

gui/src/widgets/plotbufferpreviewer.cpp:101–135  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

99}
100
101void 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"

Callers

nothing calls this directly

Calls 12

visibleMinMethod · 0.80
visibleMaxMethod · 0.80
setWaveformWidthMethod · 0.80
setWaveformPosMethod · 0.80
setHighlightWidthMethod · 0.80
setHighlightPosMethod · 0.80
selectedChannelMethod · 0.45
xAxisMethod · 0.45
minMethod · 0.45
maxMethod · 0.45
maxValueMethod · 0.45
minValueMethod · 0.45

Tested by

no test coverage detected