Class ClusterSource
java.lang.Object
io.jmix.mapsflowui.kit.component.model.MapObservableObject
io.jmix.mapsflowui.kit.component.model.source.Source
io.jmix.mapsflowui.kit.component.model.source.AbstractVectorSource
io.jmix.mapsflowui.kit.component.model.source.AbstractClusterSource
io.jmix.mapsflowui.component.model.source.ClusterSource
- All Implemented Interfaces:
AbstractClusterSource.HasClusterSourceOptions
,AbstractClusterSource.HasDisableAtZoom
,AbstractClusterSource.HasDistance
,AbstractClusterSource.HasMinDistance
,AbstractClusterSource.HasPointStyle
,AbstractClusterSource.HasPointTextStyle
,AbstractClusterSource.HasShowSinglePointAsCluster
,AbstractClusterSource.HasVectorSource
,AbstractClusterSource.HasWeightProperty
,Source.HasAttributions
,Source.HasWrapX
,Serializable
,org.springframework.beans.factory.Aware
,org.springframework.context.ApplicationContextAware
public class ClusterSource
extends AbstractClusterSource
implements AbstractClusterSource.HasClusterSourceOptions, Source.HasAttributions, Source.HasWrapX, org.springframework.context.ApplicationContextAware
Source to cluster vector data. Cluster supports all types of features.
It calculates coordinate of center of feature and uses this point for clustering.
The center of feature is calculated by the following rules:
PointFeature
- coordinate is equal to point's coordinate;MarkerFeature
- coordinate is equal to marker's coordinate;PolygonFeature
- an interior point of the polygon (see getInteriorPoint() docs);LineStringFeature
- flat midpoint of feature
For more details see: Cluster docs
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class io.jmix.mapsflowui.kit.component.model.source.AbstractClusterSource
AbstractClusterSource.HasClusterSourceOptions, AbstractClusterSource.HasDisableAtZoom, AbstractClusterSource.HasDistance, AbstractClusterSource.HasMinDistance, AbstractClusterSource.HasPointStyle, AbstractClusterSource.HasPointTextStyle, AbstractClusterSource.HasShowSinglePointAsCluster, AbstractClusterSource.HasVectorSource, AbstractClusterSource.HasWeightProperty
Nested classes/interfaces inherited from class io.jmix.mapsflowui.kit.component.model.source.AbstractVectorSource
AbstractVectorSource.HasOverlaps, AbstractVectorSource.HasUseSpatialIndex, AbstractVectorSource.HasVectorSourceOptions
Nested classes/interfaces inherited from class io.jmix.mapsflowui.kit.component.model.source.Source
Source.HasAttributions, Source.HasAttributionsCollapsible, Source.HasProjection, Source.HasSourceOptions, Source.HasWrapX
Nested classes/interfaces inherited from class io.jmix.mapsflowui.kit.component.model.MapObservableObject
MapObservableObject.ObjectChangeEvent
-
Field Summary
Modifier and TypeFieldDescriptionprotected org.springframework.context.ApplicationContext
Fields inherited from class io.jmix.mapsflowui.kit.component.model.source.AbstractClusterSource
disableAtZoom, distance, minDistance, pointStyles, pointTextStyle, showSinglePointAsCluster, vectorSource, weightProperty
Fields inherited from class io.jmix.mapsflowui.kit.component.model.source.AbstractVectorSource
overlaps, useSpatialIndex
Fields inherited from class io.jmix.mapsflowui.kit.component.model.source.Source
attributions, attributionsCollapsible, id, projection, wrapX
Fields inherited from class io.jmix.mapsflowui.kit.component.model.MapObservableObject
children, dirty, eventBus, listener, metaProperties, parent, removedChildren, syncId
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addPointStyles
(Style... styles) Adds cluster point style.<T extends AbstractVectorSource>
TgetWrapX()
void
Removes all added cluster point styles.void
removePointStyles
(Style... styles) Removes cluster point styles.void
setApplicationContext
(org.springframework.context.ApplicationContext applicationContext) void
setAttributions
(List<String> attributions) void
setDisableAtZoom
(Double disableAtZoom) Sets zoom level from which clustering will be disabled.void
setDistance
(Integer distance) Sets the distance within which features will be clustered together.void
setMinDistance
(Integer minDistance) Sets the minimum distance in pixels between clusters that will be capped at the configured distance.void
setPointTextStyle
(Style pointTextStyle) Sets the text style of cluster marker.void
setShowSinglePointAsCluster
(Boolean showSinglePointAsCluster) Enables to show not clustered feature (single point, marker, etc.) as a cluster marker of 1 size.void
setVectorSource
(AbstractVectorSource vectorSource) Sets vector source which features should be clustered.void
setWeightProperty
(String weightProperty) Sets weight property that is defined in a feature or in an entity.void
withAttributions
(List<String> attributions) withDisableAtZoom
(Double disableAtZoom) withDistance
(Integer distance) SeesetDistance(Integer)
.withMinDistance
(Integer minDistance) withPointStyles
(Style... styles) withPointTextStyle
(Style pointTextStyle) withShowSinglePointAsCluster
(Boolean showSinglePointAsCluster) withVectorSource
(AbstractVectorSource vectorSource) withWeightProperty
(String weightProperty) SeesetWrapX(Boolean)
.Methods inherited from class io.jmix.mapsflowui.kit.component.model.source.AbstractClusterSource
createDefaultPointStyles, createDefaultPointTextStyle, getType
Methods inherited from class io.jmix.mapsflowui.kit.component.model.source.AbstractVectorSource
getOverlaps, getUseSpatialIndex, setOverlaps, setUseSpatialIndex
Methods inherited from class io.jmix.mapsflowui.kit.component.model.source.Source
getAttributionsCollapsible, getId, getProjection, setAttributionsCollapsible, setId, setProjection
Methods inherited from class io.jmix.mapsflowui.kit.component.model.MapObservableObject
addChild, addListener, clearRemovedChildren, clearRemovedChildrenInDepth, equals, fireChangeEvent, getChildren, getEventBus, getMetaProperties, getRemovedChildren, getSyncId, hashCode, isDirty, isDirtyInDepth, markAsDirty, markAsDirtyInDepth, removeChild, setMapObjectChangeListener, setMetaProperty, setParent, unmarkDirtyInDepth
-
Field Details
-
applicationContext
protected org.springframework.context.ApplicationContext applicationContext
-
-
Constructor Details
-
ClusterSource
public ClusterSource()
-
-
Method Details
-
getDistance
- Specified by:
getDistance
in interfaceAbstractClusterSource.HasDistance
- Overrides:
getDistance
in classAbstractClusterSource
- Returns:
- the distance or
null
if not set
-
setDistance
Sets the distance within which features will be clustered together. If not defined distance with 20 pixels will be used.For more details see: setDistance() docs
- Specified by:
setDistance
in interfaceAbstractClusterSource.HasDistance
- Overrides:
setDistance
in classAbstractClusterSource
- Parameters:
distance
- distance in pixels
-
withDistance
SeesetDistance(Integer)
.- Parameters:
distance
- distance in pixels- Returns:
- current instance
-
getMinDistance
- Specified by:
getMinDistance
in interfaceAbstractClusterSource.HasMinDistance
- Overrides:
getMinDistance
in classAbstractClusterSource
- Returns:
- the minimum distance in pixels or
null
if not set
-
setMinDistance
Sets the minimum distance in pixels between clusters that 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 tradeoff, the cluster feature's position will no longer be the center of all its features.For more details see: setMinDistance() docs
- Specified by:
setMinDistance
in interfaceAbstractClusterSource.HasMinDistance
- Overrides:
setMinDistance
in classAbstractClusterSource
- Parameters:
minDistance
- minimum distance in pixels between clusters
-
withMinDistance
- Parameters:
minDistance
- minimum distance in pixels between clusters- Returns:
- current instance
-
getVectorSource
- Specified by:
getVectorSource
in interfaceAbstractClusterSource.HasVectorSource
- Overrides:
getVectorSource
in classAbstractClusterSource
- Type Parameters:
T
- vector source type- Returns:
- vector source or
null
if not set
-
setVectorSource
Sets vector source which features should be clustered.- Specified by:
setVectorSource
in interfaceAbstractClusterSource.HasVectorSource
- Overrides:
setVectorSource
in classAbstractClusterSource
- Parameters:
vectorSource
- vector source to set
-
withVectorSource
- Parameters:
vectorSource
- vector source to set- Returns:
- current instance
-
getAttributions
- Specified by:
getAttributions
in interfaceSource.HasAttributions
- Overrides:
getAttributions
in classSource
- Returns:
- the attributions of the source or
null
if not set
-
setAttributions
- Specified by:
setAttributions
in interfaceSource.HasAttributions
- Overrides:
setAttributions
in classSource
- Parameters:
attributions
- info about copyrights and licences
-
withAttributions
- Parameters:
attributions
- info about copyrights and licences- Returns:
- current instance
-
getWrapX
- Specified by:
getWrapX
in interfaceSource.HasWrapX
- Overrides:
getWrapX
in classSource
- Returns:
- whether the source should be looped along the X coordinate or
null
if not set
-
setWrapX
- Specified by:
setWrapX
in interfaceSource.HasWrapX
- Overrides:
setWrapX
in classSource
- Parameters:
wrapX
- whether the source should be looped along the X coordinate
-
withWrapX
SeesetWrapX(Boolean)
.- Parameters:
wrapX
- whether the source should be looped along the X coordinate- Returns:
- current instance
-
getPointStyles
- Specified by:
getPointStyles
in interfaceAbstractClusterSource.HasPointStyle
- Overrides:
getPointStyles
in classAbstractClusterSource
- Returns:
- list of added cluster point styles or empty list if no styles added
-
addPointStyles
Adds cluster point style. The Cluster generates points that includes features in this cluster. Styles will be applied only for generated points, other features will be styled according to their rules.- Specified by:
addPointStyles
in interfaceAbstractClusterSource.HasPointStyle
- Overrides:
addPointStyles
in classAbstractClusterSource
- Parameters:
styles
- cluster point styles to add
-
withPointStyles
- Parameters:
styles
- styles to add- Returns:
- current instance
-
removePointStyles
Removes cluster point styles.- Specified by:
removePointStyles
in interfaceAbstractClusterSource.HasPointStyle
- Overrides:
removePointStyles
in classAbstractClusterSource
- Parameters:
styles
- styles to remove
-
removeAllPointStyles
public void removeAllPointStyles()Removes all added cluster point styles.- Specified by:
removeAllPointStyles
in interfaceAbstractClusterSource.HasPointStyle
- Overrides:
removeAllPointStyles
in classAbstractClusterSource
-
getPointTextStyle
- Specified by:
getPointTextStyle
in interfaceAbstractClusterSource.HasPointTextStyle
- Overrides:
getPointTextStyle
in classAbstractClusterSource
- Returns:
- the text style of cluster marker
-
setPointTextStyle
Sets the text style of cluster marker. For instance, default text style is defined by the following:clusterSource.setPointTextStyle( new Style() .withText(new TextStyle() .withFont("12px sans-serif") .withOffsetY(1) .withFill(new Fill("#fff"))));
- Specified by:
setPointTextStyle
in interfaceAbstractClusterSource.HasPointTextStyle
- Overrides:
setPointTextStyle
in classAbstractClusterSource
- Parameters:
pointTextStyle
- text style to set
-
withPointTextStyle
- Parameters:
pointTextStyle
- text style to set- Returns:
- current instance
-
getWeightProperty
- Specified by:
getWeightProperty
in interfaceAbstractClusterSource.HasWeightProperty
- Overrides:
getWeightProperty
in classAbstractClusterSource
- Returns:
- weight property or
null
if not set
-
setWeightProperty
Sets weight property that is defined in a feature or in an entity. This property should contain value that will be used when calculating the summed up value of the cluster (by default, the number of points is used).- Specified by:
setWeightProperty
in interfaceAbstractClusterSource.HasWeightProperty
- Overrides:
setWeightProperty
in classAbstractClusterSource
- Parameters:
weightProperty
- property in a feature or in an entity
-
withWeightProperty
- Parameters:
weightProperty
- property in a feature or in an entity- Returns:
- current instance
-
getShowSinglePointAsCluster
- Specified by:
getShowSinglePointAsCluster
in interfaceAbstractClusterSource.HasShowSinglePointAsCluster
- Overrides:
getShowSinglePointAsCluster
in classAbstractClusterSource
- Returns:
true
if feature is shown as a cluster marker of 1 size ornull
if not set
-
setShowSinglePointAsCluster
Enables to show not clustered feature (single point, marker, etc.) as a cluster marker of 1 size. Default value isfalse
.- Specified by:
setShowSinglePointAsCluster
in interfaceAbstractClusterSource.HasShowSinglePointAsCluster
- Overrides:
setShowSinglePointAsCluster
in classAbstractClusterSource
- Parameters:
showSinglePointAsCluster
- whether to show feature as a cluster marker of 1 size
-
withShowSinglePointAsCluster
- Parameters:
showSinglePointAsCluster
- whether to show feature as a cluster marker of 1 size- Returns:
- current instance
-
getDisableAtZoom
- Specified by:
getDisableAtZoom
in interfaceAbstractClusterSource.HasDisableAtZoom
- Overrides:
getDisableAtZoom
in classAbstractClusterSource
- Returns:
- zoom level or
null
if not set
-
setDisableAtZoom
Sets zoom level from which clustering will be disabled.- Specified by:
setDisableAtZoom
in interfaceAbstractClusterSource.HasDisableAtZoom
- Overrides:
setDisableAtZoom
in classAbstractClusterSource
- Parameters:
disableAtZoom
- zoom level from which clustering will be disabled
-
withDisableAtZoom
- Parameters:
disableAtZoom
- zoom level from which clustering will be disable- Returns:
- current instance
-
setApplicationContext
public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext) throws org.springframework.beans.BeansException - Specified by:
setApplicationContext
in interfaceorg.springframework.context.ApplicationContextAware
- Throws:
org.springframework.beans.BeansException
-