##// END OF EJS Templates
Merge pull request 265 from SCIQLOP develop...
leroux -
r722:5b0f9491c554 merge
parent child
Show More
@@ -1,64 +1,63
1
1
2 core_moc_headers = [
2 core_moc_headers = [
3 'include/Data/IDataProvider.h',
3 'include/Data/IDataProvider.h',
4 'include/Data/DataSeriesMergeHelper.h',
5 'include/DataSource/DataSourceController.h',
4 'include/DataSource/DataSourceController.h',
6 'include/DataSource/DataSourceItemAction.h',
5 'include/DataSource/DataSourceItemAction.h',
7 'include/Network/NetworkController.h',
6 'include/Network/NetworkController.h',
8 'include/Time/TimeController.h',
7 'include/Time/TimeController.h',
9 'include/Variable/Variable.h',
8 'include/Variable/Variable.h',
10 'include/Variable/VariableCacheController.h',
9 'include/Variable/VariableCacheController.h',
11 'include/Variable/VariableController.h',
10 'include/Variable/VariableController.h',
12 'include/Variable/VariableAcquisitionWorker.h',
11 'include/Variable/VariableAcquisitionWorker.h',
13 'include/Variable/VariableCacheStrategy.h',
12 'include/Variable/VariableCacheStrategy.h',
14 'include/Variable/VariableSynchronizationGroup.h',
13 'include/Variable/VariableSynchronizationGroup.h',
15 'include/Variable/VariableModel.h',
14 'include/Variable/VariableModel.h',
16 'include/Visualization/VisualizationController.h'
15 'include/Visualization/VisualizationController.h'
17 ]
16 ]
18
17
19
18
20 core_moc_files = qt5.preprocess(moc_headers : core_moc_headers)
19 core_moc_files = qt5.preprocess(moc_headers : core_moc_headers)
21
20
22 core_sources = [
21 core_sources = [
23 'src/Common/DateUtils.cpp',
22 'src/Common/DateUtils.cpp',
24 'src/Common/StringUtils.cpp',
23 'src/Common/StringUtils.cpp',
25 'src/Data/ScalarSeries.cpp',
24 'src/Data/ScalarSeries.cpp',
26 'src/Data/DataSeriesIterator.cpp',
25 'src/Data/DataSeriesIterator.cpp',
27 'src/Data/ArrayDataIterator.cpp',
26 'src/Data/ArrayDataIterator.cpp',
28 'src/Data/VectorSeries.cpp',
27 'src/Data/VectorSeries.cpp',
29 'src/DataSource/DataSourceController.cpp',
28 'src/DataSource/DataSourceController.cpp',
30 'src/DataSource/DataSourceItem.cpp',
29 'src/DataSource/DataSourceItem.cpp',
31 'src/DataSource/DataSourceItemAction.cpp',
30 'src/DataSource/DataSourceItemAction.cpp',
32 'src/Network/NetworkController.cpp',
31 'src/Network/NetworkController.cpp',
33 'src/Plugin/PluginManager.cpp',
32 'src/Plugin/PluginManager.cpp',
34 'src/Settings/SqpSettingsDefs.cpp',
33 'src/Settings/SqpSettingsDefs.cpp',
35 'src/Time/TimeController.cpp',
34 'src/Time/TimeController.cpp',
36 'src/Variable/Variable.cpp',
35 'src/Variable/Variable.cpp',
37 'src/Variable/VariableCacheController.cpp',
36 'src/Variable/VariableCacheController.cpp',
38 'src/Variable/VariableController.cpp',
37 'src/Variable/VariableController.cpp',
39 'src/Variable/VariableAcquisitionWorker.cpp',
38 'src/Variable/VariableAcquisitionWorker.cpp',
40 'src/Variable/VariableCacheStrategy.cpp',
39 'src/Variable/VariableCacheStrategy.cpp',
41 'src/Variable/VariableSynchronizationGroup.cpp',
40 'src/Variable/VariableSynchronizationGroup.cpp',
42 'src/Variable/VariableModel.cpp',
41 'src/Variable/VariableModel.cpp',
43 'src/Visualization/VisualizationController.cpp'
42 'src/Visualization/VisualizationController.cpp'
44 ]
43 ]
45
44
46 core_inc = include_directories(['include', '../plugin/include'])
45 core_inc = include_directories(['include', '../plugin/include'])
47
46
48 sciqlop_core_lib = library('sciqlopcore',
47 sciqlop_core_lib = library('sciqlopcore',
49 core_sources,
48 core_sources,
50 core_moc_files,
49 core_moc_files,
51 cpp_args : '-DCORE_LIB',
50 cpp_args : '-DCORE_LIB',
52 include_directories : core_inc,
51 include_directories : core_inc,
53 dependencies : [qt5core, qt5network],
52 dependencies : [qt5core, qt5network],
54 install : true
53 install : true
55 )
54 )
56
55
57
56
58 sciqlop_core = declare_dependency(link_with : sciqlop_core_lib,
57 sciqlop_core = declare_dependency(link_with : sciqlop_core_lib,
59 include_directories : core_inc,
58 include_directories : core_inc,
60 dependencies : [qt5core, qt5network])
59 dependencies : [qt5core, qt5network])
61
60
62
61
63 subdir('tests')
62 subdir('tests')
64
63
@@ -1,88 +1,86
1 #include "Data/VectorSeries.h"
1 #include "Data/VectorSeries.h"
2
2
3 namespace {
3 namespace {
4
4
5 /**
5 /**
6 * Flatten the three components of a vector to a single QVector that can be passed to an ArrayData
6 * Flatten the three components of a vector to a single QVector that can be passed to an ArrayData
7 *
7 *
8 * Example:
8 * Example:
9 * xValues = {1, 2, 3}
9 * xValues = {1, 2, 3}
10 * yValues = {4, 5, 6}
10 * yValues = {4, 5, 6}
11 * zValues = {7, 8, 9}
11 * zValues = {7, 8, 9}
12 *
12 *
13 * result = {1, 4, 7, 2, 5, 8, 3, 6, 9}
13 * result = {1, 4, 7, 2, 5, 8, 3, 6, 9}
14 *
14 *
15 * @param xValues the x-component values of the vector
15 * @param xValues the x-component values of the vector
16 * @param yValues the y-component values of the vector
16 * @param yValues the y-component values of the vector
17 * @param zValues the z-component values of the vector
17 * @param zValues the z-component values of the vector
18 * @return the single QVector
18 * @return the single QVector
19 * @remarks the three components are consumed
19 * @remarks the three components are consumed
20 * @sa ArrayData
20 * @sa ArrayData
21 */
21 */
22 std::vector<double> flatten(std::vector<double> xValues, std::vector<double> yValues,
22 std::vector<double> flatten(std::vector<double> xValues, std::vector<double> yValues,
23 std::vector<double> zValues)
23 std::vector<double> zValues)
24 {
24 {
25 if (xValues.size() != yValues.size() || xValues.size() != zValues.size()) {
25 if (xValues.size() != yValues.size() || xValues.size() != zValues.size()) {
26 /// @todo ALX : log
26 /// @todo ALX : log
27 return {};
27 return {};
28 }
28 }
29
29
30 auto result = std::vector<double>();
30 auto result = std::vector<double>();
31 result.reserve(xValues.size() * 3);
31 result.reserve(xValues.size() * 3);
32
32 for (int i = 0; i < xValues.size(); i++) {
33 while (!xValues.empty()) {
33 result.push_back(xValues[i]);
34 result.insert(result.cend(), {xValues.front(), yValues.front(), zValues.front()});
34 result.push_back(yValues[i]);
35 xValues.erase(xValues.begin());
35 result.push_back(zValues[i]);
36 yValues.erase(yValues.begin());
36 }
37 zValues.erase(zValues.begin());
38 }
39
37
40 return result;
38 return result;
41 }
39 }
42
40
43 } // namespace
41 } // namespace
44
42
45 VectorSeries::VectorSeries(std::vector<double> xAxisData, std::vector<double> xValuesData,
43 VectorSeries::VectorSeries(std::vector<double> xAxisData, std::vector<double> xValuesData,
46 std::vector<double> yValuesData, std::vector<double> zValuesData,
44 std::vector<double> yValuesData, std::vector<double> zValuesData,
47 const Unit &xAxisUnit, const Unit &valuesUnit)
45 const Unit &xAxisUnit, const Unit &valuesUnit)
48 : VectorSeries{std::move(xAxisData), flatten(std::move(xValuesData), std::move(yValuesData),
46 : VectorSeries{std::move(xAxisData), flatten(std::move(xValuesData), std::move(yValuesData),
49 std::move(zValuesData)),
47 std::move(zValuesData)),
50 xAxisUnit, valuesUnit}
48 xAxisUnit, valuesUnit}
51 {
49 {
52 }
50 }
53
51
54 VectorSeries::VectorSeries(std::vector<double> xAxisData, std::vector<double> valuesData,
52 VectorSeries::VectorSeries(std::vector<double> xAxisData, std::vector<double> valuesData,
55 const Unit &xAxisUnit, const Unit &valuesUnit)
53 const Unit &xAxisUnit, const Unit &valuesUnit)
56 : DataSeries{std::make_shared<ArrayData<1> >(std::move(xAxisData)), xAxisUnit,
54 : DataSeries{std::make_shared<ArrayData<1> >(std::move(xAxisData)), xAxisUnit,
57 std::make_shared<ArrayData<2> >(std::move(valuesData), 3), valuesUnit}
55 std::make_shared<ArrayData<2> >(std::move(valuesData), 3), valuesUnit}
58 {
56 {
59 }
57 }
60
58
61 std::unique_ptr<IDataSeries> VectorSeries::clone() const
59 std::unique_ptr<IDataSeries> VectorSeries::clone() const
62 {
60 {
63 return std::make_unique<VectorSeries>(*this);
61 return std::make_unique<VectorSeries>(*this);
64 }
62 }
65
63
66 std::shared_ptr<IDataSeries> VectorSeries::subDataSeries(const SqpRange &range)
64 std::shared_ptr<IDataSeries> VectorSeries::subDataSeries(const SqpRange &range)
67 {
65 {
68 auto subXAxisData = std::vector<double>();
66 auto subXAxisData = std::vector<double>();
69 auto subXValuesData = std::vector<double>();
67 auto subXValuesData = std::vector<double>();
70 auto subYValuesData = std::vector<double>();
68 auto subYValuesData = std::vector<double>();
71 auto subZValuesData = std::vector<double>();
69 auto subZValuesData = std::vector<double>();
72
70
73 this->lockRead();
71 this->lockRead();
74 {
72 {
75 auto bounds = xAxisRange(range.m_TStart, range.m_TEnd);
73 auto bounds = xAxisRange(range.m_TStart, range.m_TEnd);
76 for (auto it = bounds.first; it != bounds.second; ++it) {
74 for (auto it = bounds.first; it != bounds.second; ++it) {
77 subXAxisData.push_back(it->x());
75 subXAxisData.push_back(it->x());
78 subXValuesData.push_back(it->value(0));
76 subXValuesData.push_back(it->value(0));
79 subYValuesData.push_back(it->value(1));
77 subYValuesData.push_back(it->value(1));
80 subZValuesData.push_back(it->value(2));
78 subZValuesData.push_back(it->value(2));
81 }
79 }
82 }
80 }
83 this->unlock();
81 this->unlock();
84
82
85 return std::make_shared<VectorSeries>(std::move(subXAxisData), std::move(subXValuesData),
83 return std::make_shared<VectorSeries>(std::move(subXAxisData), std::move(subXValuesData),
86 std::move(subYValuesData), std::move(subZValuesData),
84 std::move(subYValuesData), std::move(subZValuesData),
87 this->xAxisUnit(), this->valuesUnit());
85 this->xAxisUnit(), this->valuesUnit());
88 }
86 }
@@ -1,78 +1,78
1
1
2 gui_moc_headers = [
2 gui_moc_headers = [
3 'include/DataSource/DataSourceWidget.h',
3 'include/DataSource/DataSourceWidget.h',
4 'include/Settings/SqpSettingsDialog.h',
4 'include/Settings/SqpSettingsDialog.h',
5 'include/Settings/SqpSettingsGeneralWidget.h',
5 'include/Settings/SqpSettingsGeneralWidget.h',
6 'include/SidePane/SqpSidePane.h',
6 'include/SidePane/SqpSidePane.h',
7 'include/SqpApplication.h',
7 'include/SqpApplication.h',
8 'include/TimeWidget/TimeWidget.h',
8 'include/TimeWidget/TimeWidget.h',
9 'include/Variable/VariableInspectorWidget.h',
9 'include/Variable/VariableInspectorWidget.h',
10 'include/Variable/RenameVariableDialog.h',
10 'include/Variable/RenameVariableDialog.h',
11 'include/Visualization/qcustomplot.h',
11 'include/Visualization/qcustomplot.h',
12 'include/Visualization/VisualizationGraphWidget.h',
12 'include/Visualization/VisualizationGraphWidget.h',
13 'include/Visualization/VisualizationTabWidget.h',
13 'include/Visualization/VisualizationTabWidget.h',
14 'include/Visualization/VisualizationWidget.h',
14 'include/Visualization/VisualizationWidget.h',
15 'include/Visualization/VisualizationZoneWidget.h'
15 'include/Visualization/VisualizationZoneWidget.h'
16 ]
16 ]
17
17
18 gui_ui_files = [
18 gui_ui_files = [
19 'ui/DataSource/DataSourceWidget.ui',
19 'ui/DataSource/DataSourceWidget.ui',
20 'ui/Settings/SqpSettingsDialog.ui',
20 'ui/Settings/SqpSettingsDialog.ui',
21 'ui/Settings/SqpSettingsGeneralWidget.ui',
21 'ui/Settings/SqpSettingsGeneralWidget.ui',
22 'ui/SidePane/SqpSidePane.ui',
22 'ui/SidePane/SqpSidePane.ui',
23 'ui/TimeWidget/TimeWidget.ui',
23 'ui/TimeWidget/TimeWidget.ui',
24 'ui/Variable/VariableInspectorWidget.ui',
24 'ui/Variable/VariableInspectorWidget.ui',
25 'ui/Variable/VariableMenuHeaderWidget.ui',
25 'ui/Variable/VariableMenuHeaderWidget.ui',
26 'ui/Variable/RenameVariableDialog.ui',
26 'ui/Variable/RenameVariableDialog.ui',
27 'ui/Visualization/VisualizationGraphWidget.ui',
27 'ui/Visualization/VisualizationGraphWidget.ui',
28 'ui/Visualization/VisualizationTabWidget.ui',
28 'ui/Visualization/VisualizationTabWidget.ui',
29 'ui/Visualization/VisualizationWidget.ui',
29 'ui/Visualization/VisualizationWidget.ui',
30 'ui/Visualization/VisualizationZoneWidget.ui'
30 'ui/Visualization/VisualizationZoneWidget.ui'
31 ]
31 ]
32
32
33 gui_qresources = ['resources/sqpguiresources.qrc']
33 gui_qresources = ['resources/sqpguiresources.qrc']
34
34
35 gui_moc_files = qt5.preprocess(moc_headers : gui_moc_headers,
35 gui_moc_files = qt5.preprocess(moc_headers : gui_moc_headers,
36 ui_files : gui_ui_files,
36 ui_files : gui_ui_files,
37 qresources : gui_qresources)
37 qresources : gui_qresources)
38
38
39 gui_sources = [
39 gui_sources = [
40 'src/SqpApplication.cpp',
40 'src/SqpApplication.cpp',
41 'src/Common/ColorUtils.cpp',
41 'src/Common/ColorUtils.cpp',
42 'src/DataSource/DataSourceTreeWidgetItem.cpp',
42 'src/DataSource/DataSourceTreeWidgetItem.cpp',
43 'src/DataSource/DataSourceTreeWidgetHelper.cpp',
43 'src/DataSource/DataSourceTreeWidgetHelper.cpp',
44 'src/DataSource/DataSourceWidget.cpp',
44 'src/DataSource/DataSourceWidget.cpp',
45 'src/Settings/SqpSettingsDialog.cpp',
45 'src/Settings/SqpSettingsDialog.cpp',
46 'src/Settings/SqpSettingsGeneralWidget.cpp',
46 'src/Settings/SqpSettingsGeneralWidget.cpp',
47 'src/SidePane/SqpSidePane.cpp',
47 'src/SidePane/SqpSidePane.cpp',
48 'src/TimeWidget/TimeWidget.cpp',
48 'src/TimeWidget/TimeWidget.cpp',
49 'src/Variable/VariableInspectorWidget.cpp',
49 'src/Variable/VariableInspectorWidget.cpp',
50 'src/Variable/VariableMenuHeaderWidget.cpp',
50 'src/Variable/VariableMenuHeaderWidget.cpp',
51 'src/Variable/RenamevariableDialog.cpp',
51 'src/Variable/RenameVariableDialog.cpp',
52 'src/Visualization/VisualizationGraphHelper.cpp',
52 'src/Visualization/VisualizationGraphHelper.cpp',
53 'src/Visualization/VisualizationGraphRenderingDelegate.cpp',
53 'src/Visualization/VisualizationGraphRenderingDelegate.cpp',
54 'src/Visualization/VisualizationGraphWidget.cpp',
54 'src/Visualization/VisualizationGraphWidget.cpp',
55 'src/Visualization/VisualizationTabWidget.cpp',
55 'src/Visualization/VisualizationTabWidget.cpp',
56 'src/Visualization/VisualizationWidget.cpp',
56 'src/Visualization/VisualizationWidget.cpp',
57 'src/Visualization/VisualizationZoneWidget.cpp',
57 'src/Visualization/VisualizationZoneWidget.cpp',
58 'src/Visualization/qcustomplot.cpp',
58 'src/Visualization/qcustomplot.cpp',
59 'src/Visualization/operations/GenerateVariableMenuOperation.cpp',
59 'src/Visualization/operations/GenerateVariableMenuOperation.cpp',
60 'src/Visualization/operations/MenuBuilder.cpp',
60 'src/Visualization/operations/MenuBuilder.cpp',
61 'src/Visualization/operations/RemoveVariableOperation.cpp',
61 'src/Visualization/operations/RemoveVariableOperation.cpp',
62 'src/Visualization/operations/RescaleAxeOperation.cpp'
62 'src/Visualization/operations/RescaleAxeOperation.cpp'
63 ]
63 ]
64
64
65 gui_inc = include_directories(['include'])
65 gui_inc = include_directories(['include'])
66
66
67 sciqlop_gui_lib = library('sciqlopgui',
67 sciqlop_gui_lib = library('sciqlopgui',
68 gui_sources,
68 gui_sources,
69 gui_moc_files,
69 gui_moc_files,
70 include_directories : [gui_inc],
70 include_directories : [gui_inc],
71 dependencies : [ qt5printsupport, qt5gui, qt5widgets, qt5svg, sciqlop_core],
71 dependencies : [ qt5printsupport, qt5gui, qt5widgets, qt5svg, sciqlop_core],
72 install : true
72 install : true
73 )
73 )
74
74
75 sciqlop_gui = declare_dependency(link_with : sciqlop_gui_lib,
75 sciqlop_gui = declare_dependency(link_with : sciqlop_gui_lib,
76 include_directories : gui_inc,
76 include_directories : gui_inc,
77 dependencies : [qt5printsupport, qt5gui, qt5widgets, qt5svg, sciqlop_core])
77 dependencies : [qt5printsupport, qt5gui, qt5widgets, qt5svg, sciqlop_core])
78
78
General Comments 0
You need to be logged in to leave comments. Login now