Port symbol-z-order symbol layout style-spec property to Native

This commit is contained in:
ryanhamley
2018-08-30 17:18:29 -07:00
parent 79bf0e8af6
commit 31cca05fc6
25 changed files with 300 additions and 4 deletions

View File

@@ -108,6 +108,27 @@ public final class Property {
@Retention(RetentionPolicy.SOURCE)
public @interface SYMBOL_PLACEMENT {}
// SYMBOL_Z_ORDER: Controls the order in which overlapping symbols in the same layer are rendered
/**
* Symbols will be sorted by their y-position relative to the viewport.
*/
public static final String SYMBOL_Z_ORDER_VIEWPORT_Y = "viewport-y";
/**
* Symbols will be rendered in the same order as the source data with no sorting applied.
*/
public static final String SYMBOL_Z_ORDER_SOURCE = "source";
/**
* Controls the order in which overlapping symbols in the same layer are rendered
*/
@StringDef({
SYMBOL_Z_ORDER_VIEWPORT_Y,
SYMBOL_Z_ORDER_SOURCE,
})
@Retention(RetentionPolicy.SOURCE)
public @interface SYMBOL_Z_ORDER {}
// ICON_ROTATION_ALIGNMENT: In combination with `symbol-placement`, determines the rotation behavior of icons.
/**

View File

@@ -1764,6 +1764,26 @@ public class PropertyFactory {
return new LayoutPropertyValue<>("symbol-avoid-edges", value);
}
/**
* Controls the order in which overlapping symbols in the same layer are rendered
*
* @param value a String value
* @return property wrapper around String
*/
public static PropertyValue<String> symbolZOrder(@Property.SYMBOL_Z_ORDER String value) {
return new LayoutPropertyValue<>("symbol-z-order", value);
}
/**
* Controls the order in which overlapping symbols in the same layer are rendered
*
* @param value a String value
* @return property wrapper around String
*/
public static PropertyValue<Expression> symbolZOrder(Expression value) {
return new LayoutPropertyValue<>("symbol-z-order", value);
}
/**
* If true, the icon will be visible even if it collides with other previously drawn symbols.
*

View File

@@ -170,6 +170,17 @@ public class SymbolLayer extends Layer {
return (PropertyValue<Boolean>) new PropertyValue("symbol-avoid-edges", nativeGetSymbolAvoidEdges());
}
/**
* Get the SymbolZOrder property
*
* @return property wrapper value around String
*/
@SuppressWarnings("unchecked")
public PropertyValue<String> getSymbolZOrder() {
checkThread();
return (PropertyValue<String>) new PropertyValue("symbol-z-order", nativeGetSymbolZOrder());
}
/**
* Get the IconAllowOverlap property
*
@@ -1004,6 +1015,9 @@ public class SymbolLayer extends Layer {
@Keep
private native Object nativeGetSymbolAvoidEdges();
@Keep
private native Object nativeGetSymbolZOrder();
@Keep
private native Object nativeGetIconAllowOverlap();