source: ntrip/trunk/BNC/src/rinex/dopplot.cpp@ 6205

Last change on this file since 6205 was 4719, checked in by mervart, 12 years ago
File size: 3.8 KB
RevLine 
[4673]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
46#include "dopplot.h"
47#include "reqcanalyze.h"
48
49//
50//////////////////////////////////////////////////////////////////////////////
51class t_scaleDrawTime : public QwtScaleDraw {
52 public:
53 t_scaleDrawTime() {}
54 virtual QwtText label(double mjdX24) const {
55 bncTime epoTime; epoTime.setmjd(mjdX24/24.0);
56 return QwtText(epoTime.timestr(0,':').c_str());
57 }
58};
59
60// Constructor
61//////////////////////////////////////////////////////////////////////////////
62t_dopPlot::t_dopPlot(QWidget* parent, t_obsStat* obsStat)
63: QwtPlot(parent) {
64
65 setCanvasBackground(QColor(Qt::white));
66
67 // Axes
68 // ----
69 setAxisScaleDraw(QwtPlot::xBottom, new t_scaleDrawTime());
70 setAxisLabelRotation(QwtPlot::xBottom, -10.0);
71 setAxisLabelAlignment(QwtPlot::xBottom, Qt::AlignLeft | Qt::AlignBottom);
72
[4684]73 enableAxis(QwtPlot::yRight);
[4686]74
75 QwtText textPDOP("PDOP");
76 QFont fontPDOP = textPDOP.font();
77 fontPDOP.setPointSize(fontPDOP.pointSize()*0.8);
78 textPDOP.setFont(fontPDOP);
79 textPDOP.setColor(Qt::red);
80 setAxisTitle(QwtPlot::yRight, textPDOP);
[4685]81 setAxisScale(QwtPlot::yRight, 0, 6);
[4684]82
[4686]83 QwtText textNumSat("# Sat");
84 QFont fontNumSat = textNumSat.font();
85 fontNumSat.setPointSize(fontNumSat.pointSize()*0.8);
86 textNumSat.setFont(fontNumSat);
87 textNumSat.setColor(Qt::blue);
88 setAxisTitle(QwtPlot::yLeft, textNumSat);
[4719]89 double maxNumSat = 20.0;
90 if (obsStat) {
91 for (int ii = 0; ii < obsStat->_numSat.size(); ii++) {
92 if (maxNumSat < obsStat->_numSat[ii]) {
93 maxNumSat = obsStat->_numSat[ii] + 5;
94 }
95 }
96 }
97 setAxisScale(QwtPlot::yLeft, 0, maxNumSat);
[4686]98
[4673]99 // Legend
100 // ------
101 QwtLegend* legend = new QwtLegend;
102 insertLegend(legend, QwtPlot::RightLegend);
103
104 // Curves
105 // ------
[4675]106 if (obsStat) {
[4683]107
[4686]108 QwtPlotCurve* curveNumSat = new QwtPlotCurve(textNumSat);
[4683]109 curveNumSat->setXAxis(QwtPlot::xBottom);
[4684]110 curveNumSat->setYAxis(QwtPlot::yLeft);
[4683]111 curveNumSat->setSamples(obsStat->_mjdX24, obsStat->_numSat);
[4686]112 curveNumSat->setPen(QPen(textNumSat.color()));
[4683]113 curveNumSat->attach(this);
114
[4686]115 QwtPlotCurve* curvePDOP = new QwtPlotCurve(textPDOP);
[4683]116 curvePDOP->setXAxis(QwtPlot::xBottom);
[4684]117 curvePDOP->setYAxis(QwtPlot::yRight);
[4683]118 curvePDOP->setSamples(obsStat->_mjdX24, obsStat->_PDOP);
[4686]119 curvePDOP->setPen(QPen(textPDOP.color()));
[4683]120 curvePDOP->attach(this);
[4675]121 }
[4673]122
123 // Important !!!
124 // -------------
125 replot();
126}
127
Note: See TracBrowser for help on using the repository browser.