void parseRasterTile(RasterBucket* bucket, std::string data, std::function<void (TileParseResult)> callback) { std::unique_ptr<util::Image> image(new util::Image(data)); if (!(*image)) { callback(TileParseResult("error parsing raster image")); } if (!bucket->setImage(std::move(image))) { callback(TileParseResult("error setting raster image to bucket")); } callback(TileParseResult(TileData::State::parsed)); }
void parseLiveTile(TileWorker* worker, const LiveTile* tile, std::function<void (TileParseResult)> callback) { try { callback(worker->parse(*tile)); } catch (const std::exception& ex) { callback(TileParseResult(ex.what())); } }
void parseVectorTile(TileWorker* worker, std::string data, std::function<void (TileParseResult)> callback) { try { pbf tilePBF(reinterpret_cast<const unsigned char *>(data.data()), data.size()); callback(worker->parse(VectorTile(tilePBF))); } catch (const std::exception& ex) { callback(TileParseResult(ex.what())); } }
void parsePendingGeometryTileLayers(TileWorker* worker, std::function<void(TileParseResult)> callback) { try { callback(worker->parsePendingLayers()); } catch (const std::exception& ex) { callback(TileParseResult(ex.what())); } }
void parseGeometryTile(TileWorker* worker, std::vector<std::unique_ptr<StyleLayer>> layers, std::unique_ptr<GeometryTile> tile, PlacementConfig config, std::function<void(TileParseResult)> callback) { try { callback(worker->parseAllLayers(std::move(layers), *tile, config)); } catch (const std::exception& ex) { callback(TileParseResult(ex.what())); } }