diff options
Diffstat (limited to 'platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style')
28 files changed, 5207 insertions, 5105 deletions
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 893ffbc1ec..45523b41ab 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,111 +1,108 @@ -// This file is generated. Edit android/platform/scripts/generate-style-code.js, then run `make style-code-android`. package com.mapbox.mapboxsdk.style.layers; - -import com.mapbox.mapboxsdk.exceptions.ConversionException; +// This file is generated. Edit android/platform/scripts/generate-style-code.js, then run `make android-style-code`. 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; /** * The background color or pattern of the map. * * @see <a href="https://www.mapbox.com/mapbox-gl-style-spec/#layers-background">The online documentation</a> */ +@UiThread public class BackgroundLayer extends Layer { - /** - * Creates a BackgroundLayer. - * - * @param nativePtr pointer used by core - */ - public BackgroundLayer(long nativePtr) { - super(nativePtr); + /** + * Creates a BackgroundLayer. + * + * @param nativePtr pointer used by core + */ + public BackgroundLayer(long nativePtr) { + super(nativePtr); + } + + /** + * Creates a BackgroundLayer. + * + * @param layerId the id of the layer + */ + public BackgroundLayer(String layerId) { + initialize(layerId); + } + + protected native void initialize(String layerId); + + /** + * Set a property or properties. + * + * @param properties the var-args properties + * @return This + */ + public BackgroundLayer withProperties(@NonNull Property<?>... properties) { + setProperties(properties); + return this; + } + + // Property getters + + /** + * Get the BackgroundColor property + * + * @return property wrapper value around String + */ + @SuppressWarnings("unchecked") + public PropertyValue<String> getBackgroundColor() { + return (PropertyValue<String>) new PropertyValue(nativeGetBackgroundColor()); + } + + /** + * The color with which the background will be drawn. + * + * @return int representation of a rgba string color + * @throws RuntimeException thrown if property isn't a value + */ + @ColorInt + public int getBackgroundColorAsInt() { + PropertyValue<String> value = getBackgroundColor(); + if (value.isValue()) { + return rgbaToColor(value.getValue()); + } else { + throw new RuntimeException("background-color was set as a Function"); } + } - /** - * Creates a BackgroundLayer. - * - * @param layerId the id of the layer - */ - public BackgroundLayer(String layerId) { - initialize(layerId); - } - protected native void initialize(String layerId); - - /** - * Set a property or properties. - * - * @param properties the var-args properties - * @return This - */ - public BackgroundLayer withProperties(@NonNull Property<?>... properties) { - setProperties(properties); - return this; - } + /** + * Get the BackgroundPattern property + * + * @return property wrapper value around String + */ + @SuppressWarnings("unchecked") + public PropertyValue<String> getBackgroundPattern() { + return (PropertyValue<String>) new PropertyValue(nativeGetBackgroundPattern()); + } - // Property getters - - /** - * Get the BackgroundColor property - * - * @return property wrapper value around String - */ - @SuppressWarnings("unchecked") - public PropertyValue<String> getBackgroundColor() { - checkValidity(); - return (PropertyValue<String>) new PropertyValue(nativeGetBackgroundColor()); - } - /** - * The color with which the background will be drawn. - * - * @return int representation of a rgba string color - * @throws RuntimeException thrown if property isn't a value - */ - @ColorInt - public int getBackgroundColorAsInt() { - checkValidity(); - PropertyValue<String> value = getBackgroundColor(); - if (value.isValue()) { - return rgbaToColor(value.getValue()); - } else { - throw new RuntimeException("background-color was set as a Function"); - } - } + /** + * Get the BackgroundOpacity property + * + * @return property wrapper value around Float + */ + @SuppressWarnings("unchecked") + public PropertyValue<Float> getBackgroundOpacity() { + return (PropertyValue<Float>) new PropertyValue(nativeGetBackgroundOpacity()); + } - - /** - * Get the BackgroundPattern property - * - * @return property wrapper value around String - */ - @SuppressWarnings("unchecked") - public PropertyValue<String> getBackgroundPattern() { - checkValidity(); - return (PropertyValue<String>) new PropertyValue(nativeGetBackgroundPattern()); - } - - /** - * Get the BackgroundOpacity property - * - * @return property wrapper value around Float - */ - @SuppressWarnings("unchecked") - public PropertyValue<Float> getBackgroundOpacity() { - checkValidity(); - return (PropertyValue<Float>) new PropertyValue(nativeGetBackgroundOpacity()); - } - - private native Object nativeGetBackgroundColor(); + private native Object nativeGetBackgroundColor(); - private native Object nativeGetBackgroundPattern(); + private native Object nativeGetBackgroundPattern(); - private native Object nativeGetBackgroundOpacity(); + private native Object nativeGetBackgroundOpacity(); - @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/CannotAddLayerException.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/CannotAddLayerException.java new file mode 100644 index 0000000000..212493032d --- /dev/null +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/CannotAddLayerException.java @@ -0,0 +1,12 @@ +package com.mapbox.mapboxsdk.style.layers; + +/** + * Thrown when adding a layer to a map twice + */ +public class CannotAddLayerException extends RuntimeException { + + public CannotAddLayerException(String message) { + super(message); + } + +} 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 a9f081b2fa..f16ab688d6 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,227 +1,271 @@ -// This file is generated. Edit android/platform/scripts/generate-style-code.js, then run `make style-code-android`. package com.mapbox.mapboxsdk.style.layers; - -import com.mapbox.mapboxsdk.exceptions.ConversionException; +// This file is generated. Edit android/platform/scripts/generate-style-code.js, then run `make android-style-code`. 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; /** * A filled circle. * * @see <a href="https://www.mapbox.com/mapbox-gl-style-spec/#layers-circle">The online documentation</a> */ +@UiThread public class CircleLayer extends Layer { - /** - * Creates a CircleLayer. - * - * @param nativePtr pointer used by core - */ - public CircleLayer(long nativePtr) { - super(nativePtr); - } + /** + * Creates a CircleLayer. + * + * @param nativePtr pointer used by core + */ + public CircleLayer(long nativePtr) { + super(nativePtr); + } - /** - * Creates a CircleLayer. - * - * @param layerId the id of the layer - * @param sourceId the id of the source - */ - public CircleLayer(String layerId, String sourceId) { - initialize(layerId, sourceId); - } + /** + * Creates a CircleLayer. + * + * @param layerId the id of the layer + * @param sourceId the id of the source + */ + public CircleLayer(String layerId, String sourceId) { + initialize(layerId, sourceId); + } - protected native void initialize(String layerId, String 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) { - checkValidity(); - nativeSetSourceLayer(sourceLayer); - } + /** + * 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 CircleLayer withSourceLayer(String sourceLayer) { - setSourceLayer(sourceLayer); - return this; - } - /** - * Set a single filter. - * - * @param filter the filter to set - */ - public void setFilter(Filter.Statement filter) { - checkValidity(); - this.setFilter(filter.toArray()); - } + /** + * Set the source Layer. + * + * @param sourceLayer the source layer to set + * @return This + */ + public CircleLayer withSourceLayer(String sourceLayer) { + setSourceLayer(sourceLayer); + return this; + } - /** - * Set an array of filters. - * - * @param filter the filter array to set - */ - public void setFilter(Object[] filter) { - checkValidity(); - nativeSetFilter(filter); - } + /** + * 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 tthe filter array to set - * @return This - */ - public CircleLayer withFilter(Object[] filter) { - setFilter(filter); - return this; - } + /** + * Set an array of filters. + * + * @param filter the filter array to set + */ + public void setFilter(Object[] filter) { + nativeSetFilter(filter); + } - /** - * Set a single filter. - * - * @param filter the filter to set - * @return This - */ - public CircleLayer withFilter(Filter.Statement filter) { - setFilter(filter); - return this; - } + /** + * Set an array of filters. + * + * @param filter tthe filter array to set + * @return This + */ + public CircleLayer withFilter(Object[] filter) { + setFilter(filter); + return this; + } + /** + * Set a single filter. + * + * @param filter the filter to set + * @return This + */ + public CircleLayer withFilter(Filter.Statement filter) { + setFilter(filter); + return this; + } - /** - * Set a property or properties. - * - * @param properties the var-args properties - * @return This - */ - public CircleLayer withProperties(@NonNull Property<?>... properties) { - setProperties(properties); - return this; - } - // Property getters - - /** - * Get the CircleRadius property - * - * @return property wrapper value around Float - */ - @SuppressWarnings("unchecked") - public PropertyValue<Float> getCircleRadius() { - checkValidity(); - return (PropertyValue<Float>) new PropertyValue(nativeGetCircleRadius()); - } - - /** - * Get the CircleColor property - * - * @return property wrapper value around String - */ - @SuppressWarnings("unchecked") - public PropertyValue<String> getCircleColor() { - checkValidity(); - return (PropertyValue<String>) new PropertyValue(nativeGetCircleColor()); - } - /** - * The fill color of the circle. - * - * @return int representation of a rgba string color - * @throws RuntimeException thrown if property isn't a value - */ - @ColorInt - public int getCircleColorAsInt() { - checkValidity(); - PropertyValue<String> value = getCircleColor(); - if (value.isValue()) { - return rgbaToColor(value.getValue()); - } else { - throw new RuntimeException("circle-color was set as a Function"); - } - } + /** + * Set a property or properties. + * + * @param properties the var-args properties + * @return This + */ + public CircleLayer withProperties(@NonNull Property<?>... properties) { + setProperties(properties); + return this; + } - - /** - * Get the CircleBlur property - * - * @return property wrapper value around Float - */ - @SuppressWarnings("unchecked") - public PropertyValue<Float> getCircleBlur() { - checkValidity(); - return (PropertyValue<Float>) new PropertyValue(nativeGetCircleBlur()); - } - - /** - * Get the CircleOpacity property - * - * @return property wrapper value around Float - */ - @SuppressWarnings("unchecked") - public PropertyValue<Float> getCircleOpacity() { - checkValidity(); - return (PropertyValue<Float>) new PropertyValue(nativeGetCircleOpacity()); - } - - /** - * Get the CircleTranslate property - * - * @return property wrapper value around Float[] - */ - @SuppressWarnings("unchecked") - public PropertyValue<Float[]> getCircleTranslate() { - checkValidity(); - return (PropertyValue<Float[]>) new PropertyValue(nativeGetCircleTranslate()); - } - - /** - * Get the CircleTranslateAnchor property - * - * @return property wrapper value around String - */ - @SuppressWarnings("unchecked") - public PropertyValue<String> getCircleTranslateAnchor() { - checkValidity(); - return (PropertyValue<String>) new PropertyValue(nativeGetCircleTranslateAnchor()); + // Property getters + + /** + * Get the CircleRadius property + * + * @return property wrapper value around Float + */ + @SuppressWarnings("unchecked") + public PropertyValue<Float> getCircleRadius() { + return (PropertyValue<Float>) new PropertyValue(nativeGetCircleRadius()); + } + + /** + * Get the CircleColor property + * + * @return property wrapper value around String + */ + @SuppressWarnings("unchecked") + public PropertyValue<String> getCircleColor() { + return (PropertyValue<String>) new PropertyValue(nativeGetCircleColor()); + } + + /** + * The fill color of the circle. + * + * @return int representation of a rgba string color + * @throws RuntimeException thrown if property isn't a value + */ + @ColorInt + public int getCircleColorAsInt() { + PropertyValue<String> value = getCircleColor(); + if (value.isValue()) { + return rgbaToColor(value.getValue()); + } else { + throw new RuntimeException("circle-color was set as a Function"); } - - /** - * Get the CirclePitchScale property - * - * @return property wrapper value around String - */ - @SuppressWarnings("unchecked") - public PropertyValue<String> getCirclePitchScale() { - checkValidity(); - return (PropertyValue<String>) new PropertyValue(nativeGetCirclePitchScale()); + } + + + /** + * Get the CircleBlur property + * + * @return property wrapper value around Float + */ + @SuppressWarnings("unchecked") + public PropertyValue<Float> getCircleBlur() { + return (PropertyValue<Float>) new PropertyValue(nativeGetCircleBlur()); + } + + /** + * Get the CircleOpacity property + * + * @return property wrapper value around Float + */ + @SuppressWarnings("unchecked") + public PropertyValue<Float> getCircleOpacity() { + return (PropertyValue<Float>) new PropertyValue(nativeGetCircleOpacity()); + } + + /** + * Get the CircleTranslate property + * + * @return property wrapper value around Float[] + */ + @SuppressWarnings("unchecked") + public PropertyValue<Float[]> getCircleTranslate() { + return (PropertyValue<Float[]>) new PropertyValue(nativeGetCircleTranslate()); + } + + /** + * Get the CircleTranslateAnchor property + * + * @return property wrapper value around String + */ + @SuppressWarnings("unchecked") + public PropertyValue<String> getCircleTranslateAnchor() { + return (PropertyValue<String>) new PropertyValue(nativeGetCircleTranslateAnchor()); + } + + /** + * Get the CirclePitchScale property + * + * @return property wrapper value around String + */ + @SuppressWarnings("unchecked") + public PropertyValue<String> getCirclePitchScale() { + return (PropertyValue<String>) new PropertyValue(nativeGetCirclePitchScale()); + } + + /** + * Get the CircleStrokeWidth property + * + * @return property wrapper value around Float + */ + @SuppressWarnings("unchecked") + public PropertyValue<Float> getCircleStrokeWidth() { + return (PropertyValue<Float>) new PropertyValue(nativeGetCircleStrokeWidth()); + } + + /** + * Get the CircleStrokeColor property + * + * @return property wrapper value around String + */ + @SuppressWarnings("unchecked") + public PropertyValue<String> getCircleStrokeColor() { + return (PropertyValue<String>) new PropertyValue(nativeGetCircleStrokeColor()); + } + + /** + * The stroke color of the circle. + * + * @return int representation of a rgba string color + * @throws RuntimeException thrown if property isn't a value + */ + @ColorInt + public int getCircleStrokeColorAsInt() { + PropertyValue<String> value = getCircleStrokeColor(); + if (value.isValue()) { + return rgbaToColor(value.getValue()); + } else { + throw new RuntimeException("circle-stroke-color was set as a Function"); } - - private native Object nativeGetCircleRadius(); + } + + + /** + * Get the CircleStrokeOpacity property + * + * @return property wrapper value around Float + */ + @SuppressWarnings("unchecked") + public PropertyValue<Float> getCircleStrokeOpacity() { + return (PropertyValue<Float>) new PropertyValue(nativeGetCircleStrokeOpacity()); + } + + private native Object nativeGetCircleRadius(); + + private native Object nativeGetCircleColor(); + + private native Object nativeGetCircleBlur(); + + private native Object nativeGetCircleOpacity(); - private native Object nativeGetCircleColor(); + private native Object nativeGetCircleTranslate(); - private native Object nativeGetCircleBlur(); + private native Object nativeGetCircleTranslateAnchor(); - private native Object nativeGetCircleOpacity(); + private native Object nativeGetCirclePitchScale(); - private native Object nativeGetCircleTranslate(); + private native Object nativeGetCircleStrokeWidth(); - private native Object nativeGetCircleTranslateAnchor(); + private native Object nativeGetCircleStrokeColor(); - private native Object nativeGetCirclePitchScale(); + private native Object nativeGetCircleStrokeOpacity(); - @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/CustomLayer.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/CustomLayer.java index 4d578b54f8..7807556b78 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/CustomLayer.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/CustomLayer.java @@ -8,27 +8,28 @@ package com.mapbox.mapboxsdk.style.layers; */ public class CustomLayer extends Layer { - public CustomLayer(String id, - long context, - long initializeFunction, - long renderFunction, - long deinitializeFunction) { - initialize(id, initializeFunction, renderFunction, deinitializeFunction, context); - } + public CustomLayer(String id, + long context, + long initializeFunction, + long renderFunction, + long deinitializeFunction) { + initialize(id, initializeFunction, renderFunction, deinitializeFunction, context); + } - public CustomLayer(long nativePtr) { - super(nativePtr); - } + public CustomLayer(long nativePtr) { + super(nativePtr); + } - public void update() { - nativeUpdate(); - } + public void update() { + nativeUpdate(); + } - protected native void initialize(String id, long initializeFunction, long renderFunction, long deinitializeFunction, long context); + protected native void initialize(String id, long initializeFunction, long renderFunction, long deinitializeFunction, + long context); - protected native void nativeUpdate(); + protected native void nativeUpdate(); - @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/FillLayer.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/FillLayer.java index e19dc20283..3f79c9306a 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,244 +1,236 @@ -// This file is generated. Edit android/platform/scripts/generate-style-code.js, then run `make style-code-android`. package com.mapbox.mapboxsdk.style.layers; - -import com.mapbox.mapboxsdk.exceptions.ConversionException; +// This file is generated. Edit android/platform/scripts/generate-style-code.js, then run `make android-style-code`. 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; /** * A filled polygon with an optional stroked border. * * @see <a href="https://www.mapbox.com/mapbox-gl-style-spec/#layers-fill">The online documentation</a> */ +@UiThread public class FillLayer extends Layer { - /** - * Creates a FillLayer. - * - * @param nativePtr pointer used by core - */ - public FillLayer(long nativePtr) { - super(nativePtr); - } - - /** - * Creates a FillLayer. - * - * @param layerId the id of the layer - * @param sourceId the id of the source - */ - public FillLayer(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) { - checkValidity(); - nativeSetSourceLayer(sourceLayer); - } - - /** - * Set the source Layer. - * - * @param sourceLayer the source layer to set - * @return This - */ - public FillLayer withSourceLayer(String sourceLayer) { - setSourceLayer(sourceLayer); - return this; - } - /** - * Set a single filter. - * - * @param filter the filter to set - */ - public void setFilter(Filter.Statement filter) { - checkValidity(); - this.setFilter(filter.toArray()); - } - - /** - * Set an array of filters. - * - * @param filter the filter array to set - */ - public void setFilter(Object[] filter) { - checkValidity(); - 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; - } - - /** - * Set a single filter. - * - * @param filter the filter to set - * @return This - */ - public FillLayer withFilter(Filter.Statement filter) { - setFilter(filter); - return this; - } - - - /** - * Set a property or properties. - * - * @param properties the var-args properties - * @return This - */ - public FillLayer withProperties(@NonNull Property<?>... properties) { - setProperties(properties); - return this; - } - - // Property getters - - /** - * Get the FillAntialias property - * - * @return property wrapper value around Boolean - */ - @SuppressWarnings("unchecked") - public PropertyValue<Boolean> getFillAntialias() { - checkValidity(); - return (PropertyValue<Boolean>) new PropertyValue(nativeGetFillAntialias()); - } - - /** - * Get the FillOpacity property - * - * @return property wrapper value around Float - */ - @SuppressWarnings("unchecked") - public PropertyValue<Float> getFillOpacity() { - checkValidity(); - return (PropertyValue<Float>) new PropertyValue(nativeGetFillOpacity()); - } - - /** - * Get the FillColor property - * - * @return property wrapper value around String - */ - @SuppressWarnings("unchecked") - public PropertyValue<String> getFillColor() { - checkValidity(); - return (PropertyValue<String>) new PropertyValue(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. - * - * @return int representation of a rgba string color - * @throws RuntimeException thrown if property isn't a value - */ - @ColorInt - public int getFillColorAsInt() { - checkValidity(); - PropertyValue<String> value = getFillColor(); - if (value.isValue()) { - return rgbaToColor(value.getValue()); - } else { - throw new RuntimeException("fill-color was set as a Function"); - } - } - - - /** - * Get the FillOutlineColor property - * - * @return property wrapper value around String - */ - @SuppressWarnings("unchecked") - public PropertyValue<String> getFillOutlineColor() { - checkValidity(); - return (PropertyValue<String>) new PropertyValue(nativeGetFillOutlineColor()); - } - /** - * The outline color of the fill. Matches the value of `fill-color` if unspecified. - * - * @return int representation of a rgba string color - * @throws RuntimeException thrown if property isn't a value - */ - @ColorInt - public int getFillOutlineColorAsInt() { - checkValidity(); - PropertyValue<String> value = getFillOutlineColor(); - if (value.isValue()) { - return rgbaToColor(value.getValue()); - } else { - throw new RuntimeException("fill-outline-color was set as a Function"); - } - } - - - /** - * Get the FillTranslate property - * - * @return property wrapper value around Float[] - */ - @SuppressWarnings("unchecked") - public PropertyValue<Float[]> getFillTranslate() { - checkValidity(); - return (PropertyValue<Float[]>) new PropertyValue(nativeGetFillTranslate()); - } - - /** - * Get the FillTranslateAnchor property - * - * @return property wrapper value around String - */ - @SuppressWarnings("unchecked") - public PropertyValue<String> getFillTranslateAnchor() { - checkValidity(); - return (PropertyValue<String>) new PropertyValue(nativeGetFillTranslateAnchor()); - } - - /** - * Get the FillPattern property - * - * @return property wrapper value around String - */ - @SuppressWarnings("unchecked") - public PropertyValue<String> getFillPattern() { - checkValidity(); - return (PropertyValue<String>) new PropertyValue(nativeGetFillPattern()); - } - - private native Object nativeGetFillAntialias(); - - private native Object nativeGetFillOpacity(); - - private native Object nativeGetFillColor(); - - private native Object nativeGetFillOutlineColor(); - - private native Object nativeGetFillTranslate(); - - private native Object nativeGetFillTranslateAnchor(); - - private native Object nativeGetFillPattern(); - - - @Override - protected native void finalize() throws Throwable; + /** + * Creates a FillLayer. + * + * @param nativePtr pointer used by core + */ + public FillLayer(long nativePtr) { + super(nativePtr); + } + + /** + * Creates a FillLayer. + * + * @param layerId the id of the layer + * @param sourceId the id of the source + */ + public FillLayer(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 FillLayer withSourceLayer(String sourceLayer) { + setSourceLayer(sourceLayer); + return this; + } + + /** + * 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 FillLayer withFilter(Object[] filter) { + setFilter(filter); + return this; + } + + /** + * Set a single filter. + * + * @param filter the filter to set + * @return This + */ + public FillLayer withFilter(Filter.Statement filter) { + setFilter(filter); + return this; + } + + + /** + * Set a property or properties. + * + * @param properties the var-args properties + * @return This + */ + public FillLayer withProperties(@NonNull Property<?>... properties) { + setProperties(properties); + return this; + } + + // Property getters + + /** + * Get the FillAntialias property + * + * @return property wrapper value around Boolean + */ + @SuppressWarnings("unchecked") + public PropertyValue<Boolean> getFillAntialias() { + return (PropertyValue<Boolean>) new PropertyValue(nativeGetFillAntialias()); + } + + /** + * Get the FillOpacity property + * + * @return property wrapper value around Float + */ + @SuppressWarnings("unchecked") + public PropertyValue<Float> getFillOpacity() { + return (PropertyValue<Float>) new PropertyValue(nativeGetFillOpacity()); + } + + /** + * Get the FillColor property + * + * @return property wrapper value around String + */ + @SuppressWarnings("unchecked") + public PropertyValue<String> getFillColor() { + return (PropertyValue<String>) new PropertyValue(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. + * + * @return int representation of a rgba string color + * @throws RuntimeException thrown if property isn't a value + */ + @ColorInt + public int getFillColorAsInt() { + PropertyValue<String> value = getFillColor(); + if (value.isValue()) { + return rgbaToColor(value.getValue()); + } else { + throw new RuntimeException("fill-color was set as a Function"); + } + } + + + /** + * Get the FillOutlineColor property + * + * @return property wrapper value around String + */ + @SuppressWarnings("unchecked") + public PropertyValue<String> getFillOutlineColor() { + return (PropertyValue<String>) new PropertyValue(nativeGetFillOutlineColor()); + } + + /** + * The outline color of the fill. Matches the value of `fill-color` if unspecified. + * + * @return int representation of a rgba string color + * @throws RuntimeException thrown if property isn't a value + */ + @ColorInt + public int getFillOutlineColorAsInt() { + PropertyValue<String> value = getFillOutlineColor(); + if (value.isValue()) { + return rgbaToColor(value.getValue()); + } else { + throw new RuntimeException("fill-outline-color was set as a Function"); + } + } + + + /** + * Get the FillTranslate property + * + * @return property wrapper value around Float[] + */ + @SuppressWarnings("unchecked") + public PropertyValue<Float[]> getFillTranslate() { + return (PropertyValue<Float[]>) new PropertyValue(nativeGetFillTranslate()); + } + + /** + * Get the FillTranslateAnchor property + * + * @return property wrapper value around String + */ + @SuppressWarnings("unchecked") + public PropertyValue<String> getFillTranslateAnchor() { + return (PropertyValue<String>) new PropertyValue(nativeGetFillTranslateAnchor()); + } + + /** + * Get the FillPattern property + * + * @return property wrapper value around String + */ + @SuppressWarnings("unchecked") + public PropertyValue<String> getFillPattern() { + return (PropertyValue<String>) new PropertyValue(nativeGetFillPattern()); + } + + private native Object nativeGetFillAntialias(); + + private native Object nativeGetFillOpacity(); + + private native Object nativeGetFillColor(); + + private native Object nativeGetFillOutlineColor(); + + private native Object nativeGetFillTranslate(); + + private native Object nativeGetFillTranslateAnchor(); + + private native Object nativeGetFillPattern(); + + + @Override + protected native void finalize() throws Throwable; } diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/Filter.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/Filter.java index 6f881e4960..643a126388 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/Filter.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/Filter.java @@ -10,221 +10,221 @@ import java.util.Collections; */ public class Filter { - /** - * Base {@link Filter} statement. Subclassed to provide concrete statements. - */ - public abstract static class Statement { - protected final String operator; - - public Statement(String operator) { - this.operator = operator; - } - - /** - * Generate a raw array representation of the filter - * - * @return the filter represented as an array - */ - public abstract Object[] toArray(); - } - - /** - * Represents a {@link Filter} statement. Can be unary (eg `has()`, etc) or take any number of values. - */ - private static class SimpleStatement extends Statement { - private final String key; - private final Object[] values; - - /** - * @param operator the operator (eg `=`, etc) - * @param key the property key - * @param values the values to operate on, if any - */ - SimpleStatement(String operator, String key, Object... values) { - super(operator); - this.key = key; - this.values = values; - } - - - /** - * {@inheritDoc} - */ - @Override - public Object[] toArray() { - ArrayList<Object> array = new ArrayList<>(2 + values.length); - array.add(operator); - array.add(key); - Collections.addAll(array, values); - return array.toArray(); - } - } - - /** - * Represents a collection of {@link Statement}s with an operator that describes their relationship - */ - private static class CompoundStatement extends Statement { - private final Statement[] statements; - - /** - * @param operator the relationship operator - * @param statements the statements to compound - */ - CompoundStatement(String operator, Statement... statements) { - super(operator); - this.statements = statements; - } - - /** - * {@inheritDoc} - */ - @Override - public Object[] toArray() { - ArrayList<Object> array = new ArrayList<>(1 + statements.length); - array.add(operator); - for (Statement statement : statements) { - array.add(statement.toArray()); - } - return array.toArray(); - } - } - - /** - * Groups a collection of statements in an 'all' relationship - * - * @param statements the collection of statements - * @return the statements compounded - */ - public static Statement all(Statement... statements) { - return new CompoundStatement("all", statements); - } - - /** - * Groups a collection of statements in an 'any' relationship - * - * @param statements the collection of statements - * @return the statements compounded - */ - public static Statement any(Statement... statements) { - return new CompoundStatement("any", statements); - } - - /** - * Groups a collection of statements in an 'none' relationship - * - * @param statements the collection of statements - * @return the statements compounded - */ - public static Statement none(Statement... statements) { - return new CompoundStatement("none", statements); - } - - /** - * Check the property's existence - * - * @param key the property key - * @return the statement - */ - public static Statement has(String key) { - return new SimpleStatement("has", key); - } + /** + * Base {@link Filter} statement. Subclassed to provide concrete statements. + */ + public abstract static class Statement { + protected final String operator; - /** - * Check the property's existence, negated - * - * @param key the property key - * @return the statement - */ - public static Statement notHas(String key) { - return new SimpleStatement("!has", key); + public Statement(String operator) { + this.operator = operator; } /** - * Check the property equals the given value + * Generate a raw array representation of the filter * - * @param key the property key - * @param value the value to check against - * @return the statement - */ - public static Statement eq(String key, Object value) { - return new SimpleStatement("==", key, value); - } - - /** - * Check the property does not equals the given value - * - * @param key the property key - * @param value the value to check against - * @return the statement - */ - public static Statement neq(String key, Object value) { - return new SimpleStatement("!=", key, value); - } - - /** - * Check the property exceeds the given value - * - * @param key the property key - * @param value the value to check against - * @return the statement - */ - public static Statement gt(String key, Object value) { - return new SimpleStatement(">", key, value); - } - - /** - * Check the property exceeds or equals the given value - * - * @param key the property key - * @param value the value to check against - * @return the statement - */ - public static Statement gte(String key, Object value) { - return new SimpleStatement(">=", key, value); - } - - /** - * Check the property does not exceeds the given value - * - * @param key the property key - * @param value the value to check against - * @return the statement - */ - public static Statement lt(String key, Object value) { - return new SimpleStatement("<", key, value); - } - - /** - * Check the property equals or does not exceeds the given value - * - * @param key the property key - * @param value the value to check against - * @return the statement - */ - public static Statement lte(String key, Object value) { - return new SimpleStatement("<=", key, value); - } - - /** - * Check the property is within the given set - * - * @param key the property key - * @param values the set of values to check against - * @return the statement - */ - public static Statement in(String key, Object... values) { - return new SimpleStatement("in", key, values); - } - - /** - * Check the property is not within the given set - * - * @param key the property key - * @param values the set of values to check against - * @return the statement - */ - public static Statement notIn(String key, Object... values) { - return new SimpleStatement("!in", key, values); - } + * @return the filter represented as an array + */ + public abstract Object[] toArray(); + } + + /** + * Represents a {@link Filter} statement. Can be unary (eg `has()`, etc) or take any number of values. + */ + private static class SimpleStatement extends Statement { + private final String key; + private final Object[] values; + + /** + * @param operator the operator (eg `=`, etc) + * @param key the property key + * @param values the values to operate on, if any + */ + SimpleStatement(String operator, String key, Object... values) { + super(operator); + this.key = key; + this.values = values; + } + + + /** + * {@inheritDoc} + */ + @Override + public Object[] toArray() { + ArrayList<Object> array = new ArrayList<>(2 + values.length); + array.add(operator); + array.add(key); + Collections.addAll(array, values); + return array.toArray(); + } + } + + /** + * Represents a collection of {@link Statement}s with an operator that describes their relationship + */ + private static class CompoundStatement extends Statement { + private final Statement[] statements; + + /** + * @param operator the relationship operator + * @param statements the statements to compound + */ + CompoundStatement(String operator, Statement... statements) { + super(operator); + this.statements = statements; + } + + /** + * {@inheritDoc} + */ + @Override + public Object[] toArray() { + ArrayList<Object> array = new ArrayList<>(1 + statements.length); + array.add(operator); + for (Statement statement : statements) { + array.add(statement.toArray()); + } + return array.toArray(); + } + } + + /** + * Groups a collection of statements in an 'all' relationship + * + * @param statements the collection of statements + * @return the statements compounded + */ + public static Statement all(Statement... statements) { + return new CompoundStatement("all", statements); + } + + /** + * Groups a collection of statements in an 'any' relationship + * + * @param statements the collection of statements + * @return the statements compounded + */ + public static Statement any(Statement... statements) { + return new CompoundStatement("any", statements); + } + + /** + * Groups a collection of statements in an 'none' relationship + * + * @param statements the collection of statements + * @return the statements compounded + */ + public static Statement none(Statement... statements) { + return new CompoundStatement("none", statements); + } + + /** + * Check the property's existence + * + * @param key the property key + * @return the statement + */ + public static Statement has(String key) { + return new SimpleStatement("has", key); + } + + /** + * Check the property's existence, negated + * + * @param key the property key + * @return the statement + */ + public static Statement notHas(String key) { + return new SimpleStatement("!has", key); + } + + /** + * Check the property equals the given value + * + * @param key the property key + * @param value the value to check against + * @return the statement + */ + public static Statement eq(String key, Object value) { + return new SimpleStatement("==", key, value); + } + + /** + * Check the property does not equals the given value + * + * @param key the property key + * @param value the value to check against + * @return the statement + */ + public static Statement neq(String key, Object value) { + return new SimpleStatement("!=", key, value); + } + + /** + * Check the property exceeds the given value + * + * @param key the property key + * @param value the value to check against + * @return the statement + */ + public static Statement gt(String key, Object value) { + return new SimpleStatement(">", key, value); + } + + /** + * Check the property exceeds or equals the given value + * + * @param key the property key + * @param value the value to check against + * @return the statement + */ + public static Statement gte(String key, Object value) { + return new SimpleStatement(">=", key, value); + } + + /** + * Check the property does not exceeds the given value + * + * @param key the property key + * @param value the value to check against + * @return the statement + */ + public static Statement lt(String key, Object value) { + return new SimpleStatement("<", key, value); + } + + /** + * Check the property equals or does not exceeds the given value + * + * @param key the property key + * @param value the value to check against + * @return the statement + */ + public static Statement lte(String key, Object value) { + return new SimpleStatement("<=", key, value); + } + + /** + * Check the property is within the given set + * + * @param key the property key + * @param values the set of values to check against + * @return the statement + */ + public static Statement in(String key, Object... values) { + return new SimpleStatement("in", key, values); + } + + /** + * Check the property is not within the given set + * + * @param key the property key + * @param values the set of values to check against + * @return the statement + */ + public static Statement notIn(String key, Object... values) { + return new SimpleStatement("!in", key, values); + } } 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 index e147b5204f..900fe10476 100644 --- 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 @@ -19,119 +19,119 @@ import java.util.Map; */ 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); + /** + * 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; } - /** - * 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} + * @return an array representation of the Stop */ - @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); + Object[] toValueObject() { + return new Object[] {in, out}; } - /** - * 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); + @Override + public String toString() { + return String.format("[%s, %s]", in, out); } - - private final Stop<Float, T>[] stops; - private Float base; - - Function(@NonNull @Size(min = 1) Stop<Float, T>[] stops) { - this.stops = 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 <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(); } - 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; + 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 54d18962ce..2878d76430 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 @@ -7,101 +7,83 @@ import android.support.annotation.NonNull; */ public abstract class Layer { - private long nativePtr; - private boolean invalidated; + private long nativePtr; + private boolean invalidated; - public Layer(long nativePtr) { - this.nativePtr = nativePtr; - } - - public Layer() { - } + public Layer(long nativePtr) { + this.nativePtr = nativePtr; + } - public void setProperties(@NonNull Property<?>... properties) { - checkValidity(); - - if (properties.length == 0) { - return; - } - - for (Property<?> property : properties) { - Object converted = convertValue(property.value); - if (property instanceof PaintProperty) { - nativeSetPaintProperty(property.name, converted); - } else { - nativeSetLayoutProperty(property.name, converted); - } - } - } + public Layer() { + } - public String getId() { - checkValidity(); - return nativeGetId(); + public void setProperties(@NonNull Property<?>... properties) { + if (properties.length == 0) { + return; } - public PropertyValue<String> getVisibility() { - checkValidity(); - return new PropertyValue<>(nativeGetVisibility()); + for (Property<?> property : properties) { + Object converted = convertValue(property.value); + if (property instanceof PaintProperty) { + nativeSetPaintProperty(property.name, converted); + } else { + nativeSetLayoutProperty(property.name, converted); + } } + } - public float getMinZoom() { - checkValidity(); - return nativeGetMinZoom(); - } + public String getId() { + return nativeGetId(); + } - public float getMaxZoom() { - checkValidity(); - return nativeGetMaxZoom(); - } + public PropertyValue<String> getVisibility() { + return new PropertyValue<>(nativeGetVisibility()); + } - public void setMinZoom(float zoom) { - checkValidity(); - nativeSetMinZoom(zoom); - } + public float getMinZoom() { + return nativeGetMinZoom(); + } - public void setMaxZoom(float zoom) { - checkValidity(); - nativeSetMaxZoom(zoom); - } + public float getMaxZoom() { + return nativeGetMaxZoom(); + } - @Override - protected native void finalize() throws Throwable; + public void setMinZoom(float zoom) { + nativeSetMinZoom(zoom); + } - protected native String nativeGetId(); + public void setMaxZoom(float zoom) { + nativeSetMaxZoom(zoom); + } - protected native Object nativeGetVisibility(); + @Override + protected native void finalize() throws Throwable; - protected native void nativeSetLayoutProperty(String name, Object value); + protected native String nativeGetId(); - protected native void nativeSetPaintProperty(String name, Object value); + protected native Object nativeGetVisibility(); - protected native void nativeSetFilter(Object[] filter); + protected native void nativeSetLayoutProperty(String name, Object value); - protected native void nativeSetSourceLayer(String sourceLayer); + protected native void nativeSetPaintProperty(String name, Object value); - protected native float nativeGetMinZoom(); + protected native void nativeSetFilter(Object[] filter); - protected native float nativeGetMaxZoom(); + protected native void nativeSetSourceLayer(String sourceLayer); - protected native void nativeSetMinZoom(float zoom); + protected native float nativeGetMinZoom(); - protected native void nativeSetMaxZoom(float zoom); + protected native float nativeGetMaxZoom(); - public long getNativePtr() { - return nativePtr; - } + protected native void nativeSetMinZoom(float zoom); - private Object convertValue(Object value) { - return value != null && value instanceof Function ? ((Function) value).toValueObject() : value; - } + protected native void nativeSetMaxZoom(float zoom); - protected void checkValidity() { - if (invalidated) { - throw new RuntimeException("Layer has been invalidated. Request a new reference after adding"); - } - } + public long getNativePtr() { + return nativePtr; + } - public final void invalidate() { - this.invalidated = true; - } + private Object convertValue(Object value) { + return value != null && value instanceof Function ? ((Function) value).toValueObject() : value; + } } 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 index 553554270e..4c0b52be55 100644 --- 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 @@ -2,8 +2,8 @@ package com.mapbox.mapboxsdk.style.layers; class LayoutProperty<T> extends Property<T> { - LayoutProperty(String name, T value) { - super(name, value); - } + LayoutProperty(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 896558a011..4c52a40b05 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,318 +1,302 @@ -// This file is generated. Edit android/platform/scripts/generate-style-code.js, then run `make style-code-android`. package com.mapbox.mapboxsdk.style.layers; - -import com.mapbox.mapboxsdk.exceptions.ConversionException; +// This file is generated. Edit android/platform/scripts/generate-style-code.js, then run `make android-style-code`. 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; /** * A stroked line. * * @see <a href="https://www.mapbox.com/mapbox-gl-style-spec/#layers-line">The online documentation</a> */ +@UiThread public class LineLayer extends Layer { - /** - * Creates a LineLayer. - * - * @param nativePtr pointer used by core - */ - public LineLayer(long nativePtr) { - super(nativePtr); - } - - /** - * Creates a LineLayer. - * - * @param layerId the id of the layer - * @param sourceId the id of the source - */ - public LineLayer(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) { - checkValidity(); - nativeSetSourceLayer(sourceLayer); - } - - /** - * Set the source Layer. - * - * @param sourceLayer the source layer to set - * @return This - */ - public LineLayer withSourceLayer(String sourceLayer) { - setSourceLayer(sourceLayer); - return this; - } - /** - * Set a single filter. - * - * @param filter the filter to set - */ - public void setFilter(Filter.Statement filter) { - checkValidity(); - this.setFilter(filter.toArray()); - } - - /** - * Set an array of filters. - * - * @param filter the filter array to set - */ - public void setFilter(Object[] filter) { - checkValidity(); - 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; - } - - /** - * Set a single filter. - * - * @param filter the filter to set - * @return This - */ - public LineLayer withFilter(Filter.Statement filter) { - setFilter(filter); - return this; - } - - - /** - * Set a property or properties. - * - * @param properties the var-args properties - * @return This - */ - public LineLayer withProperties(@NonNull Property<?>... properties) { - setProperties(properties); - return this; - } - - // Property getters - - /** - * Get the LineCap property - * - * @return property wrapper value around String - */ - @SuppressWarnings("unchecked") - public PropertyValue<String> getLineCap() { - checkValidity(); - return (PropertyValue<String>) new PropertyValue(nativeGetLineCap()); - } - - /** - * Get the LineJoin property - * - * @return property wrapper value around String - */ - @SuppressWarnings("unchecked") - public PropertyValue<String> getLineJoin() { - checkValidity(); - return (PropertyValue<String>) new PropertyValue(nativeGetLineJoin()); - } - - /** - * Get the LineMiterLimit property - * - * @return property wrapper value around Float - */ - @SuppressWarnings("unchecked") - public PropertyValue<Float> getLineMiterLimit() { - checkValidity(); - return (PropertyValue<Float>) new PropertyValue(nativeGetLineMiterLimit()); - } - - /** - * Get the LineRoundLimit property - * - * @return property wrapper value around Float - */ - @SuppressWarnings("unchecked") - public PropertyValue<Float> getLineRoundLimit() { - checkValidity(); - return (PropertyValue<Float>) new PropertyValue(nativeGetLineRoundLimit()); - } - - /** - * Get the LineOpacity property - * - * @return property wrapper value around Float - */ - @SuppressWarnings("unchecked") - public PropertyValue<Float> getLineOpacity() { - checkValidity(); - return (PropertyValue<Float>) new PropertyValue(nativeGetLineOpacity()); - } - - /** - * Get the LineColor property - * - * @return property wrapper value around String - */ - @SuppressWarnings("unchecked") - public PropertyValue<String> getLineColor() { - checkValidity(); - return (PropertyValue<String>) new PropertyValue(nativeGetLineColor()); - } - /** - * The color with which the line will be drawn. - * - * @return int representation of a rgba string color - * @throws RuntimeException thrown if property isn't a value - */ - @ColorInt - public int getLineColorAsInt() { - checkValidity(); - PropertyValue<String> value = getLineColor(); - if (value.isValue()) { - return rgbaToColor(value.getValue()); - } else { - throw new RuntimeException("line-color was set as a Function"); - } - } - - - /** - * Get the LineTranslate property - * - * @return property wrapper value around Float[] - */ - @SuppressWarnings("unchecked") - public PropertyValue<Float[]> getLineTranslate() { - checkValidity(); - return (PropertyValue<Float[]>) new PropertyValue(nativeGetLineTranslate()); - } - - /** - * Get the LineTranslateAnchor property - * - * @return property wrapper value around String - */ - @SuppressWarnings("unchecked") - public PropertyValue<String> getLineTranslateAnchor() { - checkValidity(); - return (PropertyValue<String>) new PropertyValue(nativeGetLineTranslateAnchor()); - } - - /** - * Get the LineWidth property - * - * @return property wrapper value around Float - */ - @SuppressWarnings("unchecked") - public PropertyValue<Float> getLineWidth() { - checkValidity(); - return (PropertyValue<Float>) new PropertyValue(nativeGetLineWidth()); - } - - /** - * Get the LineGapWidth property - * - * @return property wrapper value around Float - */ - @SuppressWarnings("unchecked") - public PropertyValue<Float> getLineGapWidth() { - checkValidity(); - return (PropertyValue<Float>) new PropertyValue(nativeGetLineGapWidth()); - } - - /** - * Get the LineOffset property - * - * @return property wrapper value around Float - */ - @SuppressWarnings("unchecked") - public PropertyValue<Float> getLineOffset() { - checkValidity(); - return (PropertyValue<Float>) new PropertyValue(nativeGetLineOffset()); + /** + * Creates a LineLayer. + * + * @param nativePtr pointer used by core + */ + public LineLayer(long nativePtr) { + super(nativePtr); + } + + /** + * Creates a LineLayer. + * + * @param layerId the id of the layer + * @param sourceId the id of the source + */ + public LineLayer(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 LineLayer withSourceLayer(String sourceLayer) { + setSourceLayer(sourceLayer); + return this; + } + + /** + * 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 LineLayer withFilter(Object[] filter) { + setFilter(filter); + return this; + } + + /** + * Set a single filter. + * + * @param filter the filter to set + * @return This + */ + public LineLayer withFilter(Filter.Statement filter) { + setFilter(filter); + return this; + } + + + /** + * Set a property or properties. + * + * @param properties the var-args properties + * @return This + */ + public LineLayer withProperties(@NonNull Property<?>... properties) { + setProperties(properties); + return this; + } + + // Property getters + + /** + * Get the LineCap property + * + * @return property wrapper value around String + */ + @SuppressWarnings("unchecked") + public PropertyValue<String> getLineCap() { + return (PropertyValue<String>) new PropertyValue(nativeGetLineCap()); + } + + /** + * Get the LineJoin property + * + * @return property wrapper value around String + */ + @SuppressWarnings("unchecked") + public PropertyValue<String> getLineJoin() { + return (PropertyValue<String>) new PropertyValue(nativeGetLineJoin()); + } + + /** + * Get the LineMiterLimit property + * + * @return property wrapper value around Float + */ + @SuppressWarnings("unchecked") + public PropertyValue<Float> getLineMiterLimit() { + return (PropertyValue<Float>) new PropertyValue(nativeGetLineMiterLimit()); + } + + /** + * Get the LineRoundLimit property + * + * @return property wrapper value around Float + */ + @SuppressWarnings("unchecked") + public PropertyValue<Float> getLineRoundLimit() { + return (PropertyValue<Float>) new PropertyValue(nativeGetLineRoundLimit()); + } + + /** + * Get the LineOpacity property + * + * @return property wrapper value around Float + */ + @SuppressWarnings("unchecked") + public PropertyValue<Float> getLineOpacity() { + return (PropertyValue<Float>) new PropertyValue(nativeGetLineOpacity()); + } + + /** + * Get the LineColor property + * + * @return property wrapper value around String + */ + @SuppressWarnings("unchecked") + public PropertyValue<String> getLineColor() { + return (PropertyValue<String>) new PropertyValue(nativeGetLineColor()); + } + + /** + * The color with which the line will be drawn. + * + * @return int representation of a rgba string color + * @throws RuntimeException thrown if property isn't a value + */ + @ColorInt + public int getLineColorAsInt() { + PropertyValue<String> value = getLineColor(); + if (value.isValue()) { + return rgbaToColor(value.getValue()); + } else { + throw new RuntimeException("line-color was set as a Function"); } - - /** - * Get the LineBlur property - * - * @return property wrapper value around Float - */ - @SuppressWarnings("unchecked") - public PropertyValue<Float> getLineBlur() { - checkValidity(); - return (PropertyValue<Float>) new PropertyValue(nativeGetLineBlur()); - } - - /** - * Get the LineDasharray property - * - * @return property wrapper value around Float[] - */ - @SuppressWarnings("unchecked") - public PropertyValue<Float[]> getLineDasharray() { - checkValidity(); - return (PropertyValue<Float[]>) new PropertyValue(nativeGetLineDasharray()); - } - - /** - * Get the LinePattern property - * - * @return property wrapper value around String - */ - @SuppressWarnings("unchecked") - public PropertyValue<String> getLinePattern() { - checkValidity(); - return (PropertyValue<String>) new PropertyValue(nativeGetLinePattern()); - } - - private native Object nativeGetLineCap(); - - private native Object nativeGetLineJoin(); - - private native Object nativeGetLineMiterLimit(); - - private native Object nativeGetLineRoundLimit(); - - private native Object nativeGetLineOpacity(); - - private native Object nativeGetLineColor(); - - private native Object nativeGetLineTranslate(); - - private native Object nativeGetLineTranslateAnchor(); - - private native Object nativeGetLineWidth(); - - private native Object nativeGetLineGapWidth(); - - private native Object nativeGetLineOffset(); - - private native Object nativeGetLineBlur(); - - private native Object nativeGetLineDasharray(); - - private native Object nativeGetLinePattern(); - - - @Override - protected native void finalize() throws Throwable; + } + + + /** + * Get the LineTranslate property + * + * @return property wrapper value around Float[] + */ + @SuppressWarnings("unchecked") + public PropertyValue<Float[]> getLineTranslate() { + return (PropertyValue<Float[]>) new PropertyValue(nativeGetLineTranslate()); + } + + /** + * Get the LineTranslateAnchor property + * + * @return property wrapper value around String + */ + @SuppressWarnings("unchecked") + public PropertyValue<String> getLineTranslateAnchor() { + return (PropertyValue<String>) new PropertyValue(nativeGetLineTranslateAnchor()); + } + + /** + * Get the LineWidth property + * + * @return property wrapper value around Float + */ + @SuppressWarnings("unchecked") + public PropertyValue<Float> getLineWidth() { + return (PropertyValue<Float>) new PropertyValue(nativeGetLineWidth()); + } + + /** + * Get the LineGapWidth property + * + * @return property wrapper value around Float + */ + @SuppressWarnings("unchecked") + public PropertyValue<Float> getLineGapWidth() { + return (PropertyValue<Float>) new PropertyValue(nativeGetLineGapWidth()); + } + + /** + * Get the LineOffset property + * + * @return property wrapper value around Float + */ + @SuppressWarnings("unchecked") + public PropertyValue<Float> getLineOffset() { + return (PropertyValue<Float>) new PropertyValue(nativeGetLineOffset()); + } + + /** + * Get the LineBlur property + * + * @return property wrapper value around Float + */ + @SuppressWarnings("unchecked") + public PropertyValue<Float> getLineBlur() { + return (PropertyValue<Float>) new PropertyValue(nativeGetLineBlur()); + } + + /** + * Get the LineDasharray property + * + * @return property wrapper value around Float[] + */ + @SuppressWarnings("unchecked") + public PropertyValue<Float[]> getLineDasharray() { + return (PropertyValue<Float[]>) new PropertyValue(nativeGetLineDasharray()); + } + + /** + * Get the LinePattern property + * + * @return property wrapper value around String + */ + @SuppressWarnings("unchecked") + public PropertyValue<String> getLinePattern() { + return (PropertyValue<String>) new PropertyValue(nativeGetLinePattern()); + } + + private native Object nativeGetLineCap(); + + private native Object nativeGetLineJoin(); + + private native Object nativeGetLineMiterLimit(); + + private native Object nativeGetLineRoundLimit(); + + private native Object nativeGetLineOpacity(); + + private native Object nativeGetLineColor(); + + private native Object nativeGetLineTranslate(); + + private native Object nativeGetLineTranslateAnchor(); + + private native Object nativeGetLineWidth(); + + private native Object nativeGetLineGapWidth(); + + private native Object nativeGetLineOffset(); + + private native Object nativeGetLineBlur(); + + private native Object nativeGetLineDasharray(); + + private native Object nativeGetLinePattern(); + + + @Override + protected native void finalize() throws Throwable; } 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 index d6ef4f8824..3b8777080d 100644 --- 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 @@ -5,7 +5,7 @@ package com.mapbox.mapboxsdk.style.layers; */ public class NoSuchLayerException extends Exception { - public NoSuchLayerException(String message) { - super(message); - } + 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 index 6f1a9a0a16..69405177d9 100644 --- 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 @@ -2,8 +2,8 @@ package com.mapbox.mapboxsdk.style.layers; class PaintProperty<T> extends Property<T> { - PaintProperty(String name, T value) { - super(name, value); - } + PaintProperty(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 383d4217a8..bb060ddf15 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,5 +1,5 @@ -// This file is generated. Edit android/platform/scripts/generate-style-code.js, then run `make style-code-android`. package com.mapbox.mapboxsdk.style.layers; +// This file is generated. Edit android/platform/scripts/generate-style-code.js, then run `make android-style-code`. import android.support.annotation.StringDef; @@ -11,448 +11,477 @@ import java.lang.annotation.RetentionPolicy; */ 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 {} - - //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. - */ - 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. - */ - public static final String LINE_CAP_SQUARE = "square"; - - /** - * The display of line endings. - */ - @StringDef({ - LINE_CAP_BUTT, - LINE_CAP_ROUND, - LINE_CAP_SQUARE, - }) - @Retention(RetentionPolicy.SOURCE) - public @interface LINE_CAP {} - - //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. - */ - 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. - */ - 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. - */ - public static final String LINE_JOIN_MITER = "miter"; - - /** - * The display of lines when joining. - */ - @StringDef({ - LINE_JOIN_BEVEL, - LINE_JOIN_ROUND, - LINE_JOIN_MITER, - }) - @Retention(RetentionPolicy.SOURCE) - public @interface LINE_JOIN {} - - //SYMBOL_PLACEMENT: Label placement relative to its geometry. - - /** - * The label is placed at the point where the geometry is located. - */ - public static final String SYMBOL_PLACEMENT_POINT = "point"; - /** - * The label is placed along the line of the geometry. Can only be used on LineString and Polygon geometries. - */ - public static final String SYMBOL_PLACEMENT_LINE = "line"; - - /** - * Label placement relative to its geometry. - */ - @StringDef({ - SYMBOL_PLACEMENT_POINT, - SYMBOL_PLACEMENT_LINE, - }) - @Retention(RetentionPolicy.SOURCE) - public @interface SYMBOL_PLACEMENT {} - - //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. - */ - 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}. - */ - 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}. - */ - 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, - }) - @Retention(RetentionPolicy.SOURCE) - public @interface ICON_ROTATION_ALIGNMENT {} - - //ICON_TEXT_FIT: Scales the icon to fit around the associated text. - - /** - * The icon is displayed at its intrinsic aspect ratio. - */ - public static final String ICON_TEXT_FIT_NONE = "none"; - /** - * The icon is scaled in the x-dimension to fit the width of the text. - */ - public static final String ICON_TEXT_FIT_WIDTH = "width"; - /** - * The icon is scaled in the y-dimension to fit the height of the text. - */ - public static final String ICON_TEXT_FIT_HEIGHT = "height"; - /** - * The icon is scaled in both x- and y-dimensions. - */ - public static final String ICON_TEXT_FIT_BOTH = "both"; - - /** - * 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, - }) - @Retention(RetentionPolicy.SOURCE) - public @interface ICON_TEXT_FIT {} - - //TEXT_PITCH_ALIGNMENT: Orientation of text when map is pitched. - - /** - * The text is aligned to the plane of the map. - */ - public static final String TEXT_PITCH_ALIGNMENT_MAP = "map"; - /** - * The text is aligned to the plane of the viewport. - */ - public static final String TEXT_PITCH_ALIGNMENT_VIEWPORT = "viewport"; - /** - * Automatically matches the value of {@link TEXT_ROTATION_ALIGNMENT}. - */ - public static final String TEXT_PITCH_ALIGNMENT_AUTO = "auto"; - - /** - * Orientation of text when map is pitched. - */ - @StringDef({ - TEXT_PITCH_ALIGNMENT_MAP, - TEXT_PITCH_ALIGNMENT_VIEWPORT, - TEXT_PITCH_ALIGNMENT_AUTO, - }) - @Retention(RetentionPolicy.SOURCE) - public @interface TEXT_PITCH_ALIGNMENT {} - - //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. - */ - 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}. - */ - 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}. - */ - 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, - }) - @Retention(RetentionPolicy.SOURCE) - public @interface TEXT_ROTATION_ALIGNMENT {} - - //TEXT_JUSTIFY: Text justification options. - - /** - * The text is aligned to the left. - */ - public static final String TEXT_JUSTIFY_LEFT = "left"; - /** - * The text is centered. - */ - public static final String TEXT_JUSTIFY_CENTER = "center"; - /** - * The text is aligned to the right. - */ - public static final String TEXT_JUSTIFY_RIGHT = "right"; - - /** - * Text justification options. - */ - @StringDef({ - TEXT_JUSTIFY_LEFT, - TEXT_JUSTIFY_CENTER, - TEXT_JUSTIFY_RIGHT, - }) - @Retention(RetentionPolicy.SOURCE) - public @interface TEXT_JUSTIFY {} - - //TEXT_ANCHOR: Part of the text placed closest to the anchor. - - /** - * The center of the text is placed closest to the anchor. - */ - public static final String TEXT_ANCHOR_CENTER = "center"; - /** - * The left side of the text is placed closest to the anchor. - */ - public static final String TEXT_ANCHOR_LEFT = "left"; - /** - * The right side of the text is placed closest to the anchor. - */ - public static final String TEXT_ANCHOR_RIGHT = "right"; - /** - * The top of the text is placed closest to the anchor. - */ - public static final String TEXT_ANCHOR_TOP = "top"; - /** - * The bottom of the text is placed closest to the anchor. - */ - public static final String TEXT_ANCHOR_BOTTOM = "bottom"; - /** - * The top left corner of the text is placed closest to the anchor. - */ - public static final String TEXT_ANCHOR_TOP_LEFT = "top-left"; - /** - * The top right corner of the text is placed closest to the anchor. - */ - public static final String TEXT_ANCHOR_TOP_RIGHT = "top-right"; - /** - * The bottom left corner of the text is placed closest to the anchor. - */ - public static final String TEXT_ANCHOR_BOTTOM_LEFT = "bottom-left"; - /** - * The bottom right corner of the text is placed closest to the anchor. - */ - public static final String TEXT_ANCHOR_BOTTOM_RIGHT = "bottom-right"; - - /** - * 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, - }) - @Retention(RetentionPolicy.SOURCE) - public @interface TEXT_ANCHOR {} - - //TEXT_TRANSFORM: Specifies how to capitalize text, similar to the CSS `text-transform` property. - - /** - * The text is not altered. - */ - public static final String TEXT_TRANSFORM_NONE = "none"; - /** - * Forces all letters to be displayed in uppercase. - */ - public static final String TEXT_TRANSFORM_UPPERCASE = "uppercase"; - /** - * Forces all letters to be displayed in lowercase. - */ - public static final String TEXT_TRANSFORM_LOWERCASE = "lowercase"; - - /** - * Specifies how to capitalize text, similar to the CSS `text-transform` property. - */ - @StringDef({ - TEXT_TRANSFORM_NONE, - TEXT_TRANSFORM_UPPERCASE, - TEXT_TRANSFORM_LOWERCASE, - }) - @Retention(RetentionPolicy.SOURCE) - public @interface TEXT_TRANSFORM {} - - //FILL_TRANSLATE_ANCHOR: Controls the translation reference point. - - /** - * The fill is translated relative to the map. - */ - public static final String FILL_TRANSLATE_ANCHOR_MAP = "map"; - /** - * The fill is translated relative to the viewport. - */ - public static final String FILL_TRANSLATE_ANCHOR_VIEWPORT = "viewport"; - - /** - * Controls the translation reference point. - */ - @StringDef({ - FILL_TRANSLATE_ANCHOR_MAP, - FILL_TRANSLATE_ANCHOR_VIEWPORT, - }) - @Retention(RetentionPolicy.SOURCE) - public @interface FILL_TRANSLATE_ANCHOR {} - - //LINE_TRANSLATE_ANCHOR: Controls the translation reference point. - - /** - * The line is translated relative to the map. - */ - public static final String LINE_TRANSLATE_ANCHOR_MAP = "map"; - /** - * The line is translated relative to the viewport. - */ - public static final String LINE_TRANSLATE_ANCHOR_VIEWPORT = "viewport"; - - /** - * Controls the translation reference point. - */ - @StringDef({ - LINE_TRANSLATE_ANCHOR_MAP, - LINE_TRANSLATE_ANCHOR_VIEWPORT, - }) - @Retention(RetentionPolicy.SOURCE) - public @interface LINE_TRANSLATE_ANCHOR {} - - //ICON_TRANSLATE_ANCHOR: Controls the translation reference point. - - /** - * Icons are translated relative to the map. - */ - public static final String ICON_TRANSLATE_ANCHOR_MAP = "map"; - /** - * Icons are translated relative to the viewport. - */ - public static final String ICON_TRANSLATE_ANCHOR_VIEWPORT = "viewport"; - - /** - * Controls the translation reference point. - */ - @StringDef({ - ICON_TRANSLATE_ANCHOR_MAP, - ICON_TRANSLATE_ANCHOR_VIEWPORT, - }) - @Retention(RetentionPolicy.SOURCE) - public @interface ICON_TRANSLATE_ANCHOR {} - - //TEXT_TRANSLATE_ANCHOR: Controls the translation reference point. - - /** - * The text is translated relative to the map. - */ - public static final String TEXT_TRANSLATE_ANCHOR_MAP = "map"; - /** - * The text is translated relative to the viewport. - */ - public static final String TEXT_TRANSLATE_ANCHOR_VIEWPORT = "viewport"; - - /** - * Controls the translation reference point. - */ - @StringDef({ - TEXT_TRANSLATE_ANCHOR_MAP, - TEXT_TRANSLATE_ANCHOR_VIEWPORT, - }) - @Retention(RetentionPolicy.SOURCE) - public @interface TEXT_TRANSLATE_ANCHOR {} - - //CIRCLE_TRANSLATE_ANCHOR: Controls the translation reference point. - - /** - * The circle is translated relative to the map. - */ - public static final String CIRCLE_TRANSLATE_ANCHOR_MAP = "map"; - /** - * The circle is translated relative to the viewport. - */ - public static final String CIRCLE_TRANSLATE_ANCHOR_VIEWPORT = "viewport"; - - /** - * Controls the translation reference point. - */ - @StringDef({ - CIRCLE_TRANSLATE_ANCHOR_MAP, - CIRCLE_TRANSLATE_ANCHOR_VIEWPORT, - }) - @Retention(RetentionPolicy.SOURCE) - public @interface CIRCLE_TRANSLATE_ANCHOR {} - - //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. - */ - public static final String CIRCLE_PITCH_SCALE_MAP = "map"; - /** - * Circles are not scaled. - */ - public static final String CIRCLE_PITCH_SCALE_VIEWPORT = "viewport"; - - /** - * Controls the scaling behavior of the circle when the map is pitched. - */ - @StringDef({ - CIRCLE_PITCH_SCALE_MAP, - CIRCLE_PITCH_SCALE_VIEWPORT, - }) - @Retention(RetentionPolicy.SOURCE) - 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; - } - + //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 { + } + + //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. + */ + 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. + */ + public static final String LINE_CAP_SQUARE = "square"; + + /** + * The display of line endings. + */ + @StringDef( { + LINE_CAP_BUTT, + LINE_CAP_ROUND, + LINE_CAP_SQUARE, + }) + @Retention(RetentionPolicy.SOURCE) + public @interface LINE_CAP { + } + + //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. + */ + 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. + */ + 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. + */ + public static final String LINE_JOIN_MITER = "miter"; + + /** + * The display of lines when joining. + */ + @StringDef( { + LINE_JOIN_BEVEL, + LINE_JOIN_ROUND, + LINE_JOIN_MITER, + }) + @Retention(RetentionPolicy.SOURCE) + public @interface LINE_JOIN { + } + + //SYMBOL_PLACEMENT: Label placement relative to its geometry. + + /** + * The label is placed at the point where the geometry is located. + */ + public static final String SYMBOL_PLACEMENT_POINT = "point"; + /** + * The label is placed along the line of the geometry. Can only be used on LineString and Polygon geometries. + */ + public static final String SYMBOL_PLACEMENT_LINE = "line"; + + /** + * Label placement relative to its geometry. + */ + @StringDef( { + SYMBOL_PLACEMENT_POINT, + SYMBOL_PLACEMENT_LINE, + }) + @Retention(RetentionPolicy.SOURCE) + public @interface SYMBOL_PLACEMENT { + } + + //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. + */ + 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}. + */ + 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}. + */ + 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, + }) + @Retention(RetentionPolicy.SOURCE) + public @interface ICON_ROTATION_ALIGNMENT { + } + + //ICON_TEXT_FIT: Scales the icon to fit around the associated text. + + /** + * The icon is displayed at its intrinsic aspect ratio. + */ + public static final String ICON_TEXT_FIT_NONE = "none"; + /** + * The icon is scaled in the x-dimension to fit the width of the text. + */ + public static final String ICON_TEXT_FIT_WIDTH = "width"; + /** + * The icon is scaled in the y-dimension to fit the height of the text. + */ + public static final String ICON_TEXT_FIT_HEIGHT = "height"; + /** + * The icon is scaled in both x- and y-dimensions. + */ + public static final String ICON_TEXT_FIT_BOTH = "both"; + + /** + * 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, + }) + @Retention(RetentionPolicy.SOURCE) + public @interface ICON_TEXT_FIT { + } + + //TEXT_PITCH_ALIGNMENT: Orientation of text when map is pitched. + + /** + * The text is aligned to the plane of the map. + */ + public static final String TEXT_PITCH_ALIGNMENT_MAP = "map"; + /** + * The text is aligned to the plane of the viewport. + */ + public static final String TEXT_PITCH_ALIGNMENT_VIEWPORT = "viewport"; + /** + * Automatically matches the value of {@link TEXT_ROTATION_ALIGNMENT}. + */ + public static final String TEXT_PITCH_ALIGNMENT_AUTO = "auto"; + + /** + * Orientation of text when map is pitched. + */ + @StringDef( { + TEXT_PITCH_ALIGNMENT_MAP, + TEXT_PITCH_ALIGNMENT_VIEWPORT, + TEXT_PITCH_ALIGNMENT_AUTO, + }) + @Retention(RetentionPolicy.SOURCE) + public @interface TEXT_PITCH_ALIGNMENT { + } + + //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. + */ + 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}. + */ + 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}. + */ + 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, + }) + @Retention(RetentionPolicy.SOURCE) + public @interface TEXT_ROTATION_ALIGNMENT { + } + + //TEXT_JUSTIFY: Text justification options. + + /** + * The text is aligned to the left. + */ + public static final String TEXT_JUSTIFY_LEFT = "left"; + /** + * The text is centered. + */ + public static final String TEXT_JUSTIFY_CENTER = "center"; + /** + * The text is aligned to the right. + */ + public static final String TEXT_JUSTIFY_RIGHT = "right"; + + /** + * Text justification options. + */ + @StringDef( { + TEXT_JUSTIFY_LEFT, + TEXT_JUSTIFY_CENTER, + TEXT_JUSTIFY_RIGHT, + }) + @Retention(RetentionPolicy.SOURCE) + public @interface TEXT_JUSTIFY { + } + + //TEXT_ANCHOR: Part of the text placed closest to the anchor. + + /** + * The center of the text is placed closest to the anchor. + */ + public static final String TEXT_ANCHOR_CENTER = "center"; + /** + * The left side of the text is placed closest to the anchor. + */ + public static final String TEXT_ANCHOR_LEFT = "left"; + /** + * The right side of the text is placed closest to the anchor. + */ + public static final String TEXT_ANCHOR_RIGHT = "right"; + /** + * The top of the text is placed closest to the anchor. + */ + public static final String TEXT_ANCHOR_TOP = "top"; + /** + * The bottom of the text is placed closest to the anchor. + */ + public static final String TEXT_ANCHOR_BOTTOM = "bottom"; + /** + * The top left corner of the text is placed closest to the anchor. + */ + public static final String TEXT_ANCHOR_TOP_LEFT = "top-left"; + /** + * The top right corner of the text is placed closest to the anchor. + */ + public static final String TEXT_ANCHOR_TOP_RIGHT = "top-right"; + /** + * The bottom left corner of the text is placed closest to the anchor. + */ + public static final String TEXT_ANCHOR_BOTTOM_LEFT = "bottom-left"; + /** + * The bottom right corner of the text is placed closest to the anchor. + */ + public static final String TEXT_ANCHOR_BOTTOM_RIGHT = "bottom-right"; + + /** + * 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, + }) + @Retention(RetentionPolicy.SOURCE) + public @interface TEXT_ANCHOR { + } + + //TEXT_TRANSFORM: Specifies how to capitalize text, similar to the CSS `text-transform` property. + + /** + * The text is not altered. + */ + public static final String TEXT_TRANSFORM_NONE = "none"; + /** + * Forces all letters to be displayed in uppercase. + */ + public static final String TEXT_TRANSFORM_UPPERCASE = "uppercase"; + /** + * Forces all letters to be displayed in lowercase. + */ + public static final String TEXT_TRANSFORM_LOWERCASE = "lowercase"; + + /** + * Specifies how to capitalize text, similar to the CSS `text-transform` property. + */ + @StringDef( { + TEXT_TRANSFORM_NONE, + TEXT_TRANSFORM_UPPERCASE, + TEXT_TRANSFORM_LOWERCASE, + }) + @Retention(RetentionPolicy.SOURCE) + public @interface TEXT_TRANSFORM { + } + + //FILL_TRANSLATE_ANCHOR: Controls the translation reference point. + + /** + * The fill is translated relative to the map. + */ + public static final String FILL_TRANSLATE_ANCHOR_MAP = "map"; + /** + * The fill is translated relative to the viewport. + */ + public static final String FILL_TRANSLATE_ANCHOR_VIEWPORT = "viewport"; + + /** + * Controls the translation reference point. + */ + @StringDef( { + FILL_TRANSLATE_ANCHOR_MAP, + FILL_TRANSLATE_ANCHOR_VIEWPORT, + }) + @Retention(RetentionPolicy.SOURCE) + public @interface FILL_TRANSLATE_ANCHOR { + } + + //LINE_TRANSLATE_ANCHOR: Controls the translation reference point. + + /** + * The line is translated relative to the map. + */ + public static final String LINE_TRANSLATE_ANCHOR_MAP = "map"; + /** + * The line is translated relative to the viewport. + */ + public static final String LINE_TRANSLATE_ANCHOR_VIEWPORT = "viewport"; + + /** + * Controls the translation reference point. + */ + @StringDef( { + LINE_TRANSLATE_ANCHOR_MAP, + LINE_TRANSLATE_ANCHOR_VIEWPORT, + }) + @Retention(RetentionPolicy.SOURCE) + public @interface LINE_TRANSLATE_ANCHOR { + } + + //ICON_TRANSLATE_ANCHOR: Controls the translation reference point. + + /** + * Icons are translated relative to the map. + */ + public static final String ICON_TRANSLATE_ANCHOR_MAP = "map"; + /** + * Icons are translated relative to the viewport. + */ + public static final String ICON_TRANSLATE_ANCHOR_VIEWPORT = "viewport"; + + /** + * Controls the translation reference point. + */ + @StringDef( { + ICON_TRANSLATE_ANCHOR_MAP, + ICON_TRANSLATE_ANCHOR_VIEWPORT, + }) + @Retention(RetentionPolicy.SOURCE) + public @interface ICON_TRANSLATE_ANCHOR { + } + + //TEXT_TRANSLATE_ANCHOR: Controls the translation reference point. + + /** + * The text is translated relative to the map. + */ + public static final String TEXT_TRANSLATE_ANCHOR_MAP = "map"; + /** + * The text is translated relative to the viewport. + */ + public static final String TEXT_TRANSLATE_ANCHOR_VIEWPORT = "viewport"; + + /** + * Controls the translation reference point. + */ + @StringDef( { + TEXT_TRANSLATE_ANCHOR_MAP, + TEXT_TRANSLATE_ANCHOR_VIEWPORT, + }) + @Retention(RetentionPolicy.SOURCE) + public @interface TEXT_TRANSLATE_ANCHOR { + } + + //CIRCLE_TRANSLATE_ANCHOR: Controls the translation reference point. + + /** + * The circle is translated relative to the map. + */ + public static final String CIRCLE_TRANSLATE_ANCHOR_MAP = "map"; + /** + * The circle is translated relative to the viewport. + */ + public static final String CIRCLE_TRANSLATE_ANCHOR_VIEWPORT = "viewport"; + + /** + * Controls the translation reference point. + */ + @StringDef( { + CIRCLE_TRANSLATE_ANCHOR_MAP, + CIRCLE_TRANSLATE_ANCHOR_VIEWPORT, + }) + @Retention(RetentionPolicy.SOURCE) + public @interface CIRCLE_TRANSLATE_ANCHOR { + } + + //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. + */ + public static final String CIRCLE_PITCH_SCALE_MAP = "map"; + /** + * Circles are not scaled. + */ + public static final String CIRCLE_PITCH_SCALE_VIEWPORT = "viewport"; + + /** + * Controls the scaling behavior of the circle when the map is pitched. + */ + @StringDef( { + CIRCLE_PITCH_SCALE_MAP, + CIRCLE_PITCH_SCALE_VIEWPORT, + }) + @Retention(RetentionPolicy.SOURCE) + 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; + } } 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 0cb8fdeff9..8e7d516a39 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,5 +1,5 @@ -// This file is generated. Edit android/platform/scripts/generate-style-code.js, then run `make style-code-android`. package com.mapbox.mapboxsdk.style.layers; +// This file is generated. Edit android/platform/scripts/generate-style-code.js, then run `make android-style-code`. import android.annotation.SuppressLint; import android.support.annotation.ColorInt; @@ -11,1839 +11,1947 @@ 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); - } - - /** - * Whether or not the fill should be antialiased. - * - * @param value a Boolean value - * @return property wrapper around Boolean - */ - public static Property<Boolean> fillAntialias(Boolean value) { - return new PaintProperty<>("fill-antialias", value); - } - - /** - * Whether or not the fill should be antialiased. - * - * @param function a wrapper function for Boolean - * @return property wrapper around a Boolean function - */ - public static Property<Function<Boolean>> fillAntialias(Function<Boolean> function) { - return new PaintProperty<>("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. - * - * @param value a Float value - * @return property wrapper around Float - */ - public static Property<Float> fillOpacity(Float value) { - return new PaintProperty<>("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. - * - * @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); - } - - /** - * 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)); - } - - /** - * 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); - } - - /** - * 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 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); - } - - /** - * The outline color of the fill. Matches the value of {@link PropertyFactory#fillColor} if unspecified. - * - * @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)); - } - - /** - * The outline color of the fill. Matches the value of {@link PropertyFactory#fillColor} if unspecified. - * - * @param value a String value - * @return property wrapper around String - */ - public static Property<String> fillOutlineColor(String value) { - return new PaintProperty<>("fill-outline-color", value); - } - - /** - * The outline color of the fill. Matches the value of {@link PropertyFactory#fillColor} if unspecified. - * - * @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); - } - - /** - * The geometry's offset. Values are [x, y] where negatives indicate left and up, respectively. - * - * @param value a Float[] value - * @return property wrapper around Float[] - */ - public static Property<Float[]> fillTranslate(Float[] value) { - return new PaintProperty<>("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[] - * @return property wrapper around a Float[] function - */ - public static Property<Function<Float[]>> fillTranslate(Function<Float[]> function) { - return new PaintProperty<>("fill-translate", function); - } - - /** - * Controls the translation reference point. - * - * @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); - } - - /** - * Controls the translation reference point. - * - * @param function a wrapper function 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); - } - - /** - * 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); - } - - /** - * 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 - * @return property wrapper around a String function - */ - public static Property<Function<String>> fillPattern(Function<String> function) { - return new PaintProperty<>("fill-pattern", function); - } - - /** - * The opacity at which the line will be drawn. - * - * @param value a Float value - * @return property wrapper around Float - */ - public static Property<Float> lineOpacity(Float value) { - return new PaintProperty<>("line-opacity", value); - } - - /** - * The opacity at which the line will be drawn. - * - * @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); - } - - /** - * The color with which the line will be drawn. - * - * @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)); - } - - /** - * The color with which the line will be drawn. - * - * @param value a String value - * @return property wrapper around String - */ - public static Property<String> lineColor(String value) { - return new PaintProperty<>("line-color", value); - } - - /** - * The color with which the line will be drawn. - * - * @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); - } - - /** - * The geometry's offset. Values are [x, y] where negatives indicate left and up, respectively. - * - * @param value a Float[] value - * @return property wrapper around Float[] - */ - public static Property<Float[]> lineTranslate(Float[] value) { - return new PaintProperty<>("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[] - * @return property wrapper around a Float[] function - */ - public static Property<Function<Float[]>> lineTranslate(Function<Float[]> function) { - return new PaintProperty<>("line-translate", function); - } - - /** - * Controls the translation reference point. - * - * @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); - } - - /** - * Controls the translation reference point. - * - * @param function a wrapper function 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); - } - - /** - * Stroke thickness. - * - * @param value a Float value - * @return property wrapper around Float - */ - public static Property<Float> lineWidth(Float value) { - return new PaintProperty<>("line-width", value); - } - - /** - * Stroke thickness. - * - * @param function a wrapper function for Float - * @return property wrapper around a Float function - */ - public static Property<Function<Float>> lineWidth(Function<Float> function) { - return new PaintProperty<>("line-width", function); - } - - /** - * Draws a line casing outside of a line's actual path. Value indicates the width of the inner gap. - * - * @param value a Float value - * @return property wrapper around Float - */ - public static Property<Float> lineGapWidth(Float value) { - return new PaintProperty<>("line-gap-width", value); - } - - /** - * Draws a line casing outside of a line's actual path. Value indicates the width of the inner gap. - * - * @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); - } - - /** - * 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); - } - - /** - * 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 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); - } - - /** - * Blur applied to the line, in pixels. - * - * @param value a Float value - * @return property wrapper around Float - */ - public static Property<Float> lineBlur(Float value) { - return new PaintProperty<>("line-blur", value); - } - - /** - * Blur applied to the line, in pixels. - * - * @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); - } - - /** - * 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. - * - * @param value a Float[] value - * @return property wrapper around Float[] - */ - public static Property<Float[]> lineDasharray(Float[] value) { - return new PaintProperty<>("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. - * - * @param function a wrapper function for Float[] - * @return property wrapper around a Float[] function - */ - public static Property<Function<Float[]>> lineDasharray(Function<Float[]> function) { - return new PaintProperty<>("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). - * - * @param value a String value - * @return property wrapper around String - */ - public static Property<String> linePattern(String value) { - return new PaintProperty<>("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). - * - * @param function a wrapper function for String - * @return property wrapper around a String function - */ - public static Property<Function<String>> linePattern(Function<String> function) { - return new PaintProperty<>("line-pattern", function); - } - - /** - * The opacity at which the icon will be drawn. - * - * @param value a Float value - * @return property wrapper around Float - */ - public static Property<Float> iconOpacity(Float value) { - return new PaintProperty<>("icon-opacity", value); - } - - /** - * The opacity at which the icon will be drawn. - * - * @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); - } - - /** - * The color of the icon. This can only be used with sdf icons. - * - * @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)); - } - - /** - * The color of the icon. This can only be used with sdf icons. - * - * @param value a String value - * @return property wrapper around String - */ - public static Property<String> iconColor(String value) { - return new PaintProperty<>("icon-color", value); - } - - /** - * The color of the icon. This can only be used with sdf icons. - * - * @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); - } - - /** - * The color of the icon's halo. Icon halos can only be used with SDF icons. - * - * @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)); - } - - /** - * The color of the icon's halo. Icon halos can only be used with SDF icons. - * - * @param value a String value - * @return property wrapper around String - */ - public static Property<String> iconHaloColor(String value) { - return new PaintProperty<>("icon-halo-color", value); - } - - /** - * The color of the icon's halo. Icon halos can only be used with SDF icons. - * - * @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); - } - - /** - * Distance of halo to the icon outline. - * - * @param value a Float value - * @return property wrapper around Float - */ - public static Property<Float> iconHaloWidth(Float value) { - return new PaintProperty<>("icon-halo-width", value); - } - - /** - * Distance of halo to the icon outline. - * - * @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); - } - - /** - * Fade out the halo towards the outside. - * - * @param value a Float value - * @return property wrapper around Float - */ - public static Property<Float> iconHaloBlur(Float value) { - return new PaintProperty<>("icon-halo-blur", value); - } - - /** - * Fade out the halo towards the outside. - * - * @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); - } - - /** - * 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); - } - - /** - * 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[] - * @return property wrapper around a Float[] function - */ - public static Property<Function<Float[]>> iconTranslate(Function<Float[]> function) { - return new PaintProperty<>("icon-translate", function); - } - - /** - * Controls the translation reference point. - * - * @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); - } - - /** - * Controls the translation reference point. - * - * @param function a wrapper function 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); - } - - /** - * The opacity at which the text will be drawn. - * - * @param value a Float value - * @return property wrapper around Float - */ - public static Property<Float> textOpacity(Float value) { - return new PaintProperty<>("text-opacity", value); - } - - /** - * The opacity at which the text will be drawn. - * - * @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); - } - - /** - * The color with which the text will be drawn. - * - * @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)); - } - - /** - * The color with which the text will be drawn. - * - * @param value a String value - * @return property wrapper around String - */ - public static Property<String> textColor(String value) { - return new PaintProperty<>("text-color", value); - } - - /** - * The color with which the text will be drawn. - * - * @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); - } - - /** - * The color of the text's halo, which helps it stand out from backgrounds. - * - * @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)); - } - - /** - * The color of the text's halo, which helps it stand out from backgrounds. - * - * @param value a String value - * @return property wrapper around String - */ - public static Property<String> textHaloColor(String value) { - return new PaintProperty<>("text-halo-color", value); - } - - /** - * The color of the text's halo, which helps it stand out from backgrounds. - * - * @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); - } - - /** - * Distance of halo to the font outline. Max text halo width is 1/4 of the font-size. - * - * @param value a Float value - * @return property wrapper around Float - */ - public static Property<Float> textHaloWidth(Float value) { - return new PaintProperty<>("text-halo-width", value); - } - - /** - * Distance of halo to the font outline. Max text halo width is 1/4 of the font-size. - * - * @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); - } - - /** - * The halo's fadeout distance towards the outside. - * - * @param value a Float value - * @return property wrapper around Float - */ - public static Property<Float> textHaloBlur(Float value) { - return new PaintProperty<>("text-halo-blur", value); - } - - /** - * The halo's fadeout distance towards the outside. - * - * @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); - } - - /** - * 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); - } - - /** - * 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[] - * @return property wrapper around a Float[] function - */ - public static Property<Function<Float[]>> textTranslate(Function<Float[]> function) { - return new PaintProperty<>("text-translate", function); - } - - /** - * Controls the translation reference point. - * - * @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); - } - - /** - * Controls the translation reference point. - * - * @param function a wrapper function 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); - } - - /** - * Circle radius. - * - * @param value a Float value - * @return property wrapper around Float - */ - public static Property<Float> circleRadius(Float value) { - return new PaintProperty<>("circle-radius", value); - } - - /** - * Circle radius. - * - * @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); - } - - /** - * The fill color of the circle. - * - * @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)); - } - - /** - * The fill color of the circle. - * - * @param value a String value - * @return property wrapper around String - */ - public static Property<String> circleColor(String value) { - return new PaintProperty<>("circle-color", value); - } - - /** - * The fill color of the circle. - * - * @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); - } - - /** - * Amount to blur the circle. 1 blurs the circle such that only the centerpoint is full opacity. - * - * @param value a Float value - * @return property wrapper around Float - */ - public static Property<Float> circleBlur(Float value) { - return new PaintProperty<>("circle-blur", value); - } - - /** - * Amount to blur the circle. 1 blurs the circle such that only the centerpoint is full opacity. - * - * @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); - } - - /** - * The opacity at which the circle will be drawn. - * - * @param value a Float value - * @return property wrapper around Float - */ - public static Property<Float> circleOpacity(Float value) { - return new PaintProperty<>("circle-opacity", value); - } - - /** - * The opacity at which the circle will be drawn. - * - * @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); - } - - /** - * The geometry's offset. Values are [x, y] where negatives indicate left and up, respectively. - * - * @param value a Float[] value - * @return property wrapper around Float[] - */ - public static Property<Float[]> circleTranslate(Float[] value) { - return new PaintProperty<>("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[] - * @return property wrapper around a Float[] function - */ - public static Property<Function<Float[]>> circleTranslate(Function<Float[]> function) { - return new PaintProperty<>("circle-translate", function); - } - - /** - * Controls the translation reference point. - * - * @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); - } - - /** - * Controls the translation reference point. - * - * @param function a wrapper function 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); - } - - /** - * Controls the scaling behavior of the circle when the map is pitched. - * - * @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); - } - - /** - * Controls the scaling behavior of the circle when the map is pitched. - * - * @param function a wrapper function 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); - } - - /** - * The opacity at which the image will be drawn. - * - * @param value a Float value - * @return property wrapper around Float - */ - public static Property<Float> rasterOpacity(Float value) { - return new PaintProperty<>("raster-opacity", value); - } - - /** - * The opacity at which the image will be drawn. - * - * @param function a wrapper function for Float - * @return property wrapper around a Float function - */ - public static Property<Function<Float>> rasterOpacity(Function<Float> function) { - return new PaintProperty<>("raster-opacity", function); - } - - /** - * Rotates hues around the color wheel. - * - * @param value a Float value - * @return property wrapper around Float - */ - public static Property<Float> rasterHueRotate(Float value) { - return new PaintProperty<>("raster-hue-rotate", value); - } - - /** - * Rotates hues around the color wheel. - * - * @param function a wrapper function 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); - } - - /** - * Increase or reduce the brightness of the image. The value is the minimum brightness. - * - * @param value a Float value - * @return property wrapper around Float - */ - public static Property<Float> rasterBrightnessMin(Float value) { - return new PaintProperty<>("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 - * @return property wrapper around a Float function - */ - public static Property<Function<Float>> rasterBrightnessMin(Function<Float> function) { - return new PaintProperty<>("raster-brightness-min", function); - } - - /** - * Increase or reduce the brightness of the image. The value is the maximum brightness. - * - * @param value a Float value - * @return property wrapper around Float - */ - public static Property<Float> rasterBrightnessMax(Float value) { - return new PaintProperty<>("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 - * @return property wrapper around a Float function - */ - public static Property<Function<Float>> rasterBrightnessMax(Function<Float> function) { - return new PaintProperty<>("raster-brightness-max", function); - } - - /** - * Increase or reduce the saturation of the image. - * - * @param value a Float value - * @return property wrapper around Float - */ - public static Property<Float> rasterSaturation(Float value) { - return new PaintProperty<>("raster-saturation", value); - } - - /** - * Increase or reduce the saturation of the image. - * - * @param function a wrapper function for Float - * @return property wrapper around a Float function - */ - public static Property<Function<Float>> rasterSaturation(Function<Float> function) { - return new PaintProperty<>("raster-saturation", function); - } - - /** - * Increase or reduce the contrast of the image. - * - * @param value a Float value - * @return property wrapper around Float - */ - public static Property<Float> rasterContrast(Float value) { - return new PaintProperty<>("raster-contrast", value); - } - - /** - * Increase or reduce the contrast of the image. - * - * @param function a wrapper function for Float - * @return property wrapper around a Float function - */ - public static Property<Function<Float>> rasterContrast(Function<Float> function) { - return new PaintProperty<>("raster-contrast", function); - } - - /** - * Fade duration when a new tile is added. - * - * @param value a Float value - * @return property wrapper around Float - */ - public static Property<Float> rasterFadeDuration(Float value) { - return new PaintProperty<>("raster-fade-duration", value); - } - - /** - * Fade duration when a new tile is added. - * - * @param function a wrapper function 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); - } - - /** - * The color with which the background will be drawn. - * - * @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)); - } - - /** - * The color with which the background will be drawn. - * - * @param value a String value - * @return property wrapper around String - */ - public static Property<String> backgroundColor(String value) { - return new PaintProperty<>("background-color", value); - } - - /** - * The color with which the background will be drawn. - * - * @param function a wrapper function for String - * @return property wrapper around a String function - */ - public static Property<Function<String>> backgroundColor(Function<String> function) { - return new PaintProperty<>("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). - * - * @param value a String value - * @return property wrapper around String - */ - public static Property<String> backgroundPattern(String value) { - return new PaintProperty<>("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). - * - * @param function a wrapper function for String - * @return property wrapper around a String function - */ - public static Property<Function<String>> backgroundPattern(Function<String> function) { - return new PaintProperty<>("background-pattern", function); - } - - /** - * The opacity at which the background will be drawn. - * - * @param value a Float value - * @return property wrapper around Float - */ - public static Property<Float> backgroundOpacity(Float value) { - return new PaintProperty<>("background-opacity", value); - } - - /** - * The opacity at which the background will be drawn. - * - * @param function a wrapper function for Float - * @return property wrapper around a Float function - */ - public static Property<Function<Float>> backgroundOpacity(Function<Float> function) { - return new PaintProperty<>("background-opacity", function); - } - - /** - * The display of line endings. - * - * @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); - } - - /** - * The display of line endings. - * - * @param function a wrapper function for String - * @return property wrapper around a String function - */ - public static Property<Function<String>> lineCap(Function<String> function) { - return new LayoutProperty<>("line-cap", function); - } - - /** - * The display of lines when joining. - * - * @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); - } - - /** - * The display of lines when joining. - * - * @param function a wrapper function for String - * @return property wrapper around a String function - */ - public static Property<Function<String>> lineJoin(Function<String> function) { - return new LayoutProperty<>("line-join", function); - } - - /** - * Used to automatically convert miter joins to bevel joins for sharp angles. - * - * @param value a Float value - * @return property wrapper around Float - */ - public static Property<Float> lineMiterLimit(Float value) { - return new LayoutProperty<>("line-miter-limit", value); - } - - /** - * Used to automatically convert miter joins to bevel joins for sharp angles. - * - * @param function a wrapper function 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); - } - - /** - * Used to automatically convert round joins to miter joins for shallow angles. - * - * @param value a Float value - * @return property wrapper around Float - */ - public static Property<Float> lineRoundLimit(Float value) { - return new LayoutProperty<>("line-round-limit", value); - } - - /** - * Used to automatically convert round joins to miter joins for shallow angles. - * - * @param function a wrapper function 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); - } - - /** - * Label placement relative to its geometry. - * - * @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); - } - - /** - * Label placement relative to its geometry. - * - * @param function a wrapper function for String - * @return property wrapper around a String function - */ - public static Property<Function<String>> symbolPlacement(Function<String> function) { - return new LayoutProperty<>("symbol-placement", function); - } - - /** - * Distance between two symbol anchors. - * - * @param value a Float value - * @return property wrapper around Float - */ - public static Property<Float> symbolSpacing(Float value) { - return new LayoutProperty<>("symbol-spacing", value); - } - - /** - * Distance between two symbol anchors. - * - * @param function a wrapper function for Float - * @return property wrapper around a Float function - */ - public static Property<Function<Float>> symbolSpacing(Function<Float> function) { - return new LayoutProperty<>("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. - * - * @param value a Boolean value - * @return property wrapper around Boolean - */ - public static Property<Boolean> symbolAvoidEdges(Boolean value) { - return new LayoutProperty<>("symbol-avoid-edges", value); - } - - /** - * If true, the symbols will not cross tile edges to avoid mutual collisions. Recommended in layers that don't have enough padding in the vector tile to prevent collisions, or if it is a point symbol layer placed after a line symbol layer. - * - * @param function a wrapper function 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); - } - - /** - * If true, the icon will be visible even if it collides with other previously drawn symbols. - * - * @param value a Boolean value - * @return property wrapper around Boolean - */ - public static Property<Boolean> iconAllowOverlap(Boolean value) { - return new LayoutProperty<>("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 - * @return property wrapper around a Boolean function - */ - public static Property<Function<Boolean>> iconAllowOverlap(Function<Boolean> function) { - return new LayoutProperty<>("icon-allow-overlap", function); - } - - /** - * If true, other symbols can be visible even if they collide with the icon. - * - * @param value a Boolean value - * @return property wrapper around Boolean - */ - public static Property<Boolean> iconIgnorePlacement(Boolean value) { - return new LayoutProperty<>("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 - * @return property wrapper around a Boolean function - */ - public static Property<Function<Boolean>> iconIgnorePlacement(Function<Boolean> function) { - return new LayoutProperty<>("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. - * - * @param value a Boolean value - * @return property wrapper around Boolean - */ - public static Property<Boolean> iconOptional(Boolean value) { - return new LayoutProperty<>("icon-optional", value); - } - - /** - * If true, text will display without their corresponding icons when the icon collides with other symbols and the text does not. - * - * @param function a wrapper function for Boolean - * @return property wrapper around a Boolean function - */ - public static Property<Function<Boolean>> iconOptional(Function<Boolean> function) { - return new LayoutProperty<>("icon-optional", function); - } - - /** - * In combination with {@link Property.SYMBOL_PLACEMENT}, determines the rotation behavior of icons. - * - * @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); - } - - /** - * In combination with {@link Property.SYMBOL_PLACEMENT}, determines the rotation behavior of icons. - * - * @param function a wrapper function 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); - } - - /** - * Scale factor for icon. 1 is original size, 3 triples the size. - * - * @param value a Float value - * @return property wrapper around Float - */ - public static Property<Float> iconSize(Float value) { - return new LayoutProperty<>("icon-size", value); - } - - /** - * Scale factor for icon. 1 is original size, 3 triples the size. - * - * @param function a wrapper function for Float - * @return property wrapper around a Float function - */ - public static Property<Function<Float>> iconSize(Function<Float> function) { - return new LayoutProperty<>("icon-size", function); - } - - /** - * Scales the icon to fit around the associated text. - * - * @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); - } - - /** - * Scales the icon to fit around the associated text. - * - * @param function a wrapper function 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); - } - - /** - * 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); - } - - /** - * 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[] - * @return property wrapper around a Float[] function - */ - public static Property<Function<Float[]>> iconTextFitPadding(Function<Float[]> function) { - return new LayoutProperty<>("icon-text-fit-padding", function); - } - - /** - * A string with {tokens} replaced, referencing the data property to pull from. - * - * @param value a String value - * @return property wrapper around String - */ - public static Property<String> iconImage(String value) { - return new LayoutProperty<>("icon-image", value); - } - - /** - * A string with {tokens} replaced, referencing the data property to pull from. - * - * @param function a wrapper function for String - * @return property wrapper around a String function - */ - public static Property<Function<String>> iconImage(Function<String> function) { - return new LayoutProperty<>("icon-image", function); - } - - /** - * Rotates the icon clockwise. - * - * @param value a Float value - * @return property wrapper around Float - */ - public static Property<Float> iconRotate(Float value) { - return new LayoutProperty<>("icon-rotate", value); - } - - /** - * Rotates the icon clockwise. - * - * @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); - } - - /** - * Size of the additional area around the icon bounding box used for detecting symbol collisions. - * - * @param value a Float value - * @return property wrapper around Float - */ - public static Property<Float> iconPadding(Float value) { - return new LayoutProperty<>("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 - * @return property wrapper around a Float function - */ - public static Property<Function<Float>> iconPadding(Function<Float> function) { - return new LayoutProperty<>("icon-padding", function); - } - - /** - * If true, the icon may be flipped to prevent it from being rendered upside-down. - * - * @param value a Boolean value - * @return property wrapper around Boolean - */ - public static Property<Boolean> iconKeepUpright(Boolean value) { - return new LayoutProperty<>("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 - * @return property wrapper around a Boolean function - */ - public static Property<Function<Boolean>> iconKeepUpright(Function<Boolean> function) { - return new LayoutProperty<>("icon-keep-upright", function); - } - - /** - * Offset distance of icon 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[]> iconOffset(Float[] value) { - return new LayoutProperty<>("icon-offset", value); - } - - /** - * Offset distance of icon from its anchor. Positive values indicate right and down, while negative values indicate left and up. - * - * @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); - } - - /** - * Orientation of text when map is pitched. - * - * @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); - } - - /** - * Orientation of text when map is pitched. - * - * @param function a wrapper function 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); - } - - /** - * 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); - } - - /** - * 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 - * @return property wrapper around a String function - */ - public static Property<Function<String>> textRotationAlignment(Function<String> function) { - return new LayoutProperty<>("text-rotation-alignment", function); - } - - /** - * Value to use for a text label. Feature properties are specified using tokens like {field_name}. - * - * @param value a String value - * @return property wrapper around String - */ - public static Property<String> textField(String value) { - return new LayoutProperty<>("text-field", value); - } - - /** - * Value to use for a text label. Feature properties are specified using tokens like {field_name}. - * - * @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); - } - - /** - * Font stack to use for displaying text. - * - * @param value a String[] value - * @return property wrapper around String[] - */ - public static Property<String[]> textFont(String[] value) { - return new LayoutProperty<>("text-font", value); - } - - /** - * Font stack to use for displaying text. - * - * @param function a wrapper function for String[] - * @return property wrapper around a String[] function - */ - public static Property<Function<String[]>> textFont(Function<String[]> function) { - return new LayoutProperty<>("text-font", function); - } - - /** - * Font size. - * - * @param value a Float value - * @return property wrapper around Float - */ - public static Property<Float> textSize(Float value) { - return new LayoutProperty<>("text-size", value); - } - - /** - * Font size. - * - * @param function a wrapper function for Float - * @return property wrapper around a Float function - */ - public static Property<Function<Float>> textSize(Function<Float> function) { - return new LayoutProperty<>("text-size", function); - } - - /** - * The maximum line width for text wrapping. - * - * @param value a Float value - * @return property wrapper around Float - */ - public static Property<Float> textMaxWidth(Float value) { - return new LayoutProperty<>("text-max-width", value); - } - - /** - * The maximum line width for text wrapping. - * - * @param function a wrapper function 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); - } - - /** - * Text leading value for multi-line text. - * - * @param value a Float value - * @return property wrapper around Float - */ - public static Property<Float> textLineHeight(Float value) { - return new LayoutProperty<>("text-line-height", value); - } - - /** - * Text leading value for multi-line text. - * - * @param function a wrapper function 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); - } - - /** - * Text tracking amount. - * - * @param value a Float value - * @return property wrapper around Float - */ - public static Property<Float> textLetterSpacing(Float value) { - return new LayoutProperty<>("text-letter-spacing", value); - } - - /** - * Text tracking amount. - * - * @param function a wrapper function 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); - } - - /** - * Text justification options. - * - * @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); - } - - /** - * Text justification options. - * - * @param function a wrapper function for String - * @return property wrapper around a String function - */ - public static Property<Function<String>> textJustify(Function<String> function) { - return new LayoutProperty<>("text-justify", function); - } - - /** - * Part of the text placed closest to the anchor. - * - * @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); - } - - /** - * Part of the text placed closest to the anchor. - * - * @param function a wrapper function for String - * @return property wrapper around a String function - */ - public static Property<Function<String>> textAnchor(Function<String> function) { - return new LayoutProperty<>("text-anchor", function); - } - - /** - * Maximum angle change between adjacent characters. - * - * @param value a Float value - * @return property wrapper around Float - */ - public static Property<Float> textMaxAngle(Float value) { - return new LayoutProperty<>("text-max-angle", value); - } - - /** - * Maximum angle change between adjacent characters. - * - * @param function a wrapper function 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); - } - - /** - * Rotates the text clockwise. - * - * @param value a Float value - * @return property wrapper around Float - */ - public static Property<Float> textRotate(Float value) { - return new LayoutProperty<>("text-rotate", value); - } - - /** - * Rotates the text clockwise. - * - * @param function a wrapper function for Float - * @return property wrapper around a Float function - */ - public static Property<Function<Float>> textRotate(Function<Float> function) { - return new LayoutProperty<>("text-rotate", function); - } - - /** - * Size of the additional area around the text bounding box used for detecting symbol collisions. - * - * @param value a Float value - * @return property wrapper around Float - */ - public static Property<Float> textPadding(Float value) { - return new LayoutProperty<>("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 - * @return property wrapper around a Float function - */ - public static Property<Function<Float>> textPadding(Function<Float> function) { - return new LayoutProperty<>("text-padding", function); - } - - /** - * If true, the text may be flipped vertically to prevent it from being rendered upside-down. - * - * @param value a Boolean value - * @return property wrapper around Boolean - */ - public static Property<Boolean> textKeepUpright(Boolean value) { - return new LayoutProperty<>("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 - * @return property wrapper around a Boolean function - */ - public static Property<Function<Boolean>> textKeepUpright(Function<Boolean> function) { - return new LayoutProperty<>("text-keep-upright", function); - } - - /** - * Specifies how to capitalize text, similar to the CSS {@link PropertyFactory#textTransform} property. - * - * @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); - } - - /** - * Specifies how to capitalize text, similar to the CSS {@link PropertyFactory#textTransform} property. - * - * @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); - } - - /** - * 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); - } - - /** - * 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[] - * @return property wrapper around a Float[] function - */ - public static Property<Function<Float[]>> textOffset(Function<Float[]> function) { - return new LayoutProperty<>("text-offset", function); - } - - /** - * If true, the text will be visible even if it collides with other previously drawn symbols. - * - * @param value a Boolean value - * @return property wrapper around Boolean - */ - public static Property<Boolean> textAllowOverlap(Boolean value) { - return new LayoutProperty<>("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 - * @return property wrapper around a Boolean function - */ - public static Property<Function<Boolean>> textAllowOverlap(Function<Boolean> function) { - return new LayoutProperty<>("text-allow-overlap", function); - } - - /** - * If true, other symbols can be visible even if they collide with the text. - * - * @param value a Boolean value - * @return property wrapper around Boolean - */ - public static Property<Boolean> textIgnorePlacement(Boolean value) { - return new LayoutProperty<>("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 - * @return property wrapper around a Boolean function - */ - public static Property<Function<Boolean>> textIgnorePlacement(Function<Boolean> function) { - return new LayoutProperty<>("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. - * - * @param value a Boolean value - * @return property wrapper around Boolean - */ - public static Property<Boolean> textOptional(Boolean value) { - return new LayoutProperty<>("text-optional", value); - } - - /** - * If true, icons will display without their corresponding text when the text collides with other symbols and the icon does not. - * - * @param function a wrapper function for Boolean - * @return property wrapper around a Boolean function - */ - public static Property<Function<Boolean>> textOptional(Function<Boolean> function) { - return new LayoutProperty<>("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); - } + /** + * 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); + } + + /** + * Whether or not the fill should be antialiased. + * + * @param value a Boolean value + * @return property wrapper around Boolean + */ + public static Property<Boolean> fillAntialias(Boolean value) { + return new PaintProperty<>("fill-antialias", value); + } + + /** + * Whether or not the fill should be antialiased. + * + * @param function a wrapper function for Boolean + * @return property wrapper around a Boolean function + */ + public static Property<Function<Boolean>> fillAntialias(Function<Boolean> function) { + return new PaintProperty<>("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. + * + * @param value a Float value + * @return property wrapper around Float + */ + public static Property<Float> fillOpacity(Float value) { + return new PaintProperty<>("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. + * + * @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); + } + + /** + * 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)); + } + + /** + * 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); + } + + /** + * 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 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); + } + + /** + * The outline color of the fill. Matches the value of {@link PropertyFactory#fillColor} if unspecified. + * + * @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)); + } + + /** + * The outline color of the fill. Matches the value of {@link PropertyFactory#fillColor} if unspecified. + * + * @param value a String value + * @return property wrapper around String + */ + public static Property<String> fillOutlineColor(String value) { + return new PaintProperty<>("fill-outline-color", value); + } + + /** + * The outline color of the fill. Matches the value of {@link PropertyFactory#fillColor} if unspecified. + * + * @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); + } + + /** + * The geometry's offset. Values are [x, y] where negatives indicate left and up, respectively. + * + * @param value a Float[] value + * @return property wrapper around Float[] + */ + public static Property<Float[]> fillTranslate(Float[] value) { + return new PaintProperty<>("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[] + * @return property wrapper around a Float[] function + */ + public static Property<Function<Float[]>> fillTranslate(Function<Float[]> function) { + return new PaintProperty<>("fill-translate", function); + } + + /** + * Controls the translation reference point. + * + * @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); + } + + /** + * Controls the translation reference point. + * + * @param function a wrapper function 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); + } + + /** + * 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); + } + + /** + * 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 + * @return property wrapper around a String function + */ + public static Property<Function<String>> fillPattern(Function<String> function) { + return new PaintProperty<>("fill-pattern", function); + } + + /** + * The opacity at which the line will be drawn. + * + * @param value a Float value + * @return property wrapper around Float + */ + public static Property<Float> lineOpacity(Float value) { + return new PaintProperty<>("line-opacity", value); + } + + /** + * The opacity at which the line will be drawn. + * + * @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); + } + + /** + * The color with which the line will be drawn. + * + * @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)); + } + + /** + * The color with which the line will be drawn. + * + * @param value a String value + * @return property wrapper around String + */ + public static Property<String> lineColor(String value) { + return new PaintProperty<>("line-color", value); + } + + /** + * The color with which the line will be drawn. + * + * @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); + } + + /** + * The geometry's offset. Values are [x, y] where negatives indicate left and up, respectively. + * + * @param value a Float[] value + * @return property wrapper around Float[] + */ + public static Property<Float[]> lineTranslate(Float[] value) { + return new PaintProperty<>("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[] + * @return property wrapper around a Float[] function + */ + public static Property<Function<Float[]>> lineTranslate(Function<Float[]> function) { + return new PaintProperty<>("line-translate", function); + } + + /** + * Controls the translation reference point. + * + * @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); + } + + /** + * Controls the translation reference point. + * + * @param function a wrapper function 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); + } + + /** + * Stroke thickness. + * + * @param value a Float value + * @return property wrapper around Float + */ + public static Property<Float> lineWidth(Float value) { + return new PaintProperty<>("line-width", value); + } + + /** + * Stroke thickness. + * + * @param function a wrapper function for Float + * @return property wrapper around a Float function + */ + public static Property<Function<Float>> lineWidth(Function<Float> function) { + return new PaintProperty<>("line-width", function); + } + + /** + * Draws a line casing outside of a line's actual path. Value indicates the width of the inner gap. + * + * @param value a Float value + * @return property wrapper around Float + */ + public static Property<Float> lineGapWidth(Float value) { + return new PaintProperty<>("line-gap-width", value); + } + + /** + * Draws a line casing outside of a line's actual path. Value indicates the width of the inner gap. + * + * @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); + } + + /** + * 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); + } + + /** + * 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 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); + } + + /** + * Blur applied to the line, in pixels. + * + * @param value a Float value + * @return property wrapper around Float + */ + public static Property<Float> lineBlur(Float value) { + return new PaintProperty<>("line-blur", value); + } + + /** + * Blur applied to the line, in pixels. + * + * @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); + } + + /** + * 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. + * + * @param value a Float[] value + * @return property wrapper around Float[] + */ + public static Property<Float[]> lineDasharray(Float[] value) { + return new PaintProperty<>("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. + * + * @param function a wrapper function for Float[] + * @return property wrapper around a Float[] function + */ + public static Property<Function<Float[]>> lineDasharray(Function<Float[]> function) { + return new PaintProperty<>("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). + * + * @param value a String value + * @return property wrapper around String + */ + public static Property<String> linePattern(String value) { + return new PaintProperty<>("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). + * + * @param function a wrapper function for String + * @return property wrapper around a String function + */ + public static Property<Function<String>> linePattern(Function<String> function) { + return new PaintProperty<>("line-pattern", function); + } + + /** + * The opacity at which the icon will be drawn. + * + * @param value a Float value + * @return property wrapper around Float + */ + public static Property<Float> iconOpacity(Float value) { + return new PaintProperty<>("icon-opacity", value); + } + + /** + * The opacity at which the icon will be drawn. + * + * @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); + } + + /** + * The color of the icon. This can only be used with sdf icons. + * + * @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)); + } + + /** + * The color of the icon. This can only be used with sdf icons. + * + * @param value a String value + * @return property wrapper around String + */ + public static Property<String> iconColor(String value) { + return new PaintProperty<>("icon-color", value); + } + + /** + * The color of the icon. This can only be used with sdf icons. + * + * @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); + } + + /** + * The color of the icon's halo. Icon halos can only be used with SDF icons. + * + * @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)); + } + + /** + * The color of the icon's halo. Icon halos can only be used with SDF icons. + * + * @param value a String value + * @return property wrapper around String + */ + public static Property<String> iconHaloColor(String value) { + return new PaintProperty<>("icon-halo-color", value); + } + + /** + * The color of the icon's halo. Icon halos can only be used with SDF icons. + * + * @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); + } + + /** + * Distance of halo to the icon outline. + * + * @param value a Float value + * @return property wrapper around Float + */ + public static Property<Float> iconHaloWidth(Float value) { + return new PaintProperty<>("icon-halo-width", value); + } + + /** + * Distance of halo to the icon outline. + * + * @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); + } + + /** + * Fade out the halo towards the outside. + * + * @param value a Float value + * @return property wrapper around Float + */ + public static Property<Float> iconHaloBlur(Float value) { + return new PaintProperty<>("icon-halo-blur", value); + } + + /** + * Fade out the halo towards the outside. + * + * @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); + } + + /** + * 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); + } + + /** + * 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[] + * @return property wrapper around a Float[] function + */ + public static Property<Function<Float[]>> iconTranslate(Function<Float[]> function) { + return new PaintProperty<>("icon-translate", function); + } + + /** + * Controls the translation reference point. + * + * @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); + } + + /** + * Controls the translation reference point. + * + * @param function a wrapper function 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); + } + + /** + * The opacity at which the text will be drawn. + * + * @param value a Float value + * @return property wrapper around Float + */ + public static Property<Float> textOpacity(Float value) { + return new PaintProperty<>("text-opacity", value); + } + + /** + * The opacity at which the text will be drawn. + * + * @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); + } + + /** + * The color with which the text will be drawn. + * + * @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)); + } + + /** + * The color with which the text will be drawn. + * + * @param value a String value + * @return property wrapper around String + */ + public static Property<String> textColor(String value) { + return new PaintProperty<>("text-color", value); + } + + /** + * The color with which the text will be drawn. + * + * @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); + } + + /** + * The color of the text's halo, which helps it stand out from backgrounds. + * + * @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)); + } + + /** + * The color of the text's halo, which helps it stand out from backgrounds. + * + * @param value a String value + * @return property wrapper around String + */ + public static Property<String> textHaloColor(String value) { + return new PaintProperty<>("text-halo-color", value); + } + + /** + * The color of the text's halo, which helps it stand out from backgrounds. + * + * @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); + } + + /** + * Distance of halo to the font outline. Max text halo width is 1/4 of the font-size. + * + * @param value a Float value + * @return property wrapper around Float + */ + public static Property<Float> textHaloWidth(Float value) { + return new PaintProperty<>("text-halo-width", value); + } + + /** + * Distance of halo to the font outline. Max text halo width is 1/4 of the font-size. + * + * @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); + } + + /** + * The halo's fadeout distance towards the outside. + * + * @param value a Float value + * @return property wrapper around Float + */ + public static Property<Float> textHaloBlur(Float value) { + return new PaintProperty<>("text-halo-blur", value); + } + + /** + * The halo's fadeout distance towards the outside. + * + * @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); + } + + /** + * 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); + } + + /** + * 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[] + * @return property wrapper around a Float[] function + */ + public static Property<Function<Float[]>> textTranslate(Function<Float[]> function) { + return new PaintProperty<>("text-translate", function); + } + + /** + * Controls the translation reference point. + * + * @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); + } + + /** + * Controls the translation reference point. + * + * @param function a wrapper function 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); + } + + /** + * Circle radius. + * + * @param value a Float value + * @return property wrapper around Float + */ + public static Property<Float> circleRadius(Float value) { + return new PaintProperty<>("circle-radius", value); + } + + /** + * Circle radius. + * + * @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); + } + + /** + * The fill color of the circle. + * + * @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)); + } + + /** + * The fill color of the circle. + * + * @param value a String value + * @return property wrapper around String + */ + public static Property<String> circleColor(String value) { + return new PaintProperty<>("circle-color", value); + } + + /** + * The fill color of the circle. + * + * @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); + } + + /** + * Amount to blur the circle. 1 blurs the circle such that only the centerpoint is full opacity. + * + * @param value a Float value + * @return property wrapper around Float + */ + public static Property<Float> circleBlur(Float value) { + return new PaintProperty<>("circle-blur", value); + } + + /** + * Amount to blur the circle. 1 blurs the circle such that only the centerpoint is full opacity. + * + * @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); + } + + /** + * The opacity at which the circle will be drawn. + * + * @param value a Float value + * @return property wrapper around Float + */ + public static Property<Float> circleOpacity(Float value) { + return new PaintProperty<>("circle-opacity", value); + } + + /** + * The opacity at which the circle will be drawn. + * + * @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); + } + + /** + * The geometry's offset. Values are [x, y] where negatives indicate left and up, respectively. + * + * @param value a Float[] value + * @return property wrapper around Float[] + */ + public static Property<Float[]> circleTranslate(Float[] value) { + return new PaintProperty<>("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[] + * @return property wrapper around a Float[] function + */ + public static Property<Function<Float[]>> circleTranslate(Function<Float[]> function) { + return new PaintProperty<>("circle-translate", function); + } + + /** + * Controls the translation reference point. + * + * @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); + } + + /** + * Controls the translation reference point. + * + * @param function a wrapper function 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); + } + + /** + * Controls the scaling behavior of the circle when the map is pitched. + * + * @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); + } + + /** + * Controls the scaling behavior of the circle when the map is pitched. + * + * @param function a wrapper function 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); + } + + /** + * The width of the circle's stroke. Strokes are placed outside of the "circle-radius". + * + * @param value a Float value + * @return property wrapper around Float + */ + public static Property<Float> circleStrokeWidth(Float value) { + return new PaintProperty<>("circle-stroke-width", value); + } + + /** + * The width of the circle's stroke. Strokes are placed outside of the "circle-radius". + * + * @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); + } + + /** + * The stroke color of the circle. + * + * @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)); + } + + /** + * The stroke color of the circle. + * + * @param value a String value + * @return property wrapper around String + */ + public static Property<String> circleStrokeColor(String value) { + return new PaintProperty<>("circle-stroke-color", value); + } + + /** + * The stroke color of the circle. + * + * @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); + } + + /** + * The opacity of the circle's stroke. + * + * @param value a Float value + * @return property wrapper around Float + */ + public static Property<Float> circleStrokeOpacity(Float value) { + return new PaintProperty<>("circle-stroke-opacity", value); + } + + /** + * The opacity of the circle's stroke. + * + * @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); + } + + /** + * The opacity at which the image will be drawn. + * + * @param value a Float value + * @return property wrapper around Float + */ + public static Property<Float> rasterOpacity(Float value) { + return new PaintProperty<>("raster-opacity", value); + } + + /** + * The opacity at which the image will be drawn. + * + * @param function a wrapper function for Float + * @return property wrapper around a Float function + */ + public static Property<Function<Float>> rasterOpacity(Function<Float> function) { + return new PaintProperty<>("raster-opacity", function); + } + + /** + * Rotates hues around the color wheel. + * + * @param value a Float value + * @return property wrapper around Float + */ + public static Property<Float> rasterHueRotate(Float value) { + return new PaintProperty<>("raster-hue-rotate", value); + } + + /** + * Rotates hues around the color wheel. + * + * @param function a wrapper function 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); + } + + /** + * Increase or reduce the brightness of the image. The value is the minimum brightness. + * + * @param value a Float value + * @return property wrapper around Float + */ + public static Property<Float> rasterBrightnessMin(Float value) { + return new PaintProperty<>("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 + * @return property wrapper around a Float function + */ + public static Property<Function<Float>> rasterBrightnessMin(Function<Float> function) { + return new PaintProperty<>("raster-brightness-min", function); + } + + /** + * Increase or reduce the brightness of the image. The value is the maximum brightness. + * + * @param value a Float value + * @return property wrapper around Float + */ + public static Property<Float> rasterBrightnessMax(Float value) { + return new PaintProperty<>("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 + * @return property wrapper around a Float function + */ + public static Property<Function<Float>> rasterBrightnessMax(Function<Float> function) { + return new PaintProperty<>("raster-brightness-max", function); + } + + /** + * Increase or reduce the saturation of the image. + * + * @param value a Float value + * @return property wrapper around Float + */ + public static Property<Float> rasterSaturation(Float value) { + return new PaintProperty<>("raster-saturation", value); + } + + /** + * Increase or reduce the saturation of the image. + * + * @param function a wrapper function for Float + * @return property wrapper around a Float function + */ + public static Property<Function<Float>> rasterSaturation(Function<Float> function) { + return new PaintProperty<>("raster-saturation", function); + } + + /** + * Increase or reduce the contrast of the image. + * + * @param value a Float value + * @return property wrapper around Float + */ + public static Property<Float> rasterContrast(Float value) { + return new PaintProperty<>("raster-contrast", value); + } + + /** + * Increase or reduce the contrast of the image. + * + * @param function a wrapper function for Float + * @return property wrapper around a Float function + */ + public static Property<Function<Float>> rasterContrast(Function<Float> function) { + return new PaintProperty<>("raster-contrast", function); + } + + /** + * Fade duration when a new tile is added. + * + * @param value a Float value + * @return property wrapper around Float + */ + public static Property<Float> rasterFadeDuration(Float value) { + return new PaintProperty<>("raster-fade-duration", value); + } + + /** + * Fade duration when a new tile is added. + * + * @param function a wrapper function 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); + } + + /** + * The color with which the background will be drawn. + * + * @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)); + } + + /** + * The color with which the background will be drawn. + * + * @param value a String value + * @return property wrapper around String + */ + public static Property<String> backgroundColor(String value) { + return new PaintProperty<>("background-color", value); + } + + /** + * The color with which the background will be drawn. + * + * @param function a wrapper function for String + * @return property wrapper around a String function + */ + public static Property<Function<String>> backgroundColor(Function<String> function) { + return new PaintProperty<>("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). + * + * @param value a String value + * @return property wrapper around String + */ + public static Property<String> backgroundPattern(String value) { + return new PaintProperty<>("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). + * + * @param function a wrapper function for String + * @return property wrapper around a String function + */ + public static Property<Function<String>> backgroundPattern(Function<String> function) { + return new PaintProperty<>("background-pattern", function); + } + + /** + * The opacity at which the background will be drawn. + * + * @param value a Float value + * @return property wrapper around Float + */ + public static Property<Float> backgroundOpacity(Float value) { + return new PaintProperty<>("background-opacity", value); + } + + /** + * The opacity at which the background will be drawn. + * + * @param function a wrapper function for Float + * @return property wrapper around a Float function + */ + public static Property<Function<Float>> backgroundOpacity(Function<Float> function) { + return new PaintProperty<>("background-opacity", function); + } + + /** + * The display of line endings. + * + * @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); + } + + /** + * The display of line endings. + * + * @param function a wrapper function for String + * @return property wrapper around a String function + */ + public static Property<Function<String>> lineCap(Function<String> function) { + return new LayoutProperty<>("line-cap", function); + } + + /** + * The display of lines when joining. + * + * @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); + } + + /** + * The display of lines when joining. + * + * @param function a wrapper function for String + * @return property wrapper around a String function + */ + public static Property<Function<String>> lineJoin(Function<String> function) { + return new LayoutProperty<>("line-join", function); + } + + /** + * Used to automatically convert miter joins to bevel joins for sharp angles. + * + * @param value a Float value + * @return property wrapper around Float + */ + public static Property<Float> lineMiterLimit(Float value) { + return new LayoutProperty<>("line-miter-limit", value); + } + + /** + * Used to automatically convert miter joins to bevel joins for sharp angles. + * + * @param function a wrapper function 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); + } + + /** + * Used to automatically convert round joins to miter joins for shallow angles. + * + * @param value a Float value + * @return property wrapper around Float + */ + public static Property<Float> lineRoundLimit(Float value) { + return new LayoutProperty<>("line-round-limit", value); + } + + /** + * Used to automatically convert round joins to miter joins for shallow angles. + * + * @param function a wrapper function 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); + } + + /** + * Label placement relative to its geometry. + * + * @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); + } + + /** + * Label placement relative to its geometry. + * + * @param function a wrapper function for String + * @return property wrapper around a String function + */ + public static Property<Function<String>> symbolPlacement(Function<String> function) { + return new LayoutProperty<>("symbol-placement", function); + } + + /** + * Distance between two symbol anchors. + * + * @param value a Float value + * @return property wrapper around Float + */ + public static Property<Float> symbolSpacing(Float value) { + return new LayoutProperty<>("symbol-spacing", value); + } + + /** + * Distance between two symbol anchors. + * + * @param function a wrapper function for Float + * @return property wrapper around a Float function + */ + public static Property<Function<Float>> symbolSpacing(Function<Float> function) { + return new LayoutProperty<>("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. + * + * @param value a Boolean value + * @return property wrapper around Boolean + */ + public static Property<Boolean> symbolAvoidEdges(Boolean value) { + return new LayoutProperty<>("symbol-avoid-edges", value); + } + + /** + * If true, the symbols will not cross tile edges to avoid mutual collisions. Recommended in layers that don't have + * enough padding in the vector tile to prevent collisions, or if it is a point symbol layer placed after a line + * symbol layer. + * + * @param function a wrapper function 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); + } + + /** + * If true, the icon will be visible even if it collides with other previously drawn symbols. + * + * @param value a Boolean value + * @return property wrapper around Boolean + */ + public static Property<Boolean> iconAllowOverlap(Boolean value) { + return new LayoutProperty<>("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 + * @return property wrapper around a Boolean function + */ + public static Property<Function<Boolean>> iconAllowOverlap(Function<Boolean> function) { + return new LayoutProperty<>("icon-allow-overlap", function); + } + + /** + * If true, other symbols can be visible even if they collide with the icon. + * + * @param value a Boolean value + * @return property wrapper around Boolean + */ + public static Property<Boolean> iconIgnorePlacement(Boolean value) { + return new LayoutProperty<>("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 + * @return property wrapper around a Boolean function + */ + public static Property<Function<Boolean>> iconIgnorePlacement(Function<Boolean> function) { + return new LayoutProperty<>("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. + * + * @param value a Boolean value + * @return property wrapper around Boolean + */ + public static Property<Boolean> iconOptional(Boolean value) { + return new LayoutProperty<>("icon-optional", value); + } + + /** + * If true, text will display without their corresponding icons when the icon collides with other symbols and the + * text does not. + * + * @param function a wrapper function for Boolean + * @return property wrapper around a Boolean function + */ + public static Property<Function<Boolean>> iconOptional(Function<Boolean> function) { + return new LayoutProperty<>("icon-optional", function); + } + + /** + * In combination with {@link Property.SYMBOL_PLACEMENT}, determines the rotation behavior of icons. + * + * @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); + } + + /** + * In combination with {@link Property.SYMBOL_PLACEMENT}, determines the rotation behavior of icons. + * + * @param function a wrapper function 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); + } + + /** + * Scale factor for icon. 1 is original size, 3 triples the size. + * + * @param value a Float value + * @return property wrapper around Float + */ + public static Property<Float> iconSize(Float value) { + return new LayoutProperty<>("icon-size", value); + } + + /** + * Scale factor for icon. 1 is original size, 3 triples the size. + * + * @param function a wrapper function for Float + * @return property wrapper around a Float function + */ + public static Property<Function<Float>> iconSize(Function<Float> function) { + return new LayoutProperty<>("icon-size", function); + } + + /** + * Scales the icon to fit around the associated text. + * + * @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); + } + + /** + * Scales the icon to fit around the associated text. + * + * @param function a wrapper function 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); + } + + /** + * 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); + } + + /** + * 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[] + * @return property wrapper around a Float[] function + */ + public static Property<Function<Float[]>> iconTextFitPadding(Function<Float[]> function) { + return new LayoutProperty<>("icon-text-fit-padding", function); + } + + /** + * A string with {tokens} replaced, referencing the data property to pull from. + * + * @param value a String value + * @return property wrapper around String + */ + public static Property<String> iconImage(String value) { + return new LayoutProperty<>("icon-image", value); + } + + /** + * A string with {tokens} replaced, referencing the data property to pull from. + * + * @param function a wrapper function for String + * @return property wrapper around a String function + */ + public static Property<Function<String>> iconImage(Function<String> function) { + return new LayoutProperty<>("icon-image", function); + } + + /** + * Rotates the icon clockwise. + * + * @param value a Float value + * @return property wrapper around Float + */ + public static Property<Float> iconRotate(Float value) { + return new LayoutProperty<>("icon-rotate", value); + } + + /** + * Rotates the icon clockwise. + * + * @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); + } + + /** + * Size of the additional area around the icon bounding box used for detecting symbol collisions. + * + * @param value a Float value + * @return property wrapper around Float + */ + public static Property<Float> iconPadding(Float value) { + return new LayoutProperty<>("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 + * @return property wrapper around a Float function + */ + public static Property<Function<Float>> iconPadding(Function<Float> function) { + return new LayoutProperty<>("icon-padding", function); + } + + /** + * If true, the icon may be flipped to prevent it from being rendered upside-down. + * + * @param value a Boolean value + * @return property wrapper around Boolean + */ + public static Property<Boolean> iconKeepUpright(Boolean value) { + return new LayoutProperty<>("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 + * @return property wrapper around a Boolean function + */ + public static Property<Function<Boolean>> iconKeepUpright(Function<Boolean> function) { + return new LayoutProperty<>("icon-keep-upright", function); + } + + /** + * Offset distance of icon 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[]> iconOffset(Float[] value) { + return new LayoutProperty<>("icon-offset", value); + } + + /** + * Offset distance of icon from its anchor. Positive values indicate right and down, while negative values indicate + * left and up. + * + * @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); + } + + /** + * Orientation of text when map is pitched. + * + * @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); + } + + /** + * Orientation of text when map is pitched. + * + * @param function a wrapper function 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); + } + + /** + * 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); + } + + /** + * 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 + * @return property wrapper around a String function + */ + public static Property<Function<String>> textRotationAlignment(Function<String> function) { + return new LayoutProperty<>("text-rotation-alignment", function); + } + + /** + * Value to use for a text label. Feature properties are specified using tokens like {field_name}. + * + * @param value a String value + * @return property wrapper around String + */ + public static Property<String> textField(String value) { + return new LayoutProperty<>("text-field", value); + } + + /** + * Value to use for a text label. Feature properties are specified using tokens like {field_name}. + * + * @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); + } + + /** + * Font stack to use for displaying text. + * + * @param value a String[] value + * @return property wrapper around String[] + */ + public static Property<String[]> textFont(String[] value) { + return new LayoutProperty<>("text-font", value); + } + + /** + * Font stack to use for displaying text. + * + * @param function a wrapper function for String[] + * @return property wrapper around a String[] function + */ + public static Property<Function<String[]>> textFont(Function<String[]> function) { + return new LayoutProperty<>("text-font", function); + } + + /** + * Font size. + * + * @param value a Float value + * @return property wrapper around Float + */ + public static Property<Float> textSize(Float value) { + return new LayoutProperty<>("text-size", value); + } + + /** + * Font size. + * + * @param function a wrapper function for Float + * @return property wrapper around a Float function + */ + public static Property<Function<Float>> textSize(Function<Float> function) { + return new LayoutProperty<>("text-size", function); + } + + /** + * The maximum line width for text wrapping. + * + * @param value a Float value + * @return property wrapper around Float + */ + public static Property<Float> textMaxWidth(Float value) { + return new LayoutProperty<>("text-max-width", value); + } + + /** + * The maximum line width for text wrapping. + * + * @param function a wrapper function 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); + } + + /** + * Text leading value for multi-line text. + * + * @param value a Float value + * @return property wrapper around Float + */ + public static Property<Float> textLineHeight(Float value) { + return new LayoutProperty<>("text-line-height", value); + } + + /** + * Text leading value for multi-line text. + * + * @param function a wrapper function 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); + } + + /** + * Text tracking amount. + * + * @param value a Float value + * @return property wrapper around Float + */ + public static Property<Float> textLetterSpacing(Float value) { + return new LayoutProperty<>("text-letter-spacing", value); + } + + /** + * Text tracking amount. + * + * @param function a wrapper function 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); + } + + /** + * Text justification options. + * + * @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); + } + + /** + * Text justification options. + * + * @param function a wrapper function for String + * @return property wrapper around a String function + */ + public static Property<Function<String>> textJustify(Function<String> function) { + return new LayoutProperty<>("text-justify", function); + } + + /** + * Part of the text placed closest to the anchor. + * + * @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); + } + + /** + * Part of the text placed closest to the anchor. + * + * @param function a wrapper function for String + * @return property wrapper around a String function + */ + public static Property<Function<String>> textAnchor(Function<String> function) { + return new LayoutProperty<>("text-anchor", function); + } + + /** + * Maximum angle change between adjacent characters. + * + * @param value a Float value + * @return property wrapper around Float + */ + public static Property<Float> textMaxAngle(Float value) { + return new LayoutProperty<>("text-max-angle", value); + } + + /** + * Maximum angle change between adjacent characters. + * + * @param function a wrapper function 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); + } + + /** + * Rotates the text clockwise. + * + * @param value a Float value + * @return property wrapper around Float + */ + public static Property<Float> textRotate(Float value) { + return new LayoutProperty<>("text-rotate", value); + } + + /** + * Rotates the text clockwise. + * + * @param function a wrapper function for Float + * @return property wrapper around a Float function + */ + public static Property<Function<Float>> textRotate(Function<Float> function) { + return new LayoutProperty<>("text-rotate", function); + } + + /** + * Size of the additional area around the text bounding box used for detecting symbol collisions. + * + * @param value a Float value + * @return property wrapper around Float + */ + public static Property<Float> textPadding(Float value) { + return new LayoutProperty<>("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 + * @return property wrapper around a Float function + */ + public static Property<Function<Float>> textPadding(Function<Float> function) { + return new LayoutProperty<>("text-padding", function); + } + + /** + * If true, the text may be flipped vertically to prevent it from being rendered upside-down. + * + * @param value a Boolean value + * @return property wrapper around Boolean + */ + public static Property<Boolean> textKeepUpright(Boolean value) { + return new LayoutProperty<>("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 + * @return property wrapper around a Boolean function + */ + public static Property<Function<Boolean>> textKeepUpright(Function<Boolean> function) { + return new LayoutProperty<>("text-keep-upright", function); + } + + /** + * Specifies how to capitalize text, similar to the CSS {@link PropertyFactory#textTransform} property. + * + * @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); + } + + /** + * Specifies how to capitalize text, similar to the CSS {@link PropertyFactory#textTransform} property. + * + * @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); + } + + /** + * 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); + } + + /** + * 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[] + * @return property wrapper around a Float[] function + */ + public static Property<Function<Float[]>> textOffset(Function<Float[]> function) { + return new LayoutProperty<>("text-offset", function); + } + + /** + * If true, the text will be visible even if it collides with other previously drawn symbols. + * + * @param value a Boolean value + * @return property wrapper around Boolean + */ + public static Property<Boolean> textAllowOverlap(Boolean value) { + return new LayoutProperty<>("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 + * @return property wrapper around a Boolean function + */ + public static Property<Function<Boolean>> textAllowOverlap(Function<Boolean> function) { + return new LayoutProperty<>("text-allow-overlap", function); + } + + /** + * If true, other symbols can be visible even if they collide with the text. + * + * @param value a Boolean value + * @return property wrapper around Boolean + */ + public static Property<Boolean> textIgnorePlacement(Boolean value) { + return new LayoutProperty<>("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 + * @return property wrapper around a Boolean function + */ + public static Property<Function<Boolean>> textIgnorePlacement(Function<Boolean> function) { + return new LayoutProperty<>("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. + * + * @param value a Boolean value + * @return property wrapper around Boolean + */ + public static Property<Boolean> textOptional(Boolean value) { + return new LayoutProperty<>("text-optional", value); + } + + /** + * If true, icons will display without their corresponding text when the text collides with other symbols and the + * icon does not. + * + * @param function a wrapper function for Boolean + * @return property wrapper around a Boolean function + */ + public static Property<Function<Boolean>> textOptional(Function<Boolean> function) { + return new LayoutProperty<>("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); + } } 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 204c154743..c404f07c76 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,56 +1,57 @@ package com.mapbox.mapboxsdk.style.layers; import android.support.annotation.Nullable; -import android.util.Log; + +import timber.log.Timber; /** * Properties for Layer */ public class PropertyValue<T> { - private static final String TAG = PropertyValue.class.getSimpleName(); - private final Object value; + private final Object value; - /* package */ PropertyValue(Object value) { - this.value = value; - } + /* package */ PropertyValue(Object value) { + this.value = value; + } - public boolean isNull() { - return value == null; - } + public boolean isNull() { + return value == null; + } - public boolean isFunction() { - return !isNull() && value instanceof Function; - } + public boolean isFunction() { + return !isNull() && value instanceof Function; + } - public boolean isValue() { - return !isNull() && !isFunction(); - } + public boolean isValue() { + return !isNull() && !isFunction(); + } - @Nullable - public Function<T> getFunction() { - if (isFunction()) { - //noinspection unchecked - return (Function<T>) value; - } else { - Log.w(TAG, "not a function, try value"); - return null; - } + @Nullable + public Function<T> getFunction() { + if (isFunction()) { + //noinspection unchecked + return (Function<T>) value; + } else { + Timber.w("not a function, try value"); + return null; } - - @Nullable - public T getValue() { - if (isValue()) { - //noinspection unchecked - return (T) value; - } else { - Log.w(TAG, "not a value, try function"); - return null; - } + } + + @Nullable + public T getValue() { + if (isValue()) { + //noinspection unchecked + return (T) value; + } else { + Timber.w("not a value, try function"); + return null; } + } - @Override - public String toString() { - return String.format("%s (%s)", getClass().getSimpleName(), value != null ? value.getClass().getSimpleName() : null); - } + @Override + public String toString() { + return String.format("%s (%s)", getClass().getSimpleName(), value != null + ? value.getClass().getSimpleName() : null); + } } 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 e5f33aced6..785106c394 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,168 +1,157 @@ -// This file is generated. Edit android/platform/scripts/generate-style-code.js, then run `make style-code-android`. package com.mapbox.mapboxsdk.style.layers; +// This file is generated. Edit android/platform/scripts/generate-style-code.js, then run `make android-style-code`. -import com.mapbox.mapboxsdk.exceptions.ConversionException; - -import android.support.annotation.ColorInt; import android.support.annotation.NonNull; - -import static com.mapbox.mapboxsdk.utils.ColorUtils.*; +import android.support.annotation.UiThread; /** * Raster map textures such as satellite imagery. * * @see <a href="https://www.mapbox.com/mapbox-gl-style-spec/#layers-raster">The online documentation</a> */ +@UiThread public class RasterLayer extends Layer { - /** - * Creates a RasterLayer. - * - * @param nativePtr pointer used by core - */ - public RasterLayer(long nativePtr) { - super(nativePtr); - } - - /** - * Creates a RasterLayer. - * - * @param layerId the id of the layer - * @param sourceId the id of the source - */ - public RasterLayer(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) { - checkValidity(); - nativeSetSourceLayer(sourceLayer); - } - - /** - * Set the source Layer. - * - * @param sourceLayer the source layer to set - * @return This - */ - public RasterLayer withSourceLayer(String sourceLayer) { - setSourceLayer(sourceLayer); - return this; - } - - /** - * Set a property or properties. - * - * @param properties the var-args properties - * @return This - */ - public RasterLayer withProperties(@NonNull Property<?>... properties) { - setProperties(properties); - return this; - } - - // Property getters - - /** - * Get the RasterOpacity property - * - * @return property wrapper value around Float - */ - @SuppressWarnings("unchecked") - public PropertyValue<Float> getRasterOpacity() { - checkValidity(); - return (PropertyValue<Float>) new PropertyValue(nativeGetRasterOpacity()); - } - - /** - * Get the RasterHueRotate property - * - * @return property wrapper value around Float - */ - @SuppressWarnings("unchecked") - public PropertyValue<Float> getRasterHueRotate() { - checkValidity(); - return (PropertyValue<Float>) new PropertyValue(nativeGetRasterHueRotate()); - } - - /** - * Get the RasterBrightnessMin property - * - * @return property wrapper value around Float - */ - @SuppressWarnings("unchecked") - public PropertyValue<Float> getRasterBrightnessMin() { - checkValidity(); - return (PropertyValue<Float>) new PropertyValue(nativeGetRasterBrightnessMin()); - } - - /** - * Get the RasterBrightnessMax property - * - * @return property wrapper value around Float - */ - @SuppressWarnings("unchecked") - public PropertyValue<Float> getRasterBrightnessMax() { - checkValidity(); - return (PropertyValue<Float>) new PropertyValue(nativeGetRasterBrightnessMax()); - } - - /** - * Get the RasterSaturation property - * - * @return property wrapper value around Float - */ - @SuppressWarnings("unchecked") - public PropertyValue<Float> getRasterSaturation() { - checkValidity(); - return (PropertyValue<Float>) new PropertyValue(nativeGetRasterSaturation()); - } - - /** - * Get the RasterContrast property - * - * @return property wrapper value around Float - */ - @SuppressWarnings("unchecked") - public PropertyValue<Float> getRasterContrast() { - checkValidity(); - return (PropertyValue<Float>) new PropertyValue(nativeGetRasterContrast()); - } - - /** - * Get the RasterFadeDuration property - * - * @return property wrapper value around Float - */ - @SuppressWarnings("unchecked") - public PropertyValue<Float> getRasterFadeDuration() { - checkValidity(); - return (PropertyValue<Float>) new PropertyValue(nativeGetRasterFadeDuration()); - } - - private native Object nativeGetRasterOpacity(); - - private native Object nativeGetRasterHueRotate(); - - private native Object nativeGetRasterBrightnessMin(); - - private native Object nativeGetRasterBrightnessMax(); - - private native Object nativeGetRasterSaturation(); - - private native Object nativeGetRasterContrast(); - - private native Object nativeGetRasterFadeDuration(); - - - @Override - protected native void finalize() throws Throwable; + /** + * Creates a RasterLayer. + * + * @param nativePtr pointer used by core + */ + public RasterLayer(long nativePtr) { + super(nativePtr); + } + + /** + * Creates a RasterLayer. + * + * @param layerId the id of the layer + * @param sourceId the id of the source + */ + public RasterLayer(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 RasterLayer withSourceLayer(String sourceLayer) { + setSourceLayer(sourceLayer); + return this; + } + + /** + * Set a property or properties. + * + * @param properties the var-args properties + * @return This + */ + public RasterLayer withProperties(@NonNull Property<?>... properties) { + setProperties(properties); + return this; + } + + // Property getters + + /** + * Get the RasterOpacity property + * + * @return property wrapper value around Float + */ + @SuppressWarnings("unchecked") + public PropertyValue<Float> getRasterOpacity() { + return (PropertyValue<Float>) new PropertyValue(nativeGetRasterOpacity()); + } + + /** + * Get the RasterHueRotate property + * + * @return property wrapper value around Float + */ + @SuppressWarnings("unchecked") + public PropertyValue<Float> getRasterHueRotate() { + return (PropertyValue<Float>) new PropertyValue(nativeGetRasterHueRotate()); + } + + /** + * Get the RasterBrightnessMin property + * + * @return property wrapper value around Float + */ + @SuppressWarnings("unchecked") + public PropertyValue<Float> getRasterBrightnessMin() { + return (PropertyValue<Float>) new PropertyValue(nativeGetRasterBrightnessMin()); + } + + /** + * Get the RasterBrightnessMax property + * + * @return property wrapper value around Float + */ + @SuppressWarnings("unchecked") + public PropertyValue<Float> getRasterBrightnessMax() { + return (PropertyValue<Float>) new PropertyValue(nativeGetRasterBrightnessMax()); + } + + /** + * Get the RasterSaturation property + * + * @return property wrapper value around Float + */ + @SuppressWarnings("unchecked") + public PropertyValue<Float> getRasterSaturation() { + return (PropertyValue<Float>) new PropertyValue(nativeGetRasterSaturation()); + } + + /** + * Get the RasterContrast property + * + * @return property wrapper value around Float + */ + @SuppressWarnings("unchecked") + public PropertyValue<Float> getRasterContrast() { + return (PropertyValue<Float>) new PropertyValue(nativeGetRasterContrast()); + } + + /** + * Get the RasterFadeDuration property + * + * @return property wrapper value around Float + */ + @SuppressWarnings("unchecked") + public PropertyValue<Float> getRasterFadeDuration() { + return (PropertyValue<Float>) new PropertyValue(nativeGetRasterFadeDuration()); + } + + private native Object nativeGetRasterOpacity(); + + private native Object nativeGetRasterHueRotate(); + + private native Object nativeGetRasterBrightnessMin(); + + private native Object nativeGetRasterBrightnessMax(); + + private native Object nativeGetRasterSaturation(); + + private native Object nativeGetRasterContrast(); + + private native Object nativeGetRasterFadeDuration(); + + + @Override + protected native void finalize() throws Throwable; } 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 4ceebd8bc1..abc516d6d0 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,811 +1,761 @@ -// This file is generated. Edit android/platform/scripts/generate-style-code.js, then run `make style-code-android`. package com.mapbox.mapboxsdk.style.layers; - -import com.mapbox.mapboxsdk.exceptions.ConversionException; +// This file is generated. Edit android/platform/scripts/generate-style-code.js, then run `make android-style-code`. 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; /** * An icon or a text label. * * @see <a href="https://www.mapbox.com/mapbox-gl-style-spec/#layers-symbol">The online documentation</a> */ +@UiThread public class SymbolLayer extends Layer { - /** - * Creates a SymbolLayer. - * - * @param nativePtr pointer used by core - */ - public SymbolLayer(long nativePtr) { - super(nativePtr); - } - - /** - * Creates a SymbolLayer. - * - * @param layerId the id of the layer - * @param sourceId the id of the source - */ - public SymbolLayer(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) { - checkValidity(); - nativeSetSourceLayer(sourceLayer); - } - - /** - * Set the source Layer. - * - * @param sourceLayer the source layer to set - * @return This - */ - public SymbolLayer withSourceLayer(String sourceLayer) { - setSourceLayer(sourceLayer); - return this; - } - /** - * Set a single filter. - * - * @param filter the filter to set - */ - public void setFilter(Filter.Statement filter) { - checkValidity(); - this.setFilter(filter.toArray()); - } - - /** - * Set an array of filters. - * - * @param filter the filter array to set - */ - public void setFilter(Object[] filter) { - checkValidity(); - 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; - } - - /** - * Set a single filter. - * - * @param filter the filter to set - * @return This - */ - public SymbolLayer withFilter(Filter.Statement filter) { - setFilter(filter); - return this; - } - - - /** - * Set a property or properties. - * - * @param properties the var-args properties - * @return This - */ - public SymbolLayer withProperties(@NonNull Property<?>... properties) { - setProperties(properties); - return this; - } - - // Property getters - - /** - * Get the SymbolPlacement property - * - * @return property wrapper value around String - */ - @SuppressWarnings("unchecked") - public PropertyValue<String> getSymbolPlacement() { - checkValidity(); - return (PropertyValue<String>) new PropertyValue(nativeGetSymbolPlacement()); - } - - /** - * Get the SymbolSpacing property - * - * @return property wrapper value around Float - */ - @SuppressWarnings("unchecked") - public PropertyValue<Float> getSymbolSpacing() { - checkValidity(); - return (PropertyValue<Float>) new PropertyValue(nativeGetSymbolSpacing()); - } - - /** - * Get the SymbolAvoidEdges property - * - * @return property wrapper value around Boolean - */ - @SuppressWarnings("unchecked") - public PropertyValue<Boolean> getSymbolAvoidEdges() { - checkValidity(); - return (PropertyValue<Boolean>) new PropertyValue(nativeGetSymbolAvoidEdges()); - } - - /** - * Get the IconAllowOverlap property - * - * @return property wrapper value around Boolean - */ - @SuppressWarnings("unchecked") - public PropertyValue<Boolean> getIconAllowOverlap() { - checkValidity(); - return (PropertyValue<Boolean>) new PropertyValue(nativeGetIconAllowOverlap()); - } - - /** - * Get the IconIgnorePlacement property - * - * @return property wrapper value around Boolean - */ - @SuppressWarnings("unchecked") - public PropertyValue<Boolean> getIconIgnorePlacement() { - checkValidity(); - return (PropertyValue<Boolean>) new PropertyValue(nativeGetIconIgnorePlacement()); - } - - /** - * Get the IconOptional property - * - * @return property wrapper value around Boolean - */ - @SuppressWarnings("unchecked") - public PropertyValue<Boolean> getIconOptional() { - checkValidity(); - return (PropertyValue<Boolean>) new PropertyValue(nativeGetIconOptional()); - } - - /** - * Get the IconRotationAlignment property - * - * @return property wrapper value around String - */ - @SuppressWarnings("unchecked") - public PropertyValue<String> getIconRotationAlignment() { - checkValidity(); - return (PropertyValue<String>) new PropertyValue(nativeGetIconRotationAlignment()); - } - - /** - * Get the IconSize property - * - * @return property wrapper value around Float - */ - @SuppressWarnings("unchecked") - public PropertyValue<Float> getIconSize() { - checkValidity(); - return (PropertyValue<Float>) new PropertyValue(nativeGetIconSize()); - } - - /** - * Get the IconTextFit property - * - * @return property wrapper value around String - */ - @SuppressWarnings("unchecked") - public PropertyValue<String> getIconTextFit() { - checkValidity(); - return (PropertyValue<String>) new PropertyValue(nativeGetIconTextFit()); - } - - /** - * Get the IconTextFitPadding property - * - * @return property wrapper value around Float[] - */ - @SuppressWarnings("unchecked") - public PropertyValue<Float[]> getIconTextFitPadding() { - checkValidity(); - return (PropertyValue<Float[]>) new PropertyValue(nativeGetIconTextFitPadding()); - } - - /** - * Get the IconImage property - * - * @return property wrapper value around String - */ - @SuppressWarnings("unchecked") - public PropertyValue<String> getIconImage() { - checkValidity(); - return (PropertyValue<String>) new PropertyValue(nativeGetIconImage()); - } - - /** - * Get the IconRotate property - * - * @return property wrapper value around Float - */ - @SuppressWarnings("unchecked") - public PropertyValue<Float> getIconRotate() { - checkValidity(); - return (PropertyValue<Float>) new PropertyValue(nativeGetIconRotate()); - } - - /** - * Get the IconPadding property - * - * @return property wrapper value around Float - */ - @SuppressWarnings("unchecked") - public PropertyValue<Float> getIconPadding() { - checkValidity(); - return (PropertyValue<Float>) new PropertyValue(nativeGetIconPadding()); - } - - /** - * Get the IconKeepUpright property - * - * @return property wrapper value around Boolean - */ - @SuppressWarnings("unchecked") - public PropertyValue<Boolean> getIconKeepUpright() { - checkValidity(); - return (PropertyValue<Boolean>) new PropertyValue(nativeGetIconKeepUpright()); - } - - /** - * Get the IconOffset property - * - * @return property wrapper value around Float[] - */ - @SuppressWarnings("unchecked") - public PropertyValue<Float[]> getIconOffset() { - checkValidity(); - return (PropertyValue<Float[]>) new PropertyValue(nativeGetIconOffset()); - } - - /** - * Get the TextPitchAlignment property - * - * @return property wrapper value around String - */ - @SuppressWarnings("unchecked") - public PropertyValue<String> getTextPitchAlignment() { - checkValidity(); - return (PropertyValue<String>) new PropertyValue(nativeGetTextPitchAlignment()); - } - - /** - * Get the TextRotationAlignment property - * - * @return property wrapper value around String - */ - @SuppressWarnings("unchecked") - public PropertyValue<String> getTextRotationAlignment() { - checkValidity(); - return (PropertyValue<String>) new PropertyValue(nativeGetTextRotationAlignment()); - } - - /** - * Get the TextField property - * - * @return property wrapper value around String - */ - @SuppressWarnings("unchecked") - public PropertyValue<String> getTextField() { - checkValidity(); - return (PropertyValue<String>) new PropertyValue(nativeGetTextField()); - } - - /** - * Get the TextFont property - * - * @return property wrapper value around String[] - */ - @SuppressWarnings("unchecked") - public PropertyValue<String[]> getTextFont() { - checkValidity(); - return (PropertyValue<String[]>) new PropertyValue(nativeGetTextFont()); - } - - /** - * Get the TextSize property - * - * @return property wrapper value around Float - */ - @SuppressWarnings("unchecked") - public PropertyValue<Float> getTextSize() { - checkValidity(); - return (PropertyValue<Float>) new PropertyValue(nativeGetTextSize()); - } - - /** - * Get the TextMaxWidth property - * - * @return property wrapper value around Float - */ - @SuppressWarnings("unchecked") - public PropertyValue<Float> getTextMaxWidth() { - checkValidity(); - return (PropertyValue<Float>) new PropertyValue(nativeGetTextMaxWidth()); - } - - /** - * Get the TextLineHeight property - * - * @return property wrapper value around Float - */ - @SuppressWarnings("unchecked") - public PropertyValue<Float> getTextLineHeight() { - checkValidity(); - return (PropertyValue<Float>) new PropertyValue(nativeGetTextLineHeight()); - } - - /** - * Get the TextLetterSpacing property - * - * @return property wrapper value around Float - */ - @SuppressWarnings("unchecked") - public PropertyValue<Float> getTextLetterSpacing() { - checkValidity(); - return (PropertyValue<Float>) new PropertyValue(nativeGetTextLetterSpacing()); - } - - /** - * Get the TextJustify property - * - * @return property wrapper value around String - */ - @SuppressWarnings("unchecked") - public PropertyValue<String> getTextJustify() { - checkValidity(); - return (PropertyValue<String>) new PropertyValue(nativeGetTextJustify()); - } - - /** - * Get the TextAnchor property - * - * @return property wrapper value around String - */ - @SuppressWarnings("unchecked") - public PropertyValue<String> getTextAnchor() { - checkValidity(); - return (PropertyValue<String>) new PropertyValue(nativeGetTextAnchor()); - } - - /** - * Get the TextMaxAngle property - * - * @return property wrapper value around Float - */ - @SuppressWarnings("unchecked") - public PropertyValue<Float> getTextMaxAngle() { - checkValidity(); - return (PropertyValue<Float>) new PropertyValue(nativeGetTextMaxAngle()); - } - - /** - * Get the TextRotate property - * - * @return property wrapper value around Float - */ - @SuppressWarnings("unchecked") - public PropertyValue<Float> getTextRotate() { - checkValidity(); - return (PropertyValue<Float>) new PropertyValue(nativeGetTextRotate()); - } - - /** - * Get the TextPadding property - * - * @return property wrapper value around Float - */ - @SuppressWarnings("unchecked") - public PropertyValue<Float> getTextPadding() { - checkValidity(); - return (PropertyValue<Float>) new PropertyValue(nativeGetTextPadding()); - } - - /** - * Get the TextKeepUpright property - * - * @return property wrapper value around Boolean - */ - @SuppressWarnings("unchecked") - public PropertyValue<Boolean> getTextKeepUpright() { - checkValidity(); - return (PropertyValue<Boolean>) new PropertyValue(nativeGetTextKeepUpright()); - } - - /** - * Get the TextTransform property - * - * @return property wrapper value around String - */ - @SuppressWarnings("unchecked") - public PropertyValue<String> getTextTransform() { - checkValidity(); - return (PropertyValue<String>) new PropertyValue(nativeGetTextTransform()); - } - - /** - * Get the TextOffset property - * - * @return property wrapper value around Float[] - */ - @SuppressWarnings("unchecked") - public PropertyValue<Float[]> getTextOffset() { - checkValidity(); - return (PropertyValue<Float[]>) new PropertyValue(nativeGetTextOffset()); - } - - /** - * Get the TextAllowOverlap property - * - * @return property wrapper value around Boolean - */ - @SuppressWarnings("unchecked") - public PropertyValue<Boolean> getTextAllowOverlap() { - checkValidity(); - return (PropertyValue<Boolean>) new PropertyValue(nativeGetTextAllowOverlap()); - } - - /** - * Get the TextIgnorePlacement property - * - * @return property wrapper value around Boolean - */ - @SuppressWarnings("unchecked") - public PropertyValue<Boolean> getTextIgnorePlacement() { - checkValidity(); - return (PropertyValue<Boolean>) new PropertyValue(nativeGetTextIgnorePlacement()); - } - - /** - * Get the TextOptional property - * - * @return property wrapper value around Boolean - */ - @SuppressWarnings("unchecked") - public PropertyValue<Boolean> getTextOptional() { - checkValidity(); - return (PropertyValue<Boolean>) new PropertyValue(nativeGetTextOptional()); - } - - /** - * Get the IconOpacity property - * - * @return property wrapper value around Float - */ - @SuppressWarnings("unchecked") - public PropertyValue<Float> getIconOpacity() { - checkValidity(); - return (PropertyValue<Float>) new PropertyValue(nativeGetIconOpacity()); - } - - /** - * Get the IconColor property - * - * @return property wrapper value around String - */ - @SuppressWarnings("unchecked") - public PropertyValue<String> getIconColor() { - checkValidity(); - return (PropertyValue<String>) new PropertyValue(nativeGetIconColor()); - } - /** - * The color of the icon. This can only be used with sdf icons. - * - * @return int representation of a rgba string color - * @throws RuntimeException thrown if property isn't a value - */ - @ColorInt - public int getIconColorAsInt() { - checkValidity(); - PropertyValue<String> value = getIconColor(); - if (value.isValue()) { - return rgbaToColor(value.getValue()); - } else { - throw new RuntimeException("icon-color was set as a Function"); - } - } + /** + * Creates a SymbolLayer. + * + * @param nativePtr pointer used by core + */ + public SymbolLayer(long nativePtr) { + super(nativePtr); + } + + /** + * Creates a SymbolLayer. + * + * @param layerId the id of the layer + * @param sourceId the id of the source + */ + public SymbolLayer(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 SymbolLayer withSourceLayer(String sourceLayer) { + setSourceLayer(sourceLayer); + return this; + } + + /** + * 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 SymbolLayer withFilter(Object[] filter) { + setFilter(filter); + return this; + } + + /** + * Set a single filter. + * + * @param filter the filter to set + * @return This + */ + public SymbolLayer withFilter(Filter.Statement filter) { + setFilter(filter); + return this; + } + + + /** + * Set a property or properties. + * + * @param properties the var-args properties + * @return This + */ + public SymbolLayer withProperties(@NonNull Property<?>... properties) { + setProperties(properties); + return this; + } + + // Property getters + + /** + * Get the SymbolPlacement property + * + * @return property wrapper value around String + */ + @SuppressWarnings("unchecked") + public PropertyValue<String> getSymbolPlacement() { + return (PropertyValue<String>) new PropertyValue(nativeGetSymbolPlacement()); + } + + /** + * Get the SymbolSpacing property + * + * @return property wrapper value around Float + */ + @SuppressWarnings("unchecked") + public PropertyValue<Float> getSymbolSpacing() { + return (PropertyValue<Float>) new PropertyValue(nativeGetSymbolSpacing()); + } + + /** + * Get the SymbolAvoidEdges property + * + * @return property wrapper value around Boolean + */ + @SuppressWarnings("unchecked") + public PropertyValue<Boolean> getSymbolAvoidEdges() { + return (PropertyValue<Boolean>) new PropertyValue(nativeGetSymbolAvoidEdges()); + } + + /** + * Get the IconAllowOverlap property + * + * @return property wrapper value around Boolean + */ + @SuppressWarnings("unchecked") + public PropertyValue<Boolean> getIconAllowOverlap() { + return (PropertyValue<Boolean>) new PropertyValue(nativeGetIconAllowOverlap()); + } + + /** + * Get the IconIgnorePlacement property + * + * @return property wrapper value around Boolean + */ + @SuppressWarnings("unchecked") + public PropertyValue<Boolean> getIconIgnorePlacement() { + return (PropertyValue<Boolean>) new PropertyValue(nativeGetIconIgnorePlacement()); + } + + /** + * Get the IconOptional property + * + * @return property wrapper value around Boolean + */ + @SuppressWarnings("unchecked") + public PropertyValue<Boolean> getIconOptional() { + return (PropertyValue<Boolean>) new PropertyValue(nativeGetIconOptional()); + } + + /** + * Get the IconRotationAlignment property + * + * @return property wrapper value around String + */ + @SuppressWarnings("unchecked") + public PropertyValue<String> getIconRotationAlignment() { + return (PropertyValue<String>) new PropertyValue(nativeGetIconRotationAlignment()); + } + + /** + * Get the IconSize property + * + * @return property wrapper value around Float + */ + @SuppressWarnings("unchecked") + public PropertyValue<Float> getIconSize() { + return (PropertyValue<Float>) new PropertyValue(nativeGetIconSize()); + } + + /** + * Get the IconTextFit property + * + * @return property wrapper value around String + */ + @SuppressWarnings("unchecked") + public PropertyValue<String> getIconTextFit() { + return (PropertyValue<String>) new PropertyValue(nativeGetIconTextFit()); + } + + /** + * Get the IconTextFitPadding property + * + * @return property wrapper value around Float[] + */ + @SuppressWarnings("unchecked") + public PropertyValue<Float[]> getIconTextFitPadding() { + return (PropertyValue<Float[]>) new PropertyValue(nativeGetIconTextFitPadding()); + } + + /** + * Get the IconImage property + * + * @return property wrapper value around String + */ + @SuppressWarnings("unchecked") + public PropertyValue<String> getIconImage() { + return (PropertyValue<String>) new PropertyValue(nativeGetIconImage()); + } + + /** + * Get the IconRotate property + * + * @return property wrapper value around Float + */ + @SuppressWarnings("unchecked") + public PropertyValue<Float> getIconRotate() { + return (PropertyValue<Float>) new PropertyValue(nativeGetIconRotate()); + } + + /** + * Get the IconPadding property + * + * @return property wrapper value around Float + */ + @SuppressWarnings("unchecked") + public PropertyValue<Float> getIconPadding() { + return (PropertyValue<Float>) new PropertyValue(nativeGetIconPadding()); + } + + /** + * Get the IconKeepUpright property + * + * @return property wrapper value around Boolean + */ + @SuppressWarnings("unchecked") + public PropertyValue<Boolean> getIconKeepUpright() { + return (PropertyValue<Boolean>) new PropertyValue(nativeGetIconKeepUpright()); + } + + /** + * Get the IconOffset property + * + * @return property wrapper value around Float[] + */ + @SuppressWarnings("unchecked") + public PropertyValue<Float[]> getIconOffset() { + return (PropertyValue<Float[]>) new PropertyValue(nativeGetIconOffset()); + } + + /** + * Get the TextPitchAlignment property + * + * @return property wrapper value around String + */ + @SuppressWarnings("unchecked") + public PropertyValue<String> getTextPitchAlignment() { + return (PropertyValue<String>) new PropertyValue(nativeGetTextPitchAlignment()); + } + + /** + * Get the TextRotationAlignment property + * + * @return property wrapper value around String + */ + @SuppressWarnings("unchecked") + public PropertyValue<String> getTextRotationAlignment() { + return (PropertyValue<String>) new PropertyValue(nativeGetTextRotationAlignment()); + } + + /** + * Get the TextField property + * + * @return property wrapper value around String + */ + @SuppressWarnings("unchecked") + public PropertyValue<String> getTextField() { + return (PropertyValue<String>) new PropertyValue(nativeGetTextField()); + } + + /** + * Get the TextFont property + * + * @return property wrapper value around String[] + */ + @SuppressWarnings("unchecked") + public PropertyValue<String[]> getTextFont() { + return (PropertyValue<String[]>) new PropertyValue(nativeGetTextFont()); + } + + /** + * Get the TextSize property + * + * @return property wrapper value around Float + */ + @SuppressWarnings("unchecked") + public PropertyValue<Float> getTextSize() { + return (PropertyValue<Float>) new PropertyValue(nativeGetTextSize()); + } + + /** + * Get the TextMaxWidth property + * + * @return property wrapper value around Float + */ + @SuppressWarnings("unchecked") + public PropertyValue<Float> getTextMaxWidth() { + return (PropertyValue<Float>) new PropertyValue(nativeGetTextMaxWidth()); + } + + /** + * Get the TextLineHeight property + * + * @return property wrapper value around Float + */ + @SuppressWarnings("unchecked") + public PropertyValue<Float> getTextLineHeight() { + return (PropertyValue<Float>) new PropertyValue(nativeGetTextLineHeight()); + } + + /** + * Get the TextLetterSpacing property + * + * @return property wrapper value around Float + */ + @SuppressWarnings("unchecked") + public PropertyValue<Float> getTextLetterSpacing() { + return (PropertyValue<Float>) new PropertyValue(nativeGetTextLetterSpacing()); + } + + /** + * Get the TextJustify property + * + * @return property wrapper value around String + */ + @SuppressWarnings("unchecked") + public PropertyValue<String> getTextJustify() { + return (PropertyValue<String>) new PropertyValue(nativeGetTextJustify()); + } + + /** + * Get the TextAnchor property + * + * @return property wrapper value around String + */ + @SuppressWarnings("unchecked") + public PropertyValue<String> getTextAnchor() { + return (PropertyValue<String>) new PropertyValue(nativeGetTextAnchor()); + } + + /** + * Get the TextMaxAngle property + * + * @return property wrapper value around Float + */ + @SuppressWarnings("unchecked") + public PropertyValue<Float> getTextMaxAngle() { + return (PropertyValue<Float>) new PropertyValue(nativeGetTextMaxAngle()); + } + + /** + * Get the TextRotate property + * + * @return property wrapper value around Float + */ + @SuppressWarnings("unchecked") + public PropertyValue<Float> getTextRotate() { + return (PropertyValue<Float>) new PropertyValue(nativeGetTextRotate()); + } + + /** + * Get the TextPadding property + * + * @return property wrapper value around Float + */ + @SuppressWarnings("unchecked") + public PropertyValue<Float> getTextPadding() { + return (PropertyValue<Float>) new PropertyValue(nativeGetTextPadding()); + } + + /** + * Get the TextKeepUpright property + * + * @return property wrapper value around Boolean + */ + @SuppressWarnings("unchecked") + public PropertyValue<Boolean> getTextKeepUpright() { + return (PropertyValue<Boolean>) new PropertyValue(nativeGetTextKeepUpright()); + } + + /** + * Get the TextTransform property + * + * @return property wrapper value around String + */ + @SuppressWarnings("unchecked") + public PropertyValue<String> getTextTransform() { + return (PropertyValue<String>) new PropertyValue(nativeGetTextTransform()); + } + + /** + * Get the TextOffset property + * + * @return property wrapper value around Float[] + */ + @SuppressWarnings("unchecked") + public PropertyValue<Float[]> getTextOffset() { + return (PropertyValue<Float[]>) new PropertyValue(nativeGetTextOffset()); + } + + /** + * Get the TextAllowOverlap property + * + * @return property wrapper value around Boolean + */ + @SuppressWarnings("unchecked") + public PropertyValue<Boolean> getTextAllowOverlap() { + return (PropertyValue<Boolean>) new PropertyValue(nativeGetTextAllowOverlap()); + } + + /** + * Get the TextIgnorePlacement property + * + * @return property wrapper value around Boolean + */ + @SuppressWarnings("unchecked") + public PropertyValue<Boolean> getTextIgnorePlacement() { + return (PropertyValue<Boolean>) new PropertyValue(nativeGetTextIgnorePlacement()); + } + + /** + * Get the TextOptional property + * + * @return property wrapper value around Boolean + */ + @SuppressWarnings("unchecked") + public PropertyValue<Boolean> getTextOptional() { + return (PropertyValue<Boolean>) new PropertyValue(nativeGetTextOptional()); + } + + /** + * Get the IconOpacity property + * + * @return property wrapper value around Float + */ + @SuppressWarnings("unchecked") + public PropertyValue<Float> getIconOpacity() { + return (PropertyValue<Float>) new PropertyValue(nativeGetIconOpacity()); + } + + /** + * Get the IconColor property + * + * @return property wrapper value around String + */ + @SuppressWarnings("unchecked") + public PropertyValue<String> getIconColor() { + return (PropertyValue<String>) new PropertyValue(nativeGetIconColor()); + } + + /** + * The color of the icon. This can only be used with sdf icons. + * + * @return int representation of a rgba string color + * @throws RuntimeException thrown if property isn't a value + */ + @ColorInt + public int getIconColorAsInt() { + PropertyValue<String> value = getIconColor(); + if (value.isValue()) { + return rgbaToColor(value.getValue()); + } else { + throw new RuntimeException("icon-color was set as a Function"); + } + } + + + /** + * Get the IconHaloColor property + * + * @return property wrapper value around String + */ + @SuppressWarnings("unchecked") + public PropertyValue<String> getIconHaloColor() { + return (PropertyValue<String>) new PropertyValue(nativeGetIconHaloColor()); + } + + /** + * The color of the icon's halo. Icon halos can only be used with SDF icons. + * + * @return int representation of a rgba string color + * @throws RuntimeException thrown if property isn't a value + */ + @ColorInt + public int getIconHaloColorAsInt() { + PropertyValue<String> value = getIconHaloColor(); + if (value.isValue()) { + return rgbaToColor(value.getValue()); + } else { + throw new RuntimeException("icon-halo-color was set as a Function"); + } + } + + + /** + * Get the IconHaloWidth property + * + * @return property wrapper value around Float + */ + @SuppressWarnings("unchecked") + public PropertyValue<Float> getIconHaloWidth() { + return (PropertyValue<Float>) new PropertyValue(nativeGetIconHaloWidth()); + } + + /** + * Get the IconHaloBlur property + * + * @return property wrapper value around Float + */ + @SuppressWarnings("unchecked") + public PropertyValue<Float> getIconHaloBlur() { + return (PropertyValue<Float>) new PropertyValue(nativeGetIconHaloBlur()); + } + + /** + * Get the IconTranslate property + * + * @return property wrapper value around Float[] + */ + @SuppressWarnings("unchecked") + public PropertyValue<Float[]> getIconTranslate() { + return (PropertyValue<Float[]>) new PropertyValue(nativeGetIconTranslate()); + } + + /** + * Get the IconTranslateAnchor property + * + * @return property wrapper value around String + */ + @SuppressWarnings("unchecked") + public PropertyValue<String> getIconTranslateAnchor() { + return (PropertyValue<String>) new PropertyValue(nativeGetIconTranslateAnchor()); + } + + /** + * Get the TextOpacity property + * + * @return property wrapper value around Float + */ + @SuppressWarnings("unchecked") + public PropertyValue<Float> getTextOpacity() { + return (PropertyValue<Float>) new PropertyValue(nativeGetTextOpacity()); + } + + /** + * Get the TextColor property + * + * @return property wrapper value around String + */ + @SuppressWarnings("unchecked") + public PropertyValue<String> getTextColor() { + return (PropertyValue<String>) new PropertyValue(nativeGetTextColor()); + } + + /** + * The color with which the text will be drawn. + * + * @return int representation of a rgba string color + * @throws RuntimeException thrown if property isn't a value + */ + @ColorInt + public int getTextColorAsInt() { + PropertyValue<String> value = getTextColor(); + if (value.isValue()) { + return rgbaToColor(value.getValue()); + } else { + throw new RuntimeException("text-color was set as a Function"); + } + } + + + /** + * Get the TextHaloColor property + * + * @return property wrapper value around String + */ + @SuppressWarnings("unchecked") + public PropertyValue<String> getTextHaloColor() { + return (PropertyValue<String>) new PropertyValue(nativeGetTextHaloColor()); + } + + /** + * The color of the text's halo, which helps it stand out from backgrounds. + * + * @return int representation of a rgba string color + * @throws RuntimeException thrown if property isn't a value + */ + @ColorInt + public int getTextHaloColorAsInt() { + PropertyValue<String> value = getTextHaloColor(); + if (value.isValue()) { + return rgbaToColor(value.getValue()); + } else { + throw new RuntimeException("text-halo-color was set as a Function"); + } + } + + + /** + * Get the TextHaloWidth property + * + * @return property wrapper value around Float + */ + @SuppressWarnings("unchecked") + public PropertyValue<Float> getTextHaloWidth() { + return (PropertyValue<Float>) new PropertyValue(nativeGetTextHaloWidth()); + } - - /** - * Get the IconHaloColor property - * - * @return property wrapper value around String - */ - @SuppressWarnings("unchecked") - public PropertyValue<String> getIconHaloColor() { - checkValidity(); - return (PropertyValue<String>) new PropertyValue(nativeGetIconHaloColor()); - } - /** - * The color of the icon's halo. Icon halos can only be used with SDF icons. - * - * @return int representation of a rgba string color - * @throws RuntimeException thrown if property isn't a value - */ - @ColorInt - public int getIconHaloColorAsInt() { - checkValidity(); - PropertyValue<String> value = getIconHaloColor(); - if (value.isValue()) { - return rgbaToColor(value.getValue()); - } else { - throw new RuntimeException("icon-halo-color was set as a Function"); - } - } + /** + * Get the TextHaloBlur property + * + * @return property wrapper value around Float + */ + @SuppressWarnings("unchecked") + public PropertyValue<Float> getTextHaloBlur() { + return (PropertyValue<Float>) new PropertyValue(nativeGetTextHaloBlur()); + } - - /** - * Get the IconHaloWidth property - * - * @return property wrapper value around Float - */ - @SuppressWarnings("unchecked") - public PropertyValue<Float> getIconHaloWidth() { - checkValidity(); - return (PropertyValue<Float>) new PropertyValue(nativeGetIconHaloWidth()); - } - - /** - * Get the IconHaloBlur property - * - * @return property wrapper value around Float - */ - @SuppressWarnings("unchecked") - public PropertyValue<Float> getIconHaloBlur() { - checkValidity(); - return (PropertyValue<Float>) new PropertyValue(nativeGetIconHaloBlur()); - } - - /** - * Get the IconTranslate property - * - * @return property wrapper value around Float[] - */ - @SuppressWarnings("unchecked") - public PropertyValue<Float[]> getIconTranslate() { - checkValidity(); - return (PropertyValue<Float[]>) new PropertyValue(nativeGetIconTranslate()); - } - - /** - * Get the IconTranslateAnchor property - * - * @return property wrapper value around String - */ - @SuppressWarnings("unchecked") - public PropertyValue<String> getIconTranslateAnchor() { - checkValidity(); - return (PropertyValue<String>) new PropertyValue(nativeGetIconTranslateAnchor()); - } - - /** - * Get the TextOpacity property - * - * @return property wrapper value around Float - */ - @SuppressWarnings("unchecked") - public PropertyValue<Float> getTextOpacity() { - checkValidity(); - return (PropertyValue<Float>) new PropertyValue(nativeGetTextOpacity()); - } - - /** - * Get the TextColor property - * - * @return property wrapper value around String - */ - @SuppressWarnings("unchecked") - public PropertyValue<String> getTextColor() { - checkValidity(); - return (PropertyValue<String>) new PropertyValue(nativeGetTextColor()); - } - /** - * The color with which the text will be drawn. - * - * @return int representation of a rgba string color - * @throws RuntimeException thrown if property isn't a value - */ - @ColorInt - public int getTextColorAsInt() { - checkValidity(); - PropertyValue<String> value = getTextColor(); - if (value.isValue()) { - return rgbaToColor(value.getValue()); - } else { - throw new RuntimeException("text-color was set as a Function"); - } - } + /** + * Get the TextTranslate property + * + * @return property wrapper value around Float[] + */ + @SuppressWarnings("unchecked") + public PropertyValue<Float[]> getTextTranslate() { + return (PropertyValue<Float[]>) new PropertyValue(nativeGetTextTranslate()); + } - - /** - * Get the TextHaloColor property - * - * @return property wrapper value around String - */ - @SuppressWarnings("unchecked") - public PropertyValue<String> getTextHaloColor() { - checkValidity(); - return (PropertyValue<String>) new PropertyValue(nativeGetTextHaloColor()); - } - /** - * The color of the text's halo, which helps it stand out from backgrounds. - * - * @return int representation of a rgba string color - * @throws RuntimeException thrown if property isn't a value - */ - @ColorInt - public int getTextHaloColorAsInt() { - checkValidity(); - PropertyValue<String> value = getTextHaloColor(); - if (value.isValue()) { - return rgbaToColor(value.getValue()); - } else { - throw new RuntimeException("text-halo-color was set as a Function"); - } - } + /** + * Get the TextTranslateAnchor property + * + * @return property wrapper value around String + */ + @SuppressWarnings("unchecked") + public PropertyValue<String> getTextTranslateAnchor() { + return (PropertyValue<String>) new PropertyValue(nativeGetTextTranslateAnchor()); + } - - /** - * Get the TextHaloWidth property - * - * @return property wrapper value around Float - */ - @SuppressWarnings("unchecked") - public PropertyValue<Float> getTextHaloWidth() { - checkValidity(); - return (PropertyValue<Float>) new PropertyValue(nativeGetTextHaloWidth()); - } - - /** - * Get the TextHaloBlur property - * - * @return property wrapper value around Float - */ - @SuppressWarnings("unchecked") - public PropertyValue<Float> getTextHaloBlur() { - checkValidity(); - return (PropertyValue<Float>) new PropertyValue(nativeGetTextHaloBlur()); - } - - /** - * Get the TextTranslate property - * - * @return property wrapper value around Float[] - */ - @SuppressWarnings("unchecked") - public PropertyValue<Float[]> getTextTranslate() { - checkValidity(); - return (PropertyValue<Float[]>) new PropertyValue(nativeGetTextTranslate()); - } - - /** - * Get the TextTranslateAnchor property - * - * @return property wrapper value around String - */ - @SuppressWarnings("unchecked") - public PropertyValue<String> getTextTranslateAnchor() { - checkValidity(); - return (PropertyValue<String>) new PropertyValue(nativeGetTextTranslateAnchor()); - } - - private native Object nativeGetSymbolPlacement(); + private native Object nativeGetSymbolPlacement(); - private native Object nativeGetSymbolSpacing(); + private native Object nativeGetSymbolSpacing(); - private native Object nativeGetSymbolAvoidEdges(); + private native Object nativeGetSymbolAvoidEdges(); - private native Object nativeGetIconAllowOverlap(); + private native Object nativeGetIconAllowOverlap(); - private native Object nativeGetIconIgnorePlacement(); + private native Object nativeGetIconIgnorePlacement(); - private native Object nativeGetIconOptional(); + private native Object nativeGetIconOptional(); - private native Object nativeGetIconRotationAlignment(); + private native Object nativeGetIconRotationAlignment(); - private native Object nativeGetIconSize(); + private native Object nativeGetIconSize(); - private native Object nativeGetIconTextFit(); + private native Object nativeGetIconTextFit(); - private native Object nativeGetIconTextFitPadding(); + private native Object nativeGetIconTextFitPadding(); - private native Object nativeGetIconImage(); + private native Object nativeGetIconImage(); - private native Object nativeGetIconRotate(); + private native Object nativeGetIconRotate(); - private native Object nativeGetIconPadding(); + private native Object nativeGetIconPadding(); - private native Object nativeGetIconKeepUpright(); + private native Object nativeGetIconKeepUpright(); - private native Object nativeGetIconOffset(); + private native Object nativeGetIconOffset(); - private native Object nativeGetTextPitchAlignment(); + private native Object nativeGetTextPitchAlignment(); - private native Object nativeGetTextRotationAlignment(); + private native Object nativeGetTextRotationAlignment(); - private native Object nativeGetTextField(); + private native Object nativeGetTextField(); - private native Object nativeGetTextFont(); + private native Object nativeGetTextFont(); - private native Object nativeGetTextSize(); + private native Object nativeGetTextSize(); - private native Object nativeGetTextMaxWidth(); + private native Object nativeGetTextMaxWidth(); - private native Object nativeGetTextLineHeight(); + private native Object nativeGetTextLineHeight(); - private native Object nativeGetTextLetterSpacing(); + private native Object nativeGetTextLetterSpacing(); - private native Object nativeGetTextJustify(); + private native Object nativeGetTextJustify(); - private native Object nativeGetTextAnchor(); + private native Object nativeGetTextAnchor(); - private native Object nativeGetTextMaxAngle(); + private native Object nativeGetTextMaxAngle(); - private native Object nativeGetTextRotate(); + private native Object nativeGetTextRotate(); - private native Object nativeGetTextPadding(); + private native Object nativeGetTextPadding(); - private native Object nativeGetTextKeepUpright(); + private native Object nativeGetTextKeepUpright(); - private native Object nativeGetTextTransform(); + private native Object nativeGetTextTransform(); - private native Object nativeGetTextOffset(); + private native Object nativeGetTextOffset(); - private native Object nativeGetTextAllowOverlap(); + private native Object nativeGetTextAllowOverlap(); - private native Object nativeGetTextIgnorePlacement(); + private native Object nativeGetTextIgnorePlacement(); - private native Object nativeGetTextOptional(); + private native Object nativeGetTextOptional(); - private native Object nativeGetIconOpacity(); + private native Object nativeGetIconOpacity(); - private native Object nativeGetIconColor(); + private native Object nativeGetIconColor(); - private native Object nativeGetIconHaloColor(); + private native Object nativeGetIconHaloColor(); - private native Object nativeGetIconHaloWidth(); + private native Object nativeGetIconHaloWidth(); - private native Object nativeGetIconHaloBlur(); + private native Object nativeGetIconHaloBlur(); - private native Object nativeGetIconTranslate(); + private native Object nativeGetIconTranslate(); - private native Object nativeGetIconTranslateAnchor(); + private native Object nativeGetIconTranslateAnchor(); - private native Object nativeGetTextOpacity(); + private native Object nativeGetTextOpacity(); - private native Object nativeGetTextColor(); + private native Object nativeGetTextColor(); - private native Object nativeGetTextHaloColor(); + private native Object nativeGetTextHaloColor(); - private native Object nativeGetTextHaloWidth(); + private native Object nativeGetTextHaloWidth(); - private native Object nativeGetTextHaloBlur(); + private native Object nativeGetTextHaloBlur(); - private native Object nativeGetTextTranslate(); + private native Object nativeGetTextTranslate(); - private native Object nativeGetTextTranslateAnchor(); + private native Object nativeGetTextTranslateAnchor(); - @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/layer.java.ejs b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/layer.java.ejs index f7865c6b6c..4657037df8 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 @@ -3,10 +3,10 @@ const properties = locals.properties; const doc = locals.doc; -%> -// This file is generated. Edit android/platform/scripts/generate-style-code.js, then run `make style-code-android`. +// 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 com.mapbox.mapboxsdk.exceptions.ConversionException; +import android.support.annotation.UiThread; import android.support.annotation.ColorInt; import android.support.annotation.NonNull; @@ -18,6 +18,7 @@ import static com.mapbox.mapboxsdk.utils.ColorUtils.*; * * @see <a href="https://www.mapbox.com/mapbox-gl-style-spec/#layers-<%- type %>">The online documentation</a> */ +@UiThread public class <%- camelize(type) %>Layer extends Layer { /** @@ -59,7 +60,6 @@ public class <%- camelize(type) %>Layer extends Layer { * @param sourceLayer the source layer to set */ public void setSourceLayer(String sourceLayer) { - checkValidity(); nativeSetSourceLayer(sourceLayer); } @@ -81,7 +81,6 @@ public class <%- camelize(type) %>Layer extends Layer { * @param filter the filter to set */ public void setFilter(Filter.Statement filter) { - checkValidity(); this.setFilter(filter.toArray()); } @@ -91,7 +90,6 @@ public class <%- camelize(type) %>Layer extends Layer { * @param filter the filter array to set */ public void setFilter(Object[] filter) { - checkValidity(); nativeSetFilter(filter); } @@ -140,7 +138,6 @@ public class <%- camelize(type) %>Layer extends Layer { */ @SuppressWarnings("unchecked") public PropertyValue<<%- propertyType(property) %>> get<%- camelize(property.name) %>() { - checkValidity(); return (PropertyValue<<%- propertyType(property) %>>) new PropertyValue(nativeGet<%- camelize(property.name) %>()); } <% if (property.type == 'color') { -%> @@ -152,7 +149,6 @@ public class <%- camelize(type) %>Layer extends Layer { */ @ColorInt public int get<%- camelize(property.name) %>AsInt() { - checkValidity(); PropertyValue<<%- propertyType(property) %>> value = get<%- camelize(property.name) %>(); if (value.isValue()) { return rgbaToColor(value.getValue()); 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 bad6f87a8e..3ce691775c 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 @@ -1,7 +1,7 @@ <% const properties = locals.properties; -%> -// This file is generated. Edit android/platform/scripts/generate-style-code.js, then run `make style-code-android`. +// 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; 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 a6e2aff839..e9b7b6dcd1 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 @@ -2,7 +2,7 @@ const paintProperties = locals.paintProperties; const layoutProperties = locals.layoutProperties; -%> -// This file is generated. Edit android/platform/scripts/generate-style-code.js, then run `make style-code-android`. +// 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; diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/CannotAddSourceException.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/CannotAddSourceException.java new file mode 100644 index 0000000000..ddc4c58cf1 --- /dev/null +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/CannotAddSourceException.java @@ -0,0 +1,12 @@ +package com.mapbox.mapboxsdk.style.sources; + +/** + * Thrown when adding a source to a map twice + */ +public class CannotAddSourceException extends RuntimeException { + + public CannotAddSourceException(String message) { + super(message); + } + +} diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/GeoJsonOptions.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/GeoJsonOptions.java index 55a9799cb7..27a3d5c898 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/GeoJsonOptions.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/GeoJsonOptions.java @@ -9,70 +9,72 @@ import java.util.HashMap; */ public class GeoJsonOptions extends HashMap<String, Object> { - /** - * Maximum zoom level at which to create vector tiles (higher means greater detail at high zoom levels). - * - * @param maxZoom the maximum zoom - Defaults to 18. - * @return the current instance for chaining - */ - public GeoJsonOptions withMaxZoom(int maxZoom) { - this.put("maxzoom", maxZoom); - return this; - } + /** + * Maximum zoom level at which to create vector tiles (higher means greater detail at high zoom levels). + * + * @param maxZoom the maximum zoom - Defaults to 18. + * @return the current instance for chaining + */ + public GeoJsonOptions withMaxZoom(int maxZoom) { + this.put("maxzoom", maxZoom); + return this; + } - /** - * Tile buffer size on each side (measured in 1/512ths of a tile; higher means fewer rendering artifacts near tile edges but slower performance). - * - * @param buffer the buffer size - Defaults to 128. - * @return the current instance for chaining - */ - public GeoJsonOptions withBuffer(int buffer) { - this.put("buffer", buffer); - return this; - } + /** + * Tile buffer size on each side (measured in 1/512ths of a tile; higher means fewer rendering artifacts near tile + * edges but slower performance). + * + * @param buffer the buffer size - Defaults to 128. + * @return the current instance for chaining + */ + public GeoJsonOptions withBuffer(int buffer) { + this.put("buffer", buffer); + return this; + } - /** - * Douglas-Peucker simplification tolerance (higher means simpler geometries and faster performance). - * - * @param tolerance the tolerance - Defaults to 0.375 - * @return the current instance for chaining - */ - public GeoJsonOptions withTolerance(float tolerance) { - this.put("tolerance", tolerance); - return this; - } + /** + * Douglas-Peucker simplification tolerance (higher means simpler geometries and faster performance). + * + * @param tolerance the tolerance - Defaults to 0.375 + * @return the current instance for chaining + */ + public GeoJsonOptions withTolerance(float tolerance) { + this.put("tolerance", tolerance); + return this; + } - /** - * If the data is a collection of point features, setting this to true clusters the points by radius into groups. - * - * @param cluster cluster? - Defaults to false - * @return the current instance for chaining - */ - public GeoJsonOptions withCluster(boolean cluster) { - this.put("cluster", cluster); - return this; - } + /** + * If the data is a collection of point features, setting this to true clusters the points by radius into groups. + * + * @param cluster cluster? - Defaults to false + * @return the current instance for chaining + */ + public GeoJsonOptions withCluster(boolean cluster) { + this.put("cluster", cluster); + return this; + } - /** - * Max zoom to cluster points on. - * - * @param clusterMaxZoom clusterMaxZoom cluster maximum zoom - Defaults to one zoom less than maxzoom (so that last zoom features are not clustered) - * @return the current instance for chaining - */ - public GeoJsonOptions withClusterMaxZoom(int clusterMaxZoom) { - this.put("clusterMaxZoom", clusterMaxZoom); - return this; - } + /** + * Max zoom to cluster points on. + * + * @param clusterMaxZoom clusterMaxZoom cluster maximum zoom - Defaults to one zoom less than maxzoom (so that last + * zoom features are not clustered) + * @return the current instance for chaining + */ + public GeoJsonOptions withClusterMaxZoom(int clusterMaxZoom) { + this.put("clusterMaxZoom", clusterMaxZoom); + return this; + } - /** - * Radius of each cluster when clustering points, measured in 1/512ths of a tile. - * - * @param clusterRadius cluster radius - Defaults to 50 - * @return the current instance for chaining - */ - public GeoJsonOptions withClusterRadius(int clusterRadius) { - this.put("clusterRadius", clusterRadius); - return this; - } + /** + * Radius of each cluster when clustering points, measured in 1/512ths of a tile. + * + * @param clusterRadius cluster radius - Defaults to 50 + * @return the current instance for chaining + */ + public GeoJsonOptions withClusterRadius(int clusterRadius) { + this.put("clusterRadius", clusterRadius); + return this; + } } 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 80730d143c..0c2ee42ea0 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 @@ -14,166 +14,166 @@ import java.util.HashMap; */ public class GeoJsonSource extends Source { - /** - * Internal use - * - * @param nativePtr - pointer to native peer - */ - public GeoJsonSource(long nativePtr) { - super(nativePtr); + /** + * Internal use + * + * @param nativePtr - pointer to native peer + */ + public GeoJsonSource(long nativePtr) { + super(nativePtr); + } + + /** + * Create an empty GeoJsonSource + * + * @param id the source id + */ + public GeoJsonSource(String id) { + initialize(id, null); + setGeoJson(FeatureCollection.fromFeatures(new ArrayList<Feature>())); + } + + /** + * Create an empty GeoJsonSource with non-default {@link GeoJsonOptions} + * + * @param id the source id + * @param options options + */ + public GeoJsonSource(String id, GeoJsonOptions options) { + initialize(id, options); + setGeoJson(FeatureCollection.fromFeatures(new ArrayList<Feature>())); + } + + /** + * Create a GeoJsonSource from a raw json string + * + * @param id the source id + * @param geoJson raw Json FeatureCollection + */ + public GeoJsonSource(String id, String geoJson) { + if (geoJson == null || geoJson.startsWith("http")) { + throw new IllegalArgumentException("Expected a raw json body"); } - - /** - * Create an empty GeoJsonSource - * - * @param id the source id - */ - public GeoJsonSource(String id) { - initialize(id, null); - setGeoJson(FeatureCollection.fromFeatures(new ArrayList<Feature>())); - } - - /** - * Create an empty GeoJsonSource with non-default {@link GeoJsonOptions} - * - * @param id the source id - * @param options options - */ - public GeoJsonSource(String id, GeoJsonOptions options) { - initialize(id, options); - setGeoJson(FeatureCollection.fromFeatures(new ArrayList<Feature>())); - } - - /** - * Create a GeoJsonSource from a raw json string - * - * @param id the source id - * @param geoJson raw Json FeatureCollection - */ - public GeoJsonSource(String id, String geoJson) { - if (geoJson == null || geoJson.startsWith("http")) { - throw new IllegalArgumentException("Expected a raw json body"); - } - initialize(id, null); - setGeoJson(geoJson); - } - - /** - * Create a GeoJsonSource from a raw json string and non-default {@link GeoJsonOptions} - * - * @param id the source id - * @param geoJson raw Json body - * @param options options - */ - public GeoJsonSource(String id, String geoJson, GeoJsonOptions options) { - if (geoJson == null || geoJson.startsWith("http")) { - throw new IllegalArgumentException("Expected a raw json body"); - } - initialize(id, options); - setGeoJson(geoJson); - } - - /** - * Create a GeoJsonSource from a remote geo json file - * - * @param id the source id - * @param url remote json file - */ - public GeoJsonSource(String id, URL url) { - initialize(id, null); - nativeSetUrl(url.toExternalForm()); - } - - /** - * Create a GeoJsonSource from a remote geo json file and non-default {@link GeoJsonOptions} - * - * @param id the source id - * @param url remote json file - * @param options options - */ - public GeoJsonSource(String id, URL url, GeoJsonOptions options) { - initialize(id, options); - nativeSetUrl(url.toExternalForm()); - } - - /** - * Create a GeoJsonSource from a {@link FeatureCollection} - * - * @param id the source id - * @param features the features - */ - public GeoJsonSource(String id, FeatureCollection features) { - initialize(id, null); - setGeoJson(features); - } - - /** - * Create a GeoJsonSource from a {@link FeatureCollection} and non-default {@link GeoJsonOptions} - * - * @param id the source id - * @param features the features - * @param options options - */ - public GeoJsonSource(String id, FeatureCollection features, GeoJsonOptions options) { - initialize(id, options); - setGeoJson(features); + initialize(id, null); + setGeoJson(geoJson); + } + + /** + * Create a GeoJsonSource from a raw json string and non-default {@link GeoJsonOptions} + * + * @param id the source id + * @param geoJson raw Json body + * @param options options + */ + public GeoJsonSource(String id, String geoJson, GeoJsonOptions options) { + if (geoJson == null || geoJson.startsWith("http")) { + throw new IllegalArgumentException("Expected a raw json body"); } - - /** - * Updates the GeoJson - * - * @param features the GeoJSON {@link FeatureCollection} - */ - public void setGeoJson(FeatureCollection features) { - checkValidity(); - setGeoJson(features.toJson()); - } - - /** - * Updates the GeoJson - * - * @param json the raw GeoJson FeatureCollection string - */ - public void setGeoJson(String json) { - checkValidity(); - setRawJson(json); - } - - /** - * Updates the url - * - * @param url the GeoJSON FeatureCollection url - */ - public void setUrl(URL url) { - checkValidity(); - setUrl(url.toExternalForm()); - } - - /** - * Updates the url - * - * @param url the GeoJSON FeatureCollection url - */ - public void setUrl(String url) { - checkValidity(); - nativeSetUrl(url); - } - - protected void setRawJson(String geoJson) { - //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); - } - - protected native void initialize(String layerId, Object options); - - protected native void nativeSetUrl(String url); - - private native void nativeSetGeoJson(Object geoJson); - - @Override - protected native void finalize() throws Throwable; + initialize(id, options); + setGeoJson(geoJson); + } + + /** + * Create a GeoJsonSource from a remote geo json file + * + * @param id the source id + * @param url remote json file + */ + public GeoJsonSource(String id, URL url) { + initialize(id, null); + nativeSetUrl(url.toExternalForm()); + } + + /** + * Create a GeoJsonSource from a remote geo json file and non-default {@link GeoJsonOptions} + * + * @param id the source id + * @param url remote json file + * @param options options + */ + public GeoJsonSource(String id, URL url, GeoJsonOptions options) { + initialize(id, options); + nativeSetUrl(url.toExternalForm()); + } + + /** + * Create a GeoJsonSource from a {@link FeatureCollection} + * + * @param id the source id + * @param features the features + */ + public GeoJsonSource(String id, FeatureCollection features) { + initialize(id, null); + setGeoJson(features); + } + + /** + * Create a GeoJsonSource from a {@link FeatureCollection} and non-default {@link GeoJsonOptions} + * + * @param id the source id + * @param features the features + * @param options options + */ + public GeoJsonSource(String id, FeatureCollection features, GeoJsonOptions options) { + initialize(id, options); + setGeoJson(features); + } + + /** + * Updates the GeoJson + * + * @param features the GeoJSON {@link FeatureCollection} + */ + public void setGeoJson(FeatureCollection features) { + checkValidity(); + setGeoJson(features.toJson()); + } + + /** + * Updates the GeoJson + * + * @param json the raw GeoJson FeatureCollection string + */ + public void setGeoJson(String json) { + checkValidity(); + setRawJson(json); + } + + /** + * Updates the url + * + * @param url the GeoJSON FeatureCollection url + */ + public void setUrl(URL url) { + checkValidity(); + setUrl(url.toExternalForm()); + } + + /** + * Updates the url + * + * @param url the GeoJSON FeatureCollection url + */ + public void setUrl(String url) { + checkValidity(); + nativeSetUrl(url); + } + + protected void setRawJson(String geoJson) { + //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); + } + + protected native void initialize(String layerId, Object options); + + protected native void nativeSetUrl(String url); + + private native void nativeSetGeoJson(Object geoJson); + + @Override + protected native void finalize() throws Throwable; } 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 index 4622d72445..06d35b598b 100644 --- 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 @@ -5,7 +5,7 @@ package com.mapbox.mapboxsdk.style.sources; */ public class NoSuchSourceException extends Exception { - public NoSuchSourceException(String message) { - super(message); - } + public NoSuchSourceException(String message) { + super(message); + } } diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/RasterSource.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/RasterSource.java index 7a7ae49909..eabbdb8395 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/RasterSource.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/RasterSource.java @@ -8,72 +8,72 @@ import java.net.URL; * @see <a href="https://www.mapbox.com/mapbox-gl-style-spec/#sources-raster">The style specification</a> */ public class RasterSource extends Source { - public static final int DEFAULT_TILE_SIZE = 512; + public static final int DEFAULT_TILE_SIZE = 512; - /** - * Internal use - * - * @param nativePtr - pointer to native peer - */ - public RasterSource(long nativePtr) { - super(nativePtr); - } + /** + * Internal use + * + * @param nativePtr - pointer to native peer + */ + public RasterSource(long nativePtr) { + super(nativePtr); + } - /** - * Create the raster source from an URL - * - * @param id the source id - * @param url the source url - */ - public RasterSource(String id, URL url) { - this(id, url.toExternalForm()); - } + /** + * Create the raster source from an URL + * + * @param id the source id + * @param url the source url + */ + public RasterSource(String id, URL url) { + this(id, url.toExternalForm()); + } - /** - * Create the raster source from an URL - * - * @param id the source id - * @param url the source url - */ - public RasterSource(String id, String url) { - initialize(id, url, DEFAULT_TILE_SIZE); - } + /** + * Create the raster source from an URL + * + * @param id the source id + * @param url the source url + */ + public RasterSource(String id, String url) { + initialize(id, url, DEFAULT_TILE_SIZE); + } - /** - * Create the raster source from an URL with a specific tile size - * - * @param id the source id - * @param url the source url - * @param tileSize the tile size - */ - public RasterSource(String id, String url, int tileSize) { - initialize(id, url, tileSize); - } + /** + * Create the raster source from an URL with a specific tile size + * + * @param id the source id + * @param url the source url + * @param tileSize the tile size + */ + public RasterSource(String id, String url, int tileSize) { + initialize(id, url, tileSize); + } - /** - * Create the raster source from a {@link TileSet} - * - * @param id the source id - * @param tileSet the {@link TileSet} - */ - public RasterSource(String id, TileSet tileSet) { - initialize(id, tileSet.toValueObject(), DEFAULT_TILE_SIZE); - } + /** + * Create the raster source from a {@link TileSet} + * + * @param id the source id + * @param tileSet the {@link TileSet} + */ + public RasterSource(String id, TileSet tileSet) { + initialize(id, tileSet.toValueObject(), DEFAULT_TILE_SIZE); + } - /** - * Create the raster source from a {@link TileSet} with a specific tile size - * - * @param id the source id - * @param tileSet the {@link TileSet} - * @param tileSize tje tile size - */ - public RasterSource(String id, TileSet tileSet, int tileSize) { - initialize(id, tileSet.toValueObject(), tileSize); - } + /** + * Create the raster source from a {@link TileSet} with a specific tile size + * + * @param id the source id + * @param tileSet the {@link TileSet} + * @param tileSize tje tile size + */ + public RasterSource(String id, TileSet tileSet, int tileSize) { + initialize(id, tileSet.toValueObject(), tileSize); + } - protected native void initialize(String layerId, Object payload, int tileSize); + protected native void initialize(String layerId, Object payload, int tileSize); - @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/sources/Source.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/Source.java index 0856b117dc..6826fed1b5 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/Source.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/Source.java @@ -4,52 +4,52 @@ package com.mapbox.mapboxsdk.style.sources; * Base Peer class for sources. see source.hpp for the other half of the peer. */ public abstract class Source { - private long nativePtr; - private boolean invalidated; - - /** - * Internal use - * - * @param nativePtr - pointer to native peer - */ - public Source(long nativePtr) { - this.nativePtr = nativePtr; - } - - public Source() { - } - - /** - * Retrieve the source id - * - * @return the source id - */ - public String getId() { - checkValidity(); - return nativeGetId(); - } - - /** - * Internal use - * - * @return the native peer pointer - */ - public long getNativePtr() { - return nativePtr; - } - - protected native String nativeGetId(); - - protected void checkValidity() { - if (invalidated) { - throw new RuntimeException("Layer has been invalidated. Request a new reference after adding"); - } - } - - /** - * Internal use - invalidates the source for further use (after adding it to the map) - */ - public final void invalidate() { - this.invalidated = true; + private long nativePtr; + private boolean invalidated; + + /** + * Internal use + * + * @param nativePtr - pointer to native peer + */ + public Source(long nativePtr) { + this.nativePtr = nativePtr; + } + + public Source() { + } + + /** + * Retrieve the source id + * + * @return the source id + */ + public String getId() { + checkValidity(); + return nativeGetId(); + } + + /** + * Internal use + * + * @return the native peer pointer + */ + public long getNativePtr() { + return nativePtr; + } + + protected native String nativeGetId(); + + protected void checkValidity() { + if (invalidated) { + throw new RuntimeException("Layer has been invalidated. Request a new reference after adding"); } + } + + /** + * Internal use - invalidates the source for further use (after adding it to the map) + */ + public final void invalidate() { + this.invalidated = true; + } } diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/TileSet.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/TileSet.java index b645020c21..9f403c2fb9 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/TileSet.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/TileSet.java @@ -13,304 +13,307 @@ import java.util.Map; * @see <a href="https://github.com/mapbox/tilejson-spec/tree/master/2.1.0">The tileset specification</a> */ public class TileSet { - private final String tilejson; - private String name; - private String description; - private String version; - private String attribution; - private String template; - private String legend; - private String scheme; - private final String[] tiles; - private String[] grids; - private String[] data; - private Float minZoom; - private Float maxZoom; - private Float[] bounds; - private Float[] center; - - /** - * @param tilejson A semver.org style version number. Describes the version of the TileJSON spec that is implemented by this JSON object. - * @param tiles An array of tile endpoints. {z}, {x} and {y}, if present, are replaced with the corresponding integers. - * If multiple endpoints are specified, clients may use any combination of endpoints. All endpoints MUST return the same - * content for the same URL. The array MUST contain at least one endpoint. - * Example: "http:localhost:8888/admin/1.0.0/world-light,broadband/{z}/{x}/{y}.png" - */ - public TileSet(String tilejson, String... tiles) { - this.tilejson = tilejson; - this.tiles = tiles; + private final String tilejson; + private String name; + private String description; + private String version; + private String attribution; + private String template; + private String legend; + private String scheme; + private final String[] tiles; + private String[] grids; + private String[] data; + private Float minZoom; + private Float maxZoom; + private Float[] bounds; + private Float[] center; + + /** + * @param tilejson A semver.org style version number. Describes the version of the TileJSON spec that is implemented + * by this JSON object. + * @param tiles An array of tile endpoints. {z}, {x} and {y}, if present, are replaced with the corresponding + * integers. + * If multiple endpoints are specified, clients may use any combination of endpoints. All endpoints + * MUST return the same + * content for the same URL. The array MUST contain at least one endpoint. + * Example: "http:localhost:8888/admin/1.0.0/world-light,broadband/{z}/{x}/{y}.png" + */ + public TileSet(String tilejson, String... tiles) { + this.tilejson = tilejson; + this.tiles = tiles; + } + + public String getTilejson() { + return tilejson; + } + + public String getName() { + return name; + } + + /** + * A name describing the tileset. The name can + * contain any legal character. Implementations SHOULD NOT interpret the + * name as HTML. + * "name": "compositing", + * + * @param name the name to be set + */ + public void setName(String name) { + this.name = name; + } + + public String getDescription() { + return description; + } + + /** + * A text description of the tileset. The + * description can contain any legal character. + * Implementations SHOULD NOT + * interpret the description as HTML. + * "description": "A simple, light grey world." + * + * @param description the description to set + */ + public void setDescription(String description) { + this.description = description; + } + + public String getVersion() { + return version; + } + + public void setVersion(String version) { + this.version = version; + } + + public String getAttribution() { + return attribution; + } + + /** + * Default: null. Contains an attribution to be displayed + * when the map is shown to a user. Implementations MAY decide to treat this + * as HTML or literal text. For security reasons, make absolutely sure that + * this field can't be abused as a vector for XSS or beacon tracking. + * "attribution": "<a href='http:openstreetmap.org'>OSM contributors</a>", + * + * @param attribution the attribution to set + */ + public void setAttribution(String attribution) { + this.attribution = attribution; + } + + public String getTemplate() { + return template; + } + + /** + * Contains a mustache template to be used to + * format data from grids for interaction. + * See https:github.com/mapbox/utfgrid-spec/tree/master/1.2 + * for the interactivity specification. + * "template": "{{#__teaser__}}{{NAME}}{{/__teaser__}}" + * + * @param template the template to set + */ + public void setTemplate(String template) { + this.template = template; + } + + public String getLegend() { + return legend; + } + + /** + * Contains a legend to be displayed with the map. + * Implementations MAY decide to treat this as HTML or literal text. + * For security reasons, make absolutely sure that this field can't be + * abused as a vector for XSS or beacon tracking. + * "legend": "Dangerous zones are red, safe zones are green" + * + * @param legend the legend to set + */ + public void setLegend(String legend) { + this.legend = legend; + } + + public String getScheme() { + return scheme; + } + + /** + * Default: "xyz". Either "xyz" or "tms". Influences the y + * direction of the tile coordinates. + * The global-mercator (aka Spherical Mercator) profile is assumed. + * "scheme": "xyz" + * + * @param scheme the scheme to set + */ + public void setScheme(String scheme) { + this.scheme = scheme; + } + + public String[] getTiles() { + return tiles; + } + + public String[] getGrids() { + return grids; + } + + /** + * An array of interactivity endpoints. {z}, {x} + * and {y}, if present, are replaced with the corresponding integers. If multiple + * endpoints are specified, clients may use any combination of endpoints. + * All endpoints MUST return the same content for the same URL. + * If the array doesn't contain any entries, interactivity is not supported + * for this tileset. See https:github.com/mapbox/utfgrid-spec/tree/master/1.2 + * for the interactivity specification. + * <p> + * Example: "http:localhost:8888/admin/1.0.0/broadband/{z}/{x}/{y}.grid.json" + * </p> + * + * @param grids the grids to set + */ + public void setGrids(String... grids) { + this.grids = grids; + } + + public String[] getData() { + return data; + } + + /** + * An array of data files in GeoJSON format. + * {z}, {x} and {y}, if present, + * are replaced with the corresponding integers. If multiple + * endpoints are specified, clients may use any combination of endpoints. + * All endpoints MUST return the same content for the same URL. + * If the array doesn't contain any entries, then no data is present in + * the map. + * <p> + * "http:localhost:8888/admin/data.geojson" + * </p> + * + * @param data the data array to set + */ + public void setData(String... data) { + this.data = data; + } + + public float getMinZoom() { + return minZoom; + } + + /** + * 0. >= 0, < 22. An integer specifying the minimum zoom level. + * + * @param minZoom the minZoom level to set + */ + public void setMinZoom(float minZoom) { + this.minZoom = minZoom; + } + + public float getMaxZoom() { + return maxZoom; + } + + /** + * 0. >= 0, <= 22. An integer specifying the maximum zoom level. + * + * @param maxZoom the maxZoom level to set + */ + public void setMaxZoom(float maxZoom) { + this.maxZoom = maxZoom; + } + + public Float[] getBounds() { + return bounds; + } + + /** + * Default: [-180, -90, 180, 90]. The maximum extent of available map tiles. Bounds MUST define an area + * covered by all zoom levels. The bounds are represented in WGS:84 + * latitude and longitude values, in the order left, bottom, right, top. + * Values may be integers or floating point numbers. + * + * @param bounds the Float array to set + */ + public void setBounds(@Size(value = 4) Float... bounds) { + this.bounds = bounds; + } + + public Float[] getCenter() { + return center; + } + + /** + * The first value is the longitude, the second is latitude (both in + * WGS:84 values), the third value is the zoom level as an integer. + * Longitude and latitude MUST be within the specified bounds. + * The zoom level MUST be between minzoom and maxzoom. + * Implementations can use this value to set the default location. If the + * value is null, implementations may use their own algorithm for + * determining a default location. + * + * @param center the Float array to set + */ + public void setCenter(@Size(value = 2) Float... center) { + this.center = center; + } + + public void setCenter(LatLng center) { + this.center = new Float[] {(float) center.getLongitude(), (float) center.getLatitude()}; + } + + Map<String, Object> toValueObject() { + Map<String, Object> result = new HashMap<>(); + result.put("tilejson", tilejson); + result.put("tiles", tiles); + + if (name != null) { + result.put("name", name); } - - public String getTilejson() { - return tilejson; - } - - public String getName() { - return name; - } - - /** - * A name describing the tileset. The name can - * contain any legal character. Implementations SHOULD NOT interpret the - * name as HTML. - * "name": "compositing", - * - * @param name the name to be set - */ - public void setName(String name) { - this.name = name; - } - - public String getDescription() { - return description; - } - - /** - * A text description of the tileset. The - * description can contain any legal character. - * Implementations SHOULD NOT - * interpret the description as HTML. - * "description": "A simple, light grey world." - * - * @param description the description to set - */ - public void setDescription(String description) { - this.description = description; - } - - public String getVersion() { - return version; - } - - public void setVersion(String version) { - this.version = version; + if (description != null) { + result.put("description", description); } - - public String getAttribution() { - return attribution; + if (version != null) { + result.put("version", version); } - - /** - * Default: null. Contains an attribution to be displayed - * when the map is shown to a user. Implementations MAY decide to treat this - * as HTML or literal text. For security reasons, make absolutely sure that - * this field can't be abused as a vector for XSS or beacon tracking. - * "attribution": "<a href='http:openstreetmap.org'>OSM contributors</a>", - * - * @param attribution the attribution to set - */ - public void setAttribution(String attribution) { - this.attribution = attribution; + if (attribution != null) { + result.put("attribution", attribution); } - - public String getTemplate() { - return template; + if (template != null) { + result.put("template", template); } - - /** - * Contains a mustache template to be used to - * format data from grids for interaction. - * See https:github.com/mapbox/utfgrid-spec/tree/master/1.2 - * for the interactivity specification. - * "template": "{{#__teaser__}}{{NAME}}{{/__teaser__}}" - * - * @param template the template to set - */ - public void setTemplate(String template) { - this.template = template; + if (legend != null) { + result.put("legend", legend); } - - public String getLegend() { - return legend; + if (scheme != null) { + result.put("scheme", scheme); } - - /** - * Contains a legend to be displayed with the map. - * Implementations MAY decide to treat this as HTML or literal text. - * For security reasons, make absolutely sure that this field can't be - * abused as a vector for XSS or beacon tracking. - * "legend": "Dangerous zones are red, safe zones are green" - * - * @param legend the legend to set - */ - public void setLegend(String legend) { - this.legend = legend; + if (grids != null) { + result.put("grids", grids); } - - public String getScheme() { - return scheme; + if (data != null) { + result.put("data", data); } - - /** - * Default: "xyz". Either "xyz" or "tms". Influences the y - * direction of the tile coordinates. - * The global-mercator (aka Spherical Mercator) profile is assumed. - * "scheme": "xyz" - * - * @param scheme the scheme to set - */ - public void setScheme(String scheme) { - this.scheme = scheme; + if (minZoom != null) { + result.put("minzoom", minZoom); } - - public String[] getTiles() { - return tiles; + if (maxZoom != null) { + result.put("maxzoom", maxZoom); } - - public String[] getGrids() { - return grids; + if (bounds != null) { + result.put("bounds", bounds); } - - /** - * An array of interactivity endpoints. {z}, {x} - * and {y}, if present, are replaced with the corresponding integers. If multiple - * endpoints are specified, clients may use any combination of endpoints. - * All endpoints MUST return the same content for the same URL. - * If the array doesn't contain any entries, interactivity is not supported - * for this tileset. See https:github.com/mapbox/utfgrid-spec/tree/master/1.2 - * for the interactivity specification. - * <p> - * Example: "http:localhost:8888/admin/1.0.0/broadband/{z}/{x}/{y}.grid.json" - * </p> - * - * @param grids the grids to set - */ - public void setGrids(String... grids) { - this.grids = grids; + if (center != null) { + result.put("center", center); } - public String[] getData() { - return data; - } - - /** - * An array of data files in GeoJSON format. - * {z}, {x} and {y}, if present, - * are replaced with the corresponding integers. If multiple - * endpoints are specified, clients may use any combination of endpoints. - * All endpoints MUST return the same content for the same URL. - * If the array doesn't contain any entries, then no data is present in - * the map. - * <p> - * "http:localhost:8888/admin/data.geojson" - * </p> - * - * @param data the data array to set - */ - public void setData(String... data) { - this.data = data; - } - - public float getMinZoom() { - return minZoom; - } - - /** - * 0. >= 0, < 22. An integer specifying the minimum zoom level. - * - * @param minZoom the minZoom level to set - */ - public void setMinZoom(float minZoom) { - this.minZoom = minZoom; - } - - public float getMaxZoom() { - return maxZoom; - } - - /** - * 0. >= 0, <= 22. An integer specifying the maximum zoom level. - * - * @param maxZoom the maxZoom level to set - */ - public void setMaxZoom(float maxZoom) { - this.maxZoom = maxZoom; - } - - public Float[] getBounds() { - return bounds; - } - - /** - * Default: [-180, -90, 180, 90]. The maximum extent of available map tiles. Bounds MUST define an area - * covered by all zoom levels. The bounds are represented in WGS:84 - * latitude and longitude values, in the order left, bottom, right, top. - * Values may be integers or floating point numbers. - * - * @param bounds the Float array to set - */ - public void setBounds(@Size(value = 4) Float... bounds) { - this.bounds = bounds; - } - - public Float[] getCenter() { - return center; - } - - /** - * The first value is the longitude, the second is latitude (both in - * WGS:84 values), the third value is the zoom level as an integer. - * Longitude and latitude MUST be within the specified bounds. - * The zoom level MUST be between minzoom and maxzoom. - * Implementations can use this value to set the default location. If the - * value is null, implementations may use their own algorithm for - * determining a default location. - * - * @param center the Float array to set - */ - public void setCenter(@Size(value = 2) Float... center) { - this.center = center; - } - - public void setCenter(LatLng center) { - this.center = new Float[]{(float) center.getLongitude(), (float) center.getLatitude()}; - } - - Map<String, Object> toValueObject() { - Map<String, Object> result = new HashMap<>(); - result.put("tilejson", tilejson); - result.put("tiles", tiles); - - if (name != null) { - result.put("name", name); - } - if (description != null) { - result.put("description", description); - } - if (version != null) { - result.put("version", version); - } - if (attribution != null) { - result.put("attribution", attribution); - } - if (template != null) { - result.put("template", template); - } - if (legend != null) { - result.put("legend", legend); - } - if (scheme != null) { - result.put("scheme", scheme); - } - if (grids != null) { - result.put("grids", grids); - } - if (data != null) { - result.put("data", data); - } - if (minZoom != null) { - result.put("minzoom", minZoom); - } - if (maxZoom != null) { - result.put("maxzoom", maxZoom); - } - if (bounds != null) { - result.put("bounds", bounds); - } - if (center != null) { - result.put("center", center); - } - - return result; - } + return result; + } } diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/VectorSource.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/VectorSource.java index 689ea7c6bc..feaca839d3 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/VectorSource.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/VectorSource.java @@ -9,47 +9,47 @@ import java.net.URL; */ public class VectorSource extends Source { - /** - * Internal use - * - * @param nativePtr - pointer to native peer - */ - public VectorSource(long nativePtr) { - super(nativePtr); - } - - /** - * Create a vector source from a remote url - * - * @param id the source id - * @param url the url - */ - public VectorSource(String id, URL url) { - this(id, url.toExternalForm()); - } - - /** - * Create a vector source from a remote url - * - * @param id the source id - * @param url the url - */ - public VectorSource(String id, String url) { - initialize(id, url); - } - - /** - * Create a vector source from a tilset - * - * @param id the source id - * @param tileSet the tileset - */ - public VectorSource(String id, TileSet tileSet) { - initialize(id, tileSet.toValueObject()); - } - - protected native void initialize(String layerId, Object payload); - - @Override - protected native void finalize() throws Throwable; + /** + * Internal use + * + * @param nativePtr - pointer to native peer + */ + public VectorSource(long nativePtr) { + super(nativePtr); + } + + /** + * Create a vector source from a remote url + * + * @param id the source id + * @param url the url + */ + public VectorSource(String id, URL url) { + this(id, url.toExternalForm()); + } + + /** + * Create a vector source from a remote url + * + * @param id the source id + * @param url the url + */ + public VectorSource(String id, String url) { + initialize(id, url); + } + + /** + * Create a vector source from a tilset + * + * @param id the source id + * @param tileSet the tileset + */ + public VectorSource(String id, TileSet tileSet) { + initialize(id, tileSet.toValueObject()); + } + + protected native void initialize(String layerId, Object payload); + + @Override + protected native void finalize() throws Throwable; } |