summaryrefslogtreecommitdiff
path: root/include/mbgl/util
diff options
context:
space:
mode:
authorJuha Alanen <juha.alanen@mapbox.com>2019-10-03 15:57:05 +0300
committerJuha Alanen <juha.alanen@mapbox.com>2019-10-28 16:46:55 +0200
commit360b8b42471d7196511ab11edb4f9f277329af13 (patch)
tree6a0122d1e5527e2f7bbf4b0dcd4437203370fe69 /include/mbgl/util
parent7c9c71fba1233a6474bd4a8885e9e5d7588fd890 (diff)
downloadqtlocation-mapboxgl-360b8b42471d7196511ab11edb4f9f277329af13.tar.gz
[core,android,darwin,qt] Add fields related to feature-state
Move the fields from geometry.hpp/feature.hpp as they are not part of the GeoJSON specification.
Diffstat (limited to 'include/mbgl/util')
-rw-r--r--include/mbgl/util/feature.hpp16
1 files changed, 15 insertions, 1 deletions
diff --git a/include/mbgl/util/feature.hpp b/include/mbgl/util/feature.hpp
index 6080976945..5d8fe89e36 100644
--- a/include/mbgl/util/feature.hpp
+++ b/include/mbgl/util/feature.hpp
@@ -11,11 +11,25 @@ using Value = mapbox::base::Value;
using NullValue = mapbox::base::NullValue;
using PropertyMap = mapbox::base::ValueObject;
using FeatureIdentifier = mapbox::feature::identifier;
-using Feature = mapbox::feature::feature<double>;
+using GeoJSONFeature = mapbox::feature::feature<double>;
using FeatureState = mapbox::base::ValueObject;
using FeatureStates = std::unordered_map<std::string, FeatureState>; // <featureID, FeatureState>
using LayerFeatureStates = std::unordered_map<std::string, FeatureStates>; // <sourceLayer, FeatureStates>
+class Feature : public GeoJSONFeature {
+public:
+ std::string source;
+ std::string sourceLayer;
+ PropertyMap state;
+
+ using GeometryType = mapbox::geometry::geometry<double>;
+
+ Feature() = default;
+ Feature(const GeoJSONFeature& f) : GeoJSONFeature(f) {}
+ Feature(const GeometryType& geom_) : GeoJSONFeature(geom_) {}
+ Feature(GeometryType&& geom_) : GeoJSONFeature(std::move(geom_)) {}
+};
+
template <class T>
optional<T> numericValue(const Value& value) {
return value.match(