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

update style generation code for new style spec enum values docs #6508

Merged
merged 16 commits into from
Sep 30, 2016
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"ejs": "^2.4.1",
"express": "^4.11.1",
"mapbox-gl-shaders": "mapbox/mapbox-gl-shaders#de2ab007455aa2587c552694c68583f94c9f2747",
"mapbox-gl-style-spec": "mapbox/mapbox-gl-style-spec#23155c0f34e1e6833ca772dc8b19111ee6cd40e9",
"mapbox-gl-style-spec": "mapbox/mapbox-gl-style-spec#cc63f58948abdf659012b7014ad7187e7e484d83",
"mapbox-gl-test-suite": "mapbox/mapbox-gl-test-suite#694f0d0728f229d64d1639dc5ee7aff7f4b8ca41",
"mkdirp": "^0.5.1",
"node-cmake": "^1.2.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ public PropertyValue<String> getFillColor() {
return (PropertyValue<String>) new PropertyValue(nativeGetFillColor());
}
/**
Copy link
Contributor

Choose a reason for hiding this comment

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

Some funky indentation going on here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Think I got this in caeee4f.

* The color of the filled part of this layer. This color can be specified as rgba with an alpha component and the color's opacity will not affect the opacity of the 1px stroke, if it is used.
* The color of the filled part of this layer. This color can be specified as `rgba` with an alpha component and the color's opacity will not affect the opacity of the 1px stroke, if it is used.
*
* @return int representation of a rgba string color
* @throws RuntimeException thrown if property isn't a value
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,15 @@ public abstract class Property<T> {

//icon-text-fit
public static final String ICON_TEXT_FIT_NONE = "none";
public static final String ICON_TEXT_FIT_BOTH = "both";
public static final String ICON_TEXT_FIT_WIDTH = "width";
public static final String ICON_TEXT_FIT_HEIGHT = "height";
public static final String ICON_TEXT_FIT_BOTH = "both";

@StringDef({
ICON_TEXT_FIT_NONE,
ICON_TEXT_FIT_BOTH,
ICON_TEXT_FIT_WIDTH,
ICON_TEXT_FIT_HEIGHT,
ICON_TEXT_FIT_BOTH,
})
@Retention(RetentionPolicy.SOURCE)
public @interface ICON_TEXT_FIT {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public static Property<Function<Boolean>> fillAntialias(Function<Boolean> functi
}

/**
* The opacity of the entire fill layer. In contrast to the fill-color, this value will also affect the 1px stroke around the fill, if the stroke is used.
* The opacity of the entire fill layer. In contrast to the `fill-color`, this value will also affect the 1px stroke around the fill, if the stroke is used.
*
* @param value a Float value
* @return property wrapper around Float
Expand All @@ -62,7 +62,7 @@ public static Property<Float> fillOpacity(Float value) {
}

/**
* The opacity of the entire fill layer. In contrast to the fill-color, this value will also affect the 1px stroke around the fill, if the stroke is used.
* The opacity of the entire fill layer. In contrast to the `fill-color`, this value will also affect the 1px stroke around the fill, if the stroke is used.
*
* @param function a wrapper function for Float
* @return property wrapper around a Float function
Expand All @@ -72,7 +72,7 @@ public static Property<Function<Float>> fillOpacity(Function<Float> function) {
}

/**
* The color of the filled part of this layer. This color can be specified as rgba with an alpha component and the color's opacity will not affect the opacity of the 1px stroke, if it is used.
* The color of the filled part of this layer. This color can be specified as `rgba` with an alpha component and the color's opacity will not affect the opacity of the 1px stroke, if it is used.
*
* @param value a int color value
* @return property wrapper around String color
Expand All @@ -82,7 +82,7 @@ public static Property<String> fillColor(@ColorInt int value) {
}

/**
* The color of the filled part of this layer. This color can be specified as rgba with an alpha component and the color's opacity will not affect the opacity of the 1px stroke, if it is used.
* The color of the filled part of this layer. This color can be specified as `rgba` with an alpha component and the color's opacity will not affect the opacity of the 1px stroke, if it is used.
*
* @param value a String value
* @return property wrapper around String
Expand All @@ -92,7 +92,7 @@ public static Property<String> fillColor(String value) {
}

/**
* The color of the filled part of this layer. This color can be specified as rgba with an alpha component and the color's opacity will not affect the opacity of the 1px stroke, if it is used.
* The color of the filled part of this layer. This color can be specified as `rgba` with an alpha component and the color's opacity will not affect the opacity of the 1px stroke, if it is used.
*
* @param function a wrapper function for String
* @return property wrapper around a String function
Expand Down Expand Up @@ -152,7 +152,7 @@ public static Property<Function<Float[]>> fillTranslate(Function<Float[]> functi
}

/**
* Control whether the translation is relative to the map (north) or viewport (screen)
* Controls the translation reference point.
*
* @param value a String value
* @return property wrapper around String
Expand All @@ -162,7 +162,7 @@ public static Property<String> fillTranslateAnchor(@Property.FILL_TRANSLATE_ANCH
}

/**
* Control whether the translation is relative to the map (north) or viewport (screen)
* Controls the translation reference point.
*
* @param function a wrapper function for String
* @return property wrapper around a String function
Expand Down Expand Up @@ -262,7 +262,7 @@ public static Property<Function<Float[]>> lineTranslate(Function<Float[]> functi
}

/**
* Control whether the translation is relative to the map (north) or viewport (screen)
* Controls the translation reference point.
*
* @param value a String value
* @return property wrapper around String
Expand All @@ -272,7 +272,7 @@ public static Property<String> lineTranslateAnchor(@Property.LINE_TRANSLATE_ANCH
}

/**
* Control whether the translation is relative to the map (north) or viewport (screen)
* Controls the translation reference point.
*
* @param function a wrapper function for String
* @return property wrapper around a String function
Expand Down Expand Up @@ -452,7 +452,7 @@ public static Property<Function<String>> iconColor(Function<String> function) {
}

/**
* The color of the icon's halo. Icon halos can only be used with sdf icons.
* The color of the icon's halo. Icon halos can only be used with SDF icons.
*
* @param value a int color value
* @return property wrapper around String color
Expand All @@ -462,7 +462,7 @@ public static Property<String> iconHaloColor(@ColorInt int value) {
}

/**
* The color of the icon's halo. Icon halos can only be used with sdf icons.
* The color of the icon's halo. Icon halos can only be used with SDF icons.
*
* @param value a String value
* @return property wrapper around String
Expand All @@ -472,7 +472,7 @@ public static Property<String> iconHaloColor(String value) {
}

/**
* The color of the icon's halo. Icon halos can only be used with sdf icons.
* The color of the icon's halo. Icon halos can only be used with SDF icons.
*
* @param function a wrapper function for String
* @return property wrapper around a String function
Expand Down Expand Up @@ -542,7 +542,7 @@ public static Property<Function<Float[]>> iconTranslate(Function<Float[]> functi
}

/**
* Control whether the translation is relative to the map (north) or viewport (screen).
* Controls the translation reference point.
*
* @param value a String value
* @return property wrapper around String
Expand All @@ -552,7 +552,7 @@ public static Property<String> iconTranslateAnchor(@Property.ICON_TRANSLATE_ANCH
}

/**
* Control whether the translation is relative to the map (north) or viewport (screen).
* Controls the translation reference point.
*
* @param function a wrapper function for String
* @return property wrapper around a String function
Expand Down Expand Up @@ -702,7 +702,7 @@ public static Property<Function<Float[]>> textTranslate(Function<Float[]> functi
}

/**
* Control whether the translation is relative to the map (north) or viewport (screen).
* Controls the translation reference point.
*
* @param value a String value
* @return property wrapper around String
Expand All @@ -712,7 +712,7 @@ public static Property<String> textTranslateAnchor(@Property.TEXT_TRANSLATE_ANCH
}

/**
* Control whether the translation is relative to the map (north) or viewport (screen).
* Controls the translation reference point.
*
* @param function a wrapper function for String
* @return property wrapper around a String function
Expand Down Expand Up @@ -832,7 +832,7 @@ public static Property<Function<Float[]>> circleTranslate(Function<Float[]> func
}

/**
* Control whether the translation is relative to the map (north) or viewport (screen)
* Controls the translation reference point.
*
* @param value a String value
* @return property wrapper around String
Expand All @@ -842,7 +842,7 @@ public static Property<String> circleTranslateAnchor(@Property.CIRCLE_TRANSLATE_
}

/**
* Control whether the translation is relative to the map (north) or viewport (screen)
* Controls the translation reference point.
*
* @param function a wrapper function for String
* @return property wrapper around a String function
Expand All @@ -852,7 +852,7 @@ public static Property<Function<String>> circleTranslateAnchor(Function<String>
}

/**
* Controls the scaling behavior of the circle when the map is pitched. The value `map` scales circles according to their apparent distance to the camera. The value `viewport` results in no pitch-related scaling.
* Controls the scaling behavior of the circle when the map is pitched.
*
* @param value a String value
* @return property wrapper around String
Expand All @@ -862,7 +862,7 @@ public static Property<String> circlePitchScale(@Property.CIRCLE_PITCH_SCALE Str
}

/**
* Controls the scaling behavior of the circle when the map is pitched. The value `map` scales circles according to their apparent distance to the camera. The value `viewport` results in no pitch-related scaling.
* Controls the scaling behavior of the circle when the map is pitched.
*
* @param function a wrapper function for String
* @return property wrapper around a String function
Expand Down Expand Up @@ -1162,7 +1162,7 @@ public static Property<Function<Float>> lineRoundLimit(Function<Float> function)
}

/**
* Label placement relative to its geometry. `line` can only be used on LineStrings and Polygons.
* Label placement relative to its geometry.
*
* @param value a String value
* @return property wrapper around String
Expand All @@ -1172,7 +1172,7 @@ public static Property<String> symbolPlacement(@Property.SYMBOL_PLACEMENT String
}

/**
* Label placement relative to its geometry. `line` can only be used on LineStrings and Polygons.
* Label placement relative to its geometry.
*
* @param function a wrapper function for String
* @return property wrapper around a String function
Expand Down Expand Up @@ -1282,7 +1282,7 @@ public static Property<Function<Boolean>> iconOptional(Function<Boolean> functio
}

/**
* In combination with `symbol-placement`, determines the rotation behavior of icons. The value `viewport` produces icons whose x-axes are aligned with the x-axis of the viewport, regardless of the value of `symbol-placement`. When `symbol-placement` is set to `point`, the value `map` produces icons whose x-axes are aligned east-west, and the value `auto` is equivalent to `viewport`. When `symbol-placement` is set to `line`, the value `map` produces icons whose x-axes are aligned with the line, and the value `auto` is equivalent to `map`.
* In combination with `symbol-placement`, determines the rotation behavior of icons.
*
* @param value a String value
* @return property wrapper around String
Expand All @@ -1292,7 +1292,7 @@ public static Property<String> iconRotationAlignment(@Property.ICON_ROTATION_ALI
}

/**
* In combination with `symbol-placement`, determines the rotation behavior of icons. The value `viewport` produces icons whose x-axes are aligned with the x-axis of the viewport, regardless of the value of `symbol-placement`. When `symbol-placement` is set to `point`, the value `map` produces icons whose x-axes are aligned east-west, and the value `auto` is equivalent to `viewport`. When `symbol-placement` is set to `line`, the value `map` produces icons whose x-axes are aligned with the line, and the value `auto` is equivalent to `map`.
* In combination with `symbol-placement`, determines the rotation behavior of icons.
*
* @param function a wrapper function for String
* @return property wrapper around a String function
Expand Down Expand Up @@ -1322,7 +1322,7 @@ public static Property<Function<Float>> iconSize(Function<Float> function) {
}

/**
* Scales the icon to fit around the associated text. The value `none` performs no scaling. The values `width` and `height` scale the x- or y-dimension, respectively, to fit the text's dimensions. The value `both` scales in both dimensions.
* Scales the icon to fit around the associated text.
*
* @param value a String value
* @return property wrapper around String
Expand All @@ -1332,7 +1332,7 @@ public static Property<String> iconTextFit(@Property.ICON_TEXT_FIT String value)
}

/**
* Scales the icon to fit around the associated text. The value `none` performs no scaling. The values `width` and `height` scale the x- or y-dimension, respectively, to fit the text's dimensions. The value `both` scales in both dimensions.
* Scales the icon to fit around the associated text.
*
* @param function a wrapper function for String
* @return property wrapper around a String function
Expand Down Expand Up @@ -1462,7 +1462,7 @@ public static Property<Function<Float[]>> iconOffset(Function<Float[]> function)
}

/**
* Orientation of text when map is pitched. Aligns text to the plane of the viewport when set to `viewport` or the plane of the map when set to `map`. Matches `text-rotation-alignment` if `auto`.
* Orientation of text when map is pitched.
*
* @param value a String value
* @return property wrapper around String
Expand All @@ -1472,7 +1472,7 @@ public static Property<String> textPitchAlignment(@Property.TEXT_PITCH_ALIGNMENT
}

/**
* Orientation of text when map is pitched. Aligns text to the plane of the viewport when set to `viewport` or the plane of the map when set to `map`. Matches `text-rotation-alignment` if `auto`.
* Orientation of text when map is pitched.
*
* @param function a wrapper function for String
* @return property wrapper around a String function
Expand All @@ -1482,7 +1482,7 @@ public static Property<Function<String>> textPitchAlignment(Function<String> fun
}

/**
* In combination with `symbol-placement`, determines the rotation behavior of the individual glyphs forming the text. The value `viewport` produces glyphs whose x-axes are aligned with the x-axis of the viewport, regardless of the value of `symbol-placement`. When `symbol-placement` is set to `point`, the value `map` produces glyphs whose x-axes are aligned east-west, and the value `auto` is equivalent to `viewport`. When `symbol-placement` is set to `line`, the value `map` produces glyphs whose x-axes are aligned with the line at the point where each glyph is placed, and the value `auto` is equivalent to `map`.
* In combination with `symbol-placement`, determines the rotation behavior of the individual glyphs forming the text.
*
* @param value a String value
* @return property wrapper around String
Expand All @@ -1492,7 +1492,7 @@ public static Property<String> textRotationAlignment(@Property.TEXT_ROTATION_ALI
}

/**
* In combination with `symbol-placement`, determines the rotation behavior of the individual glyphs forming the text. The value `viewport` produces glyphs whose x-axes are aligned with the x-axis of the viewport, regardless of the value of `symbol-placement`. When `symbol-placement` is set to `point`, the value `map` produces glyphs whose x-axes are aligned east-west, and the value `auto` is equivalent to `viewport`. When `symbol-placement` is set to `line`, the value `map` produces glyphs whose x-axes are aligned with the line at the point where each glyph is placed, and the value `auto` is equivalent to `map`.
* In combination with `symbol-placement`, determines the rotation behavior of the individual glyphs forming the text.
*
* @param function a wrapper function for String
* @return property wrapper around a String function
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,7 @@ public PropertyValue<String> getIconHaloColor() {
return (PropertyValue<String>) new PropertyValue(nativeGetIconHaloColor());
}
/**
* The color of the icon's halo. Icon halos can only be used with sdf icons.
* The color of the icon's halo. Icon halos can only be used with SDF icons.
*
* @return int representation of a rgba string color
* @throws RuntimeException thrown if property isn't a value
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ public abstract class Property<T> {

<% for (const property of properties) { -%>
//<%- property.name %>
<% for (const value of property.values) { -%>
<% for (const value of Object.keys(property.values)) { -%>
public static final String <%- snakeCaseUpper(property.name) %>_<%- snakeCaseUpper(value) %> = "<%- value %>";
<% } -%>

@StringDef({
<% for (const value of property.values) { -%>
<% for (const value of Object.keys(property.values)) { -%>
<%- snakeCaseUpper(property.name) %>_<%- snakeCaseUpper(value) %>,
<% } -%>
})
Expand Down
4 changes: 2 additions & 2 deletions platform/android/scripts/generate-style-code.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ global.defaultValueJava = function(property) {
case 'string':
return '"' + property['default'] + '"';
case 'enum':
return snakeCaseUpper(property.name) + "_" + snakeCaseUpper(property.values[0]);
return snakeCaseUpper(property.name) + "_" + snakeCaseUpper(Object.keys(property.values)[0]);
case 'color':
return '"rgba(0, 0, 0, 1)"';
case 'array':
Expand All @@ -138,7 +138,7 @@ global.defaultValueJava = function(property) {
}

//Process Layers
const layers = spec.layer.type.values.map((type) => {
const layers = Object.keys(spec.layer.type.values).map((type) => {
const layoutProperties = Object.keys(spec[`layout_${type}`]).reduce((memo, name) => {
if (name !== 'visibility') {
spec[`layout_${type}`][name].name = name;
Expand Down
Loading