summaryrefslogtreecommitdiff
path: root/src/mbgl/style/sources/geojson_source_impl.hpp
diff options
context:
space:
mode:
authorJohn Firebaugh <john.firebaugh@gmail.com>2016-06-14 16:07:21 -0700
committerJohn Firebaugh <john.firebaugh@gmail.com>2016-06-16 13:27:15 -0700
commit900568cfb0b84a298395f4d84488fd9323552c63 (patch)
treee2c315656ca57a07ba48e38df5743fb05debb115 /src/mbgl/style/sources/geojson_source_impl.hpp
parent19158d9f01909bf566616524f23e0acb635562f7 (diff)
downloadqtlocation-mapboxgl-900568cfb0b84a298395f4d84488fd9323552c63.tar.gz
[core] Runtime source API: private impls
Diffstat (limited to 'src/mbgl/style/sources/geojson_source_impl.hpp')
-rw-r--r--src/mbgl/style/sources/geojson_source_impl.hpp50
1 files changed, 50 insertions, 0 deletions
diff --git a/src/mbgl/style/sources/geojson_source_impl.hpp b/src/mbgl/style/sources/geojson_source_impl.hpp
new file mode 100644
index 0000000000..350045b27c
--- /dev/null
+++ b/src/mbgl/style/sources/geojson_source_impl.hpp
@@ -0,0 +1,50 @@
+#pragma once
+
+#include <mbgl/style/sources/geojson_source.hpp>
+#include <mbgl/style/source_impl.hpp>
+#include <mbgl/util/rapidjson.hpp>
+#include <mbgl/util/variant.hpp>
+
+namespace mapbox {
+namespace geojsonvt {
+class GeoJSONVT;
+} // namespace geojsonvt
+} // namespace mapbox
+
+namespace mbgl {
+
+class AsyncRequest;
+
+namespace style {
+
+class GeoJSONSource::Impl : public Source::Impl {
+public:
+ using GeoJSON = std::unique_ptr<mapbox::geojsonvt::GeoJSONVT>;
+
+ static std::unique_ptr<GeoJSONSource> parse(const std::string& id, const JSValue&);
+ static GeoJSON parseGeoJSON(const JSValue&);
+
+ Impl(std::string id, Source&,
+ variant<std::string, GeoJSON> urlOrGeoJSON);
+ ~Impl() final;
+
+ void load(FileSource&) final;
+
+ uint16_t getTileSize() const final {
+ return util::tileSize;
+ }
+
+ const variant<std::string, GeoJSON>& getURLOrGeoJSON() const {
+ return urlOrGeoJSON;
+ }
+
+private:
+ Range<uint8_t> getZoomRange() final;
+ std::unique_ptr<Tile> createTile(const OverscaledTileID&, const UpdateParameters&) final;
+
+ variant<std::string, GeoJSON> urlOrGeoJSON;
+ std::unique_ptr<AsyncRequest> req;
+};
+
+} // namespace style
+} // namespace mbgl