import { Point, SModelElement as SModelElementSchema, ViewportResult } from 'sprotty-protocol';
/**
 * A IDiagramPieceRequestGenerator manages the ordering of diagram piece
 * requests.
 */
export interface IDiagramPieceRequestManager {
    /**
     * Adds a diagram piece that should be requested later.
     * @param parentId The ID of the SModelElement that is the direct parent of
     *                 this diagram piece. This is necessary to determine the
     *                 position of the piece.
     * @param diagramPiece Schema of diagram piece.
     */
    enqueue(parentId: string, diagramPiece: SModelElementSchema): void;
    /**
     * Returns the next diagram piece that should be requested and removes it
     * from the manager.
     */
    dequeue(): SModelElementSchema | undefined;
    /**
     * Resets the manager for a different diagram.
     */
    reset(): void;
    /**
     * Retrieves same element as dequeue, but doesn't remove it from the manager.
     */
    front(): SModelElementSchema | undefined;
    /**
     * Submit info about current viewport position to be used to prioritize the ordering of requests.
     */
    setViewport(viewportResult: ViewportResult): void;
}
/**
 * This implementation of {@link IDiagramPieceRequestManager} serves as a naive
 * implementation of the interface. Diagram pieces are stored in a simple queue
 * and requested in FIFO order. The resulting behaviour is that the pieces of a
 * diagram are requested breadth-first. The position of the viewport is not
 * taken into consideration in this approach.
 */
export declare class QueueDiagramPieceRequestManager implements IDiagramPieceRequestManager {
    piecesToRequest: SModelElementSchema[];
    enqueue(_parentId: string, diagramPiece: SModelElementSchema): void;
    dequeue(): SModelElementSchema | undefined;
    reset(): void;
    front(): SModelElementSchema | undefined;
    setViewport(_viewportResult: ViewportResult): void;
}
/**
 * This class provides a more sophisticated implementaion of
 * {@link IDiagramPieceRequestManager}. In order to send diagram piece requests
 * in order of "first needed", the diagram area is divided into a grid and the
 * locations of each piece within this grid are determined. The viewport position
 * is then taken to determine which grid cell is currently in view and each
 * grid cell maintains its own queue of pieces to request. When there are no
 * more pieces in a grid cell, grid cells in a ring around that center cell are
 * checked. And if nothing is found there either, the fallback is to go through
 * all the grid cells and request the first piece that is discovered.
 */
export declare class GridDiagramPieceRequestManager implements IDiagramPieceRequestManager {
    idToAbsolutePositions: Map<string, Point>;
    /**
     * These fields are used to map the diagram piece queues to their grid cell coordinates.
     */
    gridToPieces: Map<number, SModelElementSchema[]>;
    readonly MAX_16BIT_SIGNED: number;
    /**
     * Determines how many pixels wide each grid square should be.
     *
     * FIXME: evaluate what value makes sense here. If a proper spiral loop is in place, it shouldn't be too important though.
     *        canvas width is typically between 500 and 1000 pixels, zoom level important to consider
     *        This width is constant with respect to the actual diagram, this means that for small diagrams the
     *        grid has relatively large squares and for large diagrams the squares are relatively small
     *        There might be an advantage of setting this dynamically according to the diagram size beforehand
     *        This would require some extra communication before the actual diagram requesting process begins
     */
    gridResolution: number;
    /**
     * Determines how far around the center point of the viewport to search for nodes to request. The value used
     * here needs to be suitable for both the gridResolution and diagram size.
     */
    maxRingCount: number;
    /**
     * The last known grid position of the viewport.
     */
    currentGridPosition: {
        x: number;
        y: number;
    };
    /**
     * Transforms a coordinate pair (x,y) to a 32 bit integer. x and y must be
     * between 0 and 32767 which is a sufficiently large domain for this application.
     * The value of x is stored in the first 16 bits and the value of y is stored in
     * the last 16 bits.
     * @param point The coordinate to be transformed to an integer encoding.
     * @returns Integer representing the coordinate pair.
     */
    getKey(point: Point): number;
    /**
     * Transforms a 32 bit integer to a pair (x,y). The encoding is explained in
     * {@link GridDiagramPieceRequestManager.getKey}
     * @param key Integer to be transformed to coordinate pair.
     * @returns Coordinate pair in the form {x: valueX, y: valueY}.
     */
    getCoords(key: number): Point;
    /**
     * Generates coordinate pairs which form a square around the origin (0,0) with a distance n
     * from the center in exactly one or both components of the coordinate. Or expressed more
     * mathematically:
     *
     * All pairs must be of the form (+-n,v) or (v,+-n) with -n <= v <= n
     *
     * @param n Distance of the ring from the origin.
     * @returns List of coordinate pairs: [{x: .., y: ..}, ..]
     */
    ringCoords(n: number): Point[];
    enqueue(parentId: string, diagramPiece: SModelElementSchema): void;
    dequeue(): SModelElementSchema | undefined;
    reset(): void;
    front(): SModelElementSchema | undefined;
    setViewport(viewportResult: ViewportResult): void;
}
//# sourceMappingURL=diagram-piece-request-manager.d.ts.map