s2maps-gpu
Version:
S2 Maps GPU - An open source, high-performance, and GPU-accelerated map engine for rendering large-scale, interactive maps.
102 lines (101 loc) • 4.36 kB
TypeScript
import Workflow, { Feature } from './workflow.js';
import type Context from '../context/context.js';
import type { FillData } from 'workers/worker.spec.js';
import type { TileGL as Tile } from 'source/tile.spec.js';
import type { VectorPoint } from 'gis-tools/index.js';
import type { FillDefinition, FillStyle, FillWorkflowLayerGuide, LayerDefinitionBase } from 'style/style.spec.js';
import type { FillFeature as FillFeatureSpec, FillSource, FillWorkflow as FillWorkflowSpec, FillWorkflowUniforms, TileMaskSource } from './workflow.spec.js';
/** Fill Feature is a standalone fill render storage unit that can be drawn to the GPU */
export declare class FillFeature extends Feature implements FillFeatureSpec {
workflow: FillWorkflowSpec;
layerGuide: FillWorkflowLayerGuide;
maskLayer: boolean;
source: FillSource | TileMaskSource;
mode: number;
count: number;
offset: number;
patternXY: VectorPoint;
patternWH: [w: number, h: number];
patternMovement: number;
featureCode: number[];
tile: Tile;
parent?: Tile | undefined;
type: "fill";
color?: number[];
opacity?: number[];
/**
* @param workflow - the fill workflow
* @param layerGuide - layer guide for this feature
* @param maskLayer - whether or not the layer is a mask or a fill
* @param source - the fill or mask source
* @param mode - the draw mode
* @param count - the number of points
* @param offset - the offset of the points
* @param patternXY - the pattern offset
* @param patternWH - the pattern size
* @param patternMovement - the pattern movement position
* @param featureCode - the feature code that tells the GPU how to compute it's properties
* @param tile - the tile that the feature is drawn on
* @param parent - the parent tile if applicable
*/
constructor(workflow: FillWorkflowSpec, layerGuide: FillWorkflowLayerGuide, maskLayer: boolean, source: FillSource | TileMaskSource, mode: number, count: number, offset: number, patternXY: VectorPoint, patternWH: [w: number, h: number], patternMovement: number, featureCode: number[], tile: Tile, 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): FillFeature;
/**
* Set the attributes of the feature if the context is webgl1
* @param color - the color
* @param opacity - the opacity
*/
setWebGL1Attributes(color?: number[], opacity?: number[]): void;
}
/** Fill Workflow */
export default class FillWorkflow extends Workflow implements FillWorkflowSpec {
#private;
label: "fill";
uniforms: {
[key in FillWorkflowUniforms]: WebGLUniformLocation;
};
layerGuides: Map<number, FillWorkflowLayerGuide>;
/** @param context - The WebGL(1|2) context */
constructor(context: Context);
/**
* Build layer definition for the fill feature
* @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: FillStyle): FillDefinition;
/**
* Build a mask feature
* @param maskFeature - the mask feature guide
* @param tile - the tile that needs a mask
*/
buildMaskFeature(maskFeature: FillDefinition, tile: Tile): void;
/**
* Build a fill features from source data sent from the Tile Worker
* @param fillData - the fill data from the Tile Worker
* @param tile - the tile that the features belong to
*/
buildSource(fillData: FillData, tile: Tile): void;
/**
* Draw the fill feature
* @param feature - the fill feature
* @param interactive - whether or not the feature is interactive
*/
draw(feature: FillFeatureSpec, interactive?: boolean): void;
/**
* Draw a mask to the GPU
* @param mask - the tile mask
*/
drawMask(mask: TileMaskSource): void;
}