Strategy for vector feature clustering.
NOTE: This code includes a patch for OpenLayers.Layer.Vector.getDataExtent function.
| OpenLayers. | Strategy for vector feature clustering. |
| Properties | |
| centered | {Boolean} |
| enabled | {Boolean} |
| zoomSettings | {Boolean} |
| candidateMatches | {Function} |
| distance | {Integer} Pixel distance between features that should be considered a single cluster. |
| threshold | {Integer} Optional threshold below which original features will be added to the layer instead of clusters. |
| features | {Array(<OpenLayers.Feature.Vector>)} Cached features. |
| clustering | {Boolean} The strategy is currently clustering features. |
| resolution | {Float} The resolution (map units per pixel) of the current cluster set. |
| defaultSettings | {Object} Internal use only. |
| Constructor | |
| OpenLayers. | Create a new CenteredCluster strategy. |
| Properties | |
| _candidateMatches | {Function} Set by _createClusters method. |
| _resDistance2 | {Fload} Set by _createClusters method, and used in _withinDistance. |
| Functions | |
| _addFeature | Add the feature to the cluster |
| _centerCluster | cluster -{Object} |
| _trimCluster | |
| _groupFeatures | clusters -Array({Object}) Initial and calculated clusters at the end. |
| _groupClusters | |
| _createClusters | |
| cluster | Cluster features based on some threshold distance. |
| onMoveend | |
| activate | Activate the strategy. |
| deactivate | Deactivate the strategy. |
| cacheFeatures | Cache features before they are added to the layer. |
| refreshCache | Refresh the cached features. |
| uncluster | Uncluster features. |
| OpenLayers. | Instances of OpenLayers.Layer.Vector are used to render vector data from a variety of sources. |
| Functions | |
| getDataExtent | Calculates the max extent which includes all of the features, even if they are clustered. |
{Integer} Optional threshold below which original features will be added to the layer instead of clusters. For example, a threshold of 3 would mean that any time there are 2 or fewer features in a cluster, those features will be added directly to the layer instead of a cluster representing those features. Default is null (which is equivalent to 1 - meaning that clusters may contain just one feature)
Instances of OpenLayers.Layer.Vector are used to render vector data from a variety of sources. Create a new vector layer with the OpenLayers.Layer.Vector constructor.
| Functions | |
| getDataExtent | Calculates the max extent which includes all of the features, even if they are clustered. |
Add the feature to the cluster
var _addFeature = function( cluster, feature, fCenter )
cluster -{Object}
var _centerCluster = function( cluster )
var _trimCluster = function( rejections, cluster )
clusters -Array({Object}) Initial and calculated clusters at the end.
var _groupFeatures = function( clusters, features )
var _groupClusters = function( remainingStart, clusters, candidates )
var _self = this; var _createClusters = function( resolution )
Cluster features based on some threshold distance.
var cluster = function( event )
onMoveend: function( event )
Activate the strategy.
activate: function()
Deactivate the strategy.
deactivate: function()
Cache features before they are added to the layer.
cacheFeatures: function( event )
Refresh the cached features.
refreshCache: function()
Uncluster features.
uncluster: function()
Calculates the max extent which includes all of the features, even if they are clustered.
OpenLayers.Layer.Vector.prototype.getDataExtent = function()