Auto status change to "Under Review"
@@ -65,9 +65,11 int main(int argc, char *argv[]) | |||
|
65 | 65 | |
|
66 | 66 | #if __GNUC__ |
|
67 | 67 | #if __x86_64__ || __ppc64__ |
|
68 |
pluginDir.cd("../lib64/SciQlop") |
|
|
68 | if (!pluginDir.cd("../lib64/SciQlop")) { | |
|
69 | pluginDir.cd("../lib64/sciqlop"); | |
|
70 | } | |
|
69 | 71 | #else |
|
70 | pluginDir.cd("../lib/SciQlop"); | |
|
72 | __x86_64__ || __ppc64__ if (!pluginDir.cd("../lib/SciQlop")) { pluginDir.cd("../lib/sciqlop"); } | |
|
71 | 73 | #endif |
|
72 | 74 | #endif |
|
73 | 75 | qCDebug(LOG_PluginManager()) |
@@ -15,6 +15,11 struct SqpDateTime { | |||
|
15 | 15 | { |
|
16 | 16 | return (m_TStart <= dateTime.m_TStart && m_TEnd >= dateTime.m_TEnd); |
|
17 | 17 | } |
|
18 | ||
|
19 | bool intersect(const SqpDateTime &dateTime) | |
|
20 | { | |
|
21 | return (m_TEnd >= dateTime.m_TStart && m_TStart <= dateTime.m_TEnd); | |
|
22 | } | |
|
18 | 23 | }; |
|
19 | 24 | |
|
20 | 25 | // Required for using shared_ptr in signals/slots |
@@ -29,11 +29,13 public: | |||
|
29 | 29 | QString mission() const noexcept; |
|
30 | 30 | QString unit() const noexcept; |
|
31 | 31 | SqpDateTime dateTime() const noexcept; |
|
32 | void setDateTime(const SqpDateTime &dateTime) noexcept; | |
|
32 | 33 | |
|
33 | 34 | /// @return the data of the variable, nullptr if there is no data |
|
34 | 35 | IDataSeries *dataSeries() const noexcept; |
|
35 | 36 | |
|
36 | 37 | bool contains(const SqpDateTime &dateTime); |
|
38 | bool intersect(const SqpDateTime &dateTime); | |
|
37 | 39 | void setDataSeries(std::unique_ptr<IDataSeries> dataSeries) noexcept; |
|
38 | 40 | |
|
39 | 41 | public slots: |
@@ -50,6 +50,11 SqpDateTime Variable::dateTime() const noexcept | |||
|
50 | 50 | return impl->m_DateTime; |
|
51 | 51 | } |
|
52 | 52 | |
|
53 | void Variable::setDateTime(const SqpDateTime &dateTime) noexcept | |
|
54 | { | |
|
55 | impl->m_DateTime = dateTime; | |
|
56 | } | |
|
57 | ||
|
53 | 58 | void Variable::setDataSeries(std::unique_ptr<IDataSeries> dataSeries) noexcept |
|
54 | 59 | { |
|
55 | 60 | if (!impl->m_DataSeries) { |
@@ -73,17 +78,10 IDataSeries *Variable::dataSeries() const noexcept | |||
|
73 | 78 | |
|
74 | 79 | bool Variable::contains(const SqpDateTime &dateTime) |
|
75 | 80 | { |
|
76 |
|
|
|
77 | // The current variable dateTime isn't enough to display the dateTime requested. | |
|
78 | // We have to update it to the new dateTime requested. | |
|
79 | // the correspondant new data to display will be given by the cache if possible and the | |
|
80 | // provider if necessary. | |
|
81 | qCInfo(LOG_Variable()) << "NEW DATE NEEDED"; | |
|
82 | ||
|
83 | impl->m_DateTime = dateTime; | |
|
84 | ||
|
85 | return false; | |
|
81 | return impl->m_DateTime.contains(dateTime); | |
|
86 | 82 | } |
|
87 | 83 | |
|
88 | return true; | |
|
84 | bool Variable::intersect(const SqpDateTime &dateTime) | |
|
85 | { | |
|
86 | return impl->m_DateTime.intersect(dateTime); | |
|
89 | 87 | } |
@@ -111,14 +111,44 void VisualizationGraphWidget::onRangeChanged(const QCPRange &t1, const QCPRange | |||
|
111 | 111 | |
|
112 | 112 | for (auto it = impl->m_VariableToPlotMultiMap.cbegin(); |
|
113 | 113 | it != impl->m_VariableToPlotMultiMap.cend(); ++it) { |
|
114 | auto variable = it->first; | |
|
115 | auto tolerance = 0.1 * (t2.upper - t2.lower); | |
|
116 | auto dateTime = SqpDateTime{t2.lower - tolerance, t2.upper + tolerance}; | |
|
117 | 114 | |
|
118 | qCInfo(LOG_VisualizationGraphWidget()) << tr("VisualizationGraphWidget::onRangeChanged") | |
|
115 | auto variable = it->first; | |
|
116 | qCInfo(LOG_VisualizationGraphWidget()) | |
|
117 | << tr("TORM: VisualizationGraphWidget::onRangeChanged") | |
|
119 | 118 |
|
|
119 | auto dateTime = SqpDateTime{t2.lower, t2.upper}; | |
|
120 | ||
|
120 | 121 | if (!variable->contains(dateTime)) { |
|
121 | sqpApp->variableController().requestDataLoading(variable, dateTime); | |
|
122 | ||
|
123 | auto variableDateTimeWithTolerance = dateTime; | |
|
124 | if (variable->intersect(dateTime)) { | |
|
125 | auto variableDateTime = variable->dateTime(); | |
|
126 | if (variableDateTime.m_TStart < dateTime.m_TStart) { | |
|
127 | dateTime.m_TStart = variableDateTime.m_TStart; | |
|
128 | // START is set to the old one. tolerance have to be added to the right | |
|
129 | // add 10% tolerance for right (end) side | |
|
130 | auto tolerance = 0.1 * (dateTime.m_TEnd - dateTime.m_TStart); | |
|
131 | variableDateTimeWithTolerance.m_TEnd += tolerance; | |
|
132 | } | |
|
133 | if (variableDateTime.m_TEnd > dateTime.m_TEnd) { | |
|
134 | dateTime.m_TEnd = variableDateTime.m_TEnd; | |
|
135 | // END is set to the old one. tolerance have to be added to the left | |
|
136 | // add 10% tolerance for left (start) side | |
|
137 | auto tolerance = 0.1 * (dateTime.m_TEnd - dateTime.m_TStart); | |
|
138 | variableDateTimeWithTolerance.m_TStart -= tolerance; | |
|
139 | } | |
|
140 | } | |
|
141 | else { | |
|
142 | // add 10% tolerance for each side | |
|
143 | auto tolerance = 0.1 * (dateTime.m_TEnd - dateTime.m_TStart); | |
|
144 | variableDateTimeWithTolerance.m_TStart -= tolerance; | |
|
145 | variableDateTimeWithTolerance.m_TEnd += tolerance; | |
|
146 | } | |
|
147 | variable->setDateTime(dateTime); | |
|
148 | ||
|
149 | // CHangement detected, we need to ask controller to request data loading | |
|
150 | sqpApp->variableController().requestDataLoading(variable, | |
|
151 | variableDateTimeWithTolerance); | |
|
122 | 152 | } |
|
123 | 153 | } |
|
124 | 154 | } |
@@ -127,7 +157,8 void VisualizationGraphWidget::onMouseWheel(QWheelEvent *event) noexcept | |||
|
127 | 157 | { |
|
128 | 158 | auto zoomOrientations = QFlags<Qt::Orientation>{}; |
|
129 | 159 | |
|
130 |
// Lambda that enables a zoom orientation if the key modifier related to this orientation |
|
|
160 | // Lambda that enables a zoom orientation if the key modifier related to this orientation | |
|
161 | // has | |
|
131 | 162 | // been pressed |
|
132 | 163 | auto enableOrientation |
|
133 | 164 | = [&zoomOrientations, event](const auto &orientation, const auto &modifier) { |
@@ -143,7 +174,8 void VisualizationGraphWidget::onMouseWheel(QWheelEvent *event) noexcept | |||
|
143 | 174 | void VisualizationGraphWidget::onDataCacheVariableUpdated() |
|
144 | 175 | { |
|
145 | 176 | // NOTE: |
|
146 |
// We don't want to call the method for each component of a variable unitarily, but for |
|
|
177 | // We don't want to call the method for each component of a variable unitarily, but for | |
|
178 | // all | |
|
147 | 179 | // its components at once (eg its three components in the case of a vector). |
|
148 | 180 | |
|
149 | 181 | // The unordered_multimap does not do this easily, so the question is whether to: |
General Comments 3
Status change > Approved
You need to be logged in to leave comments.
Login now