##// END OF EJS Templates
Uses std::shared_ptr
Alexandre Leroux -
r551:221951fe7cca
parent child
Show More
@@ -32,7 +32,7 struct VisualizationGraphHelper {
32 */
32 */
33 static PlottablesMap create(std::shared_ptr<Variable> variable, QCustomPlot &plot) noexcept;
33 static PlottablesMap create(std::shared_ptr<Variable> variable, QCustomPlot &plot) noexcept;
34
34
35 static void updateData(PlottablesMap &plottables, IDataSeries *dataSeries,
35 static void updateData(PlottablesMap &plottables, std::shared_ptr<IDataSeries> dataSeries,
36 const SqpRange &dateTime);
36 const SqpRange &dateTime);
37 };
37 };
38
38
@@ -201,12 +201,12 struct PlottablesHelper : public IPlottablesHelper {
201 };
201 };
202
202
203 /// Creates IPlottablesHelper according to a data series
203 /// Creates IPlottablesHelper according to a data series
204 std::unique_ptr<IPlottablesHelper> createHelper(IDataSeries *dataSeries) noexcept
204 std::unique_ptr<IPlottablesHelper> createHelper(std::shared_ptr<IDataSeries> dataSeries) noexcept
205 {
205 {
206 if (auto scalarSeries = dynamic_cast<ScalarSeries *>(dataSeries)) {
206 if (auto scalarSeries = std::dynamic_pointer_cast<ScalarSeries>(dataSeries)) {
207 return std::make_unique<PlottablesHelper<ScalarSeries> >(*scalarSeries);
207 return std::make_unique<PlottablesHelper<ScalarSeries> >(*scalarSeries);
208 }
208 }
209 else if (auto vectorSeries = dynamic_cast<VectorSeries *>(dataSeries)) {
209 else if (auto vectorSeries = std::dynamic_pointer_cast<VectorSeries>(dataSeries)) {
210 return std::make_unique<PlottablesHelper<VectorSeries> >(*vectorSeries);
210 return std::make_unique<PlottablesHelper<VectorSeries> >(*vectorSeries);
211 }
211 }
212 else {
212 else {
@@ -220,7 +220,7 PlottablesMap VisualizationGraphHelper::create(std::shared_ptr<Variable> variabl
220 QCustomPlot &plot) noexcept
220 QCustomPlot &plot) noexcept
221 {
221 {
222 if (variable) {
222 if (variable) {
223 auto helper = createHelper(variable->dataSeries().get());
223 auto helper = createHelper(variable->dataSeries());
224 auto plottables = helper->create(plot);
224 auto plottables = helper->create(plot);
225 return plottables;
225 return plottables;
226 }
226 }
@@ -231,7 +231,8 PlottablesMap VisualizationGraphHelper::create(std::shared_ptr<Variable> variabl
231 }
231 }
232 }
232 }
233
233
234 void VisualizationGraphHelper::updateData(PlottablesMap &plottables, IDataSeries *dataSeries,
234 void VisualizationGraphHelper::updateData(PlottablesMap &plottables,
235 std::shared_ptr<IDataSeries> dataSeries,
235 const SqpRange &dateTime)
236 const SqpRange &dateTime)
236 {
237 {
237 auto helper = createHelper(dataSeries);
238 auto helper = createHelper(dataSeries);
@@ -297,7 +297,7 void VisualizationGraphWidget::onDataCacheVariableUpdated()
297 qCDebug(LOG_VisualizationGraphWidget())
297 qCDebug(LOG_VisualizationGraphWidget())
298 << "TORM: VisualizationGraphWidget::onDataCacheVariableUpdated E" << dateTime;
298 << "TORM: VisualizationGraphWidget::onDataCacheVariableUpdated E" << dateTime;
299 if (dateTime.contains(variable->range()) || dateTime.intersect(variable->range())) {
299 if (dateTime.contains(variable->range()) || dateTime.intersect(variable->range())) {
300 VisualizationGraphHelper::updateData(variableEntry.second, variable->dataSeries().get(),
300 VisualizationGraphHelper::updateData(variableEntry.second, variable->dataSeries(),
301 variable->range());
301 variable->range());
302 }
302 }
303 }
303 }
@@ -308,6 +308,6 void VisualizationGraphWidget::onUpdateVarDisplaying(std::shared_ptr<Variable> v
308 {
308 {
309 auto it = impl->m_VariableToPlotMultiMap.find(variable);
309 auto it = impl->m_VariableToPlotMultiMap.find(variable);
310 if (it != impl->m_VariableToPlotMultiMap.end()) {
310 if (it != impl->m_VariableToPlotMultiMap.end()) {
311 VisualizationGraphHelper::updateData(it->second, variable->dataSeries().get(), range);
311 VisualizationGraphHelper::updateData(it->second, variable->dataSeries(), range);
312 }
312 }
313 }
313 }
General Comments 0
You need to be logged in to leave comments. Login now