@@ -122,6 +122,15 void VisualizationGraphWidget::removeVariable(std::shared_ptr<Variable> variable | |||
|
122 | 122 | ui->widget->replot(); |
|
123 | 123 | } |
|
124 | 124 | |
|
125 | void VisualizationGraphWidget::setRange(std::shared_ptr<Variable> variable, | |
|
126 | const SqpDateTime &range) | |
|
127 | { | |
|
128 | // auto componentsIt = impl->m_VariableToPlotMultiMap.equal_range(variable); | |
|
129 | // for (auto it = componentsIt.first; it != componentsIt.second;) { | |
|
130 | // } | |
|
131 | ui->widget->xAxis->setRange(range.m_TStart, range.m_TEnd); | |
|
132 | } | |
|
133 | ||
|
125 | 134 | void VisualizationGraphWidget::accept(IVisualizationWidgetVisitor *visitor) |
|
126 | 135 | { |
|
127 | 136 | if (visitor) { |
@@ -187,7 +196,8 void VisualizationGraphWidget::onRangeChanged(const QCPRange &t1) | |||
|
187 | 196 | auto dateTime = SqpDateTime{t1.lower, t1.upper}; |
|
188 | 197 | auto dateTimeRange = dateTime; |
|
189 | 198 | |
|
190 | auto tolerance = 0.2 * (dateTime.m_TEnd - dateTime.m_TStart); | |
|
199 | auto toleranceFactor = 0.2; | |
|
200 | auto tolerance = toleranceFactor * (dateTime.m_TEnd - dateTime.m_TStart); | |
|
191 | 201 | auto variableDateTimeWithTolerance = dateTime; |
|
192 | 202 | variableDateTimeWithTolerance.m_TStart -= tolerance; |
|
193 | 203 | variableDateTimeWithTolerance.m_TEnd += tolerance; |
@@ -207,9 +217,8 void VisualizationGraphWidget::onRangeChanged(const QCPRange &t1) | |||
|
207 | 217 | auto diffEndToKeepDelta = dateTime.m_TEnd - variableDateTime.m_TEnd; |
|
208 | 218 | dateTime.m_TStart = variableDateTime.m_TStart + diffEndToKeepDelta; |
|
209 | 219 | // Tolerance have to be added to the right |
|
210 |
// add |
|
|
211 |
|
|
|
212 | // dateTime.m_TStart); | |
|
220 | // add tolerance for right (end) side | |
|
221 | tolerance = toleranceFactor * (dateTime.m_TEnd - dateTime.m_TStart); | |
|
213 | 222 | variableDateTimeWithTolerance.m_TEnd += tolerance; |
|
214 | 223 | } |
|
215 | 224 | else if (variableDateTime.m_TEnd > dateTime.m_TEnd) { |
@@ -217,8 +226,8 void VisualizationGraphWidget::onRangeChanged(const QCPRange &t1) | |||
|
217 | 226 | auto diffStartToKeepDelta = variableDateTime.m_TStart - dateTime.m_TStart; |
|
218 | 227 | dateTime.m_TEnd = variableDateTime.m_TEnd - diffStartToKeepDelta; |
|
219 | 228 | // Tolerance have to be added to the left |
|
220 |
// add |
|
|
221 |
tolerance = |
|
|
229 | // add tolerance for left (start) side | |
|
230 | tolerance = toleranceFactor * (dateTime.m_TEnd - dateTime.m_TStart); | |
|
222 | 231 | variableDateTimeWithTolerance.m_TStart -= tolerance; |
|
223 | 232 | } |
|
224 | 233 | else { |
@@ -234,7 +243,8 void VisualizationGraphWidget::onRangeChanged(const QCPRange &t1) | |||
|
234 | 243 | variableDateTimeWithTolerance.m_TEnd += tolerance; |
|
235 | 244 | } |
|
236 | 245 | if (!variable->contains(dateTimeRange)) { |
|
237 |
qCInfo(LOG_VisualizationGraphWidget()) |
|
|
246 | qCInfo(LOG_VisualizationGraphWidget()) | |
|
247 | << "TORM: Modif on variable datetime detected" << dateTime; | |
|
238 | 248 | variable->setDateTime(dateTime); |
|
239 | 249 | } |
|
240 | 250 | |
@@ -295,17 +305,3 void VisualizationGraphWidget::onDataCacheVariableUpdated() | |||
|
295 | 305 | } |
|
296 | 306 | } |
|
297 | 307 | } |
|
298 | ||
|
299 | void VisualizationGraphWidget::updateDisplay(std::shared_ptr<Variable> variable) | |
|
300 | { | |
|
301 | auto abstractPlotableItPair = impl->m_VariableToPlotMultiMap.equal_range(variable); | |
|
302 | ||
|
303 | auto abstractPlotableVect = QVector<QCPAbstractPlottable *>{}; | |
|
304 | ||
|
305 | for (auto it = abstractPlotableItPair.first; it != abstractPlotableItPair.second; ++it) { | |
|
306 | abstractPlotableVect.push_back(it->second); | |
|
307 | } | |
|
308 | ||
|
309 | VisualizationGraphHelper::updateData(abstractPlotableVect, variable->dataSeries(), | |
|
310 | variable->dateTime()); | |
|
311 | } |
General Comments 0
You need to be logged in to leave comments.
Login now