##// END OF EJS Templates
Merge pull request 223 from SCIQLOP-Initialisation develop...
leroux -
r549:d2d58fbc7625 merge
parent child
Show More
@@ -142,7 +142,7 void VariableAcquisitionWorker::onVariableDataAcquired(QUuid acqIdentifier,
142
142
143 if (it != impl->m_VIdentifierToCurrrentAcqIdNextIdPairMap.cend()) {
143 if (it != impl->m_VIdentifierToCurrrentAcqIdNextIdPairMap.cend()) {
144 if (it->second.second.isNull()) {
144 if (it->second.second.isNull()) {
145 // There is no next request, we can remove the varibale request
145 // There is no next request, we can remove the variable request
146 impl->removeVariableRequest(acqRequest.m_vIdentifier);
146 impl->removeVariableRequest(acqRequest.m_vIdentifier);
147 }
147 }
148 else {
148 else {
@@ -23,36 +23,36 Q_LOGGING_CATEGORY(LOG_VariableController, "VariableController")
23
23
24 namespace {
24 namespace {
25
25
26 SqpRange computeSynchroRangeRequested(const SqpRange &varRange, const SqpRange &grapheRange,
26 SqpRange computeSynchroRangeRequested(const SqpRange &varRange, const SqpRange &graphRange,
27 const SqpRange &oldGraphRange)
27 const SqpRange &oldGraphRange)
28 {
28 {
29 auto zoomType = VariableController::getZoomType(grapheRange, oldGraphRange);
29 auto zoomType = VariableController::getZoomType(graphRange, oldGraphRange);
30
30
31 auto varRangeRequested = varRange;
31 auto varRangeRequested = varRange;
32 switch (zoomType) {
32 switch (zoomType) {
33 case AcquisitionZoomType::ZoomIn: {
33 case AcquisitionZoomType::ZoomIn: {
34 auto deltaLeft = grapheRange.m_TStart - oldGraphRange.m_TStart;
34 auto deltaLeft = graphRange.m_TStart - oldGraphRange.m_TStart;
35 auto deltaRight = oldGraphRange.m_TEnd - grapheRange.m_TEnd;
35 auto deltaRight = oldGraphRange.m_TEnd - graphRange.m_TEnd;
36 varRangeRequested.m_TStart += deltaLeft;
36 varRangeRequested.m_TStart += deltaLeft;
37 varRangeRequested.m_TEnd -= deltaRight;
37 varRangeRequested.m_TEnd -= deltaRight;
38 break;
38 break;
39 }
39 }
40
40
41 case AcquisitionZoomType::ZoomOut: {
41 case AcquisitionZoomType::ZoomOut: {
42 auto deltaLeft = oldGraphRange.m_TStart - grapheRange.m_TStart;
42 auto deltaLeft = oldGraphRange.m_TStart - graphRange.m_TStart;
43 auto deltaRight = grapheRange.m_TEnd - oldGraphRange.m_TEnd;
43 auto deltaRight = graphRange.m_TEnd - oldGraphRange.m_TEnd;
44 varRangeRequested.m_TStart -= deltaLeft;
44 varRangeRequested.m_TStart -= deltaLeft;
45 varRangeRequested.m_TEnd += deltaRight;
45 varRangeRequested.m_TEnd += deltaRight;
46 break;
46 break;
47 }
47 }
48 case AcquisitionZoomType::PanRight: {
48 case AcquisitionZoomType::PanRight: {
49 auto deltaRight = grapheRange.m_TEnd - oldGraphRange.m_TEnd;
49 auto deltaRight = graphRange.m_TEnd - oldGraphRange.m_TEnd;
50 varRangeRequested.m_TStart += deltaRight;
50 varRangeRequested.m_TStart += deltaRight;
51 varRangeRequested.m_TEnd += deltaRight;
51 varRangeRequested.m_TEnd += deltaRight;
52 break;
52 break;
53 }
53 }
54 case AcquisitionZoomType::PanLeft: {
54 case AcquisitionZoomType::PanLeft: {
55 auto deltaLeft = oldGraphRange.m_TStart - grapheRange.m_TStart;
55 auto deltaLeft = oldGraphRange.m_TStart - graphRange.m_TStart;
56 varRangeRequested.m_TStart -= deltaLeft;
56 varRangeRequested.m_TStart -= deltaLeft;
57 varRangeRequested.m_TEnd -= deltaLeft;
57 varRangeRequested.m_TEnd -= deltaLeft;
58 break;
58 break;
@@ -263,8 +263,7 void VariableController::onDataProvided(QUuid vIdentifier, const SqpRange &range
263 const SqpRange &cacheRangeRequested,
263 const SqpRange &cacheRangeRequested,
264 QVector<AcquisitionDataPacket> dataAcquired)
264 QVector<AcquisitionDataPacket> dataAcquired)
265 {
265 {
266 auto var = impl->findVariable(vIdentifier);
266 if (auto var = impl->findVariable(vIdentifier)) {
267 if (var != nullptr) {
268 var->setRange(rangeRequested);
267 var->setRange(rangeRequested);
269 var->setCacheRange(cacheRangeRequested);
268 var->setCacheRange(cacheRangeRequested);
270 qCDebug(LOG_VariableController()) << tr("1: onDataProvided") << rangeRequested;
269 qCDebug(LOG_VariableController()) << tr("1: onDataProvided") << rangeRequested;
@@ -284,8 +283,7 void VariableController::onDataProvided(QUuid vIdentifier, const SqpRange &range
284
283
285 void VariableController::onVariableRetrieveDataInProgress(QUuid identifier, double progress)
284 void VariableController::onVariableRetrieveDataInProgress(QUuid identifier, double progress)
286 {
285 {
287 auto var = impl->findVariable(identifier);
286 if (auto var = impl->findVariable(identifier)) {
288 if (var != nullptr) {
289 impl->m_VariableModel->setDataProgress(var, progress);
287 impl->m_VariableModel->setDataProgress(var, progress);
290 }
288 }
291 else {
289 else {
@@ -331,14 +329,14 void VariableController::onAddSynchronized(std::shared_ptr<Variable> variable,
331 {
329 {
332 qCDebug(LOG_VariableController()) << "TORM: VariableController::onAddSynchronized"
330 qCDebug(LOG_VariableController()) << "TORM: VariableController::onAddSynchronized"
333 << synchronizationGroupId;
331 << synchronizationGroupId;
334 auto vToVIdit = impl->m_VariableToIdentifierMap.find(variable);
332 auto varToVarIdIt = impl->m_VariableToIdentifierMap.find(variable);
335 if (vToVIdit != impl->m_VariableToIdentifierMap.cend()) {
333 if (varToVarIdIt != impl->m_VariableToIdentifierMap.cend()) {
336 auto itSynchroGroup
334 auto groupIdToVSGIt
337 = impl->m_GroupIdToVariableSynchronizationGroupMap.find(synchronizationGroupId);
335 = impl->m_GroupIdToVariableSynchronizationGroupMap.find(synchronizationGroupId);
338 if (itSynchroGroup != impl->m_GroupIdToVariableSynchronizationGroupMap.cend()) {
336 if (groupIdToVSGIt != impl->m_GroupIdToVariableSynchronizationGroupMap.cend()) {
339 impl->m_VariableIdGroupIdMap.insert(
337 impl->m_VariableIdGroupIdMap.insert(
340 std::make_pair(vToVIdit->second, synchronizationGroupId));
338 std::make_pair(varToVarIdIt->second, synchronizationGroupId));
341 itSynchroGroup->second->addVariableId(vToVIdit->second);
339 groupIdToVSGIt->second->addVariableId(varToVarIdIt->second);
342 }
340 }
343 else {
341 else {
344 qCCritical(LOG_VariableController())
342 qCCritical(LOG_VariableController())
@@ -359,13 +357,13 void VariableController::onRequestDataLoading(QVector<std::shared_ptr<Variable>
359 {
357 {
360 // NOTE: oldRange isn't really necessary since oldRange == variable->range().
358 // NOTE: oldRange isn't really necessary since oldRange == variable->range().
361
359
362 qCInfo(LOG_VariableController()) << "VariableController::onRequestDataLoading"
360 qCDebug(LOG_VariableController()) << "VariableController::onRequestDataLoading"
363 << QThread::currentThread()->objectName();
361 << QThread::currentThread()->objectName();
364 // we want to load data of the variable for the dateTime.
362 // we want to load data of the variable for the dateTime.
365 // First we check if the cache contains some of them.
363 // First we check if the cache contains some of them.
366 // For the other, we ask the provider to give them.
364 // For the other, we ask the provider to give them.
367
365
368 foreach (auto var, variables) {
366 for (const auto &var : variables) {
369 qCDebug(LOG_VariableController()) << "processRequest for" << var->name();
367 qCDebug(LOG_VariableController()) << "processRequest for" << var->name();
370 impl->processRequest(var, range);
368 impl->processRequest(var, range);
371 }
369 }
@@ -373,9 +371,9 void VariableController::onRequestDataLoading(QVector<std::shared_ptr<Variable>
373 if (synchronise) {
371 if (synchronise) {
374 // Get the group ids
372 // Get the group ids
375 qCDebug(LOG_VariableController())
373 qCDebug(LOG_VariableController())
376 << "VariableController::onRequestDataLoading for synchro var ENABLE";
374 << "TORM VariableController::onRequestDataLoading for synchro var ENABLE";
377 auto groupIds = std::set<QUuid>();
375 auto groupIds = std::set<QUuid>();
378 foreach (auto var, variables) {
376 for (const auto &var : variables) {
379 auto varToVarIdIt = impl->m_VariableToIdentifierMap.find(var);
377 auto varToVarIdIt = impl->m_VariableToIdentifierMap.find(var);
380 if (varToVarIdIt != impl->m_VariableToIdentifierMap.cend()) {
378 if (varToVarIdIt != impl->m_VariableToIdentifierMap.cend()) {
381 auto vId = varToVarIdIt->second;
379 auto vId = varToVarIdIt->second;
@@ -391,7 +389,7 void VariableController::onRequestDataLoading(QVector<std::shared_ptr<Variable>
391 }
389 }
392
390
393 // We assume here all group ids exist
391 // We assume here all group ids exist
394 foreach (auto gId, groupIds) {
392 for (const auto &gId : groupIds) {
395 auto vSynchronizationGroup = impl->m_GroupIdToVariableSynchronizationGroupMap.at(gId);
393 auto vSynchronizationGroup = impl->m_GroupIdToVariableSynchronizationGroupMap.at(gId);
396 auto vSyncIds = vSynchronizationGroup->getIds();
394 auto vSyncIds = vSynchronizationGroup->getIds();
397 qCDebug(LOG_VariableController()) << "Var in synchro group ";
395 qCDebug(LOG_VariableController()) << "Var in synchro group ";
@@ -30,6 +30,8 struct VisualizationGraphHelper {
30 */
30 */
31 static QVector<QCPAbstractPlottable *> create(std::shared_ptr<Variable> variable,
31 static QVector<QCPAbstractPlottable *> create(std::shared_ptr<Variable> variable,
32 QCustomPlot &plot) noexcept;
32 QCustomPlot &plot) noexcept;
33 static QVector<QCPAbstractPlottable *> createV2(std::shared_ptr<Variable> variable,
34 QCustomPlot &plot) noexcept;
33
35
34 static void updateData(QVector<QCPAbstractPlottable *> plotableVect,
36 static void updateData(QVector<QCPAbstractPlottable *> plotableVect,
35 std::shared_ptr<IDataSeries> dataSeries, const SqpRange &dateTime);
37 std::shared_ptr<IDataSeries> dataSeries, const SqpRange &dateTime);
@@ -30,12 +30,13 public:
30 /// If acquisition isn't enable, requestDataLoading signal cannot be emit
30 /// If acquisition isn't enable, requestDataLoading signal cannot be emit
31 void enableAcquisition(bool enable);
31 void enableAcquisition(bool enable);
32
32
33 void addVariable(std::shared_ptr<Variable> variable);
33 void addVariable(std::shared_ptr<Variable> variable, SqpRange range);
34 void addVariableUsingGraph(std::shared_ptr<Variable> variable);
34
35 /// Removes a variable from the graph
35 /// Removes a variable from the graph
36 void removeVariable(std::shared_ptr<Variable> variable) noexcept;
36 void removeVariable(std::shared_ptr<Variable> variable) noexcept;
37
37
38 void setRange(std::shared_ptr<Variable> variable, const SqpRange &range);
38 void setRange(std::shared_ptr<Variable> variable, const SqpRange &range);
39 void setYRange(const SqpRange &range);
39 SqpRange graphRange() const noexcept;
40 SqpRange graphRange() const noexcept;
40 void setGraphRange(const SqpRange &range);
41 void setGraphRange(const SqpRange &range);
41
42
@@ -79,6 +79,29 void updateScalarData(QCPAbstractPlottable *component, std::shared_ptr<ScalarSer
79 }
79 }
80 }
80 }
81
81
82 QCPAbstractPlottable *createScalarSeriesComponentV2(std::shared_ptr<ScalarSeries> scalarSeries,
83 QCustomPlot &plot)
84 {
85 auto component = plot.addGraph();
86
87 if (component) {
88 // Axes properties
89 /// @todo : for the moment, no control is performed on the axes: the units and the tickers
90 /// are fixed for the default x-axis and y-axis of the plot, and according to the new graph
91
92 auto setAxisProperties = [](auto axis, const auto &unit) {
93 // label (unit name)
94 axis->setLabel(unit.m_Name);
95
96 // ticker (depending on the type of unit)
97 axis->setTicker(axisTicker(unit.m_TimeUnit));
98 };
99 setAxisProperties(plot.xAxis, scalarSeries->xAxisUnit());
100 setAxisProperties(plot.yAxis, scalarSeries->valuesUnit());
101 }
102 return component;
103 }
104
82 QCPAbstractPlottable *createScalarSeriesComponent(std::shared_ptr<ScalarSeries> scalarSeries,
105 QCPAbstractPlottable *createScalarSeriesComponent(std::shared_ptr<ScalarSeries> scalarSeries,
83 QCustomPlot &plot, const SqpRange &dateTime)
106 QCustomPlot &plot, const SqpRange &dateTime)
84 {
107 {
@@ -119,6 +142,30 QCPAbstractPlottable *createScalarSeriesComponent(std::shared_ptr<ScalarSeries>
119
142
120 } // namespace
143 } // namespace
121
144
145 QVector<QCPAbstractPlottable *>
146 VisualizationGraphHelper::createV2(std::shared_ptr<Variable> variable, QCustomPlot &plot) noexcept
147 {
148 auto result = QVector<QCPAbstractPlottable *>{};
149
150 if (variable) {
151 // Gets the data series of the variable to call the creation of the right components
152 // according to its type
153 if (auto scalarSeries = std::dynamic_pointer_cast<ScalarSeries>(variable->dataSeries())) {
154 result.append(createScalarSeriesComponentV2(scalarSeries, plot));
155 }
156 else {
157 qCDebug(LOG_VisualizationGraphHelper())
158 << QObject::tr("Can't create graph plottables : unmanaged data series type");
159 }
160 }
161 else {
162 qCDebug(LOG_VisualizationGraphHelper())
163 << QObject::tr("Can't create graph plottables : the variable is null");
164 }
165
166 return result;
167 }
168
122 QVector<QCPAbstractPlottable *> VisualizationGraphHelper::create(std::shared_ptr<Variable> variable,
169 QVector<QCPAbstractPlottable *> VisualizationGraphHelper::create(std::shared_ptr<Variable> variable,
123 QCustomPlot &plot) noexcept
170 QCustomPlot &plot) noexcept
124 {
171 {
@@ -93,13 +93,10 void VisualizationGraphWidget::enableAcquisition(bool enable)
93 impl->m_DoAcquisition = enable;
93 impl->m_DoAcquisition = enable;
94 }
94 }
95
95
96 void VisualizationGraphWidget::addVariable(std::shared_ptr<Variable> variable)
96 void VisualizationGraphWidget::addVariable(std::shared_ptr<Variable> variable, SqpRange range)
97 {
97 {
98 auto calibrationState = impl->m_IsCalibration;
99 impl->m_IsCalibration = true;
100 // Uses delegate to create the qcpplot components according to the variable
98 // Uses delegate to create the qcpplot components according to the variable
101 auto createdPlottables = VisualizationGraphHelper::create(variable, *ui->widget);
99 auto createdPlottables = VisualizationGraphHelper::createV2(variable, *ui->widget);
102 impl->m_IsCalibration = calibrationState;
103
100
104 for (auto createdPlottable : qAsConst(createdPlottables)) {
101 for (auto createdPlottable : qAsConst(createdPlottables)) {
105 impl->m_VariableToPlotMultiMap.insert({variable, createdPlottable});
102 impl->m_VariableToPlotMultiMap.insert({variable, createdPlottable});
@@ -107,18 +104,16 void VisualizationGraphWidget::addVariable(std::shared_ptr<Variable> variable)
107
104
108 connect(variable.get(), SIGNAL(updated()), this, SLOT(onDataCacheVariableUpdated()));
105 connect(variable.get(), SIGNAL(updated()), this, SLOT(onDataCacheVariableUpdated()));
109
106
110 emit variableAdded(variable);
107 auto varRange = variable->range();
111 }
112 void VisualizationGraphWidget::addVariableUsingGraph(std::shared_ptr<Variable> variable)
113 {
114 // Uses delegate to create the qcpplot components according to the variable
115 this->addVariable(variable);
116
108
117 // Request range for the variable
109 this->enableAcquisition(false);
118 auto graphRange = ui->widget->xAxis->range();
110 this->setGraphRange(range);
111 this->enableAcquisition(true);
112
113 emit requestDataLoading(QVector<std::shared_ptr<Variable> >() << variable, range, varRange,
114 false);
119
115
120 emit requestDataLoading(QVector<std::shared_ptr<Variable> >() << variable,
116 emit variableAdded(variable);
121 SqpRange{graphRange.lower, graphRange.upper}, variable->range(), false);
122 }
117 }
123
118
124 void VisualizationGraphWidget::removeVariable(std::shared_ptr<Variable> variable) noexcept
119 void VisualizationGraphWidget::removeVariable(std::shared_ptr<Variable> variable) noexcept
@@ -147,10 +142,15 void VisualizationGraphWidget::setRange(std::shared_ptr<Variable> variable, cons
147 ui->widget->replot();
142 ui->widget->replot();
148 }
143 }
149
144
145 void VisualizationGraphWidget::setYRange(const SqpRange &range)
146 {
147 ui->widget->yAxis->setRange(range.m_TStart, range.m_TEnd);
148 }
149
150 SqpRange VisualizationGraphWidget::graphRange() const noexcept
150 SqpRange VisualizationGraphWidget::graphRange() const noexcept
151 {
151 {
152 auto grapheRange = ui->widget->xAxis->range();
152 auto graphRange = ui->widget->xAxis->range();
153 return SqpRange{grapheRange.lower, grapheRange.upper};
153 return SqpRange{graphRange.lower, graphRange.upper};
154 }
154 }
155
155
156 void VisualizationGraphWidget::setGraphRange(const SqpRange &range)
156 void VisualizationGraphWidget::setGraphRange(const SqpRange &range)
@@ -288,8 +288,8 void VisualizationGraphWidget::onDataCacheVariableUpdated()
288 // - use an ordered_multimap and the algos of std to group the values by key
288 // - use an ordered_multimap and the algos of std to group the values by key
289 // - use a map (unique keys) and store as values directly the list of components
289 // - use a map (unique keys) and store as values directly the list of components
290
290
291 auto grapheRange = ui->widget->xAxis->range();
291 auto graphRange = ui->widget->xAxis->range();
292 auto dateTime = SqpRange{grapheRange.lower, grapheRange.upper};
292 auto dateTime = SqpRange{graphRange.lower, graphRange.upper};
293
293
294 for (auto it = impl->m_VariableToPlotMultiMap.cbegin();
294 for (auto it = impl->m_VariableToPlotMultiMap.cbegin();
295 it != impl->m_VariableToPlotMultiMap.cend(); ++it) {
295 it != impl->m_VariableToPlotMultiMap.cend(); ++it) {
@@ -6,6 +6,7
6 #include "ui_VisualizationZoneWidget.h"
6 #include "ui_VisualizationZoneWidget.h"
7
7
8 #include <Data/SqpRange.h>
8 #include <Data/SqpRange.h>
9 #include <Variable/Variable.h>
9 #include <Variable/VariableController.h>
10 #include <Variable/VariableController.h>
10
11
11 #include <QUuid>
12 #include <QUuid>
@@ -81,10 +82,10 VisualizationGraphWidget *VisualizationZoneWidget::createGraph(std::shared_ptr<V
81
82
82
83
83 // Lambda to synchronize zone widget
84 // Lambda to synchronize zone widget
84 auto synchronizeZoneWidget = [this, graphWidget](const SqpRange &grapheRange,
85 auto synchronizeZoneWidget = [this, graphWidget](const SqpRange &graphRange,
85 const SqpRange &oldGraphRange) {
86 const SqpRange &oldGraphRange) {
86
87
87 auto zoomType = VariableController::getZoomType(grapheRange, oldGraphRange);
88 auto zoomType = VariableController::getZoomType(graphRange, oldGraphRange);
88 auto frameLayout = ui->visualizationZoneFrame->layout();
89 auto frameLayout = ui->visualizationZoneFrame->layout();
89 for (auto i = 0; i < frameLayout->count(); ++i) {
90 for (auto i = 0; i < frameLayout->count(); ++i) {
90 auto graphChild
91 auto graphChild
@@ -94,8 +95,8 VisualizationGraphWidget *VisualizationZoneWidget::createGraph(std::shared_ptr<V
94 auto graphChildRange = graphChild->graphRange();
95 auto graphChildRange = graphChild->graphRange();
95 switch (zoomType) {
96 switch (zoomType) {
96 case AcquisitionZoomType::ZoomIn: {
97 case AcquisitionZoomType::ZoomIn: {
97 auto deltaLeft = grapheRange.m_TStart - oldGraphRange.m_TStart;
98 auto deltaLeft = graphRange.m_TStart - oldGraphRange.m_TStart;
98 auto deltaRight = oldGraphRange.m_TEnd - grapheRange.m_TEnd;
99 auto deltaRight = oldGraphRange.m_TEnd - graphRange.m_TEnd;
99 graphChildRange.m_TStart += deltaLeft;
100 graphChildRange.m_TStart += deltaLeft;
100 graphChildRange.m_TEnd -= deltaRight;
101 graphChildRange.m_TEnd -= deltaRight;
101 qCCritical(LOG_VisualizationZoneWidget()) << tr("TORM: ZoomIn");
102 qCCritical(LOG_VisualizationZoneWidget()) << tr("TORM: ZoomIn");
@@ -104,37 +105,37 VisualizationGraphWidget *VisualizationZoneWidget::createGraph(std::shared_ptr<V
104 qCCritical(LOG_VisualizationZoneWidget()) << tr("TORM: deltaRight")
105 qCCritical(LOG_VisualizationZoneWidget()) << tr("TORM: deltaRight")
105 << deltaRight;
106 << deltaRight;
106 qCCritical(LOG_VisualizationZoneWidget())
107 qCCritical(LOG_VisualizationZoneWidget())
107 << tr("TORM: dt") << grapheRange.m_TEnd - grapheRange.m_TStart;
108 << tr("TORM: dt") << graphRange.m_TEnd - graphRange.m_TStart;
108
109
109 break;
110 break;
110 }
111 }
111
112
112 case AcquisitionZoomType::ZoomOut: {
113 case AcquisitionZoomType::ZoomOut: {
113 qCCritical(LOG_VisualizationZoneWidget()) << tr("TORM: ZoomOut");
114 qCCritical(LOG_VisualizationZoneWidget()) << tr("TORM: ZoomOut");
114 auto deltaLeft = oldGraphRange.m_TStart - grapheRange.m_TStart;
115 auto deltaLeft = oldGraphRange.m_TStart - graphRange.m_TStart;
115 auto deltaRight = grapheRange.m_TEnd - oldGraphRange.m_TEnd;
116 auto deltaRight = graphRange.m_TEnd - oldGraphRange.m_TEnd;
116 qCCritical(LOG_VisualizationZoneWidget()) << tr("TORM: deltaLeft")
117 qCCritical(LOG_VisualizationZoneWidget()) << tr("TORM: deltaLeft")
117 << deltaLeft;
118 << deltaLeft;
118 qCCritical(LOG_VisualizationZoneWidget()) << tr("TORM: deltaRight")
119 qCCritical(LOG_VisualizationZoneWidget()) << tr("TORM: deltaRight")
119 << deltaRight;
120 << deltaRight;
120 qCCritical(LOG_VisualizationZoneWidget())
121 qCCritical(LOG_VisualizationZoneWidget())
121 << tr("TORM: dt") << grapheRange.m_TEnd - grapheRange.m_TStart;
122 << tr("TORM: dt") << graphRange.m_TEnd - graphRange.m_TStart;
122 graphChildRange.m_TStart -= deltaLeft;
123 graphChildRange.m_TStart -= deltaLeft;
123 graphChildRange.m_TEnd += deltaRight;
124 graphChildRange.m_TEnd += deltaRight;
124 break;
125 break;
125 }
126 }
126 case AcquisitionZoomType::PanRight: {
127 case AcquisitionZoomType::PanRight: {
127 qCCritical(LOG_VisualizationZoneWidget()) << tr("TORM: PanRight");
128 qCCritical(LOG_VisualizationZoneWidget()) << tr("TORM: PanRight");
128 auto deltaRight = grapheRange.m_TEnd - oldGraphRange.m_TEnd;
129 auto deltaRight = graphRange.m_TEnd - oldGraphRange.m_TEnd;
129 graphChildRange.m_TStart += deltaRight;
130 graphChildRange.m_TStart += deltaRight;
130 graphChildRange.m_TEnd += deltaRight;
131 graphChildRange.m_TEnd += deltaRight;
131 qCCritical(LOG_VisualizationZoneWidget())
132 qCCritical(LOG_VisualizationZoneWidget())
132 << tr("TORM: dt") << grapheRange.m_TEnd - grapheRange.m_TStart;
133 << tr("TORM: dt") << graphRange.m_TEnd - graphRange.m_TStart;
133 break;
134 break;
134 }
135 }
135 case AcquisitionZoomType::PanLeft: {
136 case AcquisitionZoomType::PanLeft: {
136 qCCritical(LOG_VisualizationZoneWidget()) << tr("TORM: PanLeft");
137 qCCritical(LOG_VisualizationZoneWidget()) << tr("TORM: PanLeft");
137 auto deltaLeft = oldGraphRange.m_TStart - grapheRange.m_TStart;
138 auto deltaLeft = oldGraphRange.m_TStart - graphRange.m_TStart;
138 graphChildRange.m_TStart -= deltaLeft;
139 graphChildRange.m_TStart -= deltaLeft;
139 graphChildRange.m_TEnd -= deltaLeft;
140 graphChildRange.m_TEnd -= deltaLeft;
140 break;
141 break;
@@ -168,9 +169,27 VisualizationGraphWidget *VisualizationZoneWidget::createGraph(std::shared_ptr<V
168 connect(graphWidget, &VisualizationGraphWidget::variableAdded, this,
169 connect(graphWidget, &VisualizationGraphWidget::variableAdded, this,
169 &VisualizationZoneWidget::onVariableAdded);
170 &VisualizationZoneWidget::onVariableAdded);
170
171
172 auto range = SqpRange{};
173
174 // Apply visitor to graph children
175 auto layout = ui->visualizationZoneFrame->layout();
176 if (layout->count() > 0) {
177 // Case of a new graph in a existant zone
178 if (auto visualizationGraphWidget
179 = dynamic_cast<VisualizationGraphWidget *>(layout->itemAt(0)->widget())) {
180 range = visualizationGraphWidget->graphRange();
181 }
182 }
183 else {
184 // Case of a new graph as the first of the zone
185 range = variable->range();
186 }
187
171 this->addGraph(graphWidget);
188 this->addGraph(graphWidget);
172
189
173 graphWidget->addVariable(variable);
190 graphWidget->addVariable(variable, range);
191 // TODO: get y using variable range
192 graphWidget->setYRange(SqpRange{-10, 10});
174
193
175 return graphWidget;
194 return graphWidget;
176 }
195 }
@@ -155,6 +155,7 void GenerateVariableMenuOperation::visitEnter(VisualizationZoneWidget *zoneWidg
155
155
156 void GenerateVariableMenuOperation::visitLeave(VisualizationZoneWidget *zoneWidget)
156 void GenerateVariableMenuOperation::visitLeave(VisualizationZoneWidget *zoneWidget)
157 {
157 {
158 qCCritical(LOG_GenerateVariableMenuOperation(), "Open in a new graph DETECTED !!");
158 if (zoneWidget) {
159 if (zoneWidget) {
159 // 'Plot' menu
160 // 'Plot' menu
160 impl->visitNodeLeavePlot(
161 impl->visitNodeLeavePlot(
@@ -181,7 +182,7 void GenerateVariableMenuOperation::visit(VisualizationGraphWidget *graphWidget)
181 impl->visitLeafPlot(*graphWidget, QObject::tr("Open in %1").arg(graphWidget->name()),
182 impl->visitLeafPlot(*graphWidget, QObject::tr("Open in %1").arg(graphWidget->name()),
182 [ varW = std::weak_ptr<Variable>{impl->m_Variable}, graphWidget ]() {
183 [ varW = std::weak_ptr<Variable>{impl->m_Variable}, graphWidget ]() {
183 if (auto var = varW.lock()) {
184 if (auto var = varW.lock()) {
184 graphWidget->addVariableUsingGraph(var);
185 graphWidget->addVariable(var, graphWidget->graphRange());
185 }
186 }
186 });
187 });
187
188
@@ -62,7 +62,9 void AmdaProvider::requestDataLoading(QUuid acqIdentifier, const DataProviderPar
62 const auto data = parameters.m_Data;
62 const auto data = parameters.m_Data;
63 for (const auto &dateTime : qAsConst(times)) {
63 for (const auto &dateTime : qAsConst(times)) {
64 this->retrieveData(acqIdentifier, dateTime, data);
64 this->retrieveData(acqIdentifier, dateTime, data);
65 QThread::msleep(200);
65
66 // TORM
67 // QThread::msleep(200);
66 }
68 }
67 }
69 }
68
70
@@ -92,7 +94,7 void AmdaProvider::retrieveData(QUuid token, const SqpRange &dateTime, const QVa
92 auto endDate = dateFormat(dateTime.m_TEnd);
94 auto endDate = dateFormat(dateTime.m_TEnd);
93
95
94 auto url = QUrl{QString{AMDA_URL_FORMAT}.arg(startDate, endDate, productId)};
96 auto url = QUrl{QString{AMDA_URL_FORMAT}.arg(startDate, endDate, productId)};
95 qCInfo(LOG_AmdaProvider()) << tr("AmdaProvider::retrieveData url:") << url;
97 qCInfo(LOG_AmdaProvider()) << tr("TORM AmdaProvider::retrieveData url:") << url;
96 auto tempFile = std::make_shared<QTemporaryFile>();
98 auto tempFile = std::make_shared<QTemporaryFile>();
97
99
98 // LAMBDA
100 // LAMBDA
@@ -128,8 +130,8 void AmdaProvider::retrieveData(QUuid token, const SqpRange &dateTime, const QVa
128 auto downloadFileUrl = QUrl{QString{reply->readAll()}};
130 auto downloadFileUrl = QUrl{QString{reply->readAll()}};
129
131
130
132
131 qCInfo(LOG_AmdaProvider()) << tr("AmdaProvider::retrieveData downloadFileUrl:")
133 qCInfo(LOG_AmdaProvider())
132 << downloadFileUrl;
134 << tr("TORM AmdaProvider::retrieveData downloadFileUrl:") << downloadFileUrl;
133 // Executes request for downloading file //
135 // Executes request for downloading file //
134
136
135 // Creates destination file
137 // Creates destination file
@@ -73,7 +73,7 void CosinusProvider::requestDataLoading(QUuid acqIdentifier,
73 {
73 {
74 // TODO: Add Mutex
74 // TODO: Add Mutex
75 m_VariableToEnableProvider[acqIdentifier] = true;
75 m_VariableToEnableProvider[acqIdentifier] = true;
76 qCDebug(LOG_CosinusProvider()) << "CosinusProvider::requestDataLoading"
76 qCDebug(LOG_CosinusProvider()) << "TORM: CosinusProvider::requestDataLoading"
77 << QThread::currentThread()->objectName();
77 << QThread::currentThread()->objectName();
78 // NOTE: Try to use multithread if possible
78 // NOTE: Try to use multithread if possible
79 const auto times = parameters.m_Times;
79 const auto times = parameters.m_Times;
@@ -81,7 +81,7 void CosinusProvider::requestDataLoading(QUuid acqIdentifier,
81 for (const auto &dateTime : qAsConst(times)) {
81 for (const auto &dateTime : qAsConst(times)) {
82 if (m_VariableToEnableProvider[acqIdentifier]) {
82 if (m_VariableToEnableProvider[acqIdentifier]) {
83 auto scalarSeries = this->retrieveData(acqIdentifier, dateTime);
83 auto scalarSeries = this->retrieveData(acqIdentifier, dateTime);
84 qCCritical(LOG_CosinusProvider()) << "CosinusProvider::dataProvided";
84 qCDebug(LOG_CosinusProvider()) << "TORM: CosinusProvider::dataProvided";
85 emit dataProvided(acqIdentifier, scalarSeries, dateTime);
85 emit dataProvided(acqIdentifier, scalarSeries, dateTime);
86 }
86 }
87 }
87 }
General Comments 0
You need to be logged in to leave comments. Login now