diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/expressions/Expression.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/expressions/Expression.java
index 0cd5aa9d6..f6caa0b8e 100644
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/expressions/Expression.java
+++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/expressions/Expression.java
@@ -5,9 +5,13 @@ import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.annotation.Size;
+import com.google.gson.JsonArray;
+import com.google.gson.JsonElement;
+import com.google.gson.JsonPrimitive;
import com.mapbox.mapboxsdk.style.layers.PropertyFactory;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.List;
/**
@@ -101,10 +105,6 @@ public class Expression {
return new ExpressionLiteral(bool);
}
- //
- // Types
- //
-
/**
* Create a literal object expression.
*
@@ -159,10 +159,6 @@ public class Expression {
return rgb(literal(red), literal(green), literal(blue));
}
- //
- // Literals
- //
-
/**
* Creates a color value from red, green, blue components, which must range between 0 and 255,
* and an alpha component which must range between 0 and 1.
@@ -224,10 +220,6 @@ public class Expression {
return new Expression("==", compareOne, compareTwo);
}
- //
- // Color
- //
-
/**
* Returns true if the input values are equal, false otherwise.
*
@@ -301,10 +293,6 @@ public class Expression {
return new Expression("!=", literal(compareOne), literal(compareTwo));
}
- //
- // Decision
- //
-
/**
* Returns `true` if the input values are not equal, `false` otherwise.
*
@@ -477,7 +465,6 @@ public class Expression {
* @return expression
* @see Style specification
*/
-
public static Expression all(@NonNull Expression... input) {
return new Expression("all", input);
}
@@ -494,7 +481,6 @@ public class Expression {
* @return expression
* @see Style specification
*/
-
public static Expression any(@NonNull Expression... input) {
return new Expression("any", input);
}
@@ -532,7 +518,6 @@ public class Expression {
* @return expression
* @see Style specification
*/
-
public static Expression switchCase(@NonNull @Size(min = 1) Expression... input) {
return new Expression("case", input);
}
@@ -661,10 +646,6 @@ public class Expression {
return new Expression("get", input);
}
- //
- // FeatureData
- //
-
/**
* Retrieves a property value from the current feature's properties,
* or from another object if a second argument is provided.
@@ -704,10 +685,6 @@ public class Expression {
return get(literal(key), object);
}
- //
- // Heatmap
- //
-
/**
* Tests for the presence of an property value in the current feature's properties.
*
@@ -719,10 +696,6 @@ public class Expression {
return new Expression("has", key);
}
- //
- // Lookup
- //
-
/**
* Tests for the presence of an property value in the current feature's properties.
*
@@ -817,7 +790,6 @@ public class Expression {
* @return expression
* @see Style specification
*/
-
public static Expression sum(@Size(min = 2) Expression... numbers) {
return new Expression("+", numbers);
}
@@ -829,7 +801,6 @@ public class Expression {
* @return expression
* @see Style specification
*/
-
public static Expression sum(@Size(min = 2) Number... numbers) {
Expression[] numberExpression = new Expression[numbers.length];
for (int i = 0; i < numbers.length; i++) {
@@ -845,7 +816,6 @@ public class Expression {
* @return expression
* @see Style specification
*/
-
public static Expression product(@Size(min = 2) Expression... numbers) {
return new Expression("*", numbers);
}
@@ -857,7 +827,6 @@ public class Expression {
* @return expression
* @see Style specification
*/
-
public static Expression product(@Size(min = 2) Number... numbers) {
Expression[] numberExpression = new Expression[numbers.length];
for (int i = 0; i < numbers.length; i++) {
@@ -866,10 +835,6 @@ public class Expression {
return product(numberExpression);
}
- //
- // Math
- //
-
/**
* Returns the result of subtracting a number from 0.
*
@@ -1215,7 +1180,6 @@ public class Expression {
* @return expression
* @see Style specification
*/
-
public static Expression min(@Size(min = 1) Expression... numbers) {
return new Expression("min", numbers);
}
@@ -1227,7 +1191,6 @@ public class Expression {
* @return expression
* @see Style specification
*/
-
public static Expression min(@Size(min = 1) Number... numbers) {
Expression[] numberExpression = new Expression[numbers.length];
for (int i = 0; i < numbers.length; i++) {
@@ -1243,7 +1206,6 @@ public class Expression {
* @return expression
* @see Style specification
*/
-
public static Expression max(@Size(min = 1) Expression... numbers) {
return new Expression("max", numbers);
}
@@ -1255,7 +1217,6 @@ public class Expression {
* @return expression
* @see Style specification
*/
-
public static Expression max(@Size(min = 1) Number... numbers) {
Expression[] numberExpression = new Expression[numbers.length];
for (int i = 0; i < numbers.length; i++) {
@@ -1331,7 +1292,6 @@ public class Expression {
* @return expression
* @see Style specification
*/
-
public static Expression concat(@NonNull Expression... input) {
return new Expression("concat", input);
}
@@ -1343,7 +1303,6 @@ public class Expression {
* @return expression
* @see Style specification
*/
-
public static Expression concat(@NonNull String... input) {
Expression[] stringExpression = new Expression[input.length];
for (int i = 0; i < input.length; i++) {
@@ -1365,10 +1324,6 @@ public class Expression {
return new Expression("array", input);
}
- //
- // String
- //
-
/**
* Returns a string describing the type of the given value.
*
@@ -1448,10 +1403,6 @@ public class Expression {
return new Expression("to-string", input);
}
- //
- // Types
- //
-
/**
* Converts the input value to a number, if possible.
* If the input is null or false, the result is 0.
@@ -1501,7 +1452,6 @@ public class Expression {
* @return expression
* @see Style specification
*/
-
public static Expression let(@Size(min = 1) Expression... input) {
return new Expression("let", input);
}
@@ -1565,7 +1515,6 @@ public class Expression {
* @return expression
* @see Style specification
*/
-
public static Expression step(@NonNull Number input, @NonNull Expression expression, Expression... stops) {
return step(literal(input), expression, stops);
}
@@ -1582,15 +1531,10 @@ public class Expression {
* @return expression
* @see Style specification
*/
-
public static Expression step(@NonNull Expression input, @NonNull Expression expression, Expression... stops) {
return new Expression("step", join(new Expression[] {input, expression}, stops));
}
- //
- // Variable binding
- //
-
/**
* Produces discrete, stepped results by evaluating a piecewise-constant function defined by pairs of
* input and output values (\"stops\"). The `input` may be any numeric expression (e.g., `[\"get\", \"population\"]`).
@@ -1603,14 +1547,8 @@ public class Expression {
* @return expression
* @see Style specification
*/
-
public static Expression step(@NonNull Number input, @NonNull Expression expression, Stop... stops) {
- Expression[] expressions = new Expression[stops.length * 2];
- for (int i = 0; i < stops.length; i++) {
- expressions[i * 2] = literal(stops[i].value);
- expressions[i * 2 + 1] = literal(stops[i].output);
- }
- return step(literal(input), expression, expressions);
+ return step(literal(input), expression, Stop.toExpressionArray(stops));
}
/**
@@ -1625,14 +1563,8 @@ public class Expression {
* @return expression
* @see Style specification
*/
-
public static Expression step(@NonNull Expression input, @NonNull Expression expression, Stop... stops) {
- Expression[] expressions = new Expression[stops.length * 2];
- for (int i = 0; i < stops.length; i++) {
- expressions[i * 2] = literal(stops[i].value);
- expressions[i * 2 + 1] = literal(stops[i].output);
- }
- return step(input, expression, expressions);
+ return step(input, expression, Stop.toExpressionArray(stops));
}
/**
@@ -1647,16 +1579,11 @@ public class Expression {
* @return expression
* @see Style specification
*/
-
public static Expression interpolate(@NonNull Interpolator interpolation,
@NonNull Expression number, Expression... stops) {
return new Expression("interpolate", join(new Expression[] {interpolation, number}, stops));
}
- //
- // Zoom
- //
-
/**
* Produces continuous, smooth results by interpolating between pairs of input and output values (\"stops\").
* The `input` may be any numeric expression (e.g., `[\"get\", \"population\"]`).
@@ -1669,21 +1596,11 @@ public class Expression {
* @return expression
* @see Style specification
*/
-
public static Expression interpolate(@NonNull Interpolator interpolation,
@NonNull Expression number, Stop... stops) {
- Expression[] expressions = new Expression[stops.length * 2];
- for (int i = 0; i < stops.length; i++) {
- expressions[i * 2] = literal(stops[i].value);
- expressions[i * 2 + 1] = literal(stops[i].output);
- }
- return interpolate(interpolation, number, expressions);
+ return interpolate(interpolation, number, Stop.toExpressionArray(stops));
}
-
- //
- // Ramps, scales, curves
- //
-
+
/**
* interpolates linearly between the pair of stops just less than and just greater than the input.
*
@@ -1834,6 +1751,43 @@ public class Expression {
return builder.toString();
}
+ /**
+ * Indicates whether some other object is "equal to" this one.
+ *
+ * @param o the other object
+ * @return true if equal, false if not
+ */
+ @Override
+ public boolean equals(Object o) {
+ super.equals(o);
+ if (this == o) {
+ return true;
+ }
+
+ if (o == null || !(o instanceof Expression)) {
+ return false;
+ }
+
+ Expression that = (Expression) o;
+
+ if (operator != null ? !operator.equals(that.operator) : that.operator != null) {
+ return false;
+ }
+ return Arrays.deepEquals(arguments, that.arguments);
+ }
+
+ /**
+ * Returns a hash code value for the expression.
+ *
+ * @return a hash code value for this expression
+ */
+ @Override
+ public int hashCode() {
+ int result = operator != null ? operator.hashCode() : 0;
+ result = 31 * result + Arrays.hashCode(arguments);
+ return result;
+ }
+
/**
* ExpressionLiteral wraps an object to be used as a literal in an expression.
*
@@ -1841,27 +1795,72 @@ public class Expression {
* {@link #literal(String)} and {@link #literal(Object)}.
*
*/
- private static class ExpressionLiteral extends Expression {
+ public static class ExpressionLiteral extends Expression {
protected Object literal;
/**
- * Create an ExpressionValue wrapper.
+ * Create an expression literal.
*
- * @param object the object to be wrapped
+ * @param object the object to be treated as literal
*/
- ExpressionLiteral(@NonNull Object object) {
+ public ExpressionLiteral(@NonNull Object object) {
this.literal = object;
}
/**
- * Get the wrapped object.
+ * Get the literal object.
*
- * @return the wrapped object
+ * @return the literal object
*/
Object toValue() {
return literal;
}
+
+ /**
+ * Returns a string representation of the expression literal.
+ *
+ * @return a string representation of the object.
+ */
+ @Override
+ public String toString() {
+ return literal.toString();
+ }
+
+ /**
+ * Indicates whether some other object is "equal to" this one.
+ *
+ * @param o the other object
+ * @return true if equal, false if not
+ */
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ if (!super.equals(o)) {
+ return false;
+ }
+
+ ExpressionLiteral that = (ExpressionLiteral) o;
+
+ return literal != null ? literal.equals(that.literal) : that.literal == null;
+ }
+
+ /**
+ * Returns a hash code value for the expression literal.
+ *
+ * @return a hash code value for this expression literal
+ */
+ @Override
+ public int hashCode() {
+ int result = super.hashCode();
+ result = 31 * result + (literal != null ? literal.hashCode() : 0);
+ return result;
+ }
}
/**
@@ -1896,9 +1895,9 @@ public class Expression {
/**
* Converts the int color to rgba(d, d, d, d) string representation
*
- * @return
+ * @return the string representation of a color
*/
- public String convertColor() {
+ String convertColor() {
return PropertyFactory.colorToRgbaString(color);
}
}
@@ -1921,9 +1920,90 @@ public class Expression {
private Object value;
private Object output;
- public Stop(Object value, Object output) {
+ Stop(Object value, Object output) {
this.value = value;
this.output = output;
}
+
+ /**
+ * Converts a varargs of Stops to a Expression array.
+ *
+ * @param stops the stops to convert
+ * @return the converted stops as an expression array
+ */
+ static Expression[] toExpressionArray(Stop... stops) {
+ Expression[] expressions = new Expression[stops.length * 2];
+ Stop stop;
+ Object inputValue, outputValue;
+ for (int i = 0; i < stops.length; i++) {
+ stop = stops[i];
+ inputValue = stop.value;
+ outputValue = stop.output;
+
+ if (!(inputValue instanceof Expression)) {
+ inputValue = literal(inputValue);
+ }
+
+ if (!(outputValue instanceof Expression)) {
+ outputValue = literal(outputValue);
+ }
+
+ expressions[i * 2] = (Expression) inputValue;
+ expressions[i * 2 + 1] = (Expression) outputValue;
+ }
+ return expressions;
+ }
+ }
+
+ /**
+ * Converts a JsonArray to an expression.
+ */
+ public final static class Converter {
+
+ /**
+ * Converts a JsonArray to an expression
+ *
+ * @param jsonArray the json array to convert
+ * @return the expression
+ */
+ public static Expression convert(@NonNull JsonArray jsonArray) {
+ if (jsonArray.size() == 0) {
+ throw new IllegalArgumentException("Can't convert empty jsonArray expressions");
+ }
+
+ final String operator = jsonArray.get(0).getAsString();
+ final List arguments = new ArrayList<>();
+
+ JsonElement jsonElement;
+ for (int i = 1; i < jsonArray.size(); i++) {
+ jsonElement = jsonArray.get(i);
+ if (jsonElement instanceof JsonArray) {
+ arguments.add(convert((JsonArray) jsonElement));
+ } else if (jsonElement instanceof JsonPrimitive) {
+ arguments.add(convert((JsonPrimitive) jsonElement));
+ } else {
+ throw new RuntimeException("Unsupported expression conversion for " + jsonElement.getClass());
+ }
+ }
+ return new Expression(operator, arguments.toArray(new Expression[arguments.size()]));
+ }
+
+ /**
+ * Converts a JsonPrimitive to an expression literal
+ *
+ * @param jsonPrimitive the json primitive to convert
+ * @return the expression literal
+ */
+ private static Expression convert(@NonNull JsonPrimitive jsonPrimitive) {
+ if (jsonPrimitive.isBoolean()) {
+ return new Expression.ExpressionLiteral(jsonPrimitive.getAsBoolean());
+ } else if (jsonPrimitive.isNumber()) {
+ return new Expression.ExpressionLiteral(jsonPrimitive.getAsFloat());
+ } else if (jsonPrimitive.isString()) {
+ return new Expression.ExpressionLiteral(jsonPrimitive.getAsString());
+ } else {
+ throw new RuntimeException("Unsupported literal expression conversion for " + jsonPrimitive.getClass());
+ }
+ }
}
}
\ No newline at end of file
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/functions/CameraFunction.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/functions/CameraFunction.java
deleted file mode 100644
index 74c68cf57..000000000
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/functions/CameraFunction.java
+++ /dev/null
@@ -1,50 +0,0 @@
-package com.mapbox.mapboxsdk.style.functions;
-
-import android.support.annotation.Keep;
-import android.support.annotation.NonNull;
-
-import com.mapbox.mapboxsdk.style.functions.stops.ExponentialStops;
-import com.mapbox.mapboxsdk.style.functions.stops.IntervalStops;
-import com.mapbox.mapboxsdk.style.functions.stops.Stop;
-import com.mapbox.mapboxsdk.style.functions.stops.Stops;
-
-/**
- * Camera function. Functions that take camera properties as input (zoom for now)
- *
- * Zoom functions allow the appearance of a map feature to change with map's zoom level.
- * Zoom functions can be used to create the illusion of depth and control data density.
- * Each stop is an array with two elements: the first is a zoom level and the second is
- * a function output value.
- *
- * @param the input type
- * @param the output type
- * @see Function#zoom
- */
-public class CameraFunction extends Function {
-
- /**
- * Create an exponential camera function
- *
- * @param stops @see {@link com.mapbox.mapboxsdk.style.functions.stops.Stops#exponential(float, Stop[])}
- */
- CameraFunction(@NonNull ExponentialStops stops) {
- super(stops);
- }
-
- /**
- * Create an interval camera function
- *
- * @param stops @see {@link com.mapbox.mapboxsdk.style.functions.stops.Stops#interval(Stop[])}
- */
- CameraFunction(@NonNull IntervalStops stops) {
- super(stops);
- }
-
- /**
- * JNI constructor
- */
- @Keep
- private CameraFunction(Stops stops) {
- super(stops);
- }
-}
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/functions/CompositeFunction.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/functions/CompositeFunction.java
deleted file mode 100644
index 15e447410..000000000
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/functions/CompositeFunction.java
+++ /dev/null
@@ -1,100 +0,0 @@
-package com.mapbox.mapboxsdk.style.functions;
-
-import android.support.annotation.NonNull;
-import android.support.annotation.Nullable;
-
-import com.mapbox.mapboxsdk.style.functions.stops.CategoricalStops;
-import com.mapbox.mapboxsdk.style.functions.stops.ExponentialStops;
-import com.mapbox.mapboxsdk.style.functions.stops.IntervalStops;
-import com.mapbox.mapboxsdk.style.functions.stops.Stop;
-import com.mapbox.mapboxsdk.style.functions.stops.Stops;
-import com.mapbox.mapboxsdk.style.layers.PropertyValue;
-
-import java.util.Map;
-
-/**
- * Composite functions combine Camera and SourceFunctions.
- *
- * Composite functions allow the appearance of a map feature to change with both its
- * properties and zoom. Each stop is an array with two elements, the first is an object
- * with a property input value and a zoom, and the second is a function output value. Note
- * that support for property functions is not yet complete.
- *
- * @param the zoom type (usually Float)
- * @param the input type (the feature property type)
- * @param the output type (the property type)
- * @see Function#composite
- */
-public class CompositeFunction extends Function, O> {
-
- private final String property;
- private PropertyValue defaultValue;
-
- CompositeFunction(@NonNull String property,
- @NonNull CategoricalStops, O> stops) {
- this(null, property, stops);
- }
-
- CompositeFunction(@NonNull String property,
- @NonNull ExponentialStops, O> stops) {
- this(null, property, stops);
- }
-
- CompositeFunction(@NonNull String property,
- @NonNull IntervalStops, O> stops) {
- this(null, property, stops);
- }
-
-
- /**
- * JNI Constructor
- */
- private CompositeFunction(@Nullable O defaultValue, @NonNull String property,
- @NonNull Stops, O> stops) {
- super(stops);
- this.defaultValue = new PropertyValue<>(property, defaultValue);
- this.property = property;
- }
-
- /**
- * Set the default value
- *
- * @param defaultValue the default value to use when no other applies
- * @return this (for chaining)
- */
- public CompositeFunction withDefaultValue(PropertyValue defaultValue) {
- this.defaultValue = defaultValue;
- return this;
- }
-
- /**
- * @return the defaultValue
- */
- @Nullable
- public PropertyValue getDefaultValue() {
- return defaultValue;
- }
-
- /**
- * INTERNAL USAGE ONLY
- *
- * @return the feature property name
- */
- public String getProperty() {
- return property;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Map toValueObject() {
- Map valueObject = super.toValueObject();
- valueObject.put(PROPERTY_KEY, property);
- if (defaultValue != null) {
- valueObject.put(DEFAULT_VALUE_KEY, defaultValue.value);
- }
- return valueObject;
- }
-
-}
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/functions/Function.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/functions/Function.java
deleted file mode 100644
index 80ff4198f..000000000
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/functions/Function.java
+++ /dev/null
@@ -1,300 +0,0 @@
-package com.mapbox.mapboxsdk.style.functions;
-
-import android.support.annotation.NonNull;
-import android.support.annotation.Nullable;
-
-import com.mapbox.mapboxsdk.style.functions.stops.CategoricalStops;
-import com.mapbox.mapboxsdk.style.functions.stops.ExponentialStops;
-import com.mapbox.mapboxsdk.style.functions.stops.IdentityStops;
-import com.mapbox.mapboxsdk.style.functions.stops.IntervalStops;
-import com.mapbox.mapboxsdk.style.functions.stops.Stop;
-import com.mapbox.mapboxsdk.style.functions.stops.Stops;
-
-import java.util.Map;
-
-import timber.log.Timber;
-
-/**
- * Functions are used to change properties in relation to the state of the map.
- *
- * The value for any layout or paint property may be specified as a function. Functions allow you to
- * make the appearance of a map feature change with the current zoom level and/or the feature's properties.
- *
- * @param the function's input type
- * @param the target property's value type. Make sure it matches.
- * @see The style specification
- */
-public class Function {
-
- static final String PROPERTY_KEY = "property";
- static final String DEFAULT_VALUE_KEY = "default";
-
- /**
- * Create an exponential {@link CameraFunction}
- *
- * Zoom functions allow the appearance of a map feature to change with map's zoom.
- * Zoom functions can be used to create the illusion of depth and control data density.
- * Each stop is an array with two elements, the first is a zoom and the second is a function output value.
- *
- * @param the zoom level type (Float, Integer)
- * @param the property type
- * @param stops the stops implementation that define the function. @see {@link Stops#exponential(Stop[])}
- * @return the {@link CameraFunction}
- * @see CameraFunction
- * @see ExponentialStops
- * @see Stops#exponential(Stop[])
- * @see Stops#exponential(Stop[])
- * @see Stop#stop
- */
- public static CameraFunction zoom(@NonNull ExponentialStops stops) {
- return new CameraFunction<>(stops);
- }
-
- /**
- * Create an interval {@link CameraFunction}
- *
- * Zoom functions allow the appearance of a map feature to change with map’s zoom.
- * Zoom functions can be used to create the illusion of depth and control data density.
- * Each stop is an array with two elements, the first is a zoom and the second is a function output value.
- *
- * @param the zoom level type (Float, Integer)
- * @param the property type
- * @param stops the stops implementation that define the function. @see {@link Stops#interval(Stop[])}
- * @return the {@link CameraFunction}
- * @see CameraFunction
- * @see IntervalStops
- * @see Stops#interval(Stop[])
- * @see Stop#stop
- */
- public static CameraFunction zoom(@NonNull IntervalStops stops) {
- return new CameraFunction<>(stops);
- }
-
- /**
- * Create an exponential {@link SourceFunction}
- *
- * Source functions allow the appearance of a map feature to change with
- * its properties. Source functions can be used to visually differentiate
- * types of features within the same layer or create data visualizations.
- * Each stop is an array with two elements, the first is a property input
- * value and the second is a function output value. Note that support for
- * property functions is not available across all properties and platforms
- * at this time.
- *
- * @param property the feature property name
- * @param stops the stops
- * @param the function input type
- * @param the function output type
- * @return the {@link SourceFunction}
- * @see SourceFunction
- * @see ExponentialStops
- * @see Stops#exponential(Stop[])
- * @see Stop#stop
- */
- public static SourceFunction property(@NonNull String property, @NonNull ExponentialStops stops) {
- return new SourceFunction<>(property, stops);
- }
-
- /**
- * Create an identity {@link SourceFunction}
- *
- * Source functions allow the appearance of a map feature to change with
- * its properties. Source functions can be used to visually differentiate
- * types of features within the same layer or create data visualizations.
- * Each stop is an array with two elements, the first is a property input
- * value and the second is a function output value. Note that support for
- * property functions is not available across all properties and platforms
- * at this time.
- *
- * @param property the feature property name
- * @param stops the stops
- * @param the function input/output type
- * @return the {@link SourceFunction}
- * @see SourceFunction
- * @see IdentityStops
- * @see Stops#identity()
- * @see Stop#stop
- */
- public static SourceFunction property(@NonNull String property, @NonNull IdentityStops stops) {
- return new SourceFunction<>(property, stops);
- }
-
- /**
- * Create an interval {@link SourceFunction}
- *
- * Source functions allow the appearance of a map feature to change with
- * its properties. Source functions can be used to visually differentiate
- * types of features within the same layer or create data visualizations.
- * Each stop is an array with two elements, the first is a property input
- * value and the second is a function output value. Note that support for
- * property functions is not available across all properties and platforms
- * at this time.
- *
- * @param property the feature property name
- * @param stops the stops
- * @param the function input type
- * @param the function output type
- * @return the {@link SourceFunction}
- * @see SourceFunction
- * @see IntervalStops
- * @see Stops#interval(Stop[])
- * @see Stop#stop
- */
- public static SourceFunction property(@NonNull String property, @NonNull IntervalStops stops) {
- return new SourceFunction<>(property, stops);
- }
-
- /**
- * Create an categorical {@link SourceFunction}
- *
- * Source functions allow the appearance of a map feature to change with
- * its properties. Source functions can be used to visually differentiate
- * types of features within the same layer or create data visualizations.
- * Each stop is an array with two elements, the first is a property input
- * value and the second is a function output value. Note that support for
- * property functions is not available across all properties and platforms
- * at this time.
- *
- * @param property the feature property name
- * @param stops the stops
- * @param the function input type
- * @param the function output type
- * @return the {@link SourceFunction}
- * @see SourceFunction
- * @see CategoricalStops
- * @see Stops#categorical(Stop[])
- * @see Stop#stop
- */
- public static SourceFunction property(@NonNull String property, @NonNull CategoricalStops stops) {
- return new SourceFunction<>(property, stops);
- }
-
- /**
- * Create a composite, categorical function.
- *
- * Composite functions allow the appearance of a map feature to change with both its
- * properties and zoom. Each stop is an array with two elements, the first is an object
- * with a property input value and a zoom, and the second is a function output value. Note
- * that support for property functions is not yet complete.
- *
- * @param property the feature property name for the source part of the function
- * @param stops the stops
- * @param the zoom function input type (Float usually)
- * @param the function input type for the source part of the function
- * @param the function output type
- * @return the {@link CompositeFunction}
- * @see CompositeFunction
- * @see CategoricalStops
- * @see Stops#categorical(Stop[])
- * @see Stop#stop
- */
- public static CompositeFunction composite(
- @NonNull String property,
- @NonNull CategoricalStops, O> stops) {
-
- return new CompositeFunction<>(property, stops);
- }
-
- /**
- * Create a composite, exponential function.
- *
- * Composite functions allow the appearance of a map feature to change with both its
- * properties and zoom. Each stop is an array with two elements, the first is an object
- * with a property input value and a zoom, and the second is a function output value. Note
- * that support for property functions is not yet complete.
- *
- * @param property the feature property name for the source part of the function
- * @param stops the stops
- * @param the zoom function input type (Float usually)
- * @param the function input type for the source part of the function
- * @param the function output type
- * @return the {@link CompositeFunction}
- * @see CompositeFunction
- * @see ExponentialStops
- * @see Stops#exponential(Stop[])
- * @see Stop#stop
- */
- public static CompositeFunction composite(
- @NonNull String property,
- @NonNull ExponentialStops, O> stops) {
-
- return new CompositeFunction<>(property, stops);
- }
-
- /**
- * Create a composite, interval function.
- *
- * Composite functions allow the appearance of a map feature to change with both its
- * properties and zoom. Each stop is an array with two elements, the first is an object
- * with a property input value and a zoom, and the second is a function output value. Note
- * that support for property functions is not yet complete.
- *
- * @param property the feature property name for the source part of the function
- * @param stops the stops
- * @param the zoom function input type (Float usually)
- * @param the function input type for the source part of the function
- * @param the function output type
- * @return the {@link CompositeFunction}
- * @see CompositeFunction
- * @see IntervalStops
- * @see Stops#interval(Stop[])
- * @see Stop#stop
- */
- public static CompositeFunction composite(
- @NonNull String property,
- @NonNull IntervalStops, O> stops) {
-
- return new CompositeFunction<>(property, stops);
- }
-
- // Class definition //
-
- private final Stops stops;
-
- /**
- * JNI Cosntructor for implementation classes
- *
- * @param stops the stops
- */
- Function(@NonNull Stops stops) {
- this.stops = stops;
- }
-
- /**
- * @return the stops in this function
- */
- public Stops getStops() {
- return stops;
- }
-
- /**
- * Convenience method
- *
- * @param the Stops implementation type
- * @return the Stops implementation or null when the wrong type is specified
- */
- @Nullable
- public S getStopsAs() {
- try {
- // noinspection unchecked
- return (S) stops;
- } catch (ClassCastException exception) {
- Timber.e(exception, "Stops: %s is a different type: ", stops.getClass());
- return null;
- }
- }
-
- /**
- * INTERNAL USAGE ONLY
- *
- * @return a value object representation for core conversion
- */
- public Map toValueObject() {
- return stops.toValueObject();
- }
-
- @Override
- public String toString() {
- return String.format("%s: %s", getClass().getSimpleName(), stops);
- }
-}
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/functions/SourceFunction.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/functions/SourceFunction.java
deleted file mode 100644
index 33f436ae7..000000000
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/functions/SourceFunction.java
+++ /dev/null
@@ -1,85 +0,0 @@
-package com.mapbox.mapboxsdk.style.functions;
-
-import android.support.annotation.NonNull;
-import android.support.annotation.Nullable;
-
-import com.mapbox.mapboxsdk.style.functions.stops.Stops;
-import com.mapbox.mapboxsdk.style.layers.PropertyValue;
-
-import java.util.Map;
-
-/**
- * Source functions take Feature property names as input.
- *
- * Source functions allow the appearance of a map feature to change with
- * its properties. Source functions can be used to visually differentiate
- * types of features within the same layer or create data visualizations.
- * Each stop is an array with two elements, the first is a property input
- * value and the second is a function output value. Note that support for
- * property functions is not available across all properties and platforms
- * at this time.
- *
- * @param the input type
- * @param the output type
- * @see Function#property
- */
-public class SourceFunction extends Function {
-
- private final String property;
- private PropertyValue defaultValue;
-
- SourceFunction(@NonNull String property, @NonNull Stops stops) {
- this(null, property, stops);
- }
-
- /**
- * JNI Constructor
- */
- private SourceFunction(@Nullable O defaultValue, @NonNull String property, @NonNull Stops stops) {
- super(stops);
- this.property = property;
- this.defaultValue = defaultValue != null ? new PropertyValue<>(property, defaultValue) : null;
- }
-
-
- /**
- * INTERNAL USAGE ONLY
- *
- * @return The feature property name
- */
- public String getProperty() {
- return property;
- }
-
- /**
- * Set the default value
- *
- * @param defaultValue the default value to use when no other applies
- * @return this (for chaining)
- */
- public SourceFunction withDefaultValue(PropertyValue defaultValue) {
- this.defaultValue = defaultValue;
- return this;
- }
-
- /**
- * @return the defaultValue
- */
- @Nullable
- public PropertyValue getDefaultValue() {
- return defaultValue;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Map toValueObject() {
- Map valueObject = super.toValueObject();
- valueObject.put(PROPERTY_KEY, property);
- if (defaultValue != null) {
- valueObject.put(DEFAULT_VALUE_KEY, defaultValue.value);
- }
- return valueObject;
- }
-}
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/functions/package-info.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/functions/package-info.java
deleted file mode 100644
index 6979676c9..000000000
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/functions/package-info.java
+++ /dev/null
@@ -1,6 +0,0 @@
-/**
- * Contains the Mapbox Maps Android Style Function API classes.
- *
- * @see The style specification
- */
-package com.mapbox.mapboxsdk.style.functions;
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/functions/stops/CategoricalStops.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/functions/stops/CategoricalStops.java
deleted file mode 100644
index f9b292935..000000000
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/functions/stops/CategoricalStops.java
+++ /dev/null
@@ -1,64 +0,0 @@
-package com.mapbox.mapboxsdk.style.functions.stops;
-
-import android.support.annotation.NonNull;
-import android.support.annotation.Size;
-
-import java.util.Arrays;
-import java.util.Iterator;
-import java.util.Map;
-
-/**
- * {@link Stops} implementation for categorical functions
- *
- * @param the {@link Stop} input type
- * @param the {@link Stop} output type
- */
-public class CategoricalStops extends IterableStops> {
-
- private final Stop[] stops;
-
- /**
- * Create a categorical {@link Stops} implementation. Use through {@link Stops#categorical(Stop[])}
- *
- * @param stops the stops
- */
- @SafeVarargs
- public CategoricalStops(@NonNull @Size(min = 1) Stop... stops) {
- this.stops = stops;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Map toValueObject() {
- Map map = super.toValueObject();
- map.put("stops", toValueObjects(stops));
- return map;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String getTypeName() {
- return "categorical";
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Iterator> iterator() {
- return Arrays.asList(stops).iterator();
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public int size() {
- return stops.length;
- }
-
-}
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/functions/stops/ExponentialStops.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/functions/stops/ExponentialStops.java
deleted file mode 100644
index d47aa1fc9..000000000
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/functions/stops/ExponentialStops.java
+++ /dev/null
@@ -1,97 +0,0 @@
-package com.mapbox.mapboxsdk.style.functions.stops;
-
-import android.support.annotation.NonNull;
-import android.support.annotation.Size;
-
-import java.util.Arrays;
-import java.util.Iterator;
-import java.util.Map;
-
-/**
- * The {@link Stops} implementation for exponential functions
- *
- * @param the input type
- * @param the output type
- */
-public class ExponentialStops extends IterableStops> {
-
- private float base;
- private final Stop[] stops;
-
- /**
- * Create exponential stops with an explicit base. Use through {@link Stops#exponential(Stop[])}
- *
- * @param base The exponential base of the interpolation curve. It controls the rate at which the function output
- * increases. Higher values make the output increase more towards the high end of the range.
- * With values close to 1 the output increases linearly.
- * @param stops the stops
- */
- @SafeVarargs
- public ExponentialStops(Float base, @NonNull @Size(min = 1) Stop... stops) {
- this.base = base != null ? base : 1.0f;
- this.stops = stops;
- }
-
- /**
- * Create exponential stops without an explicit base. Use through {@link Stops#exponential(Stop[])}
- *
- * @param stops the stops
- */
- @SafeVarargs
- public ExponentialStops(@NonNull @Size(min = 1) Stop... stops) {
- this(null, stops);
- }
-
- /**
- * Set the exponential base
- *
- * @param base the base to use in the exponential function
- * @return this (for chaining)
- */
- public ExponentialStops withBase(float base) {
- this.base = base;
- return this;
- }
-
- /**
- * @return The exponential base
- */
- public float getBase() {
- return base;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Map toValueObject() {
- Map map = super.toValueObject();
- map.put("base", base);
- map.put("stops", toValueObjects(stops));
- return map;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String getTypeName() {
- return "exponential";
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Iterator> iterator() {
- return Arrays.asList(stops).iterator();
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public int size() {
- return stops.length;
- }
-}
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/functions/stops/IdentityStops.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/functions/stops/IdentityStops.java
deleted file mode 100644
index 2c0b198dc..000000000
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/functions/stops/IdentityStops.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package com.mapbox.mapboxsdk.style.functions.stops;
-
-/**
- * The {@link Stops} implementation for identity functions
- *
- * @param the input/output type
- */
-public class IdentityStops extends Stops {
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected String getTypeName() {
- return "identity";
- }
-
-}
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/functions/stops/IntervalStops.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/functions/stops/IntervalStops.java
deleted file mode 100644
index 9d95b3f8c..000000000
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/functions/stops/IntervalStops.java
+++ /dev/null
@@ -1,58 +0,0 @@
-package com.mapbox.mapboxsdk.style.functions.stops;
-
-import android.support.annotation.NonNull;
-import android.support.annotation.Size;
-
-import java.util.Arrays;
-import java.util.Iterator;
-import java.util.Map;
-
-/**
- * The {@link Stops} implementation for interval functions
- *
- * @param the input type
- * @param the output type
- */
-public class IntervalStops extends IterableStops> {
-
- private final Stop[] stops;
-
- @SafeVarargs
- public IntervalStops(@NonNull @Size(min = 1) Stop... stops) {
- this.stops = stops;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String getTypeName() {
- return "interval";
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Map toValueObject() {
- Map map = super.toValueObject();
- map.put("stops", toValueObjects(stops));
- return map;
- }
-
- /**
- * @return an {@link Iterator} for the contained stops
- */
- @Override
- public Iterator> iterator() {
- return Arrays.asList(stops).iterator();
- }
-
- /**
- * @return The number of contained stops
- */
- @Override
- public int size() {
- return stops.length;
- }
-}
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/functions/stops/IterableStops.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/functions/stops/IterableStops.java
deleted file mode 100644
index 8c5a6e891..000000000
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/functions/stops/IterableStops.java
+++ /dev/null
@@ -1,52 +0,0 @@
-package com.mapbox.mapboxsdk.style.functions.stops;
-
-import java.util.Iterator;
-
-/**
- * Base class for {@link Stops} implementations with a collection of stops
- *
- * @param the {@link Stops} input type
- * @param the {@link Stops} output type
- * @param the {@link Iterable} element type (usually {@link Stop})
- */
-public abstract class IterableStops extends Stops implements Iterable {
-
- /**
- * @return The size of the contained stops collection
- */
- public abstract int size();
-
- /**
- * Convenience function to toValueObjects an array of stops to an array of value objects
- *
- * @param stops the stops to toValueObjects
- * @return the stops as value objects
- */
- Object[] toValueObjects(Stop[] stops) {
- if (stops != null) {
- Object[] stopsValue = new Object[stops.length];
-
- for (int i = 0; i < stopsValue.length; i++) {
- Stop stop = stops[i];
- stopsValue[i] = stop.toValueObject();
- }
- return stopsValue;
- }
-
- return null;
- }
-
- @Override
- public String toString() {
- StringBuilder buffer = new StringBuilder();
- Iterator iterator = iterator();
- while (iterator.hasNext()) {
- S stop = iterator.next();
- buffer.append(stop);
- if (iterator.hasNext()) {
- buffer.append(",");
- }
- }
- return String.format("%s: [%s]", super.toString(), buffer.toString());
- }
-}
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/functions/stops/Stop.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/functions/stops/Stop.java
deleted file mode 100644
index 72164f4c4..000000000
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/functions/stops/Stop.java
+++ /dev/null
@@ -1,109 +0,0 @@
-package com.mapbox.mapboxsdk.style.functions.stops;
-
-import com.mapbox.mapboxsdk.style.functions.Function;
-import com.mapbox.mapboxsdk.style.layers.PropertyValue;
-
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * A stop represents a certain point in the range of this function
- *
- * @param input the stop (function) input type
- * @param output the stop (function) output type
- * @see The style specification
- */
-public class Stop {
- /**
- * Creates a {@link Stop} to use in a {@link Function}
- *
- * @param in the input for the stop
- * @param output the output for the stop
- * @param the input property type
- * @param the output property type
- * @return the {@link Stop}
- */
- public static Stop stop(I in, PropertyValue output) {
- return new Stop<>(in, output.value);
- }
-
- /**
- * Create a composite {@link Stop} for use in a {@link com.mapbox.mapboxsdk.style.functions.CompositeFunction}
- *
- * @param zoom the zoom input
- * @param value the feature property input
- * @param output the output for the stop
- * @param the zoom type
- * @param the feature property input type
- * @param the output property type
- * @return the {@link Stop}
- * @see Function#composite(String, ExponentialStops)
- */
- public static Stop, O> stop(Z zoom,
- I value,
- PropertyValue output) {
- return new Stop<>(new Stop.CompositeValue<>(zoom, value), output.value);
- }
-
- /**
- * Represents a composite input value for composite functions (eg zoom and feature property value)
- *
- * @param the zoom input type (typically Float)
- * @param the feature property input type
- */
- public static class CompositeValue {
- public final Z zoom;
- public final V value;
-
- CompositeValue(Z zoom, V value) {
- this.zoom = zoom;
- this.value = value;
- }
-
- /**
- * INTERNAL USAGE ONLY
- *
- * @return the value object representation for core conversion
- */
- Map toValueObject() {
- HashMap map = new HashMap<>();
- map.put("zoom", zoom);
- map.put("value", value);
- return map;
- }
-
- @Override
- public String toString() {
- return String.format("[zoom: %s, value: %s]", zoom, value);
- }
- }
-
- /**
- * The input type
- */
- public final I in;
-
- /**
- * The output type
- */
- public final O out;
-
- Stop(I in, O out) {
- this.in = in;
- this.out = out;
- }
-
- /**
- * INTERNAL USAGE ONLY
- *
- * @return an array representation of the Stop
- */
- Object[] toValueObject() {
- return new Object[] {in instanceof CompositeValue ? ((CompositeValue) in).toValueObject() : in, out};
- }
-
- @Override
- public String toString() {
- return String.format("[%s, %s]", in, out);
- }
-}
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/functions/stops/Stops.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/functions/stops/Stops.java
deleted file mode 100644
index af4f53c07..000000000
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/functions/stops/Stops.java
+++ /dev/null
@@ -1,99 +0,0 @@
-package com.mapbox.mapboxsdk.style.functions.stops;
-
-import android.support.annotation.CallSuper;
-import android.support.annotation.NonNull;
-import android.support.annotation.Size;
-
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * The base class for different stops implementations
- *
- * @param the input type
- * @param the output type
- * @see The style specification
- */
-public abstract class Stops {
-
- /**
- * Convenience method for use in function declarations
- *
- * @param stops the collections of discrete stops
- * @param the Stops input type
- * @param the Stops output type
- * @return the {@link Stops} implementation
- * @see Stop#stop
- * @see CategoricalStops
- */
- @SafeVarargs
- public static CategoricalStops categorical(@NonNull @Size(min = 1) Stop... stops) {
- return new CategoricalStops<>(stops);
- }
-
- /**
- * Convenience method for use in function declarations
- *
- * @param stops the collections of discrete stops
- * @param the Stops input type
- * @param the Stops output type
- * @return the {@link Stops} implementation
- * @see Stop#stop
- * @see ExponentialStops
- */
- @SafeVarargs
- public static ExponentialStops exponential(@NonNull @Size(min = 1) Stop... stops) {
- return new ExponentialStops<>(stops);
- }
-
- /**
- * Convenience method for use in function declarations
- *
- * @param the Stops input/output type
- * @return the {@link IdentityStops} implementation
- * @see Stop#stop
- * @see IdentityStops
- */
- public static IdentityStops identity() {
- return new IdentityStops<>();
- }
-
- /**
- * Convenience method for use in function declarations
- *
- * @param stops the collections of discrete stops
- * @param the Stops input type
- * @param the Stops output type
- * @return the {@link Stops} implementation
- * @see Stop#stop
- * @see IntervalStops
- */
- @SafeVarargs
- public static IntervalStops interval(@NonNull @Size(min = 1) Stop... stops) {
- return new IntervalStops<>(stops);
- }
-
- /**
- * INTERNAL USAGE ONLY
- *
- * @return the value object representation for conversion to core
- */
- @CallSuper
- public Map toValueObject() {
- HashMap map = new HashMap<>();
- map.put("type", getTypeName());
- return map;
- }
-
- /**
- * INTERNAL USAGE ONLY
- *
- * @return the unique type name as a string according to the style specification
- */
- protected abstract String getTypeName();
-
- @Override
- public String toString() {
- return getTypeName();
- }
-}
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/functions/stops/package-info.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/functions/stops/package-info.java
deleted file mode 100644
index fa388a958..000000000
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/functions/stops/package-info.java
+++ /dev/null
@@ -1,6 +0,0 @@
-/**
- * Contains the Mapbox Maps Android Style Function Stop implementation API classes.
- *
- * @see The style specification
- */
-package com.mapbox.mapboxsdk.style.functions.stops;
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/Layer.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/Layer.java
index 5400e0458..66db88baf 100644
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/Layer.java
+++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/Layer.java
@@ -3,7 +3,6 @@ package com.mapbox.mapboxsdk.style.layers;
import android.support.annotation.NonNull;
import com.mapbox.mapboxsdk.style.expressions.Expression;
-import com.mapbox.mapboxsdk.style.functions.Function;
/**
* Base class for the different Layer types
@@ -89,12 +88,8 @@ public abstract class Layer {
}
private Object convertValue(Object value) {
- if (value != null) {
- if (value instanceof Function) {
- return ((Function) value).toValueObject();
- } else if (value instanceof Expression) {
- return ((Expression) value).toArray();
- }
+ if (value != null && value instanceof Expression) {
+ return ((Expression) value).toArray();
}
return value;
}
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 43f5be98c..66d78a40e 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
@@ -4,9 +4,7 @@ package com.mapbox.mapboxsdk.style.layers;
import android.support.annotation.ColorInt;
-import com.mapbox.mapboxsdk.style.functions.CameraFunction;
import com.mapbox.mapboxsdk.style.expressions.Expression;
-import com.mapbox.mapboxsdk.style.functions.Function;
import java.util.Locale;
@@ -27,18 +25,6 @@ public class PropertyFactory {
return new LayoutPropertyValue<>("visibility", value);
}
- /**
- * Set the property visibility.
- *
- * @param the function input type
- * @param function the visibility function
- * @return property wrapper around a String function
- */
- @Deprecated
- public static PropertyValue> visibility(Function function) {
- return new LayoutPropertyValue<>("visibility", function);
- }
-
/**
* Whether or not the fill should be antialiased.
*
@@ -59,19 +45,6 @@ public class PropertyFactory {
return new PaintPropertyValue<>("fill-antialias", expression);
}
-
- /**
- * Whether or not the fill should be antialiased.
- *
- * @param the zoom parameter type
- * @param function a wrapper {@link CameraFunction} for Boolean
- * @return property wrapper around a Boolean function
- */
- @Deprecated
- public static PropertyValue> fillAntialias(CameraFunction function) {
- return new PaintPropertyValue<>("fill-antialias", function);
- }
-
/**
* The opacity of the entire fill layer. In contrast to the {@link PropertyFactory#fillColor}, this value will also affect the 1px stroke around the fill, if the stroke is used.
*
@@ -92,19 +65,6 @@ public class PropertyFactory {
return new PaintPropertyValue<>("fill-opacity", expression);
}
-
- /**
- * The opacity of the entire fill layer. In contrast to the {@link PropertyFactory#fillColor}, this value will also affect the 1px stroke around the fill, if the stroke is used.
- *
- * @param the function input type
- * @param function a wrapper function for Float
- * @return property wrapper around a Float function
- */
- @Deprecated
- public static PropertyValue> fillOpacity(Function function) {
- return new PaintPropertyValue<>("fill-opacity", 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.
*
@@ -135,19 +95,6 @@ public class PropertyFactory {
return new PaintPropertyValue<>("fill-color", expression);
}
-
- /**
- * 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 the function input type
- * @param function a wrapper function for String
- * @return property wrapper around a String function
- */
- @Deprecated
- public static PropertyValue> fillColor(Function function) {
- return new PaintPropertyValue<>("fill-color", function);
- }
-
/**
* The outline color of the fill. Matches the value of {@link PropertyFactory#fillColor} if unspecified.
*
@@ -178,19 +125,6 @@ public class PropertyFactory {
return new PaintPropertyValue<>("fill-outline-color", expression);
}
-
- /**
- * The outline color of the fill. Matches the value of {@link PropertyFactory#fillColor} if unspecified.
- *
- * @param the function input type
- * @param function a wrapper function for String
- * @return property wrapper around a String function
- */
- @Deprecated
- public static PropertyValue> fillOutlineColor(Function function) {
- return new PaintPropertyValue<>("fill-outline-color", function);
- }
-
/**
* The geometry's offset. Values are [x, y] where negatives indicate left and up, respectively.
*
@@ -211,19 +145,6 @@ public class PropertyFactory {
return new PaintPropertyValue<>("fill-translate", expression);
}
-
- /**
- * The geometry's offset. Values are [x, y] where negatives indicate left and up, respectively.
- *
- * @param the zoom parameter type
- * @param function a wrapper {@link CameraFunction} for Float[]
- * @return property wrapper around a Float[] function
- */
- @Deprecated
- public static PropertyValue> fillTranslate(CameraFunction function) {
- return new PaintPropertyValue<>("fill-translate", function);
- }
-
/**
* Controls the frame of reference for {@link PropertyFactory#fillTranslate}.
*
@@ -244,19 +165,6 @@ public class PropertyFactory {
return new PaintPropertyValue<>("fill-translate-anchor", expression);
}
-
- /**
- * Controls the frame of reference for {@link PropertyFactory#fillTranslate}.
- *
- * @param the zoom parameter type
- * @param function a wrapper {@link CameraFunction} for String
- * @return property wrapper around a String function
- */
- @Deprecated
- public static PropertyValue> fillTranslateAnchor(CameraFunction function) {
- return new PaintPropertyValue<>("fill-translate-anchor", function);
- }
-
/**
* 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).
*
@@ -277,19 +185,6 @@ public class PropertyFactory {
return new PaintPropertyValue<>("fill-pattern", 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).
- *
- * @param the zoom parameter type
- * @param function a wrapper {@link CameraFunction} for String
- * @return property wrapper around a String function
- */
- @Deprecated
- public static PropertyValue> fillPattern(CameraFunction function) {
- return new PaintPropertyValue<>("fill-pattern", function);
- }
-
/**
* The opacity at which the line will be drawn.
*
@@ -310,19 +205,6 @@ public class PropertyFactory {
return new PaintPropertyValue<>("line-opacity", expression);
}
-
- /**
- * The opacity at which the line will be drawn.
- *
- * @param the function input type
- * @param function a wrapper function for Float
- * @return property wrapper around a Float function
- */
- @Deprecated
- public static PropertyValue> lineOpacity(Function function) {
- return new PaintPropertyValue<>("line-opacity", function);
- }
-
/**
* The color with which the line will be drawn.
*
@@ -353,19 +235,6 @@ public class PropertyFactory {
return new PaintPropertyValue<>("line-color", expression);
}
-
- /**
- * The color with which the line will be drawn.
- *
- * @param the function input type
- * @param function a wrapper function for String
- * @return property wrapper around a String function
- */
- @Deprecated
- public static PropertyValue> lineColor(Function function) {
- return new PaintPropertyValue<>("line-color", function);
- }
-
/**
* The geometry's offset. Values are [x, y] where negatives indicate left and up, respectively.
*
@@ -386,19 +255,6 @@ public class PropertyFactory {
return new PaintPropertyValue<>("line-translate", expression);
}
-
- /**
- * The geometry's offset. Values are [x, y] where negatives indicate left and up, respectively.
- *
- * @param the zoom parameter type
- * @param function a wrapper {@link CameraFunction} for Float[]
- * @return property wrapper around a Float[] function
- */
- @Deprecated
- public static PropertyValue> lineTranslate(CameraFunction function) {
- return new PaintPropertyValue<>("line-translate", function);
- }
-
/**
* Controls the frame of reference for {@link PropertyFactory#lineTranslate}.
*
@@ -419,19 +275,6 @@ public class PropertyFactory {
return new PaintPropertyValue<>("line-translate-anchor", expression);
}
-
- /**
- * Controls the frame of reference for {@link PropertyFactory#lineTranslate}.
- *
- * @param the zoom parameter type
- * @param function a wrapper {@link CameraFunction} for String
- * @return property wrapper around a String function
- */
- @Deprecated
- public static PropertyValue> lineTranslateAnchor(CameraFunction function) {
- return new PaintPropertyValue<>("line-translate-anchor", function);
- }
-
/**
* Stroke thickness.
*
@@ -452,19 +295,6 @@ public class PropertyFactory {
return new PaintPropertyValue<>("line-width", expression);
}
-
- /**
- * Stroke thickness.
- *
- * @param the function input type
- * @param function a wrapper function for Float
- * @return property wrapper around a Float function
- */
- @Deprecated
- public static PropertyValue> lineWidth(Function function) {
- return new PaintPropertyValue<>("line-width", function);
- }
-
/**
* Draws a line casing outside of a line's actual path. Value indicates the width of the inner gap.
*
@@ -485,19 +315,6 @@ public class PropertyFactory {
return new PaintPropertyValue<>("line-gap-width", expression);
}
-
- /**
- * Draws a line casing outside of a line's actual path. Value indicates the width of the inner gap.
- *
- * @param the function input type
- * @param function a wrapper function for Float
- * @return property wrapper around a Float function
- */
- @Deprecated
- public static PropertyValue> lineGapWidth(Function function) {
- return new PaintPropertyValue<>("line-gap-width", function);
- }
-
/**
* 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.
*
@@ -518,19 +335,6 @@ public class PropertyFactory {
return new PaintPropertyValue<>("line-offset", expression);
}
-
- /**
- * 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.
- *
- * @param the function input type
- * @param function a wrapper function for Float
- * @return property wrapper around a Float function
- */
- @Deprecated
- public static PropertyValue> lineOffset(Function function) {
- return new PaintPropertyValue<>("line-offset", function);
- }
-
/**
* Blur applied to the line, in density-independent pixels.
*
@@ -551,19 +355,6 @@ public class PropertyFactory {
return new PaintPropertyValue<>("line-blur", expression);
}
-
- /**
- * Blur applied to the line, in density-independent pixels.
- *
- * @param the function input type
- * @param function a wrapper function for Float
- * @return property wrapper around a Float function
- */
- @Deprecated
- public static PropertyValue> lineBlur(Function function) {
- return new PaintPropertyValue<>("line-blur", function);
- }
-
/**
* 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.
*
@@ -584,19 +375,6 @@ public class PropertyFactory {
return new PaintPropertyValue<>("line-dasharray", 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.
- *
- * @param the zoom parameter type
- * @param function a wrapper {@link CameraFunction} for Float[]
- * @return property wrapper around a Float[] function
- */
- @Deprecated
- public static PropertyValue> lineDasharray(CameraFunction function) {
- return new PaintPropertyValue<>("line-dasharray", function);
- }
-
/**
* 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).
*
@@ -617,19 +395,6 @@ public class PropertyFactory {
return new PaintPropertyValue<>("line-pattern", 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).
- *
- * @param the zoom parameter type
- * @param function a wrapper {@link CameraFunction} for String
- * @return property wrapper around a String function
- */
- @Deprecated
- public static PropertyValue> linePattern(CameraFunction function) {
- return new PaintPropertyValue<>("line-pattern", function);
- }
-
/**
* The opacity at which the icon will be drawn.
*
@@ -650,19 +415,6 @@ public class PropertyFactory {
return new PaintPropertyValue<>("icon-opacity", expression);
}
-
- /**
- * The opacity at which the icon will be drawn.
- *
- * @param the function input type
- * @param function a wrapper function for Float
- * @return property wrapper around a Float function
- */
- @Deprecated
- public static PropertyValue> iconOpacity(Function function) {
- return new PaintPropertyValue<>("icon-opacity", function);
- }
-
/**
* The color of the icon. This can only be used with sdf icons.
*
@@ -693,19 +445,6 @@ public class PropertyFactory {
return new PaintPropertyValue<>("icon-color", expression);
}
-
- /**
- * The color of the icon. This can only be used with sdf icons.
- *
- * @param the function input type
- * @param function a wrapper function for String
- * @return property wrapper around a String function
- */
- @Deprecated
- public static PropertyValue> iconColor(Function function) {
- return new PaintPropertyValue<>("icon-color", function);
- }
-
/**
* The color of the icon's halo. Icon halos can only be used with SDF icons.
*
@@ -736,19 +475,6 @@ public class PropertyFactory {
return new PaintPropertyValue<>("icon-halo-color", expression);
}
-
- /**
- * The color of the icon's halo. Icon halos can only be used with SDF icons.
- *
- * @param the function input type
- * @param function a wrapper function for String
- * @return property wrapper around a String function
- */
- @Deprecated
- public static PropertyValue> iconHaloColor(Function