+ don't fail if load_map throws config error
This commit is contained in:
parent
1cd9c3257d
commit
556df8a751
1 changed files with 17 additions and 17 deletions
|
@ -142,6 +142,7 @@ void MainWindow::reload()
|
||||||
{
|
{
|
||||||
if (!filename_.isEmpty())
|
if (!filename_.isEmpty())
|
||||||
{
|
{
|
||||||
|
|
||||||
mapnik::box2d<double> bbox = mapWidget_->getMap()->getCurrentExtent();
|
mapnik::box2d<double> bbox = mapWidget_->getMap()->getCurrentExtent();
|
||||||
load_map_file(filename_);
|
load_map_file(filename_);
|
||||||
mapWidget_->zoomToBox(bbox);
|
mapWidget_->zoomToBox(bbox);
|
||||||
|
@ -166,24 +167,23 @@ void MainWindow::save()
|
||||||
void MainWindow::load_map_file(QString const& filename)
|
void MainWindow::load_map_file(QString const& filename)
|
||||||
{
|
{
|
||||||
std::cout<<"loading "<< filename.toStdString() << std::endl;
|
std::cout<<"loading "<< filename.toStdString() << std::endl;
|
||||||
try
|
|
||||||
{
|
|
||||||
unsigned width = mapWidget_->width();
|
unsigned width = mapWidget_->width();
|
||||||
unsigned height = mapWidget_->height();
|
unsigned height = mapWidget_->height();
|
||||||
boost::shared_ptr<mapnik::Map> map(new mapnik::Map(width,height));
|
boost::shared_ptr<mapnik::Map> map(new mapnik::Map(width,height));
|
||||||
mapnik::load_map(*map,filename.toStdString());
|
|
||||||
|
|
||||||
mapWidget_->setMap(map);
|
mapWidget_->setMap(map);
|
||||||
map->zoom_all();
|
try
|
||||||
mapnik::box2d<double> const& ext = map->getCurrentExtent();
|
{
|
||||||
mapWidget_->zoomToBox(ext);
|
mapnik::load_map(*map,filename.toStdString());
|
||||||
layerTab_->setModel(new LayerListModel(map,this));
|
|
||||||
styleTab_->setModel(new StyleModel(map,this));
|
|
||||||
}
|
}
|
||||||
catch (mapnik::config_error & ex)
|
catch (mapnik::config_error & ex)
|
||||||
{
|
{
|
||||||
std::cout << ex.what() << "\n";
|
std::cout << ex.what() << "\n";
|
||||||
}
|
}
|
||||||
|
map->zoom_all();
|
||||||
|
mapnik::box2d<double> const& ext = map->getCurrentExtent();
|
||||||
|
mapWidget_->zoomToBox(ext);
|
||||||
|
layerTab_->setModel(new LayerListModel(map,this));
|
||||||
|
styleTab_->setModel(new StyleModel(map,this));
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::zoom_all()
|
void MainWindow::zoom_all()
|
||||||
|
|
Loading…
Reference in a new issue