summaryrefslogtreecommitdiff
path: root/platform/android
diff options
context:
space:
mode:
authorLauren Budorick <lauren@mapbox.com>2018-04-16 17:38:53 -0700
committerLauren Budorick <lauren@mapbox.com>2018-04-16 17:38:53 -0700
commitcfd97e5ceaa7b88d591bdb730ae1e9b70dcaa5f5 (patch)
tree781f03674488d8a5cc1e8388d5b85c9a0766bb0c /platform/android
parent8b10bb38c0a7d6e0a1225e185acde5ec8a604bdc (diff)
downloadqtlocation-mapboxgl-upstream/expression-spec.tar.gz
Bump gl-js pin: ignore line-gradient properties + shaders, use new expression style-spec taxonomyupstream/expression-spec
Diffstat (limited to 'platform/android')
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/PropertyFactory.java42
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/layer.junit.ejs6
-rwxr-xr-xplatform/android/scripts/generate-style-code.js12
3 files changed, 33 insertions, 27 deletions
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/PropertyFactory.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/PropertyFactory.java
index 18ee05e63b..f71865edca 100644
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/PropertyFactory.java
+++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/PropertyFactory.java
@@ -258,7 +258,7 @@ public class PropertyFactory {
}
/**
- * 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
@@ -268,7 +268,7 @@ public class PropertyFactory {
}
/**
- * 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
@@ -279,7 +279,7 @@ public class PropertyFactory {
/**
- * 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
@@ -565,7 +565,7 @@ public class PropertyFactory {
}
/**
- * 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[]
@@ -575,7 +575,7 @@ public class PropertyFactory {
}
/**
- * 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
@@ -586,7 +586,7 @@ public class PropertyFactory {
/**
- * 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[]
@@ -598,7 +598,7 @@ public class PropertyFactory {
}
/**
- * 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
@@ -608,7 +608,7 @@ public class PropertyFactory {
}
/**
- * 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
@@ -619,7 +619,7 @@ public class PropertyFactory {
/**
- * 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
@@ -1790,7 +1790,7 @@ public class PropertyFactory {
}
/**
- * 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
@@ -1800,7 +1800,7 @@ public class PropertyFactory {
}
/**
- * 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
@@ -1811,7 +1811,7 @@ public class PropertyFactory {
/**
- * 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
@@ -2391,7 +2391,7 @@ public class PropertyFactory {
}
/**
- * 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
@@ -2401,7 +2401,7 @@ public class PropertyFactory {
}
/**
- * 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
@@ -2412,7 +2412,7 @@ public class PropertyFactory {
/**
- * 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
@@ -2905,7 +2905,7 @@ public class PropertyFactory {
}
/**
- * 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
@@ -2915,7 +2915,7 @@ public class PropertyFactory {
}
/**
- * 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
@@ -2926,7 +2926,7 @@ public class PropertyFactory {
/**
- * 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
@@ -3193,7 +3193,7 @@ public class PropertyFactory {
}
/**
- * 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
@@ -3203,7 +3203,7 @@ public class PropertyFactory {
}
/**
- * 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
@@ -3214,7 +3214,7 @@ public class PropertyFactory {
/**
- * 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
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/layer.junit.ejs b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/layer.junit.ejs
index 206497b860..5e1d1f64d3 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/layer.junit.ejs
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/layer.junit.ejs
@@ -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) %>))
)
@@ -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 { -%>
@@ -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() {
diff --git a/platform/android/scripts/generate-style-code.js b/platform/android/scripts/generate-style-code.js
index 6e6d3cfa67..91713edcb7 100755
--- a/platform/android/scripts/generate-style-code.js
+++ b/platform/android/scripts/generate-style-code.js
@@ -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]);
@@ -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;
};
@@ -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 //