1 |
|
---|
2 | #include <qwt_symbol.h>
|
---|
3 | #include <qwt_plot_curve.h>
|
---|
4 | #include <qwt_scale_draw.h>
|
---|
5 | #include <qwt_text.h>
|
---|
6 |
|
---|
7 | #include "availplot.h"
|
---|
8 | #include "reqcanalyze.h"
|
---|
9 |
|
---|
10 | //
|
---|
11 | //////////////////////////////////////////////////////////////////////////////
|
---|
12 | class t_scaleDraw : public QwtScaleDraw {
|
---|
13 | public:
|
---|
14 | t_scaleDraw() {}
|
---|
15 | virtual QwtText label(double mjd) const {
|
---|
16 | bncTime epoTime; epoTime.setmjd(mjd);
|
---|
17 | return QwtText(epoTime.timestr(0,':').c_str());
|
---|
18 | }
|
---|
19 | };
|
---|
20 |
|
---|
21 | //
|
---|
22 | //////////////////////////////////////////////////////////////////////////////
|
---|
23 | t_availPlot::t_availPlot(QWidget* parent,
|
---|
24 | QMap<QString, t_availData>* availDataMap)
|
---|
25 | : QwtPlot(parent) {
|
---|
26 |
|
---|
27 | setCanvasBackground(QColor(Qt::white));
|
---|
28 |
|
---|
29 | // Axes
|
---|
30 | // ----
|
---|
31 | setAxisScaleDraw(QwtPlot::xBottom, new t_scaleDraw());
|
---|
32 | setAxisLabelRotation(QwtPlot::xBottom, -50.0);
|
---|
33 | setAxisLabelAlignment(QwtPlot::xBottom, Qt::AlignLeft | Qt::AlignBottom);
|
---|
34 |
|
---|
35 | setAxisTitle(QwtPlot::yLeft, "PRN");
|
---|
36 |
|
---|
37 | // Curves
|
---|
38 | // ------
|
---|
39 | int iC = 0;
|
---|
40 | QMapIterator<QString, t_availData > it(*availDataMap);
|
---|
41 | while (it.hasNext()) {
|
---|
42 | it.next();
|
---|
43 | ++iC;
|
---|
44 | const QString& prn = it.key();
|
---|
45 | const t_availData& availData = it.value();
|
---|
46 | const QVector<double>& epochs = availData._epoL1;
|
---|
47 |
|
---|
48 | double xData[epochs.size()];
|
---|
49 | double yData[epochs.size()];
|
---|
50 | for (int ii = 0; ii < epochs.size(); ii++) {
|
---|
51 | xData[ii] = epochs[ii];
|
---|
52 | yData[ii] = iC;
|
---|
53 | }
|
---|
54 |
|
---|
55 | QwtSymbol* symbol = new QwtSymbol( QwtSymbol::XCross );
|
---|
56 | symbol->setSize( 4 );
|
---|
57 |
|
---|
58 | QwtPlotCurve* curve = new QwtPlotCurve(prn);
|
---|
59 | curve->setSymbol( symbol );
|
---|
60 | curve->setStyle( QwtPlotCurve::NoCurve );
|
---|
61 | curve->setXAxis(QwtPlot::xBottom);
|
---|
62 | curve->setYAxis(QwtPlot::yLeft);
|
---|
63 | curve->setSamples(xData, yData, epochs.size());
|
---|
64 | curve->attach(this);
|
---|
65 | }
|
---|
66 |
|
---|
67 | // Important !!!
|
---|
68 | // -------------
|
---|
69 | replot();
|
---|
70 | }
|
---|
71 |
|
---|