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