Merge branch 'master' of whale.am28.uni-tuebingen.de:dataservice

This commit is contained in:
Jan Grewe 2018-09-28 11:02:37 +02:00
commit 2f0dc12363
3 changed files with 45 additions and 10 deletions

18
databuffer.cpp Normal file
View 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
View 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

View File

@ -101,13 +101,6 @@ ChartView* MultiChartView::createChartView(Chart *chart, const ArrayInfo &info)
view->setLineWidth(1);
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));
return view;
}
@ -136,8 +129,7 @@ void MultiChartView::newDataRequest(const std::string &entity_id, qreal max) {
void MultiChartView::dataReady(QString requestId){
// 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()) {
return;
}
@ -145,7 +137,6 @@ void MultiChartView::dataReady(QString requestId){
}
void MultiChartView::dataConverted(QString entityId, double ymin, double ymax) {
std::cerr << "data converted for: " << entityId.toStdString() << std::endl;
Chart *chart = chartMap[entityId.toStdString()];
QLineSeries *series;
bool newSeries = false;