Class: SelectCluster

ol.interaction. SelectCluster

Interaction for selecting vector features in a cluster. It can be used as an ol.interaction.Select. When clicking on a cluster, it springs apart to reveal the features in the cluster. Revealed features are selectable and you can pick the one you meant. Revealed features are themselves a cluster with an attribute features that contain the original feature.


new SelectCluster( [options])

Parameters:
Name Type Argument Description
options olx.interaction.SelectOptions <optional>

SelectOptions.

Properties
Name Type Description
featureStyle ol.style

used to style the revealed features as options.style is used by the Select interaction.

selectCluster boolean

false if you don't want to get cluster selected

pointRadius Number

to calculate distance between the features

spiral bool

means you want the feature to be placed on a spiral (or a circle)

circleMaxObjects Number

number of object that can be place on a circle

maxObjects Number

number of object that can be drawn, other are hidden

animate bool

if the cluster will animate when features spread out, default is false

animationDuration Number

animation duration in ms, default is 500ms

autoClose boolean

if selecting a cluster should close previously selected clusters. False to get toggle feature. Default is true

Fires:
  • ol.interaction.event:SelectEvent

Extends

  • ol.interaction.Select

Methods


animateCluster_(the)

Animate the cluster and spread out the features

Parameters:
Name Type Description
the ol.Coordinates

center of the cluster


clear()

Clear the selection, close the cluster and remove revealed features


getClusterExtent(feature)

Helper function to get the extent of a cluster

Parameters:
Name Type Description
feature ol.feature
Returns:

the extent or null if extent is empty (no cluster or superimposed points)

Type
ol.extent | null

getLayer()

Get the layer for the revealed features


selectCluster(a)

Select a cluster

Parameters:
Name Type Description
a ol.SelectEvent | ol.Feature

cluster feature ie. a feature with a 'features' attribute.


setMap(map)

Remove the interaction from its current map, if any, and attach it to a new map, if any. Pass null to just remove the interaction from the current map.

Parameters:
Name Type Description
map ol.Map

Map.