| 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 | /////////////////////////////////////////////////////////////////////////////
|
|---|
| 18 | t_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 | /////////////////////////////////////////////////////////////////////////////
|
|---|
| 39 | t_bncMap::~t_bncMap() {
|
|---|
| 40 | delete _mapPlot;
|
|---|
| 41 | }
|
|---|
| 42 |
|
|---|
| 43 | //
|
|---|
| 44 | /////////////////////////////////////////////////////////////////////////////
|
|---|
| 45 | void t_bncMap::slotNewPoint(QPointF point, QString name, QPen, double) {
|
|---|
| 46 | QwtPlotMarker* marker = new QwtPlotMarker();
|
|---|
| 47 | marker->setValue(point.x(), point.y());
|
|---|
| 48 | marker->setLabel(QwtText(name));
|
|---|
| 49 | marker->attach(_mapPlot);
|
|---|
| 50 | }
|
|---|
| 51 |
|
|---|
| 52 |
|
|---|
| 53 |
|
|---|