##// END OF EJS Templates
Merge pull request 240 from SCIQLOP-Initialisation develop...
perrinel -
r638:75b3f966c96e merge
parent child
Show More
@@ -158,10 +158,13 QVariant VariableModel::data(const QModelIndex &index, int role) const
158 /// that contains the time value to display
158 /// that contains the time value to display
159 auto dateTimeVariant = [variable](const auto &getValueFun) {
159 auto dateTimeVariant = [variable](const auto &getValueFun) {
160 if (auto dataSeries = variable->dataSeries()) {
160 if (auto dataSeries = variable->dataSeries()) {
161 dataSeries->lockRead();
161 auto it = getValueFun(*dataSeries);
162 auto it = getValueFun(*dataSeries);
162 return (it != dataSeries->cend())
163 auto resVariant = (it != dataSeries->cend())
163 ? DateUtils::dateTime(it->x()).toString(DATETIME_FORMAT)
164 ? DateUtils::dateTime(it->x()).toString(DATETIME_FORMAT)
164 : QVariant{};
165 : QVariant{};
166 dataSeries->unlock();
167 return resVariant;
165 }
168 }
166 else {
169 else {
167 return QVariant{};
170 return QVariant{};
@@ -1,12 +1,12
1
1
2
2
3 tests = [
3 tests = [
4 [['Data/TestDataSeries.cpp'],['test_data'],['DataSeries test']],
4 [['Data/TestDataSeries.cpp'],'test_data','DataSeries test'],
5 [['Data/TestOneDimArrayData.cpp'],['test_1d'],['One Dim Array test']],
5 [['Data/TestOneDimArrayData.cpp'],'test_1d','One Dim Array test'],
6 [['Data/TestTwoDimArrayData.cpp'],['test_2d'],['Two Dim Array test']],
6 [['Data/TestTwoDimArrayData.cpp'],'test_2d','Two Dim Array test'],
7 [['DataSource/TestDataSourceController.cpp'],['test_data_source'],['DataSourceController test']],
7 [['DataSource/TestDataSourceController.cpp'],'test_data_source','DataSourceController test'],
8 [['Variable/TestVariableCacheController.cpp'],['test_variable_cache'],['VariableCacheController test']],
8 [['Variable/TestVariableCacheController.cpp'],'test_variable_cache','VariableCacheController test'],
9 [['Variable/TestVariable.cpp'],['test_variable'],['Variable test']]
9 [['Variable/TestVariable.cpp'],'test_variable','Variable test']
10 ]
10 ]
11
11
12 foreach unit_test : tests
12 foreach unit_test : tests
@@ -15,6 +15,6 foreach unit_test : tests
15 link_with : sciqlop_core,
15 link_with : sciqlop_core,
16 include_directories : core_inc,
16 include_directories : core_inc,
17 dependencies : [qt5core, qt5widgets, qt5network,qt5test])
17 dependencies : [qt5core, qt5widgets, qt5network,qt5test])
18 test(unit_test[2], test_exe)
18 test(unit_test[2], test_exe, args: ['-teamcity', '-o', '@0@.teamcity.txt'.format(unit_test[1])])
19 endforeach
19 endforeach
20
20
@@ -38,7 +38,7 QSharedPointer<QCPAxisTicker> axisTicker(bool isTimeAxis)
38 }
38 }
39 }
39 }
40
40
41 /// Sets axes properties according to the properties of a data series
41 /// Sets axes properties according to the properties of a data series. Not thread safe
42 template <int Dim>
42 template <int Dim>
43 void setAxesProperties(const DataSeries<Dim> &dataSeries, QCustomPlot &plot) noexcept
43 void setAxesProperties(const DataSeries<Dim> &dataSeries, QCustomPlot &plot) noexcept
44 {
44 {
@@ -85,7 +85,9 struct PlottablesCreator<T,
85 PlottablesMap result{};
85 PlottablesMap result{};
86
86
87 // Gets the number of components of the data series
87 // Gets the number of components of the data series
88 dataSeries.lockRead();
88 auto componentCount = dataSeries.valuesData()->componentCount();
89 auto componentCount = dataSeries.valuesData()->componentCount();
90 dataSeries.unlock();
89
91
90 auto colors = ColorUtils::colors(Qt::blue, Qt::red, componentCount);
92 auto colors = ColorUtils::colors(Qt::blue, Qt::red, componentCount);
91
93
@@ -98,7 +100,9 struct PlottablesCreator<T,
98 }
100 }
99
101
100 // Axes properties
102 // Axes properties
103 dataSeries.lockRead();
101 setAxesProperties(dataSeries, plot);
104 setAxesProperties(dataSeries, plot);
105 dataSeries.unlock();
102
106
103 plot.replot();
107 plot.replot();
104
108
@@ -133,7 +137,6 struct PlottablesUpdater<T,
133 static void updatePlottables(T &dataSeries, PlottablesMap &plottables, const SqpRange &range,
137 static void updatePlottables(T &dataSeries, PlottablesMap &plottables, const SqpRange &range,
134 bool rescaleAxes)
138 bool rescaleAxes)
135 {
139 {
136 dataSeries.lockRead();
137
140
138 // For each plottable to update, resets its data
141 // For each plottable to update, resets its data
139 std::map<int, QSharedPointer<SqpDataContainer> > dataContainers{};
142 std::map<int, QSharedPointer<SqpDataContainer> > dataContainers{};
@@ -145,6 +148,7 struct PlottablesUpdater<T,
145 dataContainers.insert({plottable.first, dataContainer});
148 dataContainers.insert({plottable.first, dataContainer});
146 }
149 }
147 }
150 }
151 dataSeries.lockRead();
148
152
149 // - Gets the data of the series included in the current range
153 // - Gets the data of the series included in the current range
150 // - Updates each plottable by adding, for each data item, a point that takes x-axis data
154 // - Updates each plottable by adding, for each data item, a point that takes x-axis data
@@ -192,7 +192,9 VisualizationGraphWidget *VisualizationZoneWidget::createGraph(std::shared_ptr<V
192
192
193 // get y using variable range
193 // get y using variable range
194 if (auto dataSeries = variable->dataSeries()) {
194 if (auto dataSeries = variable->dataSeries()) {
195 auto valuesBounds = dataSeries->valuesBounds(range.m_TStart, range.m_TEnd);
195 dataSeries->lockRead();
196 auto valuesBounds
197 = dataSeries->valuesBounds(variable->range().m_TStart, variable->range().m_TEnd);
196 auto end = dataSeries->cend();
198 auto end = dataSeries->cend();
197 if (valuesBounds.first != end && valuesBounds.second != end) {
199 if (valuesBounds.first != end && valuesBounds.second != end) {
198 auto rangeValue = [](const auto &value) { return std::isnan(value) ? 0. : value; };
200 auto rangeValue = [](const auto &value) { return std::isnan(value) ? 0. : value; };
@@ -202,6 +204,7 VisualizationGraphWidget *VisualizationZoneWidget::createGraph(std::shared_ptr<V
202
204
203 graphWidget->setYRange(SqpRange{minValue, maxValue});
205 graphWidget->setYRange(SqpRange{minValue, maxValue});
204 }
206 }
207 dataSeries->unlock();
205 }
208 }
206
209
207 return graphWidget;
210 return graphWidget;
@@ -30,7 +30,6 cppcheck = find_program('cppcheck', required : false)
30 if cppcheck.found()
30 if cppcheck.found()
31 run_target('cppcheck',
31 run_target('cppcheck',
32 command : [cppcheck, '--enable=all',
32 command : [cppcheck, '--enable=all',
33 '--project=' + join_paths(meson.build_root(), 'compile_commands.json')],
33 '--project=' + join_paths(meson.build_root(), 'compile_commands.json')]
34 build_by_default : true
35 )
34 )
36 endif
35 endif
@@ -45,9 +45,9 sciqlop_amdaplugin = library('amdaplugin',
45
45
46
46
47 tests = [
47 tests = [
48 [['tests/TestAmdaParser.cpp'],['test_amda_parser'],['AMDA parser test']],
48 [['tests/TestAmdaParser.cpp'],'test_amda_parser','AMDA parser test'],
49 [['tests/TestAmdaResultParser.cpp'],['test_amda_result_parser'],['AMDA result parser test']],
49 [['tests/TestAmdaResultParser.cpp'],'test_amda_result_parser','AMDA result parser test'],
50 [['tests/TestAmdaAcquisition.cpp'],['test_amda_acquisition'],['AMDA Acquisition test']]
50 [['tests/TestAmdaAcquisition.cpp'],'test_amda_acquisition','AMDA Acquisition test']
51 ]
51 ]
52
52
53 foreach unit_test : tests
53 foreach unit_test : tests
@@ -57,5 +57,5 foreach unit_test : tests
57 include_directories : [core_inc, amdaplugin_inc, gui_inc],
57 include_directories : [core_inc, amdaplugin_inc, gui_inc],
58 cpp_args : ['-DAMDA_TESTS_RESOURCES_DIR="'+meson.current_source_dir()+'/tests-resources"'],
58 cpp_args : ['-DAMDA_TESTS_RESOURCES_DIR="'+meson.current_source_dir()+'/tests-resources"'],
59 dependencies : [qt5core, qt5widgets, qt5network,qt5test])
59 dependencies : [qt5core, qt5widgets, qt5network,qt5test])
60 test(unit_test[2], test_exe,timeout: 3 * 60)
60 test(unit_test[2], test_exe, args: ['-teamcity', '-o', '@0@.teamcity.txt'.format(unit_test[1])], timeout: 3 * 60)
61 endforeach
61 endforeach
@@ -18,7 +18,7 std::shared_ptr<IDataSeries> CosinusProvider::retrieveData(QUuid acqIdentifier,
18 auto dataIndex = 0;
18 auto dataIndex = 0;
19
19
20 // Gets the timerange from the parameters
20 // Gets the timerange from the parameters
21 double freq = 100.0;
21 double freq = 1.0;
22 double start = std::ceil(dataRangeRequested.m_TStart * freq); // 100 htz
22 double start = std::ceil(dataRangeRequested.m_TStart * freq); // 100 htz
23 double end = std::floor(dataRangeRequested.m_TEnd * freq); // 100 htz
23 double end = std::floor(dataRangeRequested.m_TEnd * freq); // 100 htz
24
24
General Comments 0
You need to be logged in to leave comments. Login now