/** * @module SuperCluster */ import Supercluster from "supercluster"; import { Feature, View } from 'ol'; import { Geometry } from 'ol/geom'; import { Vector as VectorSource } from 'ol/source'; import { Extent } from 'ol/extent'; import Projection from 'ol/proj/Projection'; import { GeoJsonProperties } from 'geojson'; /** * @typedef {Object} Options * @property {import("ol/source/Source").AttributionLike} [attributions] Attributions. * @property {import("ol/view/View").View} [view] View of the map. * @property {number} [radius=60] Radius in pixels between clusters. * @property {boolean} [onDemandMode=false] Defines if the features leaves should be * processed while detecting clusters or not * @property {function(Feature):GeoJSON.Feature} [geojsonFunction] * Function that takes an {@link module:ol/Feature} as argument and returns an * {@link module:Supercluster.Point

} as input for SuperCluster based on the feature. When a * feature should not be considered for clustering, the function should return * `null`. The default, which works when the underyling source contains point * features only, is * ```js * function(feature) { * return feature.getGeometry(); * } * ``` * See {@link module:ol/geom/Polygon~Polygon#getInteriorPoint} for a way to get a cluster * calculation point for polygons. * @property {VectorSource} source Source. * @property {boolean} [wrapX=true] Whether to wrap the world horizontally. */ /** * @classdesc * Layer source to cluster vector data. Works out of the box with point * geometries. For other geometry types, or if not all geometries should be * considered for clustering, a custom `geojsonFunction` can be defined. * @api */ declare class SuperCluster

extends VectorSource { protected resolution_?: number; protected extent_?: Extent; protected projection_?: Projection; protected view_: View; protected radius_: number; protected onDemandMode_: boolean; protected features_: Feature[]; protected cluster_?: Supercluster

; protected clusterFeatures_: Feature[]; protected geojsonFunction_: (feature: Feature) => Supercluster.PointFeature

; protected source_: VectorSource; /** * @param {Options} options Cluster options. */ constructor(options: any); /** * Get the radius in pixels between clusters. * @return {number} radius. * @api */ getRadius(): number; /** * Get a reference to the wrapped source. * * @return {VectorSource} Source. * @api */ getSource(): VectorSource; /** * @inheritDoc */ loadFeatures(extent: Extent, resolution: number, projection: Projection): void; /** * Set the radius in pixels between clusters. * @param {number} radius The radius in pixels. * @api */ setRadius(radius: number): void; /** * handle the source changing * @override */ refresh(): boolean; /** * @argument {boolean} force Force creation of new SuperCluster instance * @protected */ protected processCluster_(force: boolean): void; /** * Return all the features that are contained inside a cluster. * If the feature isn't a cluster, return the feature itself. * * @param {Feature} feature The cluster to get features inside * @returns {Array} The list of features inside the cluster */ getFeaturesForCluster(feature: Feature): Feature[]; /** * Returns the zoom on which the cluster expands into several children * (useful for "click to zoom" feature) given the feature * * @param {Feature} feature The feature to get the zoom to expand into * @returns {number} The zoom level to expand to */ getClusterExpansionZoom(feature: Feature): number; } export default SuperCluster;