#pragma once #include #include #include namespace mbgl { class AsyncRequest; namespace style { // NOTE: Any derived class must invalidate `weakFactory` in the destructor class VectorSource final : public TileSource { public: VectorSource(std::string id, variant urlOrTileset, std::optional maxZoom = std::nullopt, std::optional minZoom = std::nullopt); void setTilesetOverrides(Tileset& tileset) override; /// @brief Gets the tile urls for this vector source. /// @return List of tile urls. const std::vector getTiles() const; /// @brief Sets the tile urls for this vector source. /// @param tiles List of tile urls. void setTiles(const std::vector& tiles); bool supportsLayerType(const mbgl::style::LayerTypeInfo*) const override; mapbox::base::WeakPtr makeWeakPtr() override { return weakFactory.makeWeakPtr(); } private: std::optional maxZoom; std::optional minZoom; mapbox::base::WeakPtrFactory weakFactory{this}; // Must remain last }; template <> inline bool Source::is() const { return getType() == SourceType::Vector; } } // namespace style } // namespace mbgl