source: ntrip/trunk/BNC/src/bncmap_svg.cpp@ 4628

Last change on this file since 4628 was 4628, checked in by mervart, 12 years ago
File size: 1.3 KB
Line 
1
2#include <QtSvg>
3
4#include <qwt_plot.h>
5#include <qwt_plot_svgitem.h>
6#include <qwt_plot_curve.h>
7#include <qwt_plot_marker.h>
8#include <qwt_plot_grid.h>
9#include <qwt_plot_layout.h>
10#include <qwt_plot_canvas.h>
11#include <qwt_plot_panner.h>
12#include <qwt_plot_magnifier.h>
13
14#include "bncmap.h"
15
16// Constructor
17/////////////////////////////////////////////////////////////////////////////
18t_bncMap::t_bncMap(QWidget* parent) : QDialog(parent) {
19
20 _mapPlot = new QwtPlot();
21
22 (void)new QwtPlotPanner(_mapPlot->canvas());
23 (void)new QwtPlotMagnifier(_mapPlot->canvas());
24
25 _mapPlot->canvas()->setFocusPolicy(Qt::WheelFocus);
26
27 QwtPlotSvgItem* mapItem = new QwtPlotSvgItem();
28 mapItem->loadFile(QRectF(-180.0, -90.0, 360.0, 180.0), ":world.svg");
29 mapItem->attach(_mapPlot);
30
31 QVBoxLayout* mainLayout = new QVBoxLayout(this);
32 mainLayout->addWidget(_mapPlot);
33
34 _mapPlot->replot();
35}
36
37// Destructor
38/////////////////////////////////////////////////////////////////////////////
39t_bncMap::~t_bncMap() {
40 delete _mapPlot;
41}
42
43//
44/////////////////////////////////////////////////////////////////////////////
45void t_bncMap::slotNewPoint(const QString& name, double latDeg, double lonDeg) {
46 QwtPlotMarker* marker = new QwtPlotMarker();
47 marker->setValue(lonDeg, latDeg);
48 marker->setLabel(QwtText(name.left(4)));
49 marker->attach(_mapPlot);
50}
51
52
53
Note: See TracBrowser for help on using the repository browser.