Files
MapLibreParticleLab/platform/darwin/src/MGLVectorSource.h
Minh Nguyễn 50d2c01d7d [ios, macos] Revamped MGLStyleLayer, MGLSource inheritance
Removed the MGLStyleLayer protocol, because almost none of its members was actually implemented in every class that adopted the protocol. Removed the unused mapView backpointer property with no replacement. Renamed MGLBaseStyleLayer to MGLStyleLayer. Created the intermediate abstract classes MGLForegroundStyleLayer and MGLVectorStyleLayer to cover subsets of style layer classes with like functionality.

Moved each MGLBaseStyleLayer initializer and the corresponding properties down to an abstract subclass such that the initializer makes sense for all concrete subclasses. Moved more initializers and the predicate property up to MGLVectorStyleLayer to eliminate duplication among the concrete subclasses. Marked these initializers as designated initializers.

Removed “source” or “layer” before identifier wherever the type of identifier is apparent. Removed extra MGLGeoJSONSource initializer variants in favor of nullable parameters.

Added copious documentation comments for source and style layer classes, including several previously undocumented methods and properties. In particular, some preconditions and postconditions have been documented. Added pragma marks to break up the jazzy documentation pages into sections. Reformatted exceptions for consistency.
2016-10-06 15:19:38 -07:00

70 lines
2.1 KiB
Objective-C
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#import "MGLSource.h"
#import "MGLTypes.h"
@class MGLTileSet;
NS_ASSUME_NONNULL_BEGIN
/**
A vector tile source. Tiles must be in Mapbox Vector Tile format.
@see <a href="https://www.mapbox.com/mapbox-gl-style-spec/#sources-vector">The
style specification.</a>
*/
@interface MGLVectorSource : MGLSource
#pragma mark Initializing a Source
/**
Returns a vector source initialized with an identifier and TileJSON URL.
After initializing and configuring the source, add it to a map view’s style
using the `-[MGLStyle addSource:]` method.
@param identifier A string that uniquely identifies the source in the style to
which it is added.
@param url A URL to a TileJSON configuration file describing the source’s
contents and other metadata.
@return An initialized vector source.
*/
- (instancetype)initWithIdentifier:(NSString *)identifier URL:(NSURL *)url NS_DESIGNATED_INITIALIZER;
/**
Returns a vector source initialized an identifier and tile set.
After initializing and configuring the source, add it to a map view’s style
using the `-[MGLStyle addSource:]` method.
@param identifier A string that uniquely identifies the source in the style to
which it is added.
@param tileSet A tile set describing the source’s contents and other metadata.
@return An initialized vector source.
*/
- (instancetype)initWithIdentifier:(NSString *)identifier tileSet:(MGLTileSet *)tileSet NS_DESIGNATED_INITIALIZER;
#pragma mark Accessing a Source’s Content
/**
A URL to a TileJSON configuration file describing the source’s contents and
other metadata.
The URL may be a full HTTP or HTTPS URL or a Mapbox URL indicating the tile
set’s map ID (`mapbox://<mapid>`).
If the receiver was initialized using `-initWithIdentifier:tileSet:`, this
property is set to `nil`.
*/
@property (nonatomic, readonly, copy) NSURL *URL;
/**
A tile set describing the source’s contents and other metadata.
If the receiver was initialized using `-initWithIdentifier:URL:`, this property
is set to `nil`.
*/
@property (nonatomic, readonly, nullable) MGLTileSet *tileSet;
@end
NS_ASSUME_NONNULL_END