Class MarkerClusterGroup
java.lang.Object
org.vaadin.addons.componentfactory.leaflet.LeafletObject
org.vaadin.addons.componentfactory.leaflet.layer.Layer
org.vaadin.addons.componentfactory.leaflet.layer.groups.LayerGroup
org.vaadin.addons.componentfactory.leaflet.layer.groups.FeatureGroup
org.vaadin.addons.componentfactory.leaflet.plugins.markercluster.MarkerClusterGroup
- All Implemented Interfaces:
Serializable,Evented,SupportsLayerEvents,SupportsMouseEvents,FeatureGroupFunctions,LayerGroupFunctions,HasStyle,Identifiable,LayerPopupFunctions,LayerTooltipFunctions,ExecutableFunctions
@NpmPackage(value="leaflet.markercluster",
version="1.5.3")
@JsModule("leaflet.markercluster/dist/leaflet.markercluster-src.js")
@CssImport(value="leaflet.markercluster/dist/MarkerCluster.css",themeFor="leaflet-map") @CssImport(value="leaflet.markercluster/dist/MarkerCluster.Default.css",themeFor="leaflet-map")
public class MarkerClusterGroup
extends FeatureGroup
Leaflet.markercluster
Web component: https://www.npmjs.com/package/leaflet.markerclusterProvides Beautiful Animated Marker Clustering functionality for LeafletMap.
- Since:
- 2020-05-26
- Version:
- 1.0
- Author:
- Gabor Kokeny Email: kokeny19@gmail.com
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.vaadin.addons.componentfactory.leaflet.layer.Layer
Layer.LayerEventType -
Field Summary
Fields inherited from class org.vaadin.addons.componentfactory.leaflet.layer.Layer
DEFAULT_PANE -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new marker cluster group with default clustering options.MarkerClusterGroup(MarkerClusterOptions options) Creates a new marker cluster group configured with the given options. -
Method Summary
Modifier and TypeMethodDescriptionintGets the delay, in milliseconds, between processing consecutive chunks when chunked loading is enabled.intGets the maximum time, in milliseconds, spent processing markers in a single chunk before yielding to the browser.Gets the name of the map pane in which the cluster icons are placed.Returns the client-side constructor argument names for this layer.Gets the zoom level at and beyond which clustering is disabled, ornullif clustering is always enabled.intGets the maximum radius, in pixels, that a cluster will cover from the central marker.Gets the clustering options applied to this marker cluster group.getPane()Gets the map pane in which the cluster icons are placed.Gets the path options used to style the coverage polygon shown when a cluster is hovered.doubleGets the multiplier applied to the distance between markers when a cluster is spiderfied.Gets the path options used to style the leg lines drawn to each marker when a cluster is spiderfied.booleanReturns whether cluster splitting and merging is animated on zoom.booleanReturns whether markers added after the initial batch are animated into their clusters.booleanReturns whether markers are added in chunks to keep the UI responsive when loading large numbers of markers.booleanReturns whether clusters and markers that fall outside the visible map bounds are removed from the DOM for performance.booleanReturns whether the bounds of the markers contained in a cluster are shown as a polygon when the cluster is hovered.booleanReturns whether single markers are wrapped in a cluster icon rather than shown as a plain marker.booleanReturns whether clicking a cluster at the bottom zoom level spiderfies it so all of its markers become visible.booleanReturns whether clicking a cluster zooms the map to the bounds of its markers.voidonAnimationEnd(LeafletEventListener<LeafletEvent> listener) Fires when marker clustering/unclustering animation has completedvoidonClusterClick(LeafletEventListener<LeafletEvent> listener) Fired when the user clicks (or taps) the marker clustervoidonClusterMouseOut(LeafletEventListener<LeafletEvent> listener) Fired when the mouse leaves the marker clustervoidonClusterMouseOver(LeafletEventListener<LeafletEvent> listener) Fired when the mouse enters the marker clustervoidonSpiderfied(LeafletEventListener<LeafletEvent> listener) Fires when overlapping markers get spiderified (Contains cluster and markers attributes)voidonUnspiderfied(LeafletEventListener<LeafletEvent> listener) Fires when overlapping markers get unspiderified (Contains cluster and markers attributes)Methods inherited from class org.vaadin.addons.componentfactory.leaflet.layer.groups.FeatureGroup
getStyle, setStyleMethods inherited from class org.vaadin.addons.componentfactory.leaflet.layer.groups.LayerGroup
addLayer, clearLayers, eachLayer, findLayer, getLayer, getLayerId, getLayers, hasLayer, hasLayer, invoke, removeLayer, removeLayer, setZIndex, toGeoJSONMethods inherited from class org.vaadin.addons.componentfactory.leaflet.layer.Layer
addEventListener, addTo, addTo, bindPopup, bindPopup, bindTooltip, bindTooltip, clearAllEventListeners, fireEvent, getAttribution, getEvents, getPopup, getTooltip, hasEventListeners, onAdd, onPopupClose, onPopupOpen, onRemove, onTooltipClose, onTooltipOpen, remove, removeEventListener, set, setAttribution, setPane, unbindPopup, unbindTooltipMethods inherited from class org.vaadin.addons.componentfactory.leaflet.LeafletObject
call, configureObjectMapper, executeJs, getJson, getLeafletType, getParent, getUuid, setParentMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.vaadin.addons.componentfactory.leaflet.layer.events.Evented
addEventListener, clearAllEventListeners, hasEventListeners, listens, off, off, on, removeEventListenerMethods inherited from interface org.vaadin.addons.componentfactory.leaflet.layer.map.functions.ExecutableFunctions
call, call, executeJs, executeJsMethods inherited from interface org.vaadin.addons.componentfactory.leaflet.layer.groups.FeatureGroupFunctions
bringToBack, bringToFront, getBoundsMethods inherited from interface org.vaadin.addons.componentfactory.leaflet.layer.Identifiable
getUuidMethods inherited from interface org.vaadin.addons.componentfactory.leaflet.layer.LayerPopupFunctions
closePopup, isPopupOpen, openPopup, openPopup, setPopupContent, setPopupContent, togglePopupMethods inherited from interface org.vaadin.addons.componentfactory.leaflet.layer.LayerTooltipFunctions
closeTooltip, isTooltipOpen, openTooltip, openTooltip, setTooltipContent, setTooltipContent, toggleTooltipMethods inherited from interface org.vaadin.addons.componentfactory.leaflet.layer.events.supports.SupportsLayerEvents
onLayerAdd, onLayerRemoveMethods inherited from interface org.vaadin.addons.componentfactory.leaflet.layer.events.supports.SupportsMouseEvents
onClick, onContextMenuOpened, onDoubleClick, onMouseDown, onMouseMove, onMouseOut, onMouseOver, onMouseUp
-
Constructor Details
-
MarkerClusterGroup
public MarkerClusterGroup()Creates a new marker cluster group with default clustering options. -
MarkerClusterGroup
Creates a new marker cluster group configured with the given options.- Parameters:
options- the clustering options to apply, notnull
-
-
Method Details
-
getOptions
Gets the clustering options applied to this marker cluster group.- Returns:
- the clustering options
-
onClusterClick
Fired when the user clicks (or taps) the marker cluster- Parameters:
listener- the listener to call when the event occurs, notnull
-
onClusterMouseOver
Fired when the mouse enters the marker cluster- Parameters:
listener- the listener to call when the event occurs, notnull
-
onClusterMouseOut
Fired when the mouse leaves the marker cluster- Parameters:
listener- the listener to call when the event occurs, notnull
-
onAnimationEnd
Fires when marker clustering/unclustering animation has completed- Parameters:
listener- the listener to call when the event occurs, notnull
-
onSpiderfied
Fires when overlapping markers get spiderified (Contains cluster and markers attributes)- Parameters:
listener- the listener to call when the event occurs, notnull
-
onUnspiderfied
Fires when overlapping markers get unspiderified (Contains cluster and markers attributes)- Parameters:
listener- the listener to call when the event occurs, notnull
-
getConstructorArgumentNames
Returns the client-side constructor argument names for this layer. A marker cluster group is created without positional constructor arguments.- Overrides:
getConstructorArgumentNamesin classLeafletObject- Returns:
- an empty list
-
getPane
Gets the map pane in which the cluster icons are placed. -
getMaxClusterRadius
public int getMaxClusterRadius()Gets the maximum radius, in pixels, that a cluster will cover from the central marker.- Returns:
- the maximum cluster radius in pixels
-
getClusterPane
Gets the name of the map pane in which the cluster icons are placed.- Returns:
- the cluster pane name
-
isSpiderfyOnMaxZoom
public boolean isSpiderfyOnMaxZoom()Returns whether clicking a cluster at the bottom zoom level spiderfies it so all of its markers become visible.- Returns:
trueif the cluster spiderfies at the maximum zoom level
-
isShowCoverageOnHover
public boolean isShowCoverageOnHover()Returns whether the bounds of the markers contained in a cluster are shown as a polygon when the cluster is hovered.- Returns:
trueif the cluster coverage polygon is shown on hover
-
isZoomToBoundsOnClick
public boolean isZoomToBoundsOnClick()Returns whether clicking a cluster zooms the map to the bounds of its markers.- Returns:
trueif clicking a cluster zooms to its bounds
-
isSingleMarkerMode
public boolean isSingleMarkerMode()Returns whether single markers are wrapped in a cluster icon rather than shown as a plain marker.- Returns:
trueif single marker mode is enabled
-
getDisableClusteringAtZoom
Gets the zoom level at and beyond which clustering is disabled, ornullif clustering is always enabled.- Returns:
- the zoom level at which clustering is disabled, or
null
-
isRemoveOutsideVisibleBounds
public boolean isRemoveOutsideVisibleBounds()Returns whether clusters and markers that fall outside the visible map bounds are removed from the DOM for performance.- Returns:
trueif markers outside the visible bounds are removed
-
isAnimate
public boolean isAnimate()Returns whether cluster splitting and merging is animated on zoom.- Returns:
trueif clustering animations are enabled
-
isAnimateAddingMarkers
public boolean isAnimateAddingMarkers()Returns whether markers added after the initial batch are animated into their clusters.- Returns:
trueif adding markers is animated
-
getSpiderfyDistanceMultiplier
public double getSpiderfyDistanceMultiplier()Gets the multiplier applied to the distance between markers when a cluster is spiderfied.- Returns:
- the spiderfy distance multiplier
-
getSpiderLegPolylineOptions
Gets the path options used to style the leg lines drawn to each marker when a cluster is spiderfied.- Returns:
- the spider leg polyline options
-
isChunkedLoading
public boolean isChunkedLoading()Returns whether markers are added in chunks to keep the UI responsive when loading large numbers of markers.- Returns:
trueif chunked loading is enabled
-
getChunkInterval
public int getChunkInterval()Gets the maximum time, in milliseconds, spent processing markers in a single chunk before yielding to the browser.- Returns:
- the chunk processing interval in milliseconds
-
getChunkDelay
public int getChunkDelay()Gets the delay, in milliseconds, between processing consecutive chunks when chunked loading is enabled.- Returns:
- the delay between chunks in milliseconds
-
getPolygonOptions
Gets the path options used to style the coverage polygon shown when a cluster is hovered.- Returns:
- the coverage polygon options
-