1
#include <qfiledialog.h>
2
#include <qwt_plot_svgitem.h>
3
#include <qwt_plot_grid.h>
4
#include <qwt_plot_layout.h>
5
#include <qwt_plot_canvas.h>
6
#include <qwt_plot_panner.h>
7
#include <qwt_plot_magnifier.h>
10
Plot::Plot(QWidget *parent):
13
d_mapRect(0.0, 0.0, 100.0, 100.0) // something
17
d_mapRect is only a reference for zooming, but
18
the ranges are nothing useful for the user. So we
21
plotLayout()->setCanvasMargin(0);
22
for ( int axis = 0; axis < QwtPlot::axisCnt; axis++ )
23
enableAxis(axis, false);
25
QwtPlotGrid *grid = new QwtPlotGrid();
32
Left Mouse Button: Panning
33
Mouse Wheel: Zooming In/Out
34
Right Mouse Button: Reset to initial
37
(void)new QwtPlotPanner(canvas());
38
(void)new QwtPlotMagnifier(canvas());
40
#if QT_VERSION >= 0x040000
43
canvas()->setFocusPolicy(WheelFocus);
53
#if QT_VERSION >= 0x040000
54
const QString fileName = QFileDialog::getOpenFileName( NULL,
55
"Load a Scaleable Vector Graphic (SVG) Map",
56
dir, "SVG Files (*.svg)");
58
const QString fileName = QFileDialog::getOpenFileName(
59
dir, "SVG Files (*.svg)", NULL, NULL,
60
"Load a Scaleable Vector Graphic (SVG) Map" );
62
if ( !fileName.isEmpty() )
64
if ( d_mapItem == NULL )
66
d_mapItem = new QwtPlotSvgItem();
67
d_mapItem->attach(this);
70
d_mapItem->loadFile(d_mapRect, fileName);
79
setAxisScale(QwtPlot::xBottom,
80
d_mapRect.left(), d_mapRect.right());
81
setAxisScale(QwtPlot::yLeft,
82
d_mapRect.top(), d_mapRect.bottom());