##// END OF EJS Templates
Creates factory that is responsible of creation of QCustomPlot components relative to a variable
Alexandre Leroux -
r168:9fde42db8d93
parent child
Show More
@@ -0,0 +1,30
1 #ifndef SCIQLOP_GRAPHPLOTTABLESFACTORY_H
2 #define SCIQLOP_GRAPHPLOTTABLESFACTORY_H
3
4 #include <QLoggingCategory>
5 #include <QVector>
6
7 Q_DECLARE_LOGGING_CATEGORY(LOG_GraphPlottablesFactory)
8
9 class QCPAbstractPlottable;
10 class QCustomPlot;
11 class Variable;
12
13 /**
14 * @brief The GraphPlottablesFactory class aims to create the QCustomPlot components relative to a
15 * variable, depending on the data series of this variable
16 */
17 struct GraphPlottablesFactory {
18 /**
19 * Creates (if possible) the QCustomPlot components relative to the variable passed in
20 * parameter, and adds these to the plot passed in parameter.
21 * @param variable the variable for which to create the components
22 * @param plot the plot in which to add the created components. It takes ownership of these
23 * components.
24 * @return the list of the components created
25 */
26 static QVector<QCPAbstractPlottable *> create(const Variable *variable,
27 QCustomPlot &plot) noexcept;
28 };
29
30 #endif // SCIQLOP_GRAPHPLOTTABLESFACTORY_H
@@ -0,0 +1,22
1 #include "Visualization/GraphPlottablesFactory.h"
2 #include "Visualization/qcustomplot.h"
3
4 #include <Variable/Variable.h>
5
6 Q_LOGGING_CATEGORY(LOG_GraphPlottablesFactory, "GraphPlottablesFactory")
7
8 QVector<QCPAbstractPlottable *> GraphPlottablesFactory::create(const Variable *variable,
9 QCustomPlot &plot) noexcept
10 {
11 auto result = QVector<QCPAbstractPlottable *>{};
12
13 if (variable) {
14 /// @todo ALX
15 }
16 else {
17 qCDebug(LOG_GraphPlottablesFactory())
18 << QObject::tr("Can't create graph plottables : the variable is null");
19 }
20
21 return result;
22 }
General Comments 0
You need to be logged in to leave comments. Login now