Implement icon-anchor property

This commit is contained in:
Lauren Budorick
2017-08-28 13:32:56 -07:00
committed by GitHub
parent c6ab20e5c6
commit 2de89a99bc
27 changed files with 558 additions and 122 deletions

View File

@@ -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.
/**

View File

@@ -1881,6 +1881,29 @@ public class PropertyFactory {
return new LayoutPropertyValue<>("icon-offset", function);
}
/**
* 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.
*

View File

@@ -251,6 +251,16 @@ public class SymbolLayer extends Layer {
return (PropertyValue<Float[]>) new PropertyValue("icon-offset", nativeGetIconOffset());
}
/**
* 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
*
@@ -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();