1 #pragma once 2 3 #include <mbgl/renderer/render_source.hpp> 4 #include <mbgl/renderer/tile_pyramid.hpp> 5 #include <mbgl/style/sources/geojson_source_impl.hpp> 6 7 namespace mbgl { 8 9 namespace style { 10 class GeoJSONData; 11 } // namespace style 12 13 class RenderGeoJSONSource : public RenderSource { 14 public: 15 RenderGeoJSONSource(Immutable<style::GeoJSONSource::Impl>); 16 17 bool isLoaded() const final; 18 19 void update(Immutable<style::Source::Impl>, 20 const std::vector<Immutable<style::Layer::Impl>>&, 21 bool needsRendering, 22 bool needsRelayout, 23 const TileParameters&) final; 24 25 void startRender(PaintParameters&) final; 26 void finishRender(PaintParameters&) final; 27 28 std::vector<std::reference_wrapper<RenderTile>> getRenderTiles() final; 29 30 std::unordered_map<std::string, std::vector<Feature>> 31 queryRenderedFeatures(const ScreenLineString& geometry, 32 const TransformState& transformState, 33 const std::vector<const RenderLayer*>& layers, 34 const RenderedQueryOptions& options, 35 const mat4& projMatrix) const final; 36 37 std::vector<Feature> 38 querySourceFeatures(const SourceQueryOptions&) const final; 39 40 void reduceMemoryUse() final; 41 void dumpDebugLogs() const final; 42 43 private: 44 const style::GeoJSONSource::Impl& impl() const; 45 46 TilePyramid tilePyramid; 47 style::GeoJSONData* data = nullptr; 48 }; 49 50 template <> is() const51inline bool RenderSource::is<RenderGeoJSONSource>() const { 52 return baseImpl->type == style::SourceType::GeoJSON; 53 } 54 55 } // namespace mbgl 56