import { PointIndex, PointShape, Tile } from '..';
import type { FeatureIterator } from '..';
import type { Face, JSONCollection, MValue, Projection, Properties, S2CellId, VectorPoint, VectorPointM } from '../geometry';
import type { VectorStore, VectorStoreConstructor } from '../dataStore/vector';
/** The kind of input required to store a point for proper indexing */
export type ClusterStore<M extends MValue = Properties> = VectorStoreConstructor<PointShape<Cluster<M>>>;
/** The type of search to use */
export type ClusterSearch = 'radial' | 'cell';
/** Options for point clustering */
export interface ClusterOptions<M extends MValue = Properties> {
    /** type of store to use. Defaults to an in memory store */
    store?: ClusterStore<M>;
    /** projection to use */
    projection?: Projection;
    /** Name of the layer to build when requesting a tile */
    layerName?: string;
    /** min zoom to generate clusters on */
    minzoom?: number;
    /** max zoom level to cluster the points on */
    maxzoom?: number;
    /** cluster radius in pixels relative to a 512x512 pixel tile */
    radius?: number;
}
/** A cluster is a storage device to maintain groups of information in a cluster */
export interface Cluster<M extends MValue = Properties> extends Properties {
    data: M;
    visited: boolean;
    value: number;
}
/** Compare two data items, return true to merge data */
export type ClusterDataComparitor<M extends MValue = Properties> = (a: M, b: M) => boolean;
/**
 * # Point Cluster
 *
 * ## Description
 * A cluster store to index points at each zoom level
 *
 * ## Usage
 * ```ts
 * import { PointCluster } from 'gis-tools-ts';
 * const pointCluster = new PointCluster();
 *
 * // add a lon-lat
 * pointCluster.insertLonLat(lon, lat, data);
 * // add an STPoint
 * pointCluster.insertFaceST(face, s, t, data);
 *
 * // after adding data build the clusters
 * await pointCluster.buildClusters();
 *
 * // get the clusters for a tile
 * const tile = await pointCluster.getTile(id);
 * // or get the raw cluster data
 * const clusters = await pointCluster.getCellData(id);
 * ```
 */
export declare class PointCluster<M extends MValue = Properties> {
    #private;
    projection: Projection;
    layerName: string;
    minzoom: number;
    maxzoom: number;
    radius: number;
    gridSize: number;
    indexes: Map<number, PointIndex<Cluster<M>>>;
    /**
     * @param data - if provided, the data to index
     * @param options - cluster options on how to build the cluster
     * @param maxzoomStore - the store to use for the maxzoom index
     */
    constructor(data?: JSONCollection<unknown, M, M>, options?: ClusterOptions<M>, maxzoomStore?: VectorStore<PointShape<Cluster<M>>>);
    /**
     * Add a point to the maxzoom index. The point is a Point3D
     * @param point - the point to add
     */
    insert(point: VectorPointM<M>): void;
    /**
     * Add all points from a reader. It will try to use the M-value first, but if it doesn't exist
     * it will use the feature properties data
     * @param reader - a reader containing the input data
     */
    insertReader(reader: FeatureIterator<unknown, M, M>): Promise<void>;
    /**
     * Add a vector feature. It will try to use the M-value first, but if it doesn't exist
     * it will use the feature properties data
     * @param data - any source of data like a feature collection or features themselves
     */
    insertFeature(data: JSONCollection<unknown, M, M>): void;
    /**
     * Add a lon-lat pair to the cluster
     * @param ll - lon-lat vector point in degrees
     */
    insertLonLat(ll: VectorPoint<M>): void;
    /**
     * Insert an STPoint to the index
     * @param face - the face of the cell
     * @param s - the s coordinate
     * @param t - the t coordinate
     * @param data - the data associated with the point
     */
    insertFaceST(face: Face, s: number, t: number, data: M): void;
    /**
     * Build the clusters when done adding points
     * @param cmp_ - custom compare function
     */
    buildClusters(cmp_?: ClusterDataComparitor<M>): Promise<void>;
    /**
     * @param id - the cell id
     * @returns - the data within the range of the tile id
     */
    getCellData(id: S2CellId): Promise<undefined | PointShape<Cluster<M>>[]>;
    /**
     * @param id - the id of the vector tile
     * @returns - the vector tile
     */
    getTile(id: S2CellId): Promise<undefined | Tile<Record<string, unknown>, {
        value: number;
    }, M>>;
}
//# sourceMappingURL=pointCluster.d.ts.map