source: flair-src/trunk/tools/FlairGCS/src/ScopeVariableStep.cpp @ 15

Last change on this file since 15 was 15, checked in by Bayard Gildas, 5 years ago

sources reformatted with flair-format-dir script

File size: 1011 bytes
Line 
1// %flair:license{
2// This file is part of the Flair framework distributed under the
3// CECILL-C License, Version 1.0.
4// %flair:license}
5#include "ScopeVariableStep.h"
6#include "Scrollbar.h"
7#include <QTime>
8#include <qwt_plot_curve.h>
9
10ScopeVariableStep::ScopeVariableStep(QString title, float ymin, float ymax,
11                                     float view_size_s,
12                                     unsigned int refresh_rate_ms,
13                                     unsigned int history_size)
14    : Scope(title, ymin, ymax, view_size_s, refresh_rate_ms, history_size) {}
15
16ScopeVariableStep::~ScopeVariableStep() {}
17
18void ScopeVariableStep::plot(double value, QTime time,
19                             unsigned int curve_index) {
20  static QTime start_time = QTime::currentTime();
21  Curve *curve = curves.at(curve_index);
22
23  elapsed_time_s = start_time.msecsTo(time) / 1000.;
24  curve->data_x[curve->index] = elapsed_time_s;
25  curve->data_y[curve->index] = value;
26  curve->index++;
27
28  updateCurve(curve);
29}
Note: See TracBrowser for help on using the repository browser.