diff options
Diffstat (limited to 'platform/android/MapboxGLAndroidSDK')
3 files changed, 91 insertions, 0 deletions
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 be24b65d27..8d5858217b 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 @@ -160,6 +160,62 @@ public final class Property { @Retention(RetentionPolicy.SOURCE) public @interface ICON_TEXT_FIT {} + // ICON_ANCHOR: Part of the icon placed closest to the anchor. + + /** + * The center of the icon is placed closest to the anchor. + */ + public static final String ICON_ANCHOR_CENTER = "center"; + /** + * The left side of the icon is placed closest to the anchor. + */ + public static final String ICON_ANCHOR_LEFT = "left"; + /** + * The right side of the icon is placed closest to the anchor. + */ + public static final String ICON_ANCHOR_RIGHT = "right"; + /** + * The top of the icon is placed closest to the anchor. + */ + public static final String ICON_ANCHOR_TOP = "top"; + /** + * The bottom of the icon is placed closest to the anchor. + */ + public static final String ICON_ANCHOR_BOTTOM = "bottom"; + /** + * The top left corner of the icon is placed closest to the anchor. + */ + public static final String ICON_ANCHOR_TOP_LEFT = "top-left"; + /** + * The top right corner of the icon is placed closest to the anchor. + */ + public static final String ICON_ANCHOR_TOP_RIGHT = "top-right"; + /** + * The bottom left corner of the icon is placed closest to the anchor. + */ + public static final String ICON_ANCHOR_BOTTOM_LEFT = "bottom-left"; + /** + * The bottom right corner of the icon is placed closest to the anchor. + */ + public static final String ICON_ANCHOR_BOTTOM_RIGHT = "bottom-right"; + + /** + * Part of the icon placed closest to the anchor. + */ + @StringDef({ + ICON_ANCHOR_CENTER, + ICON_ANCHOR_LEFT, + ICON_ANCHOR_RIGHT, + ICON_ANCHOR_TOP, + ICON_ANCHOR_BOTTOM, + ICON_ANCHOR_TOP_LEFT, + ICON_ANCHOR_TOP_RIGHT, + ICON_ANCHOR_BOTTOM_LEFT, + ICON_ANCHOR_BOTTOM_RIGHT, + }) + @Retention(RetentionPolicy.SOURCE) + public @interface ICON_ANCHOR {} + // ICON_PITCH_ALIGNMENT: Orientation of icon when map is pitched. /** 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 ef89c6809e..3e90605a92 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 @@ -1882,6 +1882,29 @@ public class PropertyFactory { } /** + * Part of the icon placed closest to the anchor. + * + * @param value a String value + * @return property wrapper around String + */ + public static PropertyValue<String> iconAnchor(@Property.ICON_ANCHOR String value) { + return new LayoutPropertyValue<>("icon-anchor", value); + } + + + + /** + * Part of the icon placed closest to the anchor. + * + * @param <T> the function input type + * @param function a wrapper function for String + * @return property wrapper around a String function + */ + public static <T> PropertyValue<Function<T, String>> iconAnchor(Function<T, String> function) { + return new LayoutPropertyValue<>("icon-anchor", function); + } + + /** * Orientation of icon when map is pitched. * * @param value a String value 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 fe81dcb638..d0fb82dce5 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 @@ -252,6 +252,16 @@ public class SymbolLayer extends Layer { } /** + * Get the IconAnchor property + * + * @return property wrapper value around String + */ + @SuppressWarnings("unchecked") + public PropertyValue<String> getIconAnchor() { + return (PropertyValue<String>) new PropertyValue("icon-anchor", nativeGetIconAnchor()); + } + + /** * Get the IconPitchAlignment property * * @return property wrapper value around String @@ -901,6 +911,8 @@ public class SymbolLayer extends Layer { private native Object nativeGetIconOffset(); + private native Object nativeGetIconAnchor(); + private native Object nativeGetIconPitchAlignment(); private native Object nativeGetTextPitchAlignment(); |