#include #include namespace mbgl { LiveTileFeature::LiveTileFeature(FeatureType type_, GeometryCollection geometries_, std::unordered_map properties_) : type(type_), properties(properties_), geometries(geometries_) {} mapbox::util::optional LiveTileFeature::getValue(const std::string& key) const { auto it = properties.find(key); if (it != properties.end()) { return mapbox::util::optional(it->second); } return mapbox::util::optional(); } LiveTileLayer::LiveTileLayer() {} void LiveTileLayer::prepareToAddFeatures(size_t count) { features.reserve(features.size() + count); } void LiveTileLayer::addFeature(util::ptr feature) { features.push_back(std::move(feature)); } void LiveTileLayer::removeFeature(util::ptr feature) { for (auto it = features.begin(); it != features.end(); ++it) { if (feature == *it) { features.erase(it); return; } } } LiveTile::LiveTile() {} void LiveTile::addLayer(const std::string& name, util::ptr layer) { layers.emplace(name, std::move(layer)); } void LiveTile::removeLayer(const std::string& name) { layers.erase(name); } util::ptr LiveTile::getLayer(const std::string& name) const { return getMutableLayer(name); } util::ptr LiveTile::getMutableLayer(const std::string& name) const { auto layer_it = layers.find(name); if (layer_it != layers.end()) { return layer_it->second; } return nullptr; } }