[ios, macos] Update and reformat documentation for runtime styling (#7475)

* [ios, macos] Optimized changelog for runtime styling

Changelog entries related to style JSON now lead off with the analogous portion of the runtime styling API.

* [ios, macos] Autolink cross-class property references in docs

jazzy can autolink `Class.property` references in documentation comments.

* [ios, macos] Removed extra blank lines

* [ios, macos] Corrected typo in MGLMultiPoint docs

* [ios, macos] Rewrote shape and feature docs

Rewrote documentation about MGLShape, its subclasses, and MGLFeature to emphasize runtime styling uses over annotation uses, associate each type with real-world concepts, cross-reference related style layer classes, and cross-reference related or easily confused shape classes. Links to the GeoJSON specification have been updated to RFC 7946.

* [ios, macos] Expanded style layer docs

With this change, documentation about style layer classes is nominally based on the documentation in the style specification. However, all the existing layer types’ documentation has been overridden to explain what the layer looks like, relate the layer to a real-world concept, and cross-reference related geometry classes. This change also corrects the description of MGLBackgroundStyleLayer, which erroneously stated that the identifier must be “background”, whereas that only happens to be true by default for Studio template styles.

* [ios, macos] Wrap style layer docs

* [ios, macos] Removed unused code

* [ios, macos] Corrected symbol references in docs

* [ios, macos] Corrected typo in abstract class exception
This commit is contained in:
Minh Nguyễn
2016-12-20 16:11:05 -08:00
committed by GitHub
parent a174588e6c
commit 1254bcdb40
27 changed files with 1131 additions and 479 deletions

View File

@@ -46,6 +46,15 @@ _.forOwn(cocoaConventions, function (properties, kind) {
})
});
String.prototype.wrap = function (cols, indent) {
let wrapRe = new RegExp(`(.{1,${cols - indent}})(?: +|\n|$)`, "gm");
return this.replace(wrapRe, "$1\n").replace(/\s+$/, "").indent(indent);
};
String.prototype.indent = function (cols) {
return this.replace(/^|\n/g, "$&" + " ".repeat(cols));
};
global.camelize = function (str) {
return str.replace(/(?:^|-)(.)/g, function (_, x) {
return x.toUpperCase();
@@ -126,7 +135,7 @@ global.testHelperMessage = function (property, layerType, isFunction) {
}
};
global.propertyDoc = function (propertyName, property, layerType) {
global.propertyDoc = function (propertyName, property, layerType, kind) {
// Match references to other property names & values.
// Requires the format 'When `foo` is set to `bar`,'.
let doc = property.doc.replace(/`([^`]+?)` is set to `([^`]+?)`/g, function (m, peerPropertyName, propertyValue, offset, str) {
@@ -157,11 +166,24 @@ global.propertyDoc = function (propertyName, property, layerType) {
if (!property.units.match(/s$/)) {
property.units += 's';
}
doc += `
This property is measured in ${property.units}.`;
doc += `\n\nThis property is measured in ${property.units}.`;
}
return doc.replace(/(p)ixel/gi, '$1oint').replace(/(\d)px\b/g, '$1pt');
doc = doc.replace(/(p)ixel/gi, '$1oint').replace(/(\d)px\b/g, '$1pt');
if (kind !== 'enum') {
if ('default' in property) {
doc += `\n\nThe default value of this property is ${propertyDefault(property, layerType)}.`;
if (!property.required) {
doc += ' Set this property to `nil` to reset it to the default value.';
}
}
if ('requires' in property) {
doc += '\n\n' + propertyReqs(property, spec[`${kind}_${layerType}`], layerType);
}
if ('original' in property) {
doc += `\n\nThis attribute corresponds to the <a href="https://www.mapbox.com/mapbox-gl-style-spec/#layout-${layerType}-${property.original}"><code>${property.original}</code></a> layout property in the Mapbox Style Specification.`;
}
}
return doc;
};
global.propertyReqs = function (property, propertiesByName, type) {
@@ -365,11 +387,10 @@ const layers = Object.keys(spec.layer.type.values).map((type) => {
}, []);
return {
doc: spec.layer.type.values[type].doc,
type: type,
layoutProperties: _.sortBy(layoutProperties, ['name']),
paintProperties: _.sortBy(paintProperties, ['name']),
layoutPropertiesByName: spec[`layout_${type}`],
paintPropertiesByName: spec[`paint_${type}`],
};
});

View File

@@ -1,4 +1,28 @@
{
"layer": {
"type": {
"values": {
"fill": {
"doc": "An `MGLFillStyleLayer` is a style layer that renders one or more filled (and optionally stroked) polygons on the map.\n\nUse a fill style layer to configure the visual appearance of polygon or multipolygon features in vector tiles loaded by an `MGLVectorSource` object or `MGLPolygon`, `MGLPolygonFeature`, `MGLMultiPolygon`, or `MGLMultiPolygonFeature` instances in an `MGLShapeSource` object."
},
"line": {
"doc": "An `MGLLineStyleLayer` is a style layer that renders one or more stroked polylines on the map.\n\nUse a line style layer to configure the visual appearance of polyline or multipolyline features in vector tiles loaded by an `MGLVectorSource` object or `MGLPolyline`, `MGLPolylineFeature`, `MGLMultiPolyline`, or `MGLMultiPolylineFeature` instances in an `MGLShapeSource` object."
},
"symbol": {
"doc": "An `MGLSymbolStyleLayer` is a style layer that renders icon and text labels at points or along lines on the map.\n\nUse a symbol style layer to configure the visual appearance of labels for features in vector tiles loaded by an `MGLVectorSource` object or `MGLShape` or `MGLFeature` instances in an `MGLShapeSource` object."
},
"circle": {
"doc": "An `MGLCircleStyleLayer` is a style layer that renders one or more filled circles on the map.\n\nUse a circle style layer to configure the visual appearance of point or point collection features in vector tiles loaded by an `MGLVectorSource` object or `MGLPointAnnotation`, `MGLPointFeature`, `MGLPointCollection`, or `MGLPointCollectionFeature` instances in an `MGLShapeSource` object.\n\nA circle style layer renders circles whose radii are measured in screen units. To display circles on the map whose radii correspond to real-world distances, use many-sided regular polygons and configure their appearance using an `MGLFillStyleLayer` object."
},
"raster": {
"doc": "An `MGLRasterStyleLayer` is a style layer that renders raster tiles on the map.\n\nUse a raster style layer to configure the color parameters of raster tiles loaded by an `MGLRasterSource` object. For example, you could use a raster style layer to render <a href=\"https://www.mapbox.com/satellite/\">Mapbox Satellite</a> imagery, a <a href=\"https://www.mapbox.com/help/define-tileset/#raster-tilesets\">raster tile set</a> uploaded to Mapbox Studio, or a raster map authored in <a href=\"https://tilemill-project.github.io/tilemill/\">TileMill</a>, the classic Mapbox Editor, or Mapbox Studio Classic."
},
"background": {
"doc": "An `MGLBackgroundStyleLayer` is a style layer that covers the entire map. Use a background style layer to configure a color or pattern to show below all other map content. If the style’s other layers use the Mapbox Streets source, the background style layer is responsible for drawing land, whereas the oceans and other bodies of water are drawn by `MGLFillStyleLayer` objects.\n\nA background style layer is typically the bottommost layer in a style, because it covers the entire map and can occlude any layers below it. You can therefore access it by getting the last item in the `MGLStyle.layers` array.\n\nIf the background style layer is transparent or omitted from the style, any portion of the map view that does not show another style layer is transparent."
}
}
}
},
"layout_symbol": {
"icon-text-fit-padding": {
"doc": "Size of the additional area added to dimensions determined by `icon-text-fit`."

View File

@@ -49,7 +49,7 @@ NS_ASSUME_NONNULL_BEGIN
coordinate and zoom level.
@param centerCoordinate The map’s center coordinate.
@param zoomLevel The map’s zoom level. See `MGLMapView`’s `zoomLevel` property
@param zoomLevel The map’s zoom level. See the `MGLMapView.zoomLevel` property
for more information.
@return A modified URL containing a fragment that points to the specified
viewport. If the `feedbackLink` property is set to `NO`, this method returns

View File

@@ -7,10 +7,18 @@
NS_ASSUME_NONNULL_BEGIN
/**
A map style's background layer is the bottommost layer and is used to style a color
or pattern to show below all other map features. You can query an `MGLMapView` for its
`style` and obtain the background layer using the `-[MGLStyle layerWithIdentifier:]`
method and passing `background` for the identifier.
An `MGLBackgroundStyleLayer` is a style layer that covers the entire map. Use a
background style layer to configure a color or pattern to show below all other
map content. If the style’s other layers use the Mapbox Streets source, the
background style layer is responsible for drawing land, whereas the oceans and
other bodies of water are drawn by `MGLFillStyleLayer` objects.
A background style layer is typically the bottommost layer in a style, because
it covers the entire map and can occlude any layers below it. You can therefore
access it by getting the last item in the `MGLStyle.layers` array.
If the background style layer is transparent or omitted from the style, any
portion of the map view that does not show another style layer is transparent.
*/
@interface MGLBackgroundStyleLayer : MGLStyleLayer
@@ -22,18 +30,24 @@ NS_ASSUME_NONNULL_BEGIN
/**
The color with which the background will be drawn.
The default value of this property is an `MGLStyleValue` object containing `UIColor.blackColor`. Set this property to `nil` to reset it to the default value.
This property is only applied to the style if `backgroundPattern` is set to `nil`. Otherwise, it is ignored.
The default value of this property is an `MGLStyleValue` object containing
`UIColor.blackColor`. Set this property to `nil` to reset it to the default
value.
This property is only applied to the style if `backgroundPattern` is set to
`nil`. Otherwise, it is ignored.
*/
@property (nonatomic, null_resettable) MGLStyleValue<MGLColor *> *backgroundColor;
#else
/**
The color with which the background will be drawn.
The default value of this property is an `MGLStyleValue` object containing `NSColor.blackColor`. Set this property to `nil` to reset it to the default value.
This property is only applied to the style if `backgroundPattern` is set to `nil`. Otherwise, it is ignored.
The default value of this property is an `MGLStyleValue` object containing
`NSColor.blackColor`. Set this property to `nil` to reset it to the default
value.
This property is only applied to the style if `backgroundPattern` is set to
`nil`. Otherwise, it is ignored.
*/
@property (nonatomic, null_resettable) MGLStyleValue<MGLColor *> *backgroundColor;
#endif
@@ -41,12 +55,16 @@ NS_ASSUME_NONNULL_BEGIN
/**
The opacity at which the background will be drawn.
The default value of this property is an `MGLStyleValue` object containing an `NSNumber` object containing the float `1`. Set this property to `nil` to reset it to the default value.
The default value of this property is an `MGLStyleValue` object containing an
`NSNumber` object containing the float `1`. Set this property to `nil` to reset
it to the default value.
*/
@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *backgroundOpacity;
/**
Name of image in style images to use for drawing an image background. For seamless patterns, image width and height must be a factor of two (2, 4, 8, ..., 512).
Name of image in style images to use for drawing an image background. For
seamless patterns, image width and height must be a factor of two (2, 4, 8,
..., 512).
*/
@property (nonatomic, null_resettable) MGLStyleValue<NSString *> *backgroundPattern;

View File

@@ -9,7 +9,8 @@ NS_ASSUME_NONNULL_BEGIN
/**
Controls the scaling behavior of the circle when the map is pitched.
Values of this type are used in the `circlePitchScale` property of `MGLCircleStyleLayer`.
Values of this type are used in the `MGLCircleStyleLayer.circlePitchScale`
property.
*/
typedef NS_ENUM(NSUInteger, MGLCirclePitchScale) {
/**
@@ -25,7 +26,8 @@ typedef NS_ENUM(NSUInteger, MGLCirclePitchScale) {
/**
Controls the translation reference point.
Values of this type are used in the `circleTranslateAnchor` property of `MGLCircleStyleLayer`.
Values of this type are used in the `MGLCircleStyleLayer.circleTranslateAnchor`
property.
*/
typedef NS_ENUM(NSUInteger, MGLCircleTranslateAnchor) {
/**
@@ -39,19 +41,36 @@ typedef NS_ENUM(NSUInteger, MGLCircleTranslateAnchor) {
};
/**
A circle layer which allows customization of styling properties at runtime. You may
instantiate a new circle layer to add to a map style or you may query an
`MGLMapView` for its `style` and obtain existing layers using the
`-[MGLStyle layerWithIdentifier:]` method.
An `MGLCircleStyleLayer` is a style layer that renders one or more filled
circles on the map.
Use a circle style layer to configure the visual appearance of point or point
collection features in vector tiles loaded by an `MGLVectorSource` object or
`MGLPointAnnotation`, `MGLPointFeature`, `MGLPointCollection`, or
`MGLPointCollectionFeature` instances in an `MGLShapeSource` object.
A circle style layer renders circles whose radii are measured in screen units.
To display circles on the map whose radii correspond to real-world distances,
use many-sided regular polygons and configure their appearance using an
`MGLFillStyleLayer` object.
You can access an existing circle style layer using the
`-[MGLStyle layerWithIdentifier:]` method if you know its identifier;
otherwise, find it using the `MGLStyle.layers` property. You can also create a
new circle style layer and add it to the style using a method such as
`-[MGLStyle addLayer:]`.
*/
@interface MGLCircleStyleLayer : MGLVectorStyleLayer
#pragma mark - Accessing the Paint Attributes
/**
Amount to blur the circle. 1 blurs the circle such that only the centerpoint is full opacity.
Amount to blur the circle. 1 blurs the circle such that only the centerpoint is
full opacity.
The default value of this property is an `MGLStyleValue` object containing an `NSNumber` object containing the float `0`. Set this property to `nil` to reset it to the default value.
The default value of this property is an `MGLStyleValue` object containing an
`NSNumber` object containing the float `0`. Set this property to `nil` to reset
it to the default value.
*/
@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *circleBlur;
@@ -59,14 +78,18 @@ typedef NS_ENUM(NSUInteger, MGLCircleTranslateAnchor) {
/**
The fill color of the circle.
The default value of this property is an `MGLStyleValue` object containing `UIColor.blackColor`. Set this property to `nil` to reset it to the default value.
The default value of this property is an `MGLStyleValue` object containing
`UIColor.blackColor`. Set this property to `nil` to reset it to the default
value.
*/
@property (nonatomic, null_resettable) MGLStyleValue<MGLColor *> *circleColor;
#else
/**
The fill color of the circle.
The default value of this property is an `MGLStyleValue` object containing `NSColor.blackColor`. Set this property to `nil` to reset it to the default value.
The default value of this property is an `MGLStyleValue` object containing
`NSColor.blackColor`. Set this property to `nil` to reset it to the default
value.
*/
@property (nonatomic, null_resettable) MGLStyleValue<MGLColor *> *circleColor;
#endif
@@ -74,41 +97,53 @@ typedef NS_ENUM(NSUInteger, MGLCircleTranslateAnchor) {
/**
The opacity at which the circle will be drawn.
The default value of this property is an `MGLStyleValue` object containing an `NSNumber` object containing the float `1`. Set this property to `nil` to reset it to the default value.
The default value of this property is an `MGLStyleValue` object containing an
`NSNumber` object containing the float `1`. Set this property to `nil` to reset
it to the default value.
*/
@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *circleOpacity;
/**
Controls the scaling behavior of the circle when the map is pitched.
The default value of this property is an `MGLStyleValue` object containing an `NSValue` object containing `MGLCirclePitchScaleMap`. Set this property to `nil` to reset it to the default value.
The default value of this property is an `MGLStyleValue` object containing an
`NSValue` object containing `MGLCirclePitchScaleMap`. Set this property to
`nil` to reset it to the default value.
*/
@property (nonatomic, null_resettable) MGLStyleValue<NSValue *> *circlePitchScale;
/**
Circle radius.
This property is measured in points.
The default value of this property is an `MGLStyleValue` object containing an `NSNumber` object containing the float `5`. Set this property to `nil` to reset it to the default value.
The default value of this property is an `MGLStyleValue` object containing an
`NSNumber` object containing the float `5`. Set this property to `nil` to reset
it to the default value.
*/
@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *circleRadius;
/**
The geometry's offset.
This property is measured in points.
The default value of this property is an `MGLStyleValue` object containing an `NSValue` object containing a `CGVector` struct set to 0 points from the left and 0 points from the top. Set this property to `nil` to reset it to the default value.
The default value of this property is an `MGLStyleValue` object containing an
`NSValue` object containing a `CGVector` struct set to 0 points from the left
and 0 points from the top. Set this property to `nil` to reset it to the
default value.
*/
@property (nonatomic, null_resettable) MGLStyleValue<NSValue *> *circleTranslate;
/**
Controls the translation reference point.
The default value of this property is an `MGLStyleValue` object containing an `NSValue` object containing `MGLCircleTranslateAnchorMap`. Set this property to `nil` to reset it to the default value.
This property is only applied to the style if `circleTranslate` is non-`nil`. Otherwise, it is ignored.
The default value of this property is an `MGLStyleValue` object containing an
`NSValue` object containing `MGLCircleTranslateAnchorMap`. Set this property to
`nil` to reset it to the default value.
This property is only applied to the style if `circleTranslate` is non-`nil`.
Otherwise, it is ignored.
*/
@property (nonatomic, null_resettable) MGLStyleValue<NSValue *> *circleTranslateAnchor;

View File

@@ -10,30 +10,41 @@ NS_ASSUME_NONNULL_BEGIN
/**
The `MGLFeature` protocol is used to provide details about geographic features
contained in a map view’s
<a href="https://www.mapbox.com/mapbox-gl-style-spec/#sources">tile sources</a>.
Each concrete subclass of `MGLShape` in turn has a subclass that conforms to
this protocol.
contained in an `MGLShapeSource` or `MGLVectorSource` object. Each concrete
subclass of `MGLShape` in turn has a subclass that conforms to this protocol. A
feature object associates a shape with an optional identifier and attributes.
Typically, you do not create feature objects yourself but rather obtain them
using `-[MGLMapView visibleFeaturesAtPoint:]` and related methods. Each feature
object associates a shape with an identifier and attributes as specified by the
source. Like ordinary `MGLAnnotation` objects, some kinds of `MGLFeature`
objects can also be added to a map view using an `MGLShapeSource` or
`-[MGLMapView addAnnotations:]` and related methods.
You can add custom data to display on the map by creating feature objects and
adding them to an `MGLShapeSource` using the
`-[MGLShapeSource initWithIdentifier:shape:options:]` method or
`MGLShapeSource.shape` property. Similarly, you can add `MGLPointFeature`,
`MGLPolylineFeature`, and `MGLPolygonFeature` objects to the map as annotations
using `-[MGLMapView addAnnotations:]` and related methods.
In addition to adding data to the map, you can also extract data from the map:
`-[MGLMapView visibleFeaturesAtPoint:]` and related methods return feature
objects that correspond to features in the source. This enables you to inspect
the properties of features in vector tiles loaded by `MGLVectorSource` objects.
You also reuse these feature objects as overlay annotations.
*/
@protocol MGLFeature <MGLAnnotation>
/**
An object that uniquely identifies the feature in its containing
<a href="https://www.mapbox.com/mapbox-gl-style-spec/#sources">tile source</a>.
An object that uniquely identifies the feature in its containing content
source.
The identifier corresponds to the
You can configure an `MGLVectorStyleLayer` object to include or exclude a
specific feature in an `MGLShapeSource` or `MGLVectorSource`. In the
`MGLVectorStyleLayer.predicate` property, compare the special `$id` attribute
to the feature’s identifier.
In vector tiles loaded by `MGLVectorSource` objects, the identifier corresponds
to the
<a href="https://github.com/mapbox/vector-tile-spec/tree/master/2.1#42-features">feature identifier</a>
(`id`) in the tile source. If the source does not specify the feature’s
identifier, the value of this property is `nil`. If specified, the identifier
may be an integer, floating-point number, or string. These data types are
mapped to instances of the following Foundation classes:
(`id`). If the source does not specify the feature’s identifier, the value of
this property is `nil`. If specified, the identifier may be an integer,
floating-point number, or string. These data types are mapped to instances of
the following Foundation classes:
<table>
<thead>
@@ -49,22 +60,40 @@ NS_ASSUME_NONNULL_BEGIN
For details about the identifiers used in most Mapbox-provided styles, consult
the
<a href="https://www.mapbox.com/vector-tiles/mapbox-streets/">Mapbox Streets</a>
layer reference. Note that while it is possible to change this value on feature
instances obtained from `-[MGLMapView visibleFeaturesAtPoint:]` and related
methods, there will be no effect on the map. Setting this value can be useful
when the feature instance is used to initialize an `MGLShapeSource` and that
source is added to the map and styled.
layer reference.
The identifier should be set before adding the feature to an `MGLShapeSource`
object; setting it afterwards has no effect on the map’s contents. While it is
possible to change this value on feature instances obtained from
`-[MGLMapView visibleFeaturesAtPoint:]` and related methods, doing so likewise
has no effect on the map’s contents.
*/
@property (nonatomic, copy, nullable) id identifier;
/**
A dictionary of attributes for this feature specified by the
<a href="https://www.mapbox.com/mapbox-gl-style-spec/#sources">tile source</a>.
A dictionary of attributes for this feature.
The keys and values of this dictionary are determined by the tile source. In
the tile source, each attribute name is a string, while each attribute value
may be a null value, Boolean value, integer, floating-point number, or string.
These data types are mapped to instances of the following Foundation classes:
You can configure an `MGLVectorStyleLayer` object to include or exclude a
specific feature in an `MGLShapeSource` or `MGLVectorSource`. In the
`MGLVectorStyleLayer.predicate` property, compare a key of the attribute
dictionary to the value you want to include. For example, if you want an
`MGLLineStyleLayer` object to display only important features, you might assign
a value above 50 to the important features’ `importance` attribute, then set
`MGLVectorStyleLayer.predicate` to an `NSPredicate` with the format
`importance > 50`.
You can also configure some attributes of an `MGLSymbolStyleLayer` object to
include the value of an attribute in this dictionary whenever it renders this
feature. For example, to label features in an `MGLShapeSource` object by their
names, you can assign a `name` attribute to each of the source’s features, then
set `MGLSymbolStyleLayer.textField` to an `MGLStyleValue` object containing the
string `{name}`.
In vector tiles loaded by `MGLVectorSource` objects, the keys and values of
each feature’s attribute dictionary are determined by the source. Each
attribute name is a string, while each attribute value may be a null value,
Boolean value, integer, floating-point number, or string. These data types are
mapped to instances of the following Foundation classes:
<table>
<thead>
@@ -84,7 +113,9 @@ NS_ASSUME_NONNULL_BEGIN
<a href="https://www.mapbox.com/vector-tiles/mapbox-streets/">Mapbox Streets</a>
and
<a href="https://www.mapbox.com/vector-tiles/mapbox-terrain/">Mapbox Terrain</a>
layer references. Note that while it is possible to change this value on feature
layer references.
Note that while it is possible to change this value on feature
instances obtained from `-[MGLMapView visibleFeaturesAtPoint:]` and related
methods, there will be no effect on the map. Setting this value can be useful
when the feature instance is used to initialize an `MGLShapeSource` and that
@@ -114,50 +145,66 @@ NS_ASSUME_NONNULL_BEGIN
@end
/**
The `MGLPointFeature` class represents a point in a
<a href="https://www.mapbox.com/mapbox-gl-style-spec/#sources">tile source</a>.
An `MGLPointFeature` object associates a point shape with an optional
identifier and attributes.
*/
@interface MGLPointFeature : MGLPointAnnotation <MGLFeature>
@end
/**
The `MGLPolylineFeature` class represents a polyline in a
<a href="https://www.mapbox.com/mapbox-gl-style-spec/#sources">tile source</a>.
An `MGLPolylineFeature` object associates a polyline shape with an optional
identifier and attributes.
A polyline feature is known as a
<a href="https://tools.ietf.org/html/rfc7946#section-3.1.4">LineString</a>
feature in GeoJSON.
*/
@interface MGLPolylineFeature : MGLPolyline <MGLFeature>
@end
/**
The `MGLPolygonFeature` class represents a polygon in a
<a href="https://www.mapbox.com/mapbox-gl-style-spec/#sources">tile source</a>.
An `MGLPolygonFeature` object associates a polygon shape with an optional
identifier and attributes.
*/
@interface MGLPolygonFeature : MGLPolygon <MGLFeature>
@end
/**
The `MGLPointCollectionFeature` class represents a multipoint in a
<a href="https://www.mapbox.com/mapbox-gl-style-spec/#sources">tile source</a>.
An `MGLPointCollectionFeature` object associates a point collection with an
optional identifier and attributes.
A point collection feature is known as a
<a href="https://tools.ietf.org/html/rfc7946#section-3.1.3">MultiPoint</a>
feature in GeoJSON.
*/
@interface MGLPointCollectionFeature : MGLPointCollection <MGLFeature>
@end
/**
The `MGLMultiPolylineFeature` class represents a multipolyline in a
<a href="https://www.mapbox.com/mapbox-gl-style-spec/#sources">tile source</a>.
An `MGLMultiPolylineFeature` object associates a multipolyline shape with an
optional identifier and attributes.
A multipolyline feature is known as a
<a href="https://tools.ietf.org/html/rfc7946#section-3.1.5">MultiLineString</a>
feature in GeoJSON.
*/
@interface MGLMultiPolylineFeature : MGLMultiPolyline <MGLFeature>
@end
/**
The `MGLMultiPolygonFeature` class represents a multipolygon in a
<a href="https://www.mapbox.com/mapbox-gl-style-spec/#sources">tile source</a>.
An `MGLMultiPolygonFeature` object associates a multipolygon shape with an
optional identifier and attributes.
*/
@interface MGLMultiPolygonFeature : MGLMultiPolygon <MGLFeature>
@end
/**
The `MGLShapeCollectionFeature` class represents a shape collection in a
<a href="https://www.mapbox.com/mapbox-gl-style-spec/#sources">tile source</a>.
An `MGLShapeCollectionFeature` object associates a shape collection with an
optional identifier and attributes.
A shape collection feature is known as a
<a href="https://tools.ietf.org/html/rfc7946#section-3.3">feature collection</a>
in GeoJSON.
*/
@interface MGLShapeCollectionFeature : MGLShapeCollection <MGLFeature>

View File

@@ -9,7 +9,8 @@ NS_ASSUME_NONNULL_BEGIN
/**
Controls the translation reference point.
Values of this type are used in the `fillTranslateAnchor` property of `MGLFillStyleLayer`.
Values of this type are used in the `MGLFillStyleLayer.fillTranslateAnchor`
property.
*/
typedef NS_ENUM(NSUInteger, MGLFillTranslateAnchor) {
/**
@@ -23,10 +24,19 @@ typedef NS_ENUM(NSUInteger, MGLFillTranslateAnchor) {
};
/**
A fill layer which allows customization of styling properties at runtime. You may
instantiate a new fill layer to add to a map style or you may query an
`MGLMapView` for its `style` and obtain existing layers using the
`-[MGLStyle layerWithIdentifier:]` method.
An `MGLFillStyleLayer` is a style layer that renders one or more filled (and
optionally stroked) polygons on the map.
Use a fill style layer to configure the visual appearance of polygon or
multipolygon features in vector tiles loaded by an `MGLVectorSource` object or
`MGLPolygon`, `MGLPolygonFeature`, `MGLMultiPolygon`, or
`MGLMultiPolygonFeature` instances in an `MGLShapeSource` object.
You can access an existing fill style layer using the
`-[MGLStyle layerWithIdentifier:]` method if you know its identifier;
otherwise, find it using the `MGLStyle.layers` property. You can also create a
new fill style layer and add it to the style using a method such as
`-[MGLStyle addLayer:]`.
*/
@interface MGLFillStyleLayer : MGLVectorStyleLayer
@@ -35,69 +45,90 @@ typedef NS_ENUM(NSUInteger, MGLFillTranslateAnchor) {
/**
Whether or not the fill should be antialiased.
The default value of this property is an `MGLStyleValue` object containing an `NSNumber` object containing `YES`. Set this property to `nil` to reset it to the default value.
The default value of this property is an `MGLStyleValue` object containing an
`NSNumber` object containing `YES`. Set this property to `nil` to reset it to
the default value.
This attribute corresponds to the <a href="https://www.mapbox.com/mapbox-gl-style-spec/#paint-fill-antialias"><code>fill-antialias</code></a> paint property in the Mapbox Style Specification.
This attribute corresponds to the <a
href="https://www.mapbox.com/mapbox-gl-style-spec/#layout-fill-fill-antialias"><code>fill-antialias</code></a>
layout property in the Mapbox Style Specification.
*/
@property (nonatomic, null_resettable, getter=isFillAntialiased) MGLStyleValue<NSNumber *> *fillAntialiased;
@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *fillAntialias __attribute__((unavailable("Use fillAntialiased instead.")));
#if TARGET_OS_IPHONE
/**
The color of the filled part of this layer.
The default value of this property is an `MGLStyleValue` object containing `UIColor.blackColor`. Set this property to `nil` to reset it to the default value.
This property is only applied to the style if `fillPattern` is set to `nil`. Otherwise, it is ignored.
The default value of this property is an `MGLStyleValue` object containing
`UIColor.blackColor`. Set this property to `nil` to reset it to the default
value.
This property is only applied to the style if `fillPattern` is set to `nil`.
Otherwise, it is ignored.
*/
@property (nonatomic, null_resettable) MGLStyleValue<MGLColor *> *fillColor;
#else
/**
The color of the filled part of this layer.
The default value of this property is an `MGLStyleValue` object containing `NSColor.blackColor`. Set this property to `nil` to reset it to the default value.
This property is only applied to the style if `fillPattern` is set to `nil`. Otherwise, it is ignored.
The default value of this property is an `MGLStyleValue` object containing
`NSColor.blackColor`. Set this property to `nil` to reset it to the default
value.
This property is only applied to the style if `fillPattern` is set to `nil`.
Otherwise, it is ignored.
*/
@property (nonatomic, null_resettable) MGLStyleValue<MGLColor *> *fillColor;
#endif
/**
The opacity of the entire fill layer. In contrast to the `fillColor`, this value will also affect the 1pt stroke around the fill, if the stroke is used.
The opacity of the entire fill layer. In contrast to the `fillColor`, this
value will also affect the 1pt stroke around the fill, if the stroke is used.
The default value of this property is an `MGLStyleValue` object containing an `NSNumber` object containing the float `1`. Set this property to `nil` to reset it to the default value.
The default value of this property is an `MGLStyleValue` object containing an
`NSNumber` object containing the float `1`. Set this property to `nil` to reset
it to the default value.
*/
@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *fillOpacity;
/**
The outline color of the fill. Matches the value of `fillColor` if unspecified.
This property is only applied to the style if `fillPattern` is set to `nil`, and `fillAntialiased` is set to an `MGLStyleValue` object containing an `NSNumber` object containing `YES`. Otherwise, it is ignored.
This property is only applied to the style if `fillPattern` is set to `nil`,
and `fillAntialiased` is set to an `MGLStyleValue` object containing an
`NSNumber` object containing `YES`. Otherwise, it is ignored.
*/
@property (nonatomic, null_resettable) MGLStyleValue<MGLColor *> *fillOutlineColor;
/**
Name of image in sprite to use for drawing image fills. For seamless patterns, image width and height must be a factor of two (2, 4, 8, ..., 512).
Name of image in sprite to use for drawing image fills. For seamless patterns,
image width and height must be a factor of two (2, 4, 8, ..., 512).
*/
@property (nonatomic, null_resettable) MGLStyleValue<NSString *> *fillPattern;
/**
The geometry's offset.
This property is measured in points.
The default value of this property is an `MGLStyleValue` object containing an `NSValue` object containing a `CGVector` struct set to 0 points from the left and 0 points from the top. Set this property to `nil` to reset it to the default value.
The default value of this property is an `MGLStyleValue` object containing an
`NSValue` object containing a `CGVector` struct set to 0 points from the left
and 0 points from the top. Set this property to `nil` to reset it to the
default value.
*/
@property (nonatomic, null_resettable) MGLStyleValue<NSValue *> *fillTranslate;
/**
Controls the translation reference point.
The default value of this property is an `MGLStyleValue` object containing an `NSValue` object containing `MGLFillTranslateAnchorMap`. Set this property to `nil` to reset it to the default value.
This property is only applied to the style if `fillTranslate` is non-`nil`. Otherwise, it is ignored.
The default value of this property is an `MGLStyleValue` object containing an
`NSValue` object containing `MGLFillTranslateAnchorMap`. Set this property to
`nil` to reset it to the default value.
This property is only applied to the style if `fillTranslate` is non-`nil`.
Otherwise, it is ignored.
*/
@property (nonatomic, null_resettable) MGLStyleValue<NSValue *> *fillTranslateAnchor;

View File

@@ -9,19 +9,24 @@ NS_ASSUME_NONNULL_BEGIN
/**
The display of line endings.
Values of this type are used in the `lineCap` property of `MGLLineStyleLayer`.
Values of this type are used in the `MGLLineStyleLayer.lineCap`
property.
*/
typedef NS_ENUM(NSUInteger, MGLLineCap) {
/**
A cap with a squared-off end which is drawn to the exact endpoint of the line.
A cap with a squared-off end which is drawn to the exact endpoint of the
line.
*/
MGLLineCapButt,
/**
A cap with a rounded end which is drawn beyond the endpoint of the line at a radius of one-half of the line's width and centered on the endpoint of the line.
A cap with a rounded end which is drawn beyond the endpoint of the line at
a radius of one-half of the line's width and centered on the endpoint of
the line.
*/
MGLLineCapRound,
/**
A cap with a squared-off end which is drawn beyond the endpoint of the line at a distance of one-half of the line's width.
A cap with a squared-off end which is drawn beyond the endpoint of the line
at a distance of one-half of the line's width.
*/
MGLLineCapSquare,
};
@@ -29,19 +34,24 @@ typedef NS_ENUM(NSUInteger, MGLLineCap) {
/**
The display of lines when joining.
Values of this type are used in the `lineJoin` property of `MGLLineStyleLayer`.
Values of this type are used in the `MGLLineStyleLayer.lineJoin`
property.
*/
typedef NS_ENUM(NSUInteger, MGLLineJoin) {
/**
A join with a squared-off end which is drawn beyond the endpoint of the line at a distance of one-half of the line's width.
A join with a squared-off end which is drawn beyond the endpoint of the
line at a distance of one-half of the line's width.
*/
MGLLineJoinBevel,
/**
A join with a rounded end which is drawn beyond the endpoint of the line at a radius of one-half of the line's width and centered on the endpoint of the line.
A join with a rounded end which is drawn beyond the endpoint of the line at
a radius of one-half of the line's width and centered on the endpoint of
the line.
*/
MGLLineJoinRound,
/**
A join with a sharp, angled corner which is drawn with the outer sides beyond the endpoint of the path until they meet.
A join with a sharp, angled corner which is drawn with the outer sides
beyond the endpoint of the path until they meet.
*/
MGLLineJoinMiter,
};
@@ -49,7 +59,8 @@ typedef NS_ENUM(NSUInteger, MGLLineJoin) {
/**
Controls the translation reference point.
Values of this type are used in the `lineTranslateAnchor` property of `MGLLineStyleLayer`.
Values of this type are used in the `MGLLineStyleLayer.lineTranslateAnchor`
property.
*/
typedef NS_ENUM(NSUInteger, MGLLineTranslateAnchor) {
/**
@@ -63,10 +74,19 @@ typedef NS_ENUM(NSUInteger, MGLLineTranslateAnchor) {
};
/**
A line layer which allows customization of styling properties at runtime. You may
instantiate a new line layer to add to a map style or you may query an
`MGLMapView` for its `style` and obtain existing layers using the
`-[MGLStyle layerWithIdentifier:]` method.
An `MGLLineStyleLayer` is a style layer that renders one or more stroked
polylines on the map.
Use a line style layer to configure the visual appearance of polyline or
multipolyline features in vector tiles loaded by an `MGLVectorSource` object or
`MGLPolyline`, `MGLPolylineFeature`, `MGLMultiPolyline`, or
`MGLMultiPolylineFeature` instances in an `MGLShapeSource` object.
You can access an existing line style layer using the
`-[MGLStyle layerWithIdentifier:]` method if you know its identifier;
otherwise, find it using the `MGLStyle.layers` property. You can also create a
new line style layer and add it to the style using a method such as
`-[MGLStyle addLayer:]`.
*/
@interface MGLLineStyleLayer : MGLVectorStyleLayer
@@ -75,32 +95,44 @@ typedef NS_ENUM(NSUInteger, MGLLineTranslateAnchor) {
/**
The display of line endings.
The default value of this property is an `MGLStyleValue` object containing an `NSValue` object containing `MGLLineCapButt`. Set this property to `nil` to reset it to the default value.
The default value of this property is an `MGLStyleValue` object containing an
`NSValue` object containing `MGLLineCapButt`. Set this property to `nil` to
reset it to the default value.
*/
@property (nonatomic, null_resettable) MGLStyleValue<NSValue *> *lineCap;
/**
The display of lines when joining.
The default value of this property is an `MGLStyleValue` object containing an `NSValue` object containing `MGLLineJoinMiter`. Set this property to `nil` to reset it to the default value.
The default value of this property is an `MGLStyleValue` object containing an
`NSValue` object containing `MGLLineJoinMiter`. Set this property to `nil` to
reset it to the default value.
*/
@property (nonatomic, null_resettable) MGLStyleValue<NSValue *> *lineJoin;
/**
Used to automatically convert miter joins to bevel joins for sharp angles.
The default value of this property is an `MGLStyleValue` object containing an `NSNumber` object containing the float `2`. Set this property to `nil` to reset it to the default value.
The default value of this property is an `MGLStyleValue` object containing an
`NSNumber` object containing the float `2`. Set this property to `nil` to reset
it to the default value.
This property is only applied to the style if `lineJoin` is set to an `MGLStyleValue` object containing an `NSValue` object containing `MGLLineJoinMiter`. Otherwise, it is ignored.
This property is only applied to the style if `lineJoin` is set to an
`MGLStyleValue` object containing an `NSValue` object containing
`MGLLineJoinMiter`. Otherwise, it is ignored.
*/
@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *lineMiterLimit;
/**
Used to automatically convert round joins to miter joins for shallow angles.
The default value of this property is an `MGLStyleValue` object containing an `NSNumber` object containing the float `1.05`. Set this property to `nil` to reset it to the default value.
The default value of this property is an `MGLStyleValue` object containing an
`NSNumber` object containing the float `1.05`. Set this property to `nil` to
reset it to the default value.
This property is only applied to the style if `lineJoin` is set to an `MGLStyleValue` object containing an `NSValue` object containing `MGLLineJoinRound`. Otherwise, it is ignored.
This property is only applied to the style if `lineJoin` is set to an
`MGLStyleValue` object containing an `NSValue` object containing
`MGLLineJoinRound`. Otherwise, it is ignored.
*/
@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *lineRoundLimit;
@@ -108,10 +140,12 @@ typedef NS_ENUM(NSUInteger, MGLLineTranslateAnchor) {
/**
Blur applied to the line, in points.
This property is measured in points.
The default value of this property is an `MGLStyleValue` object containing an `NSNumber` object containing the float `0`. Set this property to `nil` to reset it to the default value.
The default value of this property is an `MGLStyleValue` object containing an
`NSNumber` object containing the float `0`. Set this property to `nil` to reset
it to the default value.
*/
@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *lineBlur;
@@ -119,90 +153,119 @@ typedef NS_ENUM(NSUInteger, MGLLineTranslateAnchor) {
/**
The color with which the line will be drawn.
The default value of this property is an `MGLStyleValue` object containing `UIColor.blackColor`. Set this property to `nil` to reset it to the default value.
This property is only applied to the style if `linePattern` is set to `nil`. Otherwise, it is ignored.
The default value of this property is an `MGLStyleValue` object containing
`UIColor.blackColor`. Set this property to `nil` to reset it to the default
value.
This property is only applied to the style if `linePattern` is set to `nil`.
Otherwise, it is ignored.
*/
@property (nonatomic, null_resettable) MGLStyleValue<MGLColor *> *lineColor;
#else
/**
The color with which the line will be drawn.
The default value of this property is an `MGLStyleValue` object containing `NSColor.blackColor`. Set this property to `nil` to reset it to the default value.
This property is only applied to the style if `linePattern` is set to `nil`. Otherwise, it is ignored.
The default value of this property is an `MGLStyleValue` object containing
`NSColor.blackColor`. Set this property to `nil` to reset it to the default
value.
This property is only applied to the style if `linePattern` is set to `nil`.
Otherwise, it is ignored.
*/
@property (nonatomic, null_resettable) MGLStyleValue<MGLColor *> *lineColor;
#endif
/**
Specifies the lengths of the alternating dashes and gaps that form the dash pattern. The lengths are later scaled by the line width. To convert a dash length to points, multiply the length by the current line width.
This property is measured in line widths.
This property is only applied to the style if `linePattern` is set to `nil`. Otherwise, it is ignored.
Specifies the lengths of the alternating dashes and gaps that form the dash
pattern. The lengths are later scaled by the line width. To convert a dash
length to points, multiply the length by the current line width.
This attribute corresponds to the <a href="https://www.mapbox.com/mapbox-gl-style-spec/#paint-line-dasharray"><code>line-dasharray</code></a> paint property in the Mapbox Style Specification.
This property is measured in line widths.
This property is only applied to the style if `linePattern` is set to `nil`.
Otherwise, it is ignored.
This attribute corresponds to the <a
href="https://www.mapbox.com/mapbox-gl-style-spec/#layout-line-line-dasharray"><code>line-dasharray</code></a>
layout property in the Mapbox Style Specification.
*/
@property (nonatomic, null_resettable) MGLStyleValue<NSArray<NSNumber *> *> *lineDashPattern;
@property (nonatomic, null_resettable) MGLStyleValue<NSArray<NSNumber *> *> *lineDasharray __attribute__((unavailable("Use lineDashPattern instead.")));
/**
Draws a line casing outside of a line's actual path. Value indicates the width of the inner gap.
Draws a line casing outside of a line's actual path. Value indicates the width
of the inner gap.
This property is measured in points.
The default value of this property is an `MGLStyleValue` object containing an `NSNumber` object containing the float `0`. Set this property to `nil` to reset it to the default value.
The default value of this property is an `MGLStyleValue` object containing an
`NSNumber` object containing the float `0`. Set this property to `nil` to reset
it to the default value.
*/
@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *lineGapWidth;
/**
The line's offset. For linear features, a positive value offsets the line to the right, relative to the direction of the line, and a negative value to the left. For polygon features, a positive value results in an inset, and a negative value results in an outset.
The line's offset. For linear features, a positive value offsets the line to
the right, relative to the direction of the line, and a negative value to the
left. For polygon features, a positive value results in an inset, and a
negative value results in an outset.
This property is measured in points.
The default value of this property is an `MGLStyleValue` object containing an `NSNumber` object containing the float `0`. Set this property to `nil` to reset it to the default value.
The default value of this property is an `MGLStyleValue` object containing an
`NSNumber` object containing the float `0`. Set this property to `nil` to reset
it to the default value.
*/
@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *lineOffset;
/**
The opacity at which the line will be drawn.
The default value of this property is an `MGLStyleValue` object containing an `NSNumber` object containing the float `1`. Set this property to `nil` to reset it to the default value.
The default value of this property is an `MGLStyleValue` object containing an
`NSNumber` object containing the float `1`. Set this property to `nil` to reset
it to the default value.
*/
@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *lineOpacity;
/**
Name of image in style images to use for drawing image lines. For seamless patterns, image width must be a factor of two (2, 4, 8, ..., 512).
Name of image in style images to use for drawing image lines. For seamless
patterns, image width must be a factor of two (2, 4, 8, ..., 512).
*/
@property (nonatomic, null_resettable) MGLStyleValue<NSString *> *linePattern;
/**
The geometry's offset.
This property is measured in points.
The default value of this property is an `MGLStyleValue` object containing an `NSValue` object containing a `CGVector` struct set to 0 points from the left and 0 points from the top. Set this property to `nil` to reset it to the default value.
The default value of this property is an `MGLStyleValue` object containing an
`NSValue` object containing a `CGVector` struct set to 0 points from the left
and 0 points from the top. Set this property to `nil` to reset it to the
default value.
*/
@property (nonatomic, null_resettable) MGLStyleValue<NSValue *> *lineTranslate;
/**
Controls the translation reference point.
The default value of this property is an `MGLStyleValue` object containing an `NSValue` object containing `MGLLineTranslateAnchorMap`. Set this property to `nil` to reset it to the default value.
This property is only applied to the style if `lineTranslate` is non-`nil`. Otherwise, it is ignored.
The default value of this property is an `MGLStyleValue` object containing an
`NSValue` object containing `MGLLineTranslateAnchorMap`. Set this property to
`nil` to reset it to the default value.
This property is only applied to the style if `lineTranslate` is non-`nil`.
Otherwise, it is ignored.
*/
@property (nonatomic, null_resettable) MGLStyleValue<NSValue *> *lineTranslateAnchor;
/**
Stroke thickness.
This property is measured in points.
The default value of this property is an `MGLStyleValue` object containing an `NSNumber` object containing the float `1`. Set this property to `nil` to reset it to the default value.
The default value of this property is an `MGLStyleValue` object containing an
`NSNumber` object containing the float `1`. Set this property to `nil` to reset
it to the default value.
*/
@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *lineWidth;

View File

@@ -7,10 +7,15 @@ NS_ASSUME_NONNULL_BEGIN
/**
The `MGLMultiPoint` class is an abstract superclass used to define shapes
composed of multiple vertices. You should not create instances of this class
directly. Instead, you should create instances of the `MGLPolyline` or
`MGLPolygon` classes. However, you can use the method and properties of this
class to access information about the vertices of the line or polygon.
composed of multiple vertices.
You do not create instances of this class directly. Instead, you create
instances of the `MGLPolyline` or `MGLPolygon` classes. However, you can use
the method and properties of this class to access information about the
vertices of the line or polygon.
Do not confuse `MGLMultiPoint` with `MGLPointCollection`, which represents a
collection of related but disconnected points.
*/
@interface MGLMultiPoint : MGLShape
@@ -55,7 +60,7 @@ NS_ASSUME_NONNULL_BEGIN
the map, it is redrawn immediately.
@param coords The array of coordinates to insert into the shape. The data in
this array is copied to the shape’s `coordinate` property.
this array is copied to the shape’s `coordinates` property.
@param count The number of items in the `coords` array.
@param index The zero-based index at which the first coordinate in `coords`
will appear in the `coordinates` property.
@@ -67,7 +72,7 @@ NS_ASSUME_NONNULL_BEGIN
the map, it is redrawn immediately.
@param coords The array of coordinates to add to the shape. The data in this
array is copied to the shape’s `coordinate` property.
array is copied to the shape’s `coordinates` property.
@param count The number of items in the `coords` array.
*/
- (void)appendCoordinates:(const CLLocationCoordinate2D *)coords count:(NSUInteger)count;
@@ -90,7 +95,7 @@ NS_ASSUME_NONNULL_BEGIN
being the second vertex, and so on. The `length` field indicates the number
of vertices to replace.
@param coords The array of coordinates defining part of the shape. The data in
this array is copied to the shape’s `coordinate` property.
this array is copied to the shape’s `coordinates` property.
*/
- (void)replaceCoordinatesInRange:(NSRange)range withCoordinates:(const CLLocationCoordinate2D *)coords;

View File

@@ -25,8 +25,8 @@ typedef NS_ENUM (NSInteger, MGLOfflinePackState) {
The pack is incomplete and is not currently downloading.
This is the initial state of a pack that is created using the
`-[MGLOfflinePack addPackForRegion:withContext:completionHandler:]` method,
as well as after the `-[MGLOfflinePack suspend]` method is
`-[MGLOfflineStorage addPackForRegion:withContext:completionHandler:]`
method, as well as after the `-[MGLOfflinePack suspend]` method is
called.
*/
MGLOfflinePackStateInactive = 1,

View File

@@ -18,7 +18,8 @@ NS_ASSUME_NONNULL_BEGIN
`userInfo` dictionary contains the pack’s current state in the
`MGLOfflinePackStateUserInfoKey` key and details about the pack’s current
progress in the `MGLOfflinePackProgressUserInfoKey` key. You may also consult
the pack’s `state` and `progress` properties, which provide the same values.
the `MGLOfflinePack.state` and `MGLOfflinePack.progress` properties, which
provide the same values.
If you only need to observe changes in a particular pack’s progress, you can
alternatively observe KVO change notifications to the pack’s `progress` key

View File

@@ -52,10 +52,19 @@ void MGLFinishCustomStyleLayer(void *context) {
}
/**
An `MGLOpenGLStyleLayer` is a style layer that is rendered by OpenGL code in
Objective-C blocks or Swift closures that you specify. You may initialize a new
OpenGL style layer to add to an `MGLStyle` or obtain one from an `MGLMapView`’s
current style using the `-[MGLStyle layerWithIdentifier:]` method.
An `MGLOpenGLStyleLayer` is a style layer that is rendered by OpenGL code that
you provide.
By default, this class does nothing. You can subclass this class to provide
custom OpenGL drawing code that is run on each frame of the map. Your subclass
should override the `-didMoveToMapView:`, `-willMoveFromMapView:`, and
`-drawInMapView:withContext:` methods.
You can access an existing OpenGL style layer using the
`-[MGLStyle layerWithIdentifier:]` method if you know its identifier;
otherwise, find it using the `MGLStyle.layers` property. You can also create a
new OpenGL style layer and add it to the style using a method such as
`-[MGLStyle addLayer:]`.
@warning This API is undocumented and therefore unsupported. It may change at
any time without notice.

View File

@@ -9,9 +9,8 @@ NS_ASSUME_NONNULL_BEGIN
/**
The `MGLOverlay` protocol defines a specific type of annotation that represents
both a point and an area on a map. Overlay objects are essentially data objects
that contain the geographic data needed to represent the map area. For example,
overlays can take the form of common shapes such as rectangles and circles.
They can also describe polygons and other complex shapes.
that contain the geographic data needed to represent the map area. Overlays can
take the form of a polyline or polygon.
You use overlays to layer more sophisticated content on top of a map view. For
example, you could use an overlay to show the boundaries of a national park or

View File

@@ -6,15 +6,37 @@
NS_ASSUME_NONNULL_BEGIN
/**
The `MGLPointAnnotation` class defines a concrete annotation object located at
a specified point. You can use this class, rather than define your own, in
situations where all you want to do is associate a point on the map with a
title.
An `MGLPointAnnotation` object represents a one-dimensional shape located at a
single geographical coordinate. Depending on how it is used, an
`MGLPointAnnotation` object is known as a point annotation or point shape. For
example, you could use a point shape to represent a city at low zoom levels, an
address at high zoom levels, or the location of a long press gesture.
You can add point shapes to the map by adding them to an `MGLShapeSource`
object. Configure the appearance of an `MGLShapeSource`’s or
`MGLVectorSource`’s point shapes collectively using an `MGLCircleStyleLayer` or
`MGLSymbolStyleLayer` object.
For more interactivity, add a selectable point annotation to a map view using
the `-[MGLMapView addAnnotation:]` method. Alternatively, define your own model
class that conforms to the `MGLAnnotation` protocol. Configure a point
annotation’s appearance using
`-[MGLMapViewDelegate mapView:imageForAnnotation:]` or
`-[MGLMapViewDelegate mapView:viewForAnnotation:]` (iOS only). A point
annotation’s `MGLShape.title` and `MGLShape.subtitle` properties define the
default content of the annotation’s callout (on iOS) or popover (on macOS).
To group multiple related points together in one shape, use an
`MGLPointCollection` or `MGLShapeCollection` object.
A point shape is known as a
<a href="https://tools.ietf.org/html/rfc7946#section-3.1.2">Point</a> geometry
in GeoJSON.
*/
@interface MGLPointAnnotation : MGLShape
/**
The coordinate point of the annotation, specified as a latitude and longitude.
The coordinate point of the shape, specified as a latitude and longitude.
*/
@property (nonatomic, assign) CLLocationCoordinate2D coordinate;

View File

@@ -5,15 +5,26 @@
#import "MGLShape.h"
/**
The `MGLPointCollection` class is used to define an array of disconnected
coordinates. The points in the collection may be related but are not
connected visually in any way.
An `MGLPointCollection` object represents a shape consisting of one or more
disconnected vertices, specified as `CLLocationCoordinate2D` instances. The
points in the collection may be related but are not connected spatially. For
example, you could use a point collection to represent all the trees in an
orchard.
@note `MGLPointCollection` objects cannot be added to a map view using
`-[MGLMapView addAnnotations:]` and related methods. However, when used in a
`MGLPointCollectionFeature` to initialize a `MGLShapeSource` that is added
to the map view's style, the point collection represents as a group of distinct
annotations.
You can add point collections to the map by adding them to an `MGLShapeSource`
object. Configure the appearance of an `MGLShapeSource`’s or
`MGLVectorSource`’s point collections collectively using an
`MGLCircleStyleLayer` or `MGLSymbolStyleLayer` object.
You cannot add an `MGLPointCollection` object directly to a map view as an
annotation. However, you can create individual `MGLPointAnnotation` objects
from the `coordinates` array and add those annotation objects to the map view
using the `-[MGLMapView addAnnotations:]` method.
A point collection is known as a
<a href="https://tools.ietf.org/html/rfc7946#section-3.1.3">MultiPoint</a>
geometry in GeoJSON. Do not confuse `MGLPointCollection` with `MGLMultiPoint`,
the abstract superclass of `MGLPolyline` and `MGLPolygon`.
*/
@interface MGLPointCollection : MGLShape <MGLOverlay>

View File

@@ -9,10 +9,39 @@
NS_ASSUME_NONNULL_BEGIN
/**
The `MGLPolygon` class represents a shape consisting of one or more points that
define a closed polygon. The points are connected end-to-end in the order they
are provided. The first and last points are connected to each other to create
the closed shape.
An `MGLPolygon` object represents a closed shape consisting of four or more
vertices, specified as `CLLocationCoordinate2D` instances, and the edges that
connect them. For example, you could use a polygon shape to represent a
building, a lake, or an area you want to highlight.
You can add polygon shapes to the map by adding them to an `MGLShapeSource`
object. Configure the appearance of an `MGLShapeSource`’s or
`MGLVectorSource`’s polygons collectively using an `MGLFillStyleLayer` or
`MGLSymbolStyleLayer` object.
Alternatively, you can add a polygon overlay directly to a map view using the
`-[MGLMapView addAnnotation:]` or `-[MGLMapView addOverlay:]` method. Configure
a polygon overlay’s appearance using
`-[MGLMapViewDelegate mapView:strokeColorForShapeAnnotation:]` and
`-[MGLMapViewDelegate mapView:fillColorForPolygonAnnotation:]`.
The vertices are automatically connected in the order in which you provide
them. You should close the polygon by specifying the same
`CLLocationCoordinate2D` as the first and last vertices; otherwise, the
polygon’s fill may not cover the area you expect it to. To avoid filling the
space within the shape, give the polygon a transparent fill or use an
`MGLPolyline` object.
A polygon may have one or more interior polygons, or holes, that you specify as
`MGLPolygon` objects with the `+polygonWithCoordinates:count:interiorPolygons:`
method. For example, if a polygon represents a lake, it could exclude an island
within the lake using an interior polygon. Interior polygons may not themselves
have interior polygons. To represent a shape that includes a polygon within a
hole or, more generally, to group multiple polygons together in one shape, use
an `MGLMultiPolygon` or `MGLShapeCollection` object.
To make the polygon straddle the antimeridian, specify some longitudes less
than −180 degrees or greater than 180 degrees.
*/
@interface MGLPolygon : MGLMultiPoint <MGLOverlay>
@@ -55,14 +84,21 @@ NS_ASSUME_NONNULL_BEGIN
@end
/**
The `MGLMultiPolygon` class represents a shape consisting of one or more
polygons that do not overlap. For example, you would use an `MGLMultiPolygon`
object to represent an atoll together with an island in the atoll’s lagoon:
the atoll itself would be one `MGLPolygon` object, while the inner island would
be another.
An `MGLMultiPolygon` object represents a shape consisting of one or more
polygons that do not overlap. For example, you could use a multipolygon shape
to represent the body of land that consists of an island surrounded by an
atoll: the inner island would be one `MGLPolygon` object, while the surrounding
atoll would be another. You could also use a multipolygon shape to represent a
group of disconnected but related buildings.
@note `MGLMultiPolygon` objects cannot be added to a map view using
`-[MGLMapView addAnnotations:]` and related methods.
You can add multipolygon shapes to the map by adding them to an
`MGLShapeSource` object. Configure the appearance of an `MGLShapeSource`’s or
`MGLVectorSource`’s multipolygons collectively using an `MGLFillStyleLayer` or
`MGLSymbolStyleLayer` object.
You cannot add an `MGLMultiPolygon` object directly to a map view using
`-[MGLMapView addAnnotation:]` or `-[MGLMapView addOverlay:]`. However, you can
add the `polygons` array’s items as overlays individually.
*/
@interface MGLMultiPolygon : MGLShape <MGLOverlay>

View File

@@ -9,10 +9,35 @@
NS_ASSUME_NONNULL_BEGIN
/**
The `MGLPolyline` class represents a shape consisting of one or more points
that define connecting line segments. The points are connected end-to-end in
the order they are provided. The first and last points are not connected to
each other.
An `MGLPolyline` object represents a shape consisting of two or more vertices,
specified as `CLLocationCoordinate2D` instances, and the line segments that
connect them. For example, you could use an polyline to represent a road or the
path along which something moves.
You can add polyline shapes to the map by adding them to an `MGLShapeSource`
object. Configure the appearance of an `MGLShapeSource`’s or
`MGLVectorSource`’s polylines collectively using an `MGLLineStyleLayer` or
`MGLSymbolStyleLayer` object.
Alternatively, you can add a polyline overlay directly to a map view using the
`-[MGLMapView addAnnotation:]` or `-[MGLMapView addOverlay:]` method. Configure
a polyline overlay’s appearance using
`-[MGLMapViewDelegate mapView:strokeColorForShapeAnnotation:]` and
`-[MGLMapViewDelegate mapView:lineWidthForPolylineAnnotation:]`.
The vertices are automatically connected in the order in which you provide
them. The first and last vertices are not connected to each other, but you can
specify the same `CLLocationCoordinate2D` as the first and last vertices in
order to close the polyline. To fill the space within the shape, use an
`MGLPolygon` object. To group multiple polylines together in one shape, use an
`MGLMultiPolyline` or `MGLShapeCollection` object.
To make the polyline straddle the antimeridian, specify some longitudes less
than −180 degrees or greater than 180 degrees.
A polyline is known as a
<a href="https://tools.ietf.org/html/rfc7946#section-3.1.4">LineString</a>
geometry in GeoJSON.
*/
@interface MGLPolyline : MGLMultiPoint <MGLOverlay>
@@ -30,14 +55,23 @@ NS_ASSUME_NONNULL_BEGIN
@end
/**
The `MGLMultiPolyline` class represents a shape consisting of one or more
polylines. For example, you could use an `MGLMultiPolyline` object to represent
both sides of a divided highway (dual carriageway), excluding the median
(central reservation): each carriageway would be a distinct `MGLPolyline`
object.
An `MGLMultiPolyline` object represents a shape consisting of one or more
polylines. For example, you could use a multipolyline shape to represent both
sides of a divided highway (dual carriageway), excluding the median (central
reservation): each carriageway would be a distinct `MGLPolyline` object.
@note `MGLMultiPolyline` objects cannot be added to a map view using
`-[MGLMapView addAnnotations:]` and related methods.
You can add multipolyline shapes to the map by adding them to an
`MGLShapeSource` object. Configure the appearance of an `MGLShapeSource`’s or
`MGLVectorSource`’s multipolylines collectively using an `MGLLineStyleLayer` or
`MGLSymbolStyleLayer` object.
You cannot add an `MGLMultiPolyline` object directly to a map view using
`-[MGLMapView addAnnotation:]` or `-[MGLMapView addOverlay:]`. However, you can
add the `polylines` array’s items as overlays individually.
A multipolyline is known as a
<a href="https://tools.ietf.org/html/rfc7946#section-3.1.5">MultiLineString</a>
geometry in GeoJSON.
*/
@interface MGLMultiPolyline : MGLShape <MGLOverlay>

View File

@@ -7,80 +7,111 @@
NS_ASSUME_NONNULL_BEGIN
/**
A raster layer which allows customization of styling properties at runtime. You may
instantiate a new raster layer to add to a map style or you may query an
`MGLMapView` for its `style` and obtain existing layers using the
`-[MGLStyle layerWithIdentifier:]` method.
An `MGLRasterStyleLayer` is a style layer that renders raster tiles on the map.
Use a raster style layer to configure the color parameters of raster tiles
loaded by an `MGLRasterSource` object. For example, you could use a raster
style layer to render <a href="https://www.mapbox.com/satellite/">Mapbox
Satellite</a> imagery, a <a
href="https://www.mapbox.com/help/define-tileset/#raster-tilesets">raster tile
set</a> uploaded to Mapbox Studio, or a raster map authored in <a
href="https://tilemill-project.github.io/tilemill/">TileMill</a>, the classic
Mapbox Editor, or Mapbox Studio Classic.
You can access an existing raster style layer using the
`-[MGLStyle layerWithIdentifier:]` method if you know its identifier;
otherwise, find it using the `MGLStyle.layers` property. You can also create a
new raster style layer and add it to the style using a method such as
`-[MGLStyle addLayer:]`.
*/
@interface MGLRasterStyleLayer : MGLForegroundStyleLayer
#pragma mark - Accessing the Paint Attributes
/**
Increase or reduce the brightness of the image. The value is the maximum brightness.
Increase or reduce the brightness of the image. The value is the maximum
brightness.
The default value of this property is an `MGLStyleValue` object containing an `NSNumber` object containing the float `1`. Set this property to `nil` to reset it to the default value.
The default value of this property is an `MGLStyleValue` object containing an
`NSNumber` object containing the float `1`. Set this property to `nil` to reset
it to the default value.
This attribute corresponds to the <a href="https://www.mapbox.com/mapbox-gl-style-spec/#paint-raster-brightness-max"><code>raster-brightness-max</code></a> paint property in the Mapbox Style Specification.
This attribute corresponds to the <a
href="https://www.mapbox.com/mapbox-gl-style-spec/#layout-raster-raster-brightness-max"><code>raster-brightness-max</code></a>
layout property in the Mapbox Style Specification.
*/
@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *maximumRasterBrightness;
@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *rasterBrightnessMax __attribute__((unavailable("Use maximumRasterBrightness instead.")));
/**
Increase or reduce the brightness of the image. The value is the minimum brightness.
Increase or reduce the brightness of the image. The value is the minimum
brightness.
The default value of this property is an `MGLStyleValue` object containing an `NSNumber` object containing the float `0`. Set this property to `nil` to reset it to the default value.
The default value of this property is an `MGLStyleValue` object containing an
`NSNumber` object containing the float `0`. Set this property to `nil` to reset
it to the default value.
This attribute corresponds to the <a href="https://www.mapbox.com/mapbox-gl-style-spec/#paint-raster-brightness-min"><code>raster-brightness-min</code></a> paint property in the Mapbox Style Specification.
This attribute corresponds to the <a
href="https://www.mapbox.com/mapbox-gl-style-spec/#layout-raster-raster-brightness-min"><code>raster-brightness-min</code></a>
layout property in the Mapbox Style Specification.
*/
@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *minimumRasterBrightness;
@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *rasterBrightnessMin __attribute__((unavailable("Use minimumRasterBrightness instead.")));
/**
Increase or reduce the contrast of the image.
The default value of this property is an `MGLStyleValue` object containing an `NSNumber` object containing the float `0`. Set this property to `nil` to reset it to the default value.
The default value of this property is an `MGLStyleValue` object containing an
`NSNumber` object containing the float `0`. Set this property to `nil` to reset
it to the default value.
*/
@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *rasterContrast;
/**
Fade duration when a new tile is added.
This property is measured in milliseconds.
The default value of this property is an `MGLStyleValue` object containing an `NSNumber` object containing the float `300`. Set this property to `nil` to reset it to the default value.
The default value of this property is an `MGLStyleValue` object containing an
`NSNumber` object containing the float `300`. Set this property to `nil` to
reset it to the default value.
*/
@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *rasterFadeDuration;
/**
Rotates hues around the color wheel.
This property is measured in degrees.
The default value of this property is an `MGLStyleValue` object containing an `NSNumber` object containing the float `0`. Set this property to `nil` to reset it to the default value.
The default value of this property is an `MGLStyleValue` object containing an
`NSNumber` object containing the float `0`. Set this property to `nil` to reset
it to the default value.
This attribute corresponds to the <a href="https://www.mapbox.com/mapbox-gl-style-spec/#paint-raster-hue-rotate"><code>raster-hue-rotate</code></a> paint property in the Mapbox Style Specification.
This attribute corresponds to the <a
href="https://www.mapbox.com/mapbox-gl-style-spec/#layout-raster-raster-hue-rotate"><code>raster-hue-rotate</code></a>
layout property in the Mapbox Style Specification.
*/
@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *rasterHueRotation;
@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *rasterHueRotate __attribute__((unavailable("Use rasterHueRotation instead.")));
/**
The opacity at which the image will be drawn.
The default value of this property is an `MGLStyleValue` object containing an `NSNumber` object containing the float `1`. Set this property to `nil` to reset it to the default value.
The default value of this property is an `MGLStyleValue` object containing an
`NSNumber` object containing the float `1`. Set this property to `nil` to reset
it to the default value.
*/
@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *rasterOpacity;
/**
Increase or reduce the saturation of the image.
The default value of this property is an `MGLStyleValue` object containing an `NSNumber` object containing the float `0`. Set this property to `nil` to reset it to the default value.
The default value of this property is an `MGLStyleValue` object containing an
`NSNumber` object containing the float `0`. Set this property to `nil` to reset
it to the default value.
*/
@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *rasterSaturation;

View File

@@ -5,11 +5,23 @@
NS_ASSUME_NONNULL_BEGIN
/**
The `MGLShape` class is an abstract class that defines the basic properties for
all shape-based annotation objects. This class must be subclassed and cannot be
used as is. Subclasses are responsible for defining the geometry of the shape
and providing an appropriate value for the coordinate property inherited from
the `MGLAnnotation` protocol.
`MGLShape` is an abstract class that represents a shape or annotation. Shapes
constitute the content of a map – not only the overlays atop the map, but also
the content that forms the base map.
You do not create instances of this class directly or create subclasses of this
class. Instead, you create instances of `MGLPointAnnotation`,
`MGLPointCollection`, `MGLPolyline`, `MGLMultiPolyline`, `MGLPolygon`,
`MGLMultiPolygon`, or `MGLShapeCollection`. The shape classes correspond to the
<a href="https://tools.ietf.org/html/rfc7946#section-3.1">Geometry</a> object
types in the GeoJSON standard, but some have nonstandard names for backwards
compatibility.
You can add shapes to the map by adding them to an `MGLShapeSource` object.
Configure the appearance of an `MGLShapeSource`’s or `MGLVectorSource`’s shapes
collectively using a concrete instance of `MGLVectorStyleLayer`. Alternatively,
you can add some kinds of shapes directly to a map view as annotations or
overlays.
*/
@interface MGLShape : NSObject <MGLAnnotation>
@@ -38,21 +50,34 @@ NS_ASSUME_NONNULL_BEGIN
#pragma mark Accessing the Shape Attributes
/**
The title of the shape annotation. The default value of this property is `nil`.
The title of the shape annotation.
The default value of this property is `nil`.
This property is ignored when the shape is used in an `MGLShapeSource`. To name
a shape used in a shape source, create an `MGLFeature` and add an attribute to
the `MGLFeature.attributes` property.
*/
@property (nonatomic, copy, nullable) NSString *title;
/**
The subtitle of the shape annotation. The default value of this property is
`nil`.
This property is ignored when the shape is used in an `MGLShapeSource`. To
provide additional information about a shape used in a shape source, create an
`MGLFeature` and add an attribute to the `MGLFeature.attributes` property.
*/
@property (nonatomic, copy, nullable) NSString *subtitle;
#if !TARGET_OS_IPHONE
/**
The tooltip of the shape annotation. The default value of this property is
`nil`.
The tooltip of the shape annotation.
The default value of this property is `nil`.
This property is ignored when the shape is used in an `MGLShapeSource`.
*/
@property (nonatomic, copy, nullable) NSString *toolTip;

View File

@@ -7,12 +7,30 @@
NS_ASSUME_NONNULL_BEGIN
/**
The `MGLShapeCollection` class represents a shape consisting of one or more
An `MGLShapeCollection` object represents a shape consisting of one or more
distinct but related shapes that are instances of `MGLShape`. The constituent
shapes can be a mixture of different kinds of shapes.
@note `MGLShapeCollection` objects cannot be added to a map view using
`-[MGLMapView addAnnotations:]` and related methods.
`MGLShapeCollection` is most commonly used to add multiple shapes to a single
`MGLShapeSource`. Configure the appearance of an `MGLShapeSource`’s or
`MGLVectorSource`’s shape collection collectively using an
`MGLSymbolStyleLayer` object, or use multiple instances of
`MGLCircleStyleLayer`, `MGLFillStyleLayer`, and `MGLLineStyleLayer` to
configure the appearance of each kind of shape inside the collection.
You cannot add an `MGLShapeCollection` object directly to a map view as an
annotation. However, you can create individual `MGLPointAnnotation`,
`MGLPolyline`, and `MGLPolygon` objects from the `shapes` array and add those
annotation objects to the map view using the `-[MGLMapView addAnnotations:]`
method.
To represent a collection of point, polyline, or polygon shapes, it may be more
convenient to use an `MGLPointCollection`, `MGLMultiPolyline`, or
`MGLMultiPolygon` object, respectively.
A multipolyline is known as a
<a href="https://tools.ietf.org/html/rfc7946#section-3.1.8">GeometryCollection</a>
geometry in GeoJSON.
*/
@interface MGLShapeCollection : MGLShape

View File

@@ -40,7 +40,7 @@ static const NSInteger MGLStyleDefaultVersion = 9;
via `-[MGLMapView style]` by updating the style's data sources or layers.
@note Wait until the map style has finished loading before modifying a map's
style via any of the MGLStyle instance methods below.
style via any of the `MGLStyle` instance methods below.
You can use the `MGLMapViewDelegate` methods `-mapViewDidFinishLoadingMap:`
or `-mapView:didFinishLoadingStyle:` as indicators that it's safe
to modify the map's style.

View File

@@ -1,9 +1,8 @@
<%
const doc = locals.doc;
const type = locals.type;
const layoutProperties = locals.layoutProperties;
const paintProperties = locals.paintProperties;
const layoutPropertiesByName = locals.layoutPropertiesByName;
const paintPropertiesByName = locals.paintPropertiesByName;
-%>
// This file is generated.
// Edit platform/darwin/scripts/generate-style-code.js, then run `make style-code-darwin`.
@@ -20,14 +19,15 @@ NS_ASSUME_NONNULL_BEGIN
<% for (const property of layoutProperties) { -%>
<% if (property.type == "enum") { -%>
/**
<%- propertyDoc(property.name, property, type) %>
<%- propertyDoc(property.name, property, type, 'enum').wrap(80, 1) %>
Values of this type are used in the `<%- camelizeWithLeadingLowercase(property.name) %>` property of `MGL<%- camelize(type) %>StyleLayer`.
Values of this type are used in the `MGL<%- camelize(type) %>StyleLayer.<%- camelizeWithLeadingLowercase(property.name) %>`
property.
*/
typedef NS_ENUM(NSUInteger, MGL<%- camelize(property.name) %>) {
<% for (const value in property.values) { -%>
/**
<%- propertyDoc(property.name, property.values[value], type) %>
<%- propertyDoc(property.name, property.values[value], type, 'enum').wrap(80, 4+1) %>
*/
MGL<%- camelize(property.name) %><%- camelize(value) %>,
<% } -%>
@@ -38,14 +38,15 @@ typedef NS_ENUM(NSUInteger, MGL<%- camelize(property.name) %>) {
<% for (const property of paintProperties) { -%>
<% if (property.type == "enum") { -%>
/**
<%- propertyDoc(property.name, property, type) %>
<%- propertyDoc(property.name, property, type, 'enum').wrap(80, 1) %>
Values of this type are used in the `<%- camelizeWithLeadingLowercase(property.name) %>` property of `MGL<%- camelize(type) %>StyleLayer`.
Values of this type are used in the `MGL<%- camelize(type) %>StyleLayer.<%- camelizeWithLeadingLowercase(property.name) %>`
property.
*/
typedef NS_ENUM(NSUInteger, MGL<%- camelize(property.name) %>) {
<% for (const value in property.values) { -%>
/**
<%- propertyDoc(property.name, property.values[value], type) %>
<%- propertyDoc(property.name, property.values[value], type, 'enum').wrap(80, 4+1) %>
*/
MGL<%- camelize(property.name) %><%- camelize(value) %>,
<% } -%>
@@ -55,17 +56,17 @@ typedef NS_ENUM(NSUInteger, MGL<%- camelize(property.name) %>) {
<% } -%>
<% if (type == 'background') { -%>
/**
A map style's background layer is the bottommost layer and is used to style a color
or pattern to show below all other map features. You can query an `MGLMapView` for its
`style` and obtain the background layer using the `-[MGLStyle layerWithIdentifier:]`
method and passing `background` for the identifier.
<%- doc.wrap(80, 1) %>
*/
<% } else { -%>
/**
A <%- type %> layer which allows customization of styling properties at runtime. You may
instantiate a new <%- type %> layer to add to a map style or you may query an
`MGLMapView` for its `style` and obtain existing layers using the
`-[MGLStyle layerWithIdentifier:]` method.
<%- doc.wrap(80, 1) %>
You can access an existing <%- type %> style layer using the
`-[MGLStyle layerWithIdentifier:]` method if you know its identifier;
otherwise, find it using the `MGLStyle.layers` property. You can also create a
new <%- type %> style layer and add it to the style using a method such as
`-[MGLStyle addLayer:]`.
*/
<% } -%>
@interface MGL<%- camelize(type) %>StyleLayer : MGL<%-
@@ -83,18 +84,7 @@ typedef NS_ENUM(NSUInteger, MGL<%- camelize(property.name) %>) {
<% for (const property of layoutProperties) { -%>
/**
<%- propertyDoc(property.name, property, type) %>
<% if ('default' in property) { -%>
The default value of this property is <%- propertyDefault(property, type) %>.<% if (!property.required) { %> Set this property to `nil` to reset it to the default value.<% } %>
<% } if (property.requires) { -%>
<%- propertyReqs(property, layoutPropertiesByName, type) %>
<% } -%>
<% if (property.original) { -%>
This attribute corresponds to the <a href="https://www.mapbox.com/mapbox-gl-style-spec/#layout-<%- type -%>-<%- property.original -%>"><code><%- property.original -%></code></a> layout property in the Mapbox Style Specification.
<% } -%>
<%- propertyDoc(property.name, property, type, 'layout').wrap(80, 1) %>
*/
@property (nonatomic<% if (!property.required) { %>, null_resettable<% } if (property.getter) { %>, getter=<%- objCGetter(property) -%><% } %>) MGLStyleValue<<%- propertyType(property, true) %>> *<%- camelizeWithLeadingLowercase(property.name) %>;
@@ -109,22 +99,11 @@ typedef NS_ENUM(NSUInteger, MGL<%- camelize(property.name) %>) {
<% for (const property of paintProperties) { -%>
/**
<%- propertyDoc(property.name, property, type) %>
<% if ('default' in property) { -%>
The default value of this property is <%- propertyDefault(property, type) %>.<% if (!property.required) { %> Set this property to `nil` to reset it to the default value.<% } %>
<% } if (property.requires) { -%>
<%- propertyReqs(property, paintPropertiesByName, type) %>
<% } -%>
<% if (property.original) { -%>
This attribute corresponds to the <a href="https://www.mapbox.com/mapbox-gl-style-spec/#paint-<%- property.original -%>"><code><%- property.original -%></code></a> paint property in the Mapbox Style Specification.
<% } -%>
<%- propertyDoc(property.name, property, type, 'paint').wrap(80, 1) %>
*/
@property (nonatomic<% if (!property.required) { %>, null_resettable<% } if (property.getter) { %>, getter=<%- objCGetter(property) -%><% } %>) MGLStyleValue<<%- propertyType(property, true) %>> *<%- camelizeWithLeadingLowercase(property.name) %>;
<% if (property.original) { %>
<% if (property.original) { -%>
@property (nonatomic<% if (!property.required) { %>, null_resettable<% } %>) MGLStyleValue<<%- propertyType(property, true) %>> *<%- camelizeWithLeadingLowercase(originalPropertyName(property)) %> __attribute__((unavailable("Use <%- camelizeWithLeadingLowercase(property.name) %> instead.")));
<% } -%>

File diff suppressed because it is too large Load Diff

View File

@@ -4,12 +4,12 @@
- (void)setPredicate:(NSPredicate *)predicate {
[NSException raise:@"MGLAbstractClassException"
format:@"MGLVectorLayer is an abstract class"];
format:@"MGLVectorStyleLayer is an abstract class"];
}
- (NSPredicate *)predicate {
[NSException raise:@"MGLAbstractClassException"
format:@"MGLVectorLayer is an abstract class"];
format:@"MGLVectorStyleLayer is an abstract class"];
return nil;
}

View File

@@ -14,18 +14,18 @@ Mapbox welcomes participation and contributions from everyone. Please read [CONT
* A new runtime styling API allows you to adjust the style and content of the base map dynamically. All the options available in [Mapbox Studio](https://www.mapbox.com/studio/) are now exposed via MGLStyle and subclasses of MGLStyleLayer and MGLSource. ([#5727](https://github.com/mapbox/mapbox-gl-native/pull/5727))
* MGLMapView’s `styleURL` property can now be set to an absolute file URL. ([#6026](https://github.com/mapbox/mapbox-gl-native/pull/6026))
* MGLShapeSource objects, as well as GeoJSON sources specified by the stylesheet at design time, now support `cluster`, `clusterMaxZoom`, and `clusterRadius` attributes for clustering point features on the base map. ([#5724](https://github.com/mapbox/mapbox-gl-native/pull/5724))
* When creating an MGLShapeSource, you can now specify options for clustering point features within the shape source. Similarly, GeoJSON sources specified by the stylesheet at design time can specify the `cluster`, `clusterMaxZoom`, and `clusterRadius` attributes. ([#5724](https://github.com/mapbox/mapbox-gl-native/pull/5724))
* Added [quadkey](https://msdn.microsoft.com/en-us/library/bb259689.aspx) support and limited WMS support in raster tile URL templates. ([#5628](https://github.com/mapbox/mapbox-gl-native/pull/5628))
* TileJSON manifests can now specify `"scheme": "tms"` to indicate the use of [TMS](https://en.wikipedia.org/wiki/Tile_Map_Service) coordinates. ([#2270](https://github.com/mapbox/mapbox-gl-native/pull/2270))
* When creating an MGLTileSource, you can now specify that the tile URLs use [TMS](https://en.wikipedia.org/wiki/Tile_Map_Service) coordinates by setting `MGLTileSourceOptionTileCoordinateSystem` to `MGLTileCoordinateSystemTMS`. TileJSON files can specify `"scheme": "tms"`. ([#2270](https://github.com/mapbox/mapbox-gl-native/pull/2270))
* Fixed an issue causing abstract MGLMultiPointFeature objects to be returned in feature query results. Now concrete MGLPointCollectionFeature objects are returned. ([#6742](https://github.com/mapbox/mapbox-gl-native/pull/6742))
* Fixed rendering artifacts and missing glyphs that occurred after viewing a large number of CJK characters on the map. ([#5908](https://github.com/mapbox/mapbox-gl-native/pull/5908))
* `-[MGLMapView resetPosition]` now resets to the current style’s default center coordinates, zoom level, direction, and pitch, if specified. ([#6127](https://github.com/mapbox/mapbox-gl-native/pull/6127))
* Fixed an issue where feature querying sometimes failed to return the expected features when the map was tilted. ([#6773](https://github.com/mapbox/mapbox-gl-native/pull/6773))
* MGLFeature’s `attributes` and `identifier` properties are now writable. ([#6728](https://github.com/mapbox/mapbox-gl-native/pull/6728))
* The action sheet that appears when tapping the information button in the bottom-right corner now lists the correct attribution for the current style. ([#5999](https://github.com/mapbox/mapbox-gl-native/pull/5999))
* The `text-pitch-alignment` property is now supported in stylesheets for improved street label legibility on a tilted map. ([#5288](https://github.com/mapbox/mapbox-gl-native/pull/5288))
* The `icon-text-fit` and `icon-text-fit-padding` properties are now supported in stylesheets, allowing the background of a shield to automatically resize to fit the shield’s text. ([#5334](https://github.com/mapbox/mapbox-gl-native/pull/5334))
* The `circle-pitch-scale` property is now supported in stylesheets, allowing circle features in a tilted base map to scale or remain the same size as the viewing distance changes. ([#5576](https://github.com/mapbox/mapbox-gl-native/pull/5576))
* Added support for MGLSymbolStyleLayer’s `textPitchAlignment` property and the corresponding style JSON property for improved street label legibility on a tilted map. ([#5288](https://github.com/mapbox/mapbox-gl-native/pull/5288))
* Added support for MGLSymbolStyleLayer’s `iconTextFit` and `iconTextFitPadding` properties and the corresponding style JSON properties, allowing the background of a shield to automatically resize to fit the shield’s text. ([#5334](https://github.com/mapbox/mapbox-gl-native/pull/5334))
* Added support for MGLSymbolStyleLayer’s `circlePitchScale` property and the corresponding style JSON property, allowing circle features in a tilted base map to scale or remain the same size as the viewing distance changes. ([#5576](https://github.com/mapbox/mapbox-gl-native/pull/5576))
* The `identifier` property of an MGLFeature may now be either a number or string. ([#5514](https://github.com/mapbox/mapbox-gl-native/pull/5514))
* If MGLMapView is unable to obtain or parse a style, it now calls its delegate’s `-mapViewDidFailLoadingMap:withError:` method. ([#6145](https://github.com/mapbox/mapbox-gl-native/pull/6145))
* Added the `-[MGLMapViewDelegate mapView:didFinishLoadingStyle:]` delegate method, which offers the earliest opportunity to modify the layout or appearance of the current style before the map view is displayed to the user. ([#6636](https://github.com/mapbox/mapbox-gl-native/pull/6636))

View File

@@ -2,6 +2,8 @@
## 0.3.0
This version of the Mapbox macOS SDK corresponds to version 3.4.0 of the Mapbox iOS SDK. The two SDKs have very similar feature sets. The main differences are the lack of user location tracking and annotation views. Some APIs have been adapted to macOS conventions, particularly the use of NSPopover for callout views.
### Packaging
* Fixed an issue causing code signing failures and bloating the framework. ([#5850](https://github.com/mapbox/mapbox-gl-native/pull/5850))
@@ -13,8 +15,8 @@
* A new runtime styling API allows you to adjust the style and content of the base map dynamically. All the options available in [Mapbox Studio](https://www.mapbox.com/studio/) are now exposed via MGLStyle and subclasses of MGLStyleLayer and MGLSource. ([#5727](https://github.com/mapbox/mapbox-gl-native/pull/5727))
* MGLMapView’s `styleURL` property can now be set to an absolute file URL. ([#6026](https://github.com/mapbox/mapbox-gl-native/pull/6026))
* MGLShapeSource objects, as well as GeoJSON sources specified by the stylesheet at design time, now support `cluster`, `clusterMaxZoom`, and `clusterRadius` attributes for clustering point features on the base map. ([#5724](https://github.com/mapbox/mapbox-gl-native/pull/5724))
* TileJSON manifests can now specify `"scheme": "tms"` to indicate the use of [TMS](https://en.wikipedia.org/wiki/Tile_Map_Service) coordinates. ([#2270](https://github.com/mapbox/mapbox-gl-native/pull/2270))
* When creating an MGLShapeSource, you can now specify options for clustering point features within the shape source. Similarly, GeoJSON sources specified by the stylesheet at design time can specify the `cluster`, `clusterMaxZoom`, and `clusterRadius` attributes. ([#5724](https://github.com/mapbox/mapbox-gl-native/pull/5724))
* When creating an MGLTileSource, you can now specify that the tile URLs use [TMS](https://en.wikipedia.org/wiki/Tile_Map_Service) coordinates by setting `MGLTileSourceOptionTileCoordinateSystem` to `MGLTileCoordinateSystemTMS`. TileJSON files can specify `"scheme": "tms"`. ([#2270](https://github.com/mapbox/mapbox-gl-native/pull/2270))
* Fixed an issue causing abstract `MGLMultiPointFeature` objects to be returned in feature query results. Now concrete `MGLPointCollectionFeature` objects are returned. ([#6742](https://github.com/mapbox/mapbox-gl-native/pull/6742))
* Fixed rendering artifacts and missing glyphs that occurred after viewing a large number of CJK characters on the map. ([#5908](https://github.com/mapbox/mapbox-gl-native/pull/5908))
* Fixed an issue where the style zoom levels were not respected when deciding when to render a layer. ([#5811](https://github.com/mapbox/mapbox-gl-native/issues/5811))

View File

@@ -257,7 +257,7 @@ NS_ASSUME_NONNULL_BEGIN
such as `title` and `subtitle`.
If each annotation should have an identical callout, you can set the
`MGLMapView` instance’s `-setCalloutViewController:` method instead.
`MGLMapView.calloutViewController` property instead.
@param mapView The map view that is requesting a callout view controller.
@param annotation The object representing the annotation.