MGLComputedShapeSource
@interface MGLComputedShapeSource : MGLAbstractShapeSource
A source for vector data that is fetched one tile at a time. Useful for sources that are too large to fit in memory, or are already divided into tiles, but not in Mapbox Vector Tile format.
Supported options are MGLShapeSourceOptionMinimumZoomLevel
, MGLShapeSourceOptionMaximumZoomLevel
,
MGLShapeSourceOptionBuffer
, and MGLShapeSourceOptionSimplificationTolerance.
This source does
not support clustering.
-
Returns a custom shape data source initialized with an identifier, and a dictionary of options for the source according to the style specification.
Declaration
Objective-C
- (nonnull instancetype) initWithIdentifier:(nonnull NSString *)identifier options:(nullable NSDictionary<MGLShapeSourceOption, id> *)options;
Swift
init(identifier: String, options: [MGLShapeSourceOption : Any]? = nil)
Parameters
identifier
A string that uniquely identifies the source.
options
An
NSDictionary
of options for this source. -
Returns a custom shape data source initialized with an identifier, data source, and a dictionary of options for the source according to the style specification.
Declaration
Objective-C
- (nonnull instancetype) initWithIdentifier:(nonnull NSString *)identifier dataSource:(nonnull id<MGLComputedShapeSourceDataSource>)dataSource options:(nullable NSDictionary<MGLShapeSourceOption, id> *)options;
Swift
convenience init(identifier: String, dataSource: MGLComputedShapeSourceDataSource, options: [MGLShapeSourceOption : Any]? = nil)
Parameters
identifier
A string that uniquely identifies the source.
options
An
NSDictionary
of options for this source. -
Invalidates all the features and properties intersecting with or contained in the specified bounds. New fetch requests will immediately be invoked on the
MGLComputedShapeSourceDataSource
.Declaration
Objective-C
- (void)invalidateBounds:(MGLCoordinateBounds)bounds;
Swift
func invalidateBounds(_ bounds: MGLCoordinateBounds)
Parameters
bounds
Coordinate bounds to invalidate.
-
Invalidates all the feautres and properties of a given tile. A new fetch request will immediately be invoked on the
MGLComputedShapeSourceDataSource
.Declaration
Objective-C
- (void)invalidateTileAtX:(NSUInteger)x y:(NSUInteger)y zoomLevel:(NSUInteger)zoomLevel;
Swift
func invalidateTileAt(x: UInt, y: UInt, zoomLevel: UInt)
Parameters
x
Tile X coordinate.
y
Tile Y coordinate.
zoomLevel
Tile zoom level.
-
Set a new set of features for a tile. This method can be invkoed from background threads. For best performance, use this method only to update tiles that have already been requested through
MGLComputedShapeSourceDataSource.
Declaration
Objective-C
- (void)setFeatures:(nonnull NSArray<MGLShape<MGLFeature> *> *)features inTileAtX:(NSUInteger)x y:(NSUInteger)y zoomLevel:(NSUInteger)zoomLevel;
Parameters
features
Features for the tile.
x
Tile X coordinate.
y
Tile Y coordinate.
zoomLevel
Tile zoom level.
-
An object that implements the
MGLComputedShapeSourceDataSource
protocol that will be queried for tile data.Declaration
Objective-C
@property (readwrite, nonatomic, nullable) id<MGLComputedShapeSourceDataSource> dataSource;
Swift
weak var dataSource: MGLComputedShapeSourceDataSource? { get set }
-
A queue that calls to the data source will be made on.
Declaration
Objective-C
@property (readonly, nonatomic) NSOperationQueue *_Nonnull requestQueue;
Swift
var requestQueue: OperationQueue { get }