From b44302af2aac3aa8ad7ee13be7c44fd1334cc81c Mon Sep 17 00:00:00 2001 From: "Thiago Marcos P. Santos" Date: Mon, 27 Nov 2017 17:24:25 +0200 Subject: Bump Mapbox GL Native mapbox-gl-native @ cf3357ea4517e74ba3a63434c330a1506064b130 --- .../mbgl/style/sources/custom_geometry_source.hpp | 56 ++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 include/mbgl/style/sources/custom_geometry_source.hpp (limited to 'include/mbgl/style/sources/custom_geometry_source.hpp') diff --git a/include/mbgl/style/sources/custom_geometry_source.hpp b/include/mbgl/style/sources/custom_geometry_source.hpp new file mode 100644 index 0000000000..a0b990b44b --- /dev/null +++ b/include/mbgl/style/sources/custom_geometry_source.hpp @@ -0,0 +1,56 @@ +#pragma once + +#include +#include +#include +#include +#include + +namespace mbgl { + +class OverscaledTileID; +class CanonicalTileID; +template +class Actor; + +namespace style { + +using TileFunction = std::function; + +class CustomTileLoader; + +class CustomGeometrySource : public Source { +public: + struct TileOptions { + double tolerance = 0.375; + uint16_t tileSize = util::tileSize; + uint16_t buffer = 128; + }; + + struct Options { + TileFunction fetchTileFunction; + TileFunction cancelTileFunction; + Range zoomRange = { 0, 18}; + TileOptions tileOptions; + }; +public: + CustomGeometrySource(std::string id, CustomGeometrySource::Options options); + ~CustomGeometrySource() final; + void loadDescription(FileSource&) final; + void setTileData(const CanonicalTileID&, const GeoJSON&); + void invalidateTile(const CanonicalTileID&); + void invalidateRegion(const LatLngBounds&); + // Private implementation + class Impl; + const Impl& impl() const; +private: + std::unique_ptr> loader; +}; + +template <> +inline bool Source::is() const { + return getType() == SourceType::CustomVector; +} + +} // namespace style +} // namespace mbgl -- cgit v1.2.1