Strategy for vector feature clustering.
ALKMaps. | Strategy for vector feature clustering. |
Properties | |
distance | {Integer} Pixel distance between features that should be considered a single cluster. |
attribute | {String} Use it as the key to find the value in the feature attributes collection. |
rule | {ALKMaps.Rule} with {ALKMaps.Filter.Comparison} as filter option. |
threshold | {Integer} Optional threshold below which original features will be added to the layer instead of clusters. |
features | {Array(ALKMaps.Feature.Vector)} Cached features. |
clusters | {Array(ALKMaps.Feature.Vector)} Calculated clusters. |
clustering | {Boolean} The strategy is currently clustering features. |
resolution | {Float} The resolution (map units per pixel) of the current cluster set. |
maxZoomLevel | {Number} Indicates the maximum zoom level at which vectors will be clustered. |
Constructor | |
ALKMaps. | Create a new clustering strategy. |
Functions | |
activate | Activate the strategy. |
deactivate | Deactivate the strategy. |
cacheFeatures | Cache features before they are added to the layer. |
clearCache | Clear out the cached features. |
cluster | Cluster features based on some threshold distance. |
recluster | User-callable function to recluster features Useful for instances where a clustering attribute (distance, threshold, ...) |
clustersExist | Determine whether calculated clusters are already on the layer. |
shouldCluster | Determine whether to include a feature in a given cluster. |
addToCluster | Add a feature to a cluster. |
createCluster | Given a feature, create a cluster. |
{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).
{Array(ALKMaps.Feature.Vector)} Cached features.
{Array(ALKMaps.Feature.Vector)} Calculated clusters.
shouldCluster: function( cluster, feature )
Determine whether to include a feature in a given cluster.
cluster | {ALKMaps.Feature.Vector} A cluster. |
feature | {ALKMaps.Feature.Vector} A feature. |
{Boolean} The feature should be included in the cluster.
addToCluster: function( cluster, feature )
Add a feature to a cluster.
cluster | {ALKMaps.Feature.Vector} A cluster. |
feature | {ALKMaps.Feature.Vector} A feature. |
createCluster: function( feature )
Given a feature, create a cluster.
feature | {ALKMaps.Feature.Vector} |
{ALKMaps.Feature.Vector} A cluster.
Activate the strategy.
activate: function()
Deactivate the strategy.
deactivate: function()
Cache features before they are added to the layer.
cacheFeatures: function( event )
Clear out the cached features.
clearCache: function()
Cluster features based on some threshold distance.
cluster: function( event )
User-callable function to recluster features Useful for instances where a clustering attribute (distance, threshold, ...)
recluster: function()
Determine whether calculated clusters are already on the layer.
clustersExist: function()
Determine whether to include a feature in a given cluster.
shouldCluster: function( cluster, feature )
Add a feature to a cluster.
addToCluster: function( cluster, feature )
Given a feature, create a cluster.
createCluster: function( feature )