#include #include #include #include #include "availplot.h" #include "reqcanalyze.h" // ////////////////////////////////////////////////////////////////////////////// class t_scaleDraw : public QwtScaleDraw { public: t_scaleDraw() {} virtual QwtText label(double mjd) const { bncTime epoTime; epoTime.setmjd(mjd); return QwtText(epoTime.timestr(0,':').c_str()); } }; // ////////////////////////////////////////////////////////////////////////////// t_availPlot::t_availPlot(QWidget* parent, QMap* availDataMap) : QwtPlot(parent) { setCanvasBackground(QColor(Qt::white)); // Axes // ---- setAxisScaleDraw(QwtPlot::xBottom, new t_scaleDraw()); setAxisLabelRotation(QwtPlot::xBottom, -50.0); setAxisLabelAlignment(QwtPlot::xBottom, Qt::AlignLeft | Qt::AlignBottom); setAxisTitle(QwtPlot::yLeft, "PRN"); // Curves // ------ int iC = 0; QMapIterator it(*availDataMap); while (it.hasNext()) { it.next(); ++iC; const QString& prn = it.key(); const t_availData& availData = it.value(); const QVector& epochs = availData._epoL1; double xData[epochs.size()]; double yData[epochs.size()]; for (int ii = 0; ii < epochs.size(); ii++) { xData[ii] = epochs[ii]; yData[ii] = iC; } QwtSymbol* symbol = new QwtSymbol( QwtSymbol::XCross ); symbol->setSize( 4 ); QwtPlotCurve* curve = new QwtPlotCurve(prn); curve->setSymbol( symbol ); curve->setStyle( QwtPlotCurve::NoCurve ); curve->setXAxis(QwtPlot::xBottom); curve->setYAxis(QwtPlot::yLeft); curve->setSamples(xData, yData, epochs.size()); curve->attach(this); } // Important !!! // ------------- replot(); }