[4578] | 1 |
|
---|
| 2 | #include <qwt_symbol.h>
|
---|
| 3 | #include <qwt_plot_curve.h>
|
---|
[4586] | 4 | #include <qwt_scale_draw.h>
|
---|
| 5 | #include <qwt_text.h>
|
---|
[4578] | 6 |
|
---|
| 7 | #include "availplot.h"
|
---|
[4584] | 8 | #include "reqcanalyze.h"
|
---|
[4578] | 9 |
|
---|
[4586] | 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 | //////////////////////////////////////////////////////////////////////////////
|
---|
[4578] | 23 | t_availPlot::t_availPlot(QWidget* parent,
|
---|
[4584] | 24 | QMap<QString, t_availData>* availDataMap)
|
---|
[4578] | 25 | : QwtPlot(parent) {
|
---|
| 26 |
|
---|
[4579] | 27 | setCanvasBackground(QColor(Qt::white));
|
---|
| 28 |
|
---|
[4578] | 29 | // Axes
|
---|
| 30 | // ----
|
---|
[4586] | 31 | setAxisScaleDraw(QwtPlot::xBottom, new t_scaleDraw());
|
---|
| 32 | setAxisLabelRotation(QwtPlot::xBottom, -50.0);
|
---|
| 33 | setAxisLabelAlignment(QwtPlot::xBottom, Qt::AlignLeft | Qt::AlignBottom);
|
---|
| 34 |
|
---|
[4578] | 35 | setAxisTitle(QwtPlot::yLeft, "PRN");
|
---|
| 36 |
|
---|
| 37 | // Curves
|
---|
| 38 | // ------
|
---|
| 39 | int iC = 0;
|
---|
[4584] | 40 | QMapIterator<QString, t_availData > it(*availDataMap);
|
---|
[4578] | 41 | while (it.hasNext()) {
|
---|
| 42 | it.next();
|
---|
| 43 | ++iC;
|
---|
[4584] | 44 | const QString& prn = it.key();
|
---|
| 45 | const t_availData& availData = it.value();
|
---|
| 46 | const QVector<double>& epochs = availData._epoL1;
|
---|
[4578] | 47 |
|
---|
| 48 | double xData[epochs.size()];
|
---|
| 49 | double yData[epochs.size()];
|
---|
| 50 | for (int ii = 0; ii < epochs.size(); ii++) {
|
---|
[4579] | 51 | xData[ii] = epochs[ii];
|
---|
[4578] | 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 );
|
---|
[4579] | 60 | curve->setStyle( QwtPlotCurve::NoCurve );
|
---|
[4578] | 61 | curve->setXAxis(QwtPlot::xBottom);
|
---|
| 62 | curve->setYAxis(QwtPlot::yLeft);
|
---|
| 63 | curve->setSamples(xData, yData, epochs.size());
|
---|
| 64 | curve->attach(this);
|
---|
| 65 | }
|
---|
[4581] | 66 |
|
---|
[4582] | 67 | // Important !!!
|
---|
| 68 | // -------------
|
---|
[4581] | 69 | replot();
|
---|
[4578] | 70 | }
|
---|
| 71 |
|
---|