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

Last change on this file since 4584 was 4584, checked in by mervart, 10 years ago
File size: 1.7 KB
Line 
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#include "reqcanalyze.h"
10
11t_availPlot::t_availPlot(QWidget* parent,
12 QMap<QString, t_availData>* availDataMap)
13: QwtPlot(parent) {
14
15 setCanvasBackground(QColor(Qt::white));
16
17 // Legend
18 // ------
19 QwtLegend* legend = new QwtLegend;
20 insertLegend(legend, QwtPlot::RightLegend);
21
22
23 // grid
24 QwtPlotGrid *grid = new QwtPlotGrid;
25 grid->enableXMin(true);
26 grid->setMajPen(QPen(Qt::gray, 0, Qt::DotLine));
27 grid->setMinPen(QPen(Qt::gray, 0 , Qt::DotLine));
28 grid->attach(this);
29
30 // Axes
31 // ----
32 setAxisTitle(QwtPlot::xBottom, "Epoch");
33 setAxisTitle(QwtPlot::yLeft, "PRN");
34
35 // Curves
36 // ------
37 int iC = 0;
38 QMapIterator<QString, t_availData > it(*availDataMap);
39 while (it.hasNext()) {
40 it.next();
41 ++iC;
42 const QString& prn = it.key();
43 const t_availData& availData = it.value();
44 const QVector<double>& epochs = availData._epoL1;
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 // Important !!!
67 // -------------
68 replot();
69}
70
Note: See TracBrowser for help on using the repository browser.