comparison src/Modules/Output/Graphics/GraphicsViewTime.cc @ 508:d609725e568a

Re-add support for plotting strobes (untested).
author tomwalters@google.com
date Fri, 22 Jun 2012 12:17:24 +0000
parents e35740ed81f3
children
comparison
equal deleted inserted replaced
507:7cc44d4e9b86 508:d609725e568a
91 snprintf(sTxt, sizeof(sTxt)/sizeof(sTxt[0]), _S("t=%.0f ms"), 91 snprintf(sTxt, sizeof(sTxt)/sizeof(sTxt[0]), _S("t=%.0f ms"),
92 1000.0 * bank.start_time() / bank.sample_rate()); 92 1000.0 * bank.start_time() / bank.sample_rate());
93 m_pDev->gText2f(0.8f, 0.0025f, sTxt, false); 93 m_pDev->gText2f(0.8f, 0.0025f, sTxt, false);
94 } 94 }
95 95
96 void GraphicsViewTime::PlotStrobes(const vector<float>& signal,
97 const vector<int>& strobes,
98 float sample_rate,
99 float y_offset,
100 float height,
101 float x_scale,
102 float diameter) {
103 x_scale *= 1000.0 / sample_rate;
104 m_pDev->gColor3f(1.0f, 0.0f, 0.0f);
105 for (vector<int>::const_iterator i = strobes.begin();
106 i != strobes.end(); ++i) {
107 float x = *i * x_scale;
108 float y = signal[*i];
109 x = m_pAxisX->m_pScale->FromLinearScaled(x) + 0.5f;
110 y = m_pAxisY->m_pScale->FromLinearScaled(y);
111
112 if (x < 0.0)
113 continue;
114
115 // Now fit it into the drawing area.
116 x = x * (1.0f - m_fMarginLeft - m_fMarginRight) + m_fMarginLeft; // fit inside x-axis area
117 PlotStrobe(x, y_offset, y, height, diameter);
118 }
119 }
120
96 void GraphicsViewTime::PlotData(const vector<float> &signal, 121 void GraphicsViewTime::PlotData(const vector<float> &signal,
97 float sample_rate, 122 float sample_rate,
98 float yOffset, 123 float yOffset,
99 float height, 124 float height,
100 float xScale) { 125 float xScale) {