Class GSClusterer

This library creates and manages clusters for large numbers of point features

Class Summary
Constructor Attributes Constructor Name and Description
 
GSClusterer(map, features, options)
Creates a GSClusterer instance
Method Summary
Method Attributes Method Name and Description
 
addFeature(feature, isNodraw, isAdded, clusters, isNoCheck)
Adds a feature
 
addFeatures(features)
Adds a set of features
 
Removes all features from the clusterer
 
Returns the cluster icon
 
Gets the configured cluster listeners
 
Get the grid size
 
Gets the clusterer's map instance
 
Get the max zoom level
 
Get the total number of clusters
 
Get the total number of features
 
Redraws all clusters in the viewport
 
removeFeature(feature)
Remove a feature
 
Collects all features for clusters in viewport and regroups them
 
setVisible(visible)
Set the visibilty of the clusterer's features
Class Detail
GSClusterer(map, features, options)
Creates a GSClusterer instance
Parameters:
{GSMap} map
the map instance that the features are to be displayed on
{Array} features
an array of GSPointFeature instances to cluster
{Object} options Optional
optional parameters
{int} options.gridSize
the size of each cluster cell in pixels
{int} options.maxZoom
the maximum zoom level at which the clusterer will cluster
{boolean} options.visible
true if the clusterer features should be visible (defaults to true)
{GSIcon} options.clusterIcon
icon to use for cluster features
{Function} options.clusterListeners
a hash of listener functions that will be called in response to cluster mouse events. Listener functions are called with the following arguments:
  • cluster - the cluster feature that was clicked
  • features - the features represented by the cluster
  • event - the native mouse event
By default a click listener will be added to each cluster feature, this default behaviour can be overriden by providing your own click listener. If the scope property is defined all listener functions will be called in the scope of the passed object. features
Method Detail
addFeature(feature, isNodraw, isAdded, clusters, isNoCheck)
Adds a feature
Parameters:
{GSPointFeature} feature
the feature to add
{Boolean} isNodraw Optional
whether to redraw the cluster containing the feature
{Boolean} isAdded Optional
whether the feature is added to the map
{Array} clusters Optional
if provided the clusterer will only check these clusters for the feature to join
isNoCheck

addFeatures(features)
Adds a set of features
Parameters:
{Array} features
the features to add

clearFeatures()
Removes all features from the clusterer

{GSIcon} getClusterIcon()
Returns the cluster icon
Returns:
{GSIcon} the cluster icon

{Object} getClusterListeners()
Gets the configured cluster listeners
Returns:
{Object} the cluster listeners

{int} getGridSize()
Get the grid size
Returns:
{int} the grid size

getMap()
Gets the clusterer's map instance

{int} getMaxZoom()
Get the max zoom level
Returns:
{int} the max zoom level

{int} getTotalClusters()
Get the total number of clusters
Returns:
{int} the total number of clusters

{int} getTotalFeatures()
Get the total number of features
Returns:
{int} the total number of features

redraw()
Redraws all clusters in the viewport

removeFeature(feature)
Remove a feature
Parameters:
{GSPointFeature} feature
the feature to remove

resetViewport()
Collects all features for clusters in viewport and regroups them

setVisible(visible)
Set the visibilty of the clusterer's features
Parameters:
{boolean} visible

Documentation generated by JsDoc Toolkit 2.3.2 on Wed Mar 07 2012 11:47:28 GMT+1300 (NZDT)