Ksetiwatch API Documentation


pulseplot.cpp

Go to the documentation of this file.
00001 /***************************************************************************/
00014 #include <klocale.h>
00015 
00016 #include "pulseplot.h"
00017 #include "setiloc.h"
00018 
00019 /*------------------------------------------------------------------------ */
00020 PulsePlot::PulsePlot(SetiLoc* loc, QWidget *parent, const char *name )
00021          : SetiGraph(loc,true,false,parent,name)
00022 {
00023 init();
00024 }
00025 
00026 /*------------------------------------------------------------------------ */
00027 PulsePlot::PulsePlot(QWidget *parent, const char *name )
00028          : SetiGraph(0,true,false,parent,name)
00029 {
00030 init();
00031 }
00032 
00033 /*------------------------------------------------------------------------ */
00034 PulsePlot::~PulsePlot()
00035 {
00036 }
00037 
00038 /*------------------------------------------------------------------------ */
00039 void PulsePlot::init()
00040 {
00041 // Make an array twice the size of the actual pulse data. Pulse data will
00042 // be copied twice into that array.
00043 pulseData.resize(1024);
00044 
00045 if(m_location)
00046   {
00047   // connect the SetiLoc signal to the new Gaussian slot of this widget.
00048   connect(m_location, SIGNAL(newPulse(PulseScore)),
00049                 this, SLOT(showNewPulseData(PulseScore)));
00050 
00051   QString title;
00052   title = i18n("Location %1: Top Pulse (right-click for options)").arg(m_location->description());
00053   setCaption(title);
00054   }
00055 setBackgroundColor(black);
00056 resize(350, 200);
00057 setMinimumSize(150, 100);
00058 
00059 setTextPosition(SetiGraph::TopRight);
00060 
00061 dataLoaded = false;
00062 
00063 // prepare data for display
00064 if(m_location)
00065   showNewPulseData(m_location->pulseScore());
00066 }
00067 
00068 /*------------------------------------------------------------------------ */
00069 void PulsePlot::showNewPulseData(PulseScore score)
00070 {
00071 pulse = score;
00072 pulseData.resize(2*pulse.data_len);
00073 // convert int to double and make a copy in the upper 512 array elements
00074 if(pulse.data_len > 0)
00075   {
00076   for(int i=0;i<pulse.data_len;i++)
00077     {
00078     pulseData[i] = (double)pulse.data[i];   
00079     pulseData[i+pulse.data_len] = pulseData[i];
00080     }
00081   }
00082 setCurve(pulseData);
00083 
00084 // generate the info text
00085 QString it;
00086 it.sprintf("power : %f\n"
00087            "mean  : %f\n"
00088            "period: %f\n"
00089            "score : %f",
00090            pulse.power,
00091            pulse.mean,
00092            pulse.period,
00093            pulse.score
00094            );
00095 setInfoText(it);
00096 
00097 dataLoaded = true;
00098 repaint();
00099 }
00100 
00101 #include "pulseplot.moc"
00102 
KDE Logo
This file is part of the documentation for Ksetiwatch API Version 2.6.1.
Documentation copyright © 2000-2003 Gordon Machel.
Generated on Fri Jun 6 00:28:15 2003 by doxygen 1.2.18, written by Dimitri van Heesch, © 1997-2002