s2maps-gpu
Version:
S2 Maps GPU - An open source, high-performance, and GPU-accelerated map engine for rendering large-scale, interactive maps.
86 lines (85 loc) • 3.21 kB
TypeScript
import type { Cap } from 'style/style.spec.js';
import type { MValue, VectorCoordinates, VectorGeometryType, VectorLineString, VectorMultiLineString, VectorPoint } from 'gis-tools/index.js';
/** An output of drawLine */
export interface Line {
prev: number[];
curr: number[];
next: number[];
lengthSoFar: number[];
}
/**
* if line, return, if poly or multipoly, flatten to lines
* @param geometry - input vector geometry
* @param type - geometry type
* @returns vector lines
*/
export declare function flattenGeometryToLines<M extends MValue>(geometry: VectorCoordinates<M>, type: VectorGeometryType): VectorMultiLineString<M>;
/** A path is a 4 point line */
export type Path = [
first: VectorPoint,
second: VectorPoint,
third: VectorPoint,
fourth: VectorPoint
];
/** An output of getPointsAndPaths */
export interface PathData {
point: VectorPoint;
pathLeft: Path;
pathRight: Path;
}
/**
* Get a collection of points and paths along the lines
* @param geometry - input vector geometry
* @param type - geometry type
* @param spacing - distance between points
* @param extent - extent is the tile "pixel" size
* @returns the points and paths that are along the lines
*/
export declare function getPointsAndPathsAlongLines<M extends MValue>(geometry: VectorCoordinates<M>, type: VectorGeometryType, spacing: number, extent: number): PathData[];
/**
* Get a collection of points and paths at the center of each line
* @param geometry - input vector geometry
* @param type - geometry type
* @param extent - extent is the tile "pixel" size
* @returns the points and paths that are at the center of each line
*/
export declare function getPointsAndPathsAtCenterOfLines(geometry: VectorCoordinates, type: VectorGeometryType, extent: number): PathData[];
/** An output of getPathPos describing the path's via raw data */
export type QuadPos = [
s: number,
t: number,
offsetX: number,
offsetY: number,
xPos: number,
yPos: number
];
/**
* Get the path position
* @param quadPos - quad position
* @param pathLeft - left path
* @param pathRight - right path
* @param tileSize - tile size
* @param size - glyph size
* @returns a vector point describing the path position
*/
export declare function getPathPos(quadPos: QuadPos, pathLeft: Path, pathRight: Path, tileSize: number, size: number): VectorPoint;
/** The resultant length and distance index given an input linestring */
export interface LineLengthRes {
length: number;
distIndex: number[];
}
/**
* Get the length of a linestring
* @param line - input linestring
* @returns the length of the linestring
*/
export declare function lineLength(line: VectorLineString): LineLengthRes;
/**
* Draw a line given a linestring, cap type, and max distance
* @param points - input linestring
* @param cap - cap type
* @param maxDistance - max distance between two points. Will reduce distance as needed to ensure
* no two points are too far away making rendering look ugly (useful for spherical data)
* @returns the resultant line verts and their lengths so far
*/
export declare function drawLine(points: VectorLineString, cap?: Cap, maxDistance?: number): Line;