summaryrefslogtreecommitdiff
path: root/include/mbgl/style
diff options
context:
space:
mode:
Diffstat (limited to 'include/mbgl/style')
-rw-r--r--include/mbgl/style/sources/custom_vector_source.hpp40
-rw-r--r--include/mbgl/style/sources/geojson_source.hpp2
-rw-r--r--include/mbgl/style/types.hpp3
3 files changed, 44 insertions, 1 deletions
diff --git a/include/mbgl/style/sources/custom_vector_source.hpp b/include/mbgl/style/sources/custom_vector_source.hpp
new file mode 100644
index 0000000000..a256c8e7f7
--- /dev/null
+++ b/include/mbgl/style/sources/custom_vector_source.hpp
@@ -0,0 +1,40 @@
+#pragma once
+
+#include <mbgl/style/source.hpp>
+#include <mbgl/style/sources/geojson_source.hpp>
+#include <mbgl/util/geo.hpp>
+#include <mbgl/util/geojson.hpp>
+#include <mbgl/util/variant.hpp>
+
+namespace mbgl {
+namespace style {
+
+struct Error { std::string message; };
+
+using FetchTileResult = variant<
+ mapbox::geojson::geojson,
+ Error>;
+
+using FetchTileCallback = std::function<void(const CanonicalTileID& tileID, const FetchTileResult&)>;
+using FetchTileFunction = std::function<void(const CanonicalTileID&, FetchTileCallback)>;
+
+class CustomVectorSource : public Source {
+public:
+ CustomVectorSource(std::string id,
+ GeoJSONOptions options,
+ FetchTileFunction fetchTile);
+
+ void loadDescription(FileSource&) final;
+
+ // Private implementation
+ class Impl;
+ const Impl& impl() const;
+};
+
+template <>
+inline bool Source::is<CustomVectorSource>() const {
+ return getType() == SourceType::CustomVector;
+}
+
+} // namespace style
+} // namespace mbgl
diff --git a/include/mbgl/style/sources/geojson_source.hpp b/include/mbgl/style/sources/geojson_source.hpp
index 5bdf1ef957..372e7c7a78 100644
--- a/include/mbgl/style/sources/geojson_source.hpp
+++ b/include/mbgl/style/sources/geojson_source.hpp
@@ -3,6 +3,7 @@
#include <mbgl/style/source.hpp>
#include <mbgl/util/geojson.hpp>
#include <mbgl/util/optional.hpp>
+#include <mbgl/util/constants.hpp>
namespace mbgl {
@@ -14,6 +15,7 @@ struct GeoJSONOptions {
// GeoJSON-VT options
uint8_t minzoom = 0;
uint8_t maxzoom = 18;
+ uint16_t tileSize = util::tileSize;
uint16_t buffer = 128;
double tolerance = 0.375;
diff --git a/include/mbgl/style/types.hpp b/include/mbgl/style/types.hpp
index ec7358de8c..346219d7dc 100644
--- a/include/mbgl/style/types.hpp
+++ b/include/mbgl/style/types.hpp
@@ -11,7 +11,8 @@ enum class SourceType : uint8_t {
GeoJSON,
Video,
Annotations,
- Image
+ Image,
+ CustomVector
};
namespace style {