Auto status change to "Under Review"
@@ -17,12 +17,12 struct SqpDateTime { | |||||
17 | /// End time |
|
17 | /// End time | |
18 | double m_TEnd; |
|
18 | double m_TEnd; | |
19 |
|
19 | |||
20 | bool contains(const SqpDateTime &dateTime) |
|
20 | bool contains(const SqpDateTime &dateTime) const noexcept | |
21 | { |
|
21 | { | |
22 | return (m_TStart <= dateTime.m_TStart && m_TEnd >= dateTime.m_TEnd); |
|
22 | return (m_TStart <= dateTime.m_TStart && m_TEnd >= dateTime.m_TEnd); | |
23 | } |
|
23 | } | |
24 |
|
24 | |||
25 | bool intersect(const SqpDateTime &dateTime) |
|
25 | bool intersect(const SqpDateTime &dateTime) const noexcept | |
26 | { |
|
26 | { | |
27 | return (m_TEnd >= dateTime.m_TStart && m_TStart <= dateTime.m_TEnd); |
|
27 | return (m_TEnd >= dateTime.m_TStart && m_TStart <= dateTime.m_TEnd); | |
28 | } |
|
28 | } |
@@ -34,8 +34,9 public: | |||||
34 | /// @return the data of the variable, nullptr if there is no data |
|
34 | /// @return the data of the variable, nullptr if there is no data | |
35 | IDataSeries *dataSeries() const noexcept; |
|
35 | IDataSeries *dataSeries() const noexcept; | |
36 |
|
36 | |||
37 | bool contains(const SqpDateTime &dateTime); |
|
37 | bool contains(const SqpDateTime &dateTime) const noexcept; | |
38 | bool intersect(const SqpDateTime &dateTime); |
|
38 | bool intersect(const SqpDateTime &dateTime) const noexcept; | |
|
39 | bool isInside(const SqpDateTime &dateTime) const noexcept; | |||
39 |
|
40 | |||
40 | public slots: |
|
41 | public slots: | |
41 | void setDataSeries(std::shared_ptr<IDataSeries> dataSeries) noexcept; |
|
42 | void setDataSeries(std::shared_ptr<IDataSeries> dataSeries) noexcept; |
@@ -78,12 +78,17 IDataSeries *Variable::dataSeries() const noexcept | |||||
78 | return impl->m_DataSeries.get(); |
|
78 | return impl->m_DataSeries.get(); | |
79 | } |
|
79 | } | |
80 |
|
80 | |||
81 | bool Variable::contains(const SqpDateTime &dateTime) |
|
81 | bool Variable::contains(const SqpDateTime &dateTime) const noexcept | |
82 | { |
|
82 | { | |
83 | return impl->m_DateTime.contains(dateTime); |
|
83 | return impl->m_DateTime.contains(dateTime); | |
84 | } |
|
84 | } | |
85 |
|
85 | |||
86 | bool Variable::intersect(const SqpDateTime &dateTime) |
|
86 | bool Variable::intersect(const SqpDateTime &dateTime) const noexcept | |
87 | { |
|
87 | { | |
88 | return impl->m_DateTime.intersect(dateTime); |
|
88 | return impl->m_DateTime.intersect(dateTime); | |
89 | } |
|
89 | } | |
|
90 | ||||
|
91 | bool Variable::isInside(const SqpDateTime &dateTime) const noexcept | |||
|
92 | { | |||
|
93 | return dateTime.contains(SqpDateTime{impl->m_DateTime.m_TStart, impl->m_DateTime.m_TEnd}); | |||
|
94 | } |
@@ -104,8 +104,16 void VariableController::createVariable(const QString &name, | |||||
104 |
|
104 | |||
105 | // store the provider |
|
105 | // store the provider | |
106 | impl->m_VariableToProviderMap[newVariable] = provider; |
|
106 | impl->m_VariableToProviderMap[newVariable] = provider; | |
107 | connect(provider.get(), &IDataProvider::dataProvided, newVariable.get(), |
|
107 | ||
108 | &Variable::setDataSeries); |
|
108 | auto addDateTimeAcquired | |
|
109 | = [this, newVariable](auto dataSeriesAcquired, auto dateTimeToPutInCache) { | |||
|
110 | ||||
|
111 | impl->m_VariableCacheController->addDateTime(newVariable, dateTimeToPutInCache); | |||
|
112 | newVariable->setDataSeries(dataSeriesAcquired); | |||
|
113 | ||||
|
114 | }; | |||
|
115 | ||||
|
116 | connect(provider.get(), &IDataProvider::dataProvided, addDateTimeAcquired); | |||
109 |
|
117 | |||
110 |
|
118 | |||
111 | // store in cache |
|
119 | // store in cache | |
@@ -144,8 +152,6 void VariableController::onRequestDataLoading(std::shared_ptr<Variable> variable | |||||
144 | // Ask the provider for each data on the dateTimeListNotInCache |
|
152 | // Ask the provider for each data on the dateTimeListNotInCache | |
145 | impl->m_VariableToProviderMap.at(variable)->requestDataLoading( |
|
153 | impl->m_VariableToProviderMap.at(variable)->requestDataLoading( | |
146 | std::move(dateTimeListNotInCache)); |
|
154 | std::move(dateTimeListNotInCache)); | |
147 | // store in cache |
|
|||
148 | impl->m_VariableCacheController->addDateTime(variable, dateTime); |
|
|||
149 | } |
|
155 | } | |
150 | else { |
|
156 | else { | |
151 | emit variable->updated(); |
|
157 | emit variable->updated(); |
@@ -42,7 +42,6 void updateScalarData(QCPAbstractPlottable *component, ScalarSeries &scalarSerie | |||||
42 | const auto &valuesData = scalarSeries.valuesData()->data(); |
|
42 | const auto &valuesData = scalarSeries.valuesData()->data(); | |
43 | const auto count = xData.count(); |
|
43 | const auto count = xData.count(); | |
44 | qCInfo(LOG_VisualizationGraphHelper()) << "TORM: Current points in cache" << xData.count(); |
|
44 | qCInfo(LOG_VisualizationGraphHelper()) << "TORM: Current points in cache" << xData.count(); | |
45 |
|
||||
46 | auto xValue = QVector<double>(count); |
|
45 | auto xValue = QVector<double>(count); | |
47 | auto vValue = QVector<double>(count); |
|
46 | auto vValue = QVector<double>(count); | |
48 |
|
47 | |||
@@ -65,7 +64,6 void updateScalarData(QCPAbstractPlottable *component, ScalarSeries &scalarSerie | |||||
65 | qcpGraph->setData(xValue, vValue); |
|
64 | qcpGraph->setData(xValue, vValue); | |
66 |
|
65 | |||
67 | // Display all data |
|
66 | // Display all data | |
68 | // component->parentPlot()->xAxis->setRange(dateTime.m_TStart, dateTime.m_TEnd); |
|
|||
69 | component->rescaleAxes(); |
|
67 | component->rescaleAxes(); | |
70 | component->parentPlot()->replot(); |
|
68 | component->parentPlot()->replot(); | |
71 | } |
|
69 | } |
@@ -177,9 +177,10 void VisualizationGraphWidget::onRangeChanged(const QCPRange &t1) | |||||
177 | if (!variable->contains(dateTime)) { |
|
177 | if (!variable->contains(dateTime)) { | |
178 |
|
178 | |||
179 | auto variableDateTimeWithTolerance = dateTime; |
|
179 | auto variableDateTimeWithTolerance = dateTime; | |
180 |
if (variable->in |
|
180 | if (!variable->isInside(dateTime)) { | |
181 | auto variableDateTime = variable->dateTime(); |
|
181 | auto variableDateTime = variable->dateTime(); | |
182 | if (variableDateTime.m_TStart < dateTime.m_TStart) { |
|
182 | if (variableDateTime.m_TStart < dateTime.m_TStart) { | |
|
183 | qCDebug(LOG_VisualizationGraphWidget()) << tr("TDetection pan to right:"); | |||
183 |
|
184 | |||
184 | auto diffEndToKeepDelta = dateTime.m_TEnd - variableDateTime.m_TEnd; |
|
185 | auto diffEndToKeepDelta = dateTime.m_TEnd - variableDateTime.m_TEnd; | |
185 | dateTime.m_TStart = variableDateTime.m_TStart + diffEndToKeepDelta; |
|
186 | dateTime.m_TStart = variableDateTime.m_TStart + diffEndToKeepDelta; | |
@@ -188,7 +189,8 void VisualizationGraphWidget::onRangeChanged(const QCPRange &t1) | |||||
188 | auto tolerance = 0.1 * (dateTime.m_TEnd - dateTime.m_TStart); |
|
189 | auto tolerance = 0.1 * (dateTime.m_TEnd - dateTime.m_TStart); | |
189 | variableDateTimeWithTolerance.m_TEnd += tolerance; |
|
190 | variableDateTimeWithTolerance.m_TEnd += tolerance; | |
190 | } |
|
191 | } | |
191 | if (variableDateTime.m_TEnd > dateTime.m_TEnd) { |
|
192 | else if (variableDateTime.m_TEnd > dateTime.m_TEnd) { | |
|
193 | qCDebug(LOG_VisualizationGraphWidget()) << tr("Detection pan to left: "); | |||
192 | auto diffStartToKeepDelta = variableDateTime.m_TStart - dateTime.m_TStart; |
|
194 | auto diffStartToKeepDelta = variableDateTime.m_TStart - dateTime.m_TStart; | |
193 | dateTime.m_TEnd = variableDateTime.m_TEnd - diffStartToKeepDelta; |
|
195 | dateTime.m_TEnd = variableDateTime.m_TEnd - diffStartToKeepDelta; | |
194 | // Tolerance have to be added to the left |
|
196 | // Tolerance have to be added to the left | |
@@ -196,8 +198,13 void VisualizationGraphWidget::onRangeChanged(const QCPRange &t1) | |||||
196 | auto tolerance = 0.1 * (dateTime.m_TEnd - dateTime.m_TStart); |
|
198 | auto tolerance = 0.1 * (dateTime.m_TEnd - dateTime.m_TStart); | |
197 | variableDateTimeWithTolerance.m_TStart -= tolerance; |
|
199 | variableDateTimeWithTolerance.m_TStart -= tolerance; | |
198 | } |
|
200 | } | |
|
201 | else { | |||
|
202 | qCWarning(LOG_VisualizationGraphWidget()) | |||
|
203 | << tr("Detection anormal zoom detection: "); | |||
|
204 | } | |||
199 | } |
|
205 | } | |
200 | else { |
|
206 | else { | |
|
207 | qCDebug(LOG_VisualizationGraphWidget()) << tr("Detection zoom out: "); | |||
201 | // add 10% tolerance for each side |
|
208 | // add 10% tolerance for each side | |
202 | auto tolerance = 0.1 * (dateTime.m_TEnd - dateTime.m_TStart); |
|
209 | auto tolerance = 0.1 * (dateTime.m_TEnd - dateTime.m_TStart); | |
203 | variableDateTimeWithTolerance.m_TStart -= tolerance; |
|
210 | variableDateTimeWithTolerance.m_TStart -= tolerance; | |
@@ -208,6 +215,9 void VisualizationGraphWidget::onRangeChanged(const QCPRange &t1) | |||||
208 | // CHangement detected, we need to ask controller to request data loading |
|
215 | // CHangement detected, we need to ask controller to request data loading | |
209 | emit requestDataLoading(variable, variableDateTimeWithTolerance); |
|
216 | emit requestDataLoading(variable, variableDateTimeWithTolerance); | |
210 | } |
|
217 | } | |
|
218 | else { | |||
|
219 | qCDebug(LOG_VisualizationGraphWidget()) << tr("Detection zoom in: "); | |||
|
220 | } | |||
211 | } |
|
221 | } | |
212 | } |
|
222 | } | |
213 |
|
223 |
General Comments 2
Pull request updated. Auto status change to "Under Review"
Changed commits: * 3 added * 0 removed Changed files: * M core/include/Data/SqpDateTime.h * M core/include/Variable/Variable.h * M core/include/Variable/VariableModel.h * M core/src/Variable/Variable.cpp * M core/src/Variable/VariableCacheController.cpp * M core/src/Variable/VariableController.cpp * M core/src/Variable/VariableModel.cpp * M gui/include/Visualization/VisualizationGraphWidget.h * M gui/src/Visualization/VisualizationGraphHelper.cpp * M gui/src/Visualization/VisualizationGraphWidget.cpp * M gui/src/Visualization/operations/GenerateVariableMenuOperation.cpp * R COPYING * R app/src/MainWindow.cpp * R app/ui/MainWindow.ui * R cmake/sciqlop_package_qt.cmake * R core/include/Common/MetaTypes.h * R core/include/Data/ArrayData.h * R core/include/Data/DataProviderParameters.h * R core/include/Data/DataSeries.h * R core/include/Data/IDataProvider.h * R core/include/Data/IDataSeries.h * R core/include/Data/ScalarSeries.h * R core/include/DataSource/DataSourceItemAction.h * R core/include/Plugin/PluginManager.h * R core/include/Time/TimeController.h * R core/include/Variable/VariableCacheController.h * R core/include/Variable/VariableController.h * R core/include/Visualization/VisualizationController.h * R core/src/Data/ScalarSeries.cpp * R core/src/DataSource/DataSourceItemAction.cpp * R core/src/Plugin/PluginManager.cpp * R core/src/Time/TimeController.cpp * R core/src/Visualization/VisualizationController.cpp * R core/tests/Variable/TestVariableCacheController.cpp * R gui/include/DataSource/DataSourceTreeWidgetItem.h * R gui/include/DataSource/DataSourceWidget.h * R gui/include/SidePane/SqpSidePane.h * R gui/include/TimeWidget/TimeWidget.h * R gui/include/Variable/VariableInspectorWidget.h * R gui/include/Variable/VariableMenuHeaderWidget.h * R gui/include/Visualization/IVariableContainer.h * R gui/include/Visualization/IVisualizationWidget.h * R gui/include/Visualization/IVisualizationWidgetVisitor.h * R gui/include/Visualization/VisualizationGraphHelper.h * R gui/include/Visualization/VisualizationTabWidget.h * R gui/include/Visualization/VisualizationWidget.h * R gui/include/Visualization/VisualizationZoneWidget.h * R gui/include/Visualization/operations/GenerateVariableMenuOperation.h * R gui/include/Visualization/operations/MenuBuilder.h * R gui/include/Visualization/qcustomplot.h * R gui/resources/icones/delete.png * R gui/resources/icones/next.png * R gui/resources/icones/openInspector.png * R gui/resources/icones/previous.png * R gui/resources/icones/sciqlop2PNG_1024.png * R gui/resources/sqpguiresources.qrc * R gui/src/DataSource/DataSourceTreeWidgetItem.cpp * R gui/src/DataSource/DataSourceWidget.cpp * R gui/src/SidePane/SqpSidePane.cpp * R gui/src/TimeWidget/TimeWidget.cpp * R gui/src/Variable/VariableInspectorWidget.cpp * R gui/src/Variable/VariableMenuHeaderWidget.cpp * R gui/src/Visualization/VisualizationTabWidget.cpp * R gui/src/Visualization/VisualizationWidget.cpp * R gui/src/Visualization/VisualizationZoneWidget.cpp * R gui/src/Visualization/operations/MenuBuilder.cpp * R gui/src/Visualization/qcustomplot.cpp * R gui/ui/DataSource/DataSourceWidget.ui * R gui/ui/SidePane/SqpSidePane.ui * R gui/ui/TimeWidget/TimeWidget.ui * R gui/ui/Variable/VariableInspectorWidget.ui * R gui/ui/Variable/VariableMenuHeaderWidget.ui * R gui/ui/Visualization/VisualizationGraphWidget.ui * R gui/ui/Visualization/VisualizationTabWidget.ui * R gui/ui/Visualization/VisualizationWidget.ui * R gui/ui/Visualization/VisualizationZoneWidget.ui * R gui/vera-exclusions/exclusions.txt * R plugin/CMakeLists.txt * R plugin/cmake/Findsciqlop-plugin.cmake * R plugin/include/Plugin/IPlugin.h * R plugins/mockplugin/CMakeLists.txt * R plugins/mockplugin/cmake/Findsciqlop-mockplugin.cmake * R plugins/mockplugin/include/CosinusProvider.h * R plugins/mockplugin/include/MockPlugin.h * R plugins/mockplugin/resources/mockplugin.json * R plugins/mockplugin/src/CosinusProvider.cpp * R plugins/mockplugin/src/MockPlugin.cpp * R README.md * R app/CMakeLists.txt * R app/include/MainWindow.h * R app/src/Main.cpp * R app/vera-exclusions/exclusions.txt * R cmake/sciqlop.cmake * R cmake/sciqlop_applications.cmake * R cmake/sciqlop_package.cmake * R cmake/sciqlop_params.cmake * R core/CMakeLists.txt * R core/include/Common/spimpl.h * R core/include/DataSource/DataSourceController.h * R core/include/DataSource/DataSourceItem.h * R core/src/DataSource/DataSourceController.cpp * R core/src/DataSource/DataSourceItem.cpp * R core/tests/DataSource/TestDataSourceController.cpp * R core/vera-exclusions/exclusions.txt * R formatting/cmake/use_clangformat.cmake * R formatting/vera-exclusions/exclusions.txt * R gui/CMakeLists.txt * R gui/include/SqpApplication.h * R gui/src/SqpApplication.cpp * R LICENSE * R app/src/mainwindow.cpp * R app/src/mainwindow.ui
You need to be logged in to leave comments.
Login now