diff options
Diffstat (limited to 'platform/android/MapboxGLAndroidSDK')
19 files changed, 205 insertions, 2664 deletions
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 0cd5aa9d6c..f6caa0b8e3 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 <a href="https://www.mapbox.com/mapbox-gl-js/style-spec/#expressions-all">Style specification</a> */ - public static Expression all(@NonNull Expression... input) { return new Expression("all", input); } @@ -494,7 +481,6 @@ public class Expression { * @return expression * @see <a href="https://www.mapbox.com/mapbox-gl-js/style-spec/#expressions-any">Style specification</a> */ - public static Expression any(@NonNull Expression... input) { return new Expression("any", input); } @@ -532,7 +518,6 @@ public class Expression { * @return expression * @see <a href="https://www.mapbox.com/mapbox-gl-js/style-spec/#expressions-case">Style specification</a> */ - 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 <a href="https://www.mapbox.com/mapbox-gl-js/style-spec/#expressions-+">Style specification</a> */ - public static Expression sum(@Size(min = 2) Expression... numbers) { return new Expression("+", numbers); } @@ -829,7 +801,6 @@ public class Expression { * @return expression * @see <a href="https://www.mapbox.com/mapbox-gl-js/style-spec/#expressions-+">Style specification</a> */ - 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 <a href="https://www.mapbox.com/mapbox-gl-js/style-spec/#expressions-*">Style specification</a> */ - public static Expression product(@Size(min = 2) Expression... numbers) { return new Expression("*", numbers); } @@ -857,7 +827,6 @@ public class Expression { * @return expression * @see <a href="https://www.mapbox.com/mapbox-gl-js/style-spec/#expressions-*">Style specification</a> */ - 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 <a href="https://www.mapbox.com/mapbox-gl-js/style-spec/#expressions-min">Style specification</a> */ - public static Expression min(@Size(min = 1) Expression... numbers) { return new Expression("min", numbers); } @@ -1227,7 +1191,6 @@ public class Expression { * @return expression * @see <a href="https://www.mapbox.com/mapbox-gl-js/style-spec/#expressions-min">Style specification</a> */ - 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 <a href="https://www.mapbox.com/mapbox-gl-js/style-spec/#expressions-max">Style specification</a> */ - public static Expression max(@Size(min = 1) Expression... numbers) { return new Expression("max", numbers); } @@ -1255,7 +1217,6 @@ public class Expression { * @return expression * @see <a href="https://www.mapbox.com/mapbox-gl-js/style-spec/#expressions-max">Style specification</a> */ - 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 <a href="https://www.mapbox.com/mapbox-gl-js/style-spec/#expressions-concat">Style specification</a> */ - public static Expression concat(@NonNull Expression... input) { return new Expression("concat", input); } @@ -1343,7 +1303,6 @@ public class Expression { * @return expression * @see <a href="https://www.mapbox.com/mapbox-gl-js/style-spec/#expressions-concat">Style specification</a> */ - 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 <a href="https://www.mapbox.com/mapbox-gl-js/style-spec/#expressions-let">Style specification</a> */ - public static Expression let(@Size(min = 1) Expression... input) { return new Expression("let", input); } @@ -1565,7 +1515,6 @@ public class Expression { * @return expression * @see <a href="https://www.mapbox.com/mapbox-gl-js/style-spec/#expressions-step">Style specification</a> */ - 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 <a href="https://www.mapbox.com/mapbox-gl-js/style-spec/#expressions-step">Style specification</a> */ - 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 <a href="https://www.mapbox.com/mapbox-gl-js/style-spec/#expressions-step">Style specification</a> */ - 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 <a href="https://www.mapbox.com/mapbox-gl-js/style-spec/#expressions-step">Style specification</a> */ - 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 <a href="https://www.mapbox.com/mapbox-gl-js/style-spec/#expressions-interpolate">Style specification</a> */ - 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 <a href="https://www.mapbox.com/mapbox-gl-js/style-spec/#expressions-interpolate">Style specification</a> */ - 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. * @@ -1835,33 +1752,115 @@ public class Expression { } /** + * 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. * <p> * ExpressionLiteral is created with {@link #literal(Number)}, {@link #literal(boolean)}, * {@link #literal(String)} and {@link #literal(Object)}. * </p> */ - 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<Expression> 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 74c68cf574..0000000000 --- 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) - * <p> - * 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 <I> the input type - * @param <O> the output type - * @see Function#zoom - */ -public class CameraFunction<I extends Number, O> extends Function<I, O> { - - /** - * Create an exponential camera function - * - * @param stops @see {@link com.mapbox.mapboxsdk.style.functions.stops.Stops#exponential(float, Stop[])} - */ - CameraFunction(@NonNull ExponentialStops<I, O> stops) { - super(stops); - } - - /** - * Create an interval camera function - * - * @param stops @see {@link com.mapbox.mapboxsdk.style.functions.stops.Stops#interval(Stop[])} - */ - CameraFunction(@NonNull IntervalStops<I, O> stops) { - super(stops); - } - - /** - * JNI constructor - */ - @Keep - private CameraFunction(Stops<I, O> 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 15e4474105..0000000000 --- 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. - * <p> - * 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 <Z> the zoom type (usually Float) - * @param <I> the input type (the feature property type) - * @param <O> the output type (the property type) - * @see Function#composite - */ -public class CompositeFunction<Z extends Number, I, O> extends Function<Stop.CompositeValue<Z, I>, O> { - - private final String property; - private PropertyValue<O> defaultValue; - - CompositeFunction(@NonNull String property, - @NonNull CategoricalStops<Stop.CompositeValue<Z, I>, O> stops) { - this(null, property, stops); - } - - CompositeFunction(@NonNull String property, - @NonNull ExponentialStops<Stop.CompositeValue<Z, I>, O> stops) { - this(null, property, stops); - } - - CompositeFunction(@NonNull String property, - @NonNull IntervalStops<Stop.CompositeValue<Z, I>, O> stops) { - this(null, property, stops); - } - - - /** - * JNI Constructor - */ - private CompositeFunction(@Nullable O defaultValue, @NonNull String property, - @NonNull Stops<Stop.CompositeValue<Z, I>, 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<Z, I, O> withDefaultValue(PropertyValue<O> defaultValue) { - this.defaultValue = defaultValue; - return this; - } - - /** - * @return the defaultValue - */ - @Nullable - public PropertyValue<O> getDefaultValue() { - return defaultValue; - } - - /** - * INTERNAL USAGE ONLY - * - * @return the feature property name - */ - public String getProperty() { - return property; - } - - /** - * {@inheritDoc} - */ - @Override - public Map<String, Object> toValueObject() { - Map<String, Object> 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 80ff4198fc..0000000000 --- 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. - * <p> - * 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 <I> the function's input type - * @param <O> the target property's value type. Make sure it matches. - * @see <a href="https://www.mapbox.com/mapbox-gl-style-spec/#types-function">The style specification</a> - */ -public class Function<I, O> { - - static final String PROPERTY_KEY = "property"; - static final String DEFAULT_VALUE_KEY = "default"; - - /** - * Create an exponential {@link CameraFunction} - * <p> - * 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 <Z> the zoom level type (Float, Integer) - * @param <O> 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 <Z extends Number, O> CameraFunction<Z, O> zoom(@NonNull ExponentialStops<Z, O> stops) { - return new CameraFunction<>(stops); - } - - /** - * Create an interval {@link CameraFunction} - * <p> - * 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 <Z> the zoom level type (Float, Integer) - * @param <O> 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 <Z extends Number, O> CameraFunction<Z, O> zoom(@NonNull IntervalStops<Z, O> stops) { - return new CameraFunction<>(stops); - } - - /** - * Create an exponential {@link SourceFunction} - * <p> - * 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 <I> the function input type - * @param <O> the function output type - * @return the {@link SourceFunction} - * @see SourceFunction - * @see ExponentialStops - * @see Stops#exponential(Stop[]) - * @see Stop#stop - */ - public static <I, O> SourceFunction<I, O> property(@NonNull String property, @NonNull ExponentialStops<I, O> stops) { - return new SourceFunction<>(property, stops); - } - - /** - * Create an identity {@link SourceFunction} - * <p> - * 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 <T> the function input/output type - * @return the {@link SourceFunction} - * @see SourceFunction - * @see IdentityStops - * @see Stops#identity() - * @see Stop#stop - */ - public static <T> SourceFunction<T, T> property(@NonNull String property, @NonNull IdentityStops<T> stops) { - return new SourceFunction<>(property, stops); - } - - /** - * Create an interval {@link SourceFunction} - * <p> - * 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 <I> the function input type - * @param <O> the function output type - * @return the {@link SourceFunction} - * @see SourceFunction - * @see IntervalStops - * @see Stops#interval(Stop[]) - * @see Stop#stop - */ - public static <I, O> SourceFunction<I, O> property(@NonNull String property, @NonNull IntervalStops<I, O> stops) { - return new SourceFunction<>(property, stops); - } - - /** - * Create an categorical {@link SourceFunction} - * <p> - * 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 <I> the function input type - * @param <O> the function output type - * @return the {@link SourceFunction} - * @see SourceFunction - * @see CategoricalStops - * @see Stops#categorical(Stop[]) - * @see Stop#stop - */ - public static <I, O> SourceFunction<I, O> property(@NonNull String property, @NonNull CategoricalStops<I, O> stops) { - return new SourceFunction<>(property, stops); - } - - /** - * Create a composite, categorical function. - * <p> - * 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 <Z> the zoom function input type (Float usually) - * @param <I> the function input type for the source part of the function - * @param <O> the function output type - * @return the {@link CompositeFunction} - * @see CompositeFunction - * @see CategoricalStops - * @see Stops#categorical(Stop[]) - * @see Stop#stop - */ - public static <Z extends Number, I, O> CompositeFunction<Z, I, O> composite( - @NonNull String property, - @NonNull CategoricalStops<Stop.CompositeValue<Z, I>, O> stops) { - - return new CompositeFunction<>(property, stops); - } - - /** - * Create a composite, exponential function. - * <p> - * 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 <Z> the zoom function input type (Float usually) - * @param <I> the function input type for the source part of the function - * @param <O> the function output type - * @return the {@link CompositeFunction} - * @see CompositeFunction - * @see ExponentialStops - * @see Stops#exponential(Stop[]) - * @see Stop#stop - */ - public static <Z extends Number, I, O> CompositeFunction<Z, I, O> composite( - @NonNull String property, - @NonNull ExponentialStops<Stop.CompositeValue<Z, I>, O> stops) { - - return new CompositeFunction<>(property, stops); - } - - /** - * Create a composite, interval function. - * <p> - * 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 <Z> the zoom function input type (Float usually) - * @param <I> the function input type for the source part of the function - * @param <O> the function output type - * @return the {@link CompositeFunction} - * @see CompositeFunction - * @see IntervalStops - * @see Stops#interval(Stop[]) - * @see Stop#stop - */ - public static <Z extends Number, I, O> CompositeFunction<Z, I, O> composite( - @NonNull String property, - @NonNull IntervalStops<Stop.CompositeValue<Z, I>, O> stops) { - - return new CompositeFunction<>(property, stops); - } - - // Class definition // - - private final Stops<I, O> stops; - - /** - * JNI Cosntructor for implementation classes - * - * @param stops the stops - */ - Function(@NonNull Stops<I, O> stops) { - this.stops = stops; - } - - /** - * @return the stops in this function - */ - public Stops getStops() { - return stops; - } - - /** - * Convenience method - * - * @param <S> the Stops implementation type - * @return the Stops implementation or null when the wrong type is specified - */ - @Nullable - public <S extends Stops> 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<String, Object> 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 33f436ae71..0000000000 --- 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. - * <p> - * 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 <I> the input type - * @param <O> the output type - * @see Function#property - */ -public class SourceFunction<I, O> extends Function<I, O> { - - private final String property; - private PropertyValue<O> defaultValue; - - SourceFunction(@NonNull String property, @NonNull Stops<I, O> stops) { - this(null, property, stops); - } - - /** - * JNI Constructor - */ - private SourceFunction(@Nullable O defaultValue, @NonNull String property, @NonNull Stops<I, O> 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<I, O> withDefaultValue(PropertyValue<O> defaultValue) { - this.defaultValue = defaultValue; - return this; - } - - /** - * @return the defaultValue - */ - @Nullable - public PropertyValue<O> getDefaultValue() { - return defaultValue; - } - - /** - * {@inheritDoc} - */ - @Override - public Map<String, Object> toValueObject() { - Map<String, Object> 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 6979676c9e..0000000000 --- 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 <a href="https://www.mapbox.com/mapbox-gl-style-spec/#types-function">The style specification</a> - */ -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 f9b2929350..0000000000 --- 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 <I> the {@link Stop} input type - * @param <O> the {@link Stop} output type - */ -public class CategoricalStops<I, O> extends IterableStops<I, O, Stop<I, O>> { - - private final Stop<I, O>[] 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<I, O>... stops) { - this.stops = stops; - } - - /** - * {@inheritDoc} - */ - @Override - public Map<String, Object> toValueObject() { - Map<String, Object> map = super.toValueObject(); - map.put("stops", toValueObjects(stops)); - return map; - } - - /** - * {@inheritDoc} - */ - @Override - public String getTypeName() { - return "categorical"; - } - - /** - * {@inheritDoc} - */ - @Override - public Iterator<Stop<I, O>> 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 d47aa1fc91..0000000000 --- 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 <I> the input type - * @param <O> the output type - */ -public class ExponentialStops<I, O> extends IterableStops<I, O, Stop<I, O>> { - - private float base; - private final Stop<I, O>[] 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<I, O>... 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<I, O>... stops) { - this(null, stops); - } - - /** - * Set the exponential base - * - * @param base the base to use in the exponential function - * @return this (for chaining) - */ - public ExponentialStops<I, O> withBase(float base) { - this.base = base; - return this; - } - - /** - * @return The exponential base - */ - public float getBase() { - return base; - } - - /** - * {@inheritDoc} - */ - @Override - public Map<String, Object> toValueObject() { - Map<String, Object> 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<Stop<I, O>> 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 2c0b198dc2..0000000000 --- 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 <T> the input/output type - */ -public class IdentityStops<T> extends Stops<T, T> { - - /** - * {@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 9d95b3f8c1..0000000000 --- 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 <I> the input type - * @param <O> the output type - */ -public class IntervalStops<I, O> extends IterableStops<I, O, Stop<I, O>> { - - private final Stop<I, O>[] stops; - - @SafeVarargs - public IntervalStops(@NonNull @Size(min = 1) Stop<I, O>... stops) { - this.stops = stops; - } - - /** - * {@inheritDoc} - */ - @Override - public String getTypeName() { - return "interval"; - } - - /** - * {@inheritDoc} - */ - @Override - public Map<String, Object> toValueObject() { - Map<String, Object> map = super.toValueObject(); - map.put("stops", toValueObjects(stops)); - return map; - } - - /** - * @return an {@link Iterator} for the contained stops - */ - @Override - public Iterator<Stop<I, O>> 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 8c5a6e8913..0000000000 --- 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 <I> the {@link Stops} input type - * @param <O> the {@link Stops} output type - * @param <S> the {@link Iterable} element type (usually {@link Stop}) - */ -public abstract class IterableStops<I, O, S> extends Stops<I, O> implements Iterable<S> { - - /** - * @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<I, O>[] 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<S> 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 72164f4c4b..0000000000 --- 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 <I> input the stop (function) input type - * @param <O> output the stop (function) output type - * @see <a href="https://www.mapbox.com/mapbox-gl-style-spec/#types-function">The style specification</a> - */ -public class Stop<I, O> { - /** - * 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 <I> the input property type - * @param <O> the output property type - * @return the {@link Stop} - */ - public static <I, O> Stop<I, O> stop(I in, PropertyValue<O> 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 <Z> the zoom type - * @param <I> the feature property input type - * @param <O> the output property type - * @return the {@link Stop} - * @see Function#composite(String, ExponentialStops) - */ - public static <Z extends Number, I, O> Stop<Stop.CompositeValue<Z, I>, O> stop(Z zoom, - I value, - PropertyValue<O> 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 <Z> the zoom input type (typically Float) - * @param <V> the feature property input type - */ - public static class CompositeValue<Z extends Number, V> { - 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<String, Object> toValueObject() { - HashMap<String, Object> 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 af4f53c072..0000000000 --- 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 <I> the input type - * @param <O> the output type - * @see <a href="https://www.mapbox.com/mapbox-gl-style-spec/#types-function">The style specification</a> - */ -public abstract class Stops<I, O> { - - /** - * Convenience method for use in function declarations - * - * @param stops the collections of discrete stops - * @param <I> the Stops input type - * @param <O> the Stops output type - * @return the {@link Stops} implementation - * @see Stop#stop - * @see CategoricalStops - */ - @SafeVarargs - public static <I, O> CategoricalStops<I, O> categorical(@NonNull @Size(min = 1) Stop<I, O>... stops) { - return new CategoricalStops<>(stops); - } - - /** - * Convenience method for use in function declarations - * - * @param stops the collections of discrete stops - * @param <I> the Stops input type - * @param <O> the Stops output type - * @return the {@link Stops} implementation - * @see Stop#stop - * @see ExponentialStops - */ - @SafeVarargs - public static <I, O> ExponentialStops<I, O> exponential(@NonNull @Size(min = 1) Stop<I, O>... stops) { - return new ExponentialStops<>(stops); - } - - /** - * Convenience method for use in function declarations - * - * @param <T> the Stops input/output type - * @return the {@link IdentityStops} implementation - * @see Stop#stop - * @see IdentityStops - */ - public static <T> IdentityStops<T> identity() { - return new IdentityStops<>(); - } - - /** - * Convenience method for use in function declarations - * - * @param stops the collections of discrete stops - * @param <I> the Stops input type - * @param <O> the Stops output type - * @return the {@link Stops} implementation - * @see Stop#stop - * @see IntervalStops - */ - @SafeVarargs - public static <I, O> IntervalStops<I, O> interval(@NonNull @Size(min = 1) Stop<I, O>... stops) { - return new IntervalStops<>(stops); - } - - /** - * INTERNAL USAGE ONLY - * - * @return the value object representation for conversion to core - */ - @CallSuper - public Map<String, Object> toValueObject() { - HashMap<String, Object> 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 fa388a9589..0000000000 --- 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 <a href="https://www.mapbox.com/mapbox-gl-style-spec/#types-function">The style specification</a> - */ -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 5400e04589..66db88bafb 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 43f5be98cb..66d78a40e5 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; @@ -28,18 +26,6 @@ public class PropertyFactory { } /** - * Set the property visibility. - * - * @param <T> the function input type - * @param function the visibility function - * @return property wrapper around a String function - */ - @Deprecated - public static <T> PropertyValue<Function<T, String>> visibility(Function<T, String> function) { - return new LayoutPropertyValue<>("visibility", function); - } - - /** * Whether or not the fill should be antialiased. * * @param value a Boolean value @@ -59,19 +45,6 @@ public class PropertyFactory { return new PaintPropertyValue<>("fill-antialias", expression); } - - /** - * Whether or not the fill should be antialiased. - * - * @param <Z> the zoom parameter type - * @param function a wrapper {@link CameraFunction} for Boolean - * @return property wrapper around a Boolean function - */ - @Deprecated - public static <Z extends Number> PropertyValue<CameraFunction<Z, Boolean>> fillAntialias(CameraFunction<Z, Boolean> 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 <T> the function input type - * @param function a wrapper function for Float - * @return property wrapper around a Float function - */ - @Deprecated - public static <T> PropertyValue<Function<T, Float>> fillOpacity(Function<T, Float> 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 <T> the function input type - * @param function a wrapper function for String - * @return property wrapper around a String function - */ - @Deprecated - public static <T> PropertyValue<Function<T, String>> fillColor(Function<T, String> 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 <T> the function input type - * @param function a wrapper function for String - * @return property wrapper around a String function - */ - @Deprecated - public static <T> PropertyValue<Function<T, String>> fillOutlineColor(Function<T, String> 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 <Z> the zoom parameter type - * @param function a wrapper {@link CameraFunction} for Float[] - * @return property wrapper around a Float[] function - */ - @Deprecated - public static <Z extends Number> PropertyValue<CameraFunction<Z, Float[]>> fillTranslate(CameraFunction<Z, Float[]> 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 <Z> the zoom parameter type - * @param function a wrapper {@link CameraFunction} for String - * @return property wrapper around a String function - */ - @Deprecated - public static <Z extends Number> PropertyValue<CameraFunction<Z, String>> fillTranslateAnchor(CameraFunction<Z, String> 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 <Z> the zoom parameter type - * @param function a wrapper {@link CameraFunction} for String - * @return property wrapper around a String function - */ - @Deprecated - public static <Z extends Number> PropertyValue<CameraFunction<Z, String>> fillPattern(CameraFunction<Z, String> 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 <T> the function input type - * @param function a wrapper function for Float - * @return property wrapper around a Float function - */ - @Deprecated - public static <T> PropertyValue<Function<T, Float>> lineOpacity(Function<T, Float> 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 <T> the function input type - * @param function a wrapper function for String - * @return property wrapper around a String function - */ - @Deprecated - public static <T> PropertyValue<Function<T, String>> lineColor(Function<T, String> 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 <Z> the zoom parameter type - * @param function a wrapper {@link CameraFunction} for Float[] - * @return property wrapper around a Float[] function - */ - @Deprecated - public static <Z extends Number> PropertyValue<CameraFunction<Z, Float[]>> lineTranslate(CameraFunction<Z, Float[]> 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 <Z> the zoom parameter type - * @param function a wrapper {@link CameraFunction} for String - * @return property wrapper around a String function - */ - @Deprecated - public static <Z extends Number> PropertyValue<CameraFunction<Z, String>> lineTranslateAnchor(CameraFunction<Z, String> 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 <T> the function input type - * @param function a wrapper function for Float - * @return property wrapper around a Float function - */ - @Deprecated - public static <T> PropertyValue<Function<T, Float>> lineWidth(Function<T, Float> 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 <T> the function input type - * @param function a wrapper function for Float - * @return property wrapper around a Float function - */ - @Deprecated - public static <T> PropertyValue<Function<T, Float>> lineGapWidth(Function<T, Float> 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 <T> the function input type - * @param function a wrapper function for Float - * @return property wrapper around a Float function - */ - @Deprecated - public static <T> PropertyValue<Function<T, Float>> lineOffset(Function<T, Float> 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 <T> the function input type - * @param function a wrapper function for Float - * @return property wrapper around a Float function - */ - @Deprecated - public static <T> PropertyValue<Function<T, Float>> lineBlur(Function<T, Float> 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 <Z> the zoom parameter type - * @param function a wrapper {@link CameraFunction} for Float[] - * @return property wrapper around a Float[] function - */ - @Deprecated - public static <Z extends Number> PropertyValue<CameraFunction<Z, Float[]>> lineDasharray(CameraFunction<Z, Float[]> 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 <Z> the zoom parameter type - * @param function a wrapper {@link CameraFunction} for String - * @return property wrapper around a String function - */ - @Deprecated - public static <Z extends Number> PropertyValue<CameraFunction<Z, String>> linePattern(CameraFunction<Z, String> 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 <T> the function input type - * @param function a wrapper function for Float - * @return property wrapper around a Float function - */ - @Deprecated - public static <T> PropertyValue<Function<T, Float>> iconOpacity(Function<T, Float> 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 <T> the function input type - * @param function a wrapper function for String - * @return property wrapper around a String function - */ - @Deprecated - public static <T> PropertyValue<Function<T, String>> iconColor(Function<T, String> 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 <T> the function input type - * @param function a wrapper function for String - * @return property wrapper around a String function - */ - @Deprecated - public static <T> PropertyValue<Function<T, String>> iconHaloColor(Function<T, String> function) { - return new PaintPropertyValue<>("icon-halo-color", function); - } - /** * Distance of halo to the icon outline. * @@ -769,19 +495,6 @@ public class PropertyFactory { return new PaintPropertyValue<>("icon-halo-width", expression); } - - /** - * Distance of halo to the icon outline. - * - * @param <T> the function input type - * @param function a wrapper function for Float - * @return property wrapper around a Float function - */ - @Deprecated - public static <T> PropertyValue<Function<T, Float>> iconHaloWidth(Function<T, Float> function) { - return new PaintPropertyValue<>("icon-halo-width", function); - } - /** * Fade out the halo towards the outside. * @@ -802,19 +515,6 @@ public class PropertyFactory { return new PaintPropertyValue<>("icon-halo-blur", expression); } - - /** - * Fade out the halo towards the outside. - * - * @param <T> the function input type - * @param function a wrapper function for Float - * @return property wrapper around a Float function - */ - @Deprecated - public static <T> PropertyValue<Function<T, Float>> iconHaloBlur(Function<T, Float> function) { - return new PaintPropertyValue<>("icon-halo-blur", function); - } - /** * Distance that the icon's anchor is moved from its original placement. Positive values indicate right and down, while negative values indicate left and up. * @@ -835,19 +535,6 @@ public class PropertyFactory { return new PaintPropertyValue<>("icon-translate", expression); } - - /** - * Distance that the icon's anchor is moved from its original placement. Positive values indicate right and down, while negative values indicate left and up. - * - * @param <Z> the zoom parameter type - * @param function a wrapper {@link CameraFunction} for Float[] - * @return property wrapper around a Float[] function - */ - @Deprecated - public static <Z extends Number> PropertyValue<CameraFunction<Z, Float[]>> iconTranslate(CameraFunction<Z, Float[]> function) { - return new PaintPropertyValue<>("icon-translate", function); - } - /** * Controls the frame of reference for {@link PropertyFactory#iconTranslate}. * @@ -868,19 +555,6 @@ public class PropertyFactory { return new PaintPropertyValue<>("icon-translate-anchor", expression); } - - /** - * Controls the frame of reference for {@link PropertyFactory#iconTranslate}. - * - * @param <Z> the zoom parameter type - * @param function a wrapper {@link CameraFunction} for String - * @return property wrapper around a String function - */ - @Deprecated - public static <Z extends Number> PropertyValue<CameraFunction<Z, String>> iconTranslateAnchor(CameraFunction<Z, String> function) { - return new PaintPropertyValue<>("icon-translate-anchor", function); - } - /** * The opacity at which the text will be drawn. * @@ -901,19 +575,6 @@ public class PropertyFactory { return new PaintPropertyValue<>("text-opacity", expression); } - - /** - * The opacity at which the text will be drawn. - * - * @param <T> the function input type - * @param function a wrapper function for Float - * @return property wrapper around a Float function - */ - @Deprecated - public static <T> PropertyValue<Function<T, Float>> textOpacity(Function<T, Float> function) { - return new PaintPropertyValue<>("text-opacity", function); - } - /** * The color with which the text will be drawn. * @@ -944,19 +605,6 @@ public class PropertyFactory { return new PaintPropertyValue<>("text-color", expression); } - - /** - * The color with which the text will be drawn. - * - * @param <T> the function input type - * @param function a wrapper function for String - * @return property wrapper around a String function - */ - @Deprecated - public static <T> PropertyValue<Function<T, String>> textColor(Function<T, String> function) { - return new PaintPropertyValue<>("text-color", function); - } - /** * The color of the text's halo, which helps it stand out from backgrounds. * @@ -987,19 +635,6 @@ public class PropertyFactory { return new PaintPropertyValue<>("text-halo-color", expression); } - - /** - * The color of the text's halo, which helps it stand out from backgrounds. - * - * @param <T> the function input type - * @param function a wrapper function for String - * @return property wrapper around a String function - */ - @Deprecated - public static <T> PropertyValue<Function<T, String>> textHaloColor(Function<T, String> function) { - return new PaintPropertyValue<>("text-halo-color", function); - } - /** * Distance of halo to the font outline. Max text halo width is 1/4 of the font-size. * @@ -1020,19 +655,6 @@ public class PropertyFactory { return new PaintPropertyValue<>("text-halo-width", expression); } - - /** - * Distance of halo to the font outline. Max text halo width is 1/4 of the font-size. - * - * @param <T> the function input type - * @param function a wrapper function for Float - * @return property wrapper around a Float function - */ - @Deprecated - public static <T> PropertyValue<Function<T, Float>> textHaloWidth(Function<T, Float> function) { - return new PaintPropertyValue<>("text-halo-width", function); - } - /** * The halo's fadeout distance towards the outside. * @@ -1053,19 +675,6 @@ public class PropertyFactory { return new PaintPropertyValue<>("text-halo-blur", expression); } - - /** - * The halo's fadeout distance towards the outside. - * - * @param <T> the function input type - * @param function a wrapper function for Float - * @return property wrapper around a Float function - */ - @Deprecated - public static <T> PropertyValue<Function<T, Float>> textHaloBlur(Function<T, Float> function) { - return new PaintPropertyValue<>("text-halo-blur", function); - } - /** * Distance that the text's anchor is moved from its original placement. Positive values indicate right and down, while negative values indicate left and up. * @@ -1086,19 +695,6 @@ public class PropertyFactory { return new PaintPropertyValue<>("text-translate", expression); } - - /** - * Distance that the text's anchor is moved from its original placement. Positive values indicate right and down, while negative values indicate left and up. - * - * @param <Z> the zoom parameter type - * @param function a wrapper {@link CameraFunction} for Float[] - * @return property wrapper around a Float[] function - */ - @Deprecated - public static <Z extends Number> PropertyValue<CameraFunction<Z, Float[]>> textTranslate(CameraFunction<Z, Float[]> function) { - return new PaintPropertyValue<>("text-translate", function); - } - /** * Controls the frame of reference for {@link PropertyFactory#textTranslate}. * @@ -1119,19 +715,6 @@ public class PropertyFactory { return new PaintPropertyValue<>("text-translate-anchor", expression); } - - /** - * Controls the frame of reference for {@link PropertyFactory#textTranslate}. - * - * @param <Z> the zoom parameter type - * @param function a wrapper {@link CameraFunction} for String - * @return property wrapper around a String function - */ - @Deprecated - public static <Z extends Number> PropertyValue<CameraFunction<Z, String>> textTranslateAnchor(CameraFunction<Z, String> function) { - return new PaintPropertyValue<>("text-translate-anchor", function); - } - /** * Circle radius. * @@ -1152,19 +735,6 @@ public class PropertyFactory { return new PaintPropertyValue<>("circle-radius", expression); } - - /** - * Circle radius. - * - * @param <T> the function input type - * @param function a wrapper function for Float - * @return property wrapper around a Float function - */ - @Deprecated - public static <T> PropertyValue<Function<T, Float>> circleRadius(Function<T, Float> function) { - return new PaintPropertyValue<>("circle-radius", function); - } - /** * The fill color of the circle. * @@ -1195,19 +765,6 @@ public class PropertyFactory { return new PaintPropertyValue<>("circle-color", expression); } - - /** - * The fill color of the circle. - * - * @param <T> the function input type - * @param function a wrapper function for String - * @return property wrapper around a String function - */ - @Deprecated - public static <T> PropertyValue<Function<T, String>> circleColor(Function<T, String> function) { - return new PaintPropertyValue<>("circle-color", function); - } - /** * Amount to blur the circle. 1 blurs the circle such that only the centerpoint is full opacity. * @@ -1228,19 +785,6 @@ public class PropertyFactory { return new PaintPropertyValue<>("circle-blur", expression); } - - /** - * Amount to blur the circle. 1 blurs the circle such that only the centerpoint is full opacity. - * - * @param <T> the function input type - * @param function a wrapper function for Float - * @return property wrapper around a Float function - */ - @Deprecated - public static <T> PropertyValue<Function<T, Float>> circleBlur(Function<T, Float> function) { - return new PaintPropertyValue<>("circle-blur", function); - } - /** * The opacity at which the circle will be drawn. * @@ -1261,19 +805,6 @@ public class PropertyFactory { return new PaintPropertyValue<>("circle-opacity", expression); } - - /** - * The opacity at which the circle will be drawn. - * - * @param <T> the function input type - * @param function a wrapper function for Float - * @return property wrapper around a Float function - */ - @Deprecated - public static <T> PropertyValue<Function<T, Float>> circleOpacity(Function<T, Float> function) { - return new PaintPropertyValue<>("circle-opacity", function); - } - /** * The geometry's offset. Values are [x, y] where negatives indicate left and up, respectively. * @@ -1294,19 +825,6 @@ public class PropertyFactory { return new PaintPropertyValue<>("circle-translate", expression); } - - /** - * The geometry's offset. Values are [x, y] where negatives indicate left and up, respectively. - * - * @param <Z> the zoom parameter type - * @param function a wrapper {@link CameraFunction} for Float[] - * @return property wrapper around a Float[] function - */ - @Deprecated - public static <Z extends Number> PropertyValue<CameraFunction<Z, Float[]>> circleTranslate(CameraFunction<Z, Float[]> function) { - return new PaintPropertyValue<>("circle-translate", function); - } - /** * Controls the frame of reference for {@link PropertyFactory#circleTranslate}. * @@ -1327,19 +845,6 @@ public class PropertyFactory { return new PaintPropertyValue<>("circle-translate-anchor", expression); } - - /** - * Controls the frame of reference for {@link PropertyFactory#circleTranslate}. - * - * @param <Z> the zoom parameter type - * @param function a wrapper {@link CameraFunction} for String - * @return property wrapper around a String function - */ - @Deprecated - public static <Z extends Number> PropertyValue<CameraFunction<Z, String>> circleTranslateAnchor(CameraFunction<Z, String> function) { - return new PaintPropertyValue<>("circle-translate-anchor", function); - } - /** * Controls the scaling behavior of the circle when the map is pitched. * @@ -1360,19 +865,6 @@ public class PropertyFactory { return new PaintPropertyValue<>("circle-pitch-scale", expression); } - - /** - * Controls the scaling behavior of the circle when the map is pitched. - * - * @param <Z> the zoom parameter type - * @param function a wrapper {@link CameraFunction} for String - * @return property wrapper around a String function - */ - @Deprecated - public static <Z extends Number> PropertyValue<CameraFunction<Z, String>> circlePitchScale(CameraFunction<Z, String> function) { - return new PaintPropertyValue<>("circle-pitch-scale", function); - } - /** * Orientation of circle when map is pitched. * @@ -1393,19 +885,6 @@ public class PropertyFactory { return new PaintPropertyValue<>("circle-pitch-alignment", expression); } - - /** - * Orientation of circle when map is pitched. - * - * @param <Z> the zoom parameter type - * @param function a wrapper {@link CameraFunction} for String - * @return property wrapper around a String function - */ - @Deprecated - public static <Z extends Number> PropertyValue<CameraFunction<Z, String>> circlePitchAlignment(CameraFunction<Z, String> function) { - return new PaintPropertyValue<>("circle-pitch-alignment", function); - } - /** * The width of the circle's stroke. Strokes are placed outside of the {@link PropertyFactory#circleRadius}. * @@ -1426,19 +905,6 @@ public class PropertyFactory { return new PaintPropertyValue<>("circle-stroke-width", expression); } - - /** - * The width of the circle's stroke. Strokes are placed outside of the {@link PropertyFactory#circleRadius}. - * - * @param <T> the function input type - * @param function a wrapper function for Float - * @return property wrapper around a Float function - */ - @Deprecated - public static <T> PropertyValue<Function<T, Float>> circleStrokeWidth(Function<T, Float> function) { - return new PaintPropertyValue<>("circle-stroke-width", function); - } - /** * The stroke color of the circle. * @@ -1469,19 +935,6 @@ public class PropertyFactory { return new PaintPropertyValue<>("circle-stroke-color", expression); } - - /** - * The stroke color of the circle. - * - * @param <T> the function input type - * @param function a wrapper function for String - * @return property wrapper around a String function - */ - @Deprecated - public static <T> PropertyValue<Function<T, String>> circleStrokeColor(Function<T, String> function) { - return new PaintPropertyValue<>("circle-stroke-color", function); - } - /** * The opacity of the circle's stroke. * @@ -1502,19 +955,6 @@ public class PropertyFactory { return new PaintPropertyValue<>("circle-stroke-opacity", expression); } - - /** - * The opacity of the circle's stroke. - * - * @param <T> the function input type - * @param function a wrapper function for Float - * @return property wrapper around a Float function - */ - @Deprecated - public static <T> PropertyValue<Function<T, Float>> circleStrokeOpacity(Function<T, Float> function) { - return new PaintPropertyValue<>("circle-stroke-opacity", function); - } - /** * Radius of influence of one heatmap point in density-independent pixels. Increasing the value makes the heatmap smoother, but less detailed. * @@ -1535,19 +975,6 @@ public class PropertyFactory { return new PaintPropertyValue<>("heatmap-radius", expression); } - - /** - * Radius of influence of one heatmap point in density-independent pixels. Increasing the value makes the heatmap smoother, but less detailed. - * - * @param <T> the function input type - * @param function a wrapper function for Float - * @return property wrapper around a Float function - */ - @Deprecated - public static <T> PropertyValue<Function<T, Float>> heatmapRadius(Function<T, Float> function) { - return new PaintPropertyValue<>("heatmap-radius", function); - } - /** * A measure of how much an individual point contributes to the heatmap. A value of 10 would be equivalent to having 10 points of weight 1 in the same spot. Especially useful when combined with clustering. * @@ -1568,19 +995,6 @@ public class PropertyFactory { return new PaintPropertyValue<>("heatmap-weight", expression); } - - /** - * A measure of how much an individual point contributes to the heatmap. A value of 10 would be equivalent to having 10 points of weight 1 in the same spot. Especially useful when combined with clustering. - * - * @param <T> the function input type - * @param function a wrapper function for Float - * @return property wrapper around a Float function - */ - @Deprecated - public static <T> PropertyValue<Function<T, Float>> heatmapWeight(Function<T, Float> function) { - return new PaintPropertyValue<>("heatmap-weight", function); - } - /** * Similar to {@link PropertyFactory#heatmapWeight} but controls the intensity of the heatmap globally. Primarily used for adjusting the heatmap based on zoom level. * @@ -1601,19 +1015,6 @@ public class PropertyFactory { return new PaintPropertyValue<>("heatmap-intensity", expression); } - - /** - * Similar to {@link PropertyFactory#heatmapWeight} but controls the intensity of the heatmap globally. Primarily used for adjusting the heatmap based on zoom level. - * - * @param <Z> the zoom parameter type - * @param function a wrapper {@link CameraFunction} for Float - * @return property wrapper around a Float function - */ - @Deprecated - public static <Z extends Number> PropertyValue<CameraFunction<Z, Float>> heatmapIntensity(CameraFunction<Z, Float> function) { - return new PaintPropertyValue<>("heatmap-intensity", function); - } - /** * Defines the color of each pixel based on its density value in a heatmap. Should be an expression that uses `["heatmap-density"]` as input. * @@ -1664,19 +1065,6 @@ public class PropertyFactory { return new PaintPropertyValue<>("heatmap-opacity", expression); } - - /** - * The global opacity at which the heatmap layer will be drawn. - * - * @param <Z> the zoom parameter type - * @param function a wrapper {@link CameraFunction} for Float - * @return property wrapper around a Float function - */ - @Deprecated - public static <Z extends Number> PropertyValue<CameraFunction<Z, Float>> heatmapOpacity(CameraFunction<Z, Float> function) { - return new PaintPropertyValue<>("heatmap-opacity", function); - } - /** * The opacity of the entire fill extrusion layer. This is rendered on a per-layer, not per-feature, basis, and data-driven styling is not available. * @@ -1697,19 +1085,6 @@ public class PropertyFactory { return new PaintPropertyValue<>("fill-extrusion-opacity", expression); } - - /** - * The opacity of the entire fill extrusion layer. This is rendered on a per-layer, not per-feature, basis, and data-driven styling is not available. - * - * @param <Z> the zoom parameter type - * @param function a wrapper {@link CameraFunction} for Float - * @return property wrapper around a Float function - */ - @Deprecated - public static <Z extends Number> PropertyValue<CameraFunction<Z, Float>> fillExtrusionOpacity(CameraFunction<Z, Float> function) { - return new PaintPropertyValue<>("fill-extrusion-opacity", function); - } - /** * The base color of the extruded fill. The extrusion's surfaces will be shaded differently based on this color in combination with the root `light` settings. If this color is specified as `rgba` with an alpha component, the alpha component will be ignored; use {@link PropertyFactory#fillExtrusionOpacity} to set layer opacity. * @@ -1740,19 +1115,6 @@ public class PropertyFactory { return new PaintPropertyValue<>("fill-extrusion-color", expression); } - - /** - * The base color of the extruded fill. The extrusion's surfaces will be shaded differently based on this color in combination with the root `light` settings. If this color is specified as `rgba` with an alpha component, the alpha component will be ignored; use {@link PropertyFactory#fillExtrusionOpacity} to set layer opacity. - * - * @param <T> the function input type - * @param function a wrapper function for String - * @return property wrapper around a String function - */ - @Deprecated - public static <T> PropertyValue<Function<T, String>> fillExtrusionColor(Function<T, String> function) { - return new PaintPropertyValue<>("fill-extrusion-color", function); - } - /** * The geometry's offset. Values are [x, y] where negatives indicate left and up (on the flat plane), respectively. * @@ -1773,19 +1135,6 @@ public class PropertyFactory { return new PaintPropertyValue<>("fill-extrusion-translate", expression); } - - /** - * The geometry's offset. Values are [x, y] where negatives indicate left and up (on the flat plane), respectively. - * - * @param <Z> the zoom parameter type - * @param function a wrapper {@link CameraFunction} for Float[] - * @return property wrapper around a Float[] function - */ - @Deprecated - public static <Z extends Number> PropertyValue<CameraFunction<Z, Float[]>> fillExtrusionTranslate(CameraFunction<Z, Float[]> function) { - return new PaintPropertyValue<>("fill-extrusion-translate", function); - } - /** * Controls the frame of reference for {@link PropertyFactory#fillExtrusionTranslate}. * @@ -1806,19 +1155,6 @@ public class PropertyFactory { return new PaintPropertyValue<>("fill-extrusion-translate-anchor", expression); } - - /** - * Controls the frame of reference for {@link PropertyFactory#fillExtrusionTranslate}. - * - * @param <Z> the zoom parameter type - * @param function a wrapper {@link CameraFunction} for String - * @return property wrapper around a String function - */ - @Deprecated - public static <Z extends Number> PropertyValue<CameraFunction<Z, String>> fillExtrusionTranslateAnchor(CameraFunction<Z, String> function) { - return new PaintPropertyValue<>("fill-extrusion-translate-anchor", function); - } - /** * 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). * @@ -1839,19 +1175,6 @@ public class PropertyFactory { return new PaintPropertyValue<>("fill-extrusion-pattern", expression); } - - /** - * 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). - * - * @param <Z> the zoom parameter type - * @param function a wrapper {@link CameraFunction} for String - * @return property wrapper around a String function - */ - @Deprecated - public static <Z extends Number> PropertyValue<CameraFunction<Z, String>> fillExtrusionPattern(CameraFunction<Z, String> function) { - return new PaintPropertyValue<>("fill-extrusion-pattern", function); - } - /** * The height with which to extrude this layer. * @@ -1872,19 +1195,6 @@ public class PropertyFactory { return new PaintPropertyValue<>("fill-extrusion-height", expression); } - - /** - * The height with which to extrude this layer. - * - * @param <T> the function input type - * @param function a wrapper function for Float - * @return property wrapper around a Float function - */ - @Deprecated - public static <T> PropertyValue<Function<T, Float>> fillExtrusionHeight(Function<T, Float> function) { - return new PaintPropertyValue<>("fill-extrusion-height", function); - } - /** * The height with which to extrude the base of this layer. Must be less than or equal to {@link PropertyFactory#fillExtrusionHeight}. * @@ -1905,19 +1215,6 @@ public class PropertyFactory { return new PaintPropertyValue<>("fill-extrusion-base", expression); } - - /** - * The height with which to extrude the base of this layer. Must be less than or equal to {@link PropertyFactory#fillExtrusionHeight}. - * - * @param <T> the function input type - * @param function a wrapper function for Float - * @return property wrapper around a Float function - */ - @Deprecated - public static <T> PropertyValue<Function<T, Float>> fillExtrusionBase(Function<T, Float> function) { - return new PaintPropertyValue<>("fill-extrusion-base", function); - } - /** * The opacity at which the image will be drawn. * @@ -1938,19 +1235,6 @@ public class PropertyFactory { return new PaintPropertyValue<>("raster-opacity", expression); } - - /** - * The opacity at which the image will be drawn. - * - * @param <Z> the zoom parameter type - * @param function a wrapper {@link CameraFunction} for Float - * @return property wrapper around a Float function - */ - @Deprecated - public static <Z extends Number> PropertyValue<CameraFunction<Z, Float>> rasterOpacity(CameraFunction<Z, Float> function) { - return new PaintPropertyValue<>("raster-opacity", function); - } - /** * Rotates hues around the color wheel. * @@ -1971,19 +1255,6 @@ public class PropertyFactory { return new PaintPropertyValue<>("raster-hue-rotate", expression); } - - /** - * Rotates hues around the color wheel. - * - * @param <Z> the zoom parameter type - * @param function a wrapper {@link CameraFunction} for Float - * @return property wrapper around a Float function - */ - @Deprecated - public static <Z extends Number> PropertyValue<CameraFunction<Z, Float>> rasterHueRotate(CameraFunction<Z, Float> function) { - return new PaintPropertyValue<>("raster-hue-rotate", function); - } - /** * Increase or reduce the brightness of the image. The value is the minimum brightness. * @@ -2004,19 +1275,6 @@ public class PropertyFactory { return new PaintPropertyValue<>("raster-brightness-min", expression); } - - /** - * Increase or reduce the brightness of the image. The value is the minimum brightness. - * - * @param <Z> the zoom parameter type - * @param function a wrapper {@link CameraFunction} for Float - * @return property wrapper around a Float function - */ - @Deprecated - public static <Z extends Number> PropertyValue<CameraFunction<Z, Float>> rasterBrightnessMin(CameraFunction<Z, Float> function) { - return new PaintPropertyValue<>("raster-brightness-min", function); - } - /** * Increase or reduce the brightness of the image. The value is the maximum brightness. * @@ -2037,19 +1295,6 @@ public class PropertyFactory { return new PaintPropertyValue<>("raster-brightness-max", expression); } - - /** - * Increase or reduce the brightness of the image. The value is the maximum brightness. - * - * @param <Z> the zoom parameter type - * @param function a wrapper {@link CameraFunction} for Float - * @return property wrapper around a Float function - */ - @Deprecated - public static <Z extends Number> PropertyValue<CameraFunction<Z, Float>> rasterBrightnessMax(CameraFunction<Z, Float> function) { - return new PaintPropertyValue<>("raster-brightness-max", function); - } - /** * Increase or reduce the saturation of the image. * @@ -2070,19 +1315,6 @@ public class PropertyFactory { return new PaintPropertyValue<>("raster-saturation", expression); } - - /** - * Increase or reduce the saturation of the image. - * - * @param <Z> the zoom parameter type - * @param function a wrapper {@link CameraFunction} for Float - * @return property wrapper around a Float function - */ - @Deprecated - public static <Z extends Number> PropertyValue<CameraFunction<Z, Float>> rasterSaturation(CameraFunction<Z, Float> function) { - return new PaintPropertyValue<>("raster-saturation", function); - } - /** * Increase or reduce the contrast of the image. * @@ -2103,19 +1335,6 @@ public class PropertyFactory { return new PaintPropertyValue<>("raster-contrast", expression); } - - /** - * Increase or reduce the contrast of the image. - * - * @param <Z> the zoom parameter type - * @param function a wrapper {@link CameraFunction} for Float - * @return property wrapper around a Float function - */ - @Deprecated - public static <Z extends Number> PropertyValue<CameraFunction<Z, Float>> rasterContrast(CameraFunction<Z, Float> function) { - return new PaintPropertyValue<>("raster-contrast", function); - } - /** * Fade duration when a new tile is added. * @@ -2136,19 +1355,6 @@ public class PropertyFactory { return new PaintPropertyValue<>("raster-fade-duration", expression); } - - /** - * Fade duration when a new tile is added. - * - * @param <Z> the zoom parameter type - * @param function a wrapper {@link CameraFunction} for Float - * @return property wrapper around a Float function - */ - @Deprecated - public static <Z extends Number> PropertyValue<CameraFunction<Z, Float>> rasterFadeDuration(CameraFunction<Z, Float> function) { - return new PaintPropertyValue<>("raster-fade-duration", function); - } - /** * The direction of the light source used to generate the hillshading with 0 as the top of the viewport if {@link Property.HILLSHADE_ILLUMINATION_ANCHOR} is set to `viewport` and due north if {@link Property.HILLSHADE_ILLUMINATION_ANCHOR} is set to `map`. * @@ -2169,19 +1375,6 @@ public class PropertyFactory { return new PaintPropertyValue<>("hillshade-illumination-direction", expression); } - - /** - * The direction of the light source used to generate the hillshading with 0 as the top of the viewport if {@link Property.HILLSHADE_ILLUMINATION_ANCHOR} is set to `viewport` and due north if {@link Property.HILLSHADE_ILLUMINATION_ANCHOR} is set to `map`. - * - * @param <Z> the zoom parameter type - * @param function a wrapper {@link CameraFunction} for Float - * @return property wrapper around a Float function - */ - @Deprecated - public static <Z extends Number> PropertyValue<CameraFunction<Z, Float>> hillshadeIlluminationDirection(CameraFunction<Z, Float> function) { - return new PaintPropertyValue<>("hillshade-illumination-direction", function); - } - /** * Direction of light source when map is rotated. * @@ -2202,19 +1395,6 @@ public class PropertyFactory { return new PaintPropertyValue<>("hillshade-illumination-anchor", expression); } - - /** - * Direction of light source when map is rotated. - * - * @param <Z> the zoom parameter type - * @param function a wrapper {@link CameraFunction} for String - * @return property wrapper around a String function - */ - @Deprecated - public static <Z extends Number> PropertyValue<CameraFunction<Z, String>> hillshadeIlluminationAnchor(CameraFunction<Z, String> function) { - return new PaintPropertyValue<>("hillshade-illumination-anchor", function); - } - /** * Intensity of the hillshade * @@ -2235,19 +1415,6 @@ public class PropertyFactory { return new PaintPropertyValue<>("hillshade-exaggeration", expression); } - - /** - * Intensity of the hillshade - * - * @param <Z> the zoom parameter type - * @param function a wrapper {@link CameraFunction} for Float - * @return property wrapper around a Float function - */ - @Deprecated - public static <Z extends Number> PropertyValue<CameraFunction<Z, Float>> hillshadeExaggeration(CameraFunction<Z, Float> function) { - return new PaintPropertyValue<>("hillshade-exaggeration", function); - } - /** * The shading color of areas that face away from the light source. * @@ -2278,19 +1445,6 @@ public class PropertyFactory { return new PaintPropertyValue<>("hillshade-shadow-color", expression); } - - /** - * The shading color of areas that face away from the light source. - * - * @param <Z> the zoom parameter type - * @param function a wrapper {@link CameraFunction} for String - * @return property wrapper around a String function - */ - @Deprecated - public static <Z extends Number> PropertyValue<CameraFunction<Z, String>> hillshadeShadowColor(CameraFunction<Z, String> function) { - return new PaintPropertyValue<>("hillshade-shadow-color", function); - } - /** * The shading color of areas that faces towards the light source. * @@ -2321,19 +1475,6 @@ public class PropertyFactory { return new PaintPropertyValue<>("hillshade-highlight-color", expression); } - - /** - * The shading color of areas that faces towards the light source. - * - * @param <Z> the zoom parameter type - * @param function a wrapper {@link CameraFunction} for String - * @return property wrapper around a String function - */ - @Deprecated - public static <Z extends Number> PropertyValue<CameraFunction<Z, String>> hillshadeHighlightColor(CameraFunction<Z, String> function) { - return new PaintPropertyValue<>("hillshade-highlight-color", function); - } - /** * The shading color used to accentuate rugged terrain like sharp cliffs and gorges. * @@ -2364,19 +1505,6 @@ public class PropertyFactory { return new PaintPropertyValue<>("hillshade-accent-color", expression); } - - /** - * The shading color used to accentuate rugged terrain like sharp cliffs and gorges. - * - * @param <Z> the zoom parameter type - * @param function a wrapper {@link CameraFunction} for String - * @return property wrapper around a String function - */ - @Deprecated - public static <Z extends Number> PropertyValue<CameraFunction<Z, String>> hillshadeAccentColor(CameraFunction<Z, String> function) { - return new PaintPropertyValue<>("hillshade-accent-color", function); - } - /** * The color with which the background will be drawn. * @@ -2407,19 +1535,6 @@ public class PropertyFactory { return new PaintPropertyValue<>("background-color", expression); } - - /** - * The color with which the background will be drawn. - * - * @param <Z> the zoom parameter type - * @param function a wrapper {@link CameraFunction} for String - * @return property wrapper around a String function - */ - @Deprecated - public static <Z extends Number> PropertyValue<CameraFunction<Z, String>> backgroundColor(CameraFunction<Z, String> function) { - return new PaintPropertyValue<>("background-color", function); - } - /** * 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). * @@ -2440,19 +1555,6 @@ public class PropertyFactory { return new PaintPropertyValue<>("background-pattern", 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). - * - * @param <Z> the zoom parameter type - * @param function a wrapper {@link CameraFunction} for String - * @return property wrapper around a String function - */ - @Deprecated - public static <Z extends Number> PropertyValue<CameraFunction<Z, String>> backgroundPattern(CameraFunction<Z, String> function) { - return new PaintPropertyValue<>("background-pattern", function); - } - /** * The opacity at which the background will be drawn. * @@ -2473,19 +1575,6 @@ public class PropertyFactory { return new PaintPropertyValue<>("background-opacity", expression); } - - /** - * The opacity at which the background will be drawn. - * - * @param <Z> the zoom parameter type - * @param function a wrapper {@link CameraFunction} for Float - * @return property wrapper around a Float function - */ - @Deprecated - public static <Z extends Number> PropertyValue<CameraFunction<Z, Float>> backgroundOpacity(CameraFunction<Z, Float> function) { - return new PaintPropertyValue<>("background-opacity", function); - } - /** * The display of line endings. * @@ -2506,18 +1595,6 @@ public class PropertyFactory { return new LayoutPropertyValue<>("line-cap", value); } - - /** - * The display of line endings. - * - * @param <Z> the zoom parameter type - * @param function a wrapper {@link CameraFunction} for String - * @return property wrapper around a String function - */ - public static <Z extends Number> PropertyValue<CameraFunction<Z, String>> lineCap(CameraFunction<Z, String> function) { - return new LayoutPropertyValue<>("line-cap", function); - } - /** * The display of lines when joining. * @@ -2538,18 +1615,6 @@ public class PropertyFactory { return new LayoutPropertyValue<>("line-join", value); } - - /** - * The display of lines when joining. - * - * @param <T> the function input type - * @param function a wrapper function for String - * @return property wrapper around a String function - */ - public static <T> PropertyValue<Function<T, String>> lineJoin(Function<T, String> function) { - return new LayoutPropertyValue<>("line-join", function); - } - /** * Used to automatically convert miter joins to bevel joins for sharp angles. * @@ -2570,18 +1635,6 @@ public class PropertyFactory { return new LayoutPropertyValue<>("line-miter-limit", value); } - - /** - * Used to automatically convert miter joins to bevel joins for sharp angles. - * - * @param <Z> the zoom parameter type - * @param function a wrapper {@link CameraFunction} for Float - * @return property wrapper around a Float function - */ - public static <Z extends Number> PropertyValue<CameraFunction<Z, Float>> lineMiterLimit(CameraFunction<Z, Float> function) { - return new LayoutPropertyValue<>("line-miter-limit", function); - } - /** * Used to automatically convert round joins to miter joins for shallow angles. * @@ -2602,18 +1655,6 @@ public class PropertyFactory { return new LayoutPropertyValue<>("line-round-limit", value); } - - /** - * Used to automatically convert round joins to miter joins for shallow angles. - * - * @param <Z> the zoom parameter type - * @param function a wrapper {@link CameraFunction} for Float - * @return property wrapper around a Float function - */ - public static <Z extends Number> PropertyValue<CameraFunction<Z, Float>> lineRoundLimit(CameraFunction<Z, Float> function) { - return new LayoutPropertyValue<>("line-round-limit", function); - } - /** * Label placement relative to its geometry. * @@ -2634,18 +1675,6 @@ public class PropertyFactory { return new LayoutPropertyValue<>("symbol-placement", value); } - - /** - * Label placement relative to its geometry. - * - * @param <Z> the zoom parameter type - * @param function a wrapper {@link CameraFunction} for String - * @return property wrapper around a String function - */ - public static <Z extends Number> PropertyValue<CameraFunction<Z, String>> symbolPlacement(CameraFunction<Z, String> function) { - return new LayoutPropertyValue<>("symbol-placement", function); - } - /** * Distance between two symbol anchors. * @@ -2666,18 +1695,6 @@ public class PropertyFactory { return new LayoutPropertyValue<>("symbol-spacing", value); } - - /** - * Distance between two symbol anchors. - * - * @param <Z> the zoom parameter type - * @param function a wrapper {@link CameraFunction} for Float - * @return property wrapper around a Float function - */ - public static <Z extends Number> PropertyValue<CameraFunction<Z, Float>> symbolSpacing(CameraFunction<Z, Float> function) { - return new LayoutPropertyValue<>("symbol-spacing", function); - } - /** * If true, the symbols will not cross tile edges to avoid mutual collisions. Recommended in layers that don't have enough padding in the vector tile to prevent collisions, or if it is a point symbol layer placed after a line symbol layer. * @@ -2698,18 +1715,6 @@ public class PropertyFactory { return new LayoutPropertyValue<>("symbol-avoid-edges", value); } - - /** - * If true, the symbols will not cross tile edges to avoid mutual collisions. Recommended in layers that don't have enough padding in the vector tile to prevent collisions, or if it is a point symbol layer placed after a line symbol layer. - * - * @param <Z> the zoom parameter type - * @param function a wrapper {@link CameraFunction} for Boolean - * @return property wrapper around a Boolean function - */ - public static <Z extends Number> PropertyValue<CameraFunction<Z, Boolean>> symbolAvoidEdges(CameraFunction<Z, Boolean> function) { - return new LayoutPropertyValue<>("symbol-avoid-edges", function); - } - /** * If true, the icon will be visible even if it collides with other previously drawn symbols. * @@ -2730,18 +1735,6 @@ public class PropertyFactory { return new LayoutPropertyValue<>("icon-allow-overlap", value); } - - /** - * If true, the icon will be visible even if it collides with other previously drawn symbols. - * - * @param <Z> the zoom parameter type - * @param function a wrapper {@link CameraFunction} for Boolean - * @return property wrapper around a Boolean function - */ - public static <Z extends Number> PropertyValue<CameraFunction<Z, Boolean>> iconAllowOverlap(CameraFunction<Z, Boolean> function) { - return new LayoutPropertyValue<>("icon-allow-overlap", function); - } - /** * If true, other symbols can be visible even if they collide with the icon. * @@ -2762,18 +1755,6 @@ public class PropertyFactory { return new LayoutPropertyValue<>("icon-ignore-placement", value); } - - /** - * If true, other symbols can be visible even if they collide with the icon. - * - * @param <Z> the zoom parameter type - * @param function a wrapper {@link CameraFunction} for Boolean - * @return property wrapper around a Boolean function - */ - public static <Z extends Number> PropertyValue<CameraFunction<Z, Boolean>> iconIgnorePlacement(CameraFunction<Z, Boolean> function) { - return new LayoutPropertyValue<>("icon-ignore-placement", function); - } - /** * If true, text will display without their corresponding icons when the icon collides with other symbols and the text does not. * @@ -2794,18 +1775,6 @@ public class PropertyFactory { return new LayoutPropertyValue<>("icon-optional", value); } - - /** - * If true, text will display without their corresponding icons when the icon collides with other symbols and the text does not. - * - * @param <Z> the zoom parameter type - * @param function a wrapper {@link CameraFunction} for Boolean - * @return property wrapper around a Boolean function - */ - public static <Z extends Number> PropertyValue<CameraFunction<Z, Boolean>> iconOptional(CameraFunction<Z, Boolean> function) { - return new LayoutPropertyValue<>("icon-optional", function); - } - /** * In combination with {@link Property.SYMBOL_PLACEMENT}, determines the rotation behavior of icons. * @@ -2826,18 +1795,6 @@ public class PropertyFactory { return new LayoutPropertyValue<>("icon-rotation-alignment", value); } - - /** - * In combination with {@link Property.SYMBOL_PLACEMENT}, determines the rotation behavior of icons. - * - * @param <Z> the zoom parameter type - * @param function a wrapper {@link CameraFunction} for String - * @return property wrapper around a String function - */ - public static <Z extends Number> PropertyValue<CameraFunction<Z, String>> iconRotationAlignment(CameraFunction<Z, String> function) { - return new LayoutPropertyValue<>("icon-rotation-alignment", function); - } - /** * Scales the original size of the icon by the provided factor. The new pixel size of the image will be the original pixel size multiplied by {@link PropertyFactory#iconSize}. 1 is the original size; 3 triples the size of the image. * @@ -2858,18 +1815,6 @@ public class PropertyFactory { return new LayoutPropertyValue<>("icon-size", value); } - - /** - * Scales the original size of the icon by the provided factor. The new pixel size of the image will be the original pixel size multiplied by {@link PropertyFactory#iconSize}. 1 is the original size; 3 triples the size of the image. - * - * @param <T> the function input type - * @param function a wrapper function for Float - * @return property wrapper around a Float function - */ - public static <T> PropertyValue<Function<T, Float>> iconSize(Function<T, Float> function) { - return new LayoutPropertyValue<>("icon-size", function); - } - /** * Scales the icon to fit around the associated text. * @@ -2890,18 +1835,6 @@ public class PropertyFactory { return new LayoutPropertyValue<>("icon-text-fit", value); } - - /** - * Scales the icon to fit around the associated text. - * - * @param <Z> the zoom parameter type - * @param function a wrapper {@link CameraFunction} for String - * @return property wrapper around a String function - */ - public static <Z extends Number> PropertyValue<CameraFunction<Z, String>> iconTextFit(CameraFunction<Z, String> function) { - return new LayoutPropertyValue<>("icon-text-fit", function); - } - /** * Size of the additional area added to dimensions determined by {@link Property.ICON_TEXT_FIT}, in clockwise order: top, right, bottom, left. * @@ -2922,18 +1855,6 @@ public class PropertyFactory { return new LayoutPropertyValue<>("icon-text-fit-padding", value); } - - /** - * Size of the additional area added to dimensions determined by {@link Property.ICON_TEXT_FIT}, in clockwise order: top, right, bottom, left. - * - * @param <Z> the zoom parameter type - * @param function a wrapper {@link CameraFunction} for Float[] - * @return property wrapper around a Float[] function - */ - public static <Z extends Number> PropertyValue<CameraFunction<Z, Float[]>> iconTextFitPadding(CameraFunction<Z, Float[]> function) { - return new LayoutPropertyValue<>("icon-text-fit-padding", function); - } - /** * 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. * @@ -2954,18 +1875,6 @@ public class PropertyFactory { return new LayoutPropertyValue<>("icon-image", 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. - * - * @param <T> the function input type - * @param function a wrapper function for String - * @return property wrapper around a String function - */ - public static <T> PropertyValue<Function<T, String>> iconImage(Function<T, String> function) { - return new LayoutPropertyValue<>("icon-image", function); - } - /** * Rotates the icon clockwise. * @@ -2986,18 +1895,6 @@ public class PropertyFactory { return new LayoutPropertyValue<>("icon-rotate", value); } - - /** - * Rotates the icon clockwise. - * - * @param <T> the function input type - * @param function a wrapper function for Float - * @return property wrapper around a Float function - */ - public static <T> PropertyValue<Function<T, Float>> iconRotate(Function<T, Float> function) { - return new LayoutPropertyValue<>("icon-rotate", function); - } - /** * Size of the additional area around the icon bounding box used for detecting symbol collisions. * @@ -3018,18 +1915,6 @@ public class PropertyFactory { return new LayoutPropertyValue<>("icon-padding", value); } - - /** - * Size of the additional area around the icon bounding box used for detecting symbol collisions. - * - * @param <Z> the zoom parameter type - * @param function a wrapper {@link CameraFunction} for Float - * @return property wrapper around a Float function - */ - public static <Z extends Number> PropertyValue<CameraFunction<Z, Float>> iconPadding(CameraFunction<Z, Float> function) { - return new LayoutPropertyValue<>("icon-padding", function); - } - /** * If true, the icon may be flipped to prevent it from being rendered upside-down. * @@ -3050,18 +1935,6 @@ public class PropertyFactory { return new LayoutPropertyValue<>("icon-keep-upright", value); } - - /** - * If true, the icon may be flipped to prevent it from being rendered upside-down. - * - * @param <Z> the zoom parameter type - * @param function a wrapper {@link CameraFunction} for Boolean - * @return property wrapper around a Boolean function - */ - public static <Z extends Number> PropertyValue<CameraFunction<Z, Boolean>> iconKeepUpright(CameraFunction<Z, Boolean> function) { - return new LayoutPropertyValue<>("icon-keep-upright", function); - } - /** * Offset distance of icon from its anchor. Positive values indicate right and down, while negative values indicate left and up. Each component is multiplied by the value of {@link PropertyFactory#iconSize} to obtain the final offset in density-independent pixels. When combined with {@link PropertyFactory#iconRotate} the offset will be as if the rotated direction was up. * @@ -3082,18 +1955,6 @@ public class PropertyFactory { return new LayoutPropertyValue<>("icon-offset", value); } - - /** - * Offset distance of icon from its anchor. Positive values indicate right and down, while negative values indicate left and up. Each component is multiplied by the value of {@link PropertyFactory#iconSize} to obtain the final offset in density-independent pixels. When combined with {@link PropertyFactory#iconRotate} the offset will be as if the rotated direction was up. - * - * @param <T> the function input type - * @param function a wrapper function for Float[] - * @return property wrapper around a Float[] function - */ - public static <T> PropertyValue<Function<T, Float[]>> iconOffset(Function<T, Float[]> function) { - return new LayoutPropertyValue<>("icon-offset", function); - } - /** * Part of the icon placed closest to the anchor. * @@ -3114,18 +1975,6 @@ public class PropertyFactory { return new LayoutPropertyValue<>("icon-anchor", value); } - - /** - * Part of the icon placed closest to the anchor. - * - * @param <T> the function input type - * @param function a wrapper function for String - * @return property wrapper around a String function - */ - public static <T> PropertyValue<Function<T, String>> iconAnchor(Function<T, String> function) { - return new LayoutPropertyValue<>("icon-anchor", function); - } - /** * Orientation of icon when map is pitched. * @@ -3146,18 +1995,6 @@ public class PropertyFactory { return new LayoutPropertyValue<>("icon-pitch-alignment", value); } - - /** - * Orientation of icon when map is pitched. - * - * @param <Z> the zoom parameter type - * @param function a wrapper {@link CameraFunction} for String - * @return property wrapper around a String function - */ - public static <Z extends Number> PropertyValue<CameraFunction<Z, String>> iconPitchAlignment(CameraFunction<Z, String> function) { - return new LayoutPropertyValue<>("icon-pitch-alignment", function); - } - /** * Orientation of text when map is pitched. * @@ -3178,18 +2015,6 @@ public class PropertyFactory { return new LayoutPropertyValue<>("text-pitch-alignment", value); } - - /** - * Orientation of text when map is pitched. - * - * @param <Z> the zoom parameter type - * @param function a wrapper {@link CameraFunction} for String - * @return property wrapper around a String function - */ - public static <Z extends Number> PropertyValue<CameraFunction<Z, String>> textPitchAlignment(CameraFunction<Z, String> function) { - return new LayoutPropertyValue<>("text-pitch-alignment", function); - } - /** * In combination with {@link Property.SYMBOL_PLACEMENT}, determines the rotation behavior of the individual glyphs forming the text. * @@ -3210,18 +2035,6 @@ public class PropertyFactory { return new LayoutPropertyValue<>("text-rotation-alignment", value); } - - /** - * In combination with {@link Property.SYMBOL_PLACEMENT}, determines the rotation behavior of the individual glyphs forming the text. - * - * @param <Z> the zoom parameter type - * @param function a wrapper {@link CameraFunction} for String - * @return property wrapper around a String function - */ - public static <Z extends Number> PropertyValue<CameraFunction<Z, String>> textRotationAlignment(CameraFunction<Z, String> function) { - return new LayoutPropertyValue<>("text-rotation-alignment", function); - } - /** * 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. * @@ -3242,18 +2055,6 @@ public class PropertyFactory { return new LayoutPropertyValue<>("text-field", 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. - * - * @param <T> the function input type - * @param function a wrapper function for String - * @return property wrapper around a String function - */ - public static <T> PropertyValue<Function<T, String>> textField(Function<T, String> function) { - return new LayoutPropertyValue<>("text-field", function); - } - /** * Font stack to use for displaying text. * @@ -3274,18 +2075,6 @@ public class PropertyFactory { return new LayoutPropertyValue<>("text-font", value); } - - /** - * Font stack to use for displaying text. - * - * @param <T> the function input type - * @param function a wrapper function for String[] - * @return property wrapper around a String[] function - */ - public static <T> PropertyValue<Function<T, String[]>> textFont(Function<T, String[]> function) { - return new LayoutPropertyValue<>("text-font", function); - } - /** * Font size. * @@ -3306,18 +2095,6 @@ public class PropertyFactory { return new LayoutPropertyValue<>("text-size", value); } - - /** - * Font size. - * - * @param <T> the function input type - * @param function a wrapper function for Float - * @return property wrapper around a Float function - */ - public static <T> PropertyValue<Function<T, Float>> textSize(Function<T, Float> function) { - return new LayoutPropertyValue<>("text-size", function); - } - /** * The maximum line width for text wrapping. * @@ -3338,18 +2115,6 @@ public class PropertyFactory { return new LayoutPropertyValue<>("text-max-width", value); } - - /** - * The maximum line width for text wrapping. - * - * @param <T> the function input type - * @param function a wrapper function for Float - * @return property wrapper around a Float function - */ - public static <T> PropertyValue<Function<T, Float>> textMaxWidth(Function<T, Float> function) { - return new LayoutPropertyValue<>("text-max-width", function); - } - /** * Text leading value for multi-line text. * @@ -3370,18 +2135,6 @@ public class PropertyFactory { return new LayoutPropertyValue<>("text-line-height", value); } - - /** - * Text leading value for multi-line text. - * - * @param <Z> the zoom parameter type - * @param function a wrapper {@link CameraFunction} for Float - * @return property wrapper around a Float function - */ - public static <Z extends Number> PropertyValue<CameraFunction<Z, Float>> textLineHeight(CameraFunction<Z, Float> function) { - return new LayoutPropertyValue<>("text-line-height", function); - } - /** * Text tracking amount. * @@ -3402,18 +2155,6 @@ public class PropertyFactory { return new LayoutPropertyValue<>("text-letter-spacing", value); } - - /** - * Text tracking amount. - * - * @param <T> the function input type - * @param function a wrapper function for Float - * @return property wrapper around a Float function - */ - public static <T> PropertyValue<Function<T, Float>> textLetterSpacing(Function<T, Float> function) { - return new LayoutPropertyValue<>("text-letter-spacing", function); - } - /** * Text justification options. * @@ -3434,18 +2175,6 @@ public class PropertyFactory { return new LayoutPropertyValue<>("text-justify", value); } - - /** - * Text justification options. - * - * @param <T> the function input type - * @param function a wrapper function for String - * @return property wrapper around a String function - */ - public static <T> PropertyValue<Function<T, String>> textJustify(Function<T, String> function) { - return new LayoutPropertyValue<>("text-justify", function); - } - /** * Part of the text placed closest to the anchor. * @@ -3466,18 +2195,6 @@ public class PropertyFactory { return new LayoutPropertyValue<>("text-anchor", value); } - - /** - * Part of the text placed closest to the anchor. - * - * @param <T> the function input type - * @param function a wrapper function for String - * @return property wrapper around a String function - */ - public static <T> PropertyValue<Function<T, String>> textAnchor(Function<T, String> function) { - return new LayoutPropertyValue<>("text-anchor", function); - } - /** * Maximum angle change between adjacent characters. * @@ -3498,18 +2215,6 @@ public class PropertyFactory { return new LayoutPropertyValue<>("text-max-angle", value); } - - /** - * Maximum angle change between adjacent characters. - * - * @param <Z> the zoom parameter type - * @param function a wrapper {@link CameraFunction} for Float - * @return property wrapper around a Float function - */ - public static <Z extends Number> PropertyValue<CameraFunction<Z, Float>> textMaxAngle(CameraFunction<Z, Float> function) { - return new LayoutPropertyValue<>("text-max-angle", function); - } - /** * Rotates the text clockwise. * @@ -3530,18 +2235,6 @@ public class PropertyFactory { return new LayoutPropertyValue<>("text-rotate", value); } - - /** - * Rotates the text clockwise. - * - * @param <T> the function input type - * @param function a wrapper function for Float - * @return property wrapper around a Float function - */ - public static <T> PropertyValue<Function<T, Float>> textRotate(Function<T, Float> function) { - return new LayoutPropertyValue<>("text-rotate", function); - } - /** * Size of the additional area around the text bounding box used for detecting symbol collisions. * @@ -3562,18 +2255,6 @@ public class PropertyFactory { return new LayoutPropertyValue<>("text-padding", value); } - - /** - * Size of the additional area around the text bounding box used for detecting symbol collisions. - * - * @param <Z> the zoom parameter type - * @param function a wrapper {@link CameraFunction} for Float - * @return property wrapper around a Float function - */ - public static <Z extends Number> PropertyValue<CameraFunction<Z, Float>> textPadding(CameraFunction<Z, Float> function) { - return new LayoutPropertyValue<>("text-padding", function); - } - /** * If true, the text may be flipped vertically to prevent it from being rendered upside-down. * @@ -3594,18 +2275,6 @@ public class PropertyFactory { return new LayoutPropertyValue<>("text-keep-upright", value); } - - /** - * If true, the text may be flipped vertically to prevent it from being rendered upside-down. - * - * @param <Z> the zoom parameter type - * @param function a wrapper {@link CameraFunction} for Boolean - * @return property wrapper around a Boolean function - */ - public static <Z extends Number> PropertyValue<CameraFunction<Z, Boolean>> textKeepUpright(CameraFunction<Z, Boolean> function) { - return new LayoutPropertyValue<>("text-keep-upright", function); - } - /** * Specifies how to capitalize text, similar to the CSS {@link PropertyFactory#textTransform} property. * @@ -3626,18 +2295,6 @@ public class PropertyFactory { return new LayoutPropertyValue<>("text-transform", value); } - - /** - * Specifies how to capitalize text, similar to the CSS {@link PropertyFactory#textTransform} property. - * - * @param <T> the function input type - * @param function a wrapper function for String - * @return property wrapper around a String function - */ - public static <T> PropertyValue<Function<T, String>> textTransform(Function<T, String> function) { - return new LayoutPropertyValue<>("text-transform", function); - } - /** * Offset distance of text from its anchor. Positive values indicate right and down, while negative values indicate left and up. * @@ -3658,18 +2315,6 @@ public class PropertyFactory { return new LayoutPropertyValue<>("text-offset", value); } - - /** - * Offset distance of text from its anchor. Positive values indicate right and down, while negative values indicate left and up. - * - * @param <T> the function input type - * @param function a wrapper function for Float[] - * @return property wrapper around a Float[] function - */ - public static <T> PropertyValue<Function<T, Float[]>> textOffset(Function<T, Float[]> function) { - return new LayoutPropertyValue<>("text-offset", function); - } - /** * If true, the text will be visible even if it collides with other previously drawn symbols. * @@ -3690,18 +2335,6 @@ public class PropertyFactory { return new LayoutPropertyValue<>("text-allow-overlap", value); } - - /** - * If true, the text will be visible even if it collides with other previously drawn symbols. - * - * @param <Z> the zoom parameter type - * @param function a wrapper {@link CameraFunction} for Boolean - * @return property wrapper around a Boolean function - */ - public static <Z extends Number> PropertyValue<CameraFunction<Z, Boolean>> textAllowOverlap(CameraFunction<Z, Boolean> function) { - return new LayoutPropertyValue<>("text-allow-overlap", function); - } - /** * If true, other symbols can be visible even if they collide with the text. * @@ -3722,18 +2355,6 @@ public class PropertyFactory { return new LayoutPropertyValue<>("text-ignore-placement", value); } - - /** - * If true, other symbols can be visible even if they collide with the text. - * - * @param <Z> the zoom parameter type - * @param function a wrapper {@link CameraFunction} for Boolean - * @return property wrapper around a Boolean function - */ - public static <Z extends Number> PropertyValue<CameraFunction<Z, Boolean>> textIgnorePlacement(CameraFunction<Z, Boolean> function) { - return new LayoutPropertyValue<>("text-ignore-placement", function); - } - /** * If true, icons will display without their corresponding text when the text collides with other symbols and the icon does not. * @@ -3754,18 +2375,6 @@ public class PropertyFactory { return new LayoutPropertyValue<>("text-optional", value); } - - /** - * If true, icons will display without their corresponding text when the text collides with other symbols and the icon does not. - * - * @param <Z> the zoom parameter type - * @param function a wrapper {@link CameraFunction} for Boolean - * @return property wrapper around a Boolean function - */ - public static <Z extends Number> PropertyValue<CameraFunction<Z, Boolean>> textOptional(CameraFunction<Z, Boolean> function) { - return new LayoutPropertyValue<>("text-optional", function); - } - public static String colorToRgbaString(@ColorInt int value) { return String.format(Locale.US,"rgba(%d, %d, %d, %d)", (value >> 16) & 0xFF, (value >> 8) & 0xFF, value & 0xFF, (value >> 24) & 0xFF); diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/PropertyValue.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/PropertyValue.java index a57c440df4..fa1779a6c7 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/PropertyValue.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/PropertyValue.java @@ -4,8 +4,9 @@ import android.support.annotation.ColorInt; import android.support.annotation.NonNull; import android.support.annotation.Nullable; +import com.google.gson.JsonArray; import com.mapbox.mapboxsdk.exceptions.ConversionException; -import com.mapbox.mapboxsdk.style.functions.Function; +import com.mapbox.mapboxsdk.style.expressions.Expression; import com.mapbox.mapboxsdk.utils.ColorUtils; import timber.log.Timber; @@ -40,35 +41,39 @@ public class PropertyValue<T> { } /** - * Returns if this is a function. + * Returns if this is a expression. * - * @return true if is a function, false if not + * @return true if this is a expression, false if not */ - public boolean isFunction() { - return !isNull() && value instanceof Function; + public boolean isExpression() { + return !isNull() && value instanceof JsonArray; } /** - * Returns if this is a value. + * Get the expression of the property. * - * @return true if is a value, false if not + * @return the property expression */ - public boolean isValue() { - return !isNull() && !isFunction(); - } - @Nullable - public Function<?, T> getFunction() { - if (isFunction()) { - // noinspection unchecked - return (Function<?, T>) value; + public Expression getExpression() { + if (isExpression()) { + return Expression.Converter.convert((JsonArray) value); } else { - Timber.w("not a function, try value"); + Timber.w("not a expression, try value"); return null; } } /** + * Returns if this is a value. + * + * @return true if is a value, false if not + */ + public boolean isValue() { + return !isNull() && !isExpression(); + } + + /** * Get the value of the property. * * @return the property value @@ -77,7 +82,7 @@ public class PropertyValue<T> { public T getValue() { if (isValue()) { // noinspection unchecked - return (T) value; + return value; } else { Timber.w("not a value, try function"); return null; @@ -114,4 +119,4 @@ public class PropertyValue<T> { public String toString() { return String.format("%s: %s", name, value); } -} +}
\ No newline at end of file diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/property_factory.java.ejs b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/property_factory.java.ejs index 283d4e4189..6480dde3c8 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/property_factory.java.ejs +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/property_factory.java.ejs @@ -8,9 +8,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; @@ -31,18 +29,6 @@ public class PropertyFactory { return new LayoutPropertyValue<>("visibility", value); } - /** - * Set the property visibility. - * - * @param <T> the function input type - * @param function the visibility function - * @return property wrapper around a String function - */ - @Deprecated - public static <T> PropertyValue<Function<T, String>> visibility(Function<T, String> function) { - return new LayoutPropertyValue<>("visibility", function); - } - <% for (const property of paintProperties) { -%> <% if (property.type == 'color') { -%> /** @@ -76,35 +62,6 @@ public class PropertyFactory { return new PaintPropertyValue<>("<%- property.name %>", expression); } -<% if (supportsPropertyFunction(property)) { -%> - - /** - * <%- propertyFactoryMethodDoc(property) %> - * - * @param <T> the function input type - * @param function a wrapper function for <%- propertyType(property) %> - * @return property wrapper around a <%- propertyType(property) %> function - */ - @Deprecated - public static <T> PropertyValue<Function<T, <%- propertyType(property) %>>> <%- camelizeWithLeadingLowercase(property.name) %>(Function<T, <%- propertyType(property) %>> function) { - return new PaintPropertyValue<>("<%- property.name %>", function); - } - -<% } else if (supportsZoomFunction(property)) { -%> - - /** - * <%- propertyFactoryMethodDoc(property) %> - * - * @param <Z> the zoom parameter type - * @param function a wrapper {@link CameraFunction} for <%- propertyType(property) %> - * @return property wrapper around a <%- propertyType(property) %> function - */ - @Deprecated - public static <Z extends Number> PropertyValue<CameraFunction<Z, <%- propertyType(property) %>>> <%- camelizeWithLeadingLowercase(property.name) %>(CameraFunction<Z, <%- propertyType(property) %>> function) { - return new PaintPropertyValue<>("<%- property.name %>", function); - } - -<% } -%> <% } -%> <% for (const property of layoutProperties) { -%> /** @@ -127,33 +84,6 @@ public class PropertyFactory { return new LayoutPropertyValue<>("<%- property.name %>", value); } -<% if (supportsPropertyFunction(property)) { -%> - - /** - * <%- propertyFactoryMethodDoc(property) %> - * - * @param <T> the function input type - * @param function a wrapper function for <%- propertyType(property) %> - * @return property wrapper around a <%- propertyType(property) %> function - */ - public static <T> PropertyValue<Function<T, <%- propertyType(property) %>>> <%- camelizeWithLeadingLowercase(property.name) %>(Function<T, <%- propertyType(property) %>> function) { - return new LayoutPropertyValue<>("<%- property.name %>", function); - } - -<% } else if (supportsZoomFunction(property)) { -%> - - /** - * <%- propertyFactoryMethodDoc(property) %> - * - * @param <Z> the zoom parameter type - * @param function a wrapper {@link CameraFunction} for <%- propertyType(property) %> - * @return property wrapper around a <%- propertyType(property) %> function - */ - public static <Z extends Number> PropertyValue<CameraFunction<Z, <%- propertyType(property) %>>> <%- camelizeWithLeadingLowercase(property.name) %>(CameraFunction<Z, <%- propertyType(property) %>> function) { - return new LayoutPropertyValue<>("<%- property.name %>", function); - } - -<% } -%> <% } -%> public static String colorToRgbaString(@ColorInt int value) { return String.format(Locale.US,"rgba(%d, %d, %d, %d)", diff --git a/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/style/layers/FunctionTest.java b/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/style/layers/FunctionTest.java deleted file mode 100644 index bac1154d62..0000000000 --- a/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/style/layers/FunctionTest.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.mapbox.mapboxsdk.style.layers; - -import com.mapbox.mapboxsdk.style.functions.Function; - -import org.junit.Test; - -import static com.mapbox.mapboxsdk.style.functions.Function.zoom; -import static com.mapbox.mapboxsdk.style.functions.stops.Stop.stop; -import static com.mapbox.mapboxsdk.style.functions.stops.Stops.interval; -import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.lineBlur; -import static org.junit.Assert.assertArrayEquals; -import static org.junit.Assert.assertNotNull; - -/** - * Tests Function - */ -public class FunctionTest { - - @Test - public void testZoomFunction() { - Function<Float, Float> zoomF = zoom(interval( - stop(1f, lineBlur(1f)), - stop(10f, lineBlur(20f)) - ) - ); - - assertNotNull(zoomF.toValueObject()); - assertArrayEquals( - new Object[] {new Object[] {1f, 1f}, new Object[] {10f, 20f}}, - (Object[]) zoomF.toValueObject().get("stops") - ); - } - -} |