SoDaRadio-5.0.3-master:8901fb5
soda_wfall_data.hpp
Go to the documentation of this file.
1 /*
2 Copyright (c) 2017 Matthew H. Reilly (kb1vc)
3 All rights reserved.
4 
5 Redistribution and use in source and binary forms, with or without
6 modification, are permitted provided that the following conditions are
7 met:
8 
9  Redistributions of source code must retain the above copyright
10  notice, this list of conditions and the following disclaimer.
11  Redistributions in binary form must reproduce the above copyright
12  notice, this list of conditions and the following disclaimer in
13  the documentation and/or other materials provided with the
14  distribution.
15 
16 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28 
29 #ifndef SODA_WFALL_DATA_H
30 #define SODA_WFALL_DATA_H
31 
32 #include <QWidget>
33 #include <qwt/qwt_plot.h>
34 #include <qwt/qwt_raster_data.h>
35 
36 namespace GUISoDa {
37  class WFallData : public QwtRasterData
38  {
39  public:
40  WFallData();
41 
42  ~WFallData();
43 
44  virtual double value(double f, double t) const;
45 
46  void setZRange();
47 
48  void setDynamicRange(double drange);
49 
50  void setRefLevel(double reflvl);
51 
52  virtual void updateData(double cfreq, float * spect);
53 
54  void setSpectrumDimensions(double cfreq, double span, long buckets);
55 
56  void setMarkers(double lo, double hi) {
57  f_lo_marker = lo;
58  f_hi_marker = hi;
59  }
60 
61  private:
62  void setReady() { is_ready = true; }
63  void clearReady() { is_ready = false; }
64  bool is_ready;
65 
66  double r_fbucket_size;
67  double span_in_freq; // the frequency limits/span for the input stream
68 
70  mutable double last_freq; // last frequency seen by the value function
71 
72  double min_time;
73 
74  // The heatmap contains spectral power buckets for each "scan" at a frequency "f"
75  // such that
76  // heatmap[i * num_buckets] is the start of the scan for a sample between
77  // start_freq[i] and start_freq[i] + span_in_freq
78  double *heatmap;
79  long heatmap_size;
80  double *start_freq;
82  long cur_row_idx;
83  long cur_freq_idx;
84 
85  mutable long last_cidx;
86 
87  double ref_level;
88  double dynamic_range;
89  };
90 }
91 
92 #endif
93 
double * start_freq
for each row in the heat map, this is the centerfreq.
double min_time
earliest time relative to "now"
virtual double value(double f, double t) const
virtual void updateData(double cfreq, float *spect)
void setMarkers(double lo, double hi)
void setDynamicRange(double drange)
void setSpectrumDimensions(double cfreq, double span, long buckets)
void setRefLevel(double reflvl)