Shellp
|
00001 /* 00002 00003 This file is a part of Shellp, a 'shell helper' library. 00004 00005 Copyright (C) 2011-2012 Jori Liesenborgs 00006 00007 Contact: jori.liesenborgs@gmail.com 00008 00009 This library is free software; you can redistribute it and/or 00010 modify it under the terms of the GNU Lesser General Public 00011 License as published by the Free Software Foundation; either 00012 version 2.1 of the License, or (at your option) any later version. 00013 00014 This library is distributed in the hope that it will be useful, 00015 but WITHOUT ANY WARRANTY; without even the implied warranty of 00016 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00017 Lesser General Public License for more details. 00018 00019 You should have received a copy of the GNU Lesser General Public 00020 License along with this library; if not, write to the Free Software 00021 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 00022 USA 00023 00024 */ 00025 00026 #ifndef SHELLP_SHELL2DPLOTWINDOW_H 00027 00028 #define SHELLP_SHELL2DPLOTWINDOW_H 00029 00030 #include <QWidget> 00031 #include <string> 00032 #include <vector> 00033 00034 class QwtPlot; 00035 class QwtPlotCurve; 00036 00037 namespace shellp 00038 { 00039 00040 class Shell2DPlotRequest 00041 { 00042 public: 00043 Shell2DPlotRequest(int id, const std::string &title, const std::string &xLabel, 00044 const std::string &yLabel, const std::vector<double> &xPoints, 00045 const std::vector<double> &yPoints, bool forceShow) 00046 { 00047 m_id = id; 00048 m_title = title; 00049 m_xLabel = xLabel; 00050 m_yLabel = yLabel; 00051 m_xPoints = xPoints; 00052 m_yPoints = yPoints; 00053 m_forceShow = forceShow; 00054 } 00055 00056 ~Shell2DPlotRequest() 00057 { 00058 } 00059 00060 const std::string &getTitle() const { return m_title; } 00061 const std::string &getXLabel() const { return m_xLabel; } 00062 const std::string &getYLabel() const { return m_yLabel; } 00063 const std::vector<double> &getXPoints() const { return m_xPoints; } 00064 const std::vector<double> &getYPoints() const { return m_yPoints; } 00065 int getID() const { return m_id; } 00066 bool getForceShow() const { return m_forceShow; } 00067 private: 00068 int m_id; 00069 std::string m_title, m_xLabel, m_yLabel; 00070 std::vector<double> m_xPoints, m_yPoints; 00071 bool m_forceShow; 00072 }; 00073 00074 class Shell2DPlotWindow : public QWidget 00075 { 00076 Q_OBJECT 00077 public: 00078 Shell2DPlotWindow(QWidget *pParent = 0); 00079 ~Shell2DPlotWindow(); 00080 00081 void processRequest(Shell2DPlotRequest *pRequest); 00082 public slots: 00083 void toggleLogLinear(); 00084 void togglePixelsOrPhysical(); 00085 private: 00086 void plotCurrentRequest(); 00087 00088 Shell2DPlotRequest *m_pRequest; 00089 QwtPlot *m_pPlot; 00090 QwtPlotCurve *m_pPlotCurve; 00091 bool m_log, m_plotPixels; 00092 }; 00093 00094 } // end namespace 00095 00096 #endif // SHELLP_SHELL2DPLOTWINDOW_H 00097