1 |
|
---|
2 | #include <qwt_scale_engine.h>
|
---|
3 | #include <qwt_symbol.h>
|
---|
4 | #include <qwt_plot_curve.h>
|
---|
5 | #include <qwt_plot_grid.h>
|
---|
6 | #include <qwt_legend.h>
|
---|
7 |
|
---|
8 | #include "availplot.h"
|
---|
9 |
|
---|
10 | t_availPlot::t_availPlot(QWidget* parent,
|
---|
11 | QMap<QString, QVector<int> >* prnAvail)
|
---|
12 | : QwtPlot(parent) {
|
---|
13 |
|
---|
14 | setTitle("Availability Plot");
|
---|
15 |
|
---|
16 | setCanvasBackground(QColor(Qt::white));
|
---|
17 |
|
---|
18 | // Legend
|
---|
19 | // ------
|
---|
20 | QwtLegend* legend = new QwtLegend;
|
---|
21 | insertLegend(legend, QwtPlot::RightLegend);
|
---|
22 |
|
---|
23 |
|
---|
24 | // grid
|
---|
25 | QwtPlotGrid *grid = new QwtPlotGrid;
|
---|
26 | grid->enableXMin(true);
|
---|
27 | grid->setMajPen(QPen(Qt::gray, 0, Qt::DotLine));
|
---|
28 | grid->setMinPen(QPen(Qt::gray, 0 , Qt::DotLine));
|
---|
29 | grid->attach(this);
|
---|
30 |
|
---|
31 | // Axes
|
---|
32 | // ----
|
---|
33 | setAxisTitle(QwtPlot::xBottom, "Epoch");
|
---|
34 | setAxisTitle(QwtPlot::yLeft, "PRN");
|
---|
35 |
|
---|
36 | // Curves
|
---|
37 | // ------
|
---|
38 | int iC = 0;
|
---|
39 | QMapIterator<QString, QVector<int> > it(*prnAvail);
|
---|
40 | while (it.hasNext()) {
|
---|
41 | it.next();
|
---|
42 | ++iC;
|
---|
43 | const QString& prn = it.key();
|
---|
44 | const QVector<int>& epochs = it.value();
|
---|
45 |
|
---|
46 | double xData[epochs.size()];
|
---|
47 | double yData[epochs.size()];
|
---|
48 | for (int ii = 0; ii < epochs.size(); ii++) {
|
---|
49 | xData[ii] = epochs[ii];
|
---|
50 | yData[ii] = iC;
|
---|
51 | }
|
---|
52 |
|
---|
53 | QwtSymbol* symbol = new QwtSymbol( QwtSymbol::XCross );
|
---|
54 | symbol->setSize( 4 );
|
---|
55 |
|
---|
56 | QwtPlotCurve* curve = new QwtPlotCurve(prn);
|
---|
57 | curve->setSymbol( symbol );
|
---|
58 | curve->setStyle( QwtPlotCurve::NoCurve );
|
---|
59 | curve->setLegendAttribute( QwtPlotCurve::LegendShowSymbol );
|
---|
60 | curve->setXAxis(QwtPlot::xBottom);
|
---|
61 | curve->setYAxis(QwtPlot::yLeft);
|
---|
62 | curve->setSamples(xData, yData, epochs.size());
|
---|
63 | curve->attach(this);
|
---|
64 | }
|
---|
65 | }
|
---|
66 |
|
---|