QGCMapTool.cc 763 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11
#include "QGCMapTool.h"
#include "ui_QGCMapTool.h"

QGCMapTool::QGCMapTool(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::QGCMapTool)
{
    ui->setupUi(this);

    // Connect map and toolbar
    ui->toolBar->setMap(ui->map);
LM's avatar
LM committed
12 13 14 15 16
    // Connect zoom slider and map
    ui->zoomSlider->setMinimum(ui->map->MinZoom());
    ui->zoomSlider->setMaximum(ui->map->MaxZoom());
    ui->zoomSlider->setValue(ui->map->ZoomReal());
    connect(ui->zoomSlider, SIGNAL(valueChanged(int)), ui->map, SLOT(SetZoom(int)));
17 18 19 20 21 22 23 24 25
    connect(ui->map, SIGNAL(zoomChanged(int)), this, SLOT(setZoom(int)));
}

void QGCMapTool::setZoom(int zoom)
{
    if (ui->zoomSlider->value() != zoom)
    {
        ui->zoomSlider->setValue(zoom);
    }
26 27 28 29 30 31
}

QGCMapTool::~QGCMapTool()
{
    delete ui;
}