source: ntrip/trunk/BNC/src/rinex/zenplot.cpp@ 4660

Last change on this file since 4660 was 4660, checked in by mervart, 12 years ago
File size: 4.0 KB
Line 
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_zenPlot
30 *
31 * Purpose: Plot with satellite zenith distances
32 *
33 * Author: L. Mervart
34 *
35 * Created: 08-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
45#include "zenplot.h"
46#include "reqcanalyze.h"
47
48//
49//////////////////////////////////////////////////////////////////////////////
50class t_scaleDrawTime : public QwtScaleDraw {
51 public:
52 t_scaleDrawTime() {}
53 virtual QwtText label(double mjdX24) const {
54 bncTime epoTime; epoTime.setmjd(mjdX24/24.0);
55 return QwtText(epoTime.timestr(0,':').c_str());
56 }
57};
58
59// Constructor
60//////////////////////////////////////////////////////////////////////////////
61t_zenPlot::t_zenPlot(QWidget* parent, QMap<QString, t_availData>* availDataMap)
62: QwtPlot(parent) {
63
64 setCanvasBackground(QColor(Qt::white));
65
66 // Axes
67 // ----
68 setAxisScaleDraw(QwtPlot::xBottom, new t_scaleDrawTime());
69 setAxisLabelRotation(QwtPlot::xBottom, -10.0);
70 setAxisLabelAlignment(QwtPlot::xBottom, Qt::AlignLeft | Qt::AlignBottom);
71
72 // Smaller Font for y-Axis
73 // -----------------------
74 QFont yFont = axisFont(QwtPlot::yLeft);
75 yFont.setPointSize(yFont.pointSize()/2);
76 setAxisFont(QwtPlot::yLeft, yFont);
77
78 // Symbols
79 // -------
80 QColor red(220,20,60);
81 QColor green(150,200,50);
82 QColor blue(60,100,200);
83 QwtSymbol symbRed(QwtSymbol::Rect, QBrush(red), QPen(red), QSize(2,1));
84 QwtSymbol symbGreen(QwtSymbol::Rect, QBrush(green), QPen(green), QSize(2,1));
85 QwtSymbol symbBlue (QwtSymbol::Rect, QBrush(blue), QPen(blue), QSize(2,1));
86
87 // Legend
88 // ------
89 QwtLegend* legend = new QwtLegend;
90 insertLegend(legend, QwtPlot::RightLegend);
91
92 // Curves
93 // ------
94 int iC = 0;
95 QMapIterator<QString, t_availData > it(*availDataMap);
96 while (it.hasNext()) {
97 it.next();
98 ++iC;
99 const QString& prn = it.key();
100 const t_availData& availData = it.value();
101
102 // Draw one curve
103 // --------------
104 if (availData._L1ok.size()) {
105 const QVector<double>& xData = availData._zenTim;
106 const QVector<double>& yData = availData._zenDeg;
107 addCurve(prn, symbGreen, xData, yData);
108 }
109 }
110
111 // Important !!!
112 // -------------
113 replot();
114}
115
116// Add Curve
117//////////////////////////////////////////////////////////////////////////////
118QwtPlotCurve* t_zenPlot::addCurve(const QString& name,
119 const QwtSymbol& symbol,
120 const QVector<double>& xData,
121 const QVector<double>& yData) {
122 QwtPlotCurve* curve = new QwtPlotCurve(name);
123 curve->setSymbol(new QwtSymbol(symbol));
124 curve->setStyle(QwtPlotCurve::NoCurve);
125 curve->setXAxis(QwtPlot::xBottom);
126 curve->setYAxis(QwtPlot::yLeft);
127 curve->setSamples(xData, yData);
128 curve->attach(this);
129 return curve;
130}
Note: See TracBrowser for help on using the repository browser.