summaryrefslogtreecommitdiff
path: root/platform/ios/src/MGLMapView.mm
diff options
context:
space:
mode:
authorAndrew Kitchen <andrew.kitchen@mapbox.com>2017-12-04 13:29:16 -0800
committerChris Loer <chris.loer@mapbox.com>2017-12-11 10:43:00 -0800
commitb2f06677a787fe7b9b08608e5a55aaedbe50ed3a (patch)
tree6ee6e3687aa8c7f68e8a75354d8c57f0f0be70a5 /platform/ios/src/MGLMapView.mm
parent00ed34f7d700ae255eae1af1ca46b939ffee219d (diff)
downloadqtlocation-mapboxgl-b2f06677a787fe7b9b08608e5a55aaedbe50ed3a.tar.gz
[darwin, ios, macos] Introduces an MGLRendererConfiguration class
Instructions for enabling client-side rendering of CJK glyphs live in this header, and this class provides the rest of the values needed for instantiating the renderer on iOS and macOS.
Diffstat (limited to 'platform/ios/src/MGLMapView.mm')
-rw-r--r--platform/ios/src/MGLMapView.mm18
1 files changed, 5 insertions, 13 deletions
diff --git a/platform/ios/src/MGLMapView.mm b/platform/ios/src/MGLMapView.mm
index cf79e63632..c60e56f808 100644
--- a/platform/ios/src/MGLMapView.mm
+++ b/platform/ios/src/MGLMapView.mm
@@ -43,6 +43,7 @@
#import "MGLOfflineStorage_Private.h"
#import "MGLFoundation_Private.h"
#import "MGLRendererFrontend.h"
+#import "MGLRendererConfiguration.h"
#import "MGLVectorSource+MGLAdditions.h"
#import "NSBundle+MGLAdditions.h"
@@ -199,7 +200,6 @@ public:
@property (nonatomic) NS_MUTABLE_ARRAY_OF(NSLayoutConstraint *) *attributionButtonConstraints;
@property (nonatomic, readwrite) MGLStyle *style;
-@property (nonatomic, readonly) NSString *ideographicFontFamilyName;
@property (nonatomic) UITapGestureRecognizer *singleTapGestureRecognizer;
@property (nonatomic) UITapGestureRecognizer *doubleTap;
@@ -324,7 +324,7 @@ public:
+ (void)initialize
{
- if (self == [MGLMapView self])
+ if (self == [MGLMapView class])
{
[MGLSDKUpdateChecker checkForUpdates];
}
@@ -407,14 +407,12 @@ public:
[[NSFileManager defaultManager] removeItemAtPath:fileCachePath error:NULL];
// setup mbgl map
- mbgl::DefaultFileSource *mbglFileSource = [MGLOfflineStorage sharedOfflineStorage].mbglFileSource;
- const float scaleFactor = [UIScreen instancesRespondToSelector:@selector(nativeScale)] ? [[UIScreen mainScreen] nativeScale] : [[UIScreen mainScreen] scale];
+ MGLRendererConfiguration *config = [MGLRendererConfiguration currentConfiguration];
_mbglThreadPool = mbgl::sharedThreadPool();
- NSString *fontFamilyName = self.ideographicFontFamilyName;
- auto renderer = std::make_unique<mbgl::Renderer>(*_mbglView, scaleFactor, *mbglFileSource, *_mbglThreadPool, mbgl::GLContextMode::Unique, mbgl::optional<std::string>(), fontFamilyName ? std::string([fontFamilyName UTF8String]) : mbgl::optional<std::string>());
+ auto renderer = std::make_unique<mbgl::Renderer>(*_mbglView, config.scaleFactor, *config.fileSource, *_mbglThreadPool, config.contextMode, config.cacheDir, config.localFontFamilyName);
_rendererFrontend = std::make_unique<MGLRenderFrontend>(std::move(renderer), self, *_mbglView);
- _mbglMap = new mbgl::Map(*_rendererFrontend, *_mbglView, self.size, scaleFactor, *mbglFileSource, *_mbglThreadPool, mbgl::MapMode::Continuous, mbgl::ConstrainMode::None, mbgl::ViewportMode::Default);
+ _mbglMap = new mbgl::Map(*_rendererFrontend, *_mbglView, self.size, config.scaleFactor, *[config fileSource], *_mbglThreadPool, mbgl::MapMode::Continuous, mbgl::ConstrainMode::None, mbgl::ViewportMode::Default);
// start paused if in IB
if (_isTargetingInterfaceBuilder || background) {
@@ -3482,12 +3480,6 @@ public:
[self.style removeStyleClass:styleClass];
}
-#pragma mark Ideographic Font Info
-
-- (NSString *)ideographicFontFamilyName {
- return [[NSBundle mainBundle] objectForInfoDictionaryKey:@"MGLIdeographicFontFamilyName"];
-}
-
#pragma mark - Annotations -
- (nullable NS_ARRAY_OF(id <MGLAnnotation>) *)annotations