diff options
author | Minh Nguyễn <mxn@1ec5.org> | 2016-12-23 15:14:54 -0800 |
---|---|---|
committer | Minh Nguyễn <mxn@1ec5.org> | 2017-01-05 10:22:10 -0800 |
commit | 4700c72e1501aca9509d9e051b1afc2d2112597e (patch) | |
tree | 21ee50ed87d9e2ed3f0698186c3a24ce3ec63594 /platform/darwin/src/MGLStyle.mm | |
parent | b6f7d03e5d4cb632dd3c59e3c6451e33fadca945 (diff) | |
download | qtlocation-mapboxgl-4700c72e1501aca9509d9e051b1afc2d2112597e.tar.gz |
[ios, macos] Relaxed sources, layers type
Refined the types of MGLStyle’s sources and layers types so that Objective-C code can easily send messages intended for subclasses of MGLSource or MGLStyleLayer that are contained in one of these containers.
Diffstat (limited to 'platform/darwin/src/MGLStyle.mm')
-rw-r--r-- | platform/darwin/src/MGLStyle.mm | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/platform/darwin/src/MGLStyle.mm b/platform/darwin/src/MGLStyle.mm index 959ba4e363..fcfa762972 100644 --- a/platform/darwin/src/MGLStyle.mm +++ b/platform/darwin/src/MGLStyle.mm @@ -127,9 +127,9 @@ static NSURL *MGLStyleURL_emerald; #pragma mark Sources -- (NS_SET_OF(MGLSource *) *)sources { +- (NS_SET_OF(__kindof MGLSource *) *)sources { auto rawSources = self.mapView.mbglMap->getSources(); - NSMutableSet *sources = [NSMutableSet setWithCapacity:rawSources.size()]; + NS_MUTABLE_SET_OF(__kindof MGLSource *) *sources = [NSMutableSet setWithCapacity:rawSources.size()]; for (auto rawSource = rawSources.begin(); rawSource != rawSources.end(); ++rawSource) { MGLSource *source = [self sourceFromMBGLSource:*rawSource]; [sources addObject:source]; @@ -137,7 +137,7 @@ static NSURL *MGLStyleURL_emerald; return sources; } -- (void)setSources:(NS_SET_OF(MGLSource *) *)sources { +- (void)setSources:(NS_SET_OF(__kindof MGLSource *) *)sources { for (MGLSource *source in self.sources) { [self removeSource:source]; } @@ -222,10 +222,10 @@ static NSURL *MGLStyleURL_emerald; #pragma mark Style layers -- (NS_ARRAY_OF(MGLStyleLayer *) *)layers +- (NS_ARRAY_OF(__kindof MGLStyleLayer *) *)layers { auto layers = self.mapView.mbglMap->getLayers(); - NSMutableArray *styleLayers = [NSMutableArray arrayWithCapacity:layers.size()]; + NS_MUTABLE_ARRAY_OF(__kindof MGLStyleLayer *) *styleLayers = [NSMutableArray arrayWithCapacity:layers.size()]; for (auto layer : layers) { MGLStyleLayer *styleLayer = [self layerFromMBGLLayer:layer]; [styleLayers addObject:styleLayer]; @@ -233,7 +233,7 @@ static NSURL *MGLStyleURL_emerald; return styleLayers; } -- (void)setLayers:(NS_ARRAY_OF(MGLStyleLayer *) *)layers { +- (void)setLayers:(NS_ARRAY_OF(__kindof MGLStyleLayer *) *)layers { for (MGLStyleLayer *layer in self.layers) { [self removeLayer:layer]; } |