##// END OF EJS Templates
Implementation of the new Dela T computation strategy
perrinel -
r241:1a61ee1f7b08
parent child
Show More
@@ -65,10 +65,12 int main(int argc, char *argv[])
65
65
66 #if __GNUC__
66 #if __GNUC__
67 #if __x86_64__ || __ppc64__
67 #if __x86_64__ || __ppc64__
68 pluginDir.cd("../lib64/SciQlop");
68 if (!pluginDir.cd("../lib64/SciQlop")) {
69 pluginDir.cd("../lib64/sciqlop");
70 }
69 #else
71 #else
70 pluginDir.cd("../lib/SciQlop");
72 __x86_64__ || __ppc64__ if (!pluginDir.cd("../lib/SciQlop")) { pluginDir.cd("../lib/sciqlop"); }
71 #endif
73 #endif
72 #endif
74 #endif
73 qCDebug(LOG_PluginManager())
75 qCDebug(LOG_PluginManager())
74 << QObject::tr("Plugin directory: %1").arg(pluginDir.absolutePath());
76 << QObject::tr("Plugin directory: %1").arg(pluginDir.absolutePath());
@@ -29,6 +29,7 public:
29 QString mission() const noexcept;
29 QString mission() const noexcept;
30 QString unit() const noexcept;
30 QString unit() const noexcept;
31 SqpDateTime dateTime() const noexcept;
31 SqpDateTime dateTime() const noexcept;
32 void setDateTime(const SqpDateTime &dateTime) noexcept;
32
33
33 /// @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
34 IDataSeries *dataSeries() const noexcept;
35 IDataSeries *dataSeries() const noexcept;
@@ -50,6 +50,11 SqpDateTime Variable::dateTime() const noexcept
50 return impl->m_DateTime;
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 void Variable::setDataSeries(std::unique_ptr<IDataSeries> dataSeries) noexcept
58 void Variable::setDataSeries(std::unique_ptr<IDataSeries> dataSeries) noexcept
54 {
59 {
55 if (!impl->m_DataSeries) {
60 if (!impl->m_DataSeries) {
@@ -73,19 +78,7 IDataSeries *Variable::dataSeries() const noexcept
73
78
74 bool Variable::contains(const SqpDateTime &dateTime)
79 bool Variable::contains(const SqpDateTime &dateTime)
75 {
80 {
76 if (!impl->m_DateTime.contains(dateTime)) {
81 return impl->m_DateTime.contains(dateTime);
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;
86 }
87
88 return true;
89 }
82 }
90
83
91 bool Variable::intersect(const SqpDateTime &dateTime)
84 bool Variable::intersect(const SqpDateTime &dateTime)
@@ -120,30 +120,35 void VisualizationGraphWidget::onRangeChanged(const QCPRange &t1, const QCPRange
120
120
121 if (!variable->contains(dateTime)) {
121 if (!variable->contains(dateTime)) {
122
122
123 auto variableDateTimeWithTolerance = dateTime;
123 if (variable->intersect(dateTime)) {
124 if (variable->intersect(dateTime)) {
124 auto variableDateTime = variable->dateTime();
125 auto variableDateTime = variable->dateTime();
125 if (variableDateTime.m_TStart < dateTime.m_TStart) {
126 if (variableDateTime.m_TStart < dateTime.m_TStart) {
126 dateTime.m_TStart = variableDateTime.m_TStart;
127 dateTime.m_TStart = variableDateTime.m_TStart;
127 // add 20% tolerance for left (start) side
128 // START is set to the old one. tolerance have to be added to the right
128 auto tolerance = 0.2 * (dateTime.m_TEnd - dateTime.m_TStart);
129 // add 10% tolerance for right (end) side
129 dateTime.m_TStart -= tolerance;
130 auto tolerance = 0.1 * (dateTime.m_TEnd - dateTime.m_TStart);
131 variableDateTimeWithTolerance.m_TEnd += tolerance;
130 }
132 }
131
132 if (variableDateTime.m_TEnd > dateTime.m_TEnd) {
133 if (variableDateTime.m_TEnd > dateTime.m_TEnd) {
133 dateTime.m_TEnd = variableDateTime.m_TEnd;
134 dateTime.m_TEnd = variableDateTime.m_TEnd;
134 // add 20% tolerance for right (end) side
135 // END is set to the old one. tolerance have to be added to the left
135 auto tolerance = 0.2 * (dateTime.m_TEnd - dateTime.m_TStart);
136 // add 10% tolerance for left (start) side
136 dateTime.m_TEnd += tolerance;
137 auto tolerance = 0.1 * (dateTime.m_TEnd - dateTime.m_TStart);
138 variableDateTimeWithTolerance.m_TStart -= tolerance;
137 }
139 }
138 }
140 }
139 else {
141 else {
140 // add 10% tolerance for each side
142 // add 10% tolerance for each side
141 auto tolerance = 0.1 * (dateTime.m_TEnd - dateTime.m_TStart);
143 auto tolerance = 0.1 * (dateTime.m_TEnd - dateTime.m_TStart);
142 dateTime.m_TStart -= tolerance;
144 variableDateTimeWithTolerance.m_TStart -= tolerance;
143 dateTime.m_TEnd += tolerance;
145 variableDateTimeWithTolerance.m_TEnd += tolerance;
144 }
146 }
145 // CHangement detected, we need to
147 variable->setDateTime(dateTime);
146 sqpApp->variableController().requestDataLoading(variable, dateTime);
148
149 // CHangement detected, we need to ask controller to request data loading
150 sqpApp->variableController().requestDataLoading(variable,
151 variableDateTimeWithTolerance);
147 }
152 }
148 }
153 }
149 }
154 }
@@ -152,7 +157,8 void VisualizationGraphWidget::onMouseWheel(QWheelEvent *event) noexcept
152 {
157 {
153 auto zoomOrientations = QFlags<Qt::Orientation>{};
158 auto zoomOrientations = QFlags<Qt::Orientation>{};
154
159
155 // Lambda that enables a zoom orientation if the key modifier related to this orientation has
160 // Lambda that enables a zoom orientation if the key modifier related to this orientation
161 // has
156 // been pressed
162 // been pressed
157 auto enableOrientation
163 auto enableOrientation
158 = [&zoomOrientations, event](const auto &orientation, const auto &modifier) {
164 = [&zoomOrientations, event](const auto &orientation, const auto &modifier) {
@@ -168,7 +174,8 void VisualizationGraphWidget::onMouseWheel(QWheelEvent *event) noexcept
168 void VisualizationGraphWidget::onDataCacheVariableUpdated()
174 void VisualizationGraphWidget::onDataCacheVariableUpdated()
169 {
175 {
170 // NOTE:
176 // NOTE:
171 // We don't want to call the method for each component of a variable unitarily, but for all
177 // We don't want to call the method for each component of a variable unitarily, but for
178 // all
172 // its components at once (eg its three components in the case of a vector).
179 // its components at once (eg its three components in the case of a vector).
173
180
174 // The unordered_multimap does not do this easily, so the question is whether to:
181 // The unordered_multimap does not do this easily, so the question is whether to:
General Comments 3
Under Review
author

Auto status change to "Under Review"

Approved
author

Status change > Approved

You need to be logged in to leave comments. Login now