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

Last change on this file since 4629 was 4629, checked in by mervart, 12 years ago
File size: 1.5 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_canvas.h>
9#include <qwt_plot_panner.h>
10#include <qwt_plot_magnifier.h>
11#include <qwt_symbol.h>
12
13#include "bncmap.h"
14
15// Constructor
16/////////////////////////////////////////////////////////////////////////////
17t_bncMap::t_bncMap(QWidget* parent) : QDialog(parent) {
18
19 _mapPlot = new QwtPlot();
20
21 (void)new QwtPlotPanner(_mapPlot->canvas());
22 (void)new QwtPlotMagnifier(_mapPlot->canvas());
23
24 _mapPlot->canvas()->setFocusPolicy(Qt::WheelFocus);
25
26 QwtPlotSvgItem* mapItem = new QwtPlotSvgItem();
27 mapItem->loadFile(QRectF(-180.0, -90.0, 360.0, 180.0), ":world.svg");
28 mapItem->attach(_mapPlot);
29
30 QVBoxLayout* mainLayout = new QVBoxLayout(this);
31 mainLayout->addWidget(_mapPlot);
32
33 _mapPlot->replot();
34}
35
36// Destructor
37/////////////////////////////////////////////////////////////////////////////
38t_bncMap::~t_bncMap() {
39 delete _mapPlot;
40}
41
42//
43/////////////////////////////////////////////////////////////////////////////
44void t_bncMap::slotNewPoint(const QString& name, double latDeg, double lonDeg) {
45 QColor red(220,20,60);
46 QwtSymbol* symbol = new QwtSymbol(QwtSymbol::Rect, QBrush(red),
47 QPen(red), QSize(2,2));
48 QwtPlotMarker* marker = new QwtPlotMarker();
49 marker->setValue(lonDeg, latDeg);
50 marker->setLabelAlignment(Qt::AlignRight);
51 marker->setLabel(QwtText(name.left(4)));
52 marker->setSymbol(symbol);
53 marker->attach(_mapPlot);
54}
55
56
57
Note: See TracBrowser for help on using the repository browser.