##// END OF EJS Templates
Implementation of the new Dela T computation strategy
perrinel -
r260:1a61ee1f7b08
parent child
Show More
@@ -65,10 +65,12 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");
71 #endif
72 __x86_64__ || __ppc64__ if (!pluginDir.cd("../lib/SciQlop")) { pluginDir.cd("../lib/sciqlop"); }
73 #endif
72 74 #endif
73 75 qCDebug(LOG_PluginManager())
74 76 << QObject::tr("Plugin directory: %1").arg(pluginDir.absolutePath());
@@ -29,6 +29,7 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;
@@ -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,19 +78,7 IDataSeries *Variable::dataSeries() const noexcept
73 78
74 79 bool Variable::contains(const SqpDateTime &dateTime)
75 80 {
76 if (!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;
81 return impl->m_DateTime.contains(dateTime);
89 82 }
90 83
91 84 bool Variable::intersect(const SqpDateTime &dateTime)
@@ -120,30 +120,35 void VisualizationGraphWidget::onRangeChanged(const QCPRange &t1, const QCPRange
120 120
121 121 if (!variable->contains(dateTime)) {
122 122
123 auto variableDateTimeWithTolerance = dateTime;
123 124 if (variable->intersect(dateTime)) {
124 125 auto variableDateTime = variable->dateTime();
125 126 if (variableDateTime.m_TStart < dateTime.m_TStart) {
126 127 dateTime.m_TStart = variableDateTime.m_TStart;
127 // add 20% tolerance for left (start) side
128 auto tolerance = 0.2 * (dateTime.m_TEnd - dateTime.m_TStart);
129 dateTime.m_TStart -= tolerance;
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;
130 132 }
131
132 133 if (variableDateTime.m_TEnd > dateTime.m_TEnd) {
133 134 dateTime.m_TEnd = variableDateTime.m_TEnd;
134 // add 20% tolerance for right (end) side
135 auto tolerance = 0.2 * (dateTime.m_TEnd - dateTime.m_TStart);
136 dateTime.m_TEnd += tolerance;
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;
137 139 }
138 140 }
139 141 else {
140 142 // add 10% tolerance for each side
141 143 auto tolerance = 0.1 * (dateTime.m_TEnd - dateTime.m_TStart);
142 dateTime.m_TStart -= tolerance;
143 dateTime.m_TEnd += tolerance;
144 variableDateTimeWithTolerance.m_TStart -= tolerance;
145 variableDateTimeWithTolerance.m_TEnd += tolerance;
144 146 }
145 // CHangement detected, we need to
146 sqpApp->variableController().requestDataLoading(variable, dateTime);
147 variable->setDateTime(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 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 162 // been pressed
157 163 auto enableOrientation
158 164 = [&zoomOrientations, event](const auto &orientation, const auto &modifier) {
@@ -168,7 +174,8 void VisualizationGraphWidget::onMouseWheel(QWheelEvent *event) noexcept
168 174 void VisualizationGraphWidget::onDataCacheVariableUpdated()
169 175 {
170 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 179 // its components at once (eg its three components in the case of a vector).
173 180
174 181 // The unordered_multimap does not do this easily, so the question is whether to:
General Comments 0
You need to be logged in to leave comments. Login now