[core] Fix properties of GeoJSON layers in queryRenderedFeatures
This commit is contained in:
@@ -6,8 +6,8 @@ namespace mbgl {
|
||||
|
||||
GeoJSONTileFeature::GeoJSONTileFeature(FeatureType type_,
|
||||
GeometryCollection&& geometries_,
|
||||
GeoJSONTileFeature::Tags&& tags_)
|
||||
: type(type_), geometries(std::move(geometries_)), tags(std::move(tags_)) {
|
||||
Feature::property_map&& properties_)
|
||||
: type(type_), geometries(std::move(geometries_)), properties(std::move(properties_)) {
|
||||
}
|
||||
|
||||
FeatureType GeoJSONTileFeature::getType() const {
|
||||
@@ -15,8 +15,8 @@ FeatureType GeoJSONTileFeature::getType() const {
|
||||
}
|
||||
|
||||
optional<Value> GeoJSONTileFeature::getValue(const std::string& key) const {
|
||||
auto it = tags.find(key);
|
||||
if (it != tags.end()) {
|
||||
auto it = properties.find(key);
|
||||
if (it != properties.end()) {
|
||||
return optional<Value>(it->second);
|
||||
}
|
||||
return optional<Value>();
|
||||
@@ -89,10 +89,10 @@ std::unique_ptr<GeoJSONTile> convertTile(const mapbox::geojsonvt::Tile& tile) {
|
||||
}
|
||||
}
|
||||
|
||||
GeoJSONTileFeature::Tags tags{ feature.tags.begin(), feature.tags.end() };
|
||||
Feature::property_map properties { feature.tags.begin(), feature.tags.end() };
|
||||
|
||||
features.emplace_back(std::make_shared<GeoJSONTileFeature>(
|
||||
featureType, std::move(geometry), std::move(tags)));
|
||||
featureType, std::move(geometry), std::move(properties)));
|
||||
}
|
||||
|
||||
layer = std::make_unique<GeoJSONTileLayer>(std::move(features));
|
||||
|
||||
@@ -19,17 +19,16 @@ namespace mbgl {
|
||||
|
||||
class GeoJSONTileFeature : public GeometryTileFeature {
|
||||
public:
|
||||
using Tags = std::unordered_map<std::string, std::string>;
|
||||
|
||||
GeoJSONTileFeature(FeatureType, GeometryCollection&&, Tags&& = Tags{});
|
||||
GeoJSONTileFeature(FeatureType, GeometryCollection&&, Feature::property_map&&);
|
||||
FeatureType getType() const override;
|
||||
optional<Value> getValue(const std::string&) const override;
|
||||
Feature::property_map getProperties() const override { return properties; }
|
||||
GeometryCollection getGeometries() const override;
|
||||
|
||||
private:
|
||||
const FeatureType type;
|
||||
const GeometryCollection geometries;
|
||||
const Tags tags;
|
||||
const Feature::property_map properties;
|
||||
};
|
||||
|
||||
class GeoJSONTileLayer : public GeometryTileLayer {
|
||||
|
||||
Reference in New Issue
Block a user