-
Notifications
You must be signed in to change notification settings - Fork 1.3k
[core] Remove optional from GeometryTileFeature::getValue() #13454
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 = { {} }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
&&?
| return optional<Value>(it->second); | ||
| } | ||
| return optional<Value>(); | ||
| return it != data->properties.cend() ? it->second : NullValue(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same
| } | ||
| 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.