summaryrefslogtreecommitdiff
path: root/platform/darwin/src/MGLTilePyramidOfflineRegion.mm
diff options
context:
space:
mode:
Diffstat (limited to 'platform/darwin/src/MGLTilePyramidOfflineRegion.mm')
-rw-r--r--platform/darwin/src/MGLTilePyramidOfflineRegion.mm23
1 files changed, 17 insertions, 6 deletions
diff --git a/platform/darwin/src/MGLTilePyramidOfflineRegion.mm b/platform/darwin/src/MGLTilePyramidOfflineRegion.mm
index 4b19b76508..a398d6baa4 100644
--- a/platform/darwin/src/MGLTilePyramidOfflineRegion.mm
+++ b/platform/darwin/src/MGLTilePyramidOfflineRegion.mm
@@ -23,6 +23,7 @@
}
@synthesize styleURL = _styleURL;
+@synthesize includesIdeographicGlyphs = _includesIdeographicGlyphs;
-(NSDictionary *)offlineStartEventAttributes {
return @{
@@ -67,6 +68,7 @@
_bounds = bounds;
_minimumZoomLevel = minimumZoomLevel;
_maximumZoomLevel = maximumZoomLevel;
+ _includesIdeographicGlyphs = YES;
}
return self;
}
@@ -74,7 +76,9 @@
- (instancetype)initWithOfflineRegionDefinition:(const mbgl::OfflineTilePyramidRegionDefinition &)definition {
NSURL *styleURL = [NSURL URLWithString:@(definition.styleURL.c_str())];
MGLCoordinateBounds bounds = MGLCoordinateBoundsFromLatLngBounds(definition.bounds);
- return [self initWithStyleURL:styleURL bounds:bounds fromZoomLevel:definition.minZoom toZoomLevel:definition.maxZoom];
+ MGLTilePyramidOfflineRegion* result = [self initWithStyleURL:styleURL bounds:bounds fromZoomLevel:definition.minZoom toZoomLevel:definition.maxZoom];
+ result.includesIdeographicGlyphs = definition.includeIdeographs;
+ return result;
}
- (const mbgl::OfflineRegionDefinition)offlineRegionDefinition {
@@ -86,7 +90,7 @@
return mbgl::OfflineTilePyramidRegionDefinition(_styleURL.absoluteString.UTF8String,
MGLLatLngBoundsFromCoordinateBounds(_bounds),
_minimumZoomLevel, _maximumZoomLevel,
- scaleFactor);
+ scaleFactor, _includesIdeographicGlyphs);
}
- (nullable instancetype)initWithCoder:(NSCoder *)coder {
@@ -100,7 +104,9 @@
double minimumZoomLevel = [coder decodeDoubleForKey:@"minimumZoomLevel"];
double maximumZoomLevel = [coder decodeDoubleForKey:@"maximumZoomLevel"];
- return [self initWithStyleURL:styleURL bounds:bounds fromZoomLevel:minimumZoomLevel toZoomLevel:maximumZoomLevel];
+ MGLTilePyramidOfflineRegion* result = [self initWithStyleURL:styleURL bounds:bounds fromZoomLevel:minimumZoomLevel toZoomLevel:maximumZoomLevel];
+ result.includesIdeographicGlyphs = [coder decodeBoolForKey:@"includesIdeographicGlyphs"];
+ return result;
}
- (void)encodeWithCoder:(NSCoder *)coder
@@ -112,10 +118,13 @@
[coder encodeDouble:_bounds.ne.longitude forKey:@"northEastLongitude"];
[coder encodeDouble:_maximumZoomLevel forKey:@"maximumZoomLevel"];
[coder encodeDouble:_minimumZoomLevel forKey:@"minimumZoomLevel"];
+ [coder encodeBool:_includesIdeographicGlyphs forKey:@"includesIdeographicGlyphs"];
}
- (id)copyWithZone:(nullable NSZone *)zone {
- return [[[self class] allocWithZone:zone] initWithStyleURL:_styleURL bounds:_bounds fromZoomLevel:_minimumZoomLevel toZoomLevel:_maximumZoomLevel];
+ MGLTilePyramidOfflineRegion* result = [[[self class] allocWithZone:zone] initWithStyleURL:_styleURL bounds:_bounds fromZoomLevel:_minimumZoomLevel toZoomLevel:_maximumZoomLevel];
+ result.includesIdeographicGlyphs = _includesIdeographicGlyphs;
+ return result;
}
- (BOOL)isEqual:(id)other {
@@ -130,14 +139,16 @@
return (_minimumZoomLevel == otherRegion->_minimumZoomLevel
&& _maximumZoomLevel == otherRegion->_maximumZoomLevel
&& MGLCoordinateBoundsEqualToCoordinateBounds(_bounds, otherRegion->_bounds)
- && [_styleURL isEqual:otherRegion->_styleURL]);
+ && [_styleURL isEqual:otherRegion->_styleURL]
+ && _includesIdeographicGlyphs == otherRegion->_includesIdeographicGlyphs);
}
- (NSUInteger)hash {
return (_styleURL.hash
+ @(_bounds.sw.latitude).hash + @(_bounds.sw.longitude).hash
+ @(_bounds.ne.latitude).hash + @(_bounds.ne.longitude).hash
- + @(_minimumZoomLevel).hash + @(_maximumZoomLevel).hash);
+ + @(_minimumZoomLevel).hash + @(_maximumZoomLevel).hash
+ + @(_includesIdeographicGlyphs).hash);
}
@end