SoDaRadio-5.0.3-master:8901fb5
qtgui
soda_freq_scale_draw.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_FREQ_SCALE_DRAW_HDR
30
#define SODA_FREQ_SCALE_DRAW_HDR
31
#include <qwt/qwt_scale_draw.h>
32
#include <boost/format.hpp>
33
#include <cmath>
34
35
namespace
GUISoDa
{
36
37
class
FreqScaleDraw
:
public
QwtScaleDraw
38
{
39
public
:
40
explicit
FreqScaleDraw
() {
41
center_freq
= 0.0;
42
}
43
44
void
setFreqStep
(
double
cf,
double
st) {
center_freq
= cf;
freq_step
= st; }
45
46
virtual
QwtText
label
(
double
f)
const override
{
47
if
(1 || (fabs(f -
center_freq
) < 0.5 *
freq_step
)) {
48
return
QwtText(QString::number(f * 1e-6,
'f'
, 3));
49
}
50
else
{
51
double
df = f * 1e-6;
52
df = df - floor(df);
53
54
return
QwtText(QString::number(df * 1000.0,
'f'
, 0));
55
}
56
}
57
protected
:
58
double
center_freq
;
59
double
freq_step
;
60
};
61
}
62
63
#endif
GUISoDa::FreqScaleDraw::FreqScaleDraw
FreqScaleDraw()
Definition:
soda_freq_scale_draw.hpp:40
GUISoDa::FreqScaleDraw::freq_step
double freq_step
Definition:
soda_freq_scale_draw.hpp:59
GUISoDa::FreqScaleDraw::setFreqStep
void setFreqStep(double cf, double st)
Definition:
soda_freq_scale_draw.hpp:44
GUISoDa::FreqScaleDraw::label
virtual QwtText label(double f) const override
Definition:
soda_freq_scale_draw.hpp:46
GUISoDa::FreqScaleDraw::center_freq
double center_freq
Definition:
soda_freq_scale_draw.hpp:58
GUISoDa
Definition:
freqlabel.hpp:38
GUISoDa::FreqScaleDraw
Definition:
soda_freq_scale_draw.hpp:37
Generated on Sun Sep 24 2017 12:16:38 for SoDaRadio-5.0.3-master:8901fb5 by
1.8.13