[android] Generate style code for symbol-sort-key

This commit is contained in:
Alexander Shalamov
2019-04-10 22:19:16 +03:00
parent 905ca29866
commit d4149ea5f1
6 changed files with 76 additions and 1 deletions

View File

@@ -110,6 +110,10 @@ public final class Property {
// SYMBOL_Z_ORDER: Controls the order in which overlapping symbols in the same layer are rendered
/**
* If {@link SYMBOL_SORT_KEY} is set, sort based on that. Otherwise sort symbols by their position relative to the viewport.
*/
public static final String SYMBOL_Z_ORDER_AUTO = "auto";
/**
* Symbols will be sorted by their y-position relative to the viewport.
*/
@@ -123,6 +127,7 @@ public final class Property {
* Controls the order in which overlapping symbols in the same layer are rendered
*/
@StringDef({
SYMBOL_Z_ORDER_AUTO,
SYMBOL_Z_ORDER_VIEWPORT_Y,
SYMBOL_Z_ORDER_SOURCE,
})

View File

@@ -1785,6 +1785,26 @@ public class PropertyFactory {
return new LayoutPropertyValue<>("symbol-avoid-edges", value);
}
/**
* Sorts features in ascending order based on this value. Features with a higher sort key will appear above features with a lower sort key wehn they overlap. Features with a lower sort key will have priority over other features when doing placement.
*
* @param value a Float value
* @return property wrapper around Float
*/
public static PropertyValue<Float> symbolSortKey(Float value) {
return new LayoutPropertyValue<>("symbol-sort-key", value);
}
/**
* Sorts features in ascending order based on this value. Features with a higher sort key will appear above features with a lower sort key wehn they overlap. Features with a lower sort key will have priority over other features when doing placement.
*
* @param value a Float value
* @return property wrapper around Float
*/
public static PropertyValue<Expression> symbolSortKey(Expression value) {
return new LayoutPropertyValue<>("symbol-sort-key", value);
}
/**
* Controls the order in which overlapping symbols in the same layer are rendered
*

View File

@@ -181,6 +181,18 @@ public class SymbolLayer extends Layer {
return (PropertyValue<Boolean>) new PropertyValue("symbol-avoid-edges", nativeGetSymbolAvoidEdges());
}
/**
* Get the SymbolSortKey property
*
* @return property wrapper value around Float
*/
@NonNull
@SuppressWarnings("unchecked")
public PropertyValue<Float> getSymbolSortKey() {
checkThread();
return (PropertyValue<Float>) new PropertyValue("symbol-sort-key", nativeGetSymbolSortKey());
}
/**
* Get the SymbolZOrder property
*
@@ -1113,6 +1125,10 @@ public class SymbolLayer extends Layer {
@Keep
private native Object nativeGetSymbolAvoidEdges();
@NonNull
@Keep
private native Object nativeGetSymbolSortKey();
@NonNull
@Keep
private native Object nativeGetSymbolZOrder();