summaryrefslogtreecommitdiff
path: root/platform/darwin/src/MGLSource.mm
diff options
context:
space:
mode:
authorJohn Firebaugh <john.firebaugh@gmail.com>2017-04-21 13:35:34 -0700
committerJohn Firebaugh <john.firebaugh@gmail.com>2017-06-22 08:04:39 -0700
commit1520a56813f82bbe875774fdc2b3df26392278d6 (patch)
treed8f6ccc10e118bd2be6a954951c037f9c2fc1384 /platform/darwin/src/MGLSource.mm
parentbe7e9bbb8d54c775127f53d793c117c4bf5e2764 (diff)
downloadqtlocation-mapboxgl-1520a56813f82bbe875774fdc2b3df26392278d6.tar.gz
[all] Promote Style to public API
Diffstat (limited to 'platform/darwin/src/MGLSource.mm')
-rw-r--r--platform/darwin/src/MGLSource.mm22
1 files changed, 11 insertions, 11 deletions
diff --git a/platform/darwin/src/MGLSource.mm b/platform/darwin/src/MGLSource.mm
index eb859ba2c0..ee012f4d66 100644
--- a/platform/darwin/src/MGLSource.mm
+++ b/platform/darwin/src/MGLSource.mm
@@ -1,7 +1,7 @@
#import "MGLSource_Private.h"
-#import "MGLMapView_Private.h"
+#import "MGLStyle_Private.h"
-#include <mbgl/map/map.hpp>
+#include <mbgl/style/style.hpp>
#include <mbgl/style/source.hpp>
@interface MGLSource ()
@@ -10,7 +10,7 @@
// special internal source types like mbgl::AnnotationSource.
@property (nonatomic, readonly) mbgl::style::Source *rawSource;
-@property (nonatomic, readonly, weak) MGLMapView *mapView;
+@property (nonatomic, readonly, weak) MGLStyle *style;
@end
@@ -43,21 +43,21 @@
return self;
}
-- (void)addToMapView:(MGLMapView *)mapView {
+- (void)addToStyle:(MGLStyle *)style {
if (_pendingSource == nullptr) {
[NSException raise:@"MGLRedundantSourceException"
format:@"This instance %@ was already added to %@. Adding the same source instance " \
- "to the style more than once is invalid.", self, mapView.style];
+ "to the style more than once is invalid.", self, style];
}
- _mapView = mapView;
- mapView.mbglMap->addSource(std::move(_pendingSource));
+ _style = style;
+ style.rawStyle->addSource(std::move(_pendingSource));
}
-- (void)removeFromMapView:(MGLMapView *)mapView {
- if (self.rawSource == mapView.mbglMap->getSource(self.identifier.UTF8String)) {
- _pendingSource = mapView.mbglMap->removeSource(self.identifier.UTF8String);
- _mapView = nil;
+- (void)removeFromStyle:(MGLStyle *)style {
+ if (self.rawSource == style.rawStyle->getSource(self.identifier.UTF8String)) {
+ _pendingSource = style.rawStyle->removeSource(self.identifier.UTF8String);
+ _style = nil;
}
}