changes
This commit is contained in:
parent
8a73aa8069
commit
639f0fb55b
@ -56,10 +56,12 @@ bool Chart::myWheelEvent(QGraphicsSceneWheelEvent *event) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Chart::XRangeChanged(qreal min, qreal max) {
|
void Chart::XRangeChanged(qreal min, qreal max) {
|
||||||
if (series().at(0)->type() == QtCharts::QAbstractSeries::SeriesTypeLine) {
|
emit newDataRequest(this->entityId, min, max);
|
||||||
|
/*
|
||||||
|
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, min, max);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
@ -14,17 +14,9 @@ QVector<QPointF> * DataBuffer::getBuffer() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
double DataBuffer::rangeMinimum() const {
|
double DataBuffer::rangeMinimum() const {
|
||||||
return rangeMin;
|
return !buffer->isEmpty() ? buffer->constFirst().x() : 0.0;
|
||||||
}
|
|
||||||
|
|
||||||
void DataBuffer::rangeMinimum(double min) {
|
|
||||||
rangeMin = min;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
double DataBuffer::rangeMaximum() const {
|
double DataBuffer::rangeMaximum() const {
|
||||||
return rangeMax;
|
return !buffer->isEmpty() ? buffer->constLast().x() : 0.0;
|
||||||
}
|
|
||||||
|
|
||||||
void DataBuffer::rangeMaximum(double max) {
|
|
||||||
rangeMax = max;
|
|
||||||
}
|
}
|
||||||
|
@ -18,10 +18,8 @@ private:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
double rangeMaximum() const;
|
double rangeMaximum() const;
|
||||||
void rangeMaximum(double max);
|
|
||||||
|
|
||||||
double rangeMinimum() const;
|
double rangeMinimum() const;
|
||||||
void rangeMinimum(double min);
|
|
||||||
|
|
||||||
QVector<QPointF> * getBuffer();
|
QVector<QPointF> * getBuffer();
|
||||||
|
|
||||||
|
@ -41,6 +41,25 @@ void DataQueue::requestData(const nix::DataArray &array, const nix::NDSize &coun
|
|||||||
start();
|
start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DataQueue::requestData(const nix::DataArray &array, DataBuffer *buffer, qreal start, qreal end, std::string &requestId) {
|
||||||
|
if (end > buffer->rangeMaximum()) { // need to load new data
|
||||||
|
std::cerr << buffer->rangeMaximum() << " need to load new data! "<< std::endl;
|
||||||
|
|
||||||
|
/*DataRequest dr(requestId, array, count, offset);
|
||||||
|
mutex.lock();
|
||||||
|
std::deque<DataRequest>::iterator it;
|
||||||
|
for (it = requestQueue.begin(); it < requestQueue.end(); it++) {
|
||||||
|
std::cerr << it->array.id() << std::endl;
|
||||||
|
if (it->array.id() == array.id())
|
||||||
|
std::cerr << "updating request" <<std::endl;
|
||||||
|
}
|
||||||
|
requestQueue.push_back(dr);
|
||||||
|
mutex.unlock();
|
||||||
|
start();
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void DataQueue::stop() {
|
void DataQueue::stop() {
|
||||||
mutex.lock();
|
mutex.lock();
|
||||||
stopped = true;
|
stopped = true;
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
#include <deque>
|
#include <deque>
|
||||||
|
|
||||||
#include "dataloader.h"
|
#include "dataloader.h"
|
||||||
|
#include "databuffer.h"
|
||||||
#include "dataresult1d.h"
|
#include "dataresult1d.h"
|
||||||
#include "datarequest.h"
|
#include "datarequest.h"
|
||||||
|
|
||||||
@ -30,6 +31,7 @@ signals:
|
|||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void requestData(const nix::DataArray &array, const nix::NDSize &count, const nix::NDSize &offset, std::string &requestId);
|
void requestData(const nix::DataArray &array, const nix::NDSize &count, const nix::NDSize &offset, std::string &requestId);
|
||||||
|
void requestData(const nix::DataArray &array, DataBuffer *buffer, qreal start, qreal end, std::string &requestId);
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -26,13 +26,14 @@ 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");
|
||||||
|
@ -117,13 +117,17 @@ void MultiChartView::loadData(const ArrayInfo &info) {
|
|||||||
|
|
||||||
void MultiChartView::newDataRequest(const std::string &entity_id, qreal min, 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]->getBuffer()->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;
|
||||||
|
*/
|
||||||
|
// dataQueue->requestData(arrayMap[entity_id], count, offset, request_id);
|
||||||
|
std::string request_id;
|
||||||
|
|
||||||
|
dataQueue->requestData(arrayMap[entity_id], data_buffer[entity_id], min, max, request_id);
|
||||||
|
|
||||||
dataQueue->requestData(arrayMap[entity_id], count, offset, request_id);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user