Class ClusterSource
java.lang.Object
com.vaadin.flow.component.map.configuration.AbstractConfigurationObject
com.vaadin.flow.component.map.configuration.source.Source
com.vaadin.flow.component.map.configuration.source.VectorSource
com.vaadin.flow.component.map.configuration.source.ClusterSource
- All Implemented Interfaces:
Serializable
A source that clusters features within a certain distance.
Currently only point-based features such as MarkerFeature are
supported.
Note: There should be no need to construct this class directly. Instead, use
a FeatureLayer which exposes the same API as this source. Clustering
can be enabled in a feature layer using
FeatureLayer.setClusteringEnabled(boolean).
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class com.vaadin.flow.component.map.configuration.source.VectorSource
VectorSource.Options -
Field Summary
Fields inherited from class com.vaadin.flow.component.map.configuration.AbstractConfigurationObject
propertyChangeSupport -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new cluster source.ClusterSource(VectorSource.Options options) Creates a new cluster source with custom options. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddFeature(Feature feature) Adds a feature to this source.intThe distance in pixels within which features should be clustered.intMinimum distance in pixels between clusters.getType()The unique type name of this class.voidsetDistance(int distance) Sets the distance in pixels within which features should be clustered.voidsetMinDistance(int minDistance) Sets the minimum distance in pixels between clusters.Methods inherited from class com.vaadin.flow.component.map.configuration.source.VectorSource
getFeatures, removeAllFeatures, removeFeatureMethods inherited from class com.vaadin.flow.component.map.configuration.source.Source
getAttributions, getProjection, isAttributionsCollapsible, setAttributionsMethods inherited from class com.vaadin.flow.component.map.configuration.AbstractConfigurationObject
addChild, addNullableChild, addPropertyChangeListener, collectChanges, deepMarkAsDirty, getId, markAsDirty, notifyChange, notifyChange, removeChild, removePropertyChangeListener, setId, update
-
Constructor Details
-
ClusterSource
public ClusterSource()Creates a new cluster source. -
ClusterSource
Creates a new cluster source with custom options.- Parameters:
options- the options for the cluster source
-
-
Method Details
-
getType
Description copied from class:AbstractConfigurationObjectThe unique type name of this class. Used by the client-side synchronization mechanism to determine which OpenLayers class to synchronize into.- Overrides:
getTypein classVectorSource
-
addFeature
Adds a feature to this source. Only point-based features such asMarkerFeatureare supported. Throws for other feature types.- Overrides:
addFeaturein classVectorSource- Parameters:
feature- the feature to add
-
getDistance
public int getDistance()The distance in pixels within which features should be clustered. Default is 50 pixels.- Returns:
- the distance in pixels within which features should be clustered
-
setDistance
public void setDistance(int distance) Sets the distance in pixels within which features should be clustered.- Parameters:
distance- the distance in pixels within which features should be clustered
-
getMinDistance
public int getMinDistance()Minimum distance in pixels between clusters. Will be capped at the configured distance. By default, no minimum distance is guaranteed. This config can be used to avoid overlapping icons. As a trade-off, the cluster feature's position will no longer be the center of all its features. Default is 50 pixels.- Returns:
- the minimum distance in pixels between clusters
-
setMinDistance
public void setMinDistance(int minDistance) Sets the minimum distance in pixels between clusters.- Parameters:
minDistance- the minimum distance in pixels between clusters
-