diff options
Diffstat (limited to 'platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/SymbolLayer.java')
-rw-r--r-- | platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/SymbolLayer.java | 175 |
1 files changed, 131 insertions, 44 deletions
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 281b4fc028..ccbfdb411f 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/SymbolLayer.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/SymbolLayer.java @@ -1,6 +1,13 @@ // 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; + +import android.support.annotation.ColorInt; +import android.support.annotation.NonNull; + +import static com.mapbox.mapboxsdk.utils.ColorUtils.*; + /** * Symbol Layer */ @@ -21,6 +28,11 @@ public class SymbolLayer extends Layer { nativeSetSourceLayer(sourceLayer); } + public SymbolLayer withSourceLayer(String sourceLayer) { + setSourceLayer(sourceLayer); + return this; + } + public void setFilter(Filter.Statement filter) { checkValidity(); this.setFilter(filter.toArray()); @@ -31,6 +43,21 @@ public class SymbolLayer extends Layer { nativeSetFilter(filter); } + public SymbolLayer withFilter(Object[] filter) { + setFilter(filter); + return this; + } + + public SymbolLayer withFilter(Filter.Statement filter) { + setFilter(filter); + return this; + } + + + public SymbolLayer withProperties(@NonNull Property<?>... properties) { + setProperties(properties); + return this; + } // Property getters @@ -39,289 +66,349 @@ public class SymbolLayer extends Layer { checkValidity(); return (PropertyValue<String>) new PropertyValue(nativeGetSymbolPlacement()); } - + @SuppressWarnings("unchecked") public PropertyValue<Float> getSymbolSpacing() { checkValidity(); return (PropertyValue<Float>) new PropertyValue(nativeGetSymbolSpacing()); } - + @SuppressWarnings("unchecked") public PropertyValue<Boolean> getSymbolAvoidEdges() { checkValidity(); return (PropertyValue<Boolean>) new PropertyValue(nativeGetSymbolAvoidEdges()); } - + @SuppressWarnings("unchecked") public PropertyValue<Boolean> getIconAllowOverlap() { checkValidity(); return (PropertyValue<Boolean>) new PropertyValue(nativeGetIconAllowOverlap()); } - + @SuppressWarnings("unchecked") public PropertyValue<Boolean> getIconIgnorePlacement() { checkValidity(); return (PropertyValue<Boolean>) new PropertyValue(nativeGetIconIgnorePlacement()); } - + @SuppressWarnings("unchecked") public PropertyValue<Boolean> getIconOptional() { checkValidity(); return (PropertyValue<Boolean>) new PropertyValue(nativeGetIconOptional()); } - + @SuppressWarnings("unchecked") public PropertyValue<String> getIconRotationAlignment() { checkValidity(); return (PropertyValue<String>) new PropertyValue(nativeGetIconRotationAlignment()); } - + @SuppressWarnings("unchecked") public PropertyValue<Float> getIconSize() { checkValidity(); return (PropertyValue<Float>) new PropertyValue(nativeGetIconSize()); } - + @SuppressWarnings("unchecked") public PropertyValue<String> getIconTextFit() { checkValidity(); return (PropertyValue<String>) new PropertyValue(nativeGetIconTextFit()); } - + @SuppressWarnings("unchecked") public PropertyValue<Float[]> getIconTextFitPadding() { checkValidity(); return (PropertyValue<Float[]>) new PropertyValue(nativeGetIconTextFitPadding()); } - + @SuppressWarnings("unchecked") public PropertyValue<String> getIconImage() { checkValidity(); return (PropertyValue<String>) new PropertyValue(nativeGetIconImage()); } - + @SuppressWarnings("unchecked") public PropertyValue<Float> getIconRotate() { checkValidity(); return (PropertyValue<Float>) new PropertyValue(nativeGetIconRotate()); } - + @SuppressWarnings("unchecked") public PropertyValue<Float> getIconPadding() { checkValidity(); return (PropertyValue<Float>) new PropertyValue(nativeGetIconPadding()); } - + @SuppressWarnings("unchecked") public PropertyValue<Boolean> getIconKeepUpright() { checkValidity(); return (PropertyValue<Boolean>) new PropertyValue(nativeGetIconKeepUpright()); } - + @SuppressWarnings("unchecked") public PropertyValue<Float[]> getIconOffset() { checkValidity(); return (PropertyValue<Float[]>) new PropertyValue(nativeGetIconOffset()); } - + @SuppressWarnings("unchecked") public PropertyValue<String> getTextPitchAlignment() { checkValidity(); return (PropertyValue<String>) new PropertyValue(nativeGetTextPitchAlignment()); } - + @SuppressWarnings("unchecked") public PropertyValue<String> getTextRotationAlignment() { checkValidity(); return (PropertyValue<String>) new PropertyValue(nativeGetTextRotationAlignment()); } - + @SuppressWarnings("unchecked") public PropertyValue<String> getTextField() { checkValidity(); return (PropertyValue<String>) new PropertyValue(nativeGetTextField()); } - + @SuppressWarnings("unchecked") public PropertyValue<String[]> getTextFont() { checkValidity(); return (PropertyValue<String[]>) new PropertyValue(nativeGetTextFont()); } - + @SuppressWarnings("unchecked") public PropertyValue<Float> getTextSize() { checkValidity(); return (PropertyValue<Float>) new PropertyValue(nativeGetTextSize()); } - + @SuppressWarnings("unchecked") public PropertyValue<Float> getTextMaxWidth() { checkValidity(); return (PropertyValue<Float>) new PropertyValue(nativeGetTextMaxWidth()); } - + @SuppressWarnings("unchecked") public PropertyValue<Float> getTextLineHeight() { checkValidity(); return (PropertyValue<Float>) new PropertyValue(nativeGetTextLineHeight()); } - + @SuppressWarnings("unchecked") public PropertyValue<Float> getTextLetterSpacing() { checkValidity(); return (PropertyValue<Float>) new PropertyValue(nativeGetTextLetterSpacing()); } - + @SuppressWarnings("unchecked") public PropertyValue<String> getTextJustify() { checkValidity(); return (PropertyValue<String>) new PropertyValue(nativeGetTextJustify()); } - + @SuppressWarnings("unchecked") public PropertyValue<String> getTextAnchor() { checkValidity(); return (PropertyValue<String>) new PropertyValue(nativeGetTextAnchor()); } - + @SuppressWarnings("unchecked") public PropertyValue<Float> getTextMaxAngle() { checkValidity(); return (PropertyValue<Float>) new PropertyValue(nativeGetTextMaxAngle()); } - + @SuppressWarnings("unchecked") public PropertyValue<Float> getTextRotate() { checkValidity(); return (PropertyValue<Float>) new PropertyValue(nativeGetTextRotate()); } - + @SuppressWarnings("unchecked") public PropertyValue<Float> getTextPadding() { checkValidity(); return (PropertyValue<Float>) new PropertyValue(nativeGetTextPadding()); } - + @SuppressWarnings("unchecked") public PropertyValue<Boolean> getTextKeepUpright() { checkValidity(); return (PropertyValue<Boolean>) new PropertyValue(nativeGetTextKeepUpright()); } - + @SuppressWarnings("unchecked") public PropertyValue<String> getTextTransform() { checkValidity(); return (PropertyValue<String>) new PropertyValue(nativeGetTextTransform()); } - + @SuppressWarnings("unchecked") public PropertyValue<Float[]> getTextOffset() { checkValidity(); return (PropertyValue<Float[]>) new PropertyValue(nativeGetTextOffset()); } - + @SuppressWarnings("unchecked") public PropertyValue<Boolean> getTextAllowOverlap() { checkValidity(); return (PropertyValue<Boolean>) new PropertyValue(nativeGetTextAllowOverlap()); } - + @SuppressWarnings("unchecked") public PropertyValue<Boolean> getTextIgnorePlacement() { checkValidity(); return (PropertyValue<Boolean>) new PropertyValue(nativeGetTextIgnorePlacement()); } - + @SuppressWarnings("unchecked") public PropertyValue<Boolean> getTextOptional() { checkValidity(); return (PropertyValue<Boolean>) new PropertyValue(nativeGetTextOptional()); } - + @SuppressWarnings("unchecked") public PropertyValue<Float> getIconOpacity() { checkValidity(); return (PropertyValue<Float>) new PropertyValue(nativeGetIconOpacity()); } - + @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. + * @throws RuntimeException + */ + @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"); + } + } + @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. + * @throws RuntimeException + */ + @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"); + } + } + @SuppressWarnings("unchecked") public PropertyValue<Float> getIconHaloWidth() { checkValidity(); return (PropertyValue<Float>) new PropertyValue(nativeGetIconHaloWidth()); } - + @SuppressWarnings("unchecked") public PropertyValue<Float> getIconHaloBlur() { checkValidity(); return (PropertyValue<Float>) new PropertyValue(nativeGetIconHaloBlur()); } - + @SuppressWarnings("unchecked") public PropertyValue<Float[]> getIconTranslate() { checkValidity(); return (PropertyValue<Float[]>) new PropertyValue(nativeGetIconTranslate()); } - + @SuppressWarnings("unchecked") public PropertyValue<String> getIconTranslateAnchor() { checkValidity(); return (PropertyValue<String>) new PropertyValue(nativeGetIconTranslateAnchor()); } - + @SuppressWarnings("unchecked") public PropertyValue<Float> getTextOpacity() { checkValidity(); return (PropertyValue<Float>) new PropertyValue(nativeGetTextOpacity()); } - + @SuppressWarnings("unchecked") public PropertyValue<String> getTextColor() { checkValidity(); return (PropertyValue<String>) new PropertyValue(nativeGetTextColor()); } + /** + * The color with which the text will be drawn. + * @throws RuntimeException + */ + @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"); + } + } + @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. + * @throws RuntimeException + */ + @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"); + } + } + @SuppressWarnings("unchecked") public PropertyValue<Float> getTextHaloWidth() { checkValidity(); return (PropertyValue<Float>) new PropertyValue(nativeGetTextHaloWidth()); } - + @SuppressWarnings("unchecked") public PropertyValue<Float> getTextHaloBlur() { checkValidity(); return (PropertyValue<Float>) new PropertyValue(nativeGetTextHaloBlur()); } - + @SuppressWarnings("unchecked") public PropertyValue<Float[]> getTextTranslate() { checkValidity(); return (PropertyValue<Float[]>) new PropertyValue(nativeGetTextTranslate()); } - + @SuppressWarnings("unchecked") public PropertyValue<String> getTextTranslateAnchor() { checkValidity(); return (PropertyValue<String>) new PropertyValue(nativeGetTextTranslateAnchor()); } - + private native Object nativeGetSymbolPlacement(); private native Object nativeGetSymbolSpacing(); |