@@ -25,6 +25,20 namespace Ui { | |||||
25 | class VisualizationGraphWidget; |
|
25 | class VisualizationGraphWidget; | |
26 | } // namespace Ui |
|
26 | } // namespace Ui | |
27 |
|
27 | |||
|
28 | /// Defines options that can be associated with the graph | |||
|
29 | enum GraphFlag { | |||
|
30 | DisableAll = 0x0, ///< Disables acquisition and synchronization | |||
|
31 | EnableAcquisition = 0x1, ///< When this flag is set, the change of the graph's range leads to | |||
|
32 | /// the acquisition of data | |||
|
33 | EnableSynchronization = 0x2, ///< When this flag is set, the change of the graph's range causes | |||
|
34 | /// the call to the synchronization of the graphs contained in the | |||
|
35 | /// same zone of this graph | |||
|
36 | EnableAll = ~DisableAll ///< Enables acquisition and synchronization | |||
|
37 | }; | |||
|
38 | ||||
|
39 | Q_DECLARE_FLAGS(GraphFlags, GraphFlag) | |||
|
40 | Q_DECLARE_OPERATORS_FOR_FLAGS(GraphFlags) | |||
|
41 | ||||
28 | class VisualizationGraphWidget : public VisualizationDragWidget, public IVisualizationWidget { |
|
42 | class VisualizationGraphWidget : public VisualizationDragWidget, public IVisualizationWidget { | |
29 | Q_OBJECT |
|
43 | Q_OBJECT | |
30 |
|
44 | |||
@@ -41,8 +55,8 public: | |||||
41 | /// Returns the main VisualizationWidget which contains the graph or nullptr |
|
55 | /// Returns the main VisualizationWidget which contains the graph or nullptr | |
42 | VisualizationWidget *parentVisualizationWidget() const; |
|
56 | VisualizationWidget *parentVisualizationWidget() const; | |
43 |
|
57 | |||
44 | /// If acquisition isn't enable, requestDataLoading signal cannot be emit |
|
58 | /// Sets graph options | |
45 | void enableAcquisition(bool enable); |
|
59 | void setFlags(GraphFlags flags); | |
46 |
|
60 | |||
47 | void addVariable(std::shared_ptr<Variable> variable, SqpRange range); |
|
61 | void addVariable(std::shared_ptr<Variable> variable, SqpRange range); | |
48 |
|
62 |
@@ -59,7 +59,7 struct VisualizationGraphWidget::VisualizationGraphWidgetPrivate { | |||||
59 |
|
59 | |||
60 | explicit VisualizationGraphWidgetPrivate(const QString &name) |
|
60 | explicit VisualizationGraphWidgetPrivate(const QString &name) | |
61 | : m_Name{name}, |
|
61 | : m_Name{name}, | |
62 | m_DoAcquisition{true}, |
|
62 | m_Flags{GraphFlag::EnableAll}, | |
63 | m_IsCalibration{false}, |
|
63 | m_IsCalibration{false}, | |
64 | m_RenderingDelegate{nullptr} |
|
64 | m_RenderingDelegate{nullptr} | |
65 | { |
|
65 | { | |
@@ -77,7 +77,7 struct VisualizationGraphWidget::VisualizationGraphWidgetPrivate { | |||||
77 | QString m_Name; |
|
77 | QString m_Name; | |
78 | // 1 variable -> n qcpplot |
|
78 | // 1 variable -> n qcpplot | |
79 | std::map<std::shared_ptr<Variable>, PlottablesMap> m_VariableToPlotMultiMap; |
|
79 | std::map<std::shared_ptr<Variable>, PlottablesMap> m_VariableToPlotMultiMap; | |
80 | bool m_DoAcquisition; |
|
80 | GraphFlags m_Flags; | |
81 | bool m_IsCalibration; |
|
81 | bool m_IsCalibration; | |
82 | /// Delegate used to attach rendering features to the plot |
|
82 | /// Delegate used to attach rendering features to the plot | |
83 | std::unique_ptr<VisualizationGraphRenderingDelegate> m_RenderingDelegate; |
|
83 | std::unique_ptr<VisualizationGraphRenderingDelegate> m_RenderingDelegate; | |
@@ -287,9 +287,9 VisualizationWidget *VisualizationGraphWidget::parentVisualizationWidget() const | |||||
287 | return qobject_cast<VisualizationWidget *>(parent); |
|
287 | return qobject_cast<VisualizationWidget *>(parent); | |
288 | } |
|
288 | } | |
289 |
|
289 | |||
290 |
void VisualizationGraphWidget:: |
|
290 | void VisualizationGraphWidget::setFlags(GraphFlags flags) | |
291 | { |
|
291 | { | |
292 | impl->m_DoAcquisition = enable; |
|
292 | impl->m_Flags = std::move(flags); | |
293 | } |
|
293 | } | |
294 |
|
294 | |||
295 | void VisualizationGraphWidget::addVariable(std::shared_ptr<Variable> variable, SqpRange range) |
|
295 | void VisualizationGraphWidget::addVariable(std::shared_ptr<Variable> variable, SqpRange range) | |
@@ -311,9 +311,9 void VisualizationGraphWidget::addVariable(std::shared_ptr<Variable> variable, S | |||||
311 |
|
311 | |||
312 | connect(variable.get(), SIGNAL(updated()), this, SLOT(onDataCacheVariableUpdated())); |
|
312 | connect(variable.get(), SIGNAL(updated()), this, SLOT(onDataCacheVariableUpdated())); | |
313 |
|
313 | |||
314 | this->enableAcquisition(false); |
|
314 | this->setFlags(GraphFlag::DisableAll); | |
315 | this->setGraphRange(range); |
|
315 | this->setGraphRange(range); | |
316 | this->enableAcquisition(true); |
|
316 | this->setFlags(GraphFlag::EnableAll); | |
317 |
|
317 | |||
318 | emit requestDataLoading(QVector<std::shared_ptr<Variable> >() << variable, range, false); |
|
318 | emit requestDataLoading(QVector<std::shared_ptr<Variable> >() << variable, range, false); | |
319 |
|
319 | |||
@@ -696,12 +696,12 void VisualizationGraphWidget::onRangeChanged(const QCPRange &t1, const QCPRange | |||||
696 | { |
|
696 | { | |
697 | qCDebug(LOG_VisualizationGraphWidget()) << tr("TORM: VisualizationGraphWidget::onRangeChanged") |
|
697 | qCDebug(LOG_VisualizationGraphWidget()) << tr("TORM: VisualizationGraphWidget::onRangeChanged") | |
698 | << QThread::currentThread()->objectName() << "DoAcqui" |
|
698 | << QThread::currentThread()->objectName() << "DoAcqui" | |
699 |
<< impl->m_ |
|
699 | << impl->m_Flags.testFlag(GraphFlag::EnableAcquisition); | |
700 |
|
700 | |||
701 | auto graphRange = SqpRange{t1.lower, t1.upper}; |
|
701 | auto graphRange = SqpRange{t1.lower, t1.upper}; | |
702 | auto oldGraphRange = SqpRange{t2.lower, t2.upper}; |
|
702 | auto oldGraphRange = SqpRange{t2.lower, t2.upper}; | |
703 |
|
703 | |||
704 |
if (impl->m_ |
|
704 | if (impl->m_Flags.testFlag(GraphFlag::EnableAcquisition)) { | |
705 | QVector<std::shared_ptr<Variable> > variableUnderGraphVector; |
|
705 | QVector<std::shared_ptr<Variable> > variableUnderGraphVector; | |
706 |
|
706 | |||
707 | for (auto it = impl->m_VariableToPlotMultiMap.begin(), |
|
707 | for (auto it = impl->m_VariableToPlotMultiMap.begin(), |
@@ -264,15 +264,15 VisualizationGraphWidget *VisualizationZoneWidget::createGraph(std::shared_ptr<V | |||||
264 | // No action |
|
264 | // No action | |
265 | break; |
|
265 | break; | |
266 | } |
|
266 | } | |
267 |
graphChild-> |
|
267 | graphChild->setFlags(GraphFlag::DisableAll); | |
268 |
qCDebug(LOG_VisualizationZoneWidget()) |
|
268 | qCDebug(LOG_VisualizationZoneWidget()) | |
269 |
|
|
269 | << tr("TORM: Range before: ") << graphChild->graphRange(); | |
270 |
qCDebug(LOG_VisualizationZoneWidget()) |
|
270 | qCDebug(LOG_VisualizationZoneWidget()) | |
271 | << graphChildRange; |
|
271 | << tr("TORM: Range after : ") << graphChildRange; | |
272 | qCDebug(LOG_VisualizationZoneWidget()) |
|
272 | qCDebug(LOG_VisualizationZoneWidget()) | |
273 | << tr("TORM: child dt") << graphChildRange.m_TEnd - graphChildRange.m_TStart; |
|
273 | << tr("TORM: child dt") << graphChildRange.m_TEnd - graphChildRange.m_TStart; | |
274 | graphChild->setGraphRange(graphChildRange); |
|
274 | graphChild->setGraphRange(graphChildRange); | |
275 |
graphChild-> |
|
275 | graphChild->setFlags(GraphFlag::EnableAll); | |
276 | } |
|
276 | } | |
277 | } |
|
277 | } | |
278 | }; |
|
278 | }; |
@@ -59,9 +59,9 void RescaleAxeOperation::visit(VisualizationGraphWidget *graphWidget) | |||||
59 | if (graphWidget) { |
|
59 | if (graphWidget) { | |
60 | // If the widget contains the variable, rescale it |
|
60 | // If the widget contains the variable, rescale it | |
61 | if (impl->m_Variable && graphWidget->contains(*impl->m_Variable)) { |
|
61 | if (impl->m_Variable && graphWidget->contains(*impl->m_Variable)) { | |
62 |
graphWidget-> |
|
62 | graphWidget->setFlags(GraphFlag::DisableAll); | |
63 | graphWidget->setGraphRange(impl->m_Range); |
|
63 | graphWidget->setGraphRange(impl->m_Range); | |
64 |
graphWidget-> |
|
64 | graphWidget->setFlags(GraphFlag::EnableAll); | |
65 | } |
|
65 | } | |
66 | } |
|
66 | } | |
67 | else { |
|
67 | else { |
General Comments 0
You need to be logged in to leave comments.
Login now