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)

circleMaxObject Number

number of object that can be place on a circle

maxObjects Number

number of object that can be drawn, other are hidden

animation bool

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

animationDuration Number

animation duration in ms, default is 500ms

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


getLayer()

Get the layer for the revealed features


selectCluster(a)

Select a cluster

Parameters:
Name Type Description
a 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.