#ifndef MATRIXDATA_H #define MATRIXDATA_H #include #include #include #include #include #include #include #include #include "constants.h" struct PlotOptions { public: int displayType; bool* channels; int numChannels; int depthType; int xWidth; int waveform; int dataType; int dataScale; double lBound; double uBound; double divSize; double timeOffset; double airOffset; double iceOffset; PlotOptions( int chanNum ) { displayType = 0; channels = new bool[chanNum]; minColorMap = -100; maxColorMap = 100; depthType = 0; xWidth = 1000; waveform = 0; dataType = 0; dataScale = 0; timeOffset = 0; airOffset = 0; iceOffset = 0; } ~PlotOptions() { delete [] channels; } void setColorMap( int min, int max, int interval ) { minColorMap = min; maxColorMap = max; intervalColorMap = interval; } int getMinColorMap() { return minColorMap; } int getMaxColorMap() { return maxColorMap; } int getIntervalColorMap() { return intervalColorMap; } private: int minColorMap; int maxColorMap; int intervalColorMap; }; class MatrixData : public QWidget { Q_OBJECT public: MatrixData( int rNum, int cNum, QWidget* parent ); ~MatrixData(); int getRadarNum(); int getChanNum(); float getMatrixData( int x, int y, int scale, int type, PlotOptions* params ); // Get the data value at a specific point. (Echogram) float getColData( int i, int x, int y, PlotOptions* p = NULL ); // Retrieve the data from matrix's column at a specific point. (A-Scope) void setFreqMatrixData( int i, std::vector< fftwf_complex > data ); // Add a new column of frequency domain data to the matrix. void setPulseMatrixData( int i, std::vector< fftwf_complex > data ); // Add a new column of pulse-compressed data to the matrix. void setRawMatrixData( int i, std::vector< fftwf_complex > data ); // Add a new column of raw data to the matrix. float* getColDataDouble( int i, PlotOptions* p ); // Returns a double pointer to the location of the newest column of data. float getRefPulse( int chan, int xCoord ); void setRefPulse( float** reference ); void setColumnLen( int len, int dataType ); //Set the length of a column. int getColumnLen( int dataType = -1); // Get the length of a column in the matrix. int getColumnNum(); // Get the number of columns in the matrix. void setDepthScaleVal( double timePre, double timePost, double* hz ); // Set the scale values per bucket for depth in air and ice. double getDepthScaleVal( int scale, int type, int val ); // Get the scale value for the x-axis. bool matrixEqualLength(); // Returns true if all of the matrices have the same number of columns (length). void initializeColumns(); int getLastCol(); void setRadarOffsetValues( double air, double ice, double time ); // Set the offset variables with new radar values. void setUserOffsetValues( double air, double ice, double time ); // Set the offset variables with new user values. void setTau( double t ); // Set the pulse length, or tau, value. signals: void writeMsg( QString text, int type ); // Signal to write message to log. private: enum { dataTypes = 4 }; // Matrices for every UAV channel. std::vector< std::vector< std::vector< fftwf_complex > > > rawMatrix; std::vector< std::vector< std::vector< fftwf_complex > > > pulseMatrix; std::vector< std::vector< std::vector< fftwf_complex > > > freqMatrix; // Double pointers for the newest column of data. float* aColSum; float** aCol; float** refPulse; int columnLen[ dataTypes ]; // 0 = Raw, 1 = Frequency, 2 = Pulse-Compressed int columnNum; // Number of columns in the channel matrices. int colsPastTraceLen; // Number of columns received past the max length of traces to be saved. double airDepthPre; // Scale value for depth in air meters before truncation. double airDepthPost; // Scale value for depth in air meters after truncation. double iceDepthPre; // Scale value for depth in ice meters before truncation. double iceDepthPost; // Scale value for depth in ice meters after truncation. double timeDepthPre; // Scale value for the time axis before truncation. (Reference, Raw). double timeDepthPost; // Scale value for the time axis after truncation. (Pulse Compressed Data). double hzDepthStart; // The starting value to add to every hz scale value. double hzDepth; // Scale value for the time axis before truncation for Frequency domain data. int radarNumber; // The number of the radar to be used. int channelNumber; // The number of channels to be used by the radar and QLook program. double tOffset; // Value by which to offset time in us. Radar defined. double pLength; // The pulse length in time, which is subtracted from the pulse-compressed values. }; #endif // MATRIXDATA_H