diff options
author | Fabian Guerra <fabian.guerra@mapbox.com> | 2017-08-28 12:43:29 -0400 |
---|---|---|
committer | Fabian Guerra <fabian.guerra@mapbox.com> | 2017-08-28 12:43:29 -0400 |
commit | acfe485302d4356ace93b1ca4a0dcbb9554e08a5 (patch) | |
tree | 6a8f18343cd1856be59d4de06a00034b27e95816 /platform/darwin/src/MGLSource.mm | |
parent | c6ab20e5c69c3705422e49c3511faf3e5ab79b05 (diff) | |
parent | 001988fba1e6eb2f6db2acdb68f26d583c48f53a (diff) | |
download | qtlocation-mapboxgl-acfe485302d4356ace93b1ca4a0dcbb9554e08a5.tar.gz |
Merge tag 'ios-v3.6.2' into master
# Conflicts:
# cmake/core-files.cmake
# include/mbgl/renderer/renderer_backend.hpp
# platform/android/CHANGELOG.md
# platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/AnnotationManager.java
# platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/IconManager.java
# platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMap.java
# platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Projection.java
# platform/android/dependencies.gradle
# platform/darwin/src/MGLStyle.mm
# platform/ios/CHANGELOG.md
# platform/ios/app/Info.plist
# platform/ios/app/MBXViewController.m
# platform/ios/ios.xcodeproj/project.pbxproj
# platform/macos/CHANGELOG.md
# src/mbgl/gl/attribute.cpp
# src/mbgl/gl/attribute.hpp
# src/mbgl/gl/context.hpp
# src/mbgl/gl/types.hpp
# src/mbgl/gl/value.cpp
# src/mbgl/gl/value.hpp
# src/mbgl/map/backend_scope.cpp
# src/mbgl/programs/attributes.hpp
# src/mbgl/programs/program.hpp
# src/mbgl/programs/segment.cpp
# src/mbgl/programs/segment.hpp
# src/mbgl/programs/symbol_program.hpp
# src/mbgl/programs/uniforms.hpp
# src/mbgl/renderer/buckets/symbol_bucket.hpp
# src/mbgl/renderer/painter.cpp
# src/mbgl/renderer/painter.hpp
# src/mbgl/renderer/painter_background.cpp
# src/mbgl/renderer/painter_circle.cpp
# src/mbgl/renderer/painter_clipping.cpp
# src/mbgl/renderer/painter_debug.cpp
# src/mbgl/renderer/painter_fill.cpp
# src/mbgl/renderer/painter_fill_extrusion.cpp
# src/mbgl/renderer/painter_line.cpp
# src/mbgl/renderer/painter_raster.cpp
# src/mbgl/renderer/painter_symbol.cpp
# src/mbgl/shaders/line.cpp
# src/mbgl/shaders/line_pattern.cpp
# test/renderer/backend_scope.test.cpp
Diffstat (limited to 'platform/darwin/src/MGLSource.mm')
-rw-r--r-- | platform/darwin/src/MGLSource.mm | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/platform/darwin/src/MGLSource.mm b/platform/darwin/src/MGLSource.mm index ee012f4d66..6d57e14e8c 100644 --- a/platform/darwin/src/MGLSource.mm +++ b/platform/darwin/src/MGLSource.mm @@ -1,7 +1,9 @@ #import "MGLSource_Private.h" #import "MGLStyle_Private.h" +#import "MGLMapView_Private.h" #include <mbgl/style/style.hpp> +#include <mbgl/map/map.hpp> #include <mbgl/style/source.hpp> @interface MGLSource () @@ -10,7 +12,7 @@ // special internal source types like mbgl::AnnotationSource. @property (nonatomic, readonly) mbgl::style::Source *rawSource; -@property (nonatomic, readonly, weak) MGLStyle *style; +@property (nonatomic, readonly, weak) MGLMapView *mapView; @end @@ -27,37 +29,38 @@ return self; } -- (instancetype)initWithRawSource:(mbgl::style::Source *)rawSource { +- (instancetype)initWithRawSource:(mbgl::style::Source *)rawSource mapView:(MGLMapView *)mapView { NSString *identifier = @(rawSource->getID().c_str()); if (self = [self initWithIdentifier:identifier]) { _rawSource = rawSource; _rawSource->peer = SourceWrapper { self }; + _mapView = mapView; } return self; } - (instancetype)initWithPendingSource:(std::unique_ptr<mbgl::style::Source>)pendingSource { - if (self = [self initWithRawSource:pendingSource.get()]) { + if (self = [self initWithRawSource:pendingSource.get() mapView:nil]) { _pendingSource = std::move(pendingSource); } return self; } -- (void)addToStyle:(MGLStyle *)style { +- (void)addToMapView:(MGLMapView *)mapView { 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, style]; + "to the style more than once is invalid.", self, mapView.style]; } - - _style = style; - style.rawStyle->addSource(std::move(_pendingSource)); + + _mapView = mapView; + _mapView.style.rawStyle->addSource(std::move(_pendingSource)); } -- (void)removeFromStyle:(MGLStyle *)style { - if (self.rawSource == style.rawStyle->getSource(self.identifier.UTF8String)) { - _pendingSource = style.rawStyle->removeSource(self.identifier.UTF8String); - _style = nil; +- (void)removeFromMapView:(MGLMapView *)mapView { + if (self.rawSource == mapView.style.rawStyle->getSource(self.identifier.UTF8String)) { + _pendingSource = mapView.style.rawStyle->removeSource(self.identifier.UTF8String); + _mapView = nil; } } |