Maps API for JavaScript Developer's Guide

H.clustering.Provider

Class Summary

Extends: H.map.provider.LocalObjectProvider

The clustering provider serves clusters and noise point representation for the map based on the provided data set. Levels for clustering as well as custom cluster representation can be set via Options.

[ For full details, see the Class Details ]

Method Summary

Table 1. Methods
Methods

addEventListener (type, handler, opt_capture, opt_scope)

This method allows to listen for specific event triggered by the object

removeEventListener (type, handler, opt_capture, opt_scope)

This method will removed previously added listener from the event target

dispatchEvent (evt)

This method will dispatch event on the event target object

dispose ()

Removes listeners from this object. Classes that extend EventTarget may need to override this method in order to remove references to DOM Elements and additional listeners.

addOnDisposeCallback (callback, opt_scope)

This method adds callback which is triggered when the object is being disposed

setDataPoints (dataPoints)

This method sets a new data on the provider class.

addDataPoint (dataPoint)

This method adds a data point to the provider. Note that this method triggers re-clustering of the the data set associated with the provider.

addDataPoints (dataPoints)

This method adds a list of data points to the provider. Note that this method triggers re-clustering of the data set associated with the provider.

removeDataPoint (dataPoint)

This method removes a data point from the provider's data set. Note that this method triggers re-clustering of the data set associated with the provider.

getTheme () : {H.clustering.ITheme}

This method retrieves the current theme used for cluster visualizations.

setTheme (theme)

This method sets new theme on the provider. Note that this method changes the visual representation of the displayed clusters and noise points.

Class Description

The clustering provider serves clusters and noise point representation for the map based on the provided data set. Levels for clustering as well as custom cluster representation can be set via Options.

Example

var dataPoints = [
  new H.clustering.DataPoint(52, 1),
  new H.clustering.DataPoint(52.1, 1)
];

var clusteringProvider = new H.clustering.Provider(dataPoints, {
  clusteringOptions: {
   minWeight: 1,
   eps: 32
  }
});
// clustering should be used with ObjectLayer
var clusteringLayer = new H.map.layer.ObjectLayer(clusteringProvider);
map.addLayer(clusteringLayer);

Constructor Details

H.clustering.Provider(dataPoints, opt_options)

Parameters:
 
dataPoints:
{Array<H.clustering.DataPoint>}
 
An array of objects representing data points
opt_options:
{H.clustering.Provider.Options=} [optional]
 
An object containing configuration options
Throws:
 
{H.lang.InvalidArgumentError}
 
If `H.clustering.Provider.Strategy.DYNAMICGRID` strategy is used with the projection other than default H.geo.mercator projection.

Method Details

addEventListener (type, handler, opt_capture, opt_scope)

This method allows to listen for specific event triggered by the object

Parameters:
 
type:
{string}
 
name of event
handler:
{!Function}
 
event handler function
opt_capture:
{boolean=} [optional]
 
if set to true will listen in the capture phase (bubble otherwise)
opt_scope:
{Object=} [optional]
 
scope for the handler function

removeEventListener (type, handler, opt_capture, opt_scope)

This method will removed previously added listener from the event target

Parameters:
 
type:
{string}
 
name of event
handler:
{!Function}
 
previously added event handler
opt_capture:
{boolean=} [optional]
 
if set to true will listen in the capture phase (bubble otherwise)
opt_scope:
{Object=} [optional]
 
scope for the handler function

dispatchEvent (evt)

This method will dispatch event on the event target object

Parameters:
 
evt:
{(H.util.Event | string)}
 
event object or event name

dispose ()

Removes listeners from this object. Classes that extend EventTarget may need to override this method in order to remove references to DOM Elements and additional listeners.

addOnDisposeCallback (callback, opt_scope)

This method adds callback which is triggered when the object is being disposed

Parameters:
 
callback:
{!Function}
 
opt_scope:
{Object=} [optional]
 

setDataPoints (dataPoints)

This method sets a new data on the provider class.

Parameters:
 
dataPoints:
{Array<H.clustering.DataPoint>}
 
A set of data points

addDataPoint (dataPoint)

This method adds a data point to the provider. Note that this method triggers re-clustering of the the data set associated with the provider.

Parameters:
 
dataPoint:
{H.clustering.DataPoint}
 
An object representing the data point to add

addDataPoints (dataPoints)

This method adds a list of data points to the provider. Note that this method triggers re-clustering of the data set associated with the provider.

Parameters:
 
dataPoints:
{Array<H.clustering.DataPoint>}
 
A set of data point objects to add

removeDataPoint (dataPoint)

This method removes a data point from the provider's data set. Note that this method triggers re-clustering of the data set associated with the provider.

Parameters:
 
dataPoint:
{H.clustering.DataPoint}
 
An object representing the data point to remove

getTheme () : {H.clustering.ITheme}

This method retrieves the current theme used for cluster visualizations.

Returns:
 
{H.clustering.ITheme}
An object representing the clustering scheme

setTheme (theme)

This method sets new theme on the provider. Note that this method changes the visual representation of the displayed clusters and noise points.

Parameters:
 
theme:
{H.clustering.ITheme}
 
An object representing the theme to set