[core] Add MapOptions to define properties of Map

To simplify the Map constructor, introduce MapOptions
interface to define the properties that can be set on
a Map.
This commit is contained in:
Sudarsana Babu Nagineni
2019-03-07 14:29:19 +02:00
parent c4115f0539
commit 5e2b6bf636
26 changed files with 326 additions and 50 deletions

View File

@@ -13,6 +13,7 @@
#include <jni/jni.hpp>
#include <mbgl/map/map_options.hpp>
#include <mbgl/math/minmax.hpp>
#include <mbgl/util/constants.hpp>
#include <mbgl/util/event.hpp>
@@ -79,12 +80,18 @@ NativeMapView::NativeMapView(jni::JNIEnv& _env,
// Create a renderer frontend
rendererFrontend = std::make_unique<AndroidRendererFrontend>(mapRenderer);
// Create Map options
MapOptions options;
options.withMapMode(MapMode::Continuous)
.withConstrainMode(ConstrainMode::HeightOnly)
.withViewportMode(ViewportMode::Default)
.withCrossSourceCollisions(_crossSourceCollisions);
// Create the core map
map = std::make_unique<mbgl::Map>(*rendererFrontend, *this,
mbgl::Size{ static_cast<uint32_t>(width),
static_cast<uint32_t>(height) }, pixelRatio,
fileSource, *threadPool, MapMode::Continuous,
ConstrainMode::HeightOnly, ViewportMode::Default, _crossSourceCollisions);
fileSource, *threadPool, options);
}
/**