00001 /****************************************************************************** 00002 * Copyright (C) 2015 by Ralf Kaestner * 00003 * ralf.kaestner@gmail.com * 00004 * * 00005 * This program is free software; you can redistribute it and/or modify * 00006 * it under the terms of the Lesser GNU General Public License as published by* 00007 * the Free Software Foundation; either version 3 of the License, or * 00008 * (at your option) any later version. * 00009 * * 00010 * This program is distributed in the hope that it will be useful, * 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00013 * Lesser GNU General Public License for more details. * 00014 * * 00015 * You should have received a copy of the Lesser GNU General Public License * 00016 * along with this program. If not, see <http://www.gnu.org/licenses/>. * 00017 ******************************************************************************/ 00018 00019 #ifndef RQT_MULTIPLOT_PLOT_CONFIG_H 00020 #define RQT_MULTIPLOT_PLOT_CONFIG_H 00021 00022 #include <QString> 00023 #include <QVector> 00024 00025 #include <rqt_multiplot/Config.h> 00026 #include <rqt_multiplot/CurveConfig.h> 00027 #include <rqt_multiplot/PlotAxesConfig.h> 00028 #include <rqt_multiplot/PlotLegendConfig.h> 00029 00030 namespace rqt_multiplot { 00031 class PlotConfig : 00032 public Config { 00033 Q_OBJECT 00034 public: 00035 PlotConfig(QObject* parent = 0, const QString& title = "Untitled Plot", 00036 double plotRate = 30.0); 00037 ~PlotConfig(); 00038 00039 void setTitle(const QString& title); 00040 const QString& getTitle() const; 00041 void setNumCurves(size_t numCurves); 00042 size_t getNumCurves() const; 00043 CurveConfig* getCurveConfig(size_t index) const; 00044 PlotAxesConfig* getAxesConfig() const; 00045 PlotLegendConfig* getLegendConfig() const; 00046 void setPlotRate(double rate); 00047 double getPlotRate() const; 00048 00049 CurveConfig* addCurve(); 00050 void removeCurve(CurveConfig* curveConfig); 00051 void removeCurve(size_t index); 00052 void clearCurves(); 00053 00054 QVector<CurveConfig*> findCurves(const QString& title) const; 00055 00056 void save(QSettings& settings) const; 00057 void load(QSettings& settings); 00058 void reset(); 00059 00060 void write(QDataStream& stream) const; 00061 void read(QDataStream& stream); 00062 00063 PlotConfig& operator=(const PlotConfig& src); 00064 00065 signals: 00066 void titleChanged(const QString& title); 00067 void curveAdded(size_t index); 00068 void curveRemoved(size_t index); 00069 void curvesCleared(); 00070 void curveConfigChanged(size_t index); 00071 void plotRateChanged(double rate); 00072 00073 private: 00074 QString title_; 00075 QVector<CurveConfig*> curveConfig_; 00076 PlotAxesConfig* axesConfig_; 00077 PlotLegendConfig* legendConfig_; 00078 double plotRate_; 00079 00080 private slots: 00081 void curveConfigChanged(); 00082 void curveConfigDestroyed(); 00083 void axesConfigChanged(); 00084 void legendConfigChanged(); 00085 }; 00086 }; 00087 00088 #endif