diff options
Diffstat (limited to 'platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style')
36 files changed, 2343 insertions, 1312 deletions
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 new file mode 100644 index 0000000000..bb87fe8a39 --- /dev/null +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/functions/CameraFunction.java @@ -0,0 +1,50 @@ +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 new file mode 100644 index 0000000000..1db14afc5f --- /dev/null +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/functions/CompositeFunction.java @@ -0,0 +1,99 @@ +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 java.util.Map; + +/** + * Composite functions combine {@link android.graphics.Camera} and {@link SourceFunction}s. + * <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 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 = 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(O defaultValue) { + this.defaultValue = defaultValue; + return this; + } + + /** + * @return the defaultValue + */ + @Nullable + public 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); + } + 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 new file mode 100644 index 0000000000..e1e40821b1 --- /dev/null +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/functions/Function.java @@ -0,0 +1,300 @@ +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(String.format("Stops: %s is a different type: %s", stops.getClass(), exception)); + 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 new file mode 100644 index 0000000000..f0eed760a4 --- /dev/null +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/functions/SourceFunction.java @@ -0,0 +1,84 @@ +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 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 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; + } + + + /** + * 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(O defaultValue) { + this.defaultValue = defaultValue; + return this; + } + + /** + * @return the defaultValue + */ + @Nullable + public 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); + } + 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 new file mode 100644 index 0000000000..6979676c9e --- /dev/null +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/functions/package-info.java @@ -0,0 +1,6 @@ +/** + * 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 new file mode 100644 index 0000000000..f9b2929350 --- /dev/null +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/functions/stops/CategoricalStops.java @@ -0,0 +1,64 @@ +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 new file mode 100644 index 0000000000..d47aa1fc91 --- /dev/null +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/functions/stops/ExponentialStops.java @@ -0,0 +1,97 @@ +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 new file mode 100644 index 0000000000..2c0b198dc2 --- /dev/null +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/functions/stops/IdentityStops.java @@ -0,0 +1,18 @@ +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 new file mode 100644 index 0000000000..9d95b3f8c1 --- /dev/null +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/functions/stops/IntervalStops.java @@ -0,0 +1,58 @@ +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 new file mode 100644 index 0000000000..8c5a6e8913 --- /dev/null +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/functions/stops/IterableStops.java @@ -0,0 +1,52 @@ +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 new file mode 100644 index 0000000000..72164f4c4b --- /dev/null +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/functions/stops/Stop.java @@ -0,0 +1,109 @@ +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 new file mode 100644 index 0000000000..af4f53c072 --- /dev/null +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/functions/stops/Stops.java @@ -0,0 +1,99 @@ +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 new file mode 100644 index 0000000000..fa388a9589 --- /dev/null +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/functions/stops/package-info.java @@ -0,0 +1,6 @@ +/** + * 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/BackgroundLayer.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/BackgroundLayer.java index 45523b41ab..0f1265f1a1 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/BackgroundLayer.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/BackgroundLayer.java @@ -1,6 +1,7 @@ -package com.mapbox.mapboxsdk.style.layers; // This file is generated. Edit android/platform/scripts/generate-style-code.js, then run `make android-style-code`. +package com.mapbox.mapboxsdk.style.layers; + import android.support.annotation.ColorInt; import android.support.annotation.NonNull; import android.support.annotation.UiThread; @@ -41,7 +42,7 @@ public class BackgroundLayer extends Layer { * @param properties the var-args properties * @return This */ - public BackgroundLayer withProperties(@NonNull Property<?>... properties) { + public BackgroundLayer withProperties(@NonNull PropertyValue<?>... properties) { setProperties(properties); return this; } @@ -55,7 +56,7 @@ public class BackgroundLayer extends Layer { */ @SuppressWarnings("unchecked") public PropertyValue<String> getBackgroundColor() { - return (PropertyValue<String>) new PropertyValue(nativeGetBackgroundColor()); + return (PropertyValue<String>) new PropertyValue("background-color", nativeGetBackgroundColor()); } /** @@ -82,7 +83,7 @@ public class BackgroundLayer extends Layer { */ @SuppressWarnings("unchecked") public PropertyValue<String> getBackgroundPattern() { - return (PropertyValue<String>) new PropertyValue(nativeGetBackgroundPattern()); + return (PropertyValue<String>) new PropertyValue("background-pattern", nativeGetBackgroundPattern()); } /** @@ -92,7 +93,7 @@ public class BackgroundLayer extends Layer { */ @SuppressWarnings("unchecked") public PropertyValue<Float> getBackgroundOpacity() { - return (PropertyValue<Float>) new PropertyValue(nativeGetBackgroundOpacity()); + return (PropertyValue<Float>) new PropertyValue("background-opacity", nativeGetBackgroundOpacity()); } private native Object nativeGetBackgroundColor(); diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/CircleLayer.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/CircleLayer.java index f16ab688d6..43ec255e81 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/CircleLayer.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/CircleLayer.java @@ -1,6 +1,7 @@ -package com.mapbox.mapboxsdk.style.layers; // This file is generated. Edit android/platform/scripts/generate-style-code.js, then run `make android-style-code`. +package com.mapbox.mapboxsdk.style.layers; + import android.support.annotation.ColorInt; import android.support.annotation.NonNull; import android.support.annotation.UiThread; @@ -62,27 +63,7 @@ public class CircleLayer extends Layer { * @param filter the filter to set */ public void setFilter(Filter.Statement filter) { - this.setFilter(filter.toArray()); - } - - /** - * Set an array of filters. - * - * @param filter the filter array to set - */ - public void setFilter(Object[] filter) { - nativeSetFilter(filter); - } - - /** - * Set an array of filters. - * - * @param filter tthe filter array to set - * @return This - */ - public CircleLayer withFilter(Object[] filter) { - setFilter(filter); - return this; + nativeSetFilter(filter.toArray()); } /** @@ -96,14 +77,13 @@ public class CircleLayer extends Layer { return this; } - /** * Set a property or properties. * * @param properties the var-args properties * @return This */ - public CircleLayer withProperties(@NonNull Property<?>... properties) { + public CircleLayer withProperties(@NonNull PropertyValue<?>... properties) { setProperties(properties); return this; } @@ -117,7 +97,7 @@ public class CircleLayer extends Layer { */ @SuppressWarnings("unchecked") public PropertyValue<Float> getCircleRadius() { - return (PropertyValue<Float>) new PropertyValue(nativeGetCircleRadius()); + return (PropertyValue<Float>) new PropertyValue("circle-radius", nativeGetCircleRadius()); } /** @@ -127,7 +107,7 @@ public class CircleLayer extends Layer { */ @SuppressWarnings("unchecked") public PropertyValue<String> getCircleColor() { - return (PropertyValue<String>) new PropertyValue(nativeGetCircleColor()); + return (PropertyValue<String>) new PropertyValue("circle-color", nativeGetCircleColor()); } /** @@ -154,7 +134,7 @@ public class CircleLayer extends Layer { */ @SuppressWarnings("unchecked") public PropertyValue<Float> getCircleBlur() { - return (PropertyValue<Float>) new PropertyValue(nativeGetCircleBlur()); + return (PropertyValue<Float>) new PropertyValue("circle-blur", nativeGetCircleBlur()); } /** @@ -164,7 +144,7 @@ public class CircleLayer extends Layer { */ @SuppressWarnings("unchecked") public PropertyValue<Float> getCircleOpacity() { - return (PropertyValue<Float>) new PropertyValue(nativeGetCircleOpacity()); + return (PropertyValue<Float>) new PropertyValue("circle-opacity", nativeGetCircleOpacity()); } /** @@ -174,7 +154,7 @@ public class CircleLayer extends Layer { */ @SuppressWarnings("unchecked") public PropertyValue<Float[]> getCircleTranslate() { - return (PropertyValue<Float[]>) new PropertyValue(nativeGetCircleTranslate()); + return (PropertyValue<Float[]>) new PropertyValue("circle-translate", nativeGetCircleTranslate()); } /** @@ -184,7 +164,7 @@ public class CircleLayer extends Layer { */ @SuppressWarnings("unchecked") public PropertyValue<String> getCircleTranslateAnchor() { - return (PropertyValue<String>) new PropertyValue(nativeGetCircleTranslateAnchor()); + return (PropertyValue<String>) new PropertyValue("circle-translate-anchor", nativeGetCircleTranslateAnchor()); } /** @@ -194,7 +174,7 @@ public class CircleLayer extends Layer { */ @SuppressWarnings("unchecked") public PropertyValue<String> getCirclePitchScale() { - return (PropertyValue<String>) new PropertyValue(nativeGetCirclePitchScale()); + return (PropertyValue<String>) new PropertyValue("circle-pitch-scale", nativeGetCirclePitchScale()); } /** @@ -204,7 +184,7 @@ public class CircleLayer extends Layer { */ @SuppressWarnings("unchecked") public PropertyValue<Float> getCircleStrokeWidth() { - return (PropertyValue<Float>) new PropertyValue(nativeGetCircleStrokeWidth()); + return (PropertyValue<Float>) new PropertyValue("circle-stroke-width", nativeGetCircleStrokeWidth()); } /** @@ -214,7 +194,7 @@ public class CircleLayer extends Layer { */ @SuppressWarnings("unchecked") public PropertyValue<String> getCircleStrokeColor() { - return (PropertyValue<String>) new PropertyValue(nativeGetCircleStrokeColor()); + return (PropertyValue<String>) new PropertyValue("circle-stroke-color", nativeGetCircleStrokeColor()); } /** @@ -241,7 +221,7 @@ public class CircleLayer extends Layer { */ @SuppressWarnings("unchecked") public PropertyValue<Float> getCircleStrokeOpacity() { - return (PropertyValue<Float>) new PropertyValue(nativeGetCircleStrokeOpacity()); + return (PropertyValue<Float>) new PropertyValue("circle-stroke-opacity", nativeGetCircleStrokeOpacity()); } private native Object nativeGetCircleRadius(); diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/FillLayer.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/FillLayer.java index 3f79c9306a..8989f3a2ec 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/FillLayer.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/FillLayer.java @@ -1,6 +1,7 @@ -package com.mapbox.mapboxsdk.style.layers; // This file is generated. Edit android/platform/scripts/generate-style-code.js, then run `make android-style-code`. +package com.mapbox.mapboxsdk.style.layers; + import android.support.annotation.ColorInt; import android.support.annotation.NonNull; import android.support.annotation.UiThread; @@ -62,27 +63,7 @@ public class FillLayer extends Layer { * @param filter the filter to set */ public void setFilter(Filter.Statement filter) { - this.setFilter(filter.toArray()); - } - - /** - * Set an array of filters. - * - * @param filter the filter array to set - */ - public void setFilter(Object[] filter) { - nativeSetFilter(filter); - } - - /** - * Set an array of filters. - * - * @param filter tthe filter array to set - * @return This - */ - public FillLayer withFilter(Object[] filter) { - setFilter(filter); - return this; + nativeSetFilter(filter.toArray()); } /** @@ -96,14 +77,13 @@ public class FillLayer extends Layer { return this; } - /** * Set a property or properties. * * @param properties the var-args properties * @return This */ - public FillLayer withProperties(@NonNull Property<?>... properties) { + public FillLayer withProperties(@NonNull PropertyValue<?>... properties) { setProperties(properties); return this; } @@ -117,7 +97,7 @@ public class FillLayer extends Layer { */ @SuppressWarnings("unchecked") public PropertyValue<Boolean> getFillAntialias() { - return (PropertyValue<Boolean>) new PropertyValue(nativeGetFillAntialias()); + return (PropertyValue<Boolean>) new PropertyValue("fill-antialias", nativeGetFillAntialias()); } /** @@ -127,7 +107,7 @@ public class FillLayer extends Layer { */ @SuppressWarnings("unchecked") public PropertyValue<Float> getFillOpacity() { - return (PropertyValue<Float>) new PropertyValue(nativeGetFillOpacity()); + return (PropertyValue<Float>) new PropertyValue("fill-opacity", nativeGetFillOpacity()); } /** @@ -137,12 +117,11 @@ public class FillLayer extends Layer { */ @SuppressWarnings("unchecked") public PropertyValue<String> getFillColor() { - return (PropertyValue<String>) new PropertyValue(nativeGetFillColor()); + return (PropertyValue<String>) new PropertyValue("fill-color", nativeGetFillColor()); } /** - * The color of the filled part of this layer. This color can be specified as `rgba` with an alpha component and the - * color's opacity will not affect the opacity of the 1px stroke, if it is used. + * The color of the filled part of this layer. This color can be specified as `rgba` with an alpha component and the color's opacity will not affect the opacity of the 1px stroke, if it is used. * * @return int representation of a rgba string color * @throws RuntimeException thrown if property isn't a value @@ -165,7 +144,7 @@ public class FillLayer extends Layer { */ @SuppressWarnings("unchecked") public PropertyValue<String> getFillOutlineColor() { - return (PropertyValue<String>) new PropertyValue(nativeGetFillOutlineColor()); + return (PropertyValue<String>) new PropertyValue("fill-outline-color", nativeGetFillOutlineColor()); } /** @@ -192,7 +171,7 @@ public class FillLayer extends Layer { */ @SuppressWarnings("unchecked") public PropertyValue<Float[]> getFillTranslate() { - return (PropertyValue<Float[]>) new PropertyValue(nativeGetFillTranslate()); + return (PropertyValue<Float[]>) new PropertyValue("fill-translate", nativeGetFillTranslate()); } /** @@ -202,7 +181,7 @@ public class FillLayer extends Layer { */ @SuppressWarnings("unchecked") public PropertyValue<String> getFillTranslateAnchor() { - return (PropertyValue<String>) new PropertyValue(nativeGetFillTranslateAnchor()); + return (PropertyValue<String>) new PropertyValue("fill-translate-anchor", nativeGetFillTranslateAnchor()); } /** @@ -212,7 +191,7 @@ public class FillLayer extends Layer { */ @SuppressWarnings("unchecked") public PropertyValue<String> getFillPattern() { - return (PropertyValue<String>) new PropertyValue(nativeGetFillPattern()); + return (PropertyValue<String>) new PropertyValue("fill-pattern", nativeGetFillPattern()); } private native Object nativeGetFillAntialias(); diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/Function.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/Function.java deleted file mode 100644 index 900fe10476..0000000000 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/Function.java +++ /dev/null @@ -1,137 +0,0 @@ -package com.mapbox.mapboxsdk.style.layers; - -import android.support.annotation.FloatRange; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; -import android.support.annotation.Size; - -import java.util.HashMap; -import java.util.Map; - -/** - * Functions are used to change properties in relation to the state of the map. - * <p> - * Currently, only zoom functions are supported. - * </p> - * - * @param <T> the target property's value type. Make sure it matches. - * @see <a href="https://www.mapbox.com/mapbox-gl-style-spec/#types-function">The online documentation</a> - */ -public class Function<T> { - - /** - * A stop represents a certain point in the range of this function - * - * @param <I> input - * @param <O> output - */ - public static class Stop<I, O> { - public final I in; - public final O out; - - Stop(I in, O out) { - this.in = in; - this.out = out; - } - - /** - * @return an array representation of the Stop - */ - Object[] toValueObject() { - return new Object[] {in, out}; - } - - @Override - public String toString() { - return String.format("[%s, %s]", in, out); - } - } - - /** - * 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 stops the stops that define the function - * @param <T> the property type - * @return the {@link Function} - */ - @SafeVarargs - public static <T> Function<T> zoom(@NonNull @Size(min = 1) Stop<Float, T>... stops) { - return new Function<T>(stops); - } - - - /** - * 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 stops the stops that define the function - * @param base the exponential base of the interpolation curve - Default 1 - * @param <T> the property type - * @return the {@link Function} - */ - @SafeVarargs - public static <T> Function<T> zoom( - @FloatRange(from = 0, to = 1, fromInclusive = false, toInclusive = false) float base, - @NonNull @Size(min = 1) Stop<Float, T>... stops) { - return new Function<T>(stops) - .withBase(base); - } - - /** - * Creates a stop to use in a {@link Function} - * - * @param in the input for the stop - * @param output the output for the stop - * @param <T> the output property type - * @return the {@link Stop} - */ - public static <T> Stop<Float, T> stop(float in, Property<T> output) { - return new Stop<>(in, output.value); - } - - private final Stop<Float, T>[] stops; - private Float base; - - Function(@NonNull @Size(min = 1) Stop<Float, T>[] stops) { - this.stops = stops; - } - - Function<T> withBase(float base) { - this.base = base; - return this; - } - - /** - * @return the base - */ - @Nullable - public Float getBase() { - return base; - } - - /** - * @return the stops in this function - */ - public Stop<Float, T>[] getStops() { - return stops; - } - - Map<String, Object> toValueObject() { - Object[] stopsValue = new Object[stops.length]; - - for (int i = 0; i < stopsValue.length; i++) { - Stop stop = stops[i]; - stopsValue[i] = stop.toValueObject(); - } - - Map<String, Object> value = new HashMap<>(); - if (base != null) { - value.put("base", base); - } - value.put("stops", stopsValue); - return value; - } -} 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 2878d76430..b4120f4f9a 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 @@ -2,6 +2,8 @@ package com.mapbox.mapboxsdk.style.layers; import android.support.annotation.NonNull; +import com.mapbox.mapboxsdk.style.functions.Function; + /** * Base class for the different Layer types */ @@ -17,14 +19,14 @@ public abstract class Layer { public Layer() { } - public void setProperties(@NonNull Property<?>... properties) { + public void setProperties(@NonNull PropertyValue<?>... properties) { if (properties.length == 0) { return; } - for (Property<?> property : properties) { + for (PropertyValue<?> property : properties) { Object converted = convertValue(property.value); - if (property instanceof PaintProperty) { + if (property instanceof PaintPropertyValue) { nativeSetPaintProperty(property.name, converted); } else { nativeSetLayoutProperty(property.name, converted); @@ -37,7 +39,7 @@ public abstract class Layer { } public PropertyValue<String> getVisibility() { - return new PropertyValue<>(nativeGetVisibility()); + return new PaintPropertyValue<>("visibility", (String) nativeGetVisibility()); } public float getMinZoom() { diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/LayoutProperty.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/LayoutProperty.java deleted file mode 100644 index 4c0b52be55..0000000000 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/LayoutProperty.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.mapbox.mapboxsdk.style.layers; - -class LayoutProperty<T> extends Property<T> { - - LayoutProperty(String name, T value) { - super(name, value); - } - -} diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/LayoutPropertyValue.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/LayoutPropertyValue.java new file mode 100644 index 0000000000..ed88a85912 --- /dev/null +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/LayoutPropertyValue.java @@ -0,0 +1,11 @@ +package com.mapbox.mapboxsdk.style.layers; + +import android.support.annotation.NonNull; + +class LayoutPropertyValue<T> extends PropertyValue<T> { + + LayoutPropertyValue(@NonNull String name, T value) { + super(name, value); + } + +} diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/LineLayer.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/LineLayer.java index 4c52a40b05..6992c22ace 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/LineLayer.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/LineLayer.java @@ -1,6 +1,7 @@ -package com.mapbox.mapboxsdk.style.layers; // This file is generated. Edit android/platform/scripts/generate-style-code.js, then run `make android-style-code`. +package com.mapbox.mapboxsdk.style.layers; + import android.support.annotation.ColorInt; import android.support.annotation.NonNull; import android.support.annotation.UiThread; @@ -62,27 +63,7 @@ public class LineLayer extends Layer { * @param filter the filter to set */ public void setFilter(Filter.Statement filter) { - this.setFilter(filter.toArray()); - } - - /** - * Set an array of filters. - * - * @param filter the filter array to set - */ - public void setFilter(Object[] filter) { - nativeSetFilter(filter); - } - - /** - * Set an array of filters. - * - * @param filter tthe filter array to set - * @return This - */ - public LineLayer withFilter(Object[] filter) { - setFilter(filter); - return this; + nativeSetFilter(filter.toArray()); } /** @@ -96,14 +77,13 @@ public class LineLayer extends Layer { return this; } - /** * Set a property or properties. * * @param properties the var-args properties * @return This */ - public LineLayer withProperties(@NonNull Property<?>... properties) { + public LineLayer withProperties(@NonNull PropertyValue<?>... properties) { setProperties(properties); return this; } @@ -117,7 +97,7 @@ public class LineLayer extends Layer { */ @SuppressWarnings("unchecked") public PropertyValue<String> getLineCap() { - return (PropertyValue<String>) new PropertyValue(nativeGetLineCap()); + return (PropertyValue<String>) new PropertyValue("line-cap", nativeGetLineCap()); } /** @@ -127,7 +107,7 @@ public class LineLayer extends Layer { */ @SuppressWarnings("unchecked") public PropertyValue<String> getLineJoin() { - return (PropertyValue<String>) new PropertyValue(nativeGetLineJoin()); + return (PropertyValue<String>) new PropertyValue("line-join", nativeGetLineJoin()); } /** @@ -137,7 +117,7 @@ public class LineLayer extends Layer { */ @SuppressWarnings("unchecked") public PropertyValue<Float> getLineMiterLimit() { - return (PropertyValue<Float>) new PropertyValue(nativeGetLineMiterLimit()); + return (PropertyValue<Float>) new PropertyValue("line-miter-limit", nativeGetLineMiterLimit()); } /** @@ -147,7 +127,7 @@ public class LineLayer extends Layer { */ @SuppressWarnings("unchecked") public PropertyValue<Float> getLineRoundLimit() { - return (PropertyValue<Float>) new PropertyValue(nativeGetLineRoundLimit()); + return (PropertyValue<Float>) new PropertyValue("line-round-limit", nativeGetLineRoundLimit()); } /** @@ -157,7 +137,7 @@ public class LineLayer extends Layer { */ @SuppressWarnings("unchecked") public PropertyValue<Float> getLineOpacity() { - return (PropertyValue<Float>) new PropertyValue(nativeGetLineOpacity()); + return (PropertyValue<Float>) new PropertyValue("line-opacity", nativeGetLineOpacity()); } /** @@ -167,7 +147,7 @@ public class LineLayer extends Layer { */ @SuppressWarnings("unchecked") public PropertyValue<String> getLineColor() { - return (PropertyValue<String>) new PropertyValue(nativeGetLineColor()); + return (PropertyValue<String>) new PropertyValue("line-color", nativeGetLineColor()); } /** @@ -194,7 +174,7 @@ public class LineLayer extends Layer { */ @SuppressWarnings("unchecked") public PropertyValue<Float[]> getLineTranslate() { - return (PropertyValue<Float[]>) new PropertyValue(nativeGetLineTranslate()); + return (PropertyValue<Float[]>) new PropertyValue("line-translate", nativeGetLineTranslate()); } /** @@ -204,7 +184,7 @@ public class LineLayer extends Layer { */ @SuppressWarnings("unchecked") public PropertyValue<String> getLineTranslateAnchor() { - return (PropertyValue<String>) new PropertyValue(nativeGetLineTranslateAnchor()); + return (PropertyValue<String>) new PropertyValue("line-translate-anchor", nativeGetLineTranslateAnchor()); } /** @@ -214,7 +194,7 @@ public class LineLayer extends Layer { */ @SuppressWarnings("unchecked") public PropertyValue<Float> getLineWidth() { - return (PropertyValue<Float>) new PropertyValue(nativeGetLineWidth()); + return (PropertyValue<Float>) new PropertyValue("line-width", nativeGetLineWidth()); } /** @@ -224,7 +204,7 @@ public class LineLayer extends Layer { */ @SuppressWarnings("unchecked") public PropertyValue<Float> getLineGapWidth() { - return (PropertyValue<Float>) new PropertyValue(nativeGetLineGapWidth()); + return (PropertyValue<Float>) new PropertyValue("line-gap-width", nativeGetLineGapWidth()); } /** @@ -234,7 +214,7 @@ public class LineLayer extends Layer { */ @SuppressWarnings("unchecked") public PropertyValue<Float> getLineOffset() { - return (PropertyValue<Float>) new PropertyValue(nativeGetLineOffset()); + return (PropertyValue<Float>) new PropertyValue("line-offset", nativeGetLineOffset()); } /** @@ -244,7 +224,7 @@ public class LineLayer extends Layer { */ @SuppressWarnings("unchecked") public PropertyValue<Float> getLineBlur() { - return (PropertyValue<Float>) new PropertyValue(nativeGetLineBlur()); + return (PropertyValue<Float>) new PropertyValue("line-blur", nativeGetLineBlur()); } /** @@ -254,7 +234,7 @@ public class LineLayer extends Layer { */ @SuppressWarnings("unchecked") public PropertyValue<Float[]> getLineDasharray() { - return (PropertyValue<Float[]>) new PropertyValue(nativeGetLineDasharray()); + return (PropertyValue<Float[]>) new PropertyValue("line-dasharray", nativeGetLineDasharray()); } /** @@ -264,7 +244,7 @@ public class LineLayer extends Layer { */ @SuppressWarnings("unchecked") public PropertyValue<String> getLinePattern() { - return (PropertyValue<String>) new PropertyValue(nativeGetLinePattern()); + return (PropertyValue<String>) new PropertyValue("line-pattern", nativeGetLinePattern()); } private native Object nativeGetLineCap(); diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/NoSuchLayerException.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/NoSuchLayerException.java deleted file mode 100644 index 3b8777080d..0000000000 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/NoSuchLayerException.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.mapbox.mapboxsdk.style.layers; - -/** - * No such layer. - */ -public class NoSuchLayerException extends Exception { - - public NoSuchLayerException(String message) { - super(message); - } -} diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/PaintProperty.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/PaintProperty.java deleted file mode 100644 index 69405177d9..0000000000 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/PaintProperty.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.mapbox.mapboxsdk.style.layers; - -class PaintProperty<T> extends Property<T> { - - PaintProperty(String name, T value) { - super(name, value); - } - -} diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/PaintPropertyValue.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/PaintPropertyValue.java new file mode 100644 index 0000000000..e6ac2d9763 --- /dev/null +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/PaintPropertyValue.java @@ -0,0 +1,11 @@ +package com.mapbox.mapboxsdk.style.layers; + +import android.support.annotation.NonNull; + +class PaintPropertyValue<T> extends PropertyValue<T> { + + PaintPropertyValue(@NonNull String name, T value) { + super(name, value); + } + +} diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/Property.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/Property.java index bb060ddf15..641ee551a2 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/Property.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/Property.java @@ -1,6 +1,7 @@ -package com.mapbox.mapboxsdk.style.layers; // This file is generated. Edit android/platform/scripts/generate-style-code.js, then run `make android-style-code`. +package com.mapbox.mapboxsdk.style.layers; + import android.support.annotation.StringDef; import java.lang.annotation.Retention; @@ -9,9 +10,9 @@ import java.lang.annotation.RetentionPolicy; /** * Paint/Layout properties for Layer */ -public abstract class Property<T> { +public final class Property { - //VISIBILITY: Whether this layer is displayed. + // VISIBILITY: Whether this layer is displayed. /** * The layer is shown. @@ -22,74 +23,66 @@ public abstract class Property<T> { */ public static final String NONE = "none"; - @StringDef( { - VISIBLE, - NONE + @StringDef({ + VISIBLE, + NONE }) @Retention(RetentionPolicy.SOURCE) - public @interface VISIBILITY { - } + public @interface VISIBILITY {} - //LINE_CAP: The display of line endings. + // LINE_CAP: The display of line endings. /** * A cap with a squared-off end which is drawn to the exact endpoint of the line. */ public static final String LINE_CAP_BUTT = "butt"; /** - * A cap with a rounded end which is drawn beyond the endpoint of the line at a radius of one-half of the line's - * width and centered on the endpoint of the line. + * A cap with a rounded end which is drawn beyond the endpoint of the line at a radius of one-half of the line's width and centered on the endpoint of the line. */ public static final String LINE_CAP_ROUND = "round"; /** - * A cap with a squared-off end which is drawn beyond the endpoint of the line at a distance of one-half of the - * line's width. + * A cap with a squared-off end which is drawn beyond the endpoint of the line at a distance of one-half of the line's width. */ public static final String LINE_CAP_SQUARE = "square"; /** * The display of line endings. */ - @StringDef( { - LINE_CAP_BUTT, - LINE_CAP_ROUND, - LINE_CAP_SQUARE, - }) + @StringDef({ + LINE_CAP_BUTT, + LINE_CAP_ROUND, + LINE_CAP_SQUARE, + }) @Retention(RetentionPolicy.SOURCE) - public @interface LINE_CAP { - } + public @interface LINE_CAP {} - //LINE_JOIN: The display of lines when joining. + // LINE_JOIN: The display of lines when joining. /** - * A join with a squared-off end which is drawn beyond the endpoint of the line at a distance of one-half of the - * line's width. + * A join with a squared-off end which is drawn beyond the endpoint of the line at a distance of one-half of the line's width. */ public static final String LINE_JOIN_BEVEL = "bevel"; /** - * A join with a rounded end which is drawn beyond the endpoint of the line at a radius of one-half of the line's - * width and centered on the endpoint of the line. + * A join with a rounded end which is drawn beyond the endpoint of the line at a radius of one-half of the line's width and centered on the endpoint of the line. */ public static final String LINE_JOIN_ROUND = "round"; /** - * A join with a sharp, angled corner which is drawn with the outer sides beyond the endpoint of the path until - * they meet. + * A join with a sharp, angled corner which is drawn with the outer sides beyond the endpoint of the path until they meet. */ public static final String LINE_JOIN_MITER = "miter"; /** * The display of lines when joining. */ - @StringDef( { - LINE_JOIN_BEVEL, - LINE_JOIN_ROUND, - LINE_JOIN_MITER, - }) + @StringDef({ + LINE_JOIN_BEVEL, + LINE_JOIN_ROUND, + LINE_JOIN_MITER, + }) @Retention(RetentionPolicy.SOURCE) - public @interface LINE_JOIN { - } + public @interface LINE_JOIN {} - //SYMBOL_PLACEMENT: Label placement relative to its geometry. + // SYMBOL_PLACEMENT: Label placement relative to its geometry. /** * The label is placed at the point where the geometry is located. @@ -103,46 +96,40 @@ public abstract class Property<T> { /** * Label placement relative to its geometry. */ - @StringDef( { - SYMBOL_PLACEMENT_POINT, - SYMBOL_PLACEMENT_LINE, - }) + @StringDef({ + SYMBOL_PLACEMENT_POINT, + SYMBOL_PLACEMENT_LINE, + }) @Retention(RetentionPolicy.SOURCE) - public @interface SYMBOL_PLACEMENT { - } + public @interface SYMBOL_PLACEMENT {} - //ICON_ROTATION_ALIGNMENT: In combination with `symbol-placement`, determines the rotation behavior of icons. + // ICON_ROTATION_ALIGNMENT: In combination with `symbol-placement`, determines the rotation behavior of icons. /** - * When {@link SYMBOL_PLACEMENT} is set to {@link Property#SYMBOL_PLACEMENT_POINT}, aligns icons east-west. When - * {@link SYMBOL_PLACEMENT} is set to {@link Property#SYMBOL_PLACEMENT_LINE}, aligns icon x-axes with the line. + * When {@link SYMBOL_PLACEMENT} is set to {@link Property#SYMBOL_PLACEMENT_POINT}, aligns icons east-west. When {@link SYMBOL_PLACEMENT} is set to {@link Property#SYMBOL_PLACEMENT_LINE}, aligns icon x-axes with the line. */ public static final String ICON_ROTATION_ALIGNMENT_MAP = "map"; /** - * Produces icons whose x-axes are aligned with the x-axis of the viewport, regardless of the value of - * {@link SYMBOL_PLACEMENT}. + * Produces icons whose x-axes are aligned with the x-axis of the viewport, regardless of the value of {@link SYMBOL_PLACEMENT}. */ public static final String ICON_ROTATION_ALIGNMENT_VIEWPORT = "viewport"; /** - * When {@link SYMBOL_PLACEMENT} is set to {@link Property#SYMBOL_PLACEMENT_POINT}, this is equivalent to - * {@link Property#ICON_ROTATION_ALIGNMENT_VIEWPORT}. When {@link SYMBOL_PLACEMENT} is set to - * {@link Property#SYMBOL_PLACEMENT_LINE}, this is equivalent to {@link Property#ICON_ROTATION_ALIGNMENT_MAP}. + * When {@link SYMBOL_PLACEMENT} is set to {@link Property#SYMBOL_PLACEMENT_POINT}, this is equivalent to {@link Property#ICON_ROTATION_ALIGNMENT_VIEWPORT}. When {@link SYMBOL_PLACEMENT} is set to {@link Property#SYMBOL_PLACEMENT_LINE}, this is equivalent to {@link Property#ICON_ROTATION_ALIGNMENT_MAP}. */ public static final String ICON_ROTATION_ALIGNMENT_AUTO = "auto"; /** * In combination with `symbol-placement`, determines the rotation behavior of icons. */ - @StringDef( { - ICON_ROTATION_ALIGNMENT_MAP, - ICON_ROTATION_ALIGNMENT_VIEWPORT, - ICON_ROTATION_ALIGNMENT_AUTO, - }) + @StringDef({ + ICON_ROTATION_ALIGNMENT_MAP, + ICON_ROTATION_ALIGNMENT_VIEWPORT, + ICON_ROTATION_ALIGNMENT_AUTO, + }) @Retention(RetentionPolicy.SOURCE) - public @interface ICON_ROTATION_ALIGNMENT { - } + public @interface ICON_ROTATION_ALIGNMENT {} - //ICON_TEXT_FIT: Scales the icon to fit around the associated text. + // ICON_TEXT_FIT: Scales the icon to fit around the associated text. /** * The icon is displayed at its intrinsic aspect ratio. @@ -164,17 +151,16 @@ public abstract class Property<T> { /** * Scales the icon to fit around the associated text. */ - @StringDef( { - ICON_TEXT_FIT_NONE, - ICON_TEXT_FIT_WIDTH, - ICON_TEXT_FIT_HEIGHT, - ICON_TEXT_FIT_BOTH, - }) + @StringDef({ + ICON_TEXT_FIT_NONE, + ICON_TEXT_FIT_WIDTH, + ICON_TEXT_FIT_HEIGHT, + ICON_TEXT_FIT_BOTH, + }) @Retention(RetentionPolicy.SOURCE) - public @interface ICON_TEXT_FIT { - } + public @interface ICON_TEXT_FIT {} - //TEXT_PITCH_ALIGNMENT: Orientation of text when map is pitched. + // TEXT_PITCH_ALIGNMENT: Orientation of text when map is pitched. /** * The text is aligned to the plane of the map. @@ -192,48 +178,41 @@ public abstract class Property<T> { /** * Orientation of text when map is pitched. */ - @StringDef( { - TEXT_PITCH_ALIGNMENT_MAP, - TEXT_PITCH_ALIGNMENT_VIEWPORT, - TEXT_PITCH_ALIGNMENT_AUTO, - }) + @StringDef({ + TEXT_PITCH_ALIGNMENT_MAP, + TEXT_PITCH_ALIGNMENT_VIEWPORT, + TEXT_PITCH_ALIGNMENT_AUTO, + }) @Retention(RetentionPolicy.SOURCE) - public @interface TEXT_PITCH_ALIGNMENT { - } + public @interface TEXT_PITCH_ALIGNMENT {} - //TEXT_ROTATION_ALIGNMENT: In combination with `symbol-placement`, determines the rotation behavior of the individual - // glyphs forming the text. + // TEXT_ROTATION_ALIGNMENT: In combination with `symbol-placement`, determines the rotation behavior of the individual glyphs forming the text. /** - * When {@link SYMBOL_PLACEMENT} is set to {@link Property#SYMBOL_PLACEMENT_POINT}, aligns text east-west. When - * {@link SYMBOL_PLACEMENT} is set to {@link Property#SYMBOL_PLACEMENT_LINE}, aligns text x-axes with the line. + * When {@link SYMBOL_PLACEMENT} is set to {@link Property#SYMBOL_PLACEMENT_POINT}, aligns text east-west. When {@link SYMBOL_PLACEMENT} is set to {@link Property#SYMBOL_PLACEMENT_LINE}, aligns text x-axes with the line. */ public static final String TEXT_ROTATION_ALIGNMENT_MAP = "map"; /** - * Produces glyphs whose x-axes are aligned with the x-axis of the viewport, regardless of the value of - * {@link SYMBOL_PLACEMENT}. + * Produces glyphs whose x-axes are aligned with the x-axis of the viewport, regardless of the value of {@link SYMBOL_PLACEMENT}. */ public static final String TEXT_ROTATION_ALIGNMENT_VIEWPORT = "viewport"; /** - * When {@link SYMBOL_PLACEMENT} is set to {@link Property#SYMBOL_PLACEMENT_POINT}, this is equivalent to - * {@link Property#TEXT_ROTATION_ALIGNMENT_VIEWPORT}. When {@link SYMBOL_PLACEMENT} is set to - * {@link Property#SYMBOL_PLACEMENT_LINE}, this is equivalent to {@link Property#TEXT_ROTATION_ALIGNMENT_MAP}. + * When {@link SYMBOL_PLACEMENT} is set to {@link Property#SYMBOL_PLACEMENT_POINT}, this is equivalent to {@link Property#TEXT_ROTATION_ALIGNMENT_VIEWPORT}. When {@link SYMBOL_PLACEMENT} is set to {@link Property#SYMBOL_PLACEMENT_LINE}, this is equivalent to {@link Property#TEXT_ROTATION_ALIGNMENT_MAP}. */ public static final String TEXT_ROTATION_ALIGNMENT_AUTO = "auto"; /** * In combination with `symbol-placement`, determines the rotation behavior of the individual glyphs forming the text. */ - @StringDef( { - TEXT_ROTATION_ALIGNMENT_MAP, - TEXT_ROTATION_ALIGNMENT_VIEWPORT, - TEXT_ROTATION_ALIGNMENT_AUTO, - }) + @StringDef({ + TEXT_ROTATION_ALIGNMENT_MAP, + TEXT_ROTATION_ALIGNMENT_VIEWPORT, + TEXT_ROTATION_ALIGNMENT_AUTO, + }) @Retention(RetentionPolicy.SOURCE) - public @interface TEXT_ROTATION_ALIGNMENT { - } + public @interface TEXT_ROTATION_ALIGNMENT {} - //TEXT_JUSTIFY: Text justification options. + // TEXT_JUSTIFY: Text justification options. /** * The text is aligned to the left. @@ -251,16 +230,15 @@ public abstract class Property<T> { /** * Text justification options. */ - @StringDef( { - TEXT_JUSTIFY_LEFT, - TEXT_JUSTIFY_CENTER, - TEXT_JUSTIFY_RIGHT, - }) + @StringDef({ + TEXT_JUSTIFY_LEFT, + TEXT_JUSTIFY_CENTER, + TEXT_JUSTIFY_RIGHT, + }) @Retention(RetentionPolicy.SOURCE) - public @interface TEXT_JUSTIFY { - } + public @interface TEXT_JUSTIFY {} - //TEXT_ANCHOR: Part of the text placed closest to the anchor. + // TEXT_ANCHOR: Part of the text placed closest to the anchor. /** * The center of the text is placed closest to the anchor. @@ -302,22 +280,21 @@ public abstract class Property<T> { /** * Part of the text placed closest to the anchor. */ - @StringDef( { - TEXT_ANCHOR_CENTER, - TEXT_ANCHOR_LEFT, - TEXT_ANCHOR_RIGHT, - TEXT_ANCHOR_TOP, - TEXT_ANCHOR_BOTTOM, - TEXT_ANCHOR_TOP_LEFT, - TEXT_ANCHOR_TOP_RIGHT, - TEXT_ANCHOR_BOTTOM_LEFT, - TEXT_ANCHOR_BOTTOM_RIGHT, - }) + @StringDef({ + TEXT_ANCHOR_CENTER, + TEXT_ANCHOR_LEFT, + TEXT_ANCHOR_RIGHT, + TEXT_ANCHOR_TOP, + TEXT_ANCHOR_BOTTOM, + TEXT_ANCHOR_TOP_LEFT, + TEXT_ANCHOR_TOP_RIGHT, + TEXT_ANCHOR_BOTTOM_LEFT, + TEXT_ANCHOR_BOTTOM_RIGHT, + }) @Retention(RetentionPolicy.SOURCE) - public @interface TEXT_ANCHOR { - } + public @interface TEXT_ANCHOR {} - //TEXT_TRANSFORM: Specifies how to capitalize text, similar to the CSS `text-transform` property. + // TEXT_TRANSFORM: Specifies how to capitalize text, similar to the CSS `text-transform` property. /** * The text is not altered. @@ -335,16 +312,15 @@ public abstract class Property<T> { /** * Specifies how to capitalize text, similar to the CSS `text-transform` property. */ - @StringDef( { - TEXT_TRANSFORM_NONE, - TEXT_TRANSFORM_UPPERCASE, - TEXT_TRANSFORM_LOWERCASE, - }) + @StringDef({ + TEXT_TRANSFORM_NONE, + TEXT_TRANSFORM_UPPERCASE, + TEXT_TRANSFORM_LOWERCASE, + }) @Retention(RetentionPolicy.SOURCE) - public @interface TEXT_TRANSFORM { - } + public @interface TEXT_TRANSFORM {} - //FILL_TRANSLATE_ANCHOR: Controls the translation reference point. + // FILL_TRANSLATE_ANCHOR: Controls the translation reference point. /** * The fill is translated relative to the map. @@ -358,15 +334,14 @@ public abstract class Property<T> { /** * Controls the translation reference point. */ - @StringDef( { - FILL_TRANSLATE_ANCHOR_MAP, - FILL_TRANSLATE_ANCHOR_VIEWPORT, - }) + @StringDef({ + FILL_TRANSLATE_ANCHOR_MAP, + FILL_TRANSLATE_ANCHOR_VIEWPORT, + }) @Retention(RetentionPolicy.SOURCE) - public @interface FILL_TRANSLATE_ANCHOR { - } + public @interface FILL_TRANSLATE_ANCHOR {} - //LINE_TRANSLATE_ANCHOR: Controls the translation reference point. + // LINE_TRANSLATE_ANCHOR: Controls the translation reference point. /** * The line is translated relative to the map. @@ -380,15 +355,14 @@ public abstract class Property<T> { /** * Controls the translation reference point. */ - @StringDef( { - LINE_TRANSLATE_ANCHOR_MAP, - LINE_TRANSLATE_ANCHOR_VIEWPORT, - }) + @StringDef({ + LINE_TRANSLATE_ANCHOR_MAP, + LINE_TRANSLATE_ANCHOR_VIEWPORT, + }) @Retention(RetentionPolicy.SOURCE) - public @interface LINE_TRANSLATE_ANCHOR { - } + public @interface LINE_TRANSLATE_ANCHOR {} - //ICON_TRANSLATE_ANCHOR: Controls the translation reference point. + // ICON_TRANSLATE_ANCHOR: Controls the translation reference point. /** * Icons are translated relative to the map. @@ -402,15 +376,14 @@ public abstract class Property<T> { /** * Controls the translation reference point. */ - @StringDef( { - ICON_TRANSLATE_ANCHOR_MAP, - ICON_TRANSLATE_ANCHOR_VIEWPORT, - }) + @StringDef({ + ICON_TRANSLATE_ANCHOR_MAP, + ICON_TRANSLATE_ANCHOR_VIEWPORT, + }) @Retention(RetentionPolicy.SOURCE) - public @interface ICON_TRANSLATE_ANCHOR { - } + public @interface ICON_TRANSLATE_ANCHOR {} - //TEXT_TRANSLATE_ANCHOR: Controls the translation reference point. + // TEXT_TRANSLATE_ANCHOR: Controls the translation reference point. /** * The text is translated relative to the map. @@ -424,15 +397,14 @@ public abstract class Property<T> { /** * Controls the translation reference point. */ - @StringDef( { - TEXT_TRANSLATE_ANCHOR_MAP, - TEXT_TRANSLATE_ANCHOR_VIEWPORT, - }) + @StringDef({ + TEXT_TRANSLATE_ANCHOR_MAP, + TEXT_TRANSLATE_ANCHOR_VIEWPORT, + }) @Retention(RetentionPolicy.SOURCE) - public @interface TEXT_TRANSLATE_ANCHOR { - } + public @interface TEXT_TRANSLATE_ANCHOR {} - //CIRCLE_TRANSLATE_ANCHOR: Controls the translation reference point. + // CIRCLE_TRANSLATE_ANCHOR: Controls the translation reference point. /** * The circle is translated relative to the map. @@ -446,15 +418,14 @@ public abstract class Property<T> { /** * Controls the translation reference point. */ - @StringDef( { - CIRCLE_TRANSLATE_ANCHOR_MAP, - CIRCLE_TRANSLATE_ANCHOR_VIEWPORT, - }) + @StringDef({ + CIRCLE_TRANSLATE_ANCHOR_MAP, + CIRCLE_TRANSLATE_ANCHOR_VIEWPORT, + }) @Retention(RetentionPolicy.SOURCE) - public @interface CIRCLE_TRANSLATE_ANCHOR { - } + public @interface CIRCLE_TRANSLATE_ANCHOR {} - //CIRCLE_PITCH_SCALE: Controls the scaling behavior of the circle when the map is pitched. + // CIRCLE_PITCH_SCALE: Controls the scaling behavior of the circle when the map is pitched. /** * Circles are scaled according to their apparent distance to the camera. @@ -468,20 +439,14 @@ public abstract class Property<T> { /** * Controls the scaling behavior of the circle when the map is pitched. */ - @StringDef( { - CIRCLE_PITCH_SCALE_MAP, - CIRCLE_PITCH_SCALE_VIEWPORT, - }) + @StringDef({ + CIRCLE_PITCH_SCALE_MAP, + CIRCLE_PITCH_SCALE_VIEWPORT, + }) @Retention(RetentionPolicy.SOURCE) - public @interface CIRCLE_PITCH_SCALE { - } + public @interface CIRCLE_PITCH_SCALE {} - //Class definition - public final String name; - public final T value; - /* package */ Property(String name, T value) { - this.name = name; - this.value = value; + private Property() { } } 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 8e7d516a39..5cd0d99270 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 @@ -1,9 +1,13 @@ -package com.mapbox.mapboxsdk.style.layers; // This file is generated. Edit android/platform/scripts/generate-style-code.js, then run `make android-style-code`. +package com.mapbox.mapboxsdk.style.layers; + import android.annotation.SuppressLint; import android.support.annotation.ColorInt; +import com.mapbox.mapboxsdk.style.functions.Function; +import com.mapbox.mapboxsdk.style.functions.CameraFunction; + /** * Constructs paint/layout properties for Layers * @@ -17,18 +21,19 @@ public class PropertyFactory { * @param value the visibility value * @return property wrapper around visibility */ - public static Property<String> visibility(@Property.VISIBILITY String value) { - return new LayoutProperty<>("visibility", value); + public static PropertyValue<String> visibility(@Property.VISIBILITY String value) { + 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 */ - public static Property<Function<String>> visibility(Function<String> function) { - return new LayoutProperty<>("visibility", function); + public static <T> PropertyValue<Function<T, String>> visibility(Function<T, String> function) { + return new LayoutPropertyValue<>("visibility", function); } /** @@ -37,73 +42,74 @@ public class PropertyFactory { * @param value a Boolean value * @return property wrapper around Boolean */ - public static Property<Boolean> fillAntialias(Boolean value) { - return new PaintProperty<>("fill-antialias", value); + public static PropertyValue<Boolean> fillAntialias(Boolean value) { + return new PaintPropertyValue<>("fill-antialias", value); } + /** * Whether or not the fill should be antialiased. * - * @param function a wrapper function for Boolean + * @param <Z> the zoom parameter type + * @param function a wrapper {@link CameraFunction} for Boolean * @return property wrapper around a Boolean function */ - public static Property<Function<Boolean>> fillAntialias(Function<Boolean> function) { - return new PaintProperty<>("fill-antialias", function); + 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. + * 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 value a Float value * @return property wrapper around Float */ - public static Property<Float> fillOpacity(Float value) { - return new PaintProperty<>("fill-opacity", value); + public static PropertyValue<Float> fillOpacity(Float value) { + return new PaintPropertyValue<>("fill-opacity", value); } + /** - * 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. + * 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 */ - public static Property<Function<Float>> fillOpacity(Function<Float> function) { - return new PaintProperty<>("fill-opacity", function); + 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. + * The color of the filled part of this layer. This color can be specified as `rgba` with an alpha component and the color's opacity will not affect the opacity of the 1px stroke, if it is used. * * @param value a int color value * @return property wrapper around String color */ - public static Property<String> fillColor(@ColorInt int value) { - return new PaintProperty<>("fill-color", colorToRgbaString(value)); + public static PropertyValue<String> fillColor(@ColorInt int value) { + return new PaintPropertyValue<>("fill-color", colorToRgbaString(value)); } /** - * The color of the filled part of this layer. This color can be specified as `rgba` with an alpha component and the - * color's opacity will not affect the opacity of the 1px stroke, if it is used. + * The color of the filled part of this layer. This color can be specified as `rgba` with an alpha component and the color's opacity will not affect the opacity of the 1px stroke, if it is used. * * @param value a String value * @return property wrapper around String */ - public static Property<String> fillColor(String value) { - return new PaintProperty<>("fill-color", value); + public static PropertyValue<String> fillColor(String value) { + return new PaintPropertyValue<>("fill-color", value); } + /** - * The color of the filled part of this layer. This color can be specified as `rgba` with an alpha component and the - * color's opacity will not affect the opacity of the 1px stroke, if it is used. + * The color of the filled part of this layer. This color can be specified as `rgba` with an alpha component and the color's opacity will not affect the opacity of the 1px stroke, if it is used. * + * @param <T> the function input type * @param function a wrapper function for String * @return property wrapper around a String function */ - public static Property<Function<String>> fillColor(Function<String> function) { - return new PaintProperty<>("fill-color", function); + public static <T> PropertyValue<Function<T, String>> fillColor(Function<T, String> function) { + return new PaintPropertyValue<>("fill-color", function); } /** @@ -112,8 +118,8 @@ public class PropertyFactory { * @param value a int color value * @return property wrapper around String color */ - public static Property<String> fillOutlineColor(@ColorInt int value) { - return new PaintProperty<>("fill-outline-color", colorToRgbaString(value)); + public static PropertyValue<String> fillOutlineColor(@ColorInt int value) { + return new PaintPropertyValue<>("fill-outline-color", colorToRgbaString(value)); } /** @@ -122,18 +128,20 @@ public class PropertyFactory { * @param value a String value * @return property wrapper around String */ - public static Property<String> fillOutlineColor(String value) { - return new PaintProperty<>("fill-outline-color", value); + public static PropertyValue<String> fillOutlineColor(String value) { + return new PaintPropertyValue<>("fill-outline-color", value); } + /** * 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 */ - public static Property<Function<String>> fillOutlineColor(Function<String> function) { - return new PaintProperty<>("fill-outline-color", function); + public static <T> PropertyValue<Function<T, String>> fillOutlineColor(Function<T, String> function) { + return new PaintPropertyValue<>("fill-outline-color", function); } /** @@ -142,18 +150,20 @@ public class PropertyFactory { * @param value a Float[] value * @return property wrapper around Float[] */ - public static Property<Float[]> fillTranslate(Float[] value) { - return new PaintProperty<>("fill-translate", value); + public static PropertyValue<Float[]> fillTranslate(Float[] value) { + return new PaintPropertyValue<>("fill-translate", value); } + /** * The geometry's offset. Values are [x, y] where negatives indicate left and up, respectively. * - * @param function a wrapper function for Float[] + * @param <Z> the zoom parameter type + * @param function a wrapper {@link CameraFunction} for Float[] * @return property wrapper around a Float[] function */ - public static Property<Function<Float[]>> fillTranslate(Function<Float[]> function) { - return new PaintProperty<>("fill-translate", function); + public static <Z extends Number> PropertyValue<CameraFunction<Z, Float[]>> fillTranslate(CameraFunction<Z, Float[]> function) { + return new PaintPropertyValue<>("fill-translate", function); } /** @@ -162,40 +172,42 @@ public class PropertyFactory { * @param value a String value * @return property wrapper around String */ - public static Property<String> fillTranslateAnchor(@Property.FILL_TRANSLATE_ANCHOR String value) { - return new PaintProperty<>("fill-translate-anchor", value); + public static PropertyValue<String> fillTranslateAnchor(@Property.FILL_TRANSLATE_ANCHOR String value) { + return new PaintPropertyValue<>("fill-translate-anchor", value); } + /** * Controls the translation reference point. * - * @param function a wrapper function for String + * @param <Z> the zoom parameter type + * @param function a wrapper {@link CameraFunction} for String * @return property wrapper around a String function */ - public static Property<Function<String>> fillTranslateAnchor(Function<String> function) { - return new PaintProperty<>("fill-translate-anchor", function); + 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). + * 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 value a String value * @return property wrapper around String */ - public static Property<String> fillPattern(String value) { - return new PaintProperty<>("fill-pattern", value); + public static PropertyValue<String> fillPattern(String value) { + return new PaintPropertyValue<>("fill-pattern", value); } + /** - * Name of image in sprite to use for drawing image fills. For seamless patterns, image width and height must be a - * factor of two (2, 4, 8, ..., 512). + * Name of image in sprite to use for drawing image fills. For seamless patterns, image width and height must be a factor of two (2, 4, 8, ..., 512). * - * @param function a wrapper function for String + * @param <Z> the zoom parameter type + * @param function a wrapper {@link CameraFunction} for String * @return property wrapper around a String function */ - public static Property<Function<String>> fillPattern(Function<String> function) { - return new PaintProperty<>("fill-pattern", function); + public static <Z extends Number> PropertyValue<CameraFunction<Z, String>> fillPattern(CameraFunction<Z, String> function) { + return new PaintPropertyValue<>("fill-pattern", function); } /** @@ -204,18 +216,20 @@ public class PropertyFactory { * @param value a Float value * @return property wrapper around Float */ - public static Property<Float> lineOpacity(Float value) { - return new PaintProperty<>("line-opacity", value); + public static PropertyValue<Float> lineOpacity(Float value) { + return new PaintPropertyValue<>("line-opacity", value); } + /** * 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 */ - public static Property<Function<Float>> lineOpacity(Function<Float> function) { - return new PaintProperty<>("line-opacity", function); + public static <T> PropertyValue<Function<T, Float>> lineOpacity(Function<T, Float> function) { + return new PaintPropertyValue<>("line-opacity", function); } /** @@ -224,8 +238,8 @@ public class PropertyFactory { * @param value a int color value * @return property wrapper around String color */ - public static Property<String> lineColor(@ColorInt int value) { - return new PaintProperty<>("line-color", colorToRgbaString(value)); + public static PropertyValue<String> lineColor(@ColorInt int value) { + return new PaintPropertyValue<>("line-color", colorToRgbaString(value)); } /** @@ -234,18 +248,20 @@ public class PropertyFactory { * @param value a String value * @return property wrapper around String */ - public static Property<String> lineColor(String value) { - return new PaintProperty<>("line-color", value); + public static PropertyValue<String> lineColor(String value) { + return new PaintPropertyValue<>("line-color", value); } + /** * 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 */ - public static Property<Function<String>> lineColor(Function<String> function) { - return new PaintProperty<>("line-color", function); + public static <T> PropertyValue<Function<T, String>> lineColor(Function<T, String> function) { + return new PaintPropertyValue<>("line-color", function); } /** @@ -254,18 +270,20 @@ public class PropertyFactory { * @param value a Float[] value * @return property wrapper around Float[] */ - public static Property<Float[]> lineTranslate(Float[] value) { - return new PaintProperty<>("line-translate", value); + public static PropertyValue<Float[]> lineTranslate(Float[] value) { + return new PaintPropertyValue<>("line-translate", value); } + /** * The geometry's offset. Values are [x, y] where negatives indicate left and up, respectively. * - * @param function a wrapper function for Float[] + * @param <Z> the zoom parameter type + * @param function a wrapper {@link CameraFunction} for Float[] * @return property wrapper around a Float[] function */ - public static Property<Function<Float[]>> lineTranslate(Function<Float[]> function) { - return new PaintProperty<>("line-translate", function); + public static <Z extends Number> PropertyValue<CameraFunction<Z, Float[]>> lineTranslate(CameraFunction<Z, Float[]> function) { + return new PaintPropertyValue<>("line-translate", function); } /** @@ -274,18 +292,20 @@ public class PropertyFactory { * @param value a String value * @return property wrapper around String */ - public static Property<String> lineTranslateAnchor(@Property.LINE_TRANSLATE_ANCHOR String value) { - return new PaintProperty<>("line-translate-anchor", value); + public static PropertyValue<String> lineTranslateAnchor(@Property.LINE_TRANSLATE_ANCHOR String value) { + return new PaintPropertyValue<>("line-translate-anchor", value); } + /** * Controls the translation reference point. * - * @param function a wrapper function for String + * @param <Z> the zoom parameter type + * @param function a wrapper {@link CameraFunction} for String * @return property wrapper around a String function */ - public static Property<Function<String>> lineTranslateAnchor(Function<String> function) { - return new PaintProperty<>("line-translate-anchor", function); + public static <Z extends Number> PropertyValue<CameraFunction<Z, String>> lineTranslateAnchor(CameraFunction<Z, String> function) { + return new PaintPropertyValue<>("line-translate-anchor", function); } /** @@ -294,18 +314,20 @@ public class PropertyFactory { * @param value a Float value * @return property wrapper around Float */ - public static Property<Float> lineWidth(Float value) { - return new PaintProperty<>("line-width", value); + public static PropertyValue<Float> lineWidth(Float value) { + return new PaintPropertyValue<>("line-width", value); } + /** * Stroke thickness. * - * @param function a wrapper function for Float + * @param <Z> the zoom parameter type + * @param function a wrapper {@link CameraFunction} for Float * @return property wrapper around a Float function */ - public static Property<Function<Float>> lineWidth(Function<Float> function) { - return new PaintProperty<>("line-width", function); + public static <Z extends Number> PropertyValue<CameraFunction<Z, Float>> lineWidth(CameraFunction<Z, Float> function) { + return new PaintPropertyValue<>("line-width", function); } /** @@ -314,106 +336,108 @@ public class PropertyFactory { * @param value a Float value * @return property wrapper around Float */ - public static Property<Float> lineGapWidth(Float value) { - return new PaintProperty<>("line-gap-width", value); + public static PropertyValue<Float> lineGapWidth(Float value) { + return new PaintPropertyValue<>("line-gap-width", value); } + /** * 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 */ - public static Property<Function<Float>> lineGapWidth(Function<Float> function) { - return new PaintProperty<>("line-gap-width", function); + 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. + * 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 value a Float value * @return property wrapper around Float */ - public static Property<Float> lineOffset(Float value) { - return new PaintProperty<>("line-offset", value); + public static PropertyValue<Float> lineOffset(Float value) { + return new PaintPropertyValue<>("line-offset", value); } + /** - * 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. + * 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 */ - public static Property<Function<Float>> lineOffset(Function<Float> function) { - return new PaintProperty<>("line-offset", function); + public static <T> PropertyValue<Function<T, Float>> lineOffset(Function<T, Float> function) { + return new PaintPropertyValue<>("line-offset", function); } /** - * Blur applied to the line, in pixels. + * Blur applied to the line, in density-independent pixels. * * @param value a Float value * @return property wrapper around Float */ - public static Property<Float> lineBlur(Float value) { - return new PaintProperty<>("line-blur", value); + public static PropertyValue<Float> lineBlur(Float value) { + return new PaintPropertyValue<>("line-blur", value); } + /** - * Blur applied to the line, in pixels. + * 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 */ - public static Property<Function<Float>> lineBlur(Function<Float> function) { - return new PaintProperty<>("line-blur", function); + 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 pixels, multiply the length by the current line width. + * Specifies the lengths of the alternating dashes and gaps that form the dash pattern. The lengths are later scaled by the line width. To convert a dash length to density-independent pixels, multiply the length by the current line width. * * @param value a Float[] value * @return property wrapper around Float[] */ - public static Property<Float[]> lineDasharray(Float[] value) { - return new PaintProperty<>("line-dasharray", value); + public static PropertyValue<Float[]> lineDasharray(Float[] value) { + return new PaintPropertyValue<>("line-dasharray", value); } + /** - * Specifies the lengths of the alternating dashes and gaps that form the dash pattern. The lengths are later scaled - * by the line width. To convert a dash length to pixels, multiply the length by the current line width. + * Specifies the lengths of the alternating dashes and gaps that form the dash pattern. The lengths are later scaled by the line width. To convert a dash length to density-independent pixels, multiply the length by the current line width. * - * @param function a wrapper function for Float[] + * @param <Z> the zoom parameter type + * @param function a wrapper {@link CameraFunction} for Float[] * @return property wrapper around a Float[] function */ - public static Property<Function<Float[]>> lineDasharray(Function<Float[]> function) { - return new PaintProperty<>("line-dasharray", function); + 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). + * 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 value a String value * @return property wrapper around String */ - public static Property<String> linePattern(String value) { - return new PaintProperty<>("line-pattern", value); + public static PropertyValue<String> linePattern(String value) { + return new PaintPropertyValue<>("line-pattern", value); } + /** - * Name of image in sprite to use for drawing image lines. For seamless patterns, image width must be a factor of two - * (2, 4, 8, ..., 512). + * Name of image in sprite to use for drawing image lines. For seamless patterns, image width must be a factor of two (2, 4, 8, ..., 512). * - * @param function a wrapper function for String + * @param <Z> the zoom parameter type + * @param function a wrapper {@link CameraFunction} for String * @return property wrapper around a String function */ - public static Property<Function<String>> linePattern(Function<String> function) { - return new PaintProperty<>("line-pattern", function); + public static <Z extends Number> PropertyValue<CameraFunction<Z, String>> linePattern(CameraFunction<Z, String> function) { + return new PaintPropertyValue<>("line-pattern", function); } /** @@ -422,18 +446,20 @@ public class PropertyFactory { * @param value a Float value * @return property wrapper around Float */ - public static Property<Float> iconOpacity(Float value) { - return new PaintProperty<>("icon-opacity", value); + public static PropertyValue<Float> iconOpacity(Float value) { + return new PaintPropertyValue<>("icon-opacity", value); } + /** * 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 */ - public static Property<Function<Float>> iconOpacity(Function<Float> function) { - return new PaintProperty<>("icon-opacity", function); + public static <T> PropertyValue<Function<T, Float>> iconOpacity(Function<T, Float> function) { + return new PaintPropertyValue<>("icon-opacity", function); } /** @@ -442,8 +468,8 @@ public class PropertyFactory { * @param value a int color value * @return property wrapper around String color */ - public static Property<String> iconColor(@ColorInt int value) { - return new PaintProperty<>("icon-color", colorToRgbaString(value)); + public static PropertyValue<String> iconColor(@ColorInt int value) { + return new PaintPropertyValue<>("icon-color", colorToRgbaString(value)); } /** @@ -452,18 +478,20 @@ public class PropertyFactory { * @param value a String value * @return property wrapper around String */ - public static Property<String> iconColor(String value) { - return new PaintProperty<>("icon-color", value); + public static PropertyValue<String> iconColor(String value) { + return new PaintPropertyValue<>("icon-color", value); } + /** * 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 */ - public static Property<Function<String>> iconColor(Function<String> function) { - return new PaintProperty<>("icon-color", function); + public static <T> PropertyValue<Function<T, String>> iconColor(Function<T, String> function) { + return new PaintPropertyValue<>("icon-color", function); } /** @@ -472,8 +500,8 @@ public class PropertyFactory { * @param value a int color value * @return property wrapper around String color */ - public static Property<String> iconHaloColor(@ColorInt int value) { - return new PaintProperty<>("icon-halo-color", colorToRgbaString(value)); + public static PropertyValue<String> iconHaloColor(@ColorInt int value) { + return new PaintPropertyValue<>("icon-halo-color", colorToRgbaString(value)); } /** @@ -482,18 +510,20 @@ public class PropertyFactory { * @param value a String value * @return property wrapper around String */ - public static Property<String> iconHaloColor(String value) { - return new PaintProperty<>("icon-halo-color", value); + public static PropertyValue<String> iconHaloColor(String value) { + return new PaintPropertyValue<>("icon-halo-color", value); } + /** * 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 */ - public static Property<Function<String>> iconHaloColor(Function<String> function) { - return new PaintProperty<>("icon-halo-color", function); + public static <T> PropertyValue<Function<T, String>> iconHaloColor(Function<T, String> function) { + return new PaintPropertyValue<>("icon-halo-color", function); } /** @@ -502,18 +532,20 @@ public class PropertyFactory { * @param value a Float value * @return property wrapper around Float */ - public static Property<Float> iconHaloWidth(Float value) { - return new PaintProperty<>("icon-halo-width", value); + public static PropertyValue<Float> iconHaloWidth(Float value) { + return new PaintPropertyValue<>("icon-halo-width", value); } + /** * 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 */ - public static Property<Function<Float>> iconHaloWidth(Function<Float> function) { - return new PaintProperty<>("icon-halo-width", function); + public static <T> PropertyValue<Function<T, Float>> iconHaloWidth(Function<T, Float> function) { + return new PaintPropertyValue<>("icon-halo-width", function); } /** @@ -522,40 +554,42 @@ public class PropertyFactory { * @param value a Float value * @return property wrapper around Float */ - public static Property<Float> iconHaloBlur(Float value) { - return new PaintProperty<>("icon-halo-blur", value); + public static PropertyValue<Float> iconHaloBlur(Float value) { + return new PaintPropertyValue<>("icon-halo-blur", value); } + /** * 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 */ - public static Property<Function<Float>> iconHaloBlur(Function<Float> function) { - return new PaintProperty<>("icon-halo-blur", function); + 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. + * 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 value a Float[] value * @return property wrapper around Float[] */ - public static Property<Float[]> iconTranslate(Float[] value) { - return new PaintProperty<>("icon-translate", value); + public static PropertyValue<Float[]> iconTranslate(Float[] value) { + return new PaintPropertyValue<>("icon-translate", value); } + /** - * 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. + * 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 function a wrapper function for Float[] + * @param <Z> the zoom parameter type + * @param function a wrapper {@link CameraFunction} for Float[] * @return property wrapper around a Float[] function */ - public static Property<Function<Float[]>> iconTranslate(Function<Float[]> function) { - return new PaintProperty<>("icon-translate", function); + public static <Z extends Number> PropertyValue<CameraFunction<Z, Float[]>> iconTranslate(CameraFunction<Z, Float[]> function) { + return new PaintPropertyValue<>("icon-translate", function); } /** @@ -564,18 +598,20 @@ public class PropertyFactory { * @param value a String value * @return property wrapper around String */ - public static Property<String> iconTranslateAnchor(@Property.ICON_TRANSLATE_ANCHOR String value) { - return new PaintProperty<>("icon-translate-anchor", value); + public static PropertyValue<String> iconTranslateAnchor(@Property.ICON_TRANSLATE_ANCHOR String value) { + return new PaintPropertyValue<>("icon-translate-anchor", value); } + /** * Controls the translation reference point. * - * @param function a wrapper function for String + * @param <Z> the zoom parameter type + * @param function a wrapper {@link CameraFunction} for String * @return property wrapper around a String function */ - public static Property<Function<String>> iconTranslateAnchor(Function<String> function) { - return new PaintProperty<>("icon-translate-anchor", function); + public static <Z extends Number> PropertyValue<CameraFunction<Z, String>> iconTranslateAnchor(CameraFunction<Z, String> function) { + return new PaintPropertyValue<>("icon-translate-anchor", function); } /** @@ -584,18 +620,20 @@ public class PropertyFactory { * @param value a Float value * @return property wrapper around Float */ - public static Property<Float> textOpacity(Float value) { - return new PaintProperty<>("text-opacity", value); + public static PropertyValue<Float> textOpacity(Float value) { + return new PaintPropertyValue<>("text-opacity", value); } + /** * 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 */ - public static Property<Function<Float>> textOpacity(Function<Float> function) { - return new PaintProperty<>("text-opacity", function); + public static <T> PropertyValue<Function<T, Float>> textOpacity(Function<T, Float> function) { + return new PaintPropertyValue<>("text-opacity", function); } /** @@ -604,8 +642,8 @@ public class PropertyFactory { * @param value a int color value * @return property wrapper around String color */ - public static Property<String> textColor(@ColorInt int value) { - return new PaintProperty<>("text-color", colorToRgbaString(value)); + public static PropertyValue<String> textColor(@ColorInt int value) { + return new PaintPropertyValue<>("text-color", colorToRgbaString(value)); } /** @@ -614,18 +652,20 @@ public class PropertyFactory { * @param value a String value * @return property wrapper around String */ - public static Property<String> textColor(String value) { - return new PaintProperty<>("text-color", value); + public static PropertyValue<String> textColor(String value) { + return new PaintPropertyValue<>("text-color", value); } + /** * 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 */ - public static Property<Function<String>> textColor(Function<String> function) { - return new PaintProperty<>("text-color", function); + public static <T> PropertyValue<Function<T, String>> textColor(Function<T, String> function) { + return new PaintPropertyValue<>("text-color", function); } /** @@ -634,8 +674,8 @@ public class PropertyFactory { * @param value a int color value * @return property wrapper around String color */ - public static Property<String> textHaloColor(@ColorInt int value) { - return new PaintProperty<>("text-halo-color", colorToRgbaString(value)); + public static PropertyValue<String> textHaloColor(@ColorInt int value) { + return new PaintPropertyValue<>("text-halo-color", colorToRgbaString(value)); } /** @@ -644,18 +684,20 @@ public class PropertyFactory { * @param value a String value * @return property wrapper around String */ - public static Property<String> textHaloColor(String value) { - return new PaintProperty<>("text-halo-color", value); + public static PropertyValue<String> textHaloColor(String value) { + return new PaintPropertyValue<>("text-halo-color", value); } + /** * 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 */ - public static Property<Function<String>> textHaloColor(Function<String> function) { - return new PaintProperty<>("text-halo-color", function); + public static <T> PropertyValue<Function<T, String>> textHaloColor(Function<T, String> function) { + return new PaintPropertyValue<>("text-halo-color", function); } /** @@ -664,18 +706,20 @@ public class PropertyFactory { * @param value a Float value * @return property wrapper around Float */ - public static Property<Float> textHaloWidth(Float value) { - return new PaintProperty<>("text-halo-width", value); + public static PropertyValue<Float> textHaloWidth(Float value) { + return new PaintPropertyValue<>("text-halo-width", value); } + /** * 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 */ - public static Property<Function<Float>> textHaloWidth(Function<Float> function) { - return new PaintProperty<>("text-halo-width", function); + public static <T> PropertyValue<Function<T, Float>> textHaloWidth(Function<T, Float> function) { + return new PaintPropertyValue<>("text-halo-width", function); } /** @@ -684,40 +728,42 @@ public class PropertyFactory { * @param value a Float value * @return property wrapper around Float */ - public static Property<Float> textHaloBlur(Float value) { - return new PaintProperty<>("text-halo-blur", value); + public static PropertyValue<Float> textHaloBlur(Float value) { + return new PaintPropertyValue<>("text-halo-blur", value); } + /** * 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 */ - public static Property<Function<Float>> textHaloBlur(Function<Float> function) { - return new PaintProperty<>("text-halo-blur", function); + 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. + * 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 value a Float[] value * @return property wrapper around Float[] */ - public static Property<Float[]> textTranslate(Float[] value) { - return new PaintProperty<>("text-translate", value); + public static PropertyValue<Float[]> textTranslate(Float[] value) { + return new PaintPropertyValue<>("text-translate", value); } + /** - * 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. + * 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 function a wrapper function for Float[] + * @param <Z> the zoom parameter type + * @param function a wrapper {@link CameraFunction} for Float[] * @return property wrapper around a Float[] function */ - public static Property<Function<Float[]>> textTranslate(Function<Float[]> function) { - return new PaintProperty<>("text-translate", function); + public static <Z extends Number> PropertyValue<CameraFunction<Z, Float[]>> textTranslate(CameraFunction<Z, Float[]> function) { + return new PaintPropertyValue<>("text-translate", function); } /** @@ -726,18 +772,20 @@ public class PropertyFactory { * @param value a String value * @return property wrapper around String */ - public static Property<String> textTranslateAnchor(@Property.TEXT_TRANSLATE_ANCHOR String value) { - return new PaintProperty<>("text-translate-anchor", value); + public static PropertyValue<String> textTranslateAnchor(@Property.TEXT_TRANSLATE_ANCHOR String value) { + return new PaintPropertyValue<>("text-translate-anchor", value); } + /** * Controls the translation reference point. * - * @param function a wrapper function for String + * @param <Z> the zoom parameter type + * @param function a wrapper {@link CameraFunction} for String * @return property wrapper around a String function */ - public static Property<Function<String>> textTranslateAnchor(Function<String> function) { - return new PaintProperty<>("text-translate-anchor", function); + public static <Z extends Number> PropertyValue<CameraFunction<Z, String>> textTranslateAnchor(CameraFunction<Z, String> function) { + return new PaintPropertyValue<>("text-translate-anchor", function); } /** @@ -746,18 +794,20 @@ public class PropertyFactory { * @param value a Float value * @return property wrapper around Float */ - public static Property<Float> circleRadius(Float value) { - return new PaintProperty<>("circle-radius", value); + public static PropertyValue<Float> circleRadius(Float value) { + return new PaintPropertyValue<>("circle-radius", value); } + /** * Circle radius. * + * @param <T> the function input type * @param function a wrapper function for Float * @return property wrapper around a Float function */ - public static Property<Function<Float>> circleRadius(Function<Float> function) { - return new PaintProperty<>("circle-radius", function); + public static <T> PropertyValue<Function<T, Float>> circleRadius(Function<T, Float> function) { + return new PaintPropertyValue<>("circle-radius", function); } /** @@ -766,8 +816,8 @@ public class PropertyFactory { * @param value a int color value * @return property wrapper around String color */ - public static Property<String> circleColor(@ColorInt int value) { - return new PaintProperty<>("circle-color", colorToRgbaString(value)); + public static PropertyValue<String> circleColor(@ColorInt int value) { + return new PaintPropertyValue<>("circle-color", colorToRgbaString(value)); } /** @@ -776,18 +826,20 @@ public class PropertyFactory { * @param value a String value * @return property wrapper around String */ - public static Property<String> circleColor(String value) { - return new PaintProperty<>("circle-color", value); + public static PropertyValue<String> circleColor(String value) { + return new PaintPropertyValue<>("circle-color", value); } + /** * 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 */ - public static Property<Function<String>> circleColor(Function<String> function) { - return new PaintProperty<>("circle-color", function); + public static <T> PropertyValue<Function<T, String>> circleColor(Function<T, String> function) { + return new PaintPropertyValue<>("circle-color", function); } /** @@ -796,18 +848,20 @@ public class PropertyFactory { * @param value a Float value * @return property wrapper around Float */ - public static Property<Float> circleBlur(Float value) { - return new PaintProperty<>("circle-blur", value); + public static PropertyValue<Float> circleBlur(Float value) { + return new PaintPropertyValue<>("circle-blur", value); } + /** * 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 */ - public static Property<Function<Float>> circleBlur(Function<Float> function) { - return new PaintProperty<>("circle-blur", function); + public static <T> PropertyValue<Function<T, Float>> circleBlur(Function<T, Float> function) { + return new PaintPropertyValue<>("circle-blur", function); } /** @@ -816,18 +870,20 @@ public class PropertyFactory { * @param value a Float value * @return property wrapper around Float */ - public static Property<Float> circleOpacity(Float value) { - return new PaintProperty<>("circle-opacity", value); + public static PropertyValue<Float> circleOpacity(Float value) { + return new PaintPropertyValue<>("circle-opacity", value); } + /** * 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 */ - public static Property<Function<Float>> circleOpacity(Function<Float> function) { - return new PaintProperty<>("circle-opacity", function); + public static <T> PropertyValue<Function<T, Float>> circleOpacity(Function<T, Float> function) { + return new PaintPropertyValue<>("circle-opacity", function); } /** @@ -836,18 +892,20 @@ public class PropertyFactory { * @param value a Float[] value * @return property wrapper around Float[] */ - public static Property<Float[]> circleTranslate(Float[] value) { - return new PaintProperty<>("circle-translate", value); + public static PropertyValue<Float[]> circleTranslate(Float[] value) { + return new PaintPropertyValue<>("circle-translate", value); } + /** * The geometry's offset. Values are [x, y] where negatives indicate left and up, respectively. * - * @param function a wrapper function for Float[] + * @param <Z> the zoom parameter type + * @param function a wrapper {@link CameraFunction} for Float[] * @return property wrapper around a Float[] function */ - public static Property<Function<Float[]>> circleTranslate(Function<Float[]> function) { - return new PaintProperty<>("circle-translate", function); + public static <Z extends Number> PropertyValue<CameraFunction<Z, Float[]>> circleTranslate(CameraFunction<Z, Float[]> function) { + return new PaintPropertyValue<>("circle-translate", function); } /** @@ -856,18 +914,20 @@ public class PropertyFactory { * @param value a String value * @return property wrapper around String */ - public static Property<String> circleTranslateAnchor(@Property.CIRCLE_TRANSLATE_ANCHOR String value) { - return new PaintProperty<>("circle-translate-anchor", value); + public static PropertyValue<String> circleTranslateAnchor(@Property.CIRCLE_TRANSLATE_ANCHOR String value) { + return new PaintPropertyValue<>("circle-translate-anchor", value); } + /** * Controls the translation reference point. * - * @param function a wrapper function for String + * @param <Z> the zoom parameter type + * @param function a wrapper {@link CameraFunction} for String * @return property wrapper around a String function */ - public static Property<Function<String>> circleTranslateAnchor(Function<String> function) { - return new PaintProperty<>("circle-translate-anchor", function); + public static <Z extends Number> PropertyValue<CameraFunction<Z, String>> circleTranslateAnchor(CameraFunction<Z, String> function) { + return new PaintPropertyValue<>("circle-translate-anchor", function); } /** @@ -876,38 +936,42 @@ public class PropertyFactory { * @param value a String value * @return property wrapper around String */ - public static Property<String> circlePitchScale(@Property.CIRCLE_PITCH_SCALE String value) { - return new PaintProperty<>("circle-pitch-scale", value); + public static PropertyValue<String> circlePitchScale(@Property.CIRCLE_PITCH_SCALE String value) { + return new PaintPropertyValue<>("circle-pitch-scale", value); } + /** * Controls the scaling behavior of the circle when the map is pitched. * - * @param function a wrapper function for String + * @param <Z> the zoom parameter type + * @param function a wrapper {@link CameraFunction} for String * @return property wrapper around a String function */ - public static Property<Function<String>> circlePitchScale(Function<String> function) { - return new PaintProperty<>("circle-pitch-scale", function); + public static <Z extends Number> PropertyValue<CameraFunction<Z, String>> circlePitchScale(CameraFunction<Z, String> function) { + return new PaintPropertyValue<>("circle-pitch-scale", function); } /** - * The width of the circle's stroke. Strokes are placed outside of the "circle-radius". + * The width of the circle's stroke. Strokes are placed outside of the {@link PropertyFactory#circleRadius}. * * @param value a Float value * @return property wrapper around Float */ - public static Property<Float> circleStrokeWidth(Float value) { - return new PaintProperty<>("circle-stroke-width", value); + public static PropertyValue<Float> circleStrokeWidth(Float value) { + return new PaintPropertyValue<>("circle-stroke-width", value); } + /** - * The width of the circle's stroke. Strokes are placed outside of the "circle-radius". + * 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 */ - public static Property<Function<Float>> circleStrokeWidth(Function<Float> function) { - return new PaintProperty<>("circle-stroke-width", function); + public static <T> PropertyValue<Function<T, Float>> circleStrokeWidth(Function<T, Float> function) { + return new PaintPropertyValue<>("circle-stroke-width", function); } /** @@ -916,8 +980,8 @@ public class PropertyFactory { * @param value a int color value * @return property wrapper around String color */ - public static Property<String> circleStrokeColor(@ColorInt int value) { - return new PaintProperty<>("circle-stroke-color", colorToRgbaString(value)); + public static PropertyValue<String> circleStrokeColor(@ColorInt int value) { + return new PaintPropertyValue<>("circle-stroke-color", colorToRgbaString(value)); } /** @@ -926,18 +990,20 @@ public class PropertyFactory { * @param value a String value * @return property wrapper around String */ - public static Property<String> circleStrokeColor(String value) { - return new PaintProperty<>("circle-stroke-color", value); + public static PropertyValue<String> circleStrokeColor(String value) { + return new PaintPropertyValue<>("circle-stroke-color", value); } + /** * 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 */ - public static Property<Function<String>> circleStrokeColor(Function<String> function) { - return new PaintProperty<>("circle-stroke-color", function); + public static <T> PropertyValue<Function<T, String>> circleStrokeColor(Function<T, String> function) { + return new PaintPropertyValue<>("circle-stroke-color", function); } /** @@ -946,18 +1012,20 @@ public class PropertyFactory { * @param value a Float value * @return property wrapper around Float */ - public static Property<Float> circleStrokeOpacity(Float value) { - return new PaintProperty<>("circle-stroke-opacity", value); + public static PropertyValue<Float> circleStrokeOpacity(Float value) { + return new PaintPropertyValue<>("circle-stroke-opacity", value); } + /** * 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 */ - public static Property<Function<Float>> circleStrokeOpacity(Function<Float> function) { - return new PaintProperty<>("circle-stroke-opacity", function); + public static <T> PropertyValue<Function<T, Float>> circleStrokeOpacity(Function<T, Float> function) { + return new PaintPropertyValue<>("circle-stroke-opacity", function); } /** @@ -966,18 +1034,20 @@ public class PropertyFactory { * @param value a Float value * @return property wrapper around Float */ - public static Property<Float> rasterOpacity(Float value) { - return new PaintProperty<>("raster-opacity", value); + public static PropertyValue<Float> rasterOpacity(Float value) { + return new PaintPropertyValue<>("raster-opacity", value); } + /** * The opacity at which the image will be drawn. * - * @param function a wrapper function for Float + * @param <Z> the zoom parameter type + * @param function a wrapper {@link CameraFunction} for Float * @return property wrapper around a Float function */ - public static Property<Function<Float>> rasterOpacity(Function<Float> function) { - return new PaintProperty<>("raster-opacity", function); + public static <Z extends Number> PropertyValue<CameraFunction<Z, Float>> rasterOpacity(CameraFunction<Z, Float> function) { + return new PaintPropertyValue<>("raster-opacity", function); } /** @@ -986,18 +1056,20 @@ public class PropertyFactory { * @param value a Float value * @return property wrapper around Float */ - public static Property<Float> rasterHueRotate(Float value) { - return new PaintProperty<>("raster-hue-rotate", value); + public static PropertyValue<Float> rasterHueRotate(Float value) { + return new PaintPropertyValue<>("raster-hue-rotate", value); } + /** * Rotates hues around the color wheel. * - * @param function a wrapper function for Float + * @param <Z> the zoom parameter type + * @param function a wrapper {@link CameraFunction} for Float * @return property wrapper around a Float function */ - public static Property<Function<Float>> rasterHueRotate(Function<Float> function) { - return new PaintProperty<>("raster-hue-rotate", function); + public static <Z extends Number> PropertyValue<CameraFunction<Z, Float>> rasterHueRotate(CameraFunction<Z, Float> function) { + return new PaintPropertyValue<>("raster-hue-rotate", function); } /** @@ -1006,18 +1078,20 @@ public class PropertyFactory { * @param value a Float value * @return property wrapper around Float */ - public static Property<Float> rasterBrightnessMin(Float value) { - return new PaintProperty<>("raster-brightness-min", value); + public static PropertyValue<Float> rasterBrightnessMin(Float value) { + return new PaintPropertyValue<>("raster-brightness-min", value); } + /** * Increase or reduce the brightness of the image. The value is the minimum brightness. * - * @param function a wrapper function for Float + * @param <Z> the zoom parameter type + * @param function a wrapper {@link CameraFunction} for Float * @return property wrapper around a Float function */ - public static Property<Function<Float>> rasterBrightnessMin(Function<Float> function) { - return new PaintProperty<>("raster-brightness-min", function); + public static <Z extends Number> PropertyValue<CameraFunction<Z, Float>> rasterBrightnessMin(CameraFunction<Z, Float> function) { + return new PaintPropertyValue<>("raster-brightness-min", function); } /** @@ -1026,18 +1100,20 @@ public class PropertyFactory { * @param value a Float value * @return property wrapper around Float */ - public static Property<Float> rasterBrightnessMax(Float value) { - return new PaintProperty<>("raster-brightness-max", value); + public static PropertyValue<Float> rasterBrightnessMax(Float value) { + return new PaintPropertyValue<>("raster-brightness-max", value); } + /** * Increase or reduce the brightness of the image. The value is the maximum brightness. * - * @param function a wrapper function for Float + * @param <Z> the zoom parameter type + * @param function a wrapper {@link CameraFunction} for Float * @return property wrapper around a Float function */ - public static Property<Function<Float>> rasterBrightnessMax(Function<Float> function) { - return new PaintProperty<>("raster-brightness-max", function); + public static <Z extends Number> PropertyValue<CameraFunction<Z, Float>> rasterBrightnessMax(CameraFunction<Z, Float> function) { + return new PaintPropertyValue<>("raster-brightness-max", function); } /** @@ -1046,18 +1122,20 @@ public class PropertyFactory { * @param value a Float value * @return property wrapper around Float */ - public static Property<Float> rasterSaturation(Float value) { - return new PaintProperty<>("raster-saturation", value); + public static PropertyValue<Float> rasterSaturation(Float value) { + return new PaintPropertyValue<>("raster-saturation", value); } + /** * Increase or reduce the saturation of the image. * - * @param function a wrapper function for Float + * @param <Z> the zoom parameter type + * @param function a wrapper {@link CameraFunction} for Float * @return property wrapper around a Float function */ - public static Property<Function<Float>> rasterSaturation(Function<Float> function) { - return new PaintProperty<>("raster-saturation", function); + public static <Z extends Number> PropertyValue<CameraFunction<Z, Float>> rasterSaturation(CameraFunction<Z, Float> function) { + return new PaintPropertyValue<>("raster-saturation", function); } /** @@ -1066,18 +1144,20 @@ public class PropertyFactory { * @param value a Float value * @return property wrapper around Float */ - public static Property<Float> rasterContrast(Float value) { - return new PaintProperty<>("raster-contrast", value); + public static PropertyValue<Float> rasterContrast(Float value) { + return new PaintPropertyValue<>("raster-contrast", value); } + /** * Increase or reduce the contrast of the image. * - * @param function a wrapper function for Float + * @param <Z> the zoom parameter type + * @param function a wrapper {@link CameraFunction} for Float * @return property wrapper around a Float function */ - public static Property<Function<Float>> rasterContrast(Function<Float> function) { - return new PaintProperty<>("raster-contrast", function); + public static <Z extends Number> PropertyValue<CameraFunction<Z, Float>> rasterContrast(CameraFunction<Z, Float> function) { + return new PaintPropertyValue<>("raster-contrast", function); } /** @@ -1086,18 +1166,20 @@ public class PropertyFactory { * @param value a Float value * @return property wrapper around Float */ - public static Property<Float> rasterFadeDuration(Float value) { - return new PaintProperty<>("raster-fade-duration", value); + public static PropertyValue<Float> rasterFadeDuration(Float value) { + return new PaintPropertyValue<>("raster-fade-duration", value); } + /** * Fade duration when a new tile is added. * - * @param function a wrapper function for Float + * @param <Z> the zoom parameter type + * @param function a wrapper {@link CameraFunction} for Float * @return property wrapper around a Float function */ - public static Property<Function<Float>> rasterFadeDuration(Function<Float> function) { - return new PaintProperty<>("raster-fade-duration", function); + public static <Z extends Number> PropertyValue<CameraFunction<Z, Float>> rasterFadeDuration(CameraFunction<Z, Float> function) { + return new PaintPropertyValue<>("raster-fade-duration", function); } /** @@ -1106,8 +1188,8 @@ public class PropertyFactory { * @param value a int color value * @return property wrapper around String color */ - public static Property<String> backgroundColor(@ColorInt int value) { - return new PaintProperty<>("background-color", colorToRgbaString(value)); + public static PropertyValue<String> backgroundColor(@ColorInt int value) { + return new PaintPropertyValue<>("background-color", colorToRgbaString(value)); } /** @@ -1116,40 +1198,42 @@ public class PropertyFactory { * @param value a String value * @return property wrapper around String */ - public static Property<String> backgroundColor(String value) { - return new PaintProperty<>("background-color", value); + public static PropertyValue<String> backgroundColor(String value) { + return new PaintPropertyValue<>("background-color", value); } + /** * The color with which the background will be drawn. * - * @param function a wrapper function for String + * @param <Z> the zoom parameter type + * @param function a wrapper {@link CameraFunction} for String * @return property wrapper around a String function */ - public static Property<Function<String>> backgroundColor(Function<String> function) { - return new PaintProperty<>("background-color", function); + 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). + * 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 value a String value * @return property wrapper around String */ - public static Property<String> backgroundPattern(String value) { - return new PaintProperty<>("background-pattern", value); + public static PropertyValue<String> backgroundPattern(String value) { + return new PaintPropertyValue<>("background-pattern", value); } + /** - * Name of image in sprite to use for drawing an image background. For seamless patterns, image width and height must - * be a factor of two (2, 4, 8, ..., 512). + * Name of image in sprite to use for drawing an image background. For seamless patterns, image width and height must be a factor of two (2, 4, 8, ..., 512). * - * @param function a wrapper function for String + * @param <Z> the zoom parameter type + * @param function a wrapper {@link CameraFunction} for String * @return property wrapper around a String function */ - public static Property<Function<String>> backgroundPattern(Function<String> function) { - return new PaintProperty<>("background-pattern", function); + public static <Z extends Number> PropertyValue<CameraFunction<Z, String>> backgroundPattern(CameraFunction<Z, String> function) { + return new PaintPropertyValue<>("background-pattern", function); } /** @@ -1158,18 +1242,20 @@ public class PropertyFactory { * @param value a Float value * @return property wrapper around Float */ - public static Property<Float> backgroundOpacity(Float value) { - return new PaintProperty<>("background-opacity", value); + public static PropertyValue<Float> backgroundOpacity(Float value) { + return new PaintPropertyValue<>("background-opacity", value); } + /** * The opacity at which the background will be drawn. * - * @param function a wrapper function for Float + * @param <Z> the zoom parameter type + * @param function a wrapper {@link CameraFunction} for Float * @return property wrapper around a Float function */ - public static Property<Function<Float>> backgroundOpacity(Function<Float> function) { - return new PaintProperty<>("background-opacity", function); + public static <Z extends Number> PropertyValue<CameraFunction<Z, Float>> backgroundOpacity(CameraFunction<Z, Float> function) { + return new PaintPropertyValue<>("background-opacity", function); } /** @@ -1178,18 +1264,21 @@ public class PropertyFactory { * @param value a String value * @return property wrapper around String */ - public static Property<String> lineCap(@Property.LINE_CAP String value) { - return new LayoutProperty<>("line-cap", value); + public static PropertyValue<String> lineCap(@Property.LINE_CAP String value) { + return new LayoutPropertyValue<>("line-cap", value); } + + /** * The display of line endings. * - * @param function a wrapper function for String + * @param <Z> the zoom parameter type + * @param function a wrapper {@link CameraFunction} for String * @return property wrapper around a String function */ - public static Property<Function<String>> lineCap(Function<String> function) { - return new LayoutProperty<>("line-cap", function); + public static <Z extends Number> PropertyValue<CameraFunction<Z, String>> lineCap(CameraFunction<Z, String> function) { + return new LayoutPropertyValue<>("line-cap", function); } /** @@ -1198,18 +1287,21 @@ public class PropertyFactory { * @param value a String value * @return property wrapper around String */ - public static Property<String> lineJoin(@Property.LINE_JOIN String value) { - return new LayoutProperty<>("line-join", value); + public static PropertyValue<String> lineJoin(@Property.LINE_JOIN String value) { + return new LayoutPropertyValue<>("line-join", value); } + + /** * The display of lines when joining. * - * @param function a wrapper function for String + * @param <Z> the zoom parameter type + * @param function a wrapper {@link CameraFunction} for String * @return property wrapper around a String function */ - public static Property<Function<String>> lineJoin(Function<String> function) { - return new LayoutProperty<>("line-join", function); + public static <Z extends Number> PropertyValue<CameraFunction<Z, String>> lineJoin(CameraFunction<Z, String> function) { + return new LayoutPropertyValue<>("line-join", function); } /** @@ -1218,18 +1310,21 @@ public class PropertyFactory { * @param value a Float value * @return property wrapper around Float */ - public static Property<Float> lineMiterLimit(Float value) { - return new LayoutProperty<>("line-miter-limit", value); + public static PropertyValue<Float> lineMiterLimit(Float value) { + return new LayoutPropertyValue<>("line-miter-limit", value); } + + /** * Used to automatically convert miter joins to bevel joins for sharp angles. * - * @param function a wrapper function for Float + * @param <Z> the zoom parameter type + * @param function a wrapper {@link CameraFunction} for Float * @return property wrapper around a Float function */ - public static Property<Function<Float>> lineMiterLimit(Function<Float> function) { - return new LayoutProperty<>("line-miter-limit", function); + public static <Z extends Number> PropertyValue<CameraFunction<Z, Float>> lineMiterLimit(CameraFunction<Z, Float> function) { + return new LayoutPropertyValue<>("line-miter-limit", function); } /** @@ -1238,18 +1333,21 @@ public class PropertyFactory { * @param value a Float value * @return property wrapper around Float */ - public static Property<Float> lineRoundLimit(Float value) { - return new LayoutProperty<>("line-round-limit", value); + public static PropertyValue<Float> lineRoundLimit(Float value) { + return new LayoutPropertyValue<>("line-round-limit", value); } + + /** * Used to automatically convert round joins to miter joins for shallow angles. * - * @param function a wrapper function for Float + * @param <Z> the zoom parameter type + * @param function a wrapper {@link CameraFunction} for Float * @return property wrapper around a Float function */ - public static Property<Function<Float>> lineRoundLimit(Function<Float> function) { - return new LayoutProperty<>("line-round-limit", function); + public static <Z extends Number> PropertyValue<CameraFunction<Z, Float>> lineRoundLimit(CameraFunction<Z, Float> function) { + return new LayoutPropertyValue<>("line-round-limit", function); } /** @@ -1258,18 +1356,21 @@ public class PropertyFactory { * @param value a String value * @return property wrapper around String */ - public static Property<String> symbolPlacement(@Property.SYMBOL_PLACEMENT String value) { - return new LayoutProperty<>("symbol-placement", value); + public static PropertyValue<String> symbolPlacement(@Property.SYMBOL_PLACEMENT String value) { + return new LayoutPropertyValue<>("symbol-placement", value); } + + /** * Label placement relative to its geometry. * - * @param function a wrapper function for String + * @param <Z> the zoom parameter type + * @param function a wrapper {@link CameraFunction} for String * @return property wrapper around a String function */ - public static Property<Function<String>> symbolPlacement(Function<String> function) { - return new LayoutProperty<>("symbol-placement", function); + public static <Z extends Number> PropertyValue<CameraFunction<Z, String>> symbolPlacement(CameraFunction<Z, String> function) { + return new LayoutPropertyValue<>("symbol-placement", function); } /** @@ -1278,42 +1379,44 @@ public class PropertyFactory { * @param value a Float value * @return property wrapper around Float */ - public static Property<Float> symbolSpacing(Float value) { - return new LayoutProperty<>("symbol-spacing", value); + public static PropertyValue<Float> symbolSpacing(Float value) { + return new LayoutPropertyValue<>("symbol-spacing", value); } + + /** * Distance between two symbol anchors. * - * @param function a wrapper function for Float + * @param <Z> the zoom parameter type + * @param function a wrapper {@link CameraFunction} for Float * @return property wrapper around a Float function */ - public static Property<Function<Float>> symbolSpacing(Function<Float> function) { - return new LayoutProperty<>("symbol-spacing", 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. + * 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 value a Boolean value * @return property wrapper around Boolean */ - public static Property<Boolean> symbolAvoidEdges(Boolean value) { - return new LayoutProperty<>("symbol-avoid-edges", value); + public static PropertyValue<Boolean> symbolAvoidEdges(Boolean value) { + 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. + * 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 function a wrapper function for Boolean + * @param <Z> the zoom parameter type + * @param function a wrapper {@link CameraFunction} for Boolean * @return property wrapper around a Boolean function */ - public static Property<Function<Boolean>> symbolAvoidEdges(Function<Boolean> function) { - return new LayoutProperty<>("symbol-avoid-edges", function); + public static <Z extends Number> PropertyValue<CameraFunction<Z, Boolean>> symbolAvoidEdges(CameraFunction<Z, Boolean> function) { + return new LayoutPropertyValue<>("symbol-avoid-edges", function); } /** @@ -1322,18 +1425,21 @@ public class PropertyFactory { * @param value a Boolean value * @return property wrapper around Boolean */ - public static Property<Boolean> iconAllowOverlap(Boolean value) { - return new LayoutProperty<>("icon-allow-overlap", value); + public static PropertyValue<Boolean> iconAllowOverlap(Boolean value) { + return new LayoutPropertyValue<>("icon-allow-overlap", value); } + + /** * If true, the icon will be visible even if it collides with other previously drawn symbols. * - * @param function a wrapper function for Boolean + * @param <Z> the zoom parameter type + * @param function a wrapper {@link CameraFunction} for Boolean * @return property wrapper around a Boolean function */ - public static Property<Function<Boolean>> iconAllowOverlap(Function<Boolean> function) { - return new LayoutProperty<>("icon-allow-overlap", function); + public static <Z extends Number> PropertyValue<CameraFunction<Z, Boolean>> iconAllowOverlap(CameraFunction<Z, Boolean> function) { + return new LayoutPropertyValue<>("icon-allow-overlap", function); } /** @@ -1342,40 +1448,44 @@ public class PropertyFactory { * @param value a Boolean value * @return property wrapper around Boolean */ - public static Property<Boolean> iconIgnorePlacement(Boolean value) { - return new LayoutProperty<>("icon-ignore-placement", value); + public static PropertyValue<Boolean> iconIgnorePlacement(Boolean value) { + return new LayoutPropertyValue<>("icon-ignore-placement", value); } + + /** * If true, other symbols can be visible even if they collide with the icon. * - * @param function a wrapper function for Boolean + * @param <Z> the zoom parameter type + * @param function a wrapper {@link CameraFunction} for Boolean * @return property wrapper around a Boolean function */ - public static Property<Function<Boolean>> iconIgnorePlacement(Function<Boolean> function) { - return new LayoutProperty<>("icon-ignore-placement", 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. + * If true, text will display without their corresponding icons when the icon collides with other symbols and the text does not. * * @param value a Boolean value * @return property wrapper around Boolean */ - public static Property<Boolean> iconOptional(Boolean value) { - return new LayoutProperty<>("icon-optional", value); + public static PropertyValue<Boolean> iconOptional(Boolean value) { + 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. + * If true, text will display without their corresponding icons when the icon collides with other symbols and the text does not. * - * @param function a wrapper function for Boolean + * @param <Z> the zoom parameter type + * @param function a wrapper {@link CameraFunction} for Boolean * @return property wrapper around a Boolean function */ - public static Property<Function<Boolean>> iconOptional(Function<Boolean> function) { - return new LayoutProperty<>("icon-optional", function); + public static <Z extends Number> PropertyValue<CameraFunction<Z, Boolean>> iconOptional(CameraFunction<Z, Boolean> function) { + return new LayoutPropertyValue<>("icon-optional", function); } /** @@ -1384,18 +1494,21 @@ public class PropertyFactory { * @param value a String value * @return property wrapper around String */ - public static Property<String> iconRotationAlignment(@Property.ICON_ROTATION_ALIGNMENT String value) { - return new LayoutProperty<>("icon-rotation-alignment", value); + public static PropertyValue<String> iconRotationAlignment(@Property.ICON_ROTATION_ALIGNMENT String value) { + return new LayoutPropertyValue<>("icon-rotation-alignment", value); } + + /** * In combination with {@link Property.SYMBOL_PLACEMENT}, determines the rotation behavior of icons. * - * @param function a wrapper function for String + * @param <Z> the zoom parameter type + * @param function a wrapper {@link CameraFunction} for String * @return property wrapper around a String function */ - public static Property<Function<String>> iconRotationAlignment(Function<String> function) { - return new LayoutProperty<>("icon-rotation-alignment", function); + public static <Z extends Number> PropertyValue<CameraFunction<Z, String>> iconRotationAlignment(CameraFunction<Z, String> function) { + return new LayoutPropertyValue<>("icon-rotation-alignment", function); } /** @@ -1404,18 +1517,21 @@ public class PropertyFactory { * @param value a Float value * @return property wrapper around Float */ - public static Property<Float> iconSize(Float value) { - return new LayoutProperty<>("icon-size", value); + public static PropertyValue<Float> iconSize(Float value) { + return new LayoutPropertyValue<>("icon-size", value); } + + /** * Scale factor for icon. 1 is original size, 3 triples the size. * - * @param function a wrapper function for Float + * @param <Z> the zoom parameter type + * @param function a wrapper {@link CameraFunction} for Float * @return property wrapper around a Float function */ - public static Property<Function<Float>> iconSize(Function<Float> function) { - return new LayoutProperty<>("icon-size", function); + public static <Z extends Number> PropertyValue<CameraFunction<Z, Float>> iconSize(CameraFunction<Z, Float> function) { + return new LayoutPropertyValue<>("icon-size", function); } /** @@ -1424,40 +1540,44 @@ public class PropertyFactory { * @param value a String value * @return property wrapper around String */ - public static Property<String> iconTextFit(@Property.ICON_TEXT_FIT String value) { - return new LayoutProperty<>("icon-text-fit", value); + public static PropertyValue<String> iconTextFit(@Property.ICON_TEXT_FIT String value) { + return new LayoutPropertyValue<>("icon-text-fit", value); } + + /** * Scales the icon to fit around the associated text. * - * @param function a wrapper function for String + * @param <Z> the zoom parameter type + * @param function a wrapper {@link CameraFunction} for String * @return property wrapper around a String function */ - public static Property<Function<String>> iconTextFit(Function<String> function) { - return new LayoutProperty<>("icon-text-fit", 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. + * Size of the additional area added to dimensions determined by {@link Property.ICON_TEXT_FIT}, in clockwise order: top, right, bottom, left. * * @param value a Float[] value * @return property wrapper around Float[] */ - public static Property<Float[]> iconTextFitPadding(Float[] value) { - return new LayoutProperty<>("icon-text-fit-padding", value); + public static PropertyValue<Float[]> iconTextFitPadding(Float[] value) { + 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. + * Size of the additional area added to dimensions determined by {@link Property.ICON_TEXT_FIT}, in clockwise order: top, right, bottom, left. * - * @param function a wrapper function for Float[] + * @param <Z> the zoom parameter type + * @param function a wrapper {@link CameraFunction} for Float[] * @return property wrapper around a Float[] function */ - public static Property<Function<Float[]>> iconTextFitPadding(Function<Float[]> function) { - return new LayoutProperty<>("icon-text-fit-padding", function); + public static <Z extends Number> PropertyValue<CameraFunction<Z, Float[]>> iconTextFitPadding(CameraFunction<Z, Float[]> function) { + return new LayoutPropertyValue<>("icon-text-fit-padding", function); } /** @@ -1466,18 +1586,21 @@ public class PropertyFactory { * @param value a String value * @return property wrapper around String */ - public static Property<String> iconImage(String value) { - return new LayoutProperty<>("icon-image", value); + public static PropertyValue<String> iconImage(String value) { + return new LayoutPropertyValue<>("icon-image", value); } + + /** * A string with {tokens} replaced, referencing the data property to pull from. * - * @param function a wrapper function for String + * @param <Z> the zoom parameter type + * @param function a wrapper {@link CameraFunction} for String * @return property wrapper around a String function */ - public static Property<Function<String>> iconImage(Function<String> function) { - return new LayoutProperty<>("icon-image", function); + public static <Z extends Number> PropertyValue<CameraFunction<Z, String>> iconImage(CameraFunction<Z, String> function) { + return new LayoutPropertyValue<>("icon-image", function); } /** @@ -1486,18 +1609,21 @@ public class PropertyFactory { * @param value a Float value * @return property wrapper around Float */ - public static Property<Float> iconRotate(Float value) { - return new LayoutProperty<>("icon-rotate", value); + public static PropertyValue<Float> iconRotate(Float value) { + 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 Property<Function<Float>> iconRotate(Function<Float> function) { - return new LayoutProperty<>("icon-rotate", function); + public static <T> PropertyValue<Function<T, Float>> iconRotate(Function<T, Float> function) { + return new LayoutPropertyValue<>("icon-rotate", function); } /** @@ -1506,18 +1632,21 @@ public class PropertyFactory { * @param value a Float value * @return property wrapper around Float */ - public static Property<Float> iconPadding(Float value) { - return new LayoutProperty<>("icon-padding", value); + public static PropertyValue<Float> iconPadding(Float value) { + return new LayoutPropertyValue<>("icon-padding", value); } + + /** * Size of the additional area around the icon bounding box used for detecting symbol collisions. * - * @param function a wrapper function for Float + * @param <Z> the zoom parameter type + * @param function a wrapper {@link CameraFunction} for Float * @return property wrapper around a Float function */ - public static Property<Function<Float>> iconPadding(Function<Float> function) { - return new LayoutProperty<>("icon-padding", function); + public static <Z extends Number> PropertyValue<CameraFunction<Z, Float>> iconPadding(CameraFunction<Z, Float> function) { + return new LayoutPropertyValue<>("icon-padding", function); } /** @@ -1526,40 +1655,44 @@ public class PropertyFactory { * @param value a Boolean value * @return property wrapper around Boolean */ - public static Property<Boolean> iconKeepUpright(Boolean value) { - return new LayoutProperty<>("icon-keep-upright", value); + public static PropertyValue<Boolean> iconKeepUpright(Boolean value) { + return new LayoutPropertyValue<>("icon-keep-upright", value); } + + /** * If true, the icon may be flipped to prevent it from being rendered upside-down. * - * @param function a wrapper function for Boolean + * @param <Z> the zoom parameter type + * @param function a wrapper {@link CameraFunction} for Boolean * @return property wrapper around a Boolean function */ - public static Property<Function<Boolean>> iconKeepUpright(Function<Boolean> function) { - return new LayoutProperty<>("icon-keep-upright", 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. + * Offset distance of icon from its anchor. Positive values indicate right and down, while negative values indicate left and up. When combined with {@link PropertyFactory#iconRotate} the offset will be as if the rotated direction was up. * * @param value a Float[] value * @return property wrapper around Float[] */ - public static Property<Float[]> iconOffset(Float[] value) { - return new LayoutProperty<>("icon-offset", value); + public static PropertyValue<Float[]> iconOffset(Float[] value) { + 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. + * Offset distance of icon from its anchor. Positive values indicate right and down, while negative values indicate left and up. 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 Property<Function<Float[]>> iconOffset(Function<Float[]> function) { - return new LayoutProperty<>("icon-offset", function); + public static <T> PropertyValue<Function<T, Float[]>> iconOffset(Function<T, Float[]> function) { + return new LayoutPropertyValue<>("icon-offset", function); } /** @@ -1568,60 +1701,67 @@ public class PropertyFactory { * @param value a String value * @return property wrapper around String */ - public static Property<String> textPitchAlignment(@Property.TEXT_PITCH_ALIGNMENT String value) { - return new LayoutProperty<>("text-pitch-alignment", value); + public static PropertyValue<String> textPitchAlignment(@Property.TEXT_PITCH_ALIGNMENT String value) { + return new LayoutPropertyValue<>("text-pitch-alignment", value); } + + /** * Orientation of text when map is pitched. * - * @param function a wrapper function for String + * @param <Z> the zoom parameter type + * @param function a wrapper {@link CameraFunction} for String * @return property wrapper around a String function */ - public static Property<Function<String>> textPitchAlignment(Function<String> function) { - return new LayoutProperty<>("text-pitch-alignment", 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. + * In combination with {@link Property.SYMBOL_PLACEMENT}, determines the rotation behavior of the individual glyphs forming the text. * * @param value a String value * @return property wrapper around String */ - public static Property<String> textRotationAlignment(@Property.TEXT_ROTATION_ALIGNMENT String value) { - return new LayoutProperty<>("text-rotation-alignment", value); + public static PropertyValue<String> textRotationAlignment(@Property.TEXT_ROTATION_ALIGNMENT String value) { + 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. + * In combination with {@link Property.SYMBOL_PLACEMENT}, determines the rotation behavior of the individual glyphs forming the text. * - * @param function a wrapper function for String + * @param <Z> the zoom parameter type + * @param function a wrapper {@link CameraFunction} for String * @return property wrapper around a String function */ - public static Property<Function<String>> textRotationAlignment(Function<String> function) { - return new LayoutProperty<>("text-rotation-alignment", 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. Feature properties are specified using tokens like {field_name}. + * Value to use for a text label. Feature properties are specified using tokens like {field_name}. (Token replacement is only supported for literal {@link PropertyFactory#textField} values--not for property functions.) * * @param value a String value * @return property wrapper around String */ - public static Property<String> textField(String value) { - return new LayoutProperty<>("text-field", value); + public static PropertyValue<String> textField(String value) { + return new LayoutPropertyValue<>("text-field", value); } + + /** - * Value to use for a text label. Feature properties are specified using tokens like {field_name}. + * Value to use for a text label. Feature properties are specified using tokens like {field_name}. (Token replacement is only supported for literal {@link PropertyFactory#textField} values--not for property functions.) * + * @param <T> the function input type * @param function a wrapper function for String * @return property wrapper around a String function */ - public static Property<Function<String>> textField(Function<String> function) { - return new LayoutProperty<>("text-field", function); + public static <T> PropertyValue<Function<T, String>> textField(Function<T, String> function) { + return new LayoutPropertyValue<>("text-field", function); } /** @@ -1630,18 +1770,21 @@ public class PropertyFactory { * @param value a String[] value * @return property wrapper around String[] */ - public static Property<String[]> textFont(String[] value) { - return new LayoutProperty<>("text-font", value); + public static PropertyValue<String[]> textFont(String[] value) { + return new LayoutPropertyValue<>("text-font", value); } + + /** * Font stack to use for displaying text. * - * @param function a wrapper function for String[] + * @param <Z> the zoom parameter type + * @param function a wrapper {@link CameraFunction} for String[] * @return property wrapper around a String[] function */ - public static Property<Function<String[]>> textFont(Function<String[]> function) { - return new LayoutProperty<>("text-font", function); + public static <Z extends Number> PropertyValue<CameraFunction<Z, String[]>> textFont(CameraFunction<Z, String[]> function) { + return new LayoutPropertyValue<>("text-font", function); } /** @@ -1650,18 +1793,21 @@ public class PropertyFactory { * @param value a Float value * @return property wrapper around Float */ - public static Property<Float> textSize(Float value) { - return new LayoutProperty<>("text-size", value); + public static PropertyValue<Float> textSize(Float value) { + return new LayoutPropertyValue<>("text-size", value); } + + /** * Font size. * - * @param function a wrapper function for Float + * @param <Z> the zoom parameter type + * @param function a wrapper {@link CameraFunction} for Float * @return property wrapper around a Float function */ - public static Property<Function<Float>> textSize(Function<Float> function) { - return new LayoutProperty<>("text-size", function); + public static <Z extends Number> PropertyValue<CameraFunction<Z, Float>> textSize(CameraFunction<Z, Float> function) { + return new LayoutPropertyValue<>("text-size", function); } /** @@ -1670,18 +1816,21 @@ public class PropertyFactory { * @param value a Float value * @return property wrapper around Float */ - public static Property<Float> textMaxWidth(Float value) { - return new LayoutProperty<>("text-max-width", value); + public static PropertyValue<Float> textMaxWidth(Float value) { + return new LayoutPropertyValue<>("text-max-width", value); } + + /** * The maximum line width for text wrapping. * - * @param function a wrapper function for Float + * @param <Z> the zoom parameter type + * @param function a wrapper {@link CameraFunction} for Float * @return property wrapper around a Float function */ - public static Property<Function<Float>> textMaxWidth(Function<Float> function) { - return new LayoutProperty<>("text-max-width", function); + public static <Z extends Number> PropertyValue<CameraFunction<Z, Float>> textMaxWidth(CameraFunction<Z, Float> function) { + return new LayoutPropertyValue<>("text-max-width", function); } /** @@ -1690,18 +1839,21 @@ public class PropertyFactory { * @param value a Float value * @return property wrapper around Float */ - public static Property<Float> textLineHeight(Float value) { - return new LayoutProperty<>("text-line-height", value); + public static PropertyValue<Float> textLineHeight(Float value) { + return new LayoutPropertyValue<>("text-line-height", value); } + + /** * Text leading value for multi-line text. * - * @param function a wrapper function for Float + * @param <Z> the zoom parameter type + * @param function a wrapper {@link CameraFunction} for Float * @return property wrapper around a Float function */ - public static Property<Function<Float>> textLineHeight(Function<Float> function) { - return new LayoutProperty<>("text-line-height", function); + public static <Z extends Number> PropertyValue<CameraFunction<Z, Float>> textLineHeight(CameraFunction<Z, Float> function) { + return new LayoutPropertyValue<>("text-line-height", function); } /** @@ -1710,18 +1862,21 @@ public class PropertyFactory { * @param value a Float value * @return property wrapper around Float */ - public static Property<Float> textLetterSpacing(Float value) { - return new LayoutProperty<>("text-letter-spacing", value); + public static PropertyValue<Float> textLetterSpacing(Float value) { + return new LayoutPropertyValue<>("text-letter-spacing", value); } + + /** * Text tracking amount. * - * @param function a wrapper function for Float + * @param <Z> the zoom parameter type + * @param function a wrapper {@link CameraFunction} for Float * @return property wrapper around a Float function */ - public static Property<Function<Float>> textLetterSpacing(Function<Float> function) { - return new LayoutProperty<>("text-letter-spacing", function); + public static <Z extends Number> PropertyValue<CameraFunction<Z, Float>> textLetterSpacing(CameraFunction<Z, Float> function) { + return new LayoutPropertyValue<>("text-letter-spacing", function); } /** @@ -1730,18 +1885,21 @@ public class PropertyFactory { * @param value a String value * @return property wrapper around String */ - public static Property<String> textJustify(@Property.TEXT_JUSTIFY String value) { - return new LayoutProperty<>("text-justify", value); + public static PropertyValue<String> textJustify(@Property.TEXT_JUSTIFY String value) { + return new LayoutPropertyValue<>("text-justify", value); } + + /** * Text justification options. * - * @param function a wrapper function for String + * @param <Z> the zoom parameter type + * @param function a wrapper {@link CameraFunction} for String * @return property wrapper around a String function */ - public static Property<Function<String>> textJustify(Function<String> function) { - return new LayoutProperty<>("text-justify", function); + public static <Z extends Number> PropertyValue<CameraFunction<Z, String>> textJustify(CameraFunction<Z, String> function) { + return new LayoutPropertyValue<>("text-justify", function); } /** @@ -1750,18 +1908,21 @@ public class PropertyFactory { * @param value a String value * @return property wrapper around String */ - public static Property<String> textAnchor(@Property.TEXT_ANCHOR String value) { - return new LayoutProperty<>("text-anchor", value); + public static PropertyValue<String> textAnchor(@Property.TEXT_ANCHOR String value) { + return new LayoutPropertyValue<>("text-anchor", value); } + + /** * Part of the text placed closest to the anchor. * - * @param function a wrapper function for String + * @param <Z> the zoom parameter type + * @param function a wrapper {@link CameraFunction} for String * @return property wrapper around a String function */ - public static Property<Function<String>> textAnchor(Function<String> function) { - return new LayoutProperty<>("text-anchor", function); + public static <Z extends Number> PropertyValue<CameraFunction<Z, String>> textAnchor(CameraFunction<Z, String> function) { + return new LayoutPropertyValue<>("text-anchor", function); } /** @@ -1770,18 +1931,21 @@ public class PropertyFactory { * @param value a Float value * @return property wrapper around Float */ - public static Property<Float> textMaxAngle(Float value) { - return new LayoutProperty<>("text-max-angle", value); + public static PropertyValue<Float> textMaxAngle(Float value) { + return new LayoutPropertyValue<>("text-max-angle", value); } + + /** * Maximum angle change between adjacent characters. * - * @param function a wrapper function for Float + * @param <Z> the zoom parameter type + * @param function a wrapper {@link CameraFunction} for Float * @return property wrapper around a Float function */ - public static Property<Function<Float>> textMaxAngle(Function<Float> function) { - return new LayoutProperty<>("text-max-angle", function); + public static <Z extends Number> PropertyValue<CameraFunction<Z, Float>> textMaxAngle(CameraFunction<Z, Float> function) { + return new LayoutPropertyValue<>("text-max-angle", function); } /** @@ -1790,18 +1954,21 @@ public class PropertyFactory { * @param value a Float value * @return property wrapper around Float */ - public static Property<Float> textRotate(Float value) { - return new LayoutProperty<>("text-rotate", value); + public static PropertyValue<Float> textRotate(Float value) { + return new LayoutPropertyValue<>("text-rotate", value); } + + /** * Rotates the text clockwise. * - * @param function a wrapper function for Float + * @param <Z> the zoom parameter type + * @param function a wrapper {@link CameraFunction} for Float * @return property wrapper around a Float function */ - public static Property<Function<Float>> textRotate(Function<Float> function) { - return new LayoutProperty<>("text-rotate", function); + public static <Z extends Number> PropertyValue<CameraFunction<Z, Float>> textRotate(CameraFunction<Z, Float> function) { + return new LayoutPropertyValue<>("text-rotate", function); } /** @@ -1810,18 +1977,21 @@ public class PropertyFactory { * @param value a Float value * @return property wrapper around Float */ - public static Property<Float> textPadding(Float value) { - return new LayoutProperty<>("text-padding", value); + public static PropertyValue<Float> textPadding(Float value) { + return new LayoutPropertyValue<>("text-padding", value); } + + /** * Size of the additional area around the text bounding box used for detecting symbol collisions. * - * @param function a wrapper function for Float + * @param <Z> the zoom parameter type + * @param function a wrapper {@link CameraFunction} for Float * @return property wrapper around a Float function */ - public static Property<Function<Float>> textPadding(Function<Float> function) { - return new LayoutProperty<>("text-padding", function); + public static <Z extends Number> PropertyValue<CameraFunction<Z, Float>> textPadding(CameraFunction<Z, Float> function) { + return new LayoutPropertyValue<>("text-padding", function); } /** @@ -1830,18 +2000,21 @@ public class PropertyFactory { * @param value a Boolean value * @return property wrapper around Boolean */ - public static Property<Boolean> textKeepUpright(Boolean value) { - return new LayoutProperty<>("text-keep-upright", value); + public static PropertyValue<Boolean> textKeepUpright(Boolean value) { + return new LayoutPropertyValue<>("text-keep-upright", value); } + + /** * If true, the text may be flipped vertically to prevent it from being rendered upside-down. * - * @param function a wrapper function for Boolean + * @param <Z> the zoom parameter type + * @param function a wrapper {@link CameraFunction} for Boolean * @return property wrapper around a Boolean function */ - public static Property<Function<Boolean>> textKeepUpright(Function<Boolean> function) { - return new LayoutProperty<>("text-keep-upright", function); + public static <Z extends Number> PropertyValue<CameraFunction<Z, Boolean>> textKeepUpright(CameraFunction<Z, Boolean> function) { + return new LayoutPropertyValue<>("text-keep-upright", function); } /** @@ -1850,40 +2023,44 @@ public class PropertyFactory { * @param value a String value * @return property wrapper around String */ - public static Property<String> textTransform(@Property.TEXT_TRANSFORM String value) { - return new LayoutProperty<>("text-transform", value); + public static PropertyValue<String> textTransform(@Property.TEXT_TRANSFORM String value) { + 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 Property<Function<String>> textTransform(Function<String> function) { - return new LayoutProperty<>("text-transform", 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. + * Offset distance of text from its anchor. Positive values indicate right and down, while negative values indicate left and up. * * @param value a Float[] value * @return property wrapper around Float[] */ - public static Property<Float[]> textOffset(Float[] value) { - return new LayoutProperty<>("text-offset", value); + public static PropertyValue<Float[]> textOffset(Float[] value) { + 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. + * Offset distance of text from its anchor. Positive values indicate right and down, while negative values indicate left and up. * - * @param function a wrapper function for Float[] + * @param <Z> the zoom parameter type + * @param function a wrapper {@link CameraFunction} for Float[] * @return property wrapper around a Float[] function */ - public static Property<Function<Float[]>> textOffset(Function<Float[]> function) { - return new LayoutProperty<>("text-offset", function); + public static <Z extends Number> PropertyValue<CameraFunction<Z, Float[]>> textOffset(CameraFunction<Z, Float[]> function) { + return new LayoutPropertyValue<>("text-offset", function); } /** @@ -1892,18 +2069,21 @@ public class PropertyFactory { * @param value a Boolean value * @return property wrapper around Boolean */ - public static Property<Boolean> textAllowOverlap(Boolean value) { - return new LayoutProperty<>("text-allow-overlap", value); + public static PropertyValue<Boolean> textAllowOverlap(Boolean value) { + return new LayoutPropertyValue<>("text-allow-overlap", value); } + + /** * If true, the text will be visible even if it collides with other previously drawn symbols. * - * @param function a wrapper function for Boolean + * @param <Z> the zoom parameter type + * @param function a wrapper {@link CameraFunction} for Boolean * @return property wrapper around a Boolean function */ - public static Property<Function<Boolean>> textAllowOverlap(Function<Boolean> function) { - return new LayoutProperty<>("text-allow-overlap", function); + public static <Z extends Number> PropertyValue<CameraFunction<Z, Boolean>> textAllowOverlap(CameraFunction<Z, Boolean> function) { + return new LayoutPropertyValue<>("text-allow-overlap", function); } /** @@ -1912,46 +2092,49 @@ public class PropertyFactory { * @param value a Boolean value * @return property wrapper around Boolean */ - public static Property<Boolean> textIgnorePlacement(Boolean value) { - return new LayoutProperty<>("text-ignore-placement", value); + public static PropertyValue<Boolean> textIgnorePlacement(Boolean value) { + return new LayoutPropertyValue<>("text-ignore-placement", value); } + + /** * If true, other symbols can be visible even if they collide with the text. * - * @param function a wrapper function for Boolean + * @param <Z> the zoom parameter type + * @param function a wrapper {@link CameraFunction} for Boolean * @return property wrapper around a Boolean function */ - public static Property<Function<Boolean>> textIgnorePlacement(Function<Boolean> function) { - return new LayoutProperty<>("text-ignore-placement", 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. + * If true, icons will display without their corresponding text when the text collides with other symbols and the icon does not. * * @param value a Boolean value * @return property wrapper around Boolean */ - public static Property<Boolean> textOptional(Boolean value) { - return new LayoutProperty<>("text-optional", value); + public static PropertyValue<Boolean> textOptional(Boolean value) { + 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. + * If true, icons will display without their corresponding text when the text collides with other symbols and the icon does not. * - * @param function a wrapper function for Boolean + * @param <Z> the zoom parameter type + * @param function a wrapper {@link CameraFunction} for Boolean * @return property wrapper around a Boolean function */ - public static Property<Function<Boolean>> textOptional(Function<Boolean> function) { - return new LayoutProperty<>("text-optional", function); + public static <Z extends Number> PropertyValue<CameraFunction<Z, Boolean>> textOptional(CameraFunction<Z, Boolean> function) { + return new LayoutPropertyValue<>("text-optional", function); } @SuppressLint("DefaultLocale") - static String colorToRgbaString(@ColorInt int value) { - return String.format("rgba(%d, %d, %d, %d)", (value >> 16) & 0xFF, (value >> 8) & 0xFF, value & 0xFF, - (value >> 24) & 0xFF); + public static String colorToRgbaString(@ColorInt int value) { + return String.format("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 c404f07c76..5286e6916d 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 @@ -1,7 +1,10 @@ package com.mapbox.mapboxsdk.style.layers; +import android.support.annotation.NonNull; import android.support.annotation.Nullable; +import com.mapbox.mapboxsdk.style.functions.Function; + import timber.log.Timber; /** @@ -9,9 +12,11 @@ import timber.log.Timber; */ public class PropertyValue<T> { - private final Object value; + public final String name; + public final T value; - /* package */ PropertyValue(Object value) { + /* package */ PropertyValue(@NonNull String name, T value) { + this.name = name; this.value = value; } @@ -28,10 +33,10 @@ public class PropertyValue<T> { } @Nullable - public Function<T> getFunction() { + public Function<?, T> getFunction() { if (isFunction()) { - //noinspection unchecked - return (Function<T>) value; + // noinspection unchecked + return (Function<?, T>) value; } else { Timber.w("not a function, try value"); return null; @@ -41,7 +46,7 @@ public class PropertyValue<T> { @Nullable public T getValue() { if (isValue()) { - //noinspection unchecked + // noinspection unchecked return (T) value; } else { Timber.w("not a value, try function"); @@ -51,7 +56,6 @@ public class PropertyValue<T> { @Override public String toString() { - return String.format("%s (%s)", getClass().getSimpleName(), value != null - ? value.getClass().getSimpleName() : null); + return String.format("%s: %s", name, value); } } diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/RasterLayer.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/RasterLayer.java index 785106c394..1871686429 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/RasterLayer.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/RasterLayer.java @@ -1,9 +1,13 @@ -package com.mapbox.mapboxsdk.style.layers; // This file is generated. Edit android/platform/scripts/generate-style-code.js, then run `make android-style-code`. +package com.mapbox.mapboxsdk.style.layers; + +import android.support.annotation.ColorInt; import android.support.annotation.NonNull; import android.support.annotation.UiThread; +import static com.mapbox.mapboxsdk.utils.ColorUtils.rgbaToColor; + /** * Raster map textures such as satellite imagery. * @@ -59,7 +63,7 @@ public class RasterLayer extends Layer { * @param properties the var-args properties * @return This */ - public RasterLayer withProperties(@NonNull Property<?>... properties) { + public RasterLayer withProperties(@NonNull PropertyValue<?>... properties) { setProperties(properties); return this; } @@ -73,7 +77,7 @@ public class RasterLayer extends Layer { */ @SuppressWarnings("unchecked") public PropertyValue<Float> getRasterOpacity() { - return (PropertyValue<Float>) new PropertyValue(nativeGetRasterOpacity()); + return (PropertyValue<Float>) new PropertyValue("raster-opacity", nativeGetRasterOpacity()); } /** @@ -83,7 +87,7 @@ public class RasterLayer extends Layer { */ @SuppressWarnings("unchecked") public PropertyValue<Float> getRasterHueRotate() { - return (PropertyValue<Float>) new PropertyValue(nativeGetRasterHueRotate()); + return (PropertyValue<Float>) new PropertyValue("raster-hue-rotate", nativeGetRasterHueRotate()); } /** @@ -93,7 +97,7 @@ public class RasterLayer extends Layer { */ @SuppressWarnings("unchecked") public PropertyValue<Float> getRasterBrightnessMin() { - return (PropertyValue<Float>) new PropertyValue(nativeGetRasterBrightnessMin()); + return (PropertyValue<Float>) new PropertyValue("raster-brightness-min", nativeGetRasterBrightnessMin()); } /** @@ -103,7 +107,7 @@ public class RasterLayer extends Layer { */ @SuppressWarnings("unchecked") public PropertyValue<Float> getRasterBrightnessMax() { - return (PropertyValue<Float>) new PropertyValue(nativeGetRasterBrightnessMax()); + return (PropertyValue<Float>) new PropertyValue("raster-brightness-max", nativeGetRasterBrightnessMax()); } /** @@ -113,7 +117,7 @@ public class RasterLayer extends Layer { */ @SuppressWarnings("unchecked") public PropertyValue<Float> getRasterSaturation() { - return (PropertyValue<Float>) new PropertyValue(nativeGetRasterSaturation()); + return (PropertyValue<Float>) new PropertyValue("raster-saturation", nativeGetRasterSaturation()); } /** @@ -123,7 +127,7 @@ public class RasterLayer extends Layer { */ @SuppressWarnings("unchecked") public PropertyValue<Float> getRasterContrast() { - return (PropertyValue<Float>) new PropertyValue(nativeGetRasterContrast()); + return (PropertyValue<Float>) new PropertyValue("raster-contrast", nativeGetRasterContrast()); } /** @@ -133,7 +137,7 @@ public class RasterLayer extends Layer { */ @SuppressWarnings("unchecked") public PropertyValue<Float> getRasterFadeDuration() { - return (PropertyValue<Float>) new PropertyValue(nativeGetRasterFadeDuration()); + return (PropertyValue<Float>) new PropertyValue("raster-fade-duration", nativeGetRasterFadeDuration()); } private native Object nativeGetRasterOpacity(); diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/SymbolLayer.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/SymbolLayer.java index abc516d6d0..c1efdc9636 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/SymbolLayer.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/SymbolLayer.java @@ -1,6 +1,7 @@ -package com.mapbox.mapboxsdk.style.layers; // This file is generated. Edit android/platform/scripts/generate-style-code.js, then run `make android-style-code`. +package com.mapbox.mapboxsdk.style.layers; + import android.support.annotation.ColorInt; import android.support.annotation.NonNull; import android.support.annotation.UiThread; @@ -62,27 +63,7 @@ public class SymbolLayer extends Layer { * @param filter the filter to set */ public void setFilter(Filter.Statement filter) { - this.setFilter(filter.toArray()); - } - - /** - * Set an array of filters. - * - * @param filter the filter array to set - */ - public void setFilter(Object[] filter) { - nativeSetFilter(filter); - } - - /** - * Set an array of filters. - * - * @param filter tthe filter array to set - * @return This - */ - public SymbolLayer withFilter(Object[] filter) { - setFilter(filter); - return this; + nativeSetFilter(filter.toArray()); } /** @@ -96,14 +77,13 @@ public class SymbolLayer extends Layer { return this; } - /** * Set a property or properties. * * @param properties the var-args properties * @return This */ - public SymbolLayer withProperties(@NonNull Property<?>... properties) { + public SymbolLayer withProperties(@NonNull PropertyValue<?>... properties) { setProperties(properties); return this; } @@ -117,7 +97,7 @@ public class SymbolLayer extends Layer { */ @SuppressWarnings("unchecked") public PropertyValue<String> getSymbolPlacement() { - return (PropertyValue<String>) new PropertyValue(nativeGetSymbolPlacement()); + return (PropertyValue<String>) new PropertyValue("symbol-placement", nativeGetSymbolPlacement()); } /** @@ -127,7 +107,7 @@ public class SymbolLayer extends Layer { */ @SuppressWarnings("unchecked") public PropertyValue<Float> getSymbolSpacing() { - return (PropertyValue<Float>) new PropertyValue(nativeGetSymbolSpacing()); + return (PropertyValue<Float>) new PropertyValue("symbol-spacing", nativeGetSymbolSpacing()); } /** @@ -137,7 +117,7 @@ public class SymbolLayer extends Layer { */ @SuppressWarnings("unchecked") public PropertyValue<Boolean> getSymbolAvoidEdges() { - return (PropertyValue<Boolean>) new PropertyValue(nativeGetSymbolAvoidEdges()); + return (PropertyValue<Boolean>) new PropertyValue("symbol-avoid-edges", nativeGetSymbolAvoidEdges()); } /** @@ -147,7 +127,7 @@ public class SymbolLayer extends Layer { */ @SuppressWarnings("unchecked") public PropertyValue<Boolean> getIconAllowOverlap() { - return (PropertyValue<Boolean>) new PropertyValue(nativeGetIconAllowOverlap()); + return (PropertyValue<Boolean>) new PropertyValue("icon-allow-overlap", nativeGetIconAllowOverlap()); } /** @@ -157,7 +137,7 @@ public class SymbolLayer extends Layer { */ @SuppressWarnings("unchecked") public PropertyValue<Boolean> getIconIgnorePlacement() { - return (PropertyValue<Boolean>) new PropertyValue(nativeGetIconIgnorePlacement()); + return (PropertyValue<Boolean>) new PropertyValue("icon-ignore-placement", nativeGetIconIgnorePlacement()); } /** @@ -167,7 +147,7 @@ public class SymbolLayer extends Layer { */ @SuppressWarnings("unchecked") public PropertyValue<Boolean> getIconOptional() { - return (PropertyValue<Boolean>) new PropertyValue(nativeGetIconOptional()); + return (PropertyValue<Boolean>) new PropertyValue("icon-optional", nativeGetIconOptional()); } /** @@ -177,7 +157,7 @@ public class SymbolLayer extends Layer { */ @SuppressWarnings("unchecked") public PropertyValue<String> getIconRotationAlignment() { - return (PropertyValue<String>) new PropertyValue(nativeGetIconRotationAlignment()); + return (PropertyValue<String>) new PropertyValue("icon-rotation-alignment", nativeGetIconRotationAlignment()); } /** @@ -187,7 +167,7 @@ public class SymbolLayer extends Layer { */ @SuppressWarnings("unchecked") public PropertyValue<Float> getIconSize() { - return (PropertyValue<Float>) new PropertyValue(nativeGetIconSize()); + return (PropertyValue<Float>) new PropertyValue("icon-size", nativeGetIconSize()); } /** @@ -197,7 +177,7 @@ public class SymbolLayer extends Layer { */ @SuppressWarnings("unchecked") public PropertyValue<String> getIconTextFit() { - return (PropertyValue<String>) new PropertyValue(nativeGetIconTextFit()); + return (PropertyValue<String>) new PropertyValue("icon-text-fit", nativeGetIconTextFit()); } /** @@ -207,7 +187,7 @@ public class SymbolLayer extends Layer { */ @SuppressWarnings("unchecked") public PropertyValue<Float[]> getIconTextFitPadding() { - return (PropertyValue<Float[]>) new PropertyValue(nativeGetIconTextFitPadding()); + return (PropertyValue<Float[]>) new PropertyValue("icon-text-fit-padding", nativeGetIconTextFitPadding()); } /** @@ -217,7 +197,7 @@ public class SymbolLayer extends Layer { */ @SuppressWarnings("unchecked") public PropertyValue<String> getIconImage() { - return (PropertyValue<String>) new PropertyValue(nativeGetIconImage()); + return (PropertyValue<String>) new PropertyValue("icon-image", nativeGetIconImage()); } /** @@ -227,7 +207,7 @@ public class SymbolLayer extends Layer { */ @SuppressWarnings("unchecked") public PropertyValue<Float> getIconRotate() { - return (PropertyValue<Float>) new PropertyValue(nativeGetIconRotate()); + return (PropertyValue<Float>) new PropertyValue("icon-rotate", nativeGetIconRotate()); } /** @@ -237,7 +217,7 @@ public class SymbolLayer extends Layer { */ @SuppressWarnings("unchecked") public PropertyValue<Float> getIconPadding() { - return (PropertyValue<Float>) new PropertyValue(nativeGetIconPadding()); + return (PropertyValue<Float>) new PropertyValue("icon-padding", nativeGetIconPadding()); } /** @@ -247,7 +227,7 @@ public class SymbolLayer extends Layer { */ @SuppressWarnings("unchecked") public PropertyValue<Boolean> getIconKeepUpright() { - return (PropertyValue<Boolean>) new PropertyValue(nativeGetIconKeepUpright()); + return (PropertyValue<Boolean>) new PropertyValue("icon-keep-upright", nativeGetIconKeepUpright()); } /** @@ -257,7 +237,7 @@ public class SymbolLayer extends Layer { */ @SuppressWarnings("unchecked") public PropertyValue<Float[]> getIconOffset() { - return (PropertyValue<Float[]>) new PropertyValue(nativeGetIconOffset()); + return (PropertyValue<Float[]>) new PropertyValue("icon-offset", nativeGetIconOffset()); } /** @@ -267,7 +247,7 @@ public class SymbolLayer extends Layer { */ @SuppressWarnings("unchecked") public PropertyValue<String> getTextPitchAlignment() { - return (PropertyValue<String>) new PropertyValue(nativeGetTextPitchAlignment()); + return (PropertyValue<String>) new PropertyValue("text-pitch-alignment", nativeGetTextPitchAlignment()); } /** @@ -277,7 +257,7 @@ public class SymbolLayer extends Layer { */ @SuppressWarnings("unchecked") public PropertyValue<String> getTextRotationAlignment() { - return (PropertyValue<String>) new PropertyValue(nativeGetTextRotationAlignment()); + return (PropertyValue<String>) new PropertyValue("text-rotation-alignment", nativeGetTextRotationAlignment()); } /** @@ -287,7 +267,7 @@ public class SymbolLayer extends Layer { */ @SuppressWarnings("unchecked") public PropertyValue<String> getTextField() { - return (PropertyValue<String>) new PropertyValue(nativeGetTextField()); + return (PropertyValue<String>) new PropertyValue("text-field", nativeGetTextField()); } /** @@ -297,7 +277,7 @@ public class SymbolLayer extends Layer { */ @SuppressWarnings("unchecked") public PropertyValue<String[]> getTextFont() { - return (PropertyValue<String[]>) new PropertyValue(nativeGetTextFont()); + return (PropertyValue<String[]>) new PropertyValue("text-font", nativeGetTextFont()); } /** @@ -307,7 +287,7 @@ public class SymbolLayer extends Layer { */ @SuppressWarnings("unchecked") public PropertyValue<Float> getTextSize() { - return (PropertyValue<Float>) new PropertyValue(nativeGetTextSize()); + return (PropertyValue<Float>) new PropertyValue("text-size", nativeGetTextSize()); } /** @@ -317,7 +297,7 @@ public class SymbolLayer extends Layer { */ @SuppressWarnings("unchecked") public PropertyValue<Float> getTextMaxWidth() { - return (PropertyValue<Float>) new PropertyValue(nativeGetTextMaxWidth()); + return (PropertyValue<Float>) new PropertyValue("text-max-width", nativeGetTextMaxWidth()); } /** @@ -327,7 +307,7 @@ public class SymbolLayer extends Layer { */ @SuppressWarnings("unchecked") public PropertyValue<Float> getTextLineHeight() { - return (PropertyValue<Float>) new PropertyValue(nativeGetTextLineHeight()); + return (PropertyValue<Float>) new PropertyValue("text-line-height", nativeGetTextLineHeight()); } /** @@ -337,7 +317,7 @@ public class SymbolLayer extends Layer { */ @SuppressWarnings("unchecked") public PropertyValue<Float> getTextLetterSpacing() { - return (PropertyValue<Float>) new PropertyValue(nativeGetTextLetterSpacing()); + return (PropertyValue<Float>) new PropertyValue("text-letter-spacing", nativeGetTextLetterSpacing()); } /** @@ -347,7 +327,7 @@ public class SymbolLayer extends Layer { */ @SuppressWarnings("unchecked") public PropertyValue<String> getTextJustify() { - return (PropertyValue<String>) new PropertyValue(nativeGetTextJustify()); + return (PropertyValue<String>) new PropertyValue("text-justify", nativeGetTextJustify()); } /** @@ -357,7 +337,7 @@ public class SymbolLayer extends Layer { */ @SuppressWarnings("unchecked") public PropertyValue<String> getTextAnchor() { - return (PropertyValue<String>) new PropertyValue(nativeGetTextAnchor()); + return (PropertyValue<String>) new PropertyValue("text-anchor", nativeGetTextAnchor()); } /** @@ -367,7 +347,7 @@ public class SymbolLayer extends Layer { */ @SuppressWarnings("unchecked") public PropertyValue<Float> getTextMaxAngle() { - return (PropertyValue<Float>) new PropertyValue(nativeGetTextMaxAngle()); + return (PropertyValue<Float>) new PropertyValue("text-max-angle", nativeGetTextMaxAngle()); } /** @@ -377,7 +357,7 @@ public class SymbolLayer extends Layer { */ @SuppressWarnings("unchecked") public PropertyValue<Float> getTextRotate() { - return (PropertyValue<Float>) new PropertyValue(nativeGetTextRotate()); + return (PropertyValue<Float>) new PropertyValue("text-rotate", nativeGetTextRotate()); } /** @@ -387,7 +367,7 @@ public class SymbolLayer extends Layer { */ @SuppressWarnings("unchecked") public PropertyValue<Float> getTextPadding() { - return (PropertyValue<Float>) new PropertyValue(nativeGetTextPadding()); + return (PropertyValue<Float>) new PropertyValue("text-padding", nativeGetTextPadding()); } /** @@ -397,7 +377,7 @@ public class SymbolLayer extends Layer { */ @SuppressWarnings("unchecked") public PropertyValue<Boolean> getTextKeepUpright() { - return (PropertyValue<Boolean>) new PropertyValue(nativeGetTextKeepUpright()); + return (PropertyValue<Boolean>) new PropertyValue("text-keep-upright", nativeGetTextKeepUpright()); } /** @@ -407,7 +387,7 @@ public class SymbolLayer extends Layer { */ @SuppressWarnings("unchecked") public PropertyValue<String> getTextTransform() { - return (PropertyValue<String>) new PropertyValue(nativeGetTextTransform()); + return (PropertyValue<String>) new PropertyValue("text-transform", nativeGetTextTransform()); } /** @@ -417,7 +397,7 @@ public class SymbolLayer extends Layer { */ @SuppressWarnings("unchecked") public PropertyValue<Float[]> getTextOffset() { - return (PropertyValue<Float[]>) new PropertyValue(nativeGetTextOffset()); + return (PropertyValue<Float[]>) new PropertyValue("text-offset", nativeGetTextOffset()); } /** @@ -427,7 +407,7 @@ public class SymbolLayer extends Layer { */ @SuppressWarnings("unchecked") public PropertyValue<Boolean> getTextAllowOverlap() { - return (PropertyValue<Boolean>) new PropertyValue(nativeGetTextAllowOverlap()); + return (PropertyValue<Boolean>) new PropertyValue("text-allow-overlap", nativeGetTextAllowOverlap()); } /** @@ -437,7 +417,7 @@ public class SymbolLayer extends Layer { */ @SuppressWarnings("unchecked") public PropertyValue<Boolean> getTextIgnorePlacement() { - return (PropertyValue<Boolean>) new PropertyValue(nativeGetTextIgnorePlacement()); + return (PropertyValue<Boolean>) new PropertyValue("text-ignore-placement", nativeGetTextIgnorePlacement()); } /** @@ -447,7 +427,7 @@ public class SymbolLayer extends Layer { */ @SuppressWarnings("unchecked") public PropertyValue<Boolean> getTextOptional() { - return (PropertyValue<Boolean>) new PropertyValue(nativeGetTextOptional()); + return (PropertyValue<Boolean>) new PropertyValue("text-optional", nativeGetTextOptional()); } /** @@ -457,7 +437,7 @@ public class SymbolLayer extends Layer { */ @SuppressWarnings("unchecked") public PropertyValue<Float> getIconOpacity() { - return (PropertyValue<Float>) new PropertyValue(nativeGetIconOpacity()); + return (PropertyValue<Float>) new PropertyValue("icon-opacity", nativeGetIconOpacity()); } /** @@ -467,7 +447,7 @@ public class SymbolLayer extends Layer { */ @SuppressWarnings("unchecked") public PropertyValue<String> getIconColor() { - return (PropertyValue<String>) new PropertyValue(nativeGetIconColor()); + return (PropertyValue<String>) new PropertyValue("icon-color", nativeGetIconColor()); } /** @@ -494,7 +474,7 @@ public class SymbolLayer extends Layer { */ @SuppressWarnings("unchecked") public PropertyValue<String> getIconHaloColor() { - return (PropertyValue<String>) new PropertyValue(nativeGetIconHaloColor()); + return (PropertyValue<String>) new PropertyValue("icon-halo-color", nativeGetIconHaloColor()); } /** @@ -521,7 +501,7 @@ public class SymbolLayer extends Layer { */ @SuppressWarnings("unchecked") public PropertyValue<Float> getIconHaloWidth() { - return (PropertyValue<Float>) new PropertyValue(nativeGetIconHaloWidth()); + return (PropertyValue<Float>) new PropertyValue("icon-halo-width", nativeGetIconHaloWidth()); } /** @@ -531,7 +511,7 @@ public class SymbolLayer extends Layer { */ @SuppressWarnings("unchecked") public PropertyValue<Float> getIconHaloBlur() { - return (PropertyValue<Float>) new PropertyValue(nativeGetIconHaloBlur()); + return (PropertyValue<Float>) new PropertyValue("icon-halo-blur", nativeGetIconHaloBlur()); } /** @@ -541,7 +521,7 @@ public class SymbolLayer extends Layer { */ @SuppressWarnings("unchecked") public PropertyValue<Float[]> getIconTranslate() { - return (PropertyValue<Float[]>) new PropertyValue(nativeGetIconTranslate()); + return (PropertyValue<Float[]>) new PropertyValue("icon-translate", nativeGetIconTranslate()); } /** @@ -551,7 +531,7 @@ public class SymbolLayer extends Layer { */ @SuppressWarnings("unchecked") public PropertyValue<String> getIconTranslateAnchor() { - return (PropertyValue<String>) new PropertyValue(nativeGetIconTranslateAnchor()); + return (PropertyValue<String>) new PropertyValue("icon-translate-anchor", nativeGetIconTranslateAnchor()); } /** @@ -561,7 +541,7 @@ public class SymbolLayer extends Layer { */ @SuppressWarnings("unchecked") public PropertyValue<Float> getTextOpacity() { - return (PropertyValue<Float>) new PropertyValue(nativeGetTextOpacity()); + return (PropertyValue<Float>) new PropertyValue("text-opacity", nativeGetTextOpacity()); } /** @@ -571,7 +551,7 @@ public class SymbolLayer extends Layer { */ @SuppressWarnings("unchecked") public PropertyValue<String> getTextColor() { - return (PropertyValue<String>) new PropertyValue(nativeGetTextColor()); + return (PropertyValue<String>) new PropertyValue("text-color", nativeGetTextColor()); } /** @@ -598,7 +578,7 @@ public class SymbolLayer extends Layer { */ @SuppressWarnings("unchecked") public PropertyValue<String> getTextHaloColor() { - return (PropertyValue<String>) new PropertyValue(nativeGetTextHaloColor()); + return (PropertyValue<String>) new PropertyValue("text-halo-color", nativeGetTextHaloColor()); } /** @@ -625,7 +605,7 @@ public class SymbolLayer extends Layer { */ @SuppressWarnings("unchecked") public PropertyValue<Float> getTextHaloWidth() { - return (PropertyValue<Float>) new PropertyValue(nativeGetTextHaloWidth()); + return (PropertyValue<Float>) new PropertyValue("text-halo-width", nativeGetTextHaloWidth()); } /** @@ -635,7 +615,7 @@ public class SymbolLayer extends Layer { */ @SuppressWarnings("unchecked") public PropertyValue<Float> getTextHaloBlur() { - return (PropertyValue<Float>) new PropertyValue(nativeGetTextHaloBlur()); + return (PropertyValue<Float>) new PropertyValue("text-halo-blur", nativeGetTextHaloBlur()); } /** @@ -645,7 +625,7 @@ public class SymbolLayer extends Layer { */ @SuppressWarnings("unchecked") public PropertyValue<Float[]> getTextTranslate() { - return (PropertyValue<Float[]>) new PropertyValue(nativeGetTextTranslate()); + return (PropertyValue<Float[]>) new PropertyValue("text-translate", nativeGetTextTranslate()); } /** @@ -655,7 +635,7 @@ public class SymbolLayer extends Layer { */ @SuppressWarnings("unchecked") public PropertyValue<String> getTextTranslateAnchor() { - return (PropertyValue<String>) new PropertyValue(nativeGetTextTranslateAnchor()); + return (PropertyValue<String>) new PropertyValue("text-translate-anchor", nativeGetTextTranslateAnchor()); } private native Object nativeGetSymbolPlacement(); diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/UnknownLayer.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/UnknownLayer.java new file mode 100644 index 0000000000..4abafcdbeb --- /dev/null +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/UnknownLayer.java @@ -0,0 +1,25 @@ +package com.mapbox.mapboxsdk.style.layers; + +import android.support.annotation.UiThread; + +/** + * An unknown type of layer + */ +@UiThread +public class UnknownLayer extends Layer { + + /** + * Creates a UnknownLayer. + * + * @param nativePtr pointer used by core + */ + UnknownLayer(long nativePtr) { + super(nativePtr); + } + + protected native void initialize(); + + @Override + protected native void finalize() throws Throwable; + +} diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/layer.java.ejs b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/layer.java.ejs index 4657037df8..5eab4c355e 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/layer.java.ejs +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/layer.java.ejs @@ -4,14 +4,14 @@ const doc = locals.doc; -%> // This file is generated. Edit android/platform/scripts/generate-style-code.js, then run `make android-style-code`. -package com.mapbox.mapboxsdk.style.layers; -import android.support.annotation.UiThread; +package com.mapbox.mapboxsdk.style.layers; import android.support.annotation.ColorInt; import android.support.annotation.NonNull; +import android.support.annotation.UiThread; -import static com.mapbox.mapboxsdk.utils.ColorUtils.*; +import static com.mapbox.mapboxsdk.utils.ColorUtils.rgbaToColor; /** * <%- doc %> @@ -21,151 +21,133 @@ import static com.mapbox.mapboxsdk.utils.ColorUtils.*; @UiThread public class <%- camelize(type) %>Layer extends Layer { - /** - * Creates a <%- camelize(type) %>Layer. - * - * @param nativePtr pointer used by core - */ - public <%- camelize(type) %>Layer(long nativePtr) { - super(nativePtr); - } + /** + * Creates a <%- camelize(type) %>Layer. + * + * @param nativePtr pointer used by core + */ + public <%- camelize(type) %>Layer(long nativePtr) { + super(nativePtr); + } <% if (type === 'background') { -%> - /** - * Creates a <%- camelize(type) %>Layer. - * - * @param layerId the id of the layer - */ - public <%- camelize(type) %>Layer(String layerId) { - initialize(layerId); - } + /** + * Creates a <%- camelize(type) %>Layer. + * + * @param layerId the id of the layer + */ + public <%- camelize(type) %>Layer(String layerId) { + initialize(layerId); + } - protected native void initialize(String layerId); -<% } else { -%> - /** - * Creates a <%- camelize(type) %>Layer. - * - * @param layerId the id of the layer - * @param sourceId the id of the source - */ - public <%- camelize(type) %>Layer(String layerId, String sourceId) { - initialize(layerId, sourceId); - } - - protected native void initialize(String layerId, String sourceId); + protected native void initialize(String layerId); - /** - * Set the source layer. - * - * @param sourceLayer the source layer to set - */ - public void setSourceLayer(String sourceLayer) { - nativeSetSourceLayer(sourceLayer); - } +<% } else { -%> + /** + * Creates a <%- camelize(type) %>Layer. + * + * @param layerId the id of the layer + * @param sourceId the id of the source + */ + public <%- camelize(type) %>Layer(String layerId, String sourceId) { + initialize(layerId, sourceId); + } + + protected native void initialize(String layerId, String sourceId); + + /** + * Set the source layer. + * + * @param sourceLayer the source layer to set + */ + public void setSourceLayer(String sourceLayer) { + nativeSetSourceLayer(sourceLayer); + } + + /** + * Set the source Layer. + * + * @param sourceLayer the source layer to set + * @return This + */ + public <%- camelize(type) %>Layer withSourceLayer(String sourceLayer) { + setSourceLayer(sourceLayer); + return this; + } - /** - * Set the source Layer. - * - * @param sourceLayer the source layer to set - * @return This - */ - public <%- camelize(type) %>Layer withSourceLayer(String sourceLayer) { - setSourceLayer(sourceLayer); - return this; - } <% } -%> <% if (type !== 'background' && type !== 'raster') { -%> - /** - * Set a single filter. - * - * @param filter the filter to set - */ - public void setFilter(Filter.Statement filter) { - this.setFilter(filter.toArray()); - } - - /** - * Set an array of filters. - * - * @param filter the filter array to set - */ - public void setFilter(Object[] filter) { - nativeSetFilter(filter); - } - - /** - * Set an array of filters. - * - * @param filter tthe filter array to set - * @return This - */ - public <%- camelize(type) %>Layer withFilter(Object[] filter) { - setFilter(filter); - return this; - } - - /** - * Set a single filter. - * - * @param filter the filter to set - * @return This - */ - public <%- camelize(type) %>Layer withFilter(Filter.Statement filter) { - setFilter(filter); - return this; - } + /** + * Set a single filter. + * + * @param filter the filter to set + */ + public void setFilter(Filter.Statement filter) { + nativeSetFilter(filter.toArray()); + } + + /** + * Set a single filter. + * + * @param filter the filter to set + * @return This + */ + public <%- camelize(type) %>Layer withFilter(Filter.Statement filter) { + setFilter(filter); + return this; + } <% } -%> - - /** - * Set a property or properties. - * - * @param properties the var-args properties - * @return This - */ - public <%- camelize(type) %>Layer withProperties(@NonNull Property<?>... properties) { - setProperties(properties); - return this; - } - - // Property getters + /** + * Set a property or properties. + * + * @param properties the var-args properties + * @return This + */ + public <%- camelize(type) %>Layer withProperties(@NonNull PropertyValue<?>... properties) { + setProperties(properties); + return this; + } + + // Property getters <% for (const property of properties) { -%> - /** - * Get the <%- camelize(property.name) %> property - * - * @return property wrapper value around <%- propertyType(property) %> - */ - @SuppressWarnings("unchecked") - public PropertyValue<<%- propertyType(property) %>> get<%- camelize(property.name) %>() { - return (PropertyValue<<%- propertyType(property) %>>) new PropertyValue(nativeGet<%- camelize(property.name) %>()); - } - <% if (property.type == 'color') { -%> - /** - * <%- property.doc %> - * - * @return int representation of a rgba string color - * @throws RuntimeException thrown if property isn't a value - */ - @ColorInt - public int get<%- camelize(property.name) %>AsInt() { - PropertyValue<<%- propertyType(property) %>> value = get<%- camelize(property.name) %>(); - if (value.isValue()) { - return rgbaToColor(value.getValue()); - } else { - throw new RuntimeException("<%- property.name %> was set as a Function"); - } + /** + * Get the <%- camelize(property.name) %> property + * + * @return property wrapper value around <%- propertyType(property) %> + */ + @SuppressWarnings("unchecked") + public PropertyValue<<%- propertyType(property) %>> get<%- camelize(property.name) %>() { + return (PropertyValue<<%- propertyType(property) %>>) new PropertyValue("<%- property.name %>", nativeGet<%- camelize(property.name) %>()); + } +<% if (property.type == 'color') { -%> + + /** + * <%- property.doc %> + * + * @return int representation of a rgba string color + * @throws RuntimeException thrown if property isn't a value + */ + @ColorInt + public int get<%- camelize(property.name) %>AsInt() { + PropertyValue<<%- propertyType(property) %>> value = get<%- camelize(property.name) %>(); + if (value.isValue()) { + return rgbaToColor(value.getValue()); + } else { + throw new RuntimeException("<%- property.name %> was set as a Function"); } + } - <% } -%> +<% } -%> <% } -%> <% for (const property of properties) { -%> - private native Object nativeGet<%- camelize(property.name) %>(); + private native Object nativeGet<%- camelize(property.name) %>(); <% } -%> - @Override - protected native void finalize() throws Throwable; + @Override + protected native void finalize() throws Throwable; } diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/property.java.ejs b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/property.java.ejs index 3ce691775c..aaab1fe9f1 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/property.java.ejs +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/property.java.ejs @@ -2,6 +2,7 @@ const properties = locals.properties; -%> // This file is generated. Edit android/platform/scripts/generate-style-code.js, then run `make android-style-code`. + package com.mapbox.mapboxsdk.style.layers; import android.support.annotation.StringDef; @@ -12,56 +13,49 @@ import java.lang.annotation.RetentionPolicy; /** * Paint/Layout properties for Layer */ -public abstract class Property<T> { - - //VISIBILITY: Whether this layer is displayed. - - /** - * The layer is shown. - */ - public static final String VISIBLE = "visible"; - /** - * The layer is hidden. - */ - public static final String NONE = "none"; - - @StringDef({ - VISIBLE, - NONE - }) - @Retention(RetentionPolicy.SOURCE) - public @interface VISIBILITY {} +public final class Property { + + // VISIBILITY: Whether this layer is displayed. + + /** + * The layer is shown. + */ + public static final String VISIBLE = "visible"; + /** + * The layer is hidden. + */ + public static final String NONE = "none"; + + @StringDef({ + VISIBLE, + NONE + }) + @Retention(RetentionPolicy.SOURCE) + public @interface VISIBILITY {} <% for (const property of properties) { -%> - //<%- snakeCaseUpper(property.name) %>: <%- property.doc %> + // <%- snakeCaseUpper(property.name) %>: <%- property.doc %> <% for (const value in property.values) { -%> - /** - * <%- propertyValueDoc(property, value) %> - */ - public static final String <%- snakeCaseUpper(property.name) %>_<%- snakeCaseUpper(value) %> = "<%- value %>"; + /** + * <%- propertyValueDoc(property, value) %> + */ + public static final String <%- snakeCaseUpper(property.name) %>_<%- snakeCaseUpper(value) %> = "<%- value %>"; <% } -%> - /** - * <%- property.doc %> - */ - @StringDef({ - <% for (const value of Object.keys(property.values)) { -%> - <%- snakeCaseUpper(property.name) %>_<%- snakeCaseUpper(value) %>, - <% } -%> - }) - @Retention(RetentionPolicy.SOURCE) - public @interface <%- snakeCaseUpper(property.name) %> {} + /** + * <%- property.doc %> + */ + @StringDef({ + <% for (const value of Object.keys(property.values)) { -%> + <%- snakeCaseUpper(property.name) %>_<%- snakeCaseUpper(value) %>, + <% } -%> + }) + @Retention(RetentionPolicy.SOURCE) + public @interface <%- snakeCaseUpper(property.name) %> {} <% } -%> - //Class definition - public final String name; - public final T value; - - /* package */ Property(String name, T value) { - this.name = name; - this.value = value; - } - + private Property() { + } } 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 e9b7b6dcd1..2d3421d1d9 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 @@ -3,11 +3,15 @@ const layoutProperties = locals.layoutProperties; -%> // This file is generated. Edit android/platform/scripts/generate-style-code.js, then run `make android-style-code`. + package com.mapbox.mapboxsdk.style.layers; import android.annotation.SuppressLint; import android.support.annotation.ColorInt; +import com.mapbox.mapboxsdk.style.functions.Function; +import com.mapbox.mapboxsdk.style.functions.CameraFunction; + /** * Constructs paint/layout properties for Layers * @@ -15,85 +19,121 @@ import android.support.annotation.ColorInt; */ public class PropertyFactory { - /** - * Set the property visibility. - * - * @param value the visibility value - * @return property wrapper around visibility - */ - public static Property<String> visibility(@Property.VISIBILITY String value) { - return new LayoutProperty<>("visibility", value); - } - - /** - * Set the property visibility. - * - * @param function the visibility function - * @return property wrapper around a String function - */ - public static Property<Function<String>> visibility(Function<String> function) { - return new LayoutProperty<>("visibility", function); - } + /** + * Set the property visibility. + * + * @param value the visibility value + * @return property wrapper around visibility + */ + public static PropertyValue<String> visibility(@Property.VISIBILITY String value) { + 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 + */ + 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') { -%> - /** - * <%- propertyFactoryMethodDoc(property) %> - * - * @param value a int color value - * @return property wrapper around String color - */ - public static Property<String> <%- camelizeWithLeadingLowercase(property.name) %>(@ColorInt int value) { - return new PaintProperty<>("<%- property.name %>", colorToRgbaString(value)); - } + /** + * <%- propertyFactoryMethodDoc(property) %> + * + * @param value a int color value + * @return property wrapper around String color + */ + public static PropertyValue<String> <%- camelizeWithLeadingLowercase(property.name) %>(@ColorInt int value) { + return new PaintPropertyValue<>("<%- property.name %>", colorToRgbaString(value)); + } <% } -%> - /** - * <%- propertyFactoryMethodDoc(property) %> - * - * @param value a <%- propertyType(property) %> value - * @return property wrapper around <%- propertyType(property) %> - */ - public static Property<<%- propertyType(property) %>> <%- camelizeWithLeadingLowercase(property.name) %>(<%- propertyTypeAnnotation(property) %><%- iff(() => propertyTypeAnnotation(property), " ") %><%- propertyType(property) %> value) { - return new PaintProperty<>("<%- property.name %>", value); - } - - /** - * <%- propertyFactoryMethodDoc(property) %> - * - * @param function a wrapper function for <%- propertyType(property) %> - * @return property wrapper around a <%- propertyType(property) %> function - */ - public static Property<Function<<%- propertyType(property) %>>> <%- camelizeWithLeadingLowercase(property.name) %>(Function<<%- propertyType(property) %>> function) { - return new PaintProperty<>("<%- property.name %>", function); - } + /** + * <%- propertyFactoryMethodDoc(property) %> + * + * @param value a <%- propertyType(property) %> value + * @return property wrapper around <%- propertyType(property) %> + */ + public static PropertyValue<<%- propertyType(property) %>> <%- camelizeWithLeadingLowercase(property.name) %>(<%- propertyTypeAnnotation(property) %><%- iff(() => propertyTypeAnnotation(property), " ") %><%- propertyType(property) %> value) { + return new PaintPropertyValue<>("<%- 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 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 + */ + 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) { -%> - /** - * <%- propertyFactoryMethodDoc(property) %> - * - * @param value a <%- propertyType(property) %> value - * @return property wrapper around <%- propertyType(property) %> - */ - public static Property<<%- propertyType(property) %>> <%- camelizeWithLeadingLowercase(property.name) %>(<%- propertyTypeAnnotation(property) %><%- iff(() => propertyTypeAnnotation(property), " ") %><%- propertyType(property) %> value) { - return new LayoutProperty<>("<%- property.name %>", value); - } - - /** - * <%- propertyFactoryMethodDoc(property) %> - * - * @param function a wrapper function for <%- propertyType(property) %> - * @return property wrapper around a <%- propertyType(property) %> function - */ - public static Property<Function<<%- propertyType(property) %>>> <%- camelizeWithLeadingLowercase(property.name) %>(Function<<%- propertyType(property) %>> function) { - return new LayoutProperty<>("<%- property.name %>", function); - } + /** + * <%- propertyFactoryMethodDoc(property) %> + * + * @param value a <%- propertyType(property) %> value + * @return property wrapper around <%- propertyType(property) %> + */ + public static PropertyValue<<%- propertyType(property) %>> <%- camelizeWithLeadingLowercase(property.name) %>(<%- propertyTypeAnnotation(property) %><%- iff(() => propertyTypeAnnotation(property), " ") %><%- propertyType(property) %> value) { + 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); + } + +<% } -%> <% } -%> - @SuppressLint("DefaultLocale") - static String colorToRgbaString(@ColorInt int value) { - return String.format("rgba(%d, %d, %d, %d)", (value >> 16) & 0xFF, (value >> 8) & 0xFF, value & 0xFF, (value >> 24) & 0xFF); - } + @SuppressLint("DefaultLocale") + public static String colorToRgbaString(@ColorInt int value) { + return String.format("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/sources/GeoJsonSource.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/GeoJsonSource.java index 0c2ee42ea0..f9875c7242 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/GeoJsonSource.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/GeoJsonSource.java @@ -160,8 +160,8 @@ public class GeoJsonSource extends Source { } protected void setRawJson(String geoJson) { - //Wrap the String in a map as an Object is expected by the - //style conversion template + // Wrap the String in a map as an Object is expected by the + // style conversion template HashMap<String, String> wrapper = new HashMap<>(); wrapper.put("data", geoJson); nativeSetGeoJson(wrapper); diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/NoSuchSourceException.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/NoSuchSourceException.java deleted file mode 100644 index 06d35b598b..0000000000 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/NoSuchSourceException.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.mapbox.mapboxsdk.style.sources; - -/** - * No such source. - */ -public class NoSuchSourceException extends Exception { - - public NoSuchSourceException(String message) { - super(message); - } -} diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/UnknownSource.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/UnknownSource.java new file mode 100644 index 0000000000..4a97d71f9a --- /dev/null +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/UnknownSource.java @@ -0,0 +1,25 @@ +package com.mapbox.mapboxsdk.style.sources; + +import android.support.annotation.UiThread; + +/** + * An unknown type of source + */ +@UiThread +public class UnknownSource extends Source { + + /** + * Creates a UnknownSource. + * + * @param nativePtr pointer used by core + */ + UnknownSource(long nativePtr) { + super(nativePtr); + } + + protected native void initialize(); + + @Override + protected native void finalize() throws Throwable; + +} |