##// END OF EJS Templates
Add connection logical for the rescale operation
perrinel -
r437:9fabd78ca3ee
parent child
Show More
@@ -192,6 +192,10 MainWindow::MainWindow(QWidget *parent)
192 192 SIGNAL(variableAboutToBeDeleted(std::shared_ptr<Variable>)), m_Ui->view,
193 193 SLOT(onVariableAboutToBeDeleted(std::shared_ptr<Variable>)));
194 194
195 connect(&sqpApp->visualizationController(),
196 SIGNAL(rangeChanged(std::shared_ptr<Variable>, const SqpDateTime &)), m_Ui->view,
197 SLOT(onRangeChanged(std::shared_ptr<Variable>, const SqpDateTime &)));
198
195 199 // Widgets / widgets connections
196 200
197 201 // For the following connections, we use DirectConnection to allow each widget that can
@@ -59,6 +59,9 signals:
59 59 /// Signal emitted when a variable is about to be deleted from the controller
60 60 void variableAboutToBeDeleted(std::shared_ptr<Variable> variable);
61 61
62 /// Signal emitted when a data acquisition is requested on a range for a variable
63 void rangeChanged(std::shared_ptr<Variable> variable, const SqpDateTime &range);
64
62 65 public slots:
63 66 /// Request the data loading of the variable whithin dateTime
64 67 void onRequestDataLoading(std::shared_ptr<Variable> variable, const SqpDateTime &dateTime);
@@ -1,6 +1,8
1 1 #ifndef SCIQLOP_VISUALIZATIONCONTROLLER_H
2 2 #define SCIQLOP_VISUALIZATIONCONTROLLER_H
3 3
4 #include <Data/SqpDateTime.h>
5
4 6 #include <QLoggingCategory>
5 7 #include <QObject>
6 8 #include <QUuid>
@@ -29,6 +31,9 signals:
29 31 /// Signal emitted when a variable is about to be deleted from SciQlop
30 32 void variableAboutToBeDeleted(std::shared_ptr<Variable> variable);
31 33
34 /// Signal emitted when a data acquisition is requested on a range for a variable
35 void rangeChanged(std::shared_ptr<Variable> variable, const SqpDateTime &range);
36
32 37 public slots:
33 38 /// Manage init/end of the controller
34 39 void initialize();
@@ -161,6 +161,7 void VariableController::onDateTimeOnSelection(const SqpDateTime &dateTime)
161 161 if (auto selectedVariable = impl->m_VariableModel->variable(selectedRow.row())) {
162 162 selectedVariable->setDateTime(dateTime);
163 163 this->onRequestDataLoading(selectedVariable, dateTime);
164 emit rangeChanged(selectedVariable, dateTime);
164 165 }
165 166 }
166 167 }
@@ -32,14 +32,15 public:
32 32 /// Removes a variable from the graph
33 33 void removeVariable(std::shared_ptr<Variable> variable) noexcept;
34 34
35 /// Rescale the X axe to range parameter
36 void setRange(std::shared_ptr<Variable> variable, const SqpDateTime &range);
37
35 38 // IVisualizationWidget interface
36 39 void accept(IVisualizationWidgetVisitor *visitor) override;
37 40 bool canDrop(const Variable &variable) const override;
38 41 bool contains(const Variable &variable) const override;
39 42 QString name() const override;
40 43
41 void updateDisplay(std::shared_ptr<Variable> variable);
42
43 44 signals:
44 45 void requestDataLoading(std::shared_ptr<Variable> variable, const SqpDateTime &dateTime);
45 46
@@ -2,6 +2,7
2 2 #define SCIQLOP_VISUALIZATIONWIDGET_H
3 3
4 4 #include "Visualization/IVisualizationWidget.h"
5 #include <Data/SqpDateTime.h>
5 6
6 7 #include <QLoggingCategory>
7 8 #include <QWidget>
@@ -41,6 +42,8 public slots:
41 42 /// Slot called when a variable is about to be deleted from SciQlop
42 43 void onVariableAboutToBeDeleted(std::shared_ptr<Variable> variable) noexcept;
43 44
45 void onRangeChanged(std::shared_ptr<Variable> variable, const SqpDateTime &range) noexcept;
46
44 47 private:
45 48 Ui::VisualizationWidget *ui;
46 49 };
@@ -38,6 +38,11 public:
38 38 m_VisualizationController.get(),
39 39 SIGNAL(variableAboutToBeDeleted(std::shared_ptr<Variable>)), Qt::DirectConnection);
40 40
41 connect(m_VariableController.get(),
42 SIGNAL(rangeChanged(std::shared_ptr<Variable>, const SqpDateTime &)),
43 m_VisualizationController.get(),
44 SIGNAL(rangeChanged(std::shared_ptr<Variable>, const SqpDateTime &)));
45
41 46
42 47 m_DataSourceController->moveToThread(&m_DataSourceControllerThread);
43 48 m_DataSourceControllerThread.setObjectName("DataSourceControllerThread");
@@ -5,6 +5,7
5 5 #include "Visualization/VisualizationZoneWidget.h"
6 6 #include "Visualization/operations/GenerateVariableMenuOperation.h"
7 7 #include "Visualization/operations/RemoveVariableOperation.h"
8 #include "Visualization/operations/RescaleAxeOperation.h"
8 9 #include "Visualization/qcustomplot.h"
9 10
10 11 #include "ui_VisualizationWidget.h"
@@ -141,3 +142,11 void VisualizationWidget::onVariableAboutToBeDeleted(std::shared_ptr<Variable> v
141 142 auto removeVariableOperation = RemoveVariableOperation{variable};
142 143 accept(&removeVariableOperation);
143 144 }
145
146 void VisualizationWidget::onRangeChanged(std::shared_ptr<Variable> variable,
147 const SqpDateTime &range) noexcept
148 {
149 // Calls the operation of removing all references to the variable in the visualization
150 auto rescaleVariableOperation = RescaleAxeOperation{variable, range};
151 accept(&rescaleVariableOperation);
152 }
General Comments 0
You need to be logged in to leave comments. Login now