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

Bump gl-js pin, update for line-gradient + new expression spec taxonomy #11697

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all 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 mapbox-gl-js
Submodule mapbox-gl-js updated 1362 files
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ public static <Z extends Number> PropertyValue<CameraFunction<Z, String>> fillTr
}

/**
* 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). Note that zoom-dependent expressions will be evaluated only at integer zoom levels.
*
* @param value a String value
* @return property wrapper around String
Expand All @@ -268,7 +268,7 @@ public static PropertyValue<String> fillPattern(String value) {
}

/**
* 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). Note that zoom-dependent expressions will be evaluated only at integer zoom levels.
*
* @param expression an expression statement
* @return property wrapper around an expression statement
Expand All @@ -279,7 +279,7 @@ public static PropertyValue<Expression> fillPattern(Expression expression) {


/**
* 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). Note that zoom-dependent expressions will be evaluated only at integer zoom levels.
*
* @param <Z> the zoom parameter type
* @param function a wrapper {@link CameraFunction} for String
Expand Down Expand Up @@ -565,7 +565,7 @@ public static <T> PropertyValue<Function<T, Float>> lineBlur(Function<T, Float>
}

/**
* 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 density-independent pixels, 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 density-independent pixels, multiply the length by the current line width. Note that GeoJSON sources with `lineMetrics: true` specified won't render dashed lines to the expected scale. Also note that zoom-dependent expressions will be evaluated only at integer zoom levels.
*
* @param value a Float[] value
* @return property wrapper around Float[]
Expand All @@ -575,7 +575,7 @@ public static PropertyValue<Float[]> lineDasharray(Float[] value) {
}

/**
* 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 density-independent pixels, 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 density-independent pixels, multiply the length by the current line width. Note that GeoJSON sources with `lineMetrics: true` specified won't render dashed lines to the expected scale. Also note that zoom-dependent expressions will be evaluated only at integer zoom levels.
*
* @param expression an expression statement
* @return property wrapper around an expression statement
Expand All @@ -586,7 +586,7 @@ public static PropertyValue<Expression> lineDasharray(Expression expression) {


/**
* 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 density-independent pixels, 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 density-independent pixels, multiply the length by the current line width. Note that GeoJSON sources with `lineMetrics: true` specified won't render dashed lines to the expected scale. Also note that zoom-dependent expressions will be evaluated only at integer zoom levels.
*
* @param <Z> the zoom parameter type
* @param function a wrapper {@link CameraFunction} for Float[]
Expand All @@ -598,7 +598,7 @@ public static <Z extends Number> PropertyValue<CameraFunction<Z, Float[]>> lineD
}

/**
* Name of image in sprite 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 sprite to use for drawing image lines. For seamless patterns, image width must be a factor of two (2, 4, 8, ..., 512). Note that zoom-dependent expressions will be evaluated only at integer zoom levels.
*
* @param value a String value
* @return property wrapper around String
Expand All @@ -608,7 +608,7 @@ public static PropertyValue<String> linePattern(String value) {
}

/**
* Name of image in sprite 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 sprite to use for drawing image lines. For seamless patterns, image width must be a factor of two (2, 4, 8, ..., 512). Note that zoom-dependent expressions will be evaluated only at integer zoom levels.
*
* @param expression an expression statement
* @return property wrapper around an expression statement
Expand All @@ -619,7 +619,7 @@ public static PropertyValue<Expression> linePattern(Expression expression) {


/**
* Name of image in sprite 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 sprite to use for drawing image lines. For seamless patterns, image width must be a factor of two (2, 4, 8, ..., 512). Note that zoom-dependent expressions will be evaluated only at integer zoom levels.
*
* @param <Z> the zoom parameter type
* @param function a wrapper {@link CameraFunction} for String
Expand Down Expand Up @@ -1790,7 +1790,7 @@ public static <Z extends Number> PropertyValue<CameraFunction<Z, String>> fillEx
}

/**
* Name of image in sprite to use for drawing images on extruded 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 images on extruded fills. For seamless patterns, image width and height must be a factor of two (2, 4, 8, ..., 512). Note that zoom-dependent expressions will be evaluated only at integer zoom levels.
*
* @param value a String value
* @return property wrapper around String
Expand All @@ -1800,7 +1800,7 @@ public static PropertyValue<String> fillExtrusionPattern(String value) {
}

/**
* Name of image in sprite to use for drawing images on extruded 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 images on extruded fills. For seamless patterns, image width and height must be a factor of two (2, 4, 8, ..., 512). Note that zoom-dependent expressions will be evaluated only at integer zoom levels.
*
* @param expression an expression statement
* @return property wrapper around an expression statement
Expand All @@ -1811,7 +1811,7 @@ public static PropertyValue<Expression> fillExtrusionPattern(Expression expressi


/**
* Name of image in sprite to use for drawing images on extruded 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 images on extruded fills. For seamless patterns, image width and height must be a factor of two (2, 4, 8, ..., 512). Note that zoom-dependent expressions will be evaluated only at integer zoom levels.
*
* @param <Z> the zoom parameter type
* @param function a wrapper {@link CameraFunction} for String
Expand Down Expand Up @@ -2391,7 +2391,7 @@ public static <Z extends Number> PropertyValue<CameraFunction<Z, String>> backgr
}

/**
* Name of image in sprite 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 sprite to use for drawing an image background. For seamless patterns, image width and height must be a factor of two (2, 4, 8, ..., 512). Note that zoom-dependent expressions will be evaluated only at integer zoom levels.
*
* @param value a String value
* @return property wrapper around String
Expand All @@ -2401,7 +2401,7 @@ public static PropertyValue<String> backgroundPattern(String value) {
}

/**
* Name of image in sprite 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 sprite to use for drawing an image background. For seamless patterns, image width and height must be a factor of two (2, 4, 8, ..., 512). Note that zoom-dependent expressions will be evaluated only at integer zoom levels.
*
* @param expression an expression statement
* @return property wrapper around an expression statement
Expand All @@ -2412,7 +2412,7 @@ public static PropertyValue<Expression> backgroundPattern(Expression expression)


/**
* Name of image in sprite 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 sprite to use for drawing an image background. For seamless patterns, image width and height must be a factor of two (2, 4, 8, ..., 512). Note that zoom-dependent expressions will be evaluated only at integer zoom levels.
*
* @param <Z> the zoom parameter type
* @param function a wrapper {@link CameraFunction} for String
Expand Down Expand Up @@ -2905,7 +2905,7 @@ public static <Z extends Number> PropertyValue<CameraFunction<Z, Float[]>> iconT
}

/**
* Name of image in sprite to use for drawing an image background. Within literal values and zoom functions, property names enclosed in curly brackets (e.g. `{token}`) are replaced with the value of the named property. Expressions and property functions do not support this syntax; for equivalent functionality in expressions, use the [`concat`](#expressions-concat) and [`get`](#expressions-get) operators.
* Name of image in sprite to use for drawing an image background.
*
* @param value a String value
* @return property wrapper around String
Expand All @@ -2915,7 +2915,7 @@ public static PropertyValue<String> iconImage(String value) {
}

/**
* Name of image in sprite to use for drawing an image background. Within literal values and zoom functions, property names enclosed in curly brackets (e.g. `{token}`) are replaced with the value of the named property. Expressions and property functions do not support this syntax; for equivalent functionality in expressions, use the [`concat`](#expressions-concat) and [`get`](#expressions-get) operators.
* Name of image in sprite to use for drawing an image background.
*
* @param value a String value
* @return property wrapper around String
Expand All @@ -2926,7 +2926,7 @@ public static PropertyValue<Expression> iconImage(Expression value) {


/**
* Name of image in sprite to use for drawing an image background. Within literal values and zoom functions, property names enclosed in curly brackets (e.g. `{token}`) are replaced with the value of the named property. Expressions and property functions do not support this syntax; for equivalent functionality in expressions, use the [`concat`](#expressions-concat) and [`get`](#expressions-get) operators.
* Name of image in sprite to use for drawing an image background.
*
* @param <T> the function input type
* @param function a wrapper function for String
Expand Down Expand Up @@ -3193,7 +3193,7 @@ public static <Z extends Number> PropertyValue<CameraFunction<Z, String>> textRo
}

/**
* Value to use for a text label. Within literal values and zoom functions, property names enclosed in curly brackets (e.g. `{token}`) are replaced with the value of the named property. Expressions and property functions do not support this syntax; for equivalent functionality in expressions, use the [`concat`](#expressions-concat) and [`get`](#expressions-get) operators.
* Value to use for a text label.
*
* @param value a String value
* @return property wrapper around String
Expand All @@ -3203,7 +3203,7 @@ public static PropertyValue<String> textField(String value) {
}

/**
* Value to use for a text label. Within literal values and zoom functions, property names enclosed in curly brackets (e.g. `{token}`) are replaced with the value of the named property. Expressions and property functions do not support this syntax; for equivalent functionality in expressions, use the [`concat`](#expressions-concat) and [`get`](#expressions-get) operators.
* Value to use for a text label.
*
* @param value a String value
* @return property wrapper around String
Expand All @@ -3214,7 +3214,7 @@ public static PropertyValue<Expression> textField(Expression value) {


/**
* Value to use for a text label. Within literal values and zoom functions, property names enclosed in curly brackets (e.g. `{token}`) are replaced with the value of the named property. Expressions and property functions do not support this syntax; for equivalent functionality in expressions, use the [`concat`](#expressions-concat) and [`get`](#expressions-get) operators.
* Value to use for a text label.
*
* @param <T> the function input type
* @param function a wrapper function for String
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ public class <%- camelize(type) %>LayerTest extends BaseActivityTest {
layer.setProperties(
<%- camelizeWithLeadingLowercase(property.name) %>(
zoom(
<% if (property.function == 'piecewise-constant') { -%>
<% if (!isInterpolable(property)) { -%>
interval(
stop(2, <%- camelizeWithLeadingLowercase(property.name) %>(<%- defaultValueJava(property) %>))
)
Expand All @@ -193,7 +193,7 @@ public class <%- camelize(type) %>LayerTest extends BaseActivityTest {
assertNotNull(layer.get<%- camelize(property.name) %>());
assertNotNull(layer.get<%- camelize(property.name) %>().getFunction());
assertEquals(CameraFunction.class, layer.get<%- camelize(property.name) %>().getFunction().getClass());
<% if (property.function == 'piecewise-constant') { -%>
<% if (!isInterpolable(property)) { -%>
assertEquals(IntervalStops.class, layer.get<%- camelize(property.name) %>().getFunction().getStops().getClass());
assertEquals(1, ((IntervalStops) layer.get<%- camelize(property.name) %>().getFunction().getStops()).size());
<% } else { -%>
Expand Down Expand Up @@ -231,7 +231,7 @@ public class <%- camelize(type) %>LayerTest extends BaseActivityTest {
}
});
}
<% if (property.function == 'piecewise-constant') { -%>
<% if (!isInterpolable(property)) { -%>

@Test
public void test<%- camelize(property.name) %>AsIntervalSourceFunction() {
Expand Down
12 changes: 9 additions & 3 deletions platform/android/scripts/generate-style-code.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ var layers = Object.keys(spec.layer.type.values).map((type) => {
const paintProperties = Object.keys(spec[`paint_${type}`]).reduce((memo, name) => {
// disabled for now, see https://github.com/mapbox/mapbox-gl-native/issues/11172
if (name === 'heatmap-color') return memo;
// not yet implemented
if (name === 'line-gradient') return memo;

spec[`paint_${type}`][name].name = name;
memo.push(spec[`paint_${type}`][name]);
Expand Down Expand Up @@ -252,9 +254,13 @@ global.propertyValueDoc = function (property, value) {
};

global.isDataDriven = function (property) {
return property['property-function'] === true;
return property['property-type'] === 'data-driven' || property['property-type'] === 'cross-faded-data-driven';
};

global.isInterpolable = function(property) {
return property.expression && property.expression.interpolated;
}

global.isLightProperty = function (property) {
return property['light-property'] === true;
};
Expand Down Expand Up @@ -302,11 +308,11 @@ global.evaluatedType = function (property) {
};

global.supportsZoomFunction = function (property) {
return property['zoom-function'] === true;
return property.expression && property.expression.parameters.indexOf('zoom') > -1;
};

global.supportsPropertyFunction = function (property) {
return property['property-function'] === true;
return property['property-type'] === 'data-driven' || property['property-type'] === 'cross-faded-data-driven';
};

// Template processing //
Expand Down
11 changes: 9 additions & 2 deletions platform/darwin/scripts/generate-style-code.js
Original file line number Diff line number Diff line change
Expand Up @@ -309,9 +309,9 @@ global.propertyDoc = function (propertyName, property, layerType, kind) {
'* Conditional expressions\n' +
'* Variable assignments and references to assigned variables\n';
const inputVariable = property.name === 'heatmap-color' ? '$heatmapDensity' : '$zoomLevel';
if (property["property-function"]) {
if (isDataDriven(property)) {
doc += `* Interpolation and step functions applied to the \`${inputVariable}\` variable and/or feature attributes\n`;
} else if (property.function === "interpolated") {
} else if (property.expression && property.expression.interpolated) {
doc += `* Interpolation and step functions applied to the \`${inputVariable}\` variable\n\n` +
'This property does not support applying interpolation or step functions to feature attributes.';
} else {
Expand All @@ -322,6 +322,10 @@ global.propertyDoc = function (propertyName, property, layerType, kind) {
return doc;
};

global.isDataDriven = function (property) {
return property['property-type'] === 'data-driven' || property['property-type'] === 'cross-faded-data-driven';
};

global.propertyReqs = function (property, propertiesByName, type) {
return 'This property is only applied to the style if ' + property.requires.map(function (req) {
if (typeof req === 'string') {
Expand Down Expand Up @@ -633,6 +637,9 @@ const layers = _(spec.layer.type.values).map((value, layerType) => {
}, []);

const paintProperties = Object.keys(spec[`paint_${layerType}`]).reduce((memo, name) => {
// not yet implemented
if (name === 'line-gradient') return memo;

spec[`paint_${layerType}`][name].name = name;
memo.push(spec[`paint_${layerType}`][name]);
return memo;
Expand Down
3 changes: 2 additions & 1 deletion platform/darwin/src/MGLFillStyleLayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,8 @@ MGL_EXPORT

/**
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).
image width and height must be a factor of two (2, 4, 8, ..., 512). Note that
zoom-dependent expressions will be evaluated only at integer zoom levels.

You can set this property to an expression containing any of the following:

Expand Down
5 changes: 4 additions & 1 deletion platform/darwin/src/MGLLineStyleLayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,10 @@ MGL_EXPORT
/**
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.
length to points, multiply the length by the current line width. Note that
GeoJSON sources with `lineMetrics: true` specified won't render dashed lines to
the expected scale. Also note that zoom-dependent expressions will be evaluated
only at integer zoom levels.

This property is measured in line widths.

Expand Down
Loading