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) {
|
||||
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));
|
||||
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 {
|
||||
return rangeMin;
|
||||
}
|
||||
|
||||
void DataBuffer::rangeMinimum(double min) {
|
||||
rangeMin = min;
|
||||
return !buffer->isEmpty() ? buffer->constFirst().x() : 0.0;
|
||||
}
|
||||
|
||||
double DataBuffer::rangeMaximum() const {
|
||||
return rangeMax;
|
||||
}
|
||||
|
||||
void DataBuffer::rangeMaximum(double max) {
|
||||
rangeMax = max;
|
||||
return !buffer->isEmpty() ? buffer->constLast().x() : 0.0;
|
||||
}
|
||||
|
@ -18,10 +18,8 @@ private:
|
||||
|
||||
public:
|
||||
double rangeMaximum() const;
|
||||
void rangeMaximum(double max);
|
||||
|
||||
double rangeMinimum() const;
|
||||
void rangeMinimum(double min);
|
||||
|
||||
QVector<QPointF> * getBuffer();
|
||||
|
||||
|
@ -41,6 +41,25 @@ void DataQueue::requestData(const nix::DataArray &array, const nix::NDSize &coun
|
||||
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() {
|
||||
mutex.lock();
|
||||
stopped = true;
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include <deque>
|
||||
|
||||
#include "dataloader.h"
|
||||
#include "databuffer.h"
|
||||
#include "dataresult1d.h"
|
||||
#include "datarequest.h"
|
||||
|
||||
@ -30,6 +31,7 @@ signals:
|
||||
|
||||
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, DataBuffer *buffer, qreal start, qreal end, std::string &requestId);
|
||||
|
||||
|
||||
private:
|
||||
|
@ -26,13 +26,14 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||
|
||||
dataQueue.start();
|
||||
conversionQueue.start();
|
||||
|
||||
/*
|
||||
file = nix::File::open("/home/grewe/zwischenlager/2017-08-17-af-invivo-1/2017-08-17-af-invivo-1.nix",
|
||||
nix::FileMode::ReadOnly);
|
||||
/*
|
||||
*/
|
||||
|
||||
file = nix::File::open("/Users/jan/zwischenlager/threading_test/dataservice/data/2017-08-17-af-invivo-1.nix",
|
||||
nix::FileMode::ReadOnly);
|
||||
*/
|
||||
|
||||
nix::Block b = file.getBlock(0);
|
||||
this->voltage = b.getDataArray("V-1");
|
||||
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) {
|
||||
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 count(1, 100000);
|
||||
std::string request_id;
|
||||
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