Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Update and reformat documentation for runtime styling #7475

Merged
merged 10 commits into from
Dec 21, 2016

Conversation

1ec5
Copy link
Contributor

@1ec5 1ec5 commented Dec 18, 2016

Rewrote documentation about MGLShape, its subclasses, and MGLFeature to emphasize runtime styling uses over annotation uses. The documentation comment for each class answers the following questions:

  • What kind of shape does it represent?
  • What real-world concept would I represent using this kind of shape?
  • How would I add this shape to a map using the runtime styling API? Which MGLStyleLayer subclasses apply?
  • How would I add this shape to the map as an annotation or overlay? Which MGLMapViewDelegate methods apply?
  • How does this class handle edge cases?
  • What other classes implement similar shapes or are easily confused with this class?
  • What does GeoJSON call this kind of shape, if it differs from the class name?

Rewrote documentation about MGLStyleLayer and its subclasses. The documentation comments are nominally based on the documentation in the style specification. However, all the existing layer types’ documentation has been overridden to answer the following questions:

  • What does the output look like?
  • What kinds of vector tile features would I style with this class?
  • What kinds of MGLShapes and MGLFeatures would I style with this class?
  • How do I get an existing layer of this type? How do I add a new one to the style?

Generated documentation comments for MGLStyleLayer subclasses now wrap at column 80. References to properties in other classes have gone from “MGLClass’s property property” to “the MGLClass.property property”, because jazzy can apparently autolink the latter syntax.

Updated links to the GeoJSON specification to point to RFC 7946. Removed references to unimplemented features like circle overlays. Corrected 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.

Fixes #6144.

/cc @ericrwolfe

1ec5 added 8 commits December 18, 2016 03:47
Changelog entries related to style JSON now lead off with the analogous portion of the runtime styling API.
jazzy can autolink `Class.property` references in documentation comments.
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.
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.
@1ec5 1ec5 added annotations Annotations on iOS and macOS or markers on Android documentation iOS Mapbox Maps SDK for iOS macOS Mapbox Maps SDK for macOS runtime styling labels Dec 18, 2016
@1ec5 1ec5 added this to the ios-v3.4.0 milestone Dec 18, 2016
@1ec5 1ec5 self-assigned this Dec 18, 2016
@1ec5 1ec5 requested a review from friedbunny December 18, 2016 12:03
@mention-bot
Copy link

@1ec5, thanks for your PR! By analyzing this pull request, we identified @incanus, @boundsj and @yhahn to be potential reviewers.

"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."
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that “getting the last item in the MGLStyle.layers array” becomes “getting the first item in the MGLStyle.layers array” once #7484 lands.

Copy link
Contributor

@friedbunny friedbunny left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great changes all around!

"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."
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Once fill extrusion layers land on the master branch, we’ll need to provide a similar documentation string for the fill-extrusion type.

/cc @boundsj

"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."
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Once this change makes it into the master branch, we’ll need to update this documentation string to note that circle style layers can be filled and optionally stroked.

@1ec5 1ec5 merged commit 1254bcd into release-ios-v3.4.0 Dec 21, 2016
@1ec5 1ec5 deleted the 1ec5-docs-style branch December 21, 2016 00:11
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
annotations Annotations on iOS and macOS or markers on Android documentation iOS Mapbox Maps SDK for iOS macOS Mapbox Maps SDK for macOS runtime styling
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants