@@ -1,1 +1,1 | |||||
1 | Subproject commit de55e7be90966d1efbd34a10df9a3231c50e245b |
|
1 | Subproject commit c08d1b8ad2976824def52cf0fca26a72b1069356 |
@@ -245,7 +245,7 bool DragDropGuiController::checkMimeDataForVisualization( | |||||
245 |
|
245 | |||
246 | if (mimeData->hasFormat(MIME_TYPE_VARIABLE_LIST)) { |
|
246 | if (mimeData->hasFormat(MIME_TYPE_VARIABLE_LIST)) { | |
247 | auto variables = sqpApp->variableController().variables( |
|
247 | auto variables = sqpApp->variableController().variables( | |
248 | mimeData->data(MIME_TYPE_VARIABLE_LIST)); |
|
248 | Variable::variablesIDs(mimeData->data(MIME_TYPE_VARIABLE_LIST))); | |
249 |
|
249 | |||
250 | if (variables.size() == 1) { |
|
250 | if (variables.size() == 1) { | |
251 |
|
251 |
@@ -19,7 +19,6 class SqpApplication::SqpApplicationPrivate { | |||||
19 | public: |
|
19 | public: | |
20 | SqpApplicationPrivate() |
|
20 | SqpApplicationPrivate() | |
21 | : m_VariableController{std::make_shared<VariableController2>()}, |
|
21 | : m_VariableController{std::make_shared<VariableController2>()}, | |
22 | m_VariableModel{m_VariableController}, |
|
|||
23 | m_PlotInterractionMode(SqpApplication::PlotsInteractionMode::None), |
|
22 | m_PlotInterractionMode(SqpApplication::PlotsInteractionMode::None), | |
24 | m_PlotCursorMode(SqpApplication::PlotsCursorMode::NoCursor) |
|
23 | m_PlotCursorMode(SqpApplication::PlotsCursorMode::NoCursor) | |
25 | { |
|
24 | { | |
@@ -29,11 +28,12 public: | |||||
29 |
|
28 | |||
30 | // VariableController <-> DataSourceController |
|
29 | // VariableController <-> DataSourceController | |
31 | connect(&m_DataSourceController, |
|
30 | connect(&m_DataSourceController, | |
32 | SIGNAL(variableCreationRequested(const QString &, const QVariantHash &, |
|
31 | &DataSourceController::createVariable,[](const QString &variableName, | |
33 | std::shared_ptr<IDataProvider>)), |
|
32 | const QVariantHash &variableMetadata, | |
34 | m_VariableController.get(), |
|
33 | std::shared_ptr<IDataProvider> variableProvider) | |
35 | SLOT(createVariable(const QString &, const QVariantHash &, |
|
34 | { | |
36 | std::shared_ptr<IDataProvider>))); |
|
35 | sqpApp->variableController().createVariable(variableName,variableMetadata,variableProvider,sqpApp->timeController().dateTime()); | |
|
36 | }); | |||
37 |
|
37 | |||
38 | // connect(m_VariableController->variableModel(), &VariableModel::requestVariable, |
|
38 | // connect(m_VariableController->variableModel(), &VariableModel::requestVariable, | |
39 | // m_DataSourceController.get(), &DataSourceController::requestVariable); |
|
39 | // m_DataSourceController.get(), &DataSourceController::requestVariable); | |
@@ -79,7 +79,6 public: | |||||
79 | NetworkController m_NetworkController; |
|
79 | NetworkController m_NetworkController; | |
80 | VisualizationController m_VisualizationController; |
|
80 | VisualizationController m_VisualizationController; | |
81 | CatalogueController m_CatalogueController; |
|
81 | CatalogueController m_CatalogueController; | |
82 | VariableModel2 m_VariableModel; |
|
|||
83 |
|
82 | |||
84 | QThread m_DataSourceControllerThread; |
|
83 | QThread m_DataSourceControllerThread; | |
85 | QThread m_NetworkControllerThread; |
|
84 | QThread m_NetworkControllerThread; |
@@ -4,6 +4,7 | |||||
4 | #include <Variable/VariableInspectorWidget.h> |
|
4 | #include <Variable/VariableInspectorWidget.h> | |
5 | #include <Variable/VariableMenuHeaderWidget.h> |
|
5 | #include <Variable/VariableMenuHeaderWidget.h> | |
6 | #include <Variable/VariableModel2.h> |
|
6 | #include <Variable/VariableModel2.h> | |
|
7 | #include <DataSource/DataSourceController.h> | |||
7 |
|
8 | |||
8 | #include <ui_VariableInspectorWidget.h> |
|
9 | #include <ui_VariableInspectorWidget.h> | |
9 |
|
10 | |||
@@ -125,13 +126,22 VariableInspectorWidget::VariableInspectorWidget(QWidget *parent) | |||||
125 | // auto sortFilterModel = new QSortFilterProxyModel{this}; |
|
126 | // auto sortFilterModel = new QSortFilterProxyModel{this}; | |
126 | // sortFilterModel->setSourceModel(sqpApp->variableController().variableModel()); |
|
127 | // sortFilterModel->setSourceModel(sqpApp->variableController().variableModel()); | |
127 |
|
128 | |||
128 |
m_model = new VariableModel2( |
|
129 | m_model = new VariableModel2(); | |
129 | ui->tableView->setModel(m_model); |
|
130 | ui->tableView->setModel(m_model); | |
|
131 | connect(m_model, &VariableModel2::createVariable, | |||
|
132 | [](const QVariantHash &productData) | |||
|
133 | { | |||
|
134 | sqpApp->dataSourceController().requestVariable(productData); | |||
|
135 | }); | |||
|
136 | auto vc = &(sqpApp->variableController()); | |||
|
137 | connect(vc, &VariableController2::variableAdded, m_model, &VariableModel2::variableAdded); | |||
|
138 | connect(vc, &VariableController2::variableDeleted, m_model, &VariableModel2::variableDeleted); | |||
|
139 | connect(m_model, &VariableModel2::asyncChangeRange, vc, &VariableController2::asyncChangeRange); | |||
130 |
|
140 | |||
131 | // Adds extra signal/slot between view and model, so the view can be updated instantly when |
|
141 | // Adds extra signal/slot between view and model, so the view can be updated instantly when | |
132 | // there is a change of data in the model |
|
142 | // there is a change of data in the model | |
133 | connect(m_model, SIGNAL(dataChanged(const QModelIndex &, const QModelIndex &)), this, |
|
143 | //connect(m_model, SIGNAL(dataChanged(const QModelIndex &, const QModelIndex &)), this, | |
134 | SLOT(refresh())); |
|
144 | // SLOT(refresh())); | |
135 |
|
145 | |||
136 | //ui->tableView->setSelectionModel(sqpApp->variableController().variableSelectionModel()); |
|
146 | //ui->tableView->setSelectionModel(sqpApp->variableController().variableSelectionModel()); | |
137 | ui->tableView->setItemDelegateForColumn(0, m_ProgressBarItemDelegate); |
|
147 | ui->tableView->setItemDelegateForColumn(0, m_ProgressBarItemDelegate); |
@@ -231,7 +231,7 void VisualizationTabWidget::dropMimeData(int index, const QMimeData *mimeData) | |||||
231 | } |
|
231 | } | |
232 | else if (mimeData->hasFormat(MIME_TYPE_VARIABLE_LIST)) { |
|
232 | else if (mimeData->hasFormat(MIME_TYPE_VARIABLE_LIST)) { | |
233 | auto variables = sqpApp->variableController().variables( |
|
233 | auto variables = sqpApp->variableController().variables( | |
234 | mimeData->data(MIME_TYPE_VARIABLE_LIST)); |
|
234 | Variable::variablesIDs(mimeData->data(MIME_TYPE_VARIABLE_LIST))); | |
235 | impl->dropVariables(variables, index, this); |
|
235 | impl->dropVariables(variables, index, this); | |
236 | } |
|
236 | } | |
237 | else if (mimeData->hasFormat(MIME_TYPE_PRODUCT_LIST)) { |
|
237 | else if (mimeData->hasFormat(MIME_TYPE_PRODUCT_LIST)) { |
@@ -119,7 +119,7 VisualizationZoneWidget::VisualizationZoneWidget(const QString &name, QWidget *p | |||||
119 |
|
119 | |||
120 | if (mimeData->hasFormat(MIME_TYPE_VARIABLE_LIST)) { |
|
120 | if (mimeData->hasFormat(MIME_TYPE_VARIABLE_LIST)) { | |
121 | auto variables = sqpApp->variableController().variables( |
|
121 | auto variables = sqpApp->variableController().variables( | |
122 | mimeData->data(MIME_TYPE_VARIABLE_LIST)); |
|
122 | Variable::variablesIDs(mimeData->data(MIME_TYPE_VARIABLE_LIST))); | |
123 |
|
123 | |||
124 | if (variables.size() != 1) { |
|
124 | if (variables.size() != 1) { | |
125 | return false; |
|
125 | return false; | |
@@ -460,7 +460,7 void VisualizationZoneWidget::dropMimeData(int index, const QMimeData *mimeData) | |||||
460 | } |
|
460 | } | |
461 | else if (mimeData->hasFormat(MIME_TYPE_VARIABLE_LIST)) { |
|
461 | else if (mimeData->hasFormat(MIME_TYPE_VARIABLE_LIST)) { | |
462 | auto variables = sqpApp->variableController().variables( |
|
462 | auto variables = sqpApp->variableController().variables( | |
463 | mimeData->data(MIME_TYPE_VARIABLE_LIST)); |
|
463 | Variable::variablesIDs(mimeData->data(MIME_TYPE_VARIABLE_LIST))); | |
464 | impl->dropVariables(variables, index, this); |
|
464 | impl->dropVariables(variables, index, this); | |
465 | } |
|
465 | } | |
466 | else if (mimeData->hasFormat(MIME_TYPE_PRODUCT_LIST)) { |
|
466 | else if (mimeData->hasFormat(MIME_TYPE_PRODUCT_LIST)) { | |
@@ -488,7 +488,7 void VisualizationZoneWidget::dropMimeDataOnGraph(VisualizationDragWidget *dragW | |||||
488 |
|
488 | |||
489 | if (mimeData->hasFormat(MIME_TYPE_VARIABLE_LIST)) { |
|
489 | if (mimeData->hasFormat(MIME_TYPE_VARIABLE_LIST)) { | |
490 | auto variables = sqpApp->variableController().variables( |
|
490 | auto variables = sqpApp->variableController().variables( | |
491 | mimeData->data(MIME_TYPE_VARIABLE_LIST)); |
|
491 | Variable::variablesIDs(mimeData->data(MIME_TYPE_VARIABLE_LIST))); | |
492 | for (const auto &var : variables) { |
|
492 | for (const auto &var : variables) { | |
493 | graphWidget->addVariable(var, graphWidget->graphRange()); |
|
493 | graphWidget->addVariable(var, graphWidget->graphRange()); | |
494 | } |
|
494 | } |
@@ -22,6 +22,8 public: | |||||
22 | void requestDataLoading(QUuid acqIdentifier, const DataProviderParameters ¶meters) override; |
|
22 | void requestDataLoading(QUuid acqIdentifier, const DataProviderParameters ¶meters) override; | |
23 |
|
23 | |||
24 |
|
24 | |||
|
25 | virtual IDataSeries* getData(const DataProviderParameters ¶meters) override; | |||
|
26 | ||||
25 | /// @sa IDataProvider::requestDataAborting(). The current impl isn't thread safe. |
|
27 | /// @sa IDataProvider::requestDataAborting(). The current impl isn't thread safe. | |
26 | void requestDataAborting(QUuid acqIdentifier) override; |
|
28 | void requestDataAborting(QUuid acqIdentifier) override; | |
27 |
|
29 | |||
@@ -35,6 +37,8 private: | |||||
35 | std::shared_ptr<IDataSeries> |
|
37 | std::shared_ptr<IDataSeries> | |
36 | retrieveData(QUuid acqIdentifier, const DateTimeRange &dataRangeRequested, const QVariantHash &data); |
|
38 | retrieveData(QUuid acqIdentifier, const DateTimeRange &dataRangeRequested, const QVariantHash &data); | |
37 |
|
39 | |||
|
40 | IDataSeries* _generate(const DateTimeRange &range, const QVariantHash &metaData); | |||
|
41 | ||||
38 | QHash<QUuid, bool> m_VariableToEnableProvider; |
|
42 | QHash<QUuid, bool> m_VariableToEnableProvider; | |
39 | }; |
|
43 | }; | |
40 |
|
44 |
@@ -30,9 +30,9 const auto SPECTROGRAM_ZERO_BANDS = std::set<int>{2, 15, 19, 29}; | |||||
30 | struct ICosinusType { |
|
30 | struct ICosinusType { | |
31 | virtual ~ICosinusType() = default; |
|
31 | virtual ~ICosinusType() = default; | |
32 | /// @return the number of components generated for the type |
|
32 | /// @return the number of components generated for the type | |
33 |
virtual |
|
33 | virtual std::size_t componentCount() const = 0; | |
34 | /// @return the data series created for the type |
|
34 | /// @return the data series created for the type | |
35 |
virtual |
|
35 | virtual IDataSeries* createDataSeries(std::vector<double> xAxisData, | |
36 | std::vector<double> valuesData) const = 0; |
|
36 | std::vector<double> valuesData) const = 0; | |
37 | /// Generates values (one value per component) |
|
37 | /// Generates values (one value per component) | |
38 | /// @param x the x-axis data used to generate values |
|
38 | /// @param x the x-axis data used to generate values | |
@@ -43,12 +43,12 struct ICosinusType { | |||||
43 | }; |
|
43 | }; | |
44 |
|
44 | |||
45 | struct ScalarCosinus : public ICosinusType { |
|
45 | struct ScalarCosinus : public ICosinusType { | |
46 |
|
|
46 | std::size_t componentCount() const override { return 1; } | |
47 |
|
47 | |||
48 |
|
|
48 | IDataSeries* createDataSeries(std::vector<double> xAxisData, | |
49 | std::vector<double> valuesData) const override |
|
49 | std::vector<double> valuesData) const override | |
50 | { |
|
50 | { | |
51 |
return |
|
51 | return new ScalarSeries(std::move(xAxisData), std::move(valuesData), | |
52 | Unit{QStringLiteral("t"), true}, Unit{}); |
|
52 | Unit{QStringLiteral("t"), true}, Unit{}); | |
53 | } |
|
53 | } | |
54 |
|
54 | |||
@@ -67,12 +67,12 struct SpectrogramCosinus : public ICosinusType { | |||||
67 | { |
|
67 | { | |
68 | } |
|
68 | } | |
69 |
|
69 | |||
70 |
|
|
70 | std::size_t componentCount() const override { return m_YAxisData.size(); } | |
71 |
|
71 | |||
72 |
|
|
72 | IDataSeries* createDataSeries(std::vector<double> xAxisData, | |
73 | std::vector<double> valuesData) const override |
|
73 | std::vector<double> valuesData) const override | |
74 | { |
|
74 | { | |
75 |
return |
|
75 | return new SpectrogramSeries( | |
76 | std::move(xAxisData), m_YAxisData, std::move(valuesData), |
|
76 | std::move(xAxisData), m_YAxisData, std::move(valuesData), | |
77 | Unit{QStringLiteral("t"), true}, m_YAxisUnit, m_ValuesUnit); |
|
77 | Unit{QStringLiteral("t"), true}, m_YAxisUnit, m_ValuesUnit); | |
78 | } |
|
78 | } | |
@@ -107,12 +107,12 struct SpectrogramCosinus : public ICosinusType { | |||||
107 | }; |
|
107 | }; | |
108 |
|
108 | |||
109 | struct VectorCosinus : public ICosinusType { |
|
109 | struct VectorCosinus : public ICosinusType { | |
110 |
|
|
110 | std::size_t componentCount() const override { return 3; } | |
111 |
|
111 | |||
112 |
|
|
112 | IDataSeries* createDataSeries(std::vector<double> xAxisData, | |
113 | std::vector<double> valuesData) const override |
|
113 | std::vector<double> valuesData) const override | |
114 | { |
|
114 | { | |
115 |
return |
|
115 | return new VectorSeries(std::move(xAxisData), std::move(valuesData), | |
116 | Unit{QStringLiteral("t"), true}, Unit{}); |
|
116 | Unit{QStringLiteral("t"), true}, Unit{}); | |
117 | } |
|
117 | } | |
118 |
|
118 | |||
@@ -244,6 +244,41 std::shared_ptr<IDataSeries> CosinusProvider::retrieveData(QUuid acqIdentifier, | |||||
244 | // We can close progression beacause all data has been retrieved |
|
244 | // We can close progression beacause all data has been retrieved | |
245 | emit dataProvidedProgress(acqIdentifier, 100); |
|
245 | emit dataProvidedProgress(acqIdentifier, 100); | |
246 | } |
|
246 | } | |
|
247 | return std::shared_ptr<IDataSeries>(type->createDataSeries(std::move(xAxisData), std::move(valuesData))); | |||
|
248 | } | |||
|
249 | ||||
|
250 | IDataSeries *CosinusProvider::_generate(const DateTimeRange &range, const QVariantHash &metaData) | |||
|
251 | { | |||
|
252 | auto dataIndex = 0; | |||
|
253 | ||||
|
254 | // Retrieves cosinus type | |||
|
255 | auto typeVariant = metaData.value(COSINUS_TYPE_KEY, COSINUS_TYPE_DEFAULT_VALUE); | |||
|
256 | auto type = cosinusType(typeVariant.toString()); | |||
|
257 | auto freqVariant = metaData.value(COSINUS_FREQUENCY_KEY, COSINUS_FREQUENCY_DEFAULT_VALUE); | |||
|
258 | double freq = freqVariant.toDouble(); | |||
|
259 | double start = std::ceil(range.m_TStart * freq); | |||
|
260 | double end = std::floor(range.m_TEnd * freq); | |||
|
261 | if (end < start) { | |||
|
262 | std::swap(start, end); | |||
|
263 | } | |||
|
264 | std::size_t dataCount = static_cast<std::size_t>(end - start + 1); | |||
|
265 | std::size_t componentCount = type->componentCount(); | |||
|
266 | ||||
|
267 | auto xAxisData = std::vector<double>{}; | |||
|
268 | xAxisData.resize(dataCount); | |||
|
269 | ||||
|
270 | auto valuesData = std::vector<double>{}; | |||
|
271 | valuesData.resize(dataCount * componentCount); | |||
|
272 | ||||
|
273 | int progress = 0; | |||
|
274 | auto progressEnd = dataCount; | |||
|
275 | for (auto time = start; time <= end; ++time, ++dataIndex) | |||
|
276 | { | |||
|
277 | const auto x = time / freq; | |||
|
278 | xAxisData[dataIndex] = x; | |||
|
279 | // Generates values (depending on the type) | |||
|
280 | type->generateValues(x, valuesData, dataIndex); | |||
|
281 | } | |||
247 | return type->createDataSeries(std::move(xAxisData), std::move(valuesData)); |
|
282 | return type->createDataSeries(std::move(xAxisData), std::move(valuesData)); | |
248 | } |
|
283 | } | |
249 |
|
284 | |||
@@ -265,6 +300,12 void CosinusProvider::requestDataLoading(QUuid acqIdentifier, | |||||
265 | } |
|
300 | } | |
266 | } |
|
301 | } | |
267 |
|
302 | |||
|
303 | IDataSeries* CosinusProvider::getData(const DataProviderParameters ¶meters) | |||
|
304 | { | |||
|
305 | return _generate(parameters.m_Times.front(),parameters.m_Data); | |||
|
306 | } | |||
|
307 | ||||
|
308 | ||||
268 | void CosinusProvider::requestDataAborting(QUuid acqIdentifier) |
|
309 | void CosinusProvider::requestDataAborting(QUuid acqIdentifier) | |
269 | { |
|
310 | { | |
270 | qCDebug(LOG_CosinusProvider()) << "CosinusProvider::requestDataAborting" << acqIdentifier |
|
311 | qCDebug(LOG_CosinusProvider()) << "CosinusProvider::requestDataAborting" << acqIdentifier |
General Comments 0
You need to be logged in to leave comments.
Login now