#pragma once #include #include #include namespace mbgl { using Value = mapbox::base::Value; using NullValue = mapbox::base::NullValue; using PropertyMap = mapbox::base::ValueObject; using FeatureIdentifier = mapbox::feature::identifier; using GeoJSONFeature = mapbox::feature::feature; using FeatureState = mapbox::base::ValueObject; using FeatureStates = std::unordered_map; // using LayerFeatureStates = std::unordered_map; // class Feature : public GeoJSONFeature { public: std::string source; std::string sourceLayer; PropertyMap state; using GeometryType = mapbox::geometry::geometry; Feature() = default; Feature(const GeoJSONFeature& f) : GeoJSONFeature(f) {} Feature(const GeometryType& geom_) : GeoJSONFeature(geom_) {} Feature(GeometryType&& geom_) : GeoJSONFeature(std::move(geom_)) {} }; template optional numericValue(const Value& value) { return value.match([](uint64_t t) { return optional(t); }, [](int64_t t) { return optional(t); }, [](double t) { return optional(t); }, [](const auto&) { return optional(); }); } inline optional featureIDtoString(const FeatureIdentifier& id) { if (id.is()) { return nullopt; } return id.match( [](const std::string& value_) { return value_; }, [](uint64_t value_) { return util::toString(value_); }, [](int64_t value_) { return util::toString(value_); }, [](double value_) { return util::toString(value_); }, [](const auto&) -> optional { return nullopt; }); } } // namespace mbgl