diff --git a/gui/include/Visualization/GraphPlottablesFactory.h b/gui/include/Visualization/GraphPlottablesFactory.h new file mode 100644 index 0000000..82c06ac --- /dev/null +++ b/gui/include/Visualization/GraphPlottablesFactory.h @@ -0,0 +1,30 @@ +#ifndef SCIQLOP_GRAPHPLOTTABLESFACTORY_H +#define SCIQLOP_GRAPHPLOTTABLESFACTORY_H + +#include +#include + +Q_DECLARE_LOGGING_CATEGORY(LOG_GraphPlottablesFactory) + +class QCPAbstractPlottable; +class QCustomPlot; +class Variable; + +/** + * @brief The GraphPlottablesFactory class aims to create the QCustomPlot components relative to a + * variable, depending on the data series of this variable + */ +struct GraphPlottablesFactory { + /** + * Creates (if possible) the QCustomPlot components relative to the variable passed in + * parameter, and adds these to the plot passed in parameter. + * @param variable the variable for which to create the components + * @param plot the plot in which to add the created components. It takes ownership of these + * components. + * @return the list of the components created + */ + static QVector create(const Variable *variable, + QCustomPlot &plot) noexcept; +}; + +#endif // SCIQLOP_GRAPHPLOTTABLESFACTORY_H diff --git a/gui/src/Visualization/GraphPlottablesFactory.cpp b/gui/src/Visualization/GraphPlottablesFactory.cpp new file mode 100644 index 0000000..bbf5c97 --- /dev/null +++ b/gui/src/Visualization/GraphPlottablesFactory.cpp @@ -0,0 +1,22 @@ +#include "Visualization/GraphPlottablesFactory.h" +#include "Visualization/qcustomplot.h" + +#include + +Q_LOGGING_CATEGORY(LOG_GraphPlottablesFactory, "GraphPlottablesFactory") + +QVector GraphPlottablesFactory::create(const Variable *variable, + QCustomPlot &plot) noexcept +{ + auto result = QVector{}; + + if (variable) { + /// @todo ALX + } + else { + qCDebug(LOG_GraphPlottablesFactory()) + << QObject::tr("Can't create graph plottables : the variable is null"); + } + + return result; +}