#pragma once #include #include #include #include namespace mln { 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 std::optional numericValue(const Value& value) { return value.match([](uint64_t t) { return std::optional(static_cast(t)); }, [](int64_t t) { return std::optional(static_cast(t)); }, [](double t) { return std::optional(static_cast(t)); }, [](const auto&) { return std::optional(); }); } inline std::optional featureIDtoString(const FeatureIdentifier& id) { if (id.is()) { return std::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&) -> std::optional { return std::nullopt; }); } } // namespace mln