s2maps-gpu
Version:
S2 Maps GPU - An open source, high-performance, and GPU-accelerated map engine for rendering large-scale, interactive maps.
49 lines (48 loc) • 1.85 kB
TypeScript
import type Camera from 'ui/camera/index.js';
import type { MapOptions } from 'ui/s2mapUI.js';
import type { TileShared as Tile } from 'source/tile.spec.js';
import type { UrlMap } from 's2/index.js';
import type { FillDefinition, LayerDefinition, ShadeDefinition, StyleDefinition } from './style.spec.js';
/**
* # Style Engine
*
* The Style Engine is responsible for:
* - PRE) If style is a string (url), ship it off to Source Worker to fetch the style
* - 1) Build workflows necessary to render the style
* - 2) Build out the layers
* - 3) Ship off appropriate style params to Tile Workers so they know how to build the tiles
* - 4) Build the layers for the painter
*/
export default class Style {
#private;
camera: Camera;
apiKey?: string;
urlMap?: UrlMap;
maskLayers: Array<FillDefinition | ShadeDefinition>;
layers: LayerDefinition[];
interactive: boolean;
dirty: boolean;
/**
* @param camera - render camera
* @param options - map options
*/
constructor(camera: Camera, options: MapOptions);
/**
* Build the style, preparing it for rendering and tile/source processing
* @param style - style definition
* @param ignorePosition - if true, we want to leave the position of the camera unchanged.
* @returns true if we can start rendering
*/
buildStyle(style: string | StyleDefinition, ignorePosition?: boolean): Promise<boolean>;
/**
* Inject mask layers
* @param tile - tile to inject the mask layers for
*/
injectMaskLayers(tile: Tile): void;
/**
* Request tiles. The projector will forward requests throug this class so it can build the
* tile requests with style specific data before forwarding it to the worker pool
* @param tiles - tiles to request data for
*/
requestTiles(tiles: Tile[]): void;
}