summaryrefslogtreecommitdiff
path: root/src/mbgl/tile
diff options
context:
space:
mode:
Diffstat (limited to 'src/mbgl/tile')
-rw-r--r--src/mbgl/tile/geojson_tile_data.hpp8
-rw-r--r--src/mbgl/tile/geometry_tile_data.hpp4
-rw-r--r--src/mbgl/tile/vector_tile_data.cpp5
-rw-r--r--src/mbgl/tile/vector_tile_data.hpp2
4 files changed, 7 insertions, 12 deletions
diff --git a/src/mbgl/tile/geojson_tile_data.hpp b/src/mbgl/tile/geojson_tile_data.hpp
index 70a985db47..9325f1bb16 100644
--- a/src/mbgl/tile/geojson_tile_data.hpp
+++ b/src/mbgl/tile/geojson_tile_data.hpp
@@ -36,12 +36,8 @@ public:
return geometry;
}
- optional<Value> getValue(const std::string& key) const override {
- auto it = feature.properties.find(key);
- if (it != feature.properties.end()) {
- return optional<Value>(it->second);
- }
- return optional<Value>();
+ Value getValue(const std::string& key) const override {
+ return feature.properties.count(key) ? feature.properties.at(key) : NullValue();
}
};
diff --git a/src/mbgl/tile/geometry_tile_data.hpp b/src/mbgl/tile/geometry_tile_data.hpp
index 3913615465..8200e51ad8 100644
--- a/src/mbgl/tile/geometry_tile_data.hpp
+++ b/src/mbgl/tile/geometry_tile_data.hpp
@@ -41,8 +41,8 @@ class GeometryTileFeature {
public:
virtual ~GeometryTileFeature() = default;
virtual FeatureType getType() const = 0;
- virtual optional<Value> getValue(const std::string& key) const = 0;
- virtual const PropertyMap& getProperties() const { static PropertyMap empty; return empty; }
+ virtual Value getValue(const std::string& key) const = 0;
+ virtual const PropertyMap& getProperties() const = 0;
virtual FeatureIdentifier getID() const { return NullValue {}; }
virtual GeometryCollection getGeometries() const = 0;
};
diff --git a/src/mbgl/tile/vector_tile_data.cpp b/src/mbgl/tile/vector_tile_data.cpp
index 305f8e7dcf..be66dc0709 100644
--- a/src/mbgl/tile/vector_tile_data.cpp
+++ b/src/mbgl/tile/vector_tile_data.cpp
@@ -21,9 +21,8 @@ FeatureType VectorTileFeature::getType() const {
}
}
-optional<Value> VectorTileFeature::getValue(const std::string& key) const {
- const optional<Value> value(feature.getValue(key));
- return value->is<NullValue>() ? nullopt : std::move(value);
+Value VectorTileFeature::getValue(const std::string& key) const {
+ return feature.getValue(key);
}
const PropertyMap& VectorTileFeature::getProperties() const {
diff --git a/src/mbgl/tile/vector_tile_data.hpp b/src/mbgl/tile/vector_tile_data.hpp
index 7a169ac44c..ace20bcfc4 100644
--- a/src/mbgl/tile/vector_tile_data.hpp
+++ b/src/mbgl/tile/vector_tile_data.hpp
@@ -14,7 +14,7 @@ public:
VectorTileFeature(const mapbox::vector_tile::layer&, const protozero::data_view&);
FeatureType getType() const override;
- optional<Value> getValue(const std::string& key) const override;
+ Value getValue(const std::string& key) const override;
const PropertyMap& getProperties() const override;
FeatureIdentifier getID() const override;
GeometryCollection getGeometries() const override;