/** * @brief get all tiles that are below this tile on the next zoom level. * Used by RequestManager to enqueue meta tile for pre-rendering. */ void MetaIdentifier::getSubIdentifiers(std::vector<shared_ptr<MetaIdentifier>>& tiles) const { int z = this->zoom + 1; int x = this->x*2; int y = this->y*2; int n = META_TILE_SIZE; tiles.push_back(boost::make_shared<MetaIdentifier>(TileIdentifier(x, y, z, styleSheetpath, imageFormat))); if (x+n < (1 << z)) tiles.push_back(boost::make_shared<MetaIdentifier>(TileIdentifier(x+n, y, z, styleSheetpath, imageFormat))); if (y+n < (1 << z)) tiles.push_back(boost::make_shared<MetaIdentifier>(TileIdentifier(x, y+n, z, styleSheetpath, imageFormat))); if (x+n < (1 << z) && y+n < (1 << z)) tiles.push_back(boost::make_shared<MetaIdentifier>(TileIdentifier(x+n, y+n, z, styleSheetpath, imageFormat))); }
// calls must be locked by write-lock void StylesheetManager::onNewStylesheet(const fs::path& stylesheet_path) { // lock the weak_ptr to manager shared_ptr<RequestManager> manager = this->manager.lock(); assert(manager); shared_ptr<Stylesheet> stylesheet; int timeout = config->get<int>(opt::server::parse_timeout); try { std::string new_filename = stylesheet_path.filename().string() + ".mapcss"; fs::path filename(new_filename); stylesheet = Stylesheet::Load(stylesheetFolder / filename, manager->getGeodata(), timeout); } catch(excp::ParseException& e) { shared_ptr<ParserLogger> logger = *boost::get_error_info<excp::InfoParserLogger>(e); // Something went wrong! logger->errorStream() << "Parsing of file \"" << excp::ErrorOut<excp::InfoFileName>(e, stylesheet_path.string()) << "\" failed:"; logger->errorStream() << excp::ErrorOut<excp::InfoWhat>(e, "unknown reason!"); logger->errorStream() << "In line " << excp::ErrorOut<excp::InfoFailureLine>(e) << " column " << excp::ErrorOut<excp::InfoFailureColumn>(e) << ":"; const string* errLine = boost::get_error_info<excp::InfoFailureLineContent>(e); const int* errColumn = boost::get_error_info<excp::InfoFailureColumn>(e); if(errLine) logger->errorStream() << "'" << *errLine << "'"; if(errColumn) logger->errorStream() << string(*errColumn, ' ') << "^-here"; return; } catch(excp::TimeoutException&) { shared_ptr<ParserLogger> logger = boost::make_shared<ParserLogger>(stylesheet_path.string()); logger->errorStream() << "Parsing of stylesheet " << stylesheet_path << " took more then " << timeout << " ms!"; logger->errorStream() << "Parsing canceled!"; logger->errorStream() << "You can configure the timeout via '--parse-timeout'."; return; } parsedStylesheets[stylesheet_path] = stylesheet; // prerenders the upmost tile as well as all higher zoomlevels that are specified in the configuration manager->enqueue(boost::make_shared<MetaIdentifier>(TileIdentifier(0, 0, 0, stylesheet_path.string(), TileIdentifier::PNG))); }