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 | bncMap::bncMap(QWidget* parent) : QDialog(parent) {
|
---|
19 |
|
---|
20 | QwtPlot* plot = new QwtPlot();
|
---|
21 |
|
---|
22 | (void)new QwtPlotPanner(plot->canvas());
|
---|
23 | (void)new QwtPlotMagnifier(plot->canvas());
|
---|
24 |
|
---|
25 | plot->canvas()->setFocusPolicy(Qt::WheelFocus);
|
---|
26 |
|
---|
27 | QRectF rect(-180.0, -90.0, 360.0, 180.0);
|
---|
28 |
|
---|
29 | QwtPlotSvgItem* map = new QwtPlotSvgItem();
|
---|
30 | map->loadFile(rect, ":world.svg");
|
---|
31 | map->attach(plot);
|
---|
32 |
|
---|
33 | //// beg test
|
---|
34 | for (int ii = -180; ii <= 180; ii += 60) {
|
---|
35 | for (int jj = -80; jj <= 80; jj += 40) {
|
---|
36 | QwtPlotMarker* marker = new QwtPlotMarker();
|
---|
37 | marker->setValue(ii,jj);
|
---|
38 | marker->setLabel(QwtText("TXT"));
|
---|
39 | marker->setItemAttribute(QwtPlotItem::AutoScale, false);
|
---|
40 | marker->attach(plot);
|
---|
41 | }
|
---|
42 | }
|
---|
43 | //// end test
|
---|
44 |
|
---|
45 | QVBoxLayout* mainLayout = new QVBoxLayout(this);
|
---|
46 | mainLayout->addWidget(plot);
|
---|
47 |
|
---|
48 | plot->replot();
|
---|
49 | }
|
---|
50 |
|
---|
51 | // Destructor
|
---|
52 | /////////////////////////////////////////////////////////////////////////////
|
---|
53 | bncMap::~bncMap(){
|
---|
54 | }
|
---|