[4659] | 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 | //////////////////////////////////////////////////////////////////////////////
|
---|
| 50 | class 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 | //////////////////////////////////////////////////////////////////////////////
|
---|
| 61 | t_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);
|
---|
[4661] | 71 | setAxisScale(QwtPlot::yLeft, 0.0, 90.0);
|
---|
[4659] | 72 |
|
---|
| 73 | // Smaller Font for y-Axis
|
---|
| 74 | // -----------------------
|
---|
| 75 | QFont yFont = axisFont(QwtPlot::yLeft);
|
---|
| 76 | yFont.setPointSize(yFont.pointSize()/2);
|
---|
| 77 | setAxisFont(QwtPlot::yLeft, yFont);
|
---|
| 78 |
|
---|
| 79 | // Symbols
|
---|
| 80 | // -------
|
---|
| 81 | QColor red(220,20,60);
|
---|
| 82 | QColor green(150,200,50);
|
---|
| 83 | QColor blue(60,100,200);
|
---|
| 84 | QwtSymbol symbRed(QwtSymbol::Rect, QBrush(red), QPen(red), QSize(2,1));
|
---|
| 85 | QwtSymbol symbGreen(QwtSymbol::Rect, QBrush(green), QPen(green), QSize(2,1));
|
---|
| 86 | QwtSymbol symbBlue (QwtSymbol::Rect, QBrush(blue), QPen(blue), QSize(2,1));
|
---|
| 87 |
|
---|
| 88 | // Legend
|
---|
| 89 | // ------
|
---|
| 90 | QwtLegend* legend = new QwtLegend;
|
---|
| 91 | insertLegend(legend, QwtPlot::RightLegend);
|
---|
| 92 |
|
---|
| 93 | // Curves
|
---|
| 94 | // ------
|
---|
| 95 | int iC = 0;
|
---|
| 96 | QMapIterator<QString, t_availData > it(*availDataMap);
|
---|
| 97 | while (it.hasNext()) {
|
---|
| 98 | it.next();
|
---|
| 99 | ++iC;
|
---|
| 100 | const QString& prn = it.key();
|
---|
| 101 | const t_availData& availData = it.value();
|
---|
| 102 |
|
---|
| 103 | // Draw one curve
|
---|
| 104 | // --------------
|
---|
| 105 | if (availData._L1ok.size()) {
|
---|
| 106 | const QVector<double>& xData = availData._zenTim;
|
---|
| 107 | const QVector<double>& yData = availData._zenDeg;
|
---|
| 108 | addCurve(prn, symbGreen, xData, yData);
|
---|
| 109 | }
|
---|
| 110 | }
|
---|
| 111 |
|
---|
| 112 | // Important !!!
|
---|
| 113 | // -------------
|
---|
| 114 | replot();
|
---|
| 115 | }
|
---|
| 116 |
|
---|
| 117 | // Add Curve
|
---|
| 118 | //////////////////////////////////////////////////////////////////////////////
|
---|
| 119 | QwtPlotCurve* t_zenPlot::addCurve(const QString& name,
|
---|
| 120 | const QwtSymbol& symbol,
|
---|
| 121 | const QVector<double>& xData,
|
---|
| 122 | const QVector<double>& yData) {
|
---|
| 123 | QwtPlotCurve* curve = new QwtPlotCurve(name);
|
---|
| 124 | curve->setSymbol(new QwtSymbol(symbol));
|
---|
| 125 | curve->setStyle(QwtPlotCurve::NoCurve);
|
---|
| 126 | curve->setXAxis(QwtPlot::xBottom);
|
---|
| 127 | curve->setYAxis(QwtPlot::yLeft);
|
---|
| 128 | curve->setSamples(xData, yData);
|
---|
| 129 | curve->attach(this);
|
---|
| 130 | return curve;
|
---|
| 131 | }
|
---|