From 1254bcdb4006d87fefedfc5020b3dc7d3cd0e544 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Minh=20Nguy=E1=BB=85n?= Date: Tue, 20 Dec 2016 16:11:05 -0800 Subject: [ios, macos] Update and reformat documentation for runtime styling (#7475) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * [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 --- platform/darwin/src/MGLLineStyleLayer.h | 159 ++++++++++++++++++++++---------- 1 file changed, 111 insertions(+), 48 deletions(-) (limited to 'platform/darwin/src/MGLLineStyleLayer.h') diff --git a/platform/darwin/src/MGLLineStyleLayer.h b/platform/darwin/src/MGLLineStyleLayer.h index c47c7d5166..c0f2eb322b 100644 --- a/platform/darwin/src/MGLLineStyleLayer.h +++ b/platform/darwin/src/MGLLineStyleLayer.h @@ -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 *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 *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 *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 *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 *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 *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 *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. - + 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. - This attribute corresponds to the line-dasharray paint property in the Mapbox Style Specification. + This property is only applied to the style if `linePattern` is set to `nil`. + Otherwise, it is ignored. + + This attribute corresponds to the line-dasharray + layout property in the Mapbox Style Specification. */ @property (nonatomic, null_resettable) MGLStyleValue *> *lineDashPattern; - @property (nonatomic, null_resettable) MGLStyleValue *> *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 *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 *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 *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 *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 *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 *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 *lineWidth; -- cgit v1.2.1 From 9faa4af1c3cf0665ede20de8d98005ef9016b792 Mon Sep 17 00:00:00 2001 From: Eric Wolfe Date: Wed, 21 Dec 2016 10:22:13 -0800 Subject: [ios] Add inline examples in documentation (#7337) --- platform/darwin/src/MGLLineStyleLayer.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'platform/darwin/src/MGLLineStyleLayer.h') diff --git a/platform/darwin/src/MGLLineStyleLayer.h b/platform/darwin/src/MGLLineStyleLayer.h index c0f2eb322b..c3371aa2a7 100644 --- a/platform/darwin/src/MGLLineStyleLayer.h +++ b/platform/darwin/src/MGLLineStyleLayer.h @@ -87,6 +87,8 @@ typedef NS_ENUM(NSUInteger, MGLLineTranslateAnchor) { 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 -- cgit v1.2.1 From 50ae3eb3c0985567a0f86d08337d7cb8bed79a6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Minh=20Nguy=E1=BB=85n?= Date: Wed, 4 Jan 2017 12:19:31 -0800 Subject: [ios, macos] Insert example code in original headers (#7569) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * [ios, macos] Removed extraneous code fences * [ios] Streamlined example delimiters Use test method names as names of example blocks and test method documentation comments as front matter for examples. Set off example blocks using a syntax similar to playground markup syntax. Avoid hard-coding indentation levels. Trigger Xcode build error when an error occurs in the script. * [ios] Removed platform-specific code from examples * [ios] Fixed logic error The comment said 200 while the code said 1,500. * [ios] Formalize build phase input * [ios] Insert examples into original source documentation Rewrote the example code insertion script to work on the original source files and overwrite any existing code examples on the same symbols. The script uses SourceKitten to find the documentation comment for the symbol named by the test method. Replaced the Run Script build phase that runs the example code insertion script with a make rule that runs the same script. Inlined skeleton examples minus the contents of the code blocks. * [ios] Fixed syntax error * [ios] Ran ios-add-examples-to-docs * [ios] Avoid touching unchanged headers * [ios] Refactored example insertion script * [ios] Point jazzy at original sources * [ios] Invoke SourceKitten only once * [ios] Look for methods as well as properties * [ios] Thoroughly search for code blocks in doc comments Refactored the example code insertion script to index test methods by their names, then recursively search the SourceKitten output for documentation comments that contain Swift code blocks, replacing each code block with the associated test method body. * [ios, macos] Enabled example insertion for macOS The example code insertion script is now platform-agnostic. * [ios, macos] Fixed documentation example tests Set the map view’s style to a minimal local JSON file. Wait for the style to finish loading before running each test. Corrected CGVector type. * [ios, macos] Dry run mode The output of this mode isn’t a good indicator of whether any files would’ve needed to be changed, because the presence of a conditional compilation block in one of the test methods means this script would always change and revert the corresponding comment. * [ios] Fixed test failure The iOS implementation of MGLMapView tries to show the Streets style by default even if no access token has been set. Avoid a race condition and frequent test failure by specifying the minimal style on initialization. * [ios, macos] Ensure SourceKitten is installed before inserting example code * [ios, macos] Tear down map view after each test Keep map views from previous tests from hanging around, potentially obscuring the result of a subsequent test. Set the access token to a bogus token upfront for all style layer tests. Unified MGLStyle usage within MGLStyleTests. * [ios, macos] Reinsert examples after generating runtime styling headers --- platform/darwin/src/MGLLineStyleLayer.h | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'platform/darwin/src/MGLLineStyleLayer.h') diff --git a/platform/darwin/src/MGLLineStyleLayer.h b/platform/darwin/src/MGLLineStyleLayer.h index c3371aa2a7..f049ae1db1 100644 --- a/platform/darwin/src/MGLLineStyleLayer.h +++ b/platform/darwin/src/MGLLineStyleLayer.h @@ -87,8 +87,21 @@ typedef NS_ENUM(NSUInteger, MGLLineTranslateAnchor) { 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:]`. - - + + ### Example + + ```swift + let layer = MGLLineStyleLayer(identifier: "trails-path", source: trails) + layer.sourceLayerIdentifier = "trails" + layer.lineWidth = MGLStyleValue(interpolationBase: 1.5, stops: [ + 14: MGLStyleValue(rawValue: 2), + 18: MGLStyleValue(rawValue: 20), + ]) + layer.lineColor = MGLStyleValue(rawValue: .brown) + layer.lineCap = MGLStyleValue(rawValue: NSValue(mglLineCap: .round)) + layer.predicate = NSPredicate(format: "%K == %@", "trail-type", "mountain-biking") + mapView.style.addLayer(layer) + ``` */ @interface MGLLineStyleLayer : MGLVectorStyleLayer -- cgit v1.2.1 From d5d6bcee0f2f11cfccb3cc8ee7bc90c4f0ac74e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Minh=20Nguye=CC=82=CC=83n?= Date: Tue, 3 Jan 2017 01:42:15 -0800 Subject: [ios, macos] Keep style attribute NSValue categories near enum declarations Eliminated the separate NSValue+MGLStyleLayerAddition files, moving the categories into their respective style layer headers to be closer to the enumeration declarations. --- platform/darwin/src/MGLLineStyleLayer.h | 49 +++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) (limited to 'platform/darwin/src/MGLLineStyleLayer.h') diff --git a/platform/darwin/src/MGLLineStyleLayer.h b/platform/darwin/src/MGLLineStyleLayer.h index f049ae1db1..72629c4d0e 100644 --- a/platform/darwin/src/MGLLineStyleLayer.h +++ b/platform/darwin/src/MGLLineStyleLayer.h @@ -286,4 +286,53 @@ typedef NS_ENUM(NSUInteger, MGLLineTranslateAnchor) { @end +/** + Methods for wrapping an enumeration value for a style layer attribute in an + `MGLLineStyleLayer` object and unwrapping its raw value. + */ +@interface NSValue (MGLLineStyleLayerAdditions) + +#pragma mark Working with Line Style Layer Attribute Values + +/** + Creates a new value object containing the given `MGLLineCap` enumeration. + + @param lineCap The value for the new object. + @return A new value object that contains the enumeration value. + */ ++ (instancetype)valueWithMGLLineCap:(MGLLineCap)lineCap; + +/** + The `MGLLineCap` enumeration representation of the value. + */ +@property (readonly) MGLLineCap MGLLineCapValue; + +/** + Creates a new value object containing the given `MGLLineJoin` enumeration. + + @param lineJoin The value for the new object. + @return A new value object that contains the enumeration value. + */ ++ (instancetype)valueWithMGLLineJoin:(MGLLineJoin)lineJoin; + +/** + The `MGLLineJoin` enumeration representation of the value. + */ +@property (readonly) MGLLineJoin MGLLineJoinValue; + +/** + Creates a new value object containing the given `MGLLineTranslateAnchor` enumeration. + + @param lineTranslateAnchor The value for the new object. + @return A new value object that contains the enumeration value. + */ ++ (instancetype)valueWithMGLLineTranslateAnchor:(MGLLineTranslateAnchor)lineTranslateAnchor; + +/** + The `MGLLineTranslateAnchor` enumeration representation of the value. + */ +@property (readonly) MGLLineTranslateAnchor MGLLineTranslateAnchorValue; + +@end + NS_ASSUME_NONNULL_END -- cgit v1.2.1 From bf8d037fca3a5e76818f2cd546e783814f046019 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Minh=20Nguy=E1=BB=85n?= Date: Fri, 6 Jan 2017 12:29:03 -0800 Subject: =?UTF-8?q?[ios,=20macos]=20-translate=20=E2=86=92=20-translation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- platform/darwin/src/MGLLineStyleLayer.h | 38 ++++++++++++++++++++++----------- 1 file changed, 25 insertions(+), 13 deletions(-) (limited to 'platform/darwin/src/MGLLineStyleLayer.h') diff --git a/platform/darwin/src/MGLLineStyleLayer.h b/platform/darwin/src/MGLLineStyleLayer.h index 72629c4d0e..75a71a3923 100644 --- a/platform/darwin/src/MGLLineStyleLayer.h +++ b/platform/darwin/src/MGLLineStyleLayer.h @@ -59,18 +59,18 @@ typedef NS_ENUM(NSUInteger, MGLLineJoin) { /** Controls the translation reference point. - Values of this type are used in the `MGLLineStyleLayer.lineTranslateAnchor` + Values of this type are used in the `MGLLineStyleLayer.lineTranslationAnchor` property. */ -typedef NS_ENUM(NSUInteger, MGLLineTranslateAnchor) { +typedef NS_ENUM(NSUInteger, MGLLineTranslationAnchor) { /** The line is translated relative to the map. */ - MGLLineTranslateAnchorMap, + MGLLineTranslationAnchorMap, /** The line is translated relative to the viewport. */ - MGLLineTranslateAnchorViewport, + MGLLineTranslationAnchorViewport, }; /** @@ -258,20 +258,32 @@ typedef NS_ENUM(NSUInteger, MGLLineTranslateAnchor) { `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. + + This attribute corresponds to the line-translate + layout property in the Mapbox Style Specification. */ -@property (nonatomic, null_resettable) MGLStyleValue *lineTranslate; +@property (nonatomic, null_resettable) MGLStyleValue *lineTranslation; + +@property (nonatomic, null_resettable) MGLStyleValue *lineTranslate __attribute__((unavailable("Use lineTranslation instead."))); /** 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 + `NSValue` object containing `MGLLineTranslationAnchorMap`. 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`. + This property is only applied to the style if `lineTranslation` is non-`nil`. Otherwise, it is ignored. + + This attribute corresponds to the line-translate-anchor + layout property in the Mapbox Style Specification. */ -@property (nonatomic, null_resettable) MGLStyleValue *lineTranslateAnchor; +@property (nonatomic, null_resettable) MGLStyleValue *lineTranslationAnchor; + +@property (nonatomic, null_resettable) MGLStyleValue *lineTranslateAnchor __attribute__((unavailable("Use lineTranslationAnchor instead."))); /** Stroke thickness. @@ -321,17 +333,17 @@ typedef NS_ENUM(NSUInteger, MGLLineTranslateAnchor) { @property (readonly) MGLLineJoin MGLLineJoinValue; /** - Creates a new value object containing the given `MGLLineTranslateAnchor` enumeration. + Creates a new value object containing the given `MGLLineTranslationAnchor` enumeration. - @param lineTranslateAnchor The value for the new object. + @param lineTranslationAnchor The value for the new object. @return A new value object that contains the enumeration value. */ -+ (instancetype)valueWithMGLLineTranslateAnchor:(MGLLineTranslateAnchor)lineTranslateAnchor; ++ (instancetype)valueWithMGLLineTranslationAnchor:(MGLLineTranslationAnchor)lineTranslationAnchor; /** - The `MGLLineTranslateAnchor` enumeration representation of the value. + The `MGLLineTranslationAnchor` enumeration representation of the value. */ -@property (readonly) MGLLineTranslateAnchor MGLLineTranslateAnchorValue; +@property (readonly) MGLLineTranslationAnchor MGLLineTranslationAnchorValue; @end -- cgit v1.2.1 From d3a2ffe747550216b19d678c40980231baeeef11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Minh=20Nguye=CC=82=CC=83n?= Date: Sat, 7 Jan 2017 15:54:08 -0800 Subject: [ios, macos] Fixed links to paint properties in style spec --- platform/darwin/src/MGLLineStyleLayer.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'platform/darwin/src/MGLLineStyleLayer.h') diff --git a/platform/darwin/src/MGLLineStyleLayer.h b/platform/darwin/src/MGLLineStyleLayer.h index 75a71a3923..f25acecf97 100644 --- a/platform/darwin/src/MGLLineStyleLayer.h +++ b/platform/darwin/src/MGLLineStyleLayer.h @@ -201,7 +201,7 @@ typedef NS_ENUM(NSUInteger, MGLLineTranslationAnchor) { Otherwise, it is ignored. This attribute corresponds to the line-dasharray + href="https://www.mapbox.com/mapbox-gl-style-spec/#paint-line-dasharray">line-dasharray layout property in the Mapbox Style Specification. */ @property (nonatomic, null_resettable) MGLStyleValue *> *lineDashPattern; @@ -260,7 +260,7 @@ typedef NS_ENUM(NSUInteger, MGLLineTranslationAnchor) { default value. This attribute corresponds to the line-translate + href="https://www.mapbox.com/mapbox-gl-style-spec/#paint-line-translate">line-translate layout property in the Mapbox Style Specification. */ @property (nonatomic, null_resettable) MGLStyleValue *lineTranslation; @@ -278,7 +278,7 @@ typedef NS_ENUM(NSUInteger, MGLLineTranslationAnchor) { Otherwise, it is ignored. This attribute corresponds to the line-translate-anchor + href="https://www.mapbox.com/mapbox-gl-style-spec/#paint-line-translate-anchor">line-translate-anchor layout property in the Mapbox Style Specification. */ @property (nonatomic, null_resettable) MGLStyleValue *lineTranslationAnchor; -- cgit v1.2.1 From e0f98704061f6e1b3b078da468baea37851391b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Minh=20Nguye=CC=82=CC=83n?= Date: Sun, 8 Jan 2017 17:10:44 -0800 Subject: [macos] Flip offsets and translations The screen origin is at the lower-left, so offsets and translations increase rightwards and upwards, in contrast to iOS and Web contexts, where the coordinate system increases rightwards and downwards. Duplicated style layer property declarations to reflect this difference. --- platform/darwin/src/MGLLineStyleLayer.h | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) (limited to 'platform/darwin/src/MGLLineStyleLayer.h') diff --git a/platform/darwin/src/MGLLineStyleLayer.h b/platform/darwin/src/MGLLineStyleLayer.h index f25acecf97..99bbaab52d 100644 --- a/platform/darwin/src/MGLLineStyleLayer.h +++ b/platform/darwin/src/MGLLineStyleLayer.h @@ -249,21 +249,37 @@ typedef NS_ENUM(NSUInteger, MGLLineTranslationAnchor) { */ @property (nonatomic, null_resettable) MGLStyleValue *linePattern; +#if TARGET_OS_IPHONE /** 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. + `NSValue` object containing a `CGVector` struct set to 0 points rightward and 0 + points downward. Set this property to `nil` to reset it to the default value. This attribute corresponds to the line-translate layout property in the Mapbox Style Specification. */ @property (nonatomic, null_resettable) MGLStyleValue *lineTranslation; +#else +/** + 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 rightward and 0 + points upward. Set this property to `nil` to reset it to the default value. + + This attribute corresponds to the line-translate + layout property in the Mapbox Style Specification. + */ +@property (nonatomic, null_resettable) MGLStyleValue *lineTranslation; +#endif @property (nonatomic, null_resettable) MGLStyleValue *lineTranslate __attribute__((unavailable("Use lineTranslation instead."))); -- cgit v1.2.1 From a4c44c51585fe1df8e8b38bf5b7b6a611b4ce986 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Minh=20Nguye=CC=82=CC=83n?= Date: Sun, 8 Jan 2017 17:30:09 -0800 Subject: [ios, macos] Cleaned up color, edge insets declarations, comments Eliminated references to MGLColor within style layer headers. --- platform/darwin/src/MGLLineStyleLayer.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'platform/darwin/src/MGLLineStyleLayer.h') diff --git a/platform/darwin/src/MGLLineStyleLayer.h b/platform/darwin/src/MGLLineStyleLayer.h index 99bbaab52d..a9f1b4c866 100644 --- a/platform/darwin/src/MGLLineStyleLayer.h +++ b/platform/darwin/src/MGLLineStyleLayer.h @@ -175,7 +175,7 @@ typedef NS_ENUM(NSUInteger, MGLLineTranslationAnchor) { This property is only applied to the style if `linePattern` is set to `nil`. Otherwise, it is ignored. */ -@property (nonatomic, null_resettable) MGLStyleValue *lineColor; +@property (nonatomic, null_resettable) MGLStyleValue *lineColor; #else /** The color with which the line will be drawn. @@ -187,7 +187,7 @@ typedef NS_ENUM(NSUInteger, MGLLineTranslationAnchor) { This property is only applied to the style if `linePattern` is set to `nil`. Otherwise, it is ignored. */ -@property (nonatomic, null_resettable) MGLStyleValue *lineColor; +@property (nonatomic, null_resettable) MGLStyleValue *lineColor; #endif /** -- cgit v1.2.1 From 424c12499cab69b935779d306d7d47d19139116e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Minh=20Nguy=E1=BB=85n?= Date: Wed, 11 Jan 2017 08:06:20 -0800 Subject: [ios, macos] Make MGLMapView.style property nullable (#7664) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * [ios, macos] Made MGLMapView.style property nullable MGLMapView’s style property is now nullable (optional in Swift). The property is set to nil while the style loads and in the event that the style has failed to load. * [ios, macos] Switch to delegate method * [macos] Create MGLMapView programmatically for layer tests When MGLMapView is created via a nib, -initWithCoder: is called, causing styleURL to be set to nil, in turn causing the default Streets style to be loaded, fooling MGLStyleLayerTests into thinking one-line has been loaded. Instead, create MGLMapView programmatically, passing the intended style URL into the initializer, preventing Streets from being loaded. --- platform/darwin/src/MGLLineStyleLayer.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'platform/darwin/src/MGLLineStyleLayer.h') diff --git a/platform/darwin/src/MGLLineStyleLayer.h b/platform/darwin/src/MGLLineStyleLayer.h index a9f1b4c866..9b37a97460 100644 --- a/platform/darwin/src/MGLLineStyleLayer.h +++ b/platform/darwin/src/MGLLineStyleLayer.h @@ -100,7 +100,7 @@ typedef NS_ENUM(NSUInteger, MGLLineTranslationAnchor) { layer.lineColor = MGLStyleValue(rawValue: .brown) layer.lineCap = MGLStyleValue(rawValue: NSValue(mglLineCap: .round)) layer.predicate = NSPredicate(format: "%K == %@", "trail-type", "mountain-biking") - mapView.style.addLayer(layer) + mapView.style?.addLayer(layer) ``` */ @interface MGLLineStyleLayer : MGLVectorStyleLayer -- cgit v1.2.1