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.HasWeightPropertyNested classes/interfaces inherited from class io.jmix.mapsflowui.kit.component.model.source.AbstractVectorSource
AbstractVectorSource.HasOverlaps, AbstractVectorSource.HasUseSpatialIndex, AbstractVectorSource.HasVectorSourceOptionsNested classes/interfaces inherited from class io.jmix.mapsflowui.kit.component.model.source.Source
Source.HasAttributions, Source.HasAttributionsCollapsible, Source.HasProjection, Source.HasSourceOptions, Source.HasWrapXNested classes/interfaces inherited from class io.jmix.mapsflowui.kit.component.model.MapObservableObject
MapObservableObject.ObjectChangeEvent -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected org.springframework.context.ApplicationContextFields inherited from class io.jmix.mapsflowui.kit.component.model.source.AbstractClusterSource
disableAtZoom, distance, minDistance, pointStyles, pointTextStyle, showSinglePointAsCluster, vectorSource, weightPropertyFields inherited from class io.jmix.mapsflowui.kit.component.model.source.AbstractVectorSource
overlaps, useSpatialIndexFields inherited from class io.jmix.mapsflowui.kit.component.model.source.Source
attributions, attributionsCollapsible, id, projection, wrapXFields inherited from class io.jmix.mapsflowui.kit.component.model.MapObservableObject
children, dirty, eventBus, listener, metaProperties, parent, removedChildren, syncId -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddPointStyles(Style... styles) Adds cluster point style.<T extends AbstractVectorSource>
TgetWrapX()voidRemoves all added cluster point styles.voidremovePointStyles(Style... styles) Removes cluster point styles.voidsetApplicationContext(org.springframework.context.ApplicationContext applicationContext) voidsetAttributions(List<String> attributions) voidsetDisableAtZoom(Double disableAtZoom) Sets zoom level from which clustering will be disabled.voidsetDistance(Integer distance) Sets the distance within which features will be clustered together.voidsetMinDistance(Integer minDistance) Sets the minimum distance in pixels between clusters that will be capped at the configured distance.voidsetPointTextStyle(Style pointTextStyle) Sets the text style of cluster marker.voidsetShowSinglePointAsCluster(Boolean showSinglePointAsCluster) Enables to show not clustered feature (single point, marker, etc.) as a cluster marker of 1 size.voidsetVectorSource(AbstractVectorSource vectorSource) Sets vector source which features should be clustered.voidsetWeightProperty(String weightProperty) Sets weight property that is defined in a feature or in an entity.voidwithAttributions(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, getTypeMethods inherited from class io.jmix.mapsflowui.kit.component.model.source.AbstractVectorSource
getOverlaps, getUseSpatialIndex, setOverlaps, setUseSpatialIndexMethods inherited from class io.jmix.mapsflowui.kit.component.model.source.Source
getAttributionsCollapsible, getId, getProjection, setAttributionsCollapsible, setId, setProjectionMethods 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:
getDistancein interfaceAbstractClusterSource.HasDistance- Overrides:
getDistancein classAbstractClusterSource- Returns:
- the distance or
nullif 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:
setDistancein interfaceAbstractClusterSource.HasDistance- Overrides:
setDistancein classAbstractClusterSource- Parameters:
distance- distance in pixels
-
withDistance
SeesetDistance(Integer).- Parameters:
distance- distance in pixels- Returns:
- current instance
-
getMinDistance
- Specified by:
getMinDistancein interfaceAbstractClusterSource.HasMinDistance- Overrides:
getMinDistancein classAbstractClusterSource- Returns:
- the minimum distance in pixels or
nullif 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:
setMinDistancein interfaceAbstractClusterSource.HasMinDistance- Overrides:
setMinDistancein classAbstractClusterSource- Parameters:
minDistance- minimum distance in pixels between clusters
-
withMinDistance
- Parameters:
minDistance- minimum distance in pixels between clusters- Returns:
- current instance
-
getVectorSource
- Specified by:
getVectorSourcein interfaceAbstractClusterSource.HasVectorSource- Overrides:
getVectorSourcein classAbstractClusterSource- Type Parameters:
T- vector source type- Returns:
- vector source or
nullif not set
-
setVectorSource
Sets vector source which features should be clustered.- Specified by:
setVectorSourcein interfaceAbstractClusterSource.HasVectorSource- Overrides:
setVectorSourcein classAbstractClusterSource- Parameters:
vectorSource- vector source to set
-
withVectorSource
- Parameters:
vectorSource- vector source to set- Returns:
- current instance
-
getAttributions
- Specified by:
getAttributionsin interfaceSource.HasAttributions- Overrides:
getAttributionsin classSource- Returns:
- the attributions of the source or
nullif not set
-
setAttributions
- Specified by:
setAttributionsin interfaceSource.HasAttributions- Overrides:
setAttributionsin classSource- Parameters:
attributions- info about copyrights and licences
-
withAttributions
- Parameters:
attributions- info about copyrights and licences- Returns:
- current instance
-
getWrapX
- Specified by:
getWrapXin interfaceSource.HasWrapX- Overrides:
getWrapXin classSource- Returns:
- whether the source should be looped along the X coordinate or
nullif not set
-
setWrapX
- Specified by:
setWrapXin interfaceSource.HasWrapX- Overrides:
setWrapXin 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:
getPointStylesin interfaceAbstractClusterSource.HasPointStyle- Overrides:
getPointStylesin 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:
addPointStylesin interfaceAbstractClusterSource.HasPointStyle- Overrides:
addPointStylesin classAbstractClusterSource- Parameters:
styles- cluster point styles to add
-
withPointStyles
- Parameters:
styles- styles to add- Returns:
- current instance
-
removePointStyles
Removes cluster point styles.- Specified by:
removePointStylesin interfaceAbstractClusterSource.HasPointStyle- Overrides:
removePointStylesin classAbstractClusterSource- Parameters:
styles- styles to remove
-
removeAllPointStyles
public void removeAllPointStyles()Removes all added cluster point styles.- Specified by:
removeAllPointStylesin interfaceAbstractClusterSource.HasPointStyle- Overrides:
removeAllPointStylesin classAbstractClusterSource
-
getPointTextStyle
- Specified by:
getPointTextStylein interfaceAbstractClusterSource.HasPointTextStyle- Overrides:
getPointTextStylein 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:
setPointTextStylein interfaceAbstractClusterSource.HasPointTextStyle- Overrides:
setPointTextStylein classAbstractClusterSource- Parameters:
pointTextStyle- text style to set
-
withPointTextStyle
- Parameters:
pointTextStyle- text style to set- Returns:
- current instance
-
getWeightProperty
- Specified by:
getWeightPropertyin interfaceAbstractClusterSource.HasWeightProperty- Overrides:
getWeightPropertyin classAbstractClusterSource- Returns:
- weight property or
nullif 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:
setWeightPropertyin interfaceAbstractClusterSource.HasWeightProperty- Overrides:
setWeightPropertyin 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:
getShowSinglePointAsClusterin interfaceAbstractClusterSource.HasShowSinglePointAsCluster- Overrides:
getShowSinglePointAsClusterin classAbstractClusterSource- Returns:
trueif feature is shown as a cluster marker of 1 size ornullif 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:
setShowSinglePointAsClusterin interfaceAbstractClusterSource.HasShowSinglePointAsCluster- Overrides:
setShowSinglePointAsClusterin 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:
getDisableAtZoomin interfaceAbstractClusterSource.HasDisableAtZoom- Overrides:
getDisableAtZoomin classAbstractClusterSource- Returns:
- zoom level or
nullif not set
-
setDisableAtZoom
Sets zoom level from which clustering will be disabled.- Specified by:
setDisableAtZoomin interfaceAbstractClusterSource.HasDisableAtZoom- Overrides:
setDisableAtZoomin 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:
setApplicationContextin interfaceorg.springframework.context.ApplicationContextAware- Throws:
org.springframework.beans.BeansException
-