import type { FeatureIterator } from '../index.js';
import type { Face, JSONCollection, MValue, Projection, Properties, S2CellId, VectorFeatures, VectorPoint } from '../geometry/index.js';
/**
 * # Tile Class
 *
 * ## Description
 * Tile Class to contain the tile information for splitting or simplifying
 *
 * ## Fields
 *
 * - `face` - the tile's face
 * - `zoom` - the tile's zoom
 * - `i` - the tile's x position
 * - `j` - the tile's y position
 * - `layers` - the tile's layers
 * - `transformed` - whether the tile feature geometry has been transformed to tile coordinates
 *
 * ## Usage
 *
 * ```ts
 * import { Tile } from 'gis-tools-ts';
 *  // create a tile
 * const tile = new Tile(id);
 * // add a feature
 * tile.addFeature(feature);
 *  // transform the geometry to be relative to the tile
 * tile.transform();
 * ```
 *
 * If you have some kind reader you can use the `addReader` method to build the tiile
 * ```ts
 * import { Tile, JSONReader } from 'gis-tools-ts';
 * import { FileReader } from 'gis-tools-ts/file';
 * // create a tile
 * const tile = new Tile(id);
 * // add a reader
 * const fileReader = new FileReader(`${__dirname}/fixtures/points.geojson`);
 * const jsonReader = new JSONReader(fileReader);
 * await tile.addReader(jsonReader);
 * // then transform
 * tile.transform();
 * ```
 */
export declare class Tile<M = Record<string, unknown>, D extends MValue = Properties, P extends Properties = Properties> {
    layers: Record<string, Layer<M, D, P>>;
    transformed: boolean;
    extent: number;
    face: Face;
    zoom: number;
    i: number;
    j: number;
    /**
     * @param id - the tile id
     * @param layers - the tile's layers
     * @param transformed - whether the tile feature geometry has been transformed to tile coordinates
     */
    constructor(id: S2CellId, layers?: Record<string, Layer<M, D, P>>, transformed?: boolean);
    /** @returns true if the tile is empty of features */
    isEmpty(): boolean;
    /**
     * Add features from a reader to the tile, optionally to a specific layer to store it in. Defaults to "default".
     * @param reader - the reader containing the input data
     * @param layer - layer to store the feature to
     */
    addReader(reader: FeatureIterator<M, D, P>, layer?: string): Promise<void>;
    /**
     * Add a vector feature to the tile, optionally to a specific layer to store it in. Defaults to "default".
     * @param feature - Vector Feature
     * @param layer - layer to store the feature to
     */
    addFeature(feature: VectorFeatures<M, D, P>, layer?: string): void;
    /**
     * Simplify the geometry to have a tolerance which will be relative to the tile's zoom level.
     * NOTE: This should be called after the tile has been split into children if that functionality
     * is needed.
     * @param tolerance - tolerance
     * @param maxzoom - max zoom at which to simplify
     */
    transform(tolerance: number, maxzoom?: number): void;
}
/**
 * Mutates the point in place to a tile coordinate
 * @param vp - input vector point that we are mutating in place
 * @param zoom - current zoom
 * @param ti - x translation
 * @param tj - y translation
 */
export declare function transformPoint<M extends MValue = Properties>(vp: VectorPoint<M>, zoom: number, ti: number, tj: number): void;
/** Layer Class to contain the layer information for splitting or simplifying */
export declare class Layer<M = Record<string, unknown>, D extends MValue = Properties, P extends Properties = Properties> {
    name: string;
    features: VectorFeatures<M, D, P>[];
    extent: number;
    /**
     * @param name - the layer name
     * @param features - the layer's features
     */
    constructor(name: string, features?: VectorFeatures<M, D, P>[]);
    /** @returns The number of features in the layer */
    get length(): number;
}
/** Options for creating a TileStore */
export interface TileStoreOptions {
    /** manually set the projection, otherwise it defaults to whatever the data type is */
    projection?: Projection;
    /** min zoom to generate data on */
    minzoom?: number;
    /** max zoom level to cluster the points on */
    maxzoom?: number;
    /** max zoom to index data on construction */
    indexMaxzoom?: number;
    /**
     * simplification tolerance (higher means simpler). 3 is a good default.
     * Since the default extent is 1, the algorithm will build a unit square of 4_096x4_096 for you.
     */
    tolerance?: number;
    /** tile buffer on each side so lines and polygons don't get clipped */
    buffer?: number;
    /** whether to build the bounding box for each tile feature */
    buildBBox?: boolean;
}
/**
 * # Tile Store
 *
 * ## Description
 * TileStore Class is a tile-lookup system that splits and simplifies as needed for each tile request
 *
 * ## Usage
 * ```ts
 * import { TileStore } from 'gis-tools-ts';
 * const tileStore = new TileStore(data, {
 *  projection: 'WG',
 *  minzoom: 0,
 *  maxzoom: 9,
 *  indexMaxzoom: 4,
 *  tolerance: 3,
 *  buffer: 0.0625
 *  buildBBox: false
 * });
 *
 * // get a tile
 * const tile = tileStore.getTile(id);
 * ```
 */
export declare class TileStore<M = Record<string, unknown>, D extends MValue = Properties, P extends Properties = Properties> {
    #private;
    minzoom: number;
    maxzoom: number;
    faces: Set<Face>;
    indexMaxzoom: number;
    tolerance: number;
    buffer: number;
    tiles: Map<S2CellId, Tile<M, D, P>>;
    projection: Projection;
    buildBBox: boolean;
    /**
     * @param data - input data may be WM or S2 as a Feature or a Collection of Features
     * @param options - options to define how to store the data
     */
    constructor(data?: JSONCollection<M, D, P>, options?: TileStoreOptions);
    /**
     * Builds the tile store with the input data
     * @param data - the input data
     */
    buildData(data: JSONCollection<M, D, P>): void;
    /**
     * Builds the tile store with the input reader
     * @param reader - the input reader
     */
    buildReader(reader: FeatureIterator<M, D, P>): Promise<void>;
    /**
     * @param id - the tile id to acquire
     * @returns - the tile if it exists
     */
    getTile(id: S2CellId): undefined | Tile<M, D, P>;
}
//# sourceMappingURL=tile.d.ts.map