diff options
author | Mikhail Pozdnyakov <mikhail.pozdnyakov@mapbox.com> | 2019-11-28 18:19:17 +0200 |
---|---|---|
committer | Mikhail Pozdnyakov <mikhail.pozdnyakov@mapbox.com> | 2019-11-29 09:53:28 +0200 |
commit | cd4136ed4b4fc5d9a44fe17aa98dfd590c9c0bfb (patch) | |
tree | 42e601f7b16a83a62a8418511b795b6dfcf9eeff /include | |
parent | e3d1daaf6687467ee5c064d2577d2903c508c2dc (diff) | |
download | qtlocation-mapboxgl-cd4136ed4b4fc5d9a44fe17aa98dfd590c9c0bfb.tar.gz |
[core][android][darwin] Fix GeoJSONOptions handling
- share the `GeoJSONOptions` instances using `Immutable<GeoJSONOptions>` - avoid extra copying
- fix wrapping of the `GeoJSONOptions` instances in supercluster map/reduce lambdas.
Previously, local variables were wrapped by reference.
Diffstat (limited to 'include')
-rw-r--r-- | include/mbgl/style/sources/geojson_source.hpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/include/mbgl/style/sources/geojson_source.hpp b/include/mbgl/style/sources/geojson_source.hpp index 549393e9b2..1cc104b245 100644 --- a/include/mbgl/style/sources/geojson_source.hpp +++ b/include/mbgl/style/sources/geojson_source.hpp @@ -34,10 +34,13 @@ struct GeoJSONOptions { std::shared_ptr<mbgl::style::expression::Expression>>; using ClusterProperties = std::unordered_map<std::string, ClusterExpression>; ClusterProperties clusterProperties; + + static Immutable<GeoJSONOptions> defaultOptions(); }; class GeoJSONData { public: - static std::shared_ptr<GeoJSONData> create(const GeoJSON&, const GeoJSONOptions&); + static std::shared_ptr<GeoJSONData> create(const GeoJSON&, + Immutable<GeoJSONOptions> = GeoJSONOptions::defaultOptions()); virtual ~GeoJSONData() = default; virtual mapbox::feature::feature_collection<int16_t> getTile(const CanonicalTileID&) = 0; @@ -52,7 +55,7 @@ public: class GeoJSONSource final : public Source { public: - GeoJSONSource(const std::string& id, optional<GeoJSONOptions> = nullopt); + GeoJSONSource(std::string id, Immutable<GeoJSONOptions> = GeoJSONOptions::defaultOptions()); ~GeoJSONSource() final; void setURL(const std::string& url); |