source: ntrip/trunk/BNC/src/rinex/availplot.cpp@ 4578

Last change on this file since 4578 was 4578, checked in by mervart, 12 years ago
File size: 1.3 KB
Line 
1
2#include <qwt_scale_engine.h>
3#include <qwt_symbol.h>
4#include <qwt_plot_curve.h>
5#include <qwt_legend.h>
6
7#include "availplot.h"
8
9t_availPlot::t_availPlot(QWidget* parent,
10 QMap<QString, QVector<int> >* prnAvail)
11: QwtPlot(parent) {
12
13 setTitle("Availability Plot");
14
15 // Legend
16 // ------
17 QwtLegend* legend = new QwtLegend;
18 insertLegend(legend, QwtPlot::RightLegend);
19
20 // Axes
21 // ----
22 setAxisTitle(QwtPlot::xBottom, "Epoch");
23 setAxisTitle(QwtPlot::yLeft, "PRN");
24
25 // Curves
26 // ------
27 int iC = 0;
28 QMapIterator<QString, QVector<int> > it(*prnAvail);
29 while (it.hasNext()) {
30 it.next();
31 ++iC;
32 const QString& prn = it.key();
33 const QVector<int>& epochs = it.value();
34
35 double xData[epochs.size()];
36 double yData[epochs.size()];
37 for (int ii = 0; ii < epochs.size(); ii++) {
38 xData[ii] = epochs[ii]/1.e5;
39 yData[ii] = iC;
40 }
41
42 QwtSymbol* symbol = new QwtSymbol( QwtSymbol::XCross );
43 symbol->setSize( 4 );
44
45 QwtPlotCurve* curve = new QwtPlotCurve(prn);
46 curve->setSymbol( symbol );
47 /// curve->setStyle( QwtPlotCurve::NoCurve );
48 curve->setLegendAttribute( QwtPlotCurve::LegendShowSymbol );
49 curve->setXAxis(QwtPlot::xBottom);
50 curve->setYAxis(QwtPlot::yLeft);
51 curve->setSamples(xData, yData, epochs.size());
52 curve->attach(this);
53 }
54}
55
Note: See TracBrowser for help on using the repository browser.