1 | // Part of BNC, a utility for retrieving decoding and
|
---|
2 | // converting GNSS data streams from NTRIP broadcasters.
|
---|
3 | //
|
---|
4 | // Copyright (C) 2007
|
---|
5 | // German Federal Agency for Cartography and Geodesy (BKG)
|
---|
6 | // http://www.bkg.bund.de
|
---|
7 | // Czech Technical University Prague, Department of Geodesy
|
---|
8 | // http://www.fsv.cvut.cz
|
---|
9 | //
|
---|
10 | // Email: euref-ip@bkg.bund.de
|
---|
11 | //
|
---|
12 | // This program is free software; you can redistribute it and/or
|
---|
13 | // modify it under the terms of the GNU General Public License
|
---|
14 | // as published by the Free Software Foundation, version 2.
|
---|
15 | //
|
---|
16 | // This program is distributed in the hope that it will be useful,
|
---|
17 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
18 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
19 | // GNU General Public License for more details.
|
---|
20 | //
|
---|
21 | // You should have received a copy of the GNU General Public License
|
---|
22 | // along with this program; if not, write to the Free Software
|
---|
23 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
---|
24 |
|
---|
25 | /* -------------------------------------------------------------------------
|
---|
26 | * BKG NTRIP Client
|
---|
27 | * -------------------------------------------------------------------------
|
---|
28 | *
|
---|
29 | * Class: t_dopPlot
|
---|
30 | *
|
---|
31 | * Purpose: Plot PDOP, GDOP, and number of satellites
|
---|
32 | *
|
---|
33 | * Author: L. Mervart
|
---|
34 | *
|
---|
35 | * Created: 09-Sep-2012
|
---|
36 | *
|
---|
37 | * Changes:
|
---|
38 | *
|
---|
39 | * -----------------------------------------------------------------------*/
|
---|
40 |
|
---|
41 | #include <qwt_scale_draw.h>
|
---|
42 | #include <qwt_text.h>
|
---|
43 | #include <qwt_legend.h>
|
---|
44 | #include <qwt_plot_marker.h>
|
---|
45 | #include <qwt_plot_canvas.h>
|
---|
46 |
|
---|
47 | #include "dopplot.h"
|
---|
48 | #include "reqcanalyze.h"
|
---|
49 |
|
---|
50 | //
|
---|
51 | //////////////////////////////////////////////////////////////////////////////
|
---|
52 | class t_scaleDrawTime : public QwtScaleDraw {
|
---|
53 | public:
|
---|
54 | t_scaleDrawTime() {}
|
---|
55 | virtual QwtText label(double mjdX24) const {
|
---|
56 | bncTime epoTime; epoTime.setmjd(mjdX24/24.0);
|
---|
57 | return QwtText(epoTime.timestr(0,':').c_str());
|
---|
58 | }
|
---|
59 | };
|
---|
60 |
|
---|
61 | // Constructor
|
---|
62 | //////////////////////////////////////////////////////////////////////////////
|
---|
63 | t_dopPlot::t_dopPlot(QWidget* parent, const QMap<t_prn, t_plotData>& plotDataMap)
|
---|
64 | : QwtPlot(parent) {
|
---|
65 |
|
---|
66 | setCanvasBackground(QColor(Qt::white));
|
---|
67 | canvas()->setFrameStyle(QFrame::NoFrame | QFrame::Plain);
|
---|
68 |
|
---|
69 | // Axes
|
---|
70 | // ----
|
---|
71 | setAxisScaleDraw(QwtPlot::xBottom, new t_scaleDrawTime());
|
---|
72 | setAxisLabelRotation(QwtPlot::xBottom, -10.0);
|
---|
73 | setAxisLabelAlignment(QwtPlot::xBottom, Qt::AlignLeft | Qt::AlignBottom);
|
---|
74 |
|
---|
75 | enableAxis(QwtPlot::yRight);
|
---|
76 |
|
---|
77 | QwtText textPDOP("PDOP");
|
---|
78 | QFont fontPDOP = textPDOP.font();
|
---|
79 | fontPDOP.setPointSize(fontPDOP.pointSize()*0.8);
|
---|
80 | textPDOP.setFont(fontPDOP);
|
---|
81 | textPDOP.setColor(Qt::red);
|
---|
82 | setAxisTitle(QwtPlot::yRight, textPDOP);
|
---|
83 | setAxisScale(QwtPlot::yRight, 0, 6);
|
---|
84 |
|
---|
85 | QwtText textNumSat("# Sat");
|
---|
86 | QFont fontNumSat = textNumSat.font();
|
---|
87 | fontNumSat.setPointSize(fontNumSat.pointSize()*0.8);
|
---|
88 | textNumSat.setFont(fontNumSat);
|
---|
89 | textNumSat.setColor(Qt::blue);
|
---|
90 | setAxisTitle(QwtPlot::yLeft, textNumSat);
|
---|
91 | double maxNumSat = 20.0;
|
---|
92 | if (plotDataMap.size() > 0) {
|
---|
93 | QMapIterator<t_prn, t_plotData> it(plotDataMap);
|
---|
94 | while (it.hasNext()) {
|
---|
95 | it.next();
|
---|
96 | const t_plotData& plotData = it.value();
|
---|
97 | for (int ii = 0; ii < plotData._numSat.size(); ii++) {
|
---|
98 | if (maxNumSat < plotData._numSat[ii]) {
|
---|
99 | maxNumSat = plotData._numSat[ii] + 5;
|
---|
100 | }
|
---|
101 | }
|
---|
102 | }
|
---|
103 | }
|
---|
104 | setAxisScale(QwtPlot::yLeft, 0, maxNumSat);
|
---|
105 |
|
---|
106 | // Legend
|
---|
107 | // ------
|
---|
108 | QwtLegend* legend = new QwtLegend;
|
---|
109 | insertLegend(legend, QwtPlot::RightLegend);
|
---|
110 |
|
---|
111 | // Curves
|
---|
112 | // ------
|
---|
113 | if (plotDataMap.size() > 0) {
|
---|
114 | QMapIterator<t_prn, t_plotData> it(plotDataMap);
|
---|
115 | while (it.hasNext()) {
|
---|
116 | it.next();
|
---|
117 | const t_plotData& plotData = it.value();
|
---|
118 |
|
---|
119 | QwtPlotCurve* curveNumSat = new QwtPlotCurve(textNumSat);
|
---|
120 | curveNumSat->setXAxis(QwtPlot::xBottom);
|
---|
121 | curveNumSat->setYAxis(QwtPlot::yLeft);
|
---|
122 | curveNumSat->setSamples(plotData._mjdX24, plotData._numSat);
|
---|
123 | curveNumSat->setPen(QPen(textNumSat.color()));
|
---|
124 | curveNumSat->attach(this);
|
---|
125 |
|
---|
126 | QwtPlotCurve* curvePDOP = new QwtPlotCurve(textPDOP);
|
---|
127 | curvePDOP->setXAxis(QwtPlot::xBottom);
|
---|
128 | curvePDOP->setYAxis(QwtPlot::yRight);
|
---|
129 | curvePDOP->setSamples(plotData._mjdX24, plotData._PDOP);
|
---|
130 | curvePDOP->setPen(QPen(textPDOP.color()));
|
---|
131 | curvePDOP->attach(this);
|
---|
132 | }
|
---|
133 | }
|
---|
134 |
|
---|
135 | // Important !!!
|
---|
136 | // -------------
|
---|
137 | replot();
|
---|
138 | }
|
---|
139 |
|
---|