#ifndef MBGL_ANNOTATION_GEOJSON_VT_TILE #define MBGL_ANNOTATION_GEOJSON_VT_TILE #include #include #include namespace mapbox { namespace geojsonvt { class GeoJSONVT; } // namespace geojsonvt } // namespace mapbox namespace mbgl { // Implements a simple in-memory Tile type that holds GeoJSON values. A GeoJSON tile can only have // one layer, and it is always returned regardless of which layer is requested. class GeoJSONTileFeature : public GeometryTileFeature { public: using Tags = std::unordered_map; GeoJSONTileFeature(FeatureType, GeometryCollection&&, Tags&& = Tags{}); FeatureType getType() const override; optional getValue(const std::string&) const override; GeometryCollection getGeometries() const override; private: const FeatureType type; const GeometryCollection geometries; const Tags tags; }; class GeoJSONTileLayer : public GeometryTileLayer { public: using Features = std::vector>; GeoJSONTileLayer(Features&&); std::size_t featureCount() const override; util::ptr getFeature(std::size_t) const override; private: const Features features; }; class GeoJSONTile : public GeometryTile { public: GeoJSONTile(std::shared_ptr); util::ptr getLayer(const std::string&) const override; private: const std::shared_ptr layer; }; class GeoJSONTileMonitor : public GeometryTileMonitor { public: GeoJSONTileMonitor(mapbox::geojsonvt::GeoJSONVT*, const TileID&); virtual ~GeoJSONTileMonitor(); std::unique_ptr monitorTile(const GeometryTileMonitor::Callback&) override; void setGeoJSONVT(mapbox::geojsonvt::GeoJSONVT*); private: void update(); public: const TileID tileID; private: mapbox::geojsonvt::GeoJSONVT* geojsonvt = nullptr; GeometryTileMonitor::Callback callback; }; } // namespace mbgl #endif