##// END OF EJS Templates
Uses factory in the VariableGraphWidget
Alexandre Leroux -
r184:0055ef23e3bb
parent child
Show More
@@ -1,4 +1,5
1 #include "Visualization/VisualizationGraphWidget.h"
1 #include "Visualization/VisualizationGraphWidget.h"
2 #include "Visualization/GraphPlottablesFactory.h"
2 #include "ui_VisualizationGraphWidget.h"
3 #include "ui_VisualizationGraphWidget.h"
3
4
4 #include <Variable/Variable.h>
5 #include <Variable/Variable.h>
@@ -18,8 +19,7 const auto VERTICAL_ZOOM_MODIFIER = Qt::ControlModifier;
18 struct VisualizationGraphWidget::VisualizationGraphWidgetPrivate {
19 struct VisualizationGraphWidget::VisualizationGraphWidgetPrivate {
19
20
20 // 1 variable -> n qcpplot
21 // 1 variable -> n qcpplot
21 std::unordered_map<std::shared_ptr<Variable>, std::unique_ptr<QCPAbstractPlottable> >
22 std::unordered_map<std::shared_ptr<Variable>, QCPAbstractPlottable *> m_VariableToPlotMap;
22 m_VariableToPlotMap;
23 };
23 };
24
24
25 VisualizationGraphWidget::VisualizationGraphWidget(QWidget *parent)
25 VisualizationGraphWidget::VisualizationGraphWidget(QWidget *parent)
@@ -44,7 +44,12 VisualizationGraphWidget::~VisualizationGraphWidget()
44
44
45 void VisualizationGraphWidget::addVariable(std::shared_ptr<Variable> variable)
45 void VisualizationGraphWidget::addVariable(std::shared_ptr<Variable> variable)
46 {
46 {
47 // todo: first check is variable contains data then check how many plot have to be created
47 // Uses delegate to create the qcpplot components according to the variable
48 auto createdPlottables = GraphPlottablesFactory::create(variable.get(), *ui->widget);
49
50 for (auto createdPlottable : qAsConst(createdPlottables)) {
51 impl->m_VariableToPlotMap.insert({variable, createdPlottable});
52 }
48 }
53 }
49
54
50 void VisualizationGraphWidget::accept(IVisualizationWidget *visitor)
55 void VisualizationGraphWidget::accept(IVisualizationWidget *visitor)
General Comments 0
You need to be logged in to leave comments. Login now