* [ios, macos] Audited source headers for nullability * [macos] Made MGLTileSet public * [ios, macos] Replaced MGLTileSet with MGLTileSource MGLRasterSource and MGLVectorSource now share a common abstract superclass, MGLTileSource. MGLTileSet has been removed. MGLTileSource is modeled after mbgl::style::RasterSource and mbgl::style::VectorSource. It has initializers that incorporate the parameters of MGLTileSet’s initializers, but it lacks getters for everything but the attribution string. MGLTileSet’s properties have been converted into options that can be passed into MGLTileSource’s initializers in a dictionary. Properly implement rawSource as a covariant property so that it doesn’t end up getting autosynthesized as a shadow ivar. This prevents concrete subclasses of MGLSource from setting _rawSource directly but getting a different value out of self.rawSource. Marked -[MGLSource init] as unavailable and ensured that concrete subclasses of MGLSource have the right set of initializers marked as designated initializers. Documentation comments for each concrete source class identify the corresponding source type in the style specification. Clarified the purpose of MGLTileSetScheme, now known as MGLTileCoordinateSystem. * [ios, macos] Clarified tile size interpretation Sticking to a default value of 256 for mapbox: URLs, but other URLs get the standard 512 value. * [ios, macos] rawSource is always set * [ios, macos] Cleaned up MGLShapeSource initialization rawSource is never nil, so there’s no need for a -commonInit method. Extracted -geoJSONOptions from MGLShapeSource into a standalone function for easier testing. * [ios, macos] Synchronized headers in project Realphabetized headers in groups. Added headers missing from one project or the other. * [ios, macos] Added MGLShape methods to (de)serialize GeoJSON data Added a class initializer and instance method to MGLShape that deserialize and serialize the shape as GeoJSON data, respectively. The new initializer handles parsing errors gracefully. Removed methods specific to GeoJSON data from MGLShapeSource, in an effort to reduce parallel state. Developers are now expected to go through the new MGLShape initializer to get an MGLShape representation. Alternatively, a local file URL can be passed into the other MGLShapeSource initializer. * [ios, macos] Typo in assertion message * [ios, macos] Simplified GeoJSON serialization Every MGLShape now knows its most specific mbgl::GeoJSON representation. * [ios, macos] Reremoved MGLFeaturePrivate mbgl::GeoJSON, which is a variant, allows a single GeoJSON representation method to traffic in whatever type is needed for a particular shape class. This change removes some hidden private protocols, which are a bug waiting to happen. * [ios, macos] Fixed covariant rawLayer property Properly implement rawLayer as a covariant property so that it doesn’t end up getting autosynthesized as a shadow ivar. This prevents concrete subclasses of MGLStyleLayer from setting _rawLayer directly but getting a different value out of self.rawLayer. * [ios, macos] Use MGLAttributionInfo for source attribution Made MGLAttributionInfo public. Replaced MGLTileSource’s attribution property with an attributionInfos property set to an array of MGLAttributionInfo objects. Added an MGLTileSourceOption for specifying an array of MGLAttributionInfo objects instead of an HTML string (either is acceptable when creating an MGLTileSource). * [ios, macos] Corrected method references in documentation
53 lines
1.6 KiB
Objective-C
53 lines
1.6 KiB
Objective-C
#import "MGLSource.h"
|
|
|
|
NS_ASSUME_NONNULL_BEGIN
|
|
|
|
namespace mbgl {
|
|
namespace style {
|
|
class Source;
|
|
}
|
|
}
|
|
|
|
@class MGLMapView;
|
|
|
|
@interface MGLSource (Private)
|
|
|
|
/**
|
|
Initializes and returns a source with a raw pointer to the backing store.
|
|
*/
|
|
- (instancetype)initWithRawSource:(mbgl::style::Source *)rawSource;
|
|
|
|
/**
|
|
A raw pointer to the mbgl object, which is always initialized, either to the
|
|
value returned by `mbgl::Map getSource`, or for independently created objects,
|
|
to the pointer value held in `pendingSource`. In the latter case, this raw
|
|
pointer value stays even after ownership of the object is transferred via
|
|
`mbgl::Map addSource`.
|
|
*/
|
|
@property (nonatomic) mbgl::style::Source *rawSource;
|
|
|
|
/**
|
|
Adds the mbgl source that this object represents to the mbgl map.
|
|
|
|
Once a mbgl source is added, ownership of the object is transferred to the
|
|
`mbgl::Map` and this object no longer has an active unique_ptr reference to the
|
|
`mbgl::Source`. If this object's mbgl source is in that state, the mbgl source
|
|
can still be changed but the changes will not be visible until the `MGLSource`
|
|
is added back to the map via `-[MGLStyle addSource:]` and styled with a
|
|
`MGLLayer`.
|
|
*/
|
|
- (void)addToMapView:(MGLMapView *)mapView;
|
|
|
|
/**
|
|
Removes the mbgl source that this object represents from the mbgl map.
|
|
|
|
When a mbgl source is removed, ownership of the object is transferred back
|
|
to the `MGLSource` instance and the unique_ptr reference is valid again. It is
|
|
safe to add the source back to the style after it is removed.
|
|
*/
|
|
- (void)removeFromMapView:(MGLMapView *)mapView;
|
|
|
|
@end
|
|
|
|
NS_ASSUME_NONNULL_END
|