diff options
Diffstat (limited to 'src/mbgl/map')
-rw-r--r-- | src/mbgl/map/map.cpp | 11 | ||||
-rw-r--r-- | src/mbgl/map/map_impl.cpp | 8 | ||||
-rw-r--r-- | src/mbgl/map/map_impl.hpp | 11 | ||||
-rw-r--r-- | src/mbgl/map/map_options.cpp | 26 |
4 files changed, 15 insertions, 41 deletions
diff --git a/src/mbgl/map/map.cpp b/src/mbgl/map/map.cpp index 8b90aee492..059746430c 100644 --- a/src/mbgl/map/map.cpp +++ b/src/mbgl/map/map.cpp @@ -9,9 +9,6 @@ #include <mbgl/renderer/update_parameters.hpp> #include <mbgl/renderer/renderer_frontend.hpp> #include <mbgl/renderer/renderer_observer.hpp> -#include <mbgl/storage/file_source.hpp> -#include <mbgl/storage/resource.hpp> -#include <mbgl/storage/response.hpp> #include <mbgl/util/constants.hpp> #include <mbgl/util/math.hpp> #include <mbgl/util/exception.hpp> @@ -30,17 +27,17 @@ Map::Map(RendererFrontend& rendererFrontend, MapObserver& mapObserver, const Size size, const float pixelRatio, - FileSource& fileSource, - const MapOptions& options) + const MapOptions& options, + const FileSourceOptions& fileSourceOptions) : impl(std::make_unique<Impl>(*this, rendererFrontend, mapObserver, - fileSource, size, pixelRatio, options.mapMode(), options.viewportMode(), - options.crossSourceCollisions())) {} + options.crossSourceCollisions(), + fileSourceOptions)) {} Map::~Map() = default; diff --git a/src/mbgl/map/map_impl.cpp b/src/mbgl/map/map_impl.cpp index 15caa34af4..572e1440e8 100644 --- a/src/mbgl/map/map_impl.cpp +++ b/src/mbgl/map/map_impl.cpp @@ -8,21 +8,21 @@ namespace mbgl { Map::Impl::Impl(Map& map_, RendererFrontend& frontend, MapObserver& mapObserver, - FileSource& fileSource_, Size size_, float pixelRatio_, MapMode mode_, ViewportMode viewportMode_, - bool crossSourceCollisions_) + bool crossSourceCollisions_, + const FileSourceOptions& fileSourceOptions) : map(map_), observer(mapObserver), rendererFrontend(frontend), - fileSource(fileSource_), + fileSource(platform::Factory::sharedFileSource(fileSourceOptions)), transform(observer, viewportMode_), mode(mode_), pixelRatio(pixelRatio_), crossSourceCollisions(crossSourceCollisions_), - style(std::make_unique<style::Style>(fileSource, pixelRatio)), + style(std::make_unique<style::Style>(pixelRatio, fileSourceOptions)), annotationManager(*style) { style->impl->setObserver(this); diff --git a/src/mbgl/map/map_impl.hpp b/src/mbgl/map/map_impl.hpp index af64d8c0f6..331ae7a588 100644 --- a/src/mbgl/map/map_impl.hpp +++ b/src/mbgl/map/map_impl.hpp @@ -5,9 +5,9 @@ #include <mbgl/map/map_observer.hpp> #include <mbgl/map/mode.hpp> #include <mbgl/map/transform.hpp> +#include <mbgl/platform/factory.hpp> #include <mbgl/renderer/renderer_frontend.hpp> #include <mbgl/renderer/renderer_observer.hpp> -#include <mbgl/storage/file_source.hpp> #include <mbgl/style/observer.hpp> #include <mbgl/style/source.hpp> #include <mbgl/style/style.hpp> @@ -28,14 +28,15 @@ public: Impl(Map&, RendererFrontend&, MapObserver&, - FileSource&, Size size, float pixelRatio, MapMode, ViewportMode, - bool crossSourceCollisions); + bool crossSourceCollisions, + + const FileSourceOptions& fileSourceOptions); ~Impl() final; @@ -57,7 +58,9 @@ public: Map& map; MapObserver& observer; RendererFrontend& rendererFrontend; - FileSource& fileSource; + + // Keeps a reference to the initialized file source. + std::shared_ptr<FileSource> fileSource; Transform transform; diff --git a/src/mbgl/map/map_options.cpp b/src/mbgl/map/map_options.cpp index 34586f364c..90f81d4b36 100644 --- a/src/mbgl/map/map_options.cpp +++ b/src/mbgl/map/map_options.cpp @@ -36,32 +36,6 @@ ViewportMode MapOptions::viewportMode() const { return impl_->viewportMode; } -MapOptions& MapOptions::withCachePath(std::string path) { - impl_->cachePath = std::move(path); - return *this; -} - -const std::string& MapOptions::cachePath() const { - return impl_->cachePath; -} - -MapOptions& MapOptions::withAssetRoot(std::string path) { - impl_->assetRoot = std::move(path); - return *this; -} - -const std::string& MapOptions::assetRoot() const { - return impl_->assetRoot; -} - -MapOptions& MapOptions::withMaximumCacheSize(uint64_t size) { - impl_->maximumSize = size; - return *this; -} - -uint64_t MapOptions::maximumCacheSize() const { - return impl_->maximumSize; -} MapOptions& MapOptions::withCrossSourceCollisions(bool enableCollisions) { impl_->crossSourceCollisions = enableCollisions; |