+ untabify

This commit is contained in:
Artem Pavlenko 2010-06-15 12:27:26 +00:00
parent f43c36daad
commit 68ff49d429

View file

@ -35,46 +35,46 @@ bool is_font_file (std::string const& filename)
int main( int argc, char **argv ) int main( int argc, char **argv )
{ {
using mapnik::datasource_cache; using mapnik::datasource_cache;
using mapnik::freetype_engine; using mapnik::freetype_engine;
// modify this prefix based on your install location // modify this prefix based on your install location
std::string mapnik_dir = "/opt/mapnik"; std::string mapnik_dir = "/opt/mapnik";
datasource_cache::instance()->register_datasources(mapnik_dir + "/lib/mapnik2/input"); datasource_cache::instance()->register_datasources(mapnik_dir + "/lib/mapnik2/input");
boost::filesystem::path path(mapnik_dir + "/lib/mapnik2/fonts"); boost::filesystem::path path(mapnik_dir + "/lib/mapnik2/fonts");
boost::filesystem::directory_iterator end_itr; boost::filesystem::directory_iterator end_itr;
if (boost::filesystem::exists(path) && boost::filesystem::is_directory(path)) 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"; std::cout << "register font " << itr->string() << "\n";
freetype_engine::register_font(itr->string()); freetype_engine::register_font(itr->string());
} }
} }
} }
QApplication app( argc, argv ); QApplication app( argc, argv );
MainWindow window; MainWindow window;
window.show(); window.show();
if (argc > 1) window.open(argv[1]); if (argc > 1) window.open(argv[1]);
if (argc == 3) if (argc == 3)
{ {
QStringList list = QString(argv[2]).split(","); QStringList list = QString(argv[2]).split(",");
if (list.size()==4) if (list.size()==4)
{ {
bool ok; bool ok;
double x0 = list[0].toDouble(&ok); double x0 = list[0].toDouble(&ok);
double y0 = list[1].toDouble(&ok); double y0 = list[1].toDouble(&ok);
double x1 = list[2].toDouble(&ok); double x1 = list[2].toDouble(&ok);
double y1 = list[3].toDouble(&ok); double y1 = list[3].toDouble(&ok);
if (ok) window.set_default_extent(x0,y0,x1,y1); if (ok) window.set_default_extent(x0,y0,x1,y1);
} }
} }
return app.exec(); return app.exec();
} }