00001 /*************************************************************************** 00002 * SpikeStream Application * 00003 * Copyright (C) 2007 by David Gamez * 00004 * david@davidgamez.eu * 00005 * Version 0.1 * 00006 * * 00007 * This program is free software; you can redistribute it and/or modify * 00008 * it under the terms of the GNU General Public License as published by * 00009 * the Free Software Foundation; either version 2 of the License, or * 00010 * (at your option) any later version. * 00011 * * 00012 * This program is distributed in the hope that it will be useful, * 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00015 * GNU General Public License for more details. * 00016 * * 00017 * You should have received a copy of the GNU General Public License * 00018 * along with this program; if not, write to the * 00019 * Free Software Foundation, Inc., * 00020 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * 00021 ***************************************************************************/ 00022 00023 #ifndef MONITORDATAPLOTTER_H 00024 #define MONITORDATAPLOTTER_H 00025 00026 //SpikeStream includes 00027 #include "MonitorDataset.h" 00028 00029 //Qt includes 00030 #include <qdialog.h> 00031 #include <qlabel.h> 00032 #include <qlayout.h> 00033 #include <qfont.h> 00034 00035 //Qwt includes 00036 #include <qwt_plot.h> 00037 00038 //Other includes 00039 #include <vector> 00040 using namespace std; 00041 00042 00043 /*! Holds the parameters associated with a new graph. */ 00044 struct NewGraph { 00045 QString description;//Description of the graph 00046 double rangeLow;//Default low range of the values 00047 double rangeHigh;//Default high range of the values 00048 }; 00049 00050 00051 //------------------------ Monitor Data Plotter---------------------------- 00052 /*! Displays graphs of parameters monitored in a neuron or synapse. */ 00053 //------------------------------------------------------------------------- 00054 00055 class MonitorDataPlotter : public QDialog { 00056 Q_OBJECT 00057 00058 public: 00059 MonitorDataPlotter(QWidget *parent, QString neuronGrpDesc, unsigned int neurGrpID, unsigned int neurID); 00060 MonitorDataPlotter(QWidget *parent, unsigned int neurGrpID, unsigned int fromNeurID, unsigned int toNeurID); 00061 ~MonitorDataPlotter(); 00062 void addGraph(NewGraph graph); 00063 void closeDialog(bool stopMon); 00064 void loadingComplete(); 00065 void plotData(double msgTime, const double* dataArray, int arrayLength); 00066 void setUpGraphs(const char* charArray); 00067 bool showDialog(); 00068 00069 00070 protected: 00071 void closeEvent ( QCloseEvent * e ); 00072 00073 00074 private: 00075 //=============================== VARIABLES =============================== 00076 /*! Store a reference to the simulation widget to access simulation manager 00077 Stored as a QWidget to avoid include problems. */ 00078 QWidget* simulationWidget; 00079 00080 /*! Neuron group.*/ 00081 unsigned int neuronGrpID; 00082 00083 /*! Are we monitoring a neuron or a synapse?.*/ 00084 bool neuronMonitoring; 00085 00086 /*! ID of neuron being monitored.*/ 00087 unsigned int neuronID; 00088 00089 /*! Presynaptic ID of synapse being monitored.*/ 00090 unsigned int fromNeuronID; 00091 00092 /*! Postsynpatic ID of synapse being monitored.*/ 00093 unsigned int toNeuronID; 00094 00095 /*! Label to inform user that we are waiting for simulation manager.*/ 00096 QLabel* loadingLabel; 00097 00098 /*! Layout of this widget, used to dynamically add graphs.*/ 00099 QVBoxLayout *verticalBox; 00100 00101 /*! Holds references to all of the graphs in this widget.*/ 00102 vector<QwtPlot*> plotVector; 00103 00104 /*! Holds references to all of the datasets plotted by the graphs.*/ 00105 vector<MonitorDataset*> dataVector; 00106 00107 /*! Records if there has been an error in parsing. */ 00108 bool parseError; 00109 00110 //Font for axes 00111 QFont* axisFont; 00112 QFont* axisTitleFont; 00113 00114 00115 //=============================== METHODS =============================== 00116 /*! Declare copy constructor private so it cannot be used inadvertently.*/ 00117 MonitorDataPlotter (const MonitorDataPlotter&); 00118 00119 /*! Declare assignment private so it cannot be used inadvertently.*/ 00120 MonitorDataPlotter operator = (const MonitorDataPlotter&); 00121 00122 void stopMonitoring(); 00123 00124 }; 00125 00126 00127 #endif//MONITORDATAPLOTTER_H 00128 00129
1.4.4