import { AsyncSeriesBailHook, AsyncWaterfallHook, SyncBailHook, SyncHook } from '@antv/async-hook'; import type { IActiveOption, IAnimateOption, IAttributeAndElements, IBuffer, IDataState, IEncodeFeature, IGlobalConfigService, ILayer, ILayerAttributesOption, ILayerConfig, ILayerModel, ILayerModelInitializationOptions, ILayerPickService, ILayerPlugin, ILegend, IModel, IModelInitializationOptions, IMultiPassRenderer, IParseDataItem, IPostProcessingPass, IRenderOptions, IScale, IScaleOptions, ISourceCFG, IStyleAttributeService, IStyleAttributeUpdateOptions, ITextureService, L7Container, LayerEventType, LegendItems, StyleAttributeField, StyleAttributeOption, Triangulation } from '@antv/l7-core'; import { BlendType } from '@antv/l7-core'; import type Source from '@antv/l7-source'; import { EventEmitter } from 'eventemitter3'; export default class BaseLayer extends EventEmitter implements ILayer { id: string; name: string; parent: ILayer; coordCenter: number[]; type: string; visible: boolean; zIndex: number; minZoom: number; maxZoom: number; inited: boolean; layerModelNeedUpdate: boolean; pickedFeatureID: number | null; selectedFeatureID: number | null; styleNeedUpdate: boolean; rendering: boolean; forceRender: boolean; clusterZoom: number; layerType?: string | undefined; triangulation?: Triangulation | undefined; layerPickService: ILayerPickService; textureService: ITextureService; defaultSourceConfig: { data: any[]; options: ISourceCFG | undefined; }; dataState: IDataState; hooks: { init: AsyncSeriesBailHook; afterInit: SyncBailHook; beforeRender: SyncBailHook; beforeRenderData: AsyncWaterfallHook; afterRender: SyncHook; beforePickingEncode: SyncHook; afterPickingEncode: SyncHook; beforeHighlight: SyncHook; afterHighlight: SyncHook; beforeSelect: SyncHook; afterSelect: SyncHook; beforeDestroy: SyncHook; afterDestroy: SyncHook; }; models: IModel[]; multiPassRenderer: IMultiPassRenderer; plugins: ILayerPlugin[]; startInit: boolean; sourceOption: { data: any; options?: ISourceCFG; }; layerModel: ILayerModel; shapeOption: { field: any; values: any; }; tileLayer: any | undefined; layerChildren: ILayer[]; masks: ILayer[]; protected readonly configService: IGlobalConfigService; protected get shaderModuleService(): import("@antv/l7-core").IShaderModuleService; protected get cameraService(): import("@antv/l7-core").ICameraService; protected get coordinateService(): import("@antv/l7-core").ICoordinateSystemService; protected get iconService(): import("@antv/l7-core").IIconService; protected get fontService(): import("@antv/l7-core").IFontService; protected get pickingService(): import("@antv/l7-core").IPickingService; protected get rendererService(): import("@antv/l7-core").IRendererService; protected get layerService(): import("@antv/l7-core").ILayerService; protected get debugService(): import("@antv/l7-core").IDebugService; protected get interactionService(): import("packages/core/src/services/interaction/InteractionService").default; protected get mapService(): import("@antv/l7-core").IMapService<{}>; styleAttributeService: IStyleAttributeService; protected layerSource: Source; postProcessingPassFactory: (name: string) => IPostProcessingPass; get normalPassFactory(): (name: string) => import("@antv/l7-core").IPass; protected animateOptions: IAnimateOption; protected relativeOrigin: [number, number]; protected originalExtent: [number, number, number, number]; protected absoluteDataArray: IParseDataItem[]; /** * 图层容器 */ container: L7Container; private encodedData; private currentPickId; protected rawConfig: Partial; private needUpdateConfig; encodeStyleAttribute: Record; enableShaderEncodeStyles: string[]; enableDataEncodeStyles: string[]; /** * 待更新样式属性,在初始化阶段完成注册 */ protected pendingStyleAttributes: Array<{ attributeName: string; attributeField: StyleAttributeField; attributeValues?: StyleAttributeOption; defaultName?: string; updateOptions?: Partial; }>; private scaleOptions; private animateStartTime; private animateStatus; private isDestroyed; private uniformBuffers; constructor(config?: Partial); addMask(layer: ILayer): void; removeMask(layer: ILayer): void; disableMask(): void; enableMask(): void; /** * 将废弃 * @deprecated */ addMaskLayer(maskLayer: ILayer): void; /** * 将废弃 * @deprecated */ removeMaskLayer(maskLayer: ILayer): void; getAttribute(name: string): import("@antv/l7-core").IStyleAttribute | undefined; getLayerConfig(): Partial; updateLayerConfig(configToUpdate: Partial): void; /** * 注入图层容器,父容器为场景容器 * RootContainer 1 * -> SceneContainer 1.* * -> LayerContainer 1.* */ setContainer(container: L7Container): void; getContainer(): L7Container; addPlugin(plugin: ILayerPlugin): ILayer; init(): Promise; log(logType: string, step?: string): void; updateModelData(data: IAttributeAndElements): void; setLayerPickService(layerPickService: ILayerPickService): void; /** * Model初始化前需要更新Model样式 */ prepareBuildModel(): void; color(field: StyleAttributeField, values?: StyleAttributeOption, updateOptions?: Partial): this; texture(field: StyleAttributeField, values?: StyleAttributeOption, updateOptions?: Partial): this; rotate(field: StyleAttributeField, values?: StyleAttributeOption, updateOptions?: Partial): this; size(field: StyleAttributeField, values?: StyleAttributeOption, updateOptions?: Partial): this; filter(field: StyleAttributeField, values?: StyleAttributeOption, updateOptions?: Partial): this; shape(field: StyleAttributeField, values?: StyleAttributeOption, updateOptions?: Partial): this; label(field: StyleAttributeField, values?: StyleAttributeOption, updateOptions?: Partial): this; animate(options: IAnimateOption | boolean): this; source(data: any, options?: ISourceCFG): ILayer; setData(data: any, options?: ISourceCFG): this; private dataUpdatelog; style(options: Partial & Partial): ILayer; private encodeStyle; scale(field: string | number | IScaleOptions, cfg?: IScale): this; /** * 渲染所有的图层 */ renderLayers(): void; prerender(): void; render(options?: Partial): ILayer; /** * renderMultiPass 专门用于渲染支持 multipass 的 layer */ renderMultiPass(): Promise; active(options: IActiveOption | boolean): this; setActive(id: number | { x: number; y: number; }, options?: IActiveOption): void; select(option: IActiveOption | boolean): ILayer; setSelect(id: number | { x: number; y: number; }, options?: IActiveOption): void; setBlend(type: keyof typeof BlendType): ILayer; show(): ILayer; hide(): ILayer; setIndex(index: number): ILayer; setCurrentPickId(id: number): void; getCurrentPickId(): number | null; setCurrentSelectedId(id: number): void; getCurrentSelectedId(): number | null; isVisible(): boolean; setMultiPass(enableMultiPass: boolean, currentPasses?: Array): this; setMinZoom(minZoom: number): ILayer; getMinZoom(): number; getMaxZoom(): number; get(name: string): any; setMaxZoom(maxZoom: number): ILayer; setAutoFit(autoFit: boolean): ILayer; /** * zoom to layer Bounds */ fitBounds(fitBoundsOptions?: unknown): ILayer; destroy(refresh?: boolean): void; clear(): void; clearModels(): void; isDirty(): boolean; setSource(source: Source): void; getSource(): Source; getScaleOptions(): IScaleOptions; encodeDataLength: number; setEncodedData(encodedData: IEncodeFeature[]): void; getEncodedData(): IEncodeFeature[]; getScale(name: string): any; getLegend(name: string): ILegend; getLegendItems(name: string): LegendItems; pick({ x, y }: { x: number; y: number; }): void; boxSelect(box: [number, number, number, number], cb: (...args: any[]) => void): void; buildLayerModel(options: ILayerModelInitializationOptions & Partial): Promise; createAttributes(options: ILayerModelInitializationOptions & Partial): any; getTime(): number; setAnimateStartTime(): void; stopAnimate(): void; getLayerAnimateTime(): number; needPick(type: string): boolean; buildModels(): Promise; rebuildModels(): Promise; renderMulPass(multiPassRenderer: IMultiPassRenderer): Promise; renderModels(options?: Partial): this; updateStyleAttribute(type: string, field: StyleAttributeField, values?: StyleAttributeOption, updateOptions?: Partial): boolean; getLayerAttributeConfig(): Partial; getShaderPickStat(): boolean; /** * 继承空方法 * @param time */ setEarthTime(time: number): void; processData(filterData: IParseDataItem[]): IParseDataItem[]; getModelType(): string; protected getDefaultConfig(): {}; /** * 处理相对坐标转换 */ protected processRelativeCoordinates(): void; /** * 获取绝对坐标数据(用于交互计算) */ getAbsoluteData(): IParseDataItem[]; /** * 获取相对坐标原点 */ getRelativeOrigin(): [number, number]; /** * 获取原始数据范围 */ getOriginalExtent(): [number, number, number, number]; protected sourceEvent: () => void; protected initLayerModels(): Promise; getPickingUniformBuffer(): IBuffer; protected reRender(): void; protected splitValuesAndCallbackInAttribute(valuesOrCallback?: unknown[]): { values: unknown[] | undefined; callback: (unknown[] & ((...args: any[]) => any)) | undefined; }; }