fixes
This commit is contained in:
parent
2f0dc12363
commit
8a73aa8069
@ -26,24 +26,26 @@ DEFINES += QT_DEPRECATED_WARNINGS
|
|||||||
SOURCES += \
|
SOURCES += \
|
||||||
main.cpp \
|
main.cpp \
|
||||||
mainwindow.cpp \
|
mainwindow.cpp \
|
||||||
|
databuffer.cpp \
|
||||||
dataservice.cpp \
|
dataservice.cpp \
|
||||||
dataqueue.cpp \
|
dataqueue.cpp \
|
||||||
dataloader.cpp \
|
dataloader.cpp \
|
||||||
dataresult1d.cpp \
|
dataresult1d.cpp \
|
||||||
datarequest.cpp \
|
datarequest.cpp \
|
||||||
converttoseries.cpp \
|
conversionqueue.cpp \
|
||||||
chart.cpp \
|
chart.cpp \
|
||||||
chartview.cpp \
|
chartview.cpp \
|
||||||
multichartview.cpp
|
multichartview.cpp
|
||||||
|
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
mainwindow.h \
|
mainwindow.h \
|
||||||
|
databuffer.h \
|
||||||
dataservice.h \
|
dataservice.h \
|
||||||
dataqueue.h \
|
dataqueue.h \
|
||||||
dataloader.h \
|
dataloader.h \
|
||||||
dataresult1d.h \
|
dataresult1d.h \
|
||||||
datarequest.h \
|
datarequest.h \
|
||||||
converttoseries.h \
|
conversionqueue.h \
|
||||||
chart.h \
|
chart.h \
|
||||||
chartview.h \
|
chartview.h \
|
||||||
multichartview.h
|
multichartview.h
|
||||||
|
@ -59,7 +59,7 @@ void Chart::XRangeChanged(qreal min, qreal max) {
|
|||||||
if (series().at(0)->type() == QtCharts::QAbstractSeries::SeriesTypeLine) {
|
if (series().at(0)->type() == QtCharts::QAbstractSeries::SeriesTypeLine) {
|
||||||
QLineSeries *s = static_cast<QLineSeries *>(series().at(0));
|
QLineSeries *s = static_cast<QLineSeries *>(series().at(0));
|
||||||
if (max > s->at(s->count()-1).x()) {
|
if (max > s->at(s->count()-1).x()) {
|
||||||
emit newDataRequest(this->entityId, max);
|
emit newDataRequest(this->entityId, min, max);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
2
chart.h
2
chart.h
@ -27,6 +27,6 @@ public slots:
|
|||||||
void XRangeChanged(qreal min, qreal max);
|
void XRangeChanged(qreal min, qreal max);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void newDataRequest(const std::string &entityId, qreal max);
|
void newDataRequest(const std::string &entityId, qreal min, qreal max);
|
||||||
};
|
};
|
||||||
#endif // CHART_H
|
#endif // CHART_H
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
#include <deque>
|
#include <deque>
|
||||||
#include <QVector>
|
#include <QVector>
|
||||||
#include <QPointF>
|
#include <QPointF>
|
||||||
|
#include <QMutex>
|
||||||
|
|
||||||
#include "dataresult1d.h"
|
#include "dataresult1d.h"
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#include "databuffer.h"
|
#include "databuffer.h"
|
||||||
|
|
||||||
DataBuffer::DataBuffer(const nix::DataArray &array) : arrayId(array.id()), minRange(0.0), maxRange(0.0)
|
DataBuffer::DataBuffer(const nix::DataArray &array) : arrayId(array.id()), rangeMin(0.0), rangeMax(0.0)
|
||||||
{
|
{
|
||||||
buffer = new QVector<QPointF>;
|
buffer = new QVector<QPointF>;
|
||||||
}
|
}
|
||||||
@ -9,7 +9,19 @@ DataBuffer::~DataBuffer() {
|
|||||||
delete buffer;
|
delete buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
double DataBuffer::rangeMaximum() {
|
QVector<QPointF> * DataBuffer::getBuffer() {
|
||||||
|
return buffer;
|
||||||
|
}
|
||||||
|
|
||||||
|
double DataBuffer::rangeMinimum() const {
|
||||||
|
return rangeMin;
|
||||||
|
}
|
||||||
|
|
||||||
|
void DataBuffer::rangeMinimum(double min) {
|
||||||
|
rangeMin = min;
|
||||||
|
}
|
||||||
|
|
||||||
|
double DataBuffer::rangeMaximum() const {
|
||||||
return rangeMax;
|
return rangeMax;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
#define DATABUFFER_H
|
#define DATABUFFER_H
|
||||||
|
|
||||||
#include <nix.hpp>
|
#include <nix.hpp>
|
||||||
|
#include <QVector>
|
||||||
|
#include <QPointF>
|
||||||
|
|
||||||
class DataBuffer
|
class DataBuffer
|
||||||
{
|
{
|
||||||
@ -14,12 +16,14 @@ private:
|
|||||||
QVector<QPointF> *buffer;
|
QVector<QPointF> *buffer;
|
||||||
double rangeMin, rangeMax;
|
double rangeMin, rangeMax;
|
||||||
|
|
||||||
double rangeMaximum();
|
public:
|
||||||
|
double rangeMaximum() const;
|
||||||
void rangeMaximum(double max);
|
void rangeMaximum(double max);
|
||||||
|
|
||||||
double rangeMinimum();
|
double rangeMinimum() const;
|
||||||
void rangeMinimum(double min);
|
void rangeMinimum(double min);
|
||||||
|
|
||||||
|
QVector<QPointF> * getBuffer();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
#include "ui_mainwindow.h"
|
#include "ui_mainwindow.h"
|
||||||
#include "converttoseries.h"
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include "chart.h"
|
#include "chart.h"
|
||||||
#include "chartview.h"
|
#include "chartview.h"
|
||||||
@ -27,12 +26,13 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||||||
|
|
||||||
dataQueue.start();
|
dataQueue.start();
|
||||||
conversionQueue.start();
|
conversionQueue.start();
|
||||||
/*
|
|
||||||
file = nix::File::open("/home/grewe/zwischenlager/2017-08-17-af-invivo-1/2017-08-17-af-invivo-1.nix",
|
file = nix::File::open("/home/grewe/zwischenlager/2017-08-17-af-invivo-1/2017-08-17-af-invivo-1.nix",
|
||||||
nix::FileMode::ReadOnly);
|
nix::FileMode::ReadOnly);
|
||||||
*/
|
/*
|
||||||
file = nix::File::open("/Users/jan/zwischenlager/threading_test/dataservice/data/2017-08-17-af-invivo-1.nix",
|
file = nix::File::open("/Users/jan/zwischenlager/threading_test/dataservice/data/2017-08-17-af-invivo-1.nix",
|
||||||
nix::FileMode::ReadOnly);
|
nix::FileMode::ReadOnly);
|
||||||
|
*/
|
||||||
nix::Block b = file.getBlock(0);
|
nix::Block b = file.getBlock(0);
|
||||||
this->voltage = b.getDataArray("V-1");
|
this->voltage = b.getDataArray("V-1");
|
||||||
this->eod = b.getDataArray("EOD");
|
this->eod = b.getDataArray("EOD");
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
#include "multichartview.h"
|
#include "multichartview.h"
|
||||||
#include "ui_multichartview.h"
|
#include "ui_multichartview.h"
|
||||||
#include "converttoseries.h"
|
|
||||||
|
|
||||||
using namespace QtCharts;
|
using namespace QtCharts;
|
||||||
|
|
||||||
@ -29,7 +28,7 @@ MultiChartView::~MultiChartView()
|
|||||||
for (vit = viewMap.begin(); vit != viewMap.end(); vit++) {
|
for (vit = viewMap.begin(); vit != viewMap.end(); vit++) {
|
||||||
delete vit->second;
|
delete vit->second;
|
||||||
}
|
}
|
||||||
std::map<std::string, QVector<QPointF>*>::iterator ait;
|
std::map<std::string, DataBuffer*>::iterator ait;
|
||||||
for (ait = data_buffer.begin(); ait != data_buffer.end(); ait++) {
|
for (ait = data_buffer.begin(); ait != data_buffer.end(); ait++) {
|
||||||
delete ait->second;
|
delete ait->second;
|
||||||
}
|
}
|
||||||
@ -44,8 +43,9 @@ void MultiChartView::addArray(const nix::DataArray &array) {
|
|||||||
this->arrayMap.insert(std::pair<std::string, nix::DataArray>(array.id(), array));
|
this->arrayMap.insert(std::pair<std::string, nix::DataArray>(array.id(), array));
|
||||||
ArrayInfo ai(array);
|
ArrayInfo ai(array);
|
||||||
this->infoMap.insert(std::pair<std::string, ArrayInfo*>(ai.arrayid, &ai));
|
this->infoMap.insert(std::pair<std::string, ArrayInfo*>(ai.arrayid, &ai));
|
||||||
QVector<QPointF> *buffer = new QVector<QPointF>();
|
|
||||||
this->data_buffer.insert(std::pair<std::string, QVector<QPointF>*>(ai.arrayid, buffer));
|
DataBuffer *buff = new DataBuffer(array);
|
||||||
|
this->data_buffer.insert(std::pair<std::string, DataBuffer*>(ai.arrayid, buff));
|
||||||
Chart* chart = createChart(ai);
|
Chart* chart = createChart(ai);
|
||||||
ChartView *view = createChartView(chart, ai);
|
ChartView *view = createChartView(chart, ai);
|
||||||
|
|
||||||
@ -91,7 +91,7 @@ Chart* MultiChartView::createChart(const ArrayInfo &info) {
|
|||||||
chart->setAxisX(axisX);
|
chart->setAxisX(axisX);
|
||||||
|
|
||||||
connect(axisX, SIGNAL(rangeChanged(qreal,qreal)), chart, SLOT(XRangeChanged(qreal,qreal)));
|
connect(axisX, SIGNAL(rangeChanged(qreal,qreal)), chart, SLOT(XRangeChanged(qreal,qreal)));
|
||||||
connect(chart, SIGNAL(newDataRequest(std::string,qreal)), this, SLOT(newDataRequest(std::string, qreal)));
|
connect(chart, SIGNAL(newDataRequest(std::string, qreal, qreal)), this, SLOT(newDataRequest(std::string, qreal, qreal)));
|
||||||
this->chartMap.insert(std::pair<std::string, Chart*>(info.arrayid, chart));
|
this->chartMap.insert(std::pair<std::string, Chart*>(info.arrayid, chart));
|
||||||
return chart;
|
return chart;
|
||||||
}
|
}
|
||||||
@ -115,10 +115,10 @@ void MultiChartView::loadData(const ArrayInfo &info) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void MultiChartView::newDataRequest(const std::string &entity_id, qreal max) {
|
void MultiChartView::newDataRequest(const std::string &entity_id, qreal min, qreal max) {
|
||||||
std::cerr << "request new data from: "<< entity_id << " with max: "<< max << std::endl;
|
std::cerr << "request new data from: "<< entity_id << " with max: "<< max << std::endl;
|
||||||
|
|
||||||
nix::NDSize offset(1, data_buffer[entity_id]->size());
|
nix::NDSize offset(1, data_buffer[entity_id]->getBuffer()->size());
|
||||||
nix::NDSize count(1, 100000);
|
nix::NDSize count(1, 100000);
|
||||||
std::string request_id;
|
std::string request_id;
|
||||||
std::cerr << offset << count;
|
std::cerr << offset << count;
|
||||||
@ -133,7 +133,7 @@ void MultiChartView::dataReady(QString requestId){
|
|||||||
if (data.id.empty()) {
|
if (data.id.empty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
conversionQueue->requestConversion(data_buffer[data.entityId], data);
|
conversionQueue->requestConversion(data_buffer[data.entityId]->getBuffer(), data);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MultiChartView::dataConverted(QString entityId, double ymin, double ymax) {
|
void MultiChartView::dataConverted(QString entityId, double ymin, double ymax) {
|
||||||
@ -142,7 +142,7 @@ void MultiChartView::dataConverted(QString entityId, double ymin, double ymax) {
|
|||||||
bool newSeries = false;
|
bool newSeries = false;
|
||||||
if (chart->series().size() == 0) {
|
if (chart->series().size() == 0) {
|
||||||
series = new QLineSeries();
|
series = new QLineSeries();
|
||||||
series->replace(*data_buffer[entityId.toStdString()]);
|
series->replace(*data_buffer[entityId.toStdString()]->getBuffer());
|
||||||
series->setUseOpenGL(true);
|
series->setUseOpenGL(true);
|
||||||
chart->addSeries(series);
|
chart->addSeries(series);
|
||||||
QPen pen = series->pen();
|
QPen pen = series->pen();
|
||||||
@ -151,7 +151,7 @@ void MultiChartView::dataConverted(QString entityId, double ymin, double ymax) {
|
|||||||
newSeries = true;
|
newSeries = true;
|
||||||
} else {
|
} else {
|
||||||
series = static_cast<QLineSeries*>(chart->series().at(0));
|
series = static_cast<QLineSeries*>(chart->series().at(0));
|
||||||
series->replace(*data_buffer[entityId.toStdString()]);
|
series->replace(*data_buffer[entityId.toStdString()]->getBuffer());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (chart->axisX()->type() == QAbstractAxis::AxisTypeValue) {
|
if (chart->axisX()->type() == QAbstractAxis::AxisTypeValue) {
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
#include <nix.hpp>
|
#include <nix.hpp>
|
||||||
|
|
||||||
#include "dataqueue.h"
|
#include "dataqueue.h"
|
||||||
|
#include "databuffer.h"
|
||||||
#include "conversionqueue.h"
|
#include "conversionqueue.h"
|
||||||
#include "chart.h"
|
#include "chart.h"
|
||||||
#include "chartview.h"
|
#include "chartview.h"
|
||||||
@ -115,7 +116,7 @@ private:
|
|||||||
std::map<std::string, Chart*> chartMap;
|
std::map<std::string, Chart*> chartMap;
|
||||||
std::map<std::string, ChartView*> viewMap;
|
std::map<std::string, ChartView*> viewMap;
|
||||||
std::map<std::string, ArrayInfo*> infoMap;
|
std::map<std::string, ArrayInfo*> infoMap;
|
||||||
std::map<std::string, QVector<QPointF>*> data_buffer;
|
std::map<std::string, DataBuffer*> data_buffer;
|
||||||
QFont labelFont, tickLabelFont;
|
QFont labelFont, tickLabelFont;
|
||||||
|
|
||||||
Chart* createChart(const ArrayInfo &info);
|
Chart* createChart(const ArrayInfo &info);
|
||||||
@ -124,7 +125,7 @@ private:
|
|||||||
public slots:
|
public slots:
|
||||||
void dataReady(QString requestId);
|
void dataReady(QString requestId);
|
||||||
void dataConverted(QString entityId, double ymin, double ymax);
|
void dataConverted(QString entityId, double ymin, double ymax);
|
||||||
void newDataRequest(const std::string &entity_id, qreal max);
|
void newDataRequest(const std::string &entity_id, qreal min, qreal max);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // MULTICHARTVIEW_H
|
#endif // MULTICHARTVIEW_H
|
||||||
|
Loading…
Reference in New Issue
Block a user