#include #include #include #include #include namespace mbgl { using namespace style; RenderGeoJSONSource::RenderGeoJSONSource(Immutable impl_) : RenderSource(impl_) { tilePyramid.setObserver(this); } const style::GeoJSONSource::Impl& RenderGeoJSONSource::impl() const { return static_cast(*baseImpl); } bool RenderGeoJSONSource::isLoaded() const { return tilePyramid.isLoaded(); } void RenderGeoJSONSource::update(Immutable baseImpl_, const std::vector>& layers, const bool needsRendering, const bool needsRelayout, const TileParameters& parameters) { std::swap(baseImpl, baseImpl_); enabled = needsRendering; 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.update(layers, needsRendering, needsRelayout, parameters, SourceType::GeoJSON, util::tileSize, impl().getZoomRange(), [&] (const OverscaledTileID& tileID) { return std::make_unique(tileID, impl().id, parameters, data->getTile(tileID.canonical)); }); } 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(); } std::unordered_map> RenderGeoJSONSource::queryRenderedFeatures(const ScreenLineString& geometry, const TransformState& transformState, const style::Style& style, const RenderedQueryOptions& options) const { return tilePyramid.queryRenderedFeatures(geometry, transformState, style, 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