remove converttoseries class
This commit is contained in:
parent
74ca366a67
commit
1eff366be2
@ -1,41 +0,0 @@
|
|||||||
#include "converttoseries.h"
|
|
||||||
using namespace QtCharts;
|
|
||||||
|
|
||||||
ConvertToSeries::ConvertToSeries(QObject *parent) : QObject(parent)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void ConvertToSeries::run() {
|
|
||||||
mutex.lock();
|
|
||||||
double min = data.ydata[0];
|
|
||||||
double max = data.ydata[0];
|
|
||||||
if (dataPresent) {
|
|
||||||
for (size_t i = 0; i < data.xdata.size(); ++i) {
|
|
||||||
this->buffer->push_back({data.xdata[i], data.ydata[i]});
|
|
||||||
if (data.ydata[i] < min)
|
|
||||||
min = data.ydata[i];
|
|
||||||
if (data.ydata[i] > max)
|
|
||||||
max = data.ydata[i];
|
|
||||||
}
|
|
||||||
emit dataConverted(QString::fromStdString(data.entityId), min, max);
|
|
||||||
}
|
|
||||||
mutex.unlock();
|
|
||||||
}
|
|
||||||
|
|
||||||
/*void ConvertToSeries::setData(QLineSeries *series, const DataResult1D &data) {
|
|
||||||
mutex.lock();
|
|
||||||
this->series = series;
|
|
||||||
this->data = data;
|
|
||||||
this->dataPresent = true;
|
|
||||||
mutex.unlock();
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
void ConvertToSeries::setData(QVector<QPointF> *buffer, const DataResult1D &data) {
|
|
||||||
mutex.lock();
|
|
||||||
this->buffer = buffer;
|
|
||||||
this->data = data;
|
|
||||||
this->dataPresent = true;
|
|
||||||
mutex.unlock();
|
|
||||||
}
|
|
@ -1,34 +0,0 @@
|
|||||||
#ifndef CONVERTTOSERIES_H
|
|
||||||
#define CONVERTTOSERIES_H
|
|
||||||
|
|
||||||
#include <QObject>
|
|
||||||
#include <QRunnable>
|
|
||||||
#include <QMutex>
|
|
||||||
#include <QLineSeries>
|
|
||||||
#include "dataresult1d.h"
|
|
||||||
|
|
||||||
using namespace QtCharts;
|
|
||||||
|
|
||||||
class ConvertToSeries : public QObject, public QRunnable {
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
explicit ConvertToSeries(QObject *parent = nullptr);
|
|
||||||
|
|
||||||
private:
|
|
||||||
QMutex mutex;
|
|
||||||
bool dataPresent = false;
|
|
||||||
DataResult1D data;
|
|
||||||
QLineSeries *series;
|
|
||||||
QVector<QPointF> *buffer;
|
|
||||||
void run() override;
|
|
||||||
|
|
||||||
public:
|
|
||||||
void setData(QLineSeries *series, const DataResult1D &data);
|
|
||||||
void setData(QVector<QPointF> *buffer, const DataResult1D &data);
|
|
||||||
|
|
||||||
signals:
|
|
||||||
void dataConverted(QString entityId, double, double);
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // CONVERTTOSERIES_H
|
|
@ -142,12 +142,6 @@ void MultiChartView::dataReady(QString requestId){
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
conversionQueue->requestConversion(data_buffer[data.entityId], data);
|
conversionQueue->requestConversion(data_buffer[data.entityId], data);
|
||||||
/*
|
|
||||||
ConvertToSeries *task = new ConvertToSeries();
|
|
||||||
task->setData(data_buffer[data.entityId], data);
|
|
||||||
connect(task, SIGNAL(dataConverted(QString, double, double)), this, SLOT(dataConverted(QString, double, double)));
|
|
||||||
QThreadPool::globalInstance()->start(task);
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MultiChartView::dataConverted(QString entityId, double ymin, double ymax) {
|
void MultiChartView::dataConverted(QString entityId, double ymin, double ymax) {
|
||||||
|
Loading…
Reference in New Issue
Block a user