s2maps-gpu
Version:
S2 Maps GPU - An open source, high-performance, and GPU-accelerated map engine for rendering large-scale, interactive maps.
55 lines (54 loc) • 2.55 kB
TypeScript
import type { TileRequest } from 'workers/worker.spec.js';
import type { VectorMultiLineString, VectorMultiPoint, VectorMultiPolygon } from 'gis-tools/index.js';
/** The scale and shift parameters */
interface ScaleShiftParams {
scale: number;
xShift: number;
yShift: number;
}
/**
* Source data may only tilelize data to a certain max zoom, but we may request a tile at a higher zoom
* Therefore we scale, shift, and clip the geometry as needed for that specific higher zoomed tile.
*
* 1) scale up by distance between tiles (if parent is 2 zooms above, you double size twice)
* 2) shift x and y by position of current tile
* 3) clip the geometry by 0->extent (include buffer if not points)
* @param extent - the extent of the current tile
* @param tile - the tile request
* @returns the scale, shift, and clip parameters
*/
export declare function scaleShiftParams(extent: number, tile: TileRequest): ScaleShiftParams | undefined;
/**
* Scale, shift, and clip polygons according to the tile request and extent
* @param geometry - input multi polygon
* @param extent - extent is the tile "pixel" size
* @param tile - the tile request
* @returns the scaled, shifted, and clipped polygons
*/
export declare function scaleShiftClipPoints(geometry: VectorMultiPoint, extent: number, tile: TileRequest): VectorMultiPoint;
/**
* Scale, shift, and clip polygons according to the tile request and extent
* @param geometry - input multi polygon
* @param extent - extent is the tile "pixel" size
* @param tile - the tile request
* @returns the scaled, shifted, and clipped polygons
*/
export declare function scaleShiftClipLines(geometry: VectorMultiLineString, extent: number, tile: TileRequest): VectorMultiLineString;
/**
* Scale, shift, and clip polygons according to the tile request and extent
* @param geometry - input multi polygon
* @param extent - extent is the tile "pixel" size
* @param tile - the tile request
* @returns the scaled, shifted, and clipped polygons
*/
export declare function scaleShiftClipPolys(geometry: VectorMultiPolygon, extent: number, tile: TileRequest): VectorMultiPolygon;
/**
* Clip a collection of lines
* @param lines - collection of input lines
* @param extent - extent is the tile "pixel" size
* @param isPolygon - true if the geometry is a polygon
* @param buffer - buffer size
* @returns collection of clipped lines
*/
export declare function clipLines(lines: VectorMultiLineString, extent: number, isPolygon: boolean, buffer?: number): VectorMultiLineString;
export {};