import { Point, Boundaries, Rectangle, QuadTree } from "../../utils/geometry/interfaces"; import { Identified } from "../../../interfaces"; /** * Recursively retrieve every elements held by the node containing the * searched point. * * @param {object} point The searched point (x, y). * @param {object} quad The searched quad. * @return {array} An array of elements contained in the relevant * node. */ export declare function quadRetrievePoint(point: Point, quad: QuadTree): T[]; /** * The quad core that will become the sigma interface with the quadtree. * * property {object} _tree Property holding the quadtree object. * property {object} _cache Cache for the area method. */ export declare abstract class AbstractQuad { tree: QuadTree | null; cache: { query: string; result: T[]; }; enabled: boolean; prefix: string; protected abstract addItem(item: T): void; protected abstract createQuadTree(bounds: Boundaries, level: number, maxElements: number, maxLevel: number): QuadTree; /** * Index a graph by inserting its nodes into the quadtree. * * @param {array} nodes An array of nodes to index. * @param {object} params An object of parameters with at least the quad * bounds. * @return {object} The quadtree object. * * Parameters: * ---------- * bounds: {object} boundaries of the quad defined by its origin (x, y) * width and heigth. * prefix: {string?} a prefix for node geometric attributes. * maxElements: {integer?} the max number of elements in a leaf node. * maxLevel: {integer?} the max recursion level of the tree. */ index: (items: T[], params: any) => QuadTree; /** * Retrieve every graph nodes held by the quadtree node containing the * searched point. * * @param {number} x of the point. * @param {number} y of the point. * @return {array} An array of items retrieved. */ point: (x: number, y: number) => T[]; /** * Retrieve every graph items within a rectangular area. The methods keep the * last area queried in cache for optimization reason and will act differently * for the same reason if the area is axis-aligned or not. * * @param {object} A rectangle defined by two top points (x1, y1), (x2, y2) * and height. * @return {array} An array of items retrieved. */ area: (rect: Rectangle) => T[]; /** * Subdivide a quad by creating a node at a precise index. The function does * not generate all four nodes not to potentially create unused nodes. * * @param {integer} index The index of the node to create. * @param {object} quad The quad object to subdivide. * @return {object} A new quad representing the node created. */ quadSubdivide(index: number, quad: QuadTree): QuadTree; /** * Recursively insert an element into the quadtree. Only points * with size, i.e. axis-aligned squares, may be inserted with this * method. * * @param {object} el The element to insert in the quadtree. * @param {object} sizedPoint A sized point defined by two top points * (x1, y1), (x2, y2) and height. * @param {object} quad The quad in which to insert the element. * @return {undefined} The function does not return anything. */ quadInsert(el: T, sizedPoint: Rectangle, quad: QuadTree): void; }