Merge branch 'master' of github.com:mapnik/mapnik

This commit is contained in:
Dane Springmeyer 2012-07-10 09:36:28 -07:00
commit 5a968959b5
4 changed files with 46 additions and 25 deletions

View file

@ -32,6 +32,7 @@
#include <QItemDelegate> #include <QItemDelegate>
#include <QSlider> #include <QSlider>
#include <QComboBox> #include <QComboBox>
#include <QDoubleSpinBox>
// mapnik // mapnik
@ -102,6 +103,9 @@ MainWindow::MainWindow()
connect(renderer_selector_,SIGNAL(currentIndexChanged(QString const&)), connect(renderer_selector_,SIGNAL(currentIndexChanged(QString const&)),
mapWidget_, SLOT(updateRenderer(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(update_mapwidget()),mapWidget_,SLOT(updateMap()));
connect(layerTab_,SIGNAL(layerSelected(int)), connect(layerTab_,SIGNAL(layerSelected(int)),
@ -383,6 +387,13 @@ void MainWindow::createToolBars()
renderer_selector_->addItem("Grid"); renderer_selector_->addItem("Grid");
fileToolBar->addWidget(renderer_selector_); 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_ = new QSlider(Qt::Horizontal,fileToolBar);
slider_->setRange(1,18); slider_->setRange(1,18);
slider_->setTickPosition(QSlider::TicksBelow); slider_->setTickPosition(QSlider::TicksBelow);

View file

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

View file

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

View file

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