[core] Remove optional from GeometryTileFeature::getValue()#13454
[core] Remove optional from GeometryTileFeature::getValue()#13454brunoabinader wants to merge 4 commits intomasterfrom
Conversation
0b3b8bd to
194260f
Compare
194260f to
fc264fb
Compare
|
@kkaefer @tmpsantos @asheemmamoowala please review. This clears the ambiguity with feature property values after removing optional usage from geometry.hpp interface. Requires mapbox/vector-tile#53 to avoid copying the properties map whenever calling |
| FeatureType, | ||
| GeometryCollection, | ||
| std::unordered_map<std::string, std::string> properties = { {} }); | ||
| PropertyMap properties = { {} }); |
| return optional<Value>(it->second); | ||
| } | ||
| return optional<Value>(); | ||
| return it != data->properties.cend() ? it->second : NullValue(); |
There was a problem hiding this comment.
No need to use cend; The const overload of end will automatically be used since this function is const.
| } | ||
| return optional<Value>(); | ||
| Value getValue(const std::string& key) const override { | ||
| return feature.properties.count(key) ? feature.properties.at(key) : NullValue(); |
| } | ||
| return optional<mbgl::Value>(); | ||
| mbgl::Value getValue(const std::string& key) const override { | ||
| return feature.properties.count(key) ? feature.properties.at(key) : NullValue(); |
There was a problem hiding this comment.
Let's not use this pattern; it does the same lookup twice, while the previous code only did it once.
There was a problem hiding this comment.
My bad - forgot to update these.
fc264fb to
f313863
Compare
|
This pull request has been automatically detected as stale because it has not had recent activity and will be archived. Thank you for your contributions. |
Follow-up from #13450, turns out semantics was broken also for
SymbolFeature. This PR replaces theoptionalusage inGeometryTileFeature::getValue(), converting non-existing property values tomapbox::feature::null_value_twhen needed./cc @kkaefer @tmpsantos @asheemmamoowala for review.