summaryrefslogtreecommitdiff
path: root/platform/darwin/src/MGLSymbolStyleLayer.h
diff options
context:
space:
mode:
authorFredrik Karlsson <bjorn.fredrik.karlsson@gmail.com>2016-08-11 13:14:45 -0400
committerGitHub <noreply@github.com>2016-08-11 13:14:45 -0400
commit2354c87411ce88c581e02f93445a66a2158bd7b0 (patch)
treea7deb9a3b1b0f24e2a876dedc13fbd1c6b22947e /platform/darwin/src/MGLSymbolStyleLayer.h
parentb0cb8715ed74678b4d0f05829fa71a590e41b2f6 (diff)
downloadqtlocation-mapboxgl-2354c87411ce88c581e02f93445a66a2158bd7b0.tar.gz
Runtime styling API for iOS/macOS (#5727)
* [ios] wip runtime styling * [ios, macos] Outlined header templates * [ios, macos] cleanup and use appropiate data types * [ios, macos] removed refs to mbgl and added convenient color methods on UIColor and NSColor * [ios, macos] updated header template, included doc string * [ios, macos] outlined template for layer implementation files * [ios, macos] moved script to platform/darwin and updated comments * [ios, macos] Cleaned up the implementation template * [ios, macos] removed unused function and added support for more datatypes * [ios, macos] overhauling the type protocols * [ios, macos] removed unnecessary style classes * [ios, macos] added support for more types * [ios, macos] fixed string and number prop values * [ios, macos] enum getters * [ios, macos] added removeLayer() and removed unused layer ref * [ios, macos] fixed remaining layer types and converted style layer into a protocol * [ios, macos] fixed addLayer() and added example for line layer * [ios] GeoJSON source now works * [ios] fixed raster layer and raster source * [ios] fixed attr prop number and outlined prop function * [ios] wip functions * [ios] bool and float function fix * [ios] cleanup * [macos] fixed support for macos * [ios] fixed string functions * [ios] extended array functions * [ios] added tests and fixed a few bugs * [ios] less verbose functions and improved tests * [ios, macos] Removed unnecessary use of default arguments Default arguments aren’t supported in Node v4, and they aren’t needed here anyways, because we’re only testing for truthiness. * [ios, macos] Enum setters Rely on a macro instead of category methods to specialize the setter implementation for enum attributes, since generic types are disallowed in Objective-C method signatures and mbgl::style::PropertyType must be type-qualified. * [ios, macos] Got macOS closer to parity w/ iOS Added various classes and test classes to the macOS workspace. Also fixed lots of compiler errors and updated macosapp runtime styling example to use the new dictionary syntax for function stops. Updated all conversions from Objective-C stops to C++ stops to enumerate over the dictionary. Fixed compiler errors in enum setter implementations. Also corrected path to script in generated file comments. * [ios, macos] Added EJS templates to project * [ios, macos] Code formatting Made code format more consistent. * [ios, macos] Spelled out ID Cocoa convention is to always spell out “ID” as “identifier”, in part to avoid confusion with the id keyword. Also, URL is capitalized in most contexts, including property names. * [ios, macos] Grouped related headers together * [ios, macos] Cleaned up layer transformation Also added support for converting background layers into Objective-C. * [ios, macos] Cleaned up tests Also made the tests work on macOS by introducing a new window to host the map. * [ios, macos] Replaced TODOs with #warnings * [ios] convert array based property values * [ios, macos] color function/undefined getter * [ios, macos] fixed function/undefined getters for bool and float properties * [ios, macos] more function/undefined property getters * [ios, macos] more type conversion and cleanup * [ios, macos] disable macos runtime styling tests for now * [ios, macos] cleaned up style code script * [ios, macos] more type conversion * [ios] added a base layer to handle visibility min/max zoom * [macos] fixed base layer * [ios, macos] use accessor methods * [ios, macos] cleanup * [ios, macos] add geojson to ios and macos * [macos] rebase fix * [ios, macos] fixed enum getters and added tests for enums * [ios, macos] added an update method to base layer * [ios, macos] added some documentation * [ios, macos] docs * [ios, macos] removed refs to filters for now * [ios, macos] various tail work * [ios, macos] missing import and incorrect type
Diffstat (limited to 'platform/darwin/src/MGLSymbolStyleLayer.h')
-rw-r--r--platform/darwin/src/MGLSymbolStyleLayer.h315
1 files changed, 315 insertions, 0 deletions
diff --git a/platform/darwin/src/MGLSymbolStyleLayer.h b/platform/darwin/src/MGLSymbolStyleLayer.h
new file mode 100644
index 0000000000..1f3568890b
--- /dev/null
+++ b/platform/darwin/src/MGLSymbolStyleLayer.h
@@ -0,0 +1,315 @@
+// This file is generated.
+// Edit platform/darwin/scripts/generate-style-code.js, then run `make style-code-darwin`.
+
+#import "MGLTypes.h"
+#import "MGLStyleAttributeValue.h"
+#import "MGLBaseStyleLayer.h"
+
+typedef NS_ENUM(NSUInteger, MGLSymbolStyleLayerSymbolPlacement) {
+ MGLSymbolStyleLayerSymbolPlacementPoint,
+ MGLSymbolStyleLayerSymbolPlacementLine,
+};
+
+typedef NS_ENUM(NSUInteger, MGLSymbolStyleLayerIconRotationAlignment) {
+ MGLSymbolStyleLayerIconRotationAlignmentMap,
+ MGLSymbolStyleLayerIconRotationAlignmentViewport,
+};
+
+typedef NS_ENUM(NSUInteger, MGLSymbolStyleLayerIconTextFit) {
+ MGLSymbolStyleLayerIconTextFitNone,
+ MGLSymbolStyleLayerIconTextFitBoth,
+ MGLSymbolStyleLayerIconTextFitWidth,
+ MGLSymbolStyleLayerIconTextFitHeight,
+};
+
+typedef NS_ENUM(NSUInteger, MGLSymbolStyleLayerTextPitchAlignment) {
+ MGLSymbolStyleLayerTextPitchAlignmentMap,
+ MGLSymbolStyleLayerTextPitchAlignmentViewport,
+};
+
+typedef NS_ENUM(NSUInteger, MGLSymbolStyleLayerTextRotationAlignment) {
+ MGLSymbolStyleLayerTextRotationAlignmentMap,
+ MGLSymbolStyleLayerTextRotationAlignmentViewport,
+};
+
+typedef NS_ENUM(NSUInteger, MGLSymbolStyleLayerTextJustify) {
+ MGLSymbolStyleLayerTextJustifyLeft,
+ MGLSymbolStyleLayerTextJustifyCenter,
+ MGLSymbolStyleLayerTextJustifyRight,
+};
+
+typedef NS_ENUM(NSUInteger, MGLSymbolStyleLayerTextAnchor) {
+ MGLSymbolStyleLayerTextAnchorCenter,
+ MGLSymbolStyleLayerTextAnchorLeft,
+ MGLSymbolStyleLayerTextAnchorRight,
+ MGLSymbolStyleLayerTextAnchorTop,
+ MGLSymbolStyleLayerTextAnchorBottom,
+ MGLSymbolStyleLayerTextAnchorTopLeft,
+ MGLSymbolStyleLayerTextAnchorTopRight,
+ MGLSymbolStyleLayerTextAnchorBottomLeft,
+ MGLSymbolStyleLayerTextAnchorBottomRight,
+};
+
+typedef NS_ENUM(NSUInteger, MGLSymbolStyleLayerTextTransform) {
+ MGLSymbolStyleLayerTextTransformNone,
+ MGLSymbolStyleLayerTextTransformUppercase,
+ MGLSymbolStyleLayerTextTransformLowercase,
+};
+
+typedef NS_ENUM(NSUInteger, MGLSymbolStyleLayerIconTranslateAnchor) {
+ MGLSymbolStyleLayerIconTranslateAnchorMap,
+ MGLSymbolStyleLayerIconTranslateAnchorViewport,
+};
+
+typedef NS_ENUM(NSUInteger, MGLSymbolStyleLayerTextTranslateAnchor) {
+ MGLSymbolStyleLayerTextTranslateAnchorMap,
+ MGLSymbolStyleLayerTextTranslateAnchorViewport,
+};
+
+@interface MGLSymbolStyleLayer : MGLBaseStyleLayer <MGLStyleLayer>
+
+#pragma mark - Accessing the Layout Attributes
+
+/**
+ Label placement relative to its geometry. `line` can only be used on LineStrings and Polygons.
+ */
+@property (nonatomic) id <MGLStyleAttributeValue> symbolPlacement;
+
+/**
+ Distance between two symbol anchors.
+ */
+@property (nonatomic) id <MGLStyleAttributeValue> symbolSpacing;
+
+/**
+ If true, the symbols will not cross tile edges to avoid mutual collisions. Recommended in layers that don't have enough padding in the vector tile to prevent collisions, or if it is a point symbol layer placed after a line symbol layer.
+ */
+@property (nonatomic) id <MGLStyleAttributeValue> symbolAvoidEdges;
+
+/**
+ If true, the icon will be visible even if it collides with other previously drawn symbols.
+ */
+@property (nonatomic) id <MGLStyleAttributeValue> iconAllowOverlap;
+
+/**
+ If true, other symbols can be visible even if they collide with the icon.
+ */
+@property (nonatomic) id <MGLStyleAttributeValue> iconIgnorePlacement;
+
+/**
+ If true, text will display without their corresponding icons when the icon collides with other symbols and the text does not.
+ */
+@property (nonatomic) id <MGLStyleAttributeValue> iconOptional;
+
+/**
+ Orientation of icon when map is rotated.
+ */
+@property (nonatomic) id <MGLStyleAttributeValue> iconRotationAlignment;
+
+/**
+ Scale factor for icon. 1 is original size, 3 triples the size.
+ */
+@property (nonatomic) id <MGLStyleAttributeValue> iconSize;
+
+/**
+ Position and scale an icon by the its corresponding text.
+ */
+@property (nonatomic) id <MGLStyleAttributeValue> iconTextFit;
+
+/**
+ Size of padding area around the text-fit size in clockwise order: top, right, bottom, left.
+ */
+@property (nonatomic) id <MGLStyleAttributeValue> iconTextFitPadding;
+
+/**
+ A string with {tokens} replaced, referencing the data property to pull from.
+ */
+@property (nonatomic) id <MGLStyleAttributeValue> iconImage;
+
+/**
+ Rotates the icon clockwise.
+ */
+@property (nonatomic) id <MGLStyleAttributeValue> iconRotate;
+
+/**
+ Size of the additional area around the icon bounding box used for detecting symbol collisions.
+ */
+@property (nonatomic) id <MGLStyleAttributeValue> iconPadding;
+
+/**
+ If true, the icon may be flipped to prevent it from being rendered upside-down.
+ */
+@property (nonatomic) id <MGLStyleAttributeValue> iconKeepUpright;
+
+/**
+ Offset distance of icon from its anchor. Positive values indicate right and down, while negative values indicate left and up.
+ */
+@property (nonatomic) id <MGLStyleAttributeValue> iconOffset;
+
+/**
+ Aligns text to the plane of the `viewport` or the `map` when the map is pitched. Matches `text-rotation-alignment` if unspecified.
+ */
+@property (nonatomic) id <MGLStyleAttributeValue> textPitchAlignment;
+
+/**
+ Orientation of text when map is rotated.
+ */
+@property (nonatomic) id <MGLStyleAttributeValue> textRotationAlignment;
+
+/**
+ Value to use for a text label. Feature properties are specified using tokens like {field_name}.
+ */
+@property (nonatomic) id <MGLStyleAttributeValue> textField;
+
+/**
+ Font stack to use for displaying text.
+ */
+@property (nonatomic) id <MGLStyleAttributeValue> textFont;
+
+/**
+ Font size.
+ */
+@property (nonatomic) id <MGLStyleAttributeValue> textSize;
+
+/**
+ The maximum line width for text wrapping.
+ */
+@property (nonatomic) id <MGLStyleAttributeValue> textMaxWidth;
+
+/**
+ Text leading value for multi-line text.
+ */
+@property (nonatomic) id <MGLStyleAttributeValue> textLineHeight;
+
+/**
+ Text tracking amount.
+ */
+@property (nonatomic) id <MGLStyleAttributeValue> textLetterSpacing;
+
+/**
+ Text justification options.
+ */
+@property (nonatomic) id <MGLStyleAttributeValue> textJustify;
+
+/**
+ Part of the text placed closest to the anchor.
+ */
+@property (nonatomic) id <MGLStyleAttributeValue> textAnchor;
+
+/**
+ Maximum angle change between adjacent characters.
+ */
+@property (nonatomic) id <MGLStyleAttributeValue> textMaxAngle;
+
+/**
+ Rotates the text clockwise.
+ */
+@property (nonatomic) id <MGLStyleAttributeValue> textRotate;
+
+/**
+ Size of the additional area around the text bounding box used for detecting symbol collisions.
+ */
+@property (nonatomic) id <MGLStyleAttributeValue> textPadding;
+
+/**
+ If true, the text may be flipped vertically to prevent it from being rendered upside-down.
+ */
+@property (nonatomic) id <MGLStyleAttributeValue> textKeepUpright;
+
+/**
+ Specifies how to capitalize text, similar to the CSS `text-transform` property.
+ */
+@property (nonatomic) id <MGLStyleAttributeValue> textTransform;
+
+/**
+ Offset distance of text from its anchor. Positive values indicate right and down, while negative values indicate left and up.
+ */
+@property (nonatomic) id <MGLStyleAttributeValue> textOffset;
+
+/**
+ If true, the text will be visible even if it collides with other previously drawn symbols.
+ */
+@property (nonatomic) id <MGLStyleAttributeValue> textAllowOverlap;
+
+/**
+ If true, other symbols can be visible even if they collide with the text.
+ */
+@property (nonatomic) id <MGLStyleAttributeValue> textIgnorePlacement;
+
+/**
+ If true, icons will display without their corresponding text when the text collides with other symbols and the icon does not.
+ */
+@property (nonatomic) id <MGLStyleAttributeValue> textOptional;
+
+#pragma mark - Accessing the Paint Attributes
+
+/**
+ The opacity at which the icon will be drawn.
+ */
+@property (nonatomic) id <MGLStyleAttributeValue> iconOpacity;
+
+/**
+ The color of the icon. This can only be used with sdf icons.
+ */
+@property (nonatomic) id <MGLStyleAttributeValue> iconColor;
+
+/**
+ The color of the icon's halo. Icon halos can only be used with sdf icons.
+ */
+@property (nonatomic) id <MGLStyleAttributeValue> iconHaloColor;
+
+/**
+ Distance of halo to the icon outline.
+ */
+@property (nonatomic) id <MGLStyleAttributeValue> iconHaloWidth;
+
+/**
+ Fade out the halo towards the outside.
+ */
+@property (nonatomic) id <MGLStyleAttributeValue> iconHaloBlur;
+
+/**
+ Distance that the icon's anchor is moved from its original placement. Positive values indicate right and down, while negative values indicate left and up.
+ */
+@property (nonatomic) id <MGLStyleAttributeValue> iconTranslate;
+
+/**
+ Control whether the translation is relative to the map (north) or viewport (screen).
+ */
+@property (nonatomic) id <MGLStyleAttributeValue> iconTranslateAnchor;
+
+/**
+ The opacity at which the text will be drawn.
+ */
+@property (nonatomic) id <MGLStyleAttributeValue> textOpacity;
+
+/**
+ The color with which the text will be drawn.
+ */
+@property (nonatomic) id <MGLStyleAttributeValue> textColor;
+
+/**
+ The color of the text's halo, which helps it stand out from backgrounds.
+ */
+@property (nonatomic) id <MGLStyleAttributeValue> textHaloColor;
+
+/**
+ Distance of halo to the font outline. Max text halo width is 1/4 of the font-size.
+ */
+@property (nonatomic) id <MGLStyleAttributeValue> textHaloWidth;
+
+/**
+ The halo's fadeout distance towards the outside.
+ */
+@property (nonatomic) id <MGLStyleAttributeValue> textHaloBlur;
+
+/**
+ Distance that the text's anchor is moved from its original placement. Positive values indicate right and down, while negative values indicate left and up.
+ */
+@property (nonatomic) id <MGLStyleAttributeValue> textTranslate;
+
+/**
+ Control whether the translation is relative to the map (north) or viewport (screen).
+ */
+@property (nonatomic) id <MGLStyleAttributeValue> textTranslateAnchor;
+
+@end