sketch of a DataBuffer class
This commit is contained in:
parent
1eff366be2
commit
1f5dab1b6b
18
databuffer.cpp
Normal file
18
databuffer.cpp
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
#include "databuffer.h"
|
||||||
|
|
||||||
|
DataBuffer::DataBuffer(const nix::DataArray &array) : arrayId(array.id()), minRange(0.0), maxRange(0.0)
|
||||||
|
{
|
||||||
|
buffer = new QVector<QPointF>;
|
||||||
|
}
|
||||||
|
|
||||||
|
DataBuffer::~DataBuffer() {
|
||||||
|
delete buffer;
|
||||||
|
}
|
||||||
|
|
||||||
|
double DataBuffer::rangeMaximum() {
|
||||||
|
return rangeMax;
|
||||||
|
}
|
||||||
|
|
||||||
|
void DataBuffer::rangeMaximum(double max) {
|
||||||
|
rangeMax = max;
|
||||||
|
}
|
26
databuffer.h
Normal file
26
databuffer.h
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
#ifndef DATABUFFER_H
|
||||||
|
#define DATABUFFER_H
|
||||||
|
|
||||||
|
#include <nix.hpp>
|
||||||
|
|
||||||
|
class DataBuffer
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
DataBuffer(const nix::DataArray &array);
|
||||||
|
~DataBuffer();
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::string arrayId;
|
||||||
|
QVector<QPointF> *buffer;
|
||||||
|
double rangeMin, rangeMax;
|
||||||
|
|
||||||
|
double rangeMaximum();
|
||||||
|
void rangeMaximum(double max);
|
||||||
|
|
||||||
|
double rangeMinimum();
|
||||||
|
void rangeMinimum(double min);
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // DATABUFFER_H
|
@ -101,13 +101,6 @@ ChartView* MultiChartView::createChartView(Chart *chart, const ArrayInfo &info)
|
|||||||
view->setLineWidth(1);
|
view->setLineWidth(1);
|
||||||
view->setRenderHint(QPainter::Antialiasing);
|
view->setRenderHint(QPainter::Antialiasing);
|
||||||
|
|
||||||
/*
|
|
||||||
QMargins margins = voltageChart->margins();
|
|
||||||
int marg1 = margins.left();
|
|
||||||
margins.setLeft(marg1 * 4);
|
|
||||||
eodChart->setMargins(margins);
|
|
||||||
*/
|
|
||||||
|
|
||||||
this->viewMap.insert(std::pair<std::string, ChartView*>(info.arrayid, view));
|
this->viewMap.insert(std::pair<std::string, ChartView*>(info.arrayid, view));
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
@ -136,8 +129,7 @@ void MultiChartView::newDataRequest(const std::string &entity_id, qreal max) {
|
|||||||
|
|
||||||
void MultiChartView::dataReady(QString requestId){
|
void MultiChartView::dataReady(QString requestId){
|
||||||
// need to make sure, that only one task does the conversion on the same buffer at the same time.
|
// need to make sure, that only one task does the conversion on the same buffer at the same time.
|
||||||
std::cerr << "converting data for array: " << requestId.toStdString() << std::endl;
|
DataResult1D data = dataQueue->getData(requestId);
|
||||||
DataResult1D data = dataQueue->getData(requestId);
|
|
||||||
if (data.id.empty()) {
|
if (data.id.empty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -145,7 +137,6 @@ void MultiChartView::dataReady(QString requestId){
|
|||||||
}
|
}
|
||||||
|
|
||||||
void MultiChartView::dataConverted(QString entityId, double ymin, double ymax) {
|
void MultiChartView::dataConverted(QString entityId, double ymin, double ymax) {
|
||||||
std::cerr << "data converted for: " << entityId.toStdString() << std::endl;
|
|
||||||
Chart *chart = chartMap[entityId.toStdString()];
|
Chart *chart = chartMap[entityId.toStdString()];
|
||||||
QLineSeries *series;
|
QLineSeries *series;
|
||||||
bool newSeries = false;
|
bool newSeries = false;
|
||||||
|
Loading…
Reference in New Issue
Block a user