Class ClusterOptions
- java.lang.Object
-
- com.mapbox.mapboxsdk.plugins.annotation.ClusterOptions
-
public class ClusterOptions extends java.lang.ObjectOptions to show and configure symbol clustering with using SymbolManager.It exposes a minimal of configuration options, a more advanced setup can be created manually with using CircleLayer and SymbolLayers directly.
-
-
Constructor Summary
Constructors Constructor Description ClusterOptions()Creates a default ClusterOptions object
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidapply(com.mapbox.mapboxsdk.maps.Style style, java.lang.String sourceId)Apply cluster options to a style and source id.com.mapbox.mapboxsdk.style.expressions.ExpressiongetCircleRadius()Get the circle radius of the cluster items, 18 by defaultintgetClusterMaxZoom()Set the cluster maximum, 14 by default.intgetClusterRadius()Get the cluster radius, 50 by default.androidx.core.util.Pair<java.lang.Integer,java.lang.Integer>[]getColorLevels()Get the cluster color levels, which a pair constructed with amount of point and a int color value.com.mapbox.mapboxsdk.style.expressions.ExpressiongetTextColor()Get the text color of cluster item.com.mapbox.mapboxsdk.style.expressions.ExpressiongetTextField()Set the text field of a cluster item.com.mapbox.mapboxsdk.style.expressions.ExpressiongetTextSize()Get the text size of cluster item.ClusterOptionswithCircleRadius(com.mapbox.mapboxsdk.style.expressions.Expression circleRadius)Set the circle radius of cluster items.ClusterOptionswithClusterMaxZoom(int clusterMaxZoom)Set the cluster maximum zoom, 14 by default.ClusterOptionswithClusterRadius(int clusterRadius)Set the cluster radius, 50 by default.ClusterOptionswithColorLevels(androidx.core.util.Pair<java.lang.Integer,java.lang.Integer>[] colorLevels)Set the cluster color levels, which a pair constructed with amount of point and a int color value.ClusterOptionswithTextColor(com.mapbox.mapboxsdk.style.expressions.Expression textColor)Set the text color of cluster item.ClusterOptionswithTextField(com.mapbox.mapboxsdk.style.expressions.Expression textField)Set the text field of a cluster item.ClusterOptionswithTextSize(com.mapbox.mapboxsdk.style.expressions.Expression textSize)Set the text size of cluster item.
-
-
-
Method Detail
-
getClusterRadius
public int getClusterRadius()
Get the cluster radius, 50 by default.- Returns:
- the radius at which the cluster dissolves
-
withClusterRadius
public ClusterOptions withClusterRadius(int clusterRadius)
Set the cluster radius, 50 by default.- Parameters:
clusterRadius- the radius at which the cluster dissolves- Returns:
- this
-
getClusterMaxZoom
public int getClusterMaxZoom()
Set the cluster maximum, 14 by default.- Returns:
- the cluster maximum zoom, at this zoom level clusters dissolve automatically
-
withClusterMaxZoom
public ClusterOptions withClusterMaxZoom(int clusterMaxZoom)
Set the cluster maximum zoom, 14 by default.- Parameters:
clusterMaxZoom- the cluster maximum zoom, at this zoom level clusters dissolve automatically- Returns:
- this
-
getColorLevels
@NonNull public androidx.core.util.Pair<java.lang.Integer,java.lang.Integer>[] getColorLevels()
Get the cluster color levels, which a pair constructed with amount of point and a int color value.- Returns:
- the cluster color levels array
-
withColorLevels
public ClusterOptions withColorLevels(@NonNull androidx.core.util.Pair<java.lang.Integer,java.lang.Integer>[] colorLevels)
Set the cluster color levels, which a pair constructed with amount of point and a int color value.- Parameters:
colorLevels- the cluster color levels array- Returns:
- this
-
getCircleRadius
@Nullable public com.mapbox.mapboxsdk.style.expressions.Expression getCircleRadius()
Get the circle radius of the cluster items, 18 by default- Returns:
- the cluster item circle radius
-
withCircleRadius
public ClusterOptions withCircleRadius(@Nullable com.mapbox.mapboxsdk.style.expressions.Expression circleRadius)
Set the circle radius of cluster items. 18 by default- Parameters:
circleRadius- the cluster item circle radius- Returns:
- this
-
getTextColor
@Nullable public com.mapbox.mapboxsdk.style.expressions.Expression getTextColor()
Get the text color of cluster item. White by default- Returns:
- the cluster item text color
-
withTextColor
public ClusterOptions withTextColor(@Nullable com.mapbox.mapboxsdk.style.expressions.Expression textColor)
Set the text color of cluster item. White by default.- Parameters:
textColor- the cluster item text color- Returns:
- this
-
getTextSize
@Nullable public com.mapbox.mapboxsdk.style.expressions.Expression getTextSize()
Get the text size of cluster item. 12 by default.- Returns:
- the cluster item text size
-
withTextSize
public ClusterOptions withTextSize(@Nullable com.mapbox.mapboxsdk.style.expressions.Expression textSize)
Set the text size of cluster item. 12 by default.- Parameters:
textSize- the cluster item text size- Returns:
- this
-
getTextField
@Nullable public com.mapbox.mapboxsdk.style.expressions.Expression getTextField()
Set the text field of a cluster item. toNumber(get("point_count")) by default.- Returns:
- the cluster item text field
-
withTextField
public ClusterOptions withTextField(@Nullable com.mapbox.mapboxsdk.style.expressions.Expression textField)
Set the text field of a cluster item. toNumber(get("point_count")) by default.- Parameters:
textField- the cluster item text field- Returns:
- this
-
apply
public void apply(@NonNull com.mapbox.mapboxsdk.maps.Style style, @NonNull java.lang.String sourceId)Apply cluster options to a style and source id.- Parameters:
style- style to apply this tosourceId- source id to apply this to
-
-