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_SHELL3DPLOTWINDOW_H 00027 00028 #define SHELLP_SHELL3DPLOTWINDOW_H 00029 00030 #include <QFrame> 00031 00032 namespace Qwt3D 00033 { 00034 class GridPlot; 00035 } 00036 00037 namespace shellp 00038 { 00039 00040 class Shell3DPlotRequest 00041 { 00042 public: 00043 Shell3DPlotRequest(int id, const std::string &title, const std::string &xLabel, const std::string &yLabel, 00044 const std::string &zLabel, double xOff, double yOff, double xDist, double yDist, 00045 double **pData, int numX, int numY, bool forceShow) 00046 { 00047 m_id = id; 00048 m_title = title; 00049 m_xLabel = xLabel; 00050 m_yLabel = yLabel; 00051 m_zLabel = zLabel; 00052 m_xOffset = xOff; 00053 m_yOffset = yOff; 00054 m_xDist = xDist; 00055 m_yDist = yDist; 00056 m_numX = numX; 00057 m_numY = numY; 00058 m_pData = pData; 00059 m_forceShow = forceShow; 00060 } 00061 00062 ~Shell3DPlotRequest() 00063 { 00064 for (int i = 0 ; i < m_numX ; i++) 00065 delete [] m_pData[i]; 00066 delete [] m_pData; 00067 } 00068 00069 int getID() const { return m_id; } 00070 const std::string &getTitle() const { return m_title; } 00071 const std::string &getXLabel() const { return m_xLabel; } 00072 const std::string &getYLabel() const { return m_yLabel; } 00073 const std::string &getZLabel() const { return m_zLabel; } 00074 double getXOffset() const { return m_xOffset; } 00075 double getYOffset() const { return m_yOffset; } 00076 double getXPixelDistance() const { return m_xDist; } 00077 double getYPixelDistance() const { return m_yDist; } 00078 double **getData() const { return m_pData; } 00079 int getWidth() const { return m_numX; } 00080 int getHeight() const { return m_numY; } 00081 bool getForceShow() const { return m_forceShow; } 00082 private: 00083 int m_id; 00084 std::string m_title, m_xLabel, m_yLabel, m_zLabel; 00085 double m_xOffset, m_yOffset, m_xDist, m_yDist; 00086 double **m_pData; 00087 int m_numX, m_numY; 00088 bool m_forceShow; 00089 }; 00090 00091 class Shell3DPlotWindow : public QWidget 00092 { 00093 Q_OBJECT 00094 public: 00095 Shell3DPlotWindow(QWidget *pParent = 0); 00096 ~Shell3DPlotWindow(); 00097 00098 void processRequest(Shell3DPlotRequest *pRequest); 00099 public slots: 00100 void toggleLogLinear(); 00101 void togglePixelsOrPhysical(); 00102 private: 00103 void plotLinear(); 00104 void plotLog(); 00105 00106 Qwt3D::GridPlot *m_pGridPlot; 00107 Shell3DPlotRequest *m_pRequest; 00108 bool m_log; 00109 bool m_plotPixels; // pixels instead of physical dimensions 00110 }; 00111 00112 } // end namespace 00113 00114 #endif // SHELLP_SHELL3DPLOTWINDOW_H