summaryrefslogtreecommitdiff
path: root/src/mbgl/style/sources/geojson_source_impl.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mbgl/style/sources/geojson_source_impl.cpp')
-rw-r--r--src/mbgl/style/sources/geojson_source_impl.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/mbgl/style/sources/geojson_source_impl.cpp b/src/mbgl/style/sources/geojson_source_impl.cpp
index 84f462e410..a89b093fc0 100644
--- a/src/mbgl/style/sources/geojson_source_impl.cpp
+++ b/src/mbgl/style/sources/geojson_source_impl.cpp
@@ -76,7 +76,7 @@ GeoJSONSource::Impl::Impl(std::string id_, GeoJSONOptions options_)
GeoJSONSource::Impl::Impl(const Impl& other, const GeoJSON& geoJSON)
: Source::Impl(other),
options(other.options) {
- double scale = util::EXTENT / util::tileSize;
+ constexpr double scale = util::EXTENT / util::tileSize;
if (options.cluster
&& geoJSON.is<mapbox::geometry::feature_collection<double>>()
@@ -85,7 +85,7 @@ GeoJSONSource::Impl::Impl(const Impl& other, const GeoJSON& geoJSON)
clusterOptions.maxZoom = options.clusterMaxZoom;
clusterOptions.extent = util::EXTENT;
clusterOptions.radius = ::round(scale * options.clusterRadius);
- data = std::make_unique<SuperclusterData>(
+ data = std::make_shared<SuperclusterData>(
geoJSON.get<mapbox::geometry::feature_collection<double>>(), clusterOptions);
} else {
mapbox::geojsonvt::Options vtOptions;
@@ -94,7 +94,7 @@ GeoJSONSource::Impl::Impl(const Impl& other, const GeoJSON& geoJSON)
vtOptions.buffer = ::round(scale * options.buffer);
vtOptions.tolerance = scale * options.tolerance;
vtOptions.lineMetrics = options.lineMetrics;
- data = std::make_unique<GeoJSONVTData>(geoJSON, vtOptions);
+ data = std::make_shared<GeoJSONVTData>(geoJSON, vtOptions);
}
}
@@ -104,8 +104,8 @@ Range<uint8_t> GeoJSONSource::Impl::getZoomRange() const {
return { options.minzoom, options.maxzoom };
}
-GeoJSONData* GeoJSONSource::Impl::getData() const {
- return data.get();
+std::weak_ptr<GeoJSONData> GeoJSONSource::Impl::getData() const {
+ return data;
}
optional<std::string> GeoJSONSource::Impl::getAttribution() const {