From a42f3d7265896dafba5619c71bf6e3c3e01f39ed Mon Sep 17 00:00:00 2001 From: Artem Pavlenko Date: Wed, 20 Jan 2010 15:25:41 +0000 Subject: [PATCH] + tidy + zoom_all on startup --- demo/viewer/main.cpp | 16 ++++++++-------- demo/viewer/mainwindow.cpp | 5 ++++- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/demo/viewer/main.cpp b/demo/viewer/main.cpp index d06a4947a..c91824729 100644 --- a/demo/viewer/main.cpp +++ b/demo/viewer/main.cpp @@ -48,16 +48,16 @@ int main( int argc, char **argv ) if (boost::filesystem::exists(path) && boost::filesystem::is_directory(path)) { - for (boost::filesystem::directory_iterator itr(path);itr!=end_itr;++itr ) + for (boost::filesystem::directory_iterator itr(path);itr!=end_itr;++itr ) + { + if (!boost::filesystem::is_directory(*itr) && is_font_file(itr->path().leaf())) { - if (!boost::filesystem::is_directory(*itr) && is_font_file(itr->path().leaf())) - { - std::cout << "register font " << itr->string() << "\n"; - freetype_engine::register_font(itr->string()); - } + std::cout << "register font " << itr->string() << "\n"; + freetype_engine::register_font(itr->string()); } - } - + } + } + QApplication app( argc, argv ); MainWindow window; window.show(); diff --git a/demo/viewer/mainwindow.cpp b/demo/viewer/mainwindow.cpp index 9e3590309..da6c065ef 100644 --- a/demo/viewer/mainwindow.cpp +++ b/demo/viewer/mainwindow.cpp @@ -169,8 +169,11 @@ void MainWindow::load_map_file(QString const& filename) unsigned height = mapWidget_->height(); boost::shared_ptr map(new mapnik::Map(width,height)); mapnik::load_map(*map,filename.toStdString()); + mapWidget_->setMap(map); - mapWidget_->zoomToBox(default_extent_); + map->zoom_all(); + mapnik::box2d const& ext = map->getCurrentExtent(); + mapWidget_->zoomToBox(ext); layerTab_->setModel(new LayerListModel(map,this)); styleTab_->setModel(new StyleModel(map,this)); }