#include #include #include #include #include namespace mbgl { using namespace style; RenderGeoJSONSource::RenderGeoJSONSource(const style::GeoJSONSource::Impl& impl_) : RenderSource(impl_), impl(impl_) { tilePyramid.setObserver(this); } bool RenderGeoJSONSource::isLoaded() const { return tilePyramid.isLoaded(); } void RenderGeoJSONSource::invalidateTiles() { tilePyramid.invalidateTiles(); } void RenderGeoJSONSource::startRender(algorithm::ClipIDGenerator& generator, const mat4& projMatrix, const mat4& clipMatrix, const TransformState& transform) { generator.update(tilePyramid.getRenderTiles()); tilePyramid.startRender(projMatrix, clipMatrix, transform); } void RenderGeoJSONSource::finishRender(Painter& painter) { tilePyramid.finishRender(painter); } std::map& RenderGeoJSONSource::getRenderTiles() { return tilePyramid.getRenderTiles(); } void RenderGeoJSONSource::updateTiles(const TileParameters& parameters) { GeoJSONData* data_ = impl.getData(); if (!data_) { return; } if (data_ != data) { data = data_; tilePyramid.cache.clear(); for (auto const& item : tilePyramid.tiles) { static_cast(item.second.get())->updateData(data->getTile(item.first.canonical)); } } tilePyramid.updateTiles(parameters, SourceType::GeoJSON, util::tileSize, impl.getZoomRange(), [&] (const OverscaledTileID& tileID) { return std::make_unique(tileID, impl.id, parameters, data->getTile(tileID.canonical)); }); } void RenderGeoJSONSource::removeTiles() { tilePyramid.removeTiles(); } void RenderGeoJSONSource::reloadTiles() { tilePyramid.reloadTiles(); } std::unordered_map> RenderGeoJSONSource::queryRenderedFeatures(const ScreenLineString& geometry, const TransformState& transformState, const RenderedQueryOptions& options) const { return tilePyramid.queryRenderedFeatures(geometry, transformState, options); } std::vector RenderGeoJSONSource::querySourceFeatures(const SourceQueryOptions& options) const { return tilePyramid.querySourceFeatures(options); } void RenderGeoJSONSource::setCacheSize(size_t size) { tilePyramid.setCacheSize(size); } void RenderGeoJSONSource::onLowMemory() { tilePyramid.onLowMemory(); } void RenderGeoJSONSource::dumpDebugLogs() const { tilePyramid.dumpDebugLogs(); } } // namespace mbgl