s2maps-gpu
Version:
S2 Maps GPU - An open source, high-performance, and GPU-accelerated map engine for rendering large-scale, interactive maps.
90 lines (89 loc) • 3.68 kB
TypeScript
import Workflow, { Feature } from './workflow.js';
import type Context from '../context/context.js';
import type { LineData } from 'workers/worker.spec.js';
import type { TileGL as Tile } from 'source/tile.spec.js';
import type { ColorArray, LayerDefinitionBase, LineDefinition, LineStyle, LineWorkflowLayerGuide } from 'style/style.spec.js';
import type { LineFeature as LineFeatureSpec, LineSource, LineWorkflow as LineWorkflowSpec, LineWorkflowUniforms } from './workflow.spec.js';
/** Line Feature is a standalone line render storage unit that can be drawn to the GPU */
export declare class LineFeature extends Feature implements LineFeatureSpec {
workflow: LineWorkflowSpec;
layerGuide: LineWorkflowLayerGuide;
source: LineSource;
tile: Tile;
count: number;
offset: number;
featureCode: number[];
cap: number;
parent?: Tile | undefined;
type: "line";
color?: ColorArray;
opacity?: number;
width?: number;
gapwidth?: number;
/**
* @param workflow - the line workflow
* @param layerGuide - layer guide for this feature
* @param source - the line source
* @param tile - the tile that the feature is drawn on
* @param count - the number of lines
* @param offset - the offset of the lines
* @param featureCode - the encoded feature that tells the GPU how to compute it's properties
* @param cap - the line cap
* @param parent - the parent tile
*/
constructor(workflow: LineWorkflowSpec, layerGuide: LineWorkflowLayerGuide, source: LineSource, tile: Tile, count: number, offset: number, featureCode: number[], cap: number, parent?: Tile | undefined);
/**
* Draw the feature to the GPU
* @param interactive - whether or not the feature is interactive
*/
draw(interactive?: boolean): void;
/**
* Duplicate this feature
* @param tile - the tile that the feature is drawn on
* @param parent - the parent tile if applicable
* @returns the duplicated feature
*/
duplicate(tile: Tile, parent?: Tile): LineFeature;
/**
* Set the attributes of the feature if the context is webgl1
* @param color - the color
* @param opacity - the opacity
* @param width - the width
* @param gapwidth - the gapwidth
*/
setWebGL1Attributes(color?: ColorArray, opacity?: number, width?: number, gapwidth?: number): void;
}
/** Line Workflow */
export default class LineWorkflow extends Workflow implements LineWorkflowSpec {
#private;
label: "line";
curTexture: number;
typeBuffer?: WebGLBuffer;
layerGuides: Map<number, LineWorkflowLayerGuide>;
uniforms: {
[key in LineWorkflowUniforms]: WebGLUniformLocation;
};
/** @param context - the WebGL(1|2) context */
constructor(context: Context);
/**
* Build the layer definition
* @param layerBase - the common layer attributes
* @param layer - the user defined layer attributes
* @returns a built layer definition that's ready to describe how to render a feature
*/
buildLayerDefinition(layerBase: LayerDefinitionBase, layer: LineStyle): LineDefinition;
/**
* Build the line source
* @param lineData - raw input data from the Tile Worker
* @param tile - the tile that the feature is drawn on
*/
buildSource(lineData: LineData, tile: Tile): void;
/** Use this workflow as the current shaders for the GPU */
use(): void;
/**
* Draw a line feature
* @param feature - the line feature
* @param _interactive - whether or not the feature is interactive
*/
draw(feature: LineFeatureSpec, _interactive?: boolean): void;
}