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.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/mbgl/style/sources/geojson_source_impl.cpp b/src/mbgl/style/sources/geojson_source_impl.cpp
index f9dfcfb310..4800b9c4be 100644
--- a/src/mbgl/style/sources/geojson_source_impl.cpp
+++ b/src/mbgl/style/sources/geojson_source_impl.cpp
@@ -51,7 +51,14 @@ optional<std::string> GeoJSONSource::Impl::getURL() {
return url;
}
+
void GeoJSONSource::Impl::setGeoJSON(const GeoJSON& geoJSON) {
+ req.reset();
+ _setGeoJSON(geoJSON);
+}
+
+//Private implementation
+void GeoJSONSource::Impl::_setGeoJSON(const GeoJSON& geoJSON) {
double scale = util::EXTENT / util::tileSize;
cache.clear();
@@ -74,7 +81,7 @@ void GeoJSONSource::Impl::setGeoJSON(const GeoJSON& geoJSON) {
geoJSONOrSupercluster =
std::make_unique<mapbox::supercluster::Supercluster>(features, clusterOptions);
}
-
+
for (auto const &item : tiles) {
GeoJSONTile* geoJSONTile = static_cast<GeoJSONTile*>(item.second.get());
setTileData(*geoJSONTile, geoJSONTile->id);
@@ -134,9 +141,9 @@ void GeoJSONSource::Impl::loadDescription(FileSource& fileSource) {
geoJSON.error().message.c_str());
// Create an empty GeoJSON VT object to make sure we're not infinitely waiting for
// tiles to load.
- setGeoJSON(GeoJSON{ FeatureCollection{} });
+ _setGeoJSON(GeoJSON{ FeatureCollection{} });
} else {
- setGeoJSON(*geoJSON);
+ _setGeoJSON(*geoJSON);
}
loaded = true;