Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Commit

Permalink
[core] Fix supercluster lambdas capturing
Browse files Browse the repository at this point in the history
  • Loading branch information
pozdnyakov committed Nov 28, 2019
1 parent 32eff46 commit 86c7263
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/mbgl/style/sources/geojson_source_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,24 +91,24 @@ std::shared_ptr<GeoJSONData> GeoJSONData::create(const GeoJSON& geoJSON, Immutab
clusterOptions.maxZoom = options->clusterMaxZoom;
clusterOptions.extent = util::EXTENT;
clusterOptions.radius = ::round(scale * options->clusterRadius);
Feature feature;
clusterOptions.map = [&, options](const PropertyMap& properties) -> PropertyMap {
auto feature = std::make_shared<Feature>();
clusterOptions.map = [feature, options](const PropertyMap& properties) -> PropertyMap {
PropertyMap ret{};
if (properties.empty()) return ret;
for (const auto& p : options->clusterProperties) {
feature.properties = properties;
ret[p.first] = evaluateFeature<Value>(feature, p.second.first);
feature->properties = properties;
ret[p.first] = evaluateFeature<Value>(*feature, p.second.first);
}
return ret;
};
clusterOptions.reduce = [&, options](PropertyMap& toReturn, const PropertyMap& toFill) {
clusterOptions.reduce = [feature, options](PropertyMap& toReturn, const PropertyMap& toFill) {
for (const auto& p : options->clusterProperties) {
if (toFill.count(p.first) == 0) {
continue;
}
feature.properties = toFill;
feature->properties = toFill;
optional<Value> accumulated(toReturn[p.first]);
toReturn[p.first] = evaluateFeature<Value>(feature, p.second.second, accumulated);
toReturn[p.first] = evaluateFeature<Value>(*feature, p.second.second, accumulated);
}
};
return std::make_shared<SuperclusterData>(geoJSON.get<mapbox::feature::feature_collection<double>>(),
Expand Down

0 comments on commit 86c7263

Please sign in to comment.