commit-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Commit-gnuradio] r9172 - gnuradio/branches/developers/trondeau/qtgui/gr


From: trondeau
Subject: [Commit-gnuradio] r9172 - gnuradio/branches/developers/trondeau/qtgui/gr-qtgui/src/lib/qtspectrum
Date: Mon, 4 Aug 2008 17:08:32 -0600 (MDT)

Author: trondeau
Date: 2008-08-04 17:08:32 -0600 (Mon, 04 Aug 2008)
New Revision: 9172

Modified:
   
gnuradio/branches/developers/trondeau/qtgui/gr-qtgui/src/lib/qtspectrum/waterfallGlobalData.cpp
Log:
fixing autoscaling in waterfall plot.

Modified: 
gnuradio/branches/developers/trondeau/qtgui/gr-qtgui/src/lib/qtspectrum/waterfallGlobalData.cpp
===================================================================
--- 
gnuradio/branches/developers/trondeau/qtgui/gr-qtgui/src/lib/qtspectrum/waterfallGlobalData.cpp
     2008-08-04 22:17:29 UTC (rev 9171)
+++ 
gnuradio/branches/developers/trondeau/qtgui/gr-qtgui/src/lib/qtspectrum/waterfallGlobalData.cpp
     2008-08-04 23:08:32 UTC (rev 9172)
@@ -74,10 +74,12 @@
 double WaterfallData::value(double x, double y) const{
   double returnValue = 0.0;
 
-  int intY = static_cast<int>(boundingRect().height() - y - 1.0 );
-  int intX = static_cast<int>( ( (x - boundingRect().left()) / 
boundingRect().width() * _fftPoints));
+  const unsigned int intY = static_cast<unsigned int>((1.0 - 
(y/boundingRect().height())) * 
+                                                     
static_cast<double>(_historyLength - 1));
+  const unsigned int intX = static_cast<unsigned int>((((x - 
boundingRect().left()) / boundingRect().width()) * 
+                                                      
static_cast<double>(_fftPoints-1)) + 0.5);
 
-  int location = (intY * _fftPoints) + intX;
+  const int location = (intY * _fftPoints) + intX;
   if((location > -1) && (location < static_cast<int64_t>(_fftPoints * 
_historyLength))){
     returnValue = _spectrumData[location];
   }





reply via email to

[Prev in Thread] Current Thread [Next in Thread]