diff options
Diffstat (limited to 'src/mbgl/map')
-rw-r--r-- | src/mbgl/map/map.cpp | 9 | ||||
-rw-r--r-- | src/mbgl/map/map_impl.cpp | 9 | ||||
-rw-r--r-- | src/mbgl/map/map_impl.hpp | 10 | ||||
-rw-r--r-- | src/mbgl/map/map_options.cpp | 33 |
4 files changed, 18 insertions, 43 deletions
diff --git a/src/mbgl/map/map.cpp b/src/mbgl/map/map.cpp index e8237cca74..24b2435923 100644 --- a/src/mbgl/map/map.cpp +++ b/src/mbgl/map/map.cpp @@ -31,10 +31,13 @@ Map::Map(RendererFrontend& frontend, MapObserver& observer, const Size size, const float pixelRatio, - FileSource& fileSource, Scheduler& scheduler, - const MapOptions& mapOptions) - : impl(std::make_unique<Impl>(frontend, observer, fileSource, scheduler, size, pixelRatio, mapOptions)) {} + const MapOptions& mapOptions, + const ResourceOptions& resourceOptions) + : impl(std::make_unique<Impl>(frontend, observer, scheduler, size, pixelRatio, + FileSource::getSharedFileSource(resourceOptions), mapOptions)) {} + +Map::Map(std::unique_ptr<Impl> impl_) : impl(std::move(impl_)) {} Map::~Map() = default; diff --git a/src/mbgl/map/map_impl.cpp b/src/mbgl/map/map_impl.cpp index fbceff559f..348e26700f 100644 --- a/src/mbgl/map/map_impl.cpp +++ b/src/mbgl/map/map_impl.cpp @@ -1,6 +1,7 @@ #include <mbgl/layermanager/layer_manager.hpp> #include <mbgl/map/map_impl.hpp> #include <mbgl/renderer/update_parameters.hpp> +#include <mbgl/storage/file_source.hpp> #include <mbgl/style/style_impl.hpp> #include <mbgl/util/exception.hpp> @@ -8,20 +9,20 @@ namespace mbgl { Map::Impl::Impl(RendererFrontend& frontend_, MapObserver& observer_, - FileSource& fileSource_, Scheduler& scheduler_, Size size_, float pixelRatio_, + std::shared_ptr<FileSource> fileSource_, const MapOptions& mapOptions) : observer(observer_), rendererFrontend(frontend_), - fileSource(fileSource_), scheduler(scheduler_), transform(observer, mapOptions.constrainMode(), mapOptions.viewportMode()), mode(mapOptions.mapMode()), pixelRatio(pixelRatio_), crossSourceCollisions(mapOptions.crossSourceCollisions()), - style(std::make_unique<style::Style>(scheduler, fileSource, pixelRatio)), + fileSource(std::move(fileSource_)), + style(std::make_unique<style::Style>(scheduler, *fileSource, pixelRatio)), annotationManager(*style) { style->impl->setObserver(this); rendererFrontend.setObserver(*this); @@ -65,7 +66,7 @@ void Map::Impl::onUpdate() { style->impl->getSourceImpls(), style->impl->getLayerImpls(), annotationManager, - fileSource, + *fileSource, prefetchZoomDelta, bool(stillImageRequest), crossSourceCollisions diff --git a/src/mbgl/map/map_impl.hpp b/src/mbgl/map/map_impl.hpp index d65fe5aafc..13ffdc02ae 100644 --- a/src/mbgl/map/map_impl.hpp +++ b/src/mbgl/map/map_impl.hpp @@ -1,5 +1,6 @@ #pragma once +#include <mbgl/actor/actor.hpp> #include <mbgl/actor/scheduler.hpp> #include <mbgl/annotation/annotation_manager.hpp> #include <mbgl/map/map.hpp> @@ -9,7 +10,6 @@ #include <mbgl/map/transform.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> @@ -17,6 +17,9 @@ namespace mbgl { +class FileSource; +class ResourceTransform; + struct StillImageRequest { StillImageRequest(Map::StillImageCallback&& callback_) : callback(std::move(callback_)) { @@ -27,7 +30,7 @@ struct StillImageRequest { class Map::Impl : public style::Observer, public RendererObserver { public: - Impl(RendererFrontend&, MapObserver&, FileSource&, Scheduler&, Size size, float pixelRatio, const MapOptions&); + Impl(RendererFrontend&, MapObserver&, Scheduler&, Size size, float pixelRatio, std::shared_ptr<FileSource>, const MapOptions&); ~Impl() final; // StyleObserver @@ -50,7 +53,6 @@ public: MapObserver& observer; RendererFrontend& rendererFrontend; - FileSource& fileSource; Scheduler& scheduler; Transform transform; @@ -61,6 +63,8 @@ public: MapDebugOptions debugOptions { MapDebugOptions::NoDebug }; + std::shared_ptr<FileSource> fileSource; + std::unique_ptr<style::Style> style; AnnotationManager annotationManager; diff --git a/src/mbgl/map/map_options.cpp b/src/mbgl/map/map_options.cpp index 118fcaf3df..ddb3f8e3be 100644 --- a/src/mbgl/map/map_options.cpp +++ b/src/mbgl/map/map_options.cpp @@ -1,7 +1,4 @@ #include <mbgl/map/map_options.hpp> -#include <mbgl/util/constants.hpp> - -#include <cassert> namespace mbgl { @@ -10,9 +7,6 @@ public: MapMode mapMode = MapMode::Continuous; ConstrainMode constrainMode = ConstrainMode::HeightOnly; ViewportMode viewportMode = ViewportMode::Default; - std::string cachePath; - std::string assetRoot; - uint64_t maximumSize{mbgl::util::DEFAULT_MAX_CACHE_SIZE}; bool crossSourceCollisions = true; }; @@ -46,33 +40,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; return *this; |