[android] - add heatmap color property
This commit is contained in:
@@ -167,6 +167,32 @@ public class HeatmapLayer extends Layer {
|
||||
nativeSetHeatmapIntensityTransition(options.getDuration(), options.getDelay());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the HeatmapColor property
|
||||
*
|
||||
* @return property wrapper value around String
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public PropertyValue<String> getHeatmapColor() {
|
||||
return (PropertyValue<String>) new PropertyValue("heatmap-color", nativeGetHeatmapColor());
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines the color of each pixel based on its density value in a heatmap. Should be an expression that uses `["heatmap-density"]` as input.
|
||||
*
|
||||
* @return int representation of a rgba string color
|
||||
* @throws RuntimeException thrown if property isn't a value
|
||||
*/
|
||||
@ColorInt
|
||||
public int getHeatmapColorAsInt() {
|
||||
PropertyValue<String> value = getHeatmapColor();
|
||||
if (value.isValue()) {
|
||||
return rgbaToColor(value.getValue());
|
||||
} else {
|
||||
throw new RuntimeException("heatmap-color was set as a Function");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the HeatmapOpacity property
|
||||
*
|
||||
@@ -209,6 +235,8 @@ public class HeatmapLayer extends Layer {
|
||||
|
||||
private native void nativeSetHeatmapIntensityTransition(long duration, long delay);
|
||||
|
||||
private native Object nativeGetHeatmapColor();
|
||||
|
||||
private native Object nativeGetHeatmapOpacity();
|
||||
|
||||
private native TransitionOptions nativeGetHeatmapOpacityTransition();
|
||||
|
||||
@@ -1614,6 +1614,36 @@ public class PropertyFactory {
|
||||
return new PaintPropertyValue<>("heatmap-intensity", function);
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines the color of each pixel based on its density value in a heatmap. Should be an expression that uses `["heatmap-density"]` as input.
|
||||
*
|
||||
* @param value a int color value
|
||||
* @return property wrapper around String color
|
||||
*/
|
||||
public static PropertyValue<String> heatmapColor(@ColorInt int value) {
|
||||
return new PaintPropertyValue<>("heatmap-color", colorToRgbaString(value));
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines the color of each pixel based on its density value in a heatmap. Should be an expression that uses `["heatmap-density"]` as input.
|
||||
*
|
||||
* @param value a String value
|
||||
* @return property wrapper around String
|
||||
*/
|
||||
public static PropertyValue<String> heatmapColor(String value) {
|
||||
return new PaintPropertyValue<>("heatmap-color", value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines the color of each pixel based on its density value in a heatmap. Should be an expression that uses `["heatmap-density"]` as input.
|
||||
*
|
||||
* @param expression an expression statement
|
||||
* @return property wrapper around an expression statement
|
||||
*/
|
||||
public static PropertyValue<Expression> heatmapColor(Expression expression) {
|
||||
return new PaintPropertyValue<>("heatmap-color", expression);
|
||||
}
|
||||
|
||||
/**
|
||||
* The global opacity at which the heatmap layer will be drawn.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user