+ add scale_factor_ UI (QDoubleSpinBox)

This commit is contained in:
artemp 2012-07-10 16:58:43 +01:00
parent 216768fbc0
commit 6cde3e6864
4 changed files with 46 additions and 25 deletions

View file

@ -32,6 +32,7 @@
#include <QItemDelegate>
#include <QSlider>
#include <QComboBox>
#include <QDoubleSpinBox>
// mapnik
@ -102,6 +103,9 @@ MainWindow::MainWindow()
connect(renderer_selector_,SIGNAL(currentIndexChanged(QString const&)),
mapWidget_, SLOT(updateRenderer(QString const&)));
// scale factor
connect(scale_factor_,SIGNAL(valueChanged(double)),
mapWidget_, SLOT(updateScaleFactor(double)));
//
connect(layerTab_,SIGNAL(update_mapwidget()),mapWidget_,SLOT(updateMap()));
connect(layerTab_,SIGNAL(layerSelected(int)),
@ -383,6 +387,13 @@ void MainWindow::createToolBars()
renderer_selector_->addItem("Grid");
fileToolBar->addWidget(renderer_selector_);
scale_factor_ = new QDoubleSpinBox(fileToolBar);
scale_factor_->setMinimum(0.1);
scale_factor_->setMaximum(5.0);
scale_factor_->setSingleStep(0.1);
scale_factor_->setValue(1.0);
fileToolBar->addWidget(scale_factor_);
slider_ = new QSlider(Qt::Horizontal,fileToolBar);
slider_->setRange(1,18);
slider_->setTickPosition(QSlider::TicksBelow);

View file

@ -28,6 +28,7 @@
#include <QActionGroup>
#include <QStatusBar>
#include <QAbstractItemModel>
#include <QDoubleSpinBox>
#include "mapwidget.hpp"
@ -37,6 +38,7 @@ class LayerTab;
class StyleTab;
class QSlider;
class QComboBox;
class QDoubleSpinBox;
class MainWindow : public QMainWindow
{
@ -108,6 +110,7 @@ private:
QStatusBar *status;
QSlider * slider_;
QComboBox * renderer_selector_;
QDoubleSpinBox * scale_factor_;
mapnik::box2d<double> default_extent_;
};

View file

@ -588,6 +588,12 @@ void MapWidget::updateRenderer(QString const& txt)
updateMap();
}
void MapWidget::updateScaleFactor(double scale_factor)
{
set_scaling_factor(scale_factor);
updateMap();
}
void MapWidget::updateMap()
{
if (map_)

View file

@ -91,6 +91,7 @@ public slots:
void updateMap();
void layerSelected(int);
void updateRenderer(QString const& txt);
void updateScaleFactor(double scale_factor);
signals:
void mapViewChanged();
protected: