@antv/l7-layers 2.8.20 → 2.8.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -36,6 +36,7 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
36
36
 
37
37
  import { SyncBailHook, SyncHook, SyncWaterfallHook } from '@antv/async-hook';
38
38
  import { BlendType, lazyInject, TYPES } from '@antv/l7-core';
39
+ import Source from '@antv/l7-source';
39
40
  import { encodePickingColor } from '@antv/l7-utils';
40
41
  import { EventEmitter } from 'eventemitter3';
41
42
  import { BlendTypes } from '../utils/blend';
@@ -441,7 +442,15 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = functi
441
442
  this.layerSource.setData(data, options);
442
443
  } else {
443
444
  this.on('inited', function () {
444
- _this3.layerSource.setData(data, options);
445
+ var currentSource = _this3.getSource();
446
+
447
+ if (!currentSource) {
448
+ _this3.source(new Source(data, options));
449
+
450
+ _this3.sourceEvent();
451
+ } else {
452
+ _this3.layerSource.setData(data, options);
453
+ }
445
454
  });
446
455
  }
447
456
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/core/BaseLayer.ts"],"names":["SyncBailHook","SyncHook","SyncWaterfallHook","BlendType","lazyInject","TYPES","encodePickingColor","EventEmitter","BlendTypes","handleStyleDataMapping","createMultiPassRenderer","normalizePasses","updateShape","layerIdCounter","BaseLayer","IGlobalConfigService","config","dataSourceNeedUpdate","dataMappingNeedUpdate","filterNeedUpdate","featureScaleNeedUpdate","StyleAttrNeedUpdate","init","afterInit","beforeRender","beforeRenderData","afterRender","beforePickingEncode","afterPickingEncode","beforeHighlight","afterHighlight","beforeSelect","afterSelect","beforeDestroy","afterDestroy","enable","dataState","getLayerConfig","autoFit","fitBoundsOptions","fitBounds","reRender","name","id","zIndex","rawConfig","configService","configToUpdate","inited","needUpdateConfig","sceneId","container","get","SceneID","setLayerConfig","sceneContainer","color","bottomColor","plugin","plugins","push","layerType","iconService","IIconService","fontService","IFontService","rendererService","IRendererService","layerService","ILayerService","interactionService","IInteractionService","pickingService","IPickingService","mapService","IMapService","enableMultiPassRenderer","passes","length","on","renderLayers","cameraService","ICameraService","coordinateService","ICoordinateSystemService","shaderModuleService","IShaderModuleService","postProcessingPassFactory","IFactoryPostProcessingPass","normalPassFactory","IFactoryNormalPass","styleAttributeService","IStyleAttributeService","multiPassRenderer","IMultiPassRenderer","setLayer","pendingStyleAttributes","forEach","attributeName","attributeField","attributeValues","updateOptions","updateStyleAttribute","scale","field","splitValuesAndCallbackInAttribute","getAll","ILayerPlugin","apply","hooks","call","emit","target","type","updateLayerConfig","getDefaultConfig","animateOption","startAnimate","aniamateStatus","values","lastShape","getLayerStyleAttribute","currentShape","shapeOption","options","rawAnimate","data","setSource","sourceOption","clusterZoom","layerSource","setData","rest","pass","postProcessingPass","getPostProcessor","getPostProcessingPassByName","styleNeedUpdate","cfg","scaleOptions","rendering","getEncodedData","renderModels","getRenderFlag","render","activeOption","enableHighlight","highlightColor","mix","activeMix","x","y","pick","pickedFeatureID","then","setTimeout","option","enableSelect","selectColor","selectMix","blend","layerModelNeedUpdate","visible","index","updateLayerRenderList","currentPickId","selectedFeatureID","zoom","getZoom","minZoom","Infinity","maxZoom","enableMultiPass","currentPasses","setRenderFlag","getViewportSize","width","height","resize","source","getSource","extent","isValid","some","v","Math","abs","isDestroied","off","sourceEvent","destroy","clearAllAttributes","models","cleanRemove","removeAllListeners","model","layerModel","clearModels","getLayerStyleAttributes","filter","attribute","needRescale","needRemapping","needRegenerateVertices","cluster","updateClusterData","encodedData","getLayerAttributeScale","invertExtent","items","range","map","item","value","ticks","domain","triggerHover","box","cb","boxPickLayer","moduleName","vertexShader","fragmentShader","triangulation","segmentNumber","registerModule","vs","fs","getModule","uniforms","createModel","createAttributesAndIndices","attributes","elements","normal","clock","getDelta","animateStartTime","getElapsedTime","stopAnimate","isPick","eventNames","indexOf","isVisible","Error","isPicking","buildModels","renderUpdate","draw","getUninforms","getShaderPickStat","time","console","warn","valuesOrCallback","defaultValues","undefined","callback"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,SAASA,YAAT,EAAuBC,QAAvB,EAAiCC,iBAAjC,QAA0D,kBAA1D;AACA,SACEC,SADF,EAqCEC,UArCF,EA4CEC,KA5CF,QA6CO,eA7CP;AA+CA,SAASC,kBAAT,QAAmC,gBAAnC;AACA,SAASC,YAAT,QAA6B,eAA7B;AAGA,SAASC,UAAT,QAA2B,gBAA3B;AACA,SAASC,sBAAT,QAAuC,2BAAvC;AACA,SACEC,uBADF,EAEEC,eAFF,QAGO,0BAHP;AAIA,SAASC,WAAT,QAA4B,sBAA5B;AAIA,IAAIC,cAAc,GAAG,CAArB;IAEqBC,S,WAoElBV,UAAU,CAACC,KAAK,CAACU,oBAAP,C;;;;;AA2EX,uBAAyE;AAAA;;AAAA,QAA7DC,MAA6D,uEAAJ,EAAI;;AAAA;;AACvE;;AADuE,mEA7IlDH,cAAc,EA6IoC;;AAAA,qEA5IhDA,cA4IgD;;AAAA;;AAAA,8DA1I/C,IA0I+C;;AAAA,6DAzIjD,CAyIiD;;AAAA;;AAAA;;AAAA,6DAtIhD,KAsIgD;;AAAA,2EArIlC,KAqIkC;;AAAA,sEApIjC,IAoIiC;;AAAA,wEAnI/B,IAmI+B;;AAAA,sEAlIvC,KAkIuC;;AAAA;;AAAA,kEAhI5C,CAgI4C;;AAAA;;AAAA,gEA7H1C;AAC7BI,MAAAA,oBAAoB,EAAE,KADO;AAE7BC,MAAAA,qBAAqB,EAAE,KAFM;AAG7BC,MAAAA,gBAAgB,EAAE,KAHW;AAI7BC,MAAAA,sBAAsB,EAAE,KAJK;AAK7BC,MAAAA,mBAAmB,EAAE;AALQ,KA6H0C;;AAAA,4DArH1D;AACbC,MAAAA,IAAI,EAAE,IAAItB,YAAJ,EADO;AAEbuB,MAAAA,SAAS,EAAE,IAAIvB,YAAJ,EAFE;AAGbwB,MAAAA,YAAY,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EAEEC,aAFF,EAGE;AACA,aAAO;AACLxI,QAAAA,MAAM,EAAE,YAAWuI,gBAAX,IACJE,SADI,GAEJF,gBAAgB,IAAIC,aAHnB;AAILE,QAAAA,QAAQ,EAAE,YAAWH,gBAAX,IAA+BA,gBAA/B,GAAkDE;AAJvD,OAAP;AAMD;;;;EAnoCiEzP,Y;;;;;;SAA/CO,S","sourcesContent":["// @ts-ignore\nimport { SyncBailHook, SyncHook, SyncWaterfallHook } from '@antv/async-hook';\nimport {\n BlendType,\n gl,\n IActiveOption,\n IAnimateOption,\n ICameraService,\n ICoordinateSystemService,\n IDataState,\n IEncodeFeature,\n IFontService,\n IGlobalConfigService,\n IIconService,\n IInteractionService,\n ILayer,\n ILayerConfig,\n ILayerModel,\n ILayerModelInitializationOptions,\n ILayerPlugin,\n ILayerService,\n ILegendClassificaItem,\n ILegendSegmentItem,\n IMapService,\n IModel,\n IModelInitializationOptions,\n IMultiPassRenderer,\n IPass,\n IPickingService,\n IPostProcessingPass,\n IRendererService,\n IScale,\n IScaleOptions,\n IShaderModuleService,\n ISource,\n ISourceCFG,\n IStyleAttributeInitializationOptions,\n IStyleAttributeService,\n IStyleAttributeUpdateOptions,\n lazyInject,\n LegendItems,\n ScaleAttributeType,\n ScaleTypeName,\n ScaleTypes,\n StyleAttributeField,\n StyleAttributeOption,\n TYPES,\n} from '@antv/l7-core';\nimport Source from '@antv/l7-source';\nimport { encodePickingColor } from '@antv/l7-utils';\nimport { EventEmitter } from 'eventemitter3';\nimport { Container } from 'inversify';\nimport { isFunction, isObject, isUndefined } from 'lodash';\nimport { BlendTypes } from '../utils/blend';\nimport { handleStyleDataMapping } from '../utils/dataMappingStyle';\nimport {\n createMultiPassRenderer,\n normalizePasses,\n} from '../utils/multiPassRender';\nimport { updateShape } from '../utils/updateShape';\n/**\n * 分配 layer id\n */\nlet layerIdCounter = 0;\n\nexport default class BaseLayer<ChildLayerStyleOptions = {}> extends EventEmitter\n implements ILayer {\n public id: string = `${layerIdCounter++}`;\n public name: string = `${layerIdCounter}`;\n public type: string;\n public visible: boolean = true;\n public zIndex: number = 0;\n public minZoom: number;\n public maxZoom: number;\n public inited: boolean = false;\n public layerModelNeedUpdate: boolean = false;\n public pickedFeatureID: number | null = null;\n public selectedFeatureID: number | null = null;\n public styleNeedUpdate: boolean = false;\n public rendering: boolean;\n public clusterZoom: number = 0; // 聚合等级标记\n public layerType?: string | undefined;\n\n public dataState: IDataState = {\n dataSourceNeedUpdate: false,\n dataMappingNeedUpdate: false,\n filterNeedUpdate: false,\n featureScaleNeedUpdate: false,\n StyleAttrNeedUpdate: false,\n };\n // 生命周期钩子\n public hooks = {\n init: new SyncBailHook(),\n afterInit: new SyncBailHook(),\n beforeRender: new SyncBailHook(),\n beforeRenderData: new SyncWaterfallHook(),\n afterRender: new SyncHook(),\n beforePickingEncode: new SyncHook(),\n afterPickingEncode: new SyncHook(),\n beforeHighlight: new SyncHook(['pickedColor']),\n afterHighlight: new SyncHook(),\n beforeSelect: new SyncHook(['pickedColor']),\n afterSelect: new SyncHook(),\n beforeDestroy: new SyncHook(),\n afterDestroy: new SyncHook(),\n };\n\n // 待渲染 model 列表\n public models: IModel[] = [];\n\n // 每个 Layer 都有一个\n public multiPassRenderer: IMultiPassRenderer;\n\n // 注入插件集\n public plugins: ILayerPlugin[];\n\n public sourceOption: {\n data: any;\n options?: ISourceCFG;\n };\n\n public layerModel: ILayerModel;\n\n public shapeOption: {\n field: any;\n values: any;\n };\n\n // TODO: 记录 sceneContainer 供创建子图层的时候使用 如 imageTileLayer\n public sceneContainer: Container | undefined;\n // TODO: 用于保存子图层对象\n public layerChildren: ILayer[] = [];\n\n @lazyInject(TYPES.IGlobalConfigService)\n protected readonly configService: IGlobalConfigService;\n\n // @lazyInject(TYPES.IShaderModuleService)\n // protected readonly shaderModuleService: IShaderModuleService;\n\n protected shaderModuleService: IShaderModuleService;\n protected cameraService: ICameraService;\n\n protected coordinateService: ICoordinateSystemService;\n\n protected iconService: IIconService;\n\n protected fontService: IFontService;\n\n protected pickingService: IPickingService;\n\n protected rendererService: IRendererService;\n\n protected layerService: ILayerService;\n\n protected interactionService: IInteractionService;\n\n protected mapService: IMapService;\n\n protected styleAttributeService: IStyleAttributeService;\n\n protected layerSource: Source;\n\n protected postProcessingPassFactory: (\n name: string,\n ) => IPostProcessingPass<unknown>;\n protected normalPassFactory: (name: string) => IPass<unknown>;\n\n protected animateOptions: IAnimateOption = { enable: false };\n\n /**\n * 图层容器\n */\n private container: Container;\n\n private encodedData: IEncodeFeature[];\n\n private configSchema: object;\n\n private currentPickId: number | null = null;\n\n private rawConfig: Partial<ILayerConfig & ChildLayerStyleOptions>;\n\n private needUpdateConfig: Partial<ILayerConfig & ChildLayerStyleOptions>;\n\n /**\n * 待更新样式属性,在初始化阶段完成注册\n */\n private pendingStyleAttributes: Array<{\n attributeName: string;\n attributeField: StyleAttributeField;\n attributeValues?: StyleAttributeOption;\n defaultName?: string;\n updateOptions?: Partial<IStyleAttributeUpdateOptions>;\n }> = [];\n\n private scaleOptions: IScaleOptions = {};\n\n private animateStartTime: number;\n\n private aniamateStatus: boolean = false;\n\n // TODO: layer 保底颜色\n private bottomColor = 'rgba(0, 0, 0, 0)';\n\n private isDestroied: boolean = false;\n\n // private pickingPassRender: IPass<'pixelPicking'>;\n\n constructor(config: Partial<ILayerConfig & ChildLayerStyleOptions> = {}) {\n super();\n this.name = config.name || this.id;\n this.zIndex = config.zIndex || 0;\n this.rawConfig = config;\n }\n\n public getLayerConfig() {\n return this.configService.getLayerConfig<ChildLayerStyleOptions>(this.id);\n }\n\n public updateLayerConfig(\n configToUpdate: Partial<ILayerConfig | ChildLayerStyleOptions>,\n ) {\n if (!this.inited) {\n this.needUpdateConfig = {\n ...this.needUpdateConfig,\n ...configToUpdate,\n };\n } else {\n const sceneId = this.container.get<string>(TYPES.SceneID);\n\n // @ts-ignore\n handleStyleDataMapping(configToUpdate, this); // 处理 style 中进行数据映射的属性字段\n\n this.configService.setLayerConfig(sceneId, this.id, {\n ...this.configService.getLayerConfig(this.id),\n ...this.needUpdateConfig,\n ...configToUpdate,\n });\n this.needUpdateConfig = {};\n }\n }\n\n /**\n * 注入图层容器,父容器为场景容器\n * RootContainer 1\n * -> SceneContainer 1.*\n * -> LayerContainer 1.*\n */\n public setContainer(container: Container, sceneContainer: Container) {\n this.container = container;\n this.sceneContainer = sceneContainer;\n }\n\n public getContainer() {\n return this.container;\n }\n\n public setBottomColor(color: string) {\n this.bottomColor = color;\n }\n\n public getBottomColor() {\n return this.bottomColor;\n }\n\n public addPlugin(plugin: ILayerPlugin): ILayer {\n // TODO: 控制插件注册顺序\n // @example:\n // pointLayer.addPlugin(new MyCustomPlugin(), {\n // before: 'L7BuiltinPlugin'\n // });\n this.plugins.push(plugin);\n return this;\n }\n\n public init() {\n // 设置配置项\n const sceneId = this.container.get<string>(TYPES.SceneID);\n // 初始化图层配置项\n // const { enableMultiPassRenderer = false } = this.rawConfig;\n // this.configService.setLayerConfig(sceneId, this.id, {\n // enableMultiPassRenderer,\n // });\n this.configService.setLayerConfig(sceneId, this.id, this.rawConfig);\n this.layerType = this.rawConfig.layerType;\n\n // 全局容器服务\n\n // 场景容器服务\n this.iconService = this.container.get<IIconService>(TYPES.IIconService);\n this.fontService = this.container.get<IFontService>(TYPES.IFontService);\n\n this.rendererService = this.container.get<IRendererService>(\n TYPES.IRendererService,\n );\n this.layerService = this.container.get<ILayerService>(TYPES.ILayerService);\n this.interactionService = this.container.get<IInteractionService>(\n TYPES.IInteractionService,\n );\n\n this.pickingService = this.container.get<IPickingService>(\n TYPES.IPickingService,\n );\n this.mapService = this.container.get<IMapService>(TYPES.IMapService);\n const { enableMultiPassRenderer, passes } = this.getLayerConfig();\n if (enableMultiPassRenderer && passes?.length && passes.length > 0) {\n // Tip: 兼容 multiPassRender 在 amap1 时存在的图层不同步问题 zoom\n this.mapService.on('mapAfterFrameChange', () => {\n this.renderLayers();\n });\n }\n\n this.cameraService = this.container.get<ICameraService>(\n TYPES.ICameraService,\n );\n this.coordinateService = this.container.get<ICoordinateSystemService>(\n TYPES.ICoordinateSystemService,\n );\n this.shaderModuleService = this.container.get<IShaderModuleService>(\n TYPES.IShaderModuleService,\n );\n this.postProcessingPassFactory = this.container.get(\n TYPES.IFactoryPostProcessingPass,\n );\n this.normalPassFactory = this.container.get(TYPES.IFactoryNormalPass);\n\n // 图层容器服务\n this.styleAttributeService = this.container.get<IStyleAttributeService>(\n TYPES.IStyleAttributeService,\n );\n this.multiPassRenderer = this.container.get<IMultiPassRenderer>(\n TYPES.IMultiPassRenderer,\n );\n this.multiPassRenderer.setLayer(this);\n\n // 完成样式服务注册完成前添加的属性\n this.pendingStyleAttributes.forEach(\n ({ attributeName, attributeField, attributeValues, updateOptions }) => {\n this.styleAttributeService.updateStyleAttribute(\n attributeName,\n {\n // @ts-ignore\n scale: {\n field: attributeField,\n ...this.splitValuesAndCallbackInAttribute(\n // @ts-ignore\n attributeValues,\n // @ts-ignore\n this.getLayerConfig()[attributeName],\n ),\n },\n },\n // @ts-ignore\n updateOptions,\n );\n },\n );\n this.pendingStyleAttributes = [];\n\n // 获取插件集\n this.plugins = this.container.getAll<ILayerPlugin>(TYPES.ILayerPlugin);\n // 完成插件注册,传入场景和图层容器内的服务\n for (const plugin of this.plugins) {\n plugin.apply(this, {\n rendererService: this.rendererService,\n mapService: this.mapService,\n styleAttributeService: this.styleAttributeService,\n normalPassFactory: this.normalPassFactory,\n postProcessingPassFactory: this.postProcessingPassFactory,\n });\n }\n\n // 触发 init 生命周期插件\n this.hooks.init.call();\n // this.pickingPassRender = this.normalPassFactory('pixelPicking');\n // this.pickingPassRender.init(this);\n this.hooks.afterInit.call();\n\n // 触发初始化完成事件;\n this.emit('inited', {\n target: this,\n type: 'inited',\n });\n this.emit('add', {\n target: this,\n type: 'add',\n });\n return this;\n }\n /**\n * Model初始化前需要更新Model样式\n */\n public prepareBuildModel() {\n this.inited = true;\n this.updateLayerConfig({\n ...(this.getDefaultConfig() as object),\n ...this.rawConfig,\n });\n\n // 启动动画\n const { animateOption } = this.getLayerConfig();\n if (animateOption?.enable) {\n this.layerService.startAnimate();\n this.aniamateStatus = true;\n }\n }\n public color(\n field: StyleAttributeField,\n values?: StyleAttributeOption,\n updateOptions?: Partial<IStyleAttributeUpdateOptions>,\n ) {\n // 设置 color、size、shape、style 时由于场景服务尚未完成(并没有调用 scene.addLayer),因此暂时加入待更新属性列表\n this.updateStyleAttribute('color', field, values, updateOptions);\n\n // this.pendingStyleAttributes.push({\n // attributeName: 'color',\n // attributeField: field,\n // attributeValues: values,\n // defaultName: 'colors',\n // updateOptions,\n // });\n return this;\n }\n\n // 为对应的图层传入纹理的编号名称(point/image 在 shape 方法中传入纹理名称的方法并不通用)\n public texture(\n field: StyleAttributeField,\n values?: StyleAttributeOption,\n updateOptions?: Partial<IStyleAttributeUpdateOptions>,\n ) {\n this.updateStyleAttribute('texture', field, values, updateOptions);\n return this;\n }\n\n public rotate(\n field: StyleAttributeField,\n values?: StyleAttributeOption,\n updateOptions?: Partial<IStyleAttributeUpdateOptions>,\n ) {\n this.updateStyleAttribute('rotate', field, values, updateOptions);\n return this;\n }\n public size(\n field: StyleAttributeField,\n values?: StyleAttributeOption,\n updateOptions?: Partial<IStyleAttributeUpdateOptions>,\n ) {\n this.updateStyleAttribute('size', field, values, updateOptions);\n return this;\n }\n // 对mapping后的数据过滤,scale保持不变\n public filter(\n field: StyleAttributeField,\n values?: StyleAttributeOption,\n updateOptions?: Partial<IStyleAttributeUpdateOptions>,\n ) {\n this.updateStyleAttribute('filter', field, values, updateOptions);\n return this;\n }\n\n public shape(\n field: StyleAttributeField,\n values?: StyleAttributeOption,\n updateOptions?: Partial<IStyleAttributeUpdateOptions>,\n ) {\n const lastShape = this.styleAttributeService?.getLayerStyleAttribute(\n 'shape',\n )?.scale?.field;\n const currentShape = field;\n this.shapeOption = {\n field,\n values,\n };\n this.updateStyleAttribute('shape', field, values, updateOptions);\n // TODO: 根据 shape 判断是否需要更新 model\n updateShape(this, lastShape, currentShape);\n return this;\n }\n public label(\n field: StyleAttributeField,\n values?: StyleAttributeOption,\n updateOptions?: Partial<IStyleAttributeUpdateOptions>,\n ) {\n this.pendingStyleAttributes.push({\n attributeName: 'label',\n attributeField: field,\n attributeValues: values,\n updateOptions,\n });\n return this;\n }\n public animate(options: IAnimateOption | boolean) {\n let rawAnimate: Partial<IAnimateOption> = {};\n if (isObject(options)) {\n rawAnimate.enable = true;\n rawAnimate = {\n ...rawAnimate,\n ...options,\n };\n } else {\n rawAnimate.enable = options;\n }\n this.updateLayerConfig({\n animateOption: rawAnimate,\n });\n // this.animateOptions = options;\n return this;\n }\n\n public source(data: any, options?: ISourceCFG): ILayer {\n if (data?.data) {\n // 判断是否为source\n this.setSource(data);\n return this;\n }\n this.sourceOption = {\n data,\n options,\n };\n this.clusterZoom = 0;\n return this;\n }\n public setData(data: any, options?: ISourceCFG) {\n if (this.inited) {\n this.layerSource.setData(data, options);\n } else {\n this.on('inited', () => {\n this.layerSource.setData(data, options);\n });\n }\n\n return this;\n }\n public style(\n options: Partial<ChildLayerStyleOptions> & Partial<ILayerConfig>,\n ): ILayer {\n const { passes, ...rest } = options;\n\n // passes 特殊处理\n if (passes) {\n normalizePasses(passes).forEach(\n (pass: [string, { [key: string]: unknown }]) => {\n const postProcessingPass = this.multiPassRenderer\n .getPostProcessor()\n .getPostProcessingPassByName(pass[0]);\n if (postProcessingPass) {\n postProcessingPass.updateOptions(pass[1]);\n }\n },\n );\n }\n\n this.rawConfig = {\n ...this.rawConfig,\n ...rest,\n };\n if (this.container) {\n this.updateLayerConfig(this.rawConfig);\n this.styleNeedUpdate = true;\n }\n return this;\n }\n public scale(field: string | number | IScaleOptions, cfg?: IScale) {\n if (isObject(field)) {\n this.scaleOptions = {\n ...this.scaleOptions,\n ...field,\n };\n } else {\n this.scaleOptions[field] = cfg;\n }\n return this;\n }\n\n /**\n * 渲染所有的图层\n */\n public renderLayers(): void {\n this.rendering = true;\n\n this.layerService.renderLayers();\n\n this.rendering = false;\n }\n\n public render(): ILayer {\n // TODO: this.getEncodedData().length !== 0 这个判断是为了解决在 2.5.x 引入数据纹理后产生的 空数据渲染导致 texture 超出上限问题\n if (this.getEncodedData().length !== 0) {\n this.renderModels();\n }\n return this;\n }\n\n /**\n * renderMultiPass 专门用于渲染支持 multipass 的 layer\n */\n public async renderMultiPass() {\n if (this.getEncodedData().length !== 0) {\n if (this.multiPassRenderer && this.multiPassRenderer.getRenderFlag()) {\n // multi render 开始执行 multiPassRender 的渲染流程\n await this.multiPassRenderer.render();\n } else if (this.multiPassRenderer) {\n // renderPass 触发的渲染\n this.renderModels();\n } else {\n this.renderModels();\n }\n }\n }\n\n public active(options: IActiveOption | boolean) {\n const activeOption: Partial<ILayerConfig> = {};\n activeOption.enableHighlight = isObject(options) ? true : options;\n if (isObject(options)) {\n activeOption.enableHighlight = true;\n if (options.color) {\n activeOption.highlightColor = options.color;\n }\n if (options.mix) {\n activeOption.activeMix = options.mix;\n }\n } else {\n activeOption.enableHighlight = !!options;\n }\n this.updateLayerConfig(activeOption);\n return this;\n }\n public setActive(\n id: number | { x: number; y: number },\n options?: IActiveOption,\n ): void {\n if (isObject(id)) {\n const { x = 0, y = 0 } = id;\n this.updateLayerConfig({\n highlightColor: isObject(options)\n ? options.color\n : this.getLayerConfig().highlightColor,\n activeMix: isObject(options)\n ? options.mix\n : this.getLayerConfig().activeMix,\n });\n this.pick({ x, y });\n } else {\n this.updateLayerConfig({\n pickedFeatureID: id,\n highlightColor: isObject(options)\n ? options.color\n : this.getLayerConfig().highlightColor,\n activeMix: isObject(options)\n ? options.mix\n : this.getLayerConfig().activeMix,\n });\n this.hooks.beforeSelect\n .call(encodePickingColor(id as number) as number[])\n // @ts-ignore\n .then(() => {\n setTimeout(() => {\n this.reRender();\n }, 1);\n });\n }\n }\n\n public select(option: IActiveOption | boolean): ILayer {\n const activeOption: Partial<ILayerConfig> = {};\n activeOption.enableSelect = isObject(option) ? true : option;\n if (isObject(option)) {\n activeOption.enableSelect = true;\n if (option.color) {\n activeOption.selectColor = option.color;\n }\n if (option.mix) {\n activeOption.selectMix = option.mix;\n }\n } else {\n activeOption.enableSelect = !!option;\n }\n this.updateLayerConfig(activeOption);\n return this;\n }\n\n public setSelect(\n id: number | { x: number; y: number },\n options?: IActiveOption,\n ): void {\n if (isObject(id)) {\n const { x = 0, y = 0 } = id;\n this.updateLayerConfig({\n selectColor: isObject(options)\n ? options.color\n : this.getLayerConfig().selectColor,\n selectMix: isObject(options)\n ? options.mix\n : this.getLayerConfig().selectMix,\n });\n this.pick({ x, y });\n } else {\n this.updateLayerConfig({\n pickedFeatureID: id,\n selectColor: isObject(options)\n ? options.color\n : this.getLayerConfig().selectColor,\n selectMix: isObject(options)\n ? options.mix\n : this.getLayerConfig().selectMix,\n });\n this.hooks.beforeSelect\n .call(encodePickingColor(id as number) as number[])\n // @ts-ignore\n .then(() => {\n setTimeout(() => {\n this.reRender();\n }, 1);\n });\n }\n }\n public setBlend(type: keyof typeof BlendType): ILayer {\n this.updateLayerConfig({\n blend: type,\n });\n this.layerModelNeedUpdate = true;\n this.reRender();\n return this;\n }\n public show(): ILayer {\n this.updateLayerConfig({\n visible: true,\n });\n this.reRender();\n return this;\n }\n\n public hide(): ILayer {\n this.updateLayerConfig({\n visible: false,\n });\n this.reRender();\n return this;\n }\n public setIndex(index: number): ILayer {\n this.zIndex = index;\n this.layerService.updateLayerRenderList();\n this.layerService.renderLayers();\n return this;\n }\n\n public setCurrentPickId(id: number) {\n this.currentPickId = id;\n }\n\n public getCurrentPickId(): number | null {\n return this.currentPickId;\n }\n\n public setCurrentSelectedId(id: number) {\n this.selectedFeatureID = id;\n }\n\n public getCurrentSelectedId(): number | null {\n return this.selectedFeatureID;\n }\n public isVisible(): boolean {\n const zoom = this.mapService.getZoom();\n const {\n visible,\n minZoom = -Infinity,\n maxZoom = Infinity,\n } = this.getLayerConfig();\n return !!visible && zoom >= minZoom && zoom <= maxZoom;\n }\n\n public setMultiPass(\n enableMultiPass: boolean,\n currentPasses?: Array<string | [string, { [key: string]: unknown }]>,\n ) {\n this.updateLayerConfig({\n enableMultiPassRenderer: enableMultiPass,\n });\n if (currentPasses) {\n this.updateLayerConfig({\n passes: currentPasses,\n });\n }\n\n if (enableMultiPass) {\n const { passes = [] } = this.getLayerConfig();\n this.multiPassRenderer = createMultiPassRenderer(\n this,\n passes,\n this.postProcessingPassFactory,\n this.normalPassFactory,\n );\n this.multiPassRenderer.setRenderFlag(true);\n const { width, height } = this.rendererService.getViewportSize();\n this.multiPassRenderer.resize(width, height);\n }\n\n return this;\n }\n\n public setMinZoom(minZoom: number): ILayer {\n this.updateLayerConfig({\n minZoom,\n });\n return this;\n }\n\n public getMinZoom(): number {\n const { minZoom } = this.getLayerConfig();\n return minZoom as number;\n }\n\n public getMaxZoom(): number {\n const { maxZoom } = this.getLayerConfig();\n return maxZoom as number;\n }\n\n public get(name: string) {\n const cfg = this.getLayerConfig();\n // @ts-ignore\n return cfg[name];\n }\n\n public setMaxZoom(maxZoom: number): ILayer {\n this.updateLayerConfig({\n maxZoom,\n });\n return this;\n }\n\n public setAutoFit(autoFit: boolean): ILayer {\n this.updateLayerConfig({\n autoFit,\n });\n return this;\n }\n\n /**\n * zoom to layer Bounds\n */\n public fitBounds(fitBoundsOptions?: unknown): ILayer {\n if (!this.inited) {\n this.updateLayerConfig({\n autoFit: true,\n });\n return this;\n }\n const source = this.getSource();\n const extent = source.extent;\n const isValid = extent.some((v) => Math.abs(v) === Infinity);\n if (isValid) {\n return this;\n }\n this.mapService.fitBounds(\n [\n [extent[0], extent[1]],\n [extent[2], extent[3]],\n ],\n fitBoundsOptions,\n );\n return this;\n }\n\n public destroy() {\n // debugger\n if (this.isDestroied) {\n return;\n }\n this.hooks.beforeDestroy.call();\n // 清除sources事件\n this.layerSource.off('update', this.sourceEvent);\n\n this.multiPassRenderer.destroy();\n // console.log(this.styleAttributeService.getAttributes())\n // 清除所有属性以及关联的 vao == 销毁所有 => model this.models.forEach((model) => model.destroy());\n this.styleAttributeService.clearAllAttributes();\n\n // 执行每个图层单独的 clearModels 方法 (清除一些额外的 texture、program、buffer 等)\n\n this.hooks.afterDestroy.call();\n\n // TODO: 清除各个图层自定义的 models 资源\n // this.layerModel?.clearModels();\n\n this.models = [];\n\n this.layerService.cleanRemove(this);\n\n this.emit('remove', {\n target: this,\n type: 'remove',\n });\n\n this.emit('destroy', {\n target: this,\n type: 'destroy',\n });\n\n this.removeAllListeners();\n // 解绑图层容器中的服务\n // this.container.unbind(TYPES.IStyleAttributeService);\n\n this.isDestroied = true;\n }\n public clear() {\n this.styleAttributeService.clearAllAttributes();\n // 销毁所有 model\n }\n public clearModels() {\n this.models.forEach((model) => model.destroy());\n this.layerModel.clearModels();\n }\n\n public isDirty() {\n return !!(\n this.styleAttributeService.getLayerStyleAttributes() || []\n ).filter(\n (attribute) =>\n attribute.needRescale ||\n attribute.needRemapping ||\n attribute.needRegenerateVertices,\n ).length;\n }\n\n public setSource(source: Source) {\n // 清除旧 sources 事件\n if (this.layerSource) {\n this.layerSource.off('update', this.sourceEvent);\n }\n\n this.layerSource = source;\n this.clusterZoom = 0;\n\n // 已 inited 且启用聚合进行更新聚合数据\n if (this.inited && this.layerSource.cluster) {\n const zoom = this.mapService.getZoom();\n this.layerSource.updateClusterData(zoom);\n }\n // source 可能会复用,会在其它layer被修改\n this.layerSource.on('update', this.sourceEvent);\n }\n public getSource() {\n return this.layerSource;\n }\n\n public getScaleOptions() {\n return this.scaleOptions;\n }\n\n public setEncodedData(encodedData: IEncodeFeature[]) {\n this.encodedData = encodedData;\n }\n public getEncodedData() {\n return this.encodedData;\n }\n\n public getScale(name: string): any {\n return this.styleAttributeService.getLayerAttributeScale(name);\n }\n\n public getLegendItems(name: string): LegendItems {\n const scale = this.styleAttributeService.getLayerAttributeScale(name);\n\n // 函数自定义映射,没有 scale 返回为空数组\n if (!scale) {\n return [];\n }\n\n if (scale.invertExtent) {\n // 分段类型 Quantize、Quantile、Threshold\n const items: ILegendSegmentItem[] = scale.range().map((item: number) => {\n return {\n value: scale.invertExtent(item),\n [name]: item,\n };\n });\n\n return items;\n } else if (scale.ticks) {\n // 连续类型 Continuous (Linear, Power, Log, Identity, Time)\n const items: ILegendClassificaItem[] = scale\n .ticks()\n .map((item: string) => {\n return {\n value: item,\n [name]: scale(item),\n };\n });\n\n return items;\n } else if (scale?.domain) {\n // 枚举类型 Cat\n const items: ILegendClassificaItem[] = scale\n .domain()\n .filter((item: string | number | undefined) => !isUndefined(item))\n .map((item: string | number) => {\n return {\n value: item,\n [name]: scale(item) as string,\n };\n });\n\n return items;\n }\n\n return [];\n }\n\n public pick({ x, y }: { x: number; y: number }) {\n this.interactionService.triggerHover({ x, y });\n }\n\n public boxSelect(\n box: [number, number, number, number],\n cb: (...args: any[]) => void,\n ) {\n this.pickingService.boxPickLayer(this, box, cb);\n }\n\n public buildLayerModel(\n options: ILayerModelInitializationOptions &\n Partial<IModelInitializationOptions>,\n ): IModel {\n const {\n moduleName,\n vertexShader,\n fragmentShader,\n triangulation,\n segmentNumber,\n ...rest\n } = options;\n this.shaderModuleService.registerModule(moduleName, {\n vs: vertexShader,\n fs: fragmentShader,\n });\n const { vs, fs, uniforms } = this.shaderModuleService.getModule(moduleName);\n const { createModel } = this.rendererService;\n const {\n attributes,\n elements,\n } = this.styleAttributeService.createAttributesAndIndices(\n this.encodedData,\n triangulation,\n segmentNumber,\n );\n return createModel({\n attributes,\n uniforms,\n fs,\n vs,\n elements,\n blend: BlendTypes[BlendType.normal],\n ...rest,\n });\n }\n\n public getTime() {\n return this.layerService.clock.getDelta();\n }\n public setAnimateStartTime() {\n this.animateStartTime = this.layerService.clock.getElapsedTime();\n }\n public stopAnimate() {\n if (this.aniamateStatus) {\n this.layerService.stopAnimate();\n this.aniamateStatus = false;\n this.updateLayerConfig({\n animateOption: {\n enable: false,\n },\n });\n }\n }\n public getLayerAnimateTime(): number {\n return this.layerService.clock.getElapsedTime() - this.animateStartTime;\n }\n\n public needPick(type: string): boolean {\n const {\n enableHighlight = true,\n enableSelect = true,\n } = this.getLayerConfig();\n // 判断layer是否监听事件;\n let isPick =\n this.eventNames().indexOf(type) !== -1 ||\n this.eventNames().indexOf('un' + type) !== -1;\n if ((type === 'click' || type === 'dblclick') && enableSelect) {\n isPick = true;\n }\n if (\n type === 'mousemove' &&\n (enableHighlight ||\n this.eventNames().indexOf('mouseenter') !== -1 ||\n this.eventNames().indexOf('unmousemove') !== -1 ||\n this.eventNames().indexOf('mouseout') !== -1)\n ) {\n isPick = true;\n }\n return this.isVisible() && isPick;\n }\n\n public buildModels() {\n throw new Error('Method not implemented.');\n }\n public rebuildModels() {\n throw new Error('Method not implemented.');\n }\n\n public async renderMulPass(multiPassRenderer: IMultiPassRenderer) {\n await multiPassRenderer.render();\n }\n\n public renderModels(isPicking?: boolean) {\n // TODO: this.getEncodedData().length > 0 这个判断是为了解决在 2.5.x 引入数据纹理后产生的 空数据渲染导致 texture 超出上限问题\n if (this.getEncodedData().length > 0) {\n if (this.layerModelNeedUpdate && this.layerModel) {\n this.models = this.layerModel.buildModels();\n this.hooks.beforeRender.call();\n this.layerModelNeedUpdate = false;\n }\n\n if (this.layerModel.renderUpdate) {\n this.layerModel.renderUpdate();\n }\n this.models.forEach((model) => {\n model.draw(\n {\n uniforms: this.layerModel.getUninforms(),\n },\n isPicking,\n );\n });\n }\n return this;\n }\n\n public updateStyleAttribute(\n type: string,\n field: StyleAttributeField,\n values?: StyleAttributeOption,\n updateOptions?: Partial<IStyleAttributeUpdateOptions>,\n ) {\n if (!this.inited) {\n this.pendingStyleAttributes.push({\n attributeName: type,\n attributeField: field,\n attributeValues: values,\n updateOptions,\n });\n } else {\n this.styleAttributeService.updateStyleAttribute(\n type,\n {\n // @ts-ignore\n scale: {\n field,\n ...this.splitValuesAndCallbackInAttribute(\n // @ts-ignore\n values,\n // @ts-ignore\n this.getLayerConfig()[field],\n ),\n },\n },\n // @ts-ignore\n updateOptions,\n );\n }\n }\n\n public getShaderPickStat() {\n return this.layerService.getShaderPickStat();\n }\n\n /**\n * 继承空方法\n * @param time\n */\n public setEarthTime(time: number) {\n console.warn('empty fn');\n }\n\n protected getConfigSchema() {\n throw new Error('Method not implemented.');\n }\n\n protected getModelType(): unknown {\n throw new Error('Method not implemented.');\n }\n protected getDefaultConfig() {\n return {};\n }\n\n private sourceEvent = () => {\n this.dataState.dataSourceNeedUpdate = true;\n const { autoFit, fitBoundsOptions } = this.getLayerConfig();\n if (autoFit) {\n this.fitBounds(fitBoundsOptions);\n }\n // 对外暴露事件 迁移到 DataMappingPlugin generateMapping,保证在重新重新映射后触发\n // this.emit('dataUpdate');\n this.reRender();\n };\n\n private reRender() {\n if (this.inited) {\n this.layerService.updateLayerRenderList();\n this.layerService.renderLayers();\n }\n }\n private splitValuesAndCallbackInAttribute(\n valuesOrCallback?: unknown[],\n defaultValues?: unknown[],\n ) {\n return {\n values: isFunction(valuesOrCallback)\n ? undefined\n : valuesOrCallback || defaultValues,\n callback: isFunction(valuesOrCallback) ? valuesOrCallback : undefined,\n };\n }\n}\n"],"file":"BaseLayer.js"}
1
+ {"version":3,"sources":["../../src/core/BaseLayer.ts"],"names":["SyncBailHook","SyncHook","SyncWaterfallHook","BlendType","lazyInject","TYPES","Source","encodePickingColor","EventEmitter","BlendTypes","handleStyleDataMapping","createMultiPassRenderer","normalizePasses","updateShape","layerIdCounter","BaseLayer","IGlobalConfigService","config","dataSourceNeedUpdate","dataMappingNeedUpdate","filterNeedUpdate","featureScaleNeedUpdate","StyleAttrNeedUpdate","init","afterInit","beforeRender","beforeRenderData","afterRender","beforePickingEncode","afterPickingEncode","beforeHighlight","afterHighlight","beforeSelect","afterSelect","beforeDestroy","afterDestroy","enable","dataState","getLayerConfig","autoFit","fitBoundsOptions","fitBounds","reRender","name","id","zIndex","rawConfig","configService","configToUpdate","inited","needUpdateConfig","sceneId","container","get","SceneID","setLayerConfig","sceneContainer","color","bottomColor","plugin","plugins","push","layerType","iconService","IIconService","fontService","IFontService","rendererService","IRendererService","layerService","ILayerService","interactionService","IInteractionService","pickingService","IPickingService","mapService","IMapService","enableMultiPassRenderer","passes","length","on","renderLayers","cameraService","ICameraService","coordinateService","ICoordinateSystemService","shaderModuleService","IShaderModuleService","postProcessingPassFactory","IFactoryPostProcessingPass","normalPassFactory","IFactoryNormalPass","styleAttributeService","IStyleAttributeService","multiPassRenderer","IMultiPassRenderer","setLayer","pendingStyleAttributes","forEach","attributeName","attributeField","attributeValues","updateOptions","updateStyleAttribute","scale","field","splitValuesAndCallbackInAttribute","getAll","ILayerPlugin","apply","hooks","call","emit","target","type","updateLayerConfig","getDefaultConfig","animateOption","startAnimate","aniamateStatus","values","lastShape","getLayerStyleAttribute","currentShape","shapeOption","options","rawAnimate","data","setSource","sourceOption","clusterZoom","layerSource","setData","currentSource","getSource","source","sourceEvent","rest","pass","postProcessingPass","getPostProcessor","getPostProcessingPassByName","styleNeedUpdate","cfg","scaleOptions","rendering","getEncodedData","renderModels","getRenderFlag","render","activeOption","enableHighlight","highlightColor","mix","activeMix","x","y","pick","pickedFeatureID","then","setTimeout","option","enableSelect","selectColor","selectMix","blend","layerModelNeedUpdate","visible","index","updateLayerRenderList","currentPickId","selectedFeatureID","zoom","getZoom","minZoom","Infinity","maxZoom","enableMultiPass","currentPasses","setRenderFlag","getViewportSize","width","height","resize","extent","isValid","some","v","Math","abs","isDestroied","off","destroy","clearAllAttributes","models","cleanRemove","removeAllListeners","model","layerModel","clearModels","getLayerStyleAttributes","filter","attribute","needRescale","needRemapping","needRegenerateVertices","cluster","updateClusterData","encodedData","getLayerAttributeScale","invertExtent","items","range","map","item","value","ticks","domain","triggerHover","box","cb","boxPickLayer","moduleName","vertexShader","fragmentShader","triangulation","segmentNumber","registerModule","vs","fs","getModule","uniforms","createModel","createAttributesAndIndices","attributes","elements","normal","clock","getDelta","animateStartTime","getElapsedTime","stopAnimate","isPick","eventNames","indexOf","isVisible","Error","isPicking","buildModels","renderUpdate","draw","getUninforms","getShaderPickStat","time","console","warn","valuesOrCallback","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ChC,YAAM,IAAIA,KAAJ,CAAU,yBAAV,CAAN;AACD;;;WACD,4BAA6B;AAC3B,aAAO,EAAP;AACD;;;WAaD,oBAAmB;AACjB,UAAI,KAAKrM,MAAT,EAAiB;AACf,aAAKoB,YAAL,CAAkBoG,qBAAlB;AACA,aAAKpG,YAAL,CAAkBY,YAAlB;AACD;AACF;;;WACD,2CACE+K,gBADF,EAEEC,aAFF,EAGE;AACA,aAAO;AACLzI,QAAAA,MAAM,EAAE,YAAWwI,gBAAX,IACJE,SADI,GAEJF,gBAAgB,IAAIC,aAHnB;AAILE,QAAAA,QAAQ,EAAE,YAAWH,gBAAX,IAA+BA,gBAA/B,GAAkDE;AAJvD,OAAP;AAMD;;;;EA5oCiE1P,Y;;;;;;SAA/CO,S","sourcesContent":["// @ts-ignore\nimport { SyncBailHook, SyncHook, SyncWaterfallHook } from '@antv/async-hook';\nimport {\n BlendType,\n gl,\n IActiveOption,\n IAnimateOption,\n ICameraService,\n ICoordinateSystemService,\n IDataState,\n IEncodeFeature,\n IFontService,\n IGlobalConfigService,\n IIconService,\n IInteractionService,\n ILayer,\n ILayerConfig,\n ILayerModel,\n ILayerModelInitializationOptions,\n ILayerPlugin,\n ILayerService,\n ILegendClassificaItem,\n ILegendSegmentItem,\n IMapService,\n IModel,\n IModelInitializationOptions,\n IMultiPassRenderer,\n IPass,\n IPickingService,\n IPostProcessingPass,\n IRendererService,\n IScale,\n IScaleOptions,\n IShaderModuleService,\n ISource,\n ISourceCFG,\n IStyleAttributeInitializationOptions,\n IStyleAttributeService,\n IStyleAttributeUpdateOptions,\n lazyInject,\n LegendItems,\n ScaleAttributeType,\n ScaleTypeName,\n ScaleTypes,\n StyleAttributeField,\n StyleAttributeOption,\n TYPES,\n} from '@antv/l7-core';\nimport Source from '@antv/l7-source';\nimport { encodePickingColor } from '@antv/l7-utils';\nimport { EventEmitter } from 'eventemitter3';\nimport { Container } from 'inversify';\nimport { isEqual, isFunction, isObject, isUndefined } from 'lodash';\nimport { BlendTypes } from '../utils/blend';\nimport { handleStyleDataMapping } from '../utils/dataMappingStyle';\nimport {\n createMultiPassRenderer,\n normalizePasses,\n} from '../utils/multiPassRender';\nimport { updateShape } from '../utils/updateShape';\n/**\n * 分配 layer id\n */\nlet layerIdCounter = 0;\n\nexport default class BaseLayer<ChildLayerStyleOptions = {}> extends EventEmitter\n implements ILayer {\n public id: string = `${layerIdCounter++}`;\n public name: string = `${layerIdCounter}`;\n public type: string;\n public visible: boolean = true;\n public zIndex: number = 0;\n public minZoom: number;\n public maxZoom: number;\n public inited: boolean = false;\n public layerModelNeedUpdate: boolean = false;\n public pickedFeatureID: number | null = null;\n public selectedFeatureID: number | null = null;\n public styleNeedUpdate: boolean = false;\n public rendering: boolean;\n public clusterZoom: number = 0; // 聚合等级标记\n public layerType?: string | undefined;\n\n public dataState: IDataState = {\n dataSourceNeedUpdate: false,\n dataMappingNeedUpdate: false,\n filterNeedUpdate: false,\n featureScaleNeedUpdate: false,\n StyleAttrNeedUpdate: false,\n };\n // 生命周期钩子\n public hooks = {\n init: new SyncBailHook(),\n afterInit: new SyncBailHook(),\n beforeRender: new SyncBailHook(),\n beforeRenderData: new SyncWaterfallHook(),\n afterRender: new SyncHook(),\n beforePickingEncode: new SyncHook(),\n afterPickingEncode: new SyncHook(),\n beforeHighlight: new SyncHook(['pickedColor']),\n afterHighlight: new SyncHook(),\n beforeSelect: new SyncHook(['pickedColor']),\n afterSelect: new SyncHook(),\n beforeDestroy: new SyncHook(),\n afterDestroy: new SyncHook(),\n };\n\n // 待渲染 model 列表\n public models: IModel[] = [];\n\n // 每个 Layer 都有一个\n public multiPassRenderer: IMultiPassRenderer;\n\n // 注入插件集\n public plugins: ILayerPlugin[];\n\n public sourceOption: {\n data: any;\n options?: ISourceCFG;\n };\n\n public layerModel: ILayerModel;\n\n public shapeOption: {\n field: any;\n values: any;\n };\n\n // TODO: 记录 sceneContainer 供创建子图层的时候使用 如 imageTileLayer\n public sceneContainer: Container | undefined;\n // TODO: 用于保存子图层对象\n public layerChildren: ILayer[] = [];\n\n @lazyInject(TYPES.IGlobalConfigService)\n protected readonly configService: IGlobalConfigService;\n\n // @lazyInject(TYPES.IShaderModuleService)\n // protected readonly shaderModuleService: IShaderModuleService;\n\n protected shaderModuleService: IShaderModuleService;\n protected cameraService: ICameraService;\n\n protected coordinateService: ICoordinateSystemService;\n\n protected iconService: IIconService;\n\n protected fontService: IFontService;\n\n protected pickingService: IPickingService;\n\n protected rendererService: IRendererService;\n\n protected layerService: ILayerService;\n\n protected interactionService: IInteractionService;\n\n protected mapService: IMapService;\n\n protected styleAttributeService: IStyleAttributeService;\n\n protected layerSource: Source;\n\n protected postProcessingPassFactory: (\n name: string,\n ) => IPostProcessingPass<unknown>;\n protected normalPassFactory: (name: string) => IPass<unknown>;\n\n protected animateOptions: IAnimateOption = { enable: false };\n\n /**\n * 图层容器\n */\n private container: Container;\n\n private encodedData: IEncodeFeature[];\n\n private configSchema: object;\n\n private currentPickId: number | null = null;\n\n private rawConfig: Partial<ILayerConfig & ChildLayerStyleOptions>;\n\n private needUpdateConfig: Partial<ILayerConfig & ChildLayerStyleOptions>;\n\n /**\n * 待更新样式属性,在初始化阶段完成注册\n */\n private pendingStyleAttributes: Array<{\n attributeName: string;\n attributeField: StyleAttributeField;\n attributeValues?: StyleAttributeOption;\n defaultName?: string;\n updateOptions?: Partial<IStyleAttributeUpdateOptions>;\n }> = [];\n\n private scaleOptions: IScaleOptions = {};\n\n private animateStartTime: number;\n\n private aniamateStatus: boolean = false;\n\n // TODO: layer 保底颜色\n private bottomColor = 'rgba(0, 0, 0, 0)';\n\n private isDestroied: boolean = false;\n\n // private pickingPassRender: IPass<'pixelPicking'>;\n\n constructor(config: Partial<ILayerConfig & ChildLayerStyleOptions> = {}) {\n super();\n this.name = config.name || this.id;\n this.zIndex = config.zIndex || 0;\n this.rawConfig = config;\n }\n\n public getLayerConfig() {\n return this.configService.getLayerConfig<ChildLayerStyleOptions>(this.id);\n }\n\n public updateLayerConfig(\n configToUpdate: Partial<ILayerConfig | ChildLayerStyleOptions>,\n ) {\n if (!this.inited) {\n this.needUpdateConfig = {\n ...this.needUpdateConfig,\n ...configToUpdate,\n };\n } else {\n const sceneId = this.container.get<string>(TYPES.SceneID);\n\n // @ts-ignore\n handleStyleDataMapping(configToUpdate, this); // 处理 style 中进行数据映射的属性字段\n\n this.configService.setLayerConfig(sceneId, this.id, {\n ...this.configService.getLayerConfig(this.id),\n ...this.needUpdateConfig,\n ...configToUpdate,\n });\n this.needUpdateConfig = {};\n }\n }\n\n /**\n * 注入图层容器,父容器为场景容器\n * RootContainer 1\n * -> SceneContainer 1.*\n * -> LayerContainer 1.*\n */\n public setContainer(container: Container, sceneContainer: Container) {\n this.container = container;\n this.sceneContainer = sceneContainer;\n }\n\n public getContainer() {\n return this.container;\n }\n\n public setBottomColor(color: string) {\n this.bottomColor = color;\n }\n\n public getBottomColor() {\n return this.bottomColor;\n }\n\n public addPlugin(plugin: ILayerPlugin): ILayer {\n // TODO: 控制插件注册顺序\n // @example:\n // pointLayer.addPlugin(new MyCustomPlugin(), {\n // before: 'L7BuiltinPlugin'\n // });\n this.plugins.push(plugin);\n return this;\n }\n\n public init() {\n // 设置配置项\n const sceneId = this.container.get<string>(TYPES.SceneID);\n // 初始化图层配置项\n // const { enableMultiPassRenderer = false } = this.rawConfig;\n // this.configService.setLayerConfig(sceneId, this.id, {\n // enableMultiPassRenderer,\n // });\n this.configService.setLayerConfig(sceneId, this.id, this.rawConfig);\n this.layerType = this.rawConfig.layerType;\n\n // 全局容器服务\n\n // 场景容器服务\n this.iconService = this.container.get<IIconService>(TYPES.IIconService);\n this.fontService = this.container.get<IFontService>(TYPES.IFontService);\n\n this.rendererService = this.container.get<IRendererService>(\n TYPES.IRendererService,\n );\n this.layerService = this.container.get<ILayerService>(TYPES.ILayerService);\n this.interactionService = this.container.get<IInteractionService>(\n TYPES.IInteractionService,\n );\n\n this.pickingService = this.container.get<IPickingService>(\n TYPES.IPickingService,\n );\n this.mapService = this.container.get<IMapService>(TYPES.IMapService);\n const { enableMultiPassRenderer, passes } = this.getLayerConfig();\n if (enableMultiPassRenderer && passes?.length && passes.length > 0) {\n // Tip: 兼容 multiPassRender 在 amap1 时存在的图层不同步问题 zoom\n this.mapService.on('mapAfterFrameChange', () => {\n this.renderLayers();\n });\n }\n\n this.cameraService = this.container.get<ICameraService>(\n TYPES.ICameraService,\n );\n this.coordinateService = this.container.get<ICoordinateSystemService>(\n TYPES.ICoordinateSystemService,\n );\n this.shaderModuleService = this.container.get<IShaderModuleService>(\n TYPES.IShaderModuleService,\n );\n this.postProcessingPassFactory = this.container.get(\n TYPES.IFactoryPostProcessingPass,\n );\n this.normalPassFactory = this.container.get(TYPES.IFactoryNormalPass);\n\n // 图层容器服务\n this.styleAttributeService = this.container.get<IStyleAttributeService>(\n TYPES.IStyleAttributeService,\n );\n this.multiPassRenderer = this.container.get<IMultiPassRenderer>(\n TYPES.IMultiPassRenderer,\n );\n this.multiPassRenderer.setLayer(this);\n\n // 完成样式服务注册完成前添加的属性\n this.pendingStyleAttributes.forEach(\n ({ attributeName, attributeField, attributeValues, updateOptions }) => {\n this.styleAttributeService.updateStyleAttribute(\n attributeName,\n {\n // @ts-ignore\n scale: {\n field: attributeField,\n ...this.splitValuesAndCallbackInAttribute(\n // @ts-ignore\n attributeValues,\n // @ts-ignore\n this.getLayerConfig()[attributeName],\n ),\n },\n },\n // @ts-ignore\n updateOptions,\n );\n },\n );\n this.pendingStyleAttributes = [];\n\n // 获取插件集\n this.plugins = this.container.getAll<ILayerPlugin>(TYPES.ILayerPlugin);\n // 完成插件注册,传入场景和图层容器内的服务\n for (const plugin of this.plugins) {\n plugin.apply(this, {\n rendererService: this.rendererService,\n mapService: this.mapService,\n styleAttributeService: this.styleAttributeService,\n normalPassFactory: this.normalPassFactory,\n postProcessingPassFactory: this.postProcessingPassFactory,\n });\n }\n\n // 触发 init 生命周期插件\n this.hooks.init.call();\n // this.pickingPassRender = this.normalPassFactory('pixelPicking');\n // this.pickingPassRender.init(this);\n this.hooks.afterInit.call();\n\n // 触发初始化完成事件;\n this.emit('inited', {\n target: this,\n type: 'inited',\n });\n this.emit('add', {\n target: this,\n type: 'add',\n });\n return this;\n }\n /**\n * Model初始化前需要更新Model样式\n */\n public prepareBuildModel() {\n this.inited = true;\n this.updateLayerConfig({\n ...(this.getDefaultConfig() as object),\n ...this.rawConfig,\n });\n\n // 启动动画\n const { animateOption } = this.getLayerConfig();\n if (animateOption?.enable) {\n this.layerService.startAnimate();\n this.aniamateStatus = true;\n }\n }\n public color(\n field: StyleAttributeField,\n values?: StyleAttributeOption,\n updateOptions?: Partial<IStyleAttributeUpdateOptions>,\n ) {\n // 设置 color、size、shape、style 时由于场景服务尚未完成(并没有调用 scene.addLayer),因此暂时加入待更新属性列表\n this.updateStyleAttribute('color', field, values, updateOptions);\n\n // this.pendingStyleAttributes.push({\n // attributeName: 'color',\n // attributeField: field,\n // attributeValues: values,\n // defaultName: 'colors',\n // updateOptions,\n // });\n return this;\n }\n\n // 为对应的图层传入纹理的编号名称(point/image 在 shape 方法中传入纹理名称的方法并不通用)\n public texture(\n field: StyleAttributeField,\n values?: StyleAttributeOption,\n updateOptions?: Partial<IStyleAttributeUpdateOptions>,\n ) {\n this.updateStyleAttribute('texture', field, values, updateOptions);\n return this;\n }\n\n public rotate(\n field: StyleAttributeField,\n values?: StyleAttributeOption,\n updateOptions?: Partial<IStyleAttributeUpdateOptions>,\n ) {\n this.updateStyleAttribute('rotate', field, values, updateOptions);\n return this;\n }\n public size(\n field: StyleAttributeField,\n values?: StyleAttributeOption,\n updateOptions?: Partial<IStyleAttributeUpdateOptions>,\n ) {\n this.updateStyleAttribute('size', field, values, updateOptions);\n return this;\n }\n // 对mapping后的数据过滤,scale保持不变\n public filter(\n field: StyleAttributeField,\n values?: StyleAttributeOption,\n updateOptions?: Partial<IStyleAttributeUpdateOptions>,\n ) {\n this.updateStyleAttribute('filter', field, values, updateOptions);\n return this;\n }\n\n public shape(\n field: StyleAttributeField,\n values?: StyleAttributeOption,\n updateOptions?: Partial<IStyleAttributeUpdateOptions>,\n ) {\n const lastShape = this.styleAttributeService?.getLayerStyleAttribute(\n 'shape',\n )?.scale?.field;\n const currentShape = field;\n this.shapeOption = {\n field,\n values,\n };\n this.updateStyleAttribute('shape', field, values, updateOptions);\n // TODO: 根据 shape 判断是否需要更新 model\n updateShape(this, lastShape, currentShape);\n return this;\n }\n public label(\n field: StyleAttributeField,\n values?: StyleAttributeOption,\n updateOptions?: Partial<IStyleAttributeUpdateOptions>,\n ) {\n this.pendingStyleAttributes.push({\n attributeName: 'label',\n attributeField: field,\n attributeValues: values,\n updateOptions,\n });\n return this;\n }\n public animate(options: IAnimateOption | boolean) {\n let rawAnimate: Partial<IAnimateOption> = {};\n if (isObject(options)) {\n rawAnimate.enable = true;\n rawAnimate = {\n ...rawAnimate,\n ...options,\n };\n } else {\n rawAnimate.enable = options;\n }\n this.updateLayerConfig({\n animateOption: rawAnimate,\n });\n // this.animateOptions = options;\n return this;\n }\n\n public source(data: any, options?: ISourceCFG): ILayer {\n if (data?.data) {\n // 判断是否为source\n this.setSource(data);\n return this;\n }\n this.sourceOption = {\n data,\n options,\n };\n this.clusterZoom = 0;\n return this;\n }\n\n public setData(data: any, options?: ISourceCFG) {\n if (this.inited) {\n this.layerSource.setData(data, options);\n } else {\n this.on('inited', () => {\n const currentSource = this.getSource();\n if (!currentSource) {\n // 执行 setData 的时候 source 还不存在(还未执行 addLayer)\n this.source(new Source(data, options));\n this.sourceEvent();\n } else {\n this.layerSource.setData(data, options);\n }\n // this.layerSource.setData(data, options);\n });\n }\n\n return this;\n }\n public style(\n options: Partial<ChildLayerStyleOptions> & Partial<ILayerConfig>,\n ): ILayer {\n const { passes, ...rest } = options;\n\n // passes 特殊处理\n if (passes) {\n normalizePasses(passes).forEach(\n (pass: [string, { [key: string]: unknown }]) => {\n const postProcessingPass = this.multiPassRenderer\n .getPostProcessor()\n .getPostProcessingPassByName(pass[0]);\n if (postProcessingPass) {\n postProcessingPass.updateOptions(pass[1]);\n }\n },\n );\n }\n\n this.rawConfig = {\n ...this.rawConfig,\n ...rest,\n };\n if (this.container) {\n this.updateLayerConfig(this.rawConfig);\n this.styleNeedUpdate = true;\n }\n return this;\n }\n public scale(field: string | number | IScaleOptions, cfg?: IScale) {\n if (isObject(field)) {\n this.scaleOptions = {\n ...this.scaleOptions,\n ...field,\n };\n } else {\n this.scaleOptions[field] = cfg;\n }\n return this;\n }\n\n /**\n * 渲染所有的图层\n */\n public renderLayers(): void {\n this.rendering = true;\n\n this.layerService.renderLayers();\n\n this.rendering = false;\n }\n\n public render(): ILayer {\n // TODO: this.getEncodedData().length !== 0 这个判断是为了解决在 2.5.x 引入数据纹理后产生的 空数据渲染导致 texture 超出上限问题\n if (this.getEncodedData().length !== 0) {\n this.renderModels();\n }\n return this;\n }\n\n /**\n * renderMultiPass 专门用于渲染支持 multipass 的 layer\n */\n public async renderMultiPass() {\n if (this.getEncodedData().length !== 0) {\n if (this.multiPassRenderer && this.multiPassRenderer.getRenderFlag()) {\n // multi render 开始执行 multiPassRender 的渲染流程\n await this.multiPassRenderer.render();\n } else if (this.multiPassRenderer) {\n // renderPass 触发的渲染\n this.renderModels();\n } else {\n this.renderModels();\n }\n }\n }\n\n public active(options: IActiveOption | boolean) {\n const activeOption: Partial<ILayerConfig> = {};\n activeOption.enableHighlight = isObject(options) ? true : options;\n if (isObject(options)) {\n activeOption.enableHighlight = true;\n if (options.color) {\n activeOption.highlightColor = options.color;\n }\n if (options.mix) {\n activeOption.activeMix = options.mix;\n }\n } else {\n activeOption.enableHighlight = !!options;\n }\n this.updateLayerConfig(activeOption);\n return this;\n }\n public setActive(\n id: number | { x: number; y: number },\n options?: IActiveOption,\n ): void {\n if (isObject(id)) {\n const { x = 0, y = 0 } = id;\n this.updateLayerConfig({\n highlightColor: isObject(options)\n ? options.color\n : this.getLayerConfig().highlightColor,\n activeMix: isObject(options)\n ? options.mix\n : this.getLayerConfig().activeMix,\n });\n this.pick({ x, y });\n } else {\n this.updateLayerConfig({\n pickedFeatureID: id,\n highlightColor: isObject(options)\n ? options.color\n : this.getLayerConfig().highlightColor,\n activeMix: isObject(options)\n ? options.mix\n : this.getLayerConfig().activeMix,\n });\n this.hooks.beforeSelect\n .call(encodePickingColor(id as number) as number[])\n // @ts-ignore\n .then(() => {\n setTimeout(() => {\n this.reRender();\n }, 1);\n });\n }\n }\n\n public select(option: IActiveOption | boolean): ILayer {\n const activeOption: Partial<ILayerConfig> = {};\n activeOption.enableSelect = isObject(option) ? true : option;\n if (isObject(option)) {\n activeOption.enableSelect = true;\n if (option.color) {\n activeOption.selectColor = option.color;\n }\n if (option.mix) {\n activeOption.selectMix = option.mix;\n }\n } else {\n activeOption.enableSelect = !!option;\n }\n this.updateLayerConfig(activeOption);\n return this;\n }\n\n public setSelect(\n id: number | { x: number; y: number },\n options?: IActiveOption,\n ): void {\n if (isObject(id)) {\n const { x = 0, y = 0 } = id;\n this.updateLayerConfig({\n selectColor: isObject(options)\n ? options.color\n : this.getLayerConfig().selectColor,\n selectMix: isObject(options)\n ? options.mix\n : this.getLayerConfig().selectMix,\n });\n this.pick({ x, y });\n } else {\n this.updateLayerConfig({\n pickedFeatureID: id,\n selectColor: isObject(options)\n ? options.color\n : this.getLayerConfig().selectColor,\n selectMix: isObject(options)\n ? options.mix\n : this.getLayerConfig().selectMix,\n });\n this.hooks.beforeSelect\n .call(encodePickingColor(id as number) as number[])\n // @ts-ignore\n .then(() => {\n setTimeout(() => {\n this.reRender();\n }, 1);\n });\n }\n }\n public setBlend(type: keyof typeof BlendType): ILayer {\n this.updateLayerConfig({\n blend: type,\n });\n this.layerModelNeedUpdate = true;\n this.reRender();\n return this;\n }\n public show(): ILayer {\n this.updateLayerConfig({\n visible: true,\n });\n this.reRender();\n return this;\n }\n\n public hide(): ILayer {\n this.updateLayerConfig({\n visible: false,\n });\n this.reRender();\n return this;\n }\n public setIndex(index: number): ILayer {\n this.zIndex = index;\n this.layerService.updateLayerRenderList();\n this.layerService.renderLayers();\n return this;\n }\n\n public setCurrentPickId(id: number) {\n this.currentPickId = id;\n }\n\n public getCurrentPickId(): number | null {\n return this.currentPickId;\n }\n\n public setCurrentSelectedId(id: number) {\n this.selectedFeatureID = id;\n }\n\n public getCurrentSelectedId(): number | null {\n return this.selectedFeatureID;\n }\n public isVisible(): boolean {\n const zoom = this.mapService.getZoom();\n const {\n visible,\n minZoom = -Infinity,\n maxZoom = Infinity,\n } = this.getLayerConfig();\n return !!visible && zoom >= minZoom && zoom <= maxZoom;\n }\n\n public setMultiPass(\n enableMultiPass: boolean,\n currentPasses?: Array<string | [string, { [key: string]: unknown }]>,\n ) {\n this.updateLayerConfig({\n enableMultiPassRenderer: enableMultiPass,\n });\n if (currentPasses) {\n this.updateLayerConfig({\n passes: currentPasses,\n });\n }\n\n if (enableMultiPass) {\n const { passes = [] } = this.getLayerConfig();\n this.multiPassRenderer = createMultiPassRenderer(\n this,\n passes,\n this.postProcessingPassFactory,\n this.normalPassFactory,\n );\n this.multiPassRenderer.setRenderFlag(true);\n const { width, height } = this.rendererService.getViewportSize();\n this.multiPassRenderer.resize(width, height);\n }\n\n return this;\n }\n\n public setMinZoom(minZoom: number): ILayer {\n this.updateLayerConfig({\n minZoom,\n });\n return this;\n }\n\n public getMinZoom(): number {\n const { minZoom } = this.getLayerConfig();\n return minZoom as number;\n }\n\n public getMaxZoom(): number {\n const { maxZoom } = this.getLayerConfig();\n return maxZoom as number;\n }\n\n public get(name: string) {\n const cfg = this.getLayerConfig();\n // @ts-ignore\n return cfg[name];\n }\n\n public setMaxZoom(maxZoom: number): ILayer {\n this.updateLayerConfig({\n maxZoom,\n });\n return this;\n }\n\n public setAutoFit(autoFit: boolean): ILayer {\n this.updateLayerConfig({\n autoFit,\n });\n return this;\n }\n\n /**\n * zoom to layer Bounds\n */\n public fitBounds(fitBoundsOptions?: unknown): ILayer {\n if (!this.inited) {\n this.updateLayerConfig({\n autoFit: true,\n });\n return this;\n }\n const source = this.getSource();\n const extent = source.extent;\n const isValid = extent.some((v) => Math.abs(v) === Infinity);\n if (isValid) {\n return this;\n }\n this.mapService.fitBounds(\n [\n [extent[0], extent[1]],\n [extent[2], extent[3]],\n ],\n fitBoundsOptions,\n );\n return this;\n }\n\n public destroy() {\n // debugger\n if (this.isDestroied) {\n return;\n }\n this.hooks.beforeDestroy.call();\n // 清除sources事件\n this.layerSource.off('update', this.sourceEvent);\n\n this.multiPassRenderer.destroy();\n // console.log(this.styleAttributeService.getAttributes())\n // 清除所有属性以及关联的 vao == 销毁所有 => model this.models.forEach((model) => model.destroy());\n this.styleAttributeService.clearAllAttributes();\n\n // 执行每个图层单独的 clearModels 方法 (清除一些额外的 texture、program、buffer 等)\n\n this.hooks.afterDestroy.call();\n\n // TODO: 清除各个图层自定义的 models 资源\n // this.layerModel?.clearModels();\n\n this.models = [];\n\n this.layerService.cleanRemove(this);\n\n this.emit('remove', {\n target: this,\n type: 'remove',\n });\n\n this.emit('destroy', {\n target: this,\n type: 'destroy',\n });\n\n this.removeAllListeners();\n // 解绑图层容器中的服务\n // this.container.unbind(TYPES.IStyleAttributeService);\n\n this.isDestroied = true;\n }\n public clear() {\n this.styleAttributeService.clearAllAttributes();\n // 销毁所有 model\n }\n public clearModels() {\n this.models.forEach((model) => model.destroy());\n this.layerModel.clearModels();\n }\n\n public isDirty() {\n return !!(\n this.styleAttributeService.getLayerStyleAttributes() || []\n ).filter(\n (attribute) =>\n attribute.needRescale ||\n attribute.needRemapping ||\n attribute.needRegenerateVertices,\n ).length;\n }\n\n public setSource(source: Source) {\n // 清除旧 sources 事件\n if (this.layerSource) {\n this.layerSource.off('update', this.sourceEvent);\n }\n\n this.layerSource = source;\n this.clusterZoom = 0;\n\n // 已 inited 且启用聚合进行更新聚合数据\n if (this.inited && this.layerSource.cluster) {\n const zoom = this.mapService.getZoom();\n this.layerSource.updateClusterData(zoom);\n }\n // source 可能会复用,会在其它layer被修改\n this.layerSource.on('update', this.sourceEvent);\n }\n public getSource() {\n return this.layerSource;\n }\n\n public getScaleOptions() {\n return this.scaleOptions;\n }\n\n public setEncodedData(encodedData: IEncodeFeature[]) {\n this.encodedData = encodedData;\n }\n public getEncodedData() {\n return this.encodedData;\n }\n\n public getScale(name: string): any {\n return this.styleAttributeService.getLayerAttributeScale(name);\n }\n\n public getLegendItems(name: string): LegendItems {\n const scale = this.styleAttributeService.getLayerAttributeScale(name);\n\n // 函数自定义映射,没有 scale 返回为空数组\n if (!scale) {\n return [];\n }\n\n if (scale.invertExtent) {\n // 分段类型 Quantize、Quantile、Threshold\n const items: ILegendSegmentItem[] = scale.range().map((item: number) => {\n return {\n value: scale.invertExtent(item),\n [name]: item,\n };\n });\n\n return items;\n } else if (scale.ticks) {\n // 连续类型 Continuous (Linear, Power, Log, Identity, Time)\n const items: ILegendClassificaItem[] = scale\n .ticks()\n .map((item: string) => {\n return {\n value: item,\n [name]: scale(item),\n };\n });\n\n return items;\n } else if (scale?.domain) {\n // 枚举类型 Cat\n const items: ILegendClassificaItem[] = scale\n .domain()\n .filter((item: string | number | undefined) => !isUndefined(item))\n .map((item: string | number) => {\n return {\n value: item,\n [name]: scale(item) as string,\n };\n });\n\n return items;\n }\n\n return [];\n }\n\n public pick({ x, y }: { x: number; y: number }) {\n this.interactionService.triggerHover({ x, y });\n }\n\n public boxSelect(\n box: [number, number, number, number],\n cb: (...args: any[]) => void,\n ) {\n this.pickingService.boxPickLayer(this, box, cb);\n }\n\n public buildLayerModel(\n options: ILayerModelInitializationOptions &\n Partial<IModelInitializationOptions>,\n ): IModel {\n const {\n moduleName,\n vertexShader,\n fragmentShader,\n triangulation,\n segmentNumber,\n ...rest\n } = options;\n this.shaderModuleService.registerModule(moduleName, {\n vs: vertexShader,\n fs: fragmentShader,\n });\n const { vs, fs, uniforms } = this.shaderModuleService.getModule(moduleName);\n const { createModel } = this.rendererService;\n const {\n attributes,\n elements,\n } = this.styleAttributeService.createAttributesAndIndices(\n this.encodedData,\n triangulation,\n segmentNumber,\n );\n return createModel({\n attributes,\n uniforms,\n fs,\n vs,\n elements,\n blend: BlendTypes[BlendType.normal],\n ...rest,\n });\n }\n\n public getTime() {\n return this.layerService.clock.getDelta();\n }\n public setAnimateStartTime() {\n this.animateStartTime = this.layerService.clock.getElapsedTime();\n }\n public stopAnimate() {\n if (this.aniamateStatus) {\n this.layerService.stopAnimate();\n this.aniamateStatus = false;\n this.updateLayerConfig({\n animateOption: {\n enable: false,\n },\n });\n }\n }\n public getLayerAnimateTime(): number {\n return this.layerService.clock.getElapsedTime() - this.animateStartTime;\n }\n\n public needPick(type: string): boolean {\n const {\n enableHighlight = true,\n enableSelect = true,\n } = this.getLayerConfig();\n // 判断layer是否监听事件;\n let isPick =\n this.eventNames().indexOf(type) !== -1 ||\n this.eventNames().indexOf('un' + type) !== -1;\n if ((type === 'click' || type === 'dblclick') && enableSelect) {\n isPick = true;\n }\n if (\n type === 'mousemove' &&\n (enableHighlight ||\n this.eventNames().indexOf('mouseenter') !== -1 ||\n this.eventNames().indexOf('unmousemove') !== -1 ||\n this.eventNames().indexOf('mouseout') !== -1)\n ) {\n isPick = true;\n }\n return this.isVisible() && isPick;\n }\n\n public buildModels() {\n throw new Error('Method not implemented.');\n }\n public rebuildModels() {\n throw new Error('Method not implemented.');\n }\n\n public async renderMulPass(multiPassRenderer: IMultiPassRenderer) {\n await multiPassRenderer.render();\n }\n\n public renderModels(isPicking?: boolean) {\n // TODO: this.getEncodedData().length > 0 这个判断是为了解决在 2.5.x 引入数据纹理后产生的 空数据渲染导致 texture 超出上限问题\n if (this.getEncodedData().length > 0) {\n if (this.layerModelNeedUpdate && this.layerModel) {\n this.models = this.layerModel.buildModels();\n this.hooks.beforeRender.call();\n this.layerModelNeedUpdate = false;\n }\n\n if (this.layerModel.renderUpdate) {\n this.layerModel.renderUpdate();\n }\n this.models.forEach((model) => {\n model.draw(\n {\n uniforms: this.layerModel.getUninforms(),\n },\n isPicking,\n );\n });\n }\n return this;\n }\n\n public updateStyleAttribute(\n type: string,\n field: StyleAttributeField,\n values?: StyleAttributeOption,\n updateOptions?: Partial<IStyleAttributeUpdateOptions>,\n ) {\n if (!this.inited) {\n this.pendingStyleAttributes.push({\n attributeName: type,\n attributeField: field,\n attributeValues: values,\n updateOptions,\n });\n } else {\n this.styleAttributeService.updateStyleAttribute(\n type,\n {\n // @ts-ignore\n scale: {\n field,\n ...this.splitValuesAndCallbackInAttribute(\n // @ts-ignore\n values,\n // @ts-ignore\n this.getLayerConfig()[field],\n ),\n },\n },\n // @ts-ignore\n updateOptions,\n );\n }\n }\n\n public getShaderPickStat() {\n return this.layerService.getShaderPickStat();\n }\n\n /**\n * 继承空方法\n * @param time\n */\n public setEarthTime(time: number) {\n console.warn('empty fn');\n }\n\n protected getConfigSchema() {\n throw new Error('Method not implemented.');\n }\n\n protected getModelType(): unknown {\n throw new Error('Method not implemented.');\n }\n protected getDefaultConfig() {\n return {};\n }\n\n private sourceEvent = () => {\n this.dataState.dataSourceNeedUpdate = true;\n const { autoFit, fitBoundsOptions } = this.getLayerConfig();\n if (autoFit) {\n this.fitBounds(fitBoundsOptions);\n }\n // 对外暴露事件 迁移到 DataMappingPlugin generateMapping,保证在重新重新映射后触发\n // this.emit('dataUpdate');\n this.reRender();\n };\n\n private reRender() {\n if (this.inited) {\n this.layerService.updateLayerRenderList();\n this.layerService.renderLayers();\n }\n }\n private splitValuesAndCallbackInAttribute(\n valuesOrCallback?: unknown[],\n defaultValues?: unknown[],\n ) {\n return {\n values: isFunction(valuesOrCallback)\n ? undefined\n : valuesOrCallback || defaultValues,\n callback: isFunction(valuesOrCallback) ? valuesOrCallback : undefined,\n };\n }\n}\n"],"file":"BaseLayer.js"}
@@ -8,7 +8,6 @@ import _initializerWarningHelper from "@babel/runtime/helpers/initializerWarning
8
8
  import _isString from "lodash/isString";
9
9
  import _isNumber from "lodash/isNumber";
10
10
  import _isEqual from "lodash/isEqual";
11
- import _isArray from "lodash/isArray";
12
11
 
13
12
  var _dec, _class, _descriptor;
14
13
 
@@ -267,7 +266,7 @@ var BaseModel = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = functi
267
266
  }, {
268
267
  key: "isOffsetStatic",
269
268
  value: function isOffsetStatic(offsets) {
270
- if (_isArray(offsets) && offsets.length === 2 && _isNumber(offsets[0]) && _isNumber(offsets[1])) {
269
+ if (Array.isArray(offsets) && offsets.length === 2 && _isNumber(offsets[0]) && _isNumber(offsets[1])) {
271
270
  return true;
272
271
  } else {
273
272
  return false;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/core/BaseModel.ts"],"names":["BlendType","gl","lazyInject","TYPES","rgb2arr","color","BlendTypes","BaseModel","IGlobalConfigService","layer","rendererService","getContainer","get","IRendererService","shaderModuleService","IShaderModuleService","styleAttributeService","IStyleAttributeService","mapService","IMapService","iconService","IIconService","fontService","IFontService","cameraService","ICameraService","layerService","ILayerService","registerBuiltinAttributes","startModelAnimate","createTexture2D","DATA_TEXTURE_WIDTH","rowCount","cellLength","cellProperties","cacheStyleProperties","thetaOffset","undefined","opacity","strokeOpacity","strokeWidth","stroke","offsets","stylePropertyesExist","hasThetaOffset","hasOpacity","hasStrokeOpacity","hasStrokeWidth","hasStroke","hasOffsets","dataTextureTest","getOESTextureFloat","dataTexture","data","Uint8Array","mag","NEAREST","min","width","height","options","isUpdate","clearLastCalRes","push","attr","count","isStaticColor","isOffsetStatic","strokeColor","length","d","i","cellData","cellPropertiesLayouts","layout","value","patchMod","encodeData","encodeDatalength","Math","ceil","totalLength","patchData","getLayerConfig","blend","Error","option","enable","duration","interval","trailLength","animateOption","setAnimateStartTime"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA,SACEA,SADF,EAEEC,EAFF,EAwBEC,UAxBF,EA0BEC,KA1BF,QA2BO,eA3BP;AA4BA,SAASC,OAAT,QAAwB,gBAAxB;AACA,SAASC,KAAT,QAAsB,UAAtB;AAEA,SAASC,UAAT,QAA2B,gBAA3B;IA0BqBC,S,WAoClBL,UAAU,CAACC,KAAK,CA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D;;;WACD,wBAAqC;AACnC,YAAM,IAAIC,KAAJ,CAAU,yBAAV,CAAN;AACD;;;WAED,8BAA2C;AACzC,aAAO,EAAP;AACD;;;WAED,sBAA6B;AAC3B,aAAO,KAAP;AACD;;;WACD,uBAA+B;AAC7B,YAAM,IAAIA,KAAJ,CAAU,yBAAV,CAAN;AACD;;;WACD,sBAA8B;AAC5B,YAAM,IAAIA,KAAJ,CAAU,yBAAV,CAAN;AACD;;;WACD,uBAAqB;AACnB;AACD;;;WACD,wBAKE;AACA,YAAM,IAAIA,KAAJ,CAAU,yBAAV,CAAN;AACD;;;WACD,kBAAgB;AACd,YAAM,IAAIA,KAAJ,CAAU,yBAAV,CAAN;AACD;;;WACD,qCAAsC;AACpC,YAAM,IAAIA,KAAJ,CAAU,yBAAV,CAAN;AACD;;;WACD,6BAA8BC,MAA9B,EAAgE;AAC9D,aAAO,CACLA,MAAM,CAACC,MAAP,GAAgB,CAAhB,GAAoB,GADf,EAELD,MAAM,CAACE,QAAP,IAAmB,GAFd,EAGLF,MAAM,CAACG,QAAP,IAAmB,GAHd,EAILH,MAAM,CAACI,WAAP,IAAsB,GAJjB,CAAP;AAMD;;;WACD,6BAA8B;AAC5B,iBAA0B,KAAKjF,KAAL,CAAW0E,cAAX,EAA1B;AAAA,UAAQQ,aAAR,QAAQA,aAAR;;AACA,UAAIA,aAAa,CAACJ,MAAlB,EAA0B;AACxB,aAAK9E,KAAL,CAAWmF,mBAAX;AACD;AACF;;;;;;;;;;SAzekBrF,S","sourcesContent":["import {\n BlendType,\n gl,\n IAnimateOption,\n IAttribute,\n IBlendOptions,\n ICameraService,\n IElements,\n IEncodeFeature,\n IFontService,\n IGlobalConfigService,\n IIconService,\n ILayer,\n ILayerConfig,\n ILayerModel,\n ILayerService,\n IMapService,\n IModel,\n IModelUniform,\n IRendererService,\n IShaderModuleService,\n IStyleAttributeService,\n ITexture2D,\n ITexture2DInitializationOptions,\n lazyInject,\n Triangulation,\n TYPES,\n} from '@antv/l7-core';\nimport { rgb2arr } from '@antv/l7-utils';\nimport { color } from 'd3-color';\nimport { isArray, isEqual, isFunction, isNumber, isString } from 'lodash';\nimport { BlendTypes } from '../utils/blend';\n\nexport type styleSingle =\n | number\n | string\n | [string, (single: any) => number]\n | [string, [number, number]];\nexport type styleOffset =\n | string\n | [number, number]\n | [string, (single: any) => number];\nexport type styleColor =\n | string\n | [string, (single: any) => string]\n | [string, [string, string]];\nexport interface IDataTextureFrame {\n data: number[];\n width: number;\n height: number;\n}\n\nexport interface ICellProperty {\n attr: string;\n count: number;\n}\n\nexport default class BaseModel<ChildLayerStyleOptions = {}>\n implements ILayerModel {\n public triangulation: Triangulation;\n\n // style texture data mapping\n public createTexture2D: (\n options: ITexture2DInitializationOptions,\n ) => ITexture2D;\n\n protected layer: ILayer;\n protected dataTexture: ITexture2D; // 用于数据传递的数据纹理\n protected DATA_TEXTURE_WIDTH: number; // 默认有多少列(宽度)\n protected rowCount: number; // 计算得到的当前数据纹理有多少行(高度)\n protected cacheStyleProperties: {\n // 记录存储上一次样式字段的值\n thetaOffset: styleSingle | undefined;\n opacity: styleSingle | undefined;\n strokeOpacity: styleSingle | undefined;\n strokeWidth: styleSingle | undefined;\n stroke: styleColor | undefined;\n offsets: styleOffset | undefined;\n };\n protected cellLength: number; // 单个 cell 的长度\n protected cellProperties: ICellProperty[]; // 需要进行数据映射的属性集合\n protected cellTypeLayout: number[];\n protected stylePropertyesExist: {\n // 记录 style 属性是否存在的中间变量\n hasThetaOffset: number;\n hasOpacity: number;\n hasStrokeOpacity: number;\n hasStrokeWidth: number;\n hasStroke: number;\n hasOffsets: number;\n };\n protected dataTextureTest: boolean;\n\n @lazyInject(TYPES.IGlobalConfigService)\n protected readonly configService: IGlobalConfigService;\n\n // @lazyInject(TYPES.IIconService)\n // protected readonly iconService: IIconService;\n\n // @lazyInject(TYPES.IFontService)\n // protected readonly fontService: IFontService;\n\n // @lazyInject(TYPES.IShaderModuleService)\n protected shaderModuleService: IShaderModuleService;\n\n protected rendererService: IRendererService;\n protected iconService: IIconService;\n protected fontService: IFontService;\n protected styleAttributeService: IStyleAttributeService;\n protected mapService: IMapService;\n protected cameraService: ICameraService;\n protected layerService: ILayerService;\n\n // style texture data mapping\n\n constructor(layer: ILayer) {\n this.layer = layer;\n this.rendererService = layer\n .getContainer()\n .get<IRendererService>(TYPES.IRendererService);\n this.shaderModuleService = layer\n .getContainer()\n .get<IShaderModuleService>(TYPES.IShaderModuleService);\n\n this.styleAttributeService = layer\n .getContainer()\n .get<IStyleAttributeService>(TYPES.IStyleAttributeService);\n this.mapService = layer.getContainer().get<IMapService>(TYPES.IMapService);\n this.iconService = layer\n .getContainer()\n .get<IIconService>(TYPES.IIconService);\n this.fontService = layer\n .getContainer()\n .get<IFontService>(TYPES.IFontService);\n this.cameraService = layer\n .getContainer()\n .get<ICameraService>(TYPES.ICameraService);\n this.layerService = layer\n .getContainer()\n .get<ILayerService>(TYPES.ILayerService);\n\n // 注册 Attribute\n this.registerBuiltinAttributes();\n // 开启动画\n this.startModelAnimate();\n\n const { createTexture2D } = this.rendererService;\n this.createTexture2D = createTexture2D;\n this.DATA_TEXTURE_WIDTH = 1024; // 数据纹理固定宽度\n this.rowCount = 1;\n this.cellLength = 0;\n this.cellProperties = [];\n this.cacheStyleProperties = {\n thetaOffset: undefined,\n opacity: undefined,\n strokeOpacity: undefined,\n strokeWidth: undefined,\n stroke: undefined,\n offsets: undefined,\n };\n this.stylePropertyesExist = {\n hasThetaOffset: 0,\n hasOpacity: 0,\n hasStrokeOpacity: 0,\n hasStrokeWidth: 0,\n hasStroke: 0,\n hasOffsets: 0,\n };\n this.dataTextureTest = this.layerService.getOESTextureFloat();\n // 只有在不支持数据纹理的情况下进行赋值\n if (!this.dataTextureTest) {\n this.dataTexture = this.createTexture2D({\n // data: new Uint8ClampedArray(4),\n // 使用 Uint8ClampedArray 在 支付宝 环境中可能存在问题 UC 内核对格式有要求 L7 v2.7.18 版本发现\n // Uint8ClampedArray 和 Uint8Array 没有实质性的区别\n data: new Uint8Array(4),\n mag: gl.NEAREST,\n min: gl.NEAREST,\n width: 1,\n height: 1,\n });\n }\n }\n\n // style datatexture mapping\n\n /**\n * 清除上一次的计算结果 - 全量清除\n */\n public clearLastCalRes() {\n this.cellProperties = []; // 清空上一次计算的需要进行数据映射的属性集合\n this.cellLength = 0; // 清空上一次计算的 cell 的长度\n this.stylePropertyesExist = {\n // 全量清空上一次是否需要对 style 属性进行数据映射的判断\n hasThetaOffset: 0,\n hasOpacity: 0,\n hasStrokeOpacity: 0,\n hasStrokeWidth: 0,\n hasStroke: 0,\n hasOffsets: 0,\n };\n }\n\n public getCellTypeLayout() {\n if (this.dataTextureTest) {\n return [\n // 0\n this.rowCount, // 数据纹理有几行\n this.DATA_TEXTURE_WIDTH, // 数据纹理有几列\n 0.0,\n 0.0,\n // 1\n this.stylePropertyesExist.hasOpacity, // cell 中是否存在 opacity\n this.stylePropertyesExist.hasStrokeOpacity, // cell 中是否存在 strokeOpacity\n this.stylePropertyesExist.hasStrokeWidth, // cell 中是否存在 strokeWidth\n this.stylePropertyesExist.hasStroke, // cell 中是否存在 stroke\n // 2\n this.stylePropertyesExist.hasOffsets, // cell 中是否存在 offsets\n this.stylePropertyesExist.hasThetaOffset, // cell 中是否存在 thetaOffset\n 0.0,\n 0.0,\n // 3\n 0.0,\n 0.0,\n 0.0,\n 1.0,\n ];\n } else {\n return [\n 1.0, // 数据纹理有几行\n 1.0, // 数据纹理有几列\n 0.0,\n 0.0,\n 0.0, // cell 中是否存在 opacity\n 0.0, // cell 中是否存在 strokeOpacity\n 0.0, // cell 中是否存在 strokeWidth\n 0.0, // cell 中是否存在 stroke\n 0.0, // cell 中是否存在 offsets\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n -1.0,\n ];\n }\n }\n\n /**\n * 判断数据纹理是否需要重新计算 - 根据传入的值进行判断\n * @param options\n * @returns\n */\n public dataTextureNeedUpdate(options: {\n // TODO: thetaOffset 目前只有 lineLayer/arc 使用\n thetaOffset?: styleSingle;\n opacity?: styleSingle;\n strokeOpacity?: styleSingle;\n strokeWidth?: styleSingle;\n stroke?: styleColor;\n offsets?: styleOffset;\n textOffset?: styleOffset;\n }): boolean {\n let isUpdate = false;\n if (!isEqual(options.thetaOffset, this.cacheStyleProperties.thetaOffset)) {\n isUpdate = true;\n this.cacheStyleProperties.thetaOffset = options.thetaOffset;\n }\n if (!isEqual(options.opacity, this.cacheStyleProperties.opacity)) {\n isUpdate = true;\n this.cacheStyleProperties.opacity = options.opacity;\n }\n if (\n !isEqual(options.strokeOpacity, this.cacheStyleProperties.strokeOpacity)\n ) {\n isUpdate = true;\n this.cacheStyleProperties.strokeOpacity = options.strokeOpacity;\n }\n if (!isEqual(options.strokeWidth, this.cacheStyleProperties.strokeWidth)) {\n isUpdate = true;\n this.cacheStyleProperties.strokeWidth = options.strokeWidth;\n }\n if (!isEqual(options.stroke, this.cacheStyleProperties.stroke)) {\n isUpdate = true;\n this.cacheStyleProperties.stroke = options.stroke;\n }\n if (!isEqual(options.offsets, this.cacheStyleProperties.offsets)) {\n isUpdate = true;\n this.cacheStyleProperties.offsets = options.offsets;\n }\n if (this.dataTexture === undefined) {\n isUpdate = true;\n }\n return isUpdate;\n }\n /**\n * 判断当前的样式中哪些是需要进行数据映射的,哪些是常量,同时计算用于构建数据纹理的一些中间变量\n * @param options\n */\n public judgeStyleAttributes(options: {\n // TODO: 目前 thetaOffset 只有 lineLayer/arc 使用\n thetaOffset?: styleSingle;\n opacity?: styleSingle;\n strokeOpacity?: styleSingle;\n strokeWidth?: styleSingle;\n stroke?: styleColor;\n offsets?: styleOffset;\n }) {\n this.clearLastCalRes(); // 清除上一次的计算结果 - 全量清除\n\n if (options.opacity !== undefined && !isNumber(options.opacity)) {\n // 数据映射\n this.cellProperties.push({ attr: 'opacity', count: 1 });\n this.stylePropertyesExist.hasOpacity = 1;\n this.cellLength += 1;\n }\n\n if (\n options.strokeOpacity !== undefined &&\n !isNumber(options.strokeOpacity)\n ) {\n // 数据映射\n this.cellProperties.push({ attr: 'strokeOpacity', count: 1 });\n this.stylePropertyesExist.hasStrokeOpacity = 1;\n this.cellLength += 1;\n }\n\n if (options.strokeWidth !== undefined && !isNumber(options.strokeWidth)) {\n // 数据映射\n this.cellProperties.push({ attr: 'strokeWidth', count: 1 });\n this.stylePropertyesExist.hasStrokeWidth = 1;\n this.cellLength += 1;\n }\n\n if (options.stroke !== undefined && !this.isStaticColor(options.stroke)) {\n // 数据映射\n this.cellProperties.push({ attr: 'stroke', count: 4 });\n this.stylePropertyesExist.hasStroke = 1;\n this.cellLength += 4;\n }\n\n if (\n options.offsets !== undefined &&\n !this.isOffsetStatic(options.offsets)\n ) {\n // 数据映射\n this.cellProperties.push({ attr: 'offsets', count: 2 });\n this.stylePropertyesExist.hasOffsets = 1;\n this.cellLength += 2;\n }\n\n if (options.thetaOffset !== undefined && !isNumber(options.thetaOffset)) {\n // 数据映射\n this.cellProperties.push({ attr: 'thetaOffset', count: 1 });\n this.stylePropertyesExist.hasThetaOffset = 1;\n this.cellLength += 1;\n }\n // console.log('this.cellLength', this.cellLength)\n }\n\n /**\n * 判断变量 stroke 是否是常量值\n * @param stroke\n * @returns\n */\n public isStaticColor(stroke: styleColor): boolean {\n if (isString(stroke)) {\n if (color(stroke)) {\n return true;\n } else {\n return false;\n }\n }\n return false;\n }\n /**\n * 获取 stroke 颜色并做兼容处理\n * @param stroke\n * @returns\n */\n public getStrokeColor(stroke: styleColor) {\n if (this.isStaticColor(stroke)) {\n const strokeColor = rgb2arr(stroke as string);\n strokeColor[0] = strokeColor[0] ? strokeColor[0] : 0;\n strokeColor[1] = strokeColor[1] ? strokeColor[1] : 0;\n strokeColor[2] = strokeColor[2] ? strokeColor[2] : 0;\n strokeColor[3] = strokeColor[3] ? strokeColor[3] : 0;\n return strokeColor;\n } else {\n return [0, 0, 0, 0];\n }\n }\n\n /**\n * 判断 offsets 是否是常量\n * @param offsets\n * @returns\n */\n public isOffsetStatic(offsets: styleOffset) {\n if (\n isArray(offsets) &&\n offsets.length === 2 &&\n isNumber(offsets[0]) &&\n isNumber(offsets[1])\n ) {\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * 补空位\n * @param d\n * @param count\n */\n public patchMod(d: number[], count: number) {\n for (let i = 0; i < count; i++) {\n d.push(-1);\n }\n }\n\n /**\n * 根据映射的数据字段往推入数据\n * @param d\n * @param cellData\n * @param cellPropertiesLayouts\n */\n public patchData(\n d: number[],\n cellData: IEncodeFeature,\n cellPropertiesLayouts: ICellProperty[],\n ) {\n for (const layout of cellPropertiesLayouts) {\n const { attr, count } = layout;\n\n const value = cellData[attr];\n if (value !== undefined) {\n // 数据中存在该属性\n if (attr === 'stroke') {\n d.push(...rgb2arr(value));\n } else if (attr === 'offsets') {\n if (this.isOffsetStatic(value)) {\n d.push(-value[0], value[1]);\n } else {\n d.push(0, 0);\n }\n } else {\n d.push(isNumber(value) ? value : 1.0);\n }\n } else {\n // 若不存在时则补位\n this.patchMod(d, count);\n }\n }\n }\n\n /**\n * 计算推入数据纹理的数据\n * @param cellLength\n * @param encodeData\n * @param cellPropertiesLayouts\n * @returns\n */\n public calDataFrame(\n cellLength: number,\n encodeData: IEncodeFeature[],\n cellPropertiesLayouts: ICellProperty[],\n ): IDataTextureFrame {\n const encodeDatalength = encodeData.length;\n const rowCount = Math.ceil(\n (encodeDatalength * cellLength) / this.DATA_TEXTURE_WIDTH,\n ); // 有多少行\n\n const totalLength = rowCount * this.DATA_TEXTURE_WIDTH;\n const d: number[] = [];\n for (let i = 0; i < encodeDatalength; i++) {\n // 根据 encodeData 数据推入数据\n const cellData = encodeData[i];\n this.patchData(d, cellData, cellPropertiesLayouts);\n }\n for (let i = d.length; i < totalLength; i++) {\n // 每行不足的部分用 -1 补足(数据纹理时 width * height 的矩形数据集合)\n d.push(-1);\n }\n // console.log('data', d)\n return { data: d, width: this.DATA_TEXTURE_WIDTH, height: rowCount };\n }\n\n // style datatexture mapping\n\n public getBlend(): IBlendOptions {\n const { blend = 'normal' } = this.layer.getLayerConfig();\n return BlendTypes[BlendType[blend]] as IBlendOptions;\n }\n public getDefaultStyle(): unknown {\n return {};\n }\n public getUninforms(): IModelUniform {\n throw new Error('Method not implemented.');\n }\n\n public getAnimateUniforms(): IModelUniform {\n return {};\n }\n\n public needUpdate(): boolean {\n return false;\n }\n public buildModels(): IModel[] {\n throw new Error('Method not implemented.');\n }\n public initModels(): IModel[] {\n throw new Error('Method not implemented.');\n }\n public clearModels() {\n return;\n }\n public getAttribute(): {\n attributes: {\n [attributeName: string]: IAttribute;\n };\n elements: IElements;\n } {\n throw new Error('Method not implemented.');\n }\n public render() {\n throw new Error('Method not implemented.');\n }\n protected registerBuiltinAttributes() {\n throw new Error('Method not implemented.');\n }\n protected animateOption2Array(option: IAnimateOption): number[] {\n return [\n option.enable ? 0 : 1.0,\n option.duration || 4.0,\n option.interval || 0.2,\n option.trailLength || 0.1,\n ];\n }\n protected startModelAnimate() {\n const { animateOption } = this.layer.getLayerConfig() as ILayerConfig;\n if (animateOption.enable) {\n this.layer.setAnimateStartTime();\n }\n }\n}\n"],"file":"BaseModel.js"}
1
+ {"version":3,"sources":["../../src/core/BaseModel.ts"],"names":["BlendType","gl","lazyInject","TYPES","rgb2arr","color","BlendTypes","BaseModel","IGlobalConfigService","layer","rendererService","getContainer","get","IRendererService","shaderModuleService","IShaderModuleService","styleAttributeService","IStyleAttributeService","mapService","IMapService","iconService","IIconService","fontService","IFontService","cameraService","ICameraService","layerService","ILayerService","registerBuiltinAttributes","startModelAnimate","createTexture2D","DATA_TEXTURE_WIDTH","rowCount","cellLength","cellProperties","cacheStyleProperties","thetaOffset","undefined","opacity","strokeOpacity","strokeWidth","stroke","offsets","stylePropertyesExist","hasThetaOffset","hasOpacity","hasStrokeOpacity","hasStrokeWidth","hasStroke","hasOffsets","dataTextureTest","getOESTextureFloat","dataTexture","data","Uint8Array","mag","NEAREST","min","width","height","options","isUpdate","clearLastCalRes","push","attr","count","isStaticColor","isOffsetStatic","strokeColor","Array","isArray","length","d","i","cellData","cellPropertiesLayouts","layout","value","patchMod","encodeData","encodeDatalength","Math","ceil","totalLength","patchData","getLayerConfig","blend","Error","option","enable","duration","interval","trailLength","animateOption","setAnimateStartTime"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA,SACEA,SADF,EAEEC,EAFF,EAwBEC,UAxBF,EA0BEC,KA1BF,QA2BO,eA3BP;AA4BA,SAASC,OAAT,QAAwB,gBAAxB;AACA,SAASC,KAAT,QAAsB,UAAtB;AAEA,SAASC,UAAT,QAA2B,gBAA3B;IA0BqBC,S,WAoClBL,UAAU,CAACC,KAAK,CAACK,oBAAP,C;AAsBX,qBAAYC,KAAZ,EAA2B;AAAA;;AAAA;;AAAA;;AAAA;;AAAA;;AAAA;;AAAA;;AAAA;;AAAA;;AAAA;;AAAA;;AAAA;;AAAA;;AAAA;;AAAA;;AAAA;;AAAA;;AAAA;;AAAA;;AAAA;;AAAA;;AAAA;;AACzB,SAAKA,KAAL,GAAaA,KAAb;AACA,SAAKC,eAAL,GAAuBD,KAAK,CACzBE,YADoB,GAEpBC,GAFoB,CAEET,KAAK,CAACU,gBAFR,CAAvB;AAGA,SAAKC,mBAAL,GAA2BL,KAAK,CAC7BE,YADwB,GAExBC,GAFwB,CAEET,KAAK,CAACY,oBAFR,CAA3B;AAIA,SAAKC,qBAAL,GAA6BP,KAAK,CAC/BE,YAD0B,GAE1BC,GAF0B,CAEET,KAAK,CAACc,sBAFR,CAA7B;AAGA,SAAKC,UAAL,GAAkBT,KAAK,CAACE,YAAN,GAAqBC,GAArB,CAAsCT,KAAK,CAACgB,WAA5C,CAAlB;AACA,SAAKC,WAAL,GAAmBX,KAAK,CACrBE,YADgB,GAEhBC,GAFgB,CAEET,KAAK,CAACkB,YAFR,CAAnB;AAGA,SAAKC,WAAL,GAAmBb,KAAK,CACrBE,YADgB,GAEhBC,GAFgB,CAEET,KAAK,CAACoB,YAFR,CAAnB;AAGA,SAAKC,aAAL,G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,aAAR,QAAQA,aAAR;;AACA,UAAIA,aAAa,CAACJ,MAAlB,EAA0B;AACxB,aAAKhF,KAAL,CAAWqF,mBAAX;AACD;AACF;;;;;;;;;;SAzekBvF,S","sourcesContent":["import {\n BlendType,\n gl,\n IAnimateOption,\n IAttribute,\n IBlendOptions,\n ICameraService,\n IElements,\n IEncodeFeature,\n IFontService,\n IGlobalConfigService,\n IIconService,\n ILayer,\n ILayerConfig,\n ILayerModel,\n ILayerService,\n IMapService,\n IModel,\n IModelUniform,\n IRendererService,\n IShaderModuleService,\n IStyleAttributeService,\n ITexture2D,\n ITexture2DInitializationOptions,\n lazyInject,\n Triangulation,\n TYPES,\n} from '@antv/l7-core';\nimport { rgb2arr } from '@antv/l7-utils';\nimport { color } from 'd3-color';\nimport { isEqual, isFunction, isNumber, isString } from 'lodash';\nimport { BlendTypes } from '../utils/blend';\n\nexport type styleSingle =\n | number\n | string\n | [string, (single: any) => number]\n | [string, [number, number]];\nexport type styleOffset =\n | string\n | [number, number]\n | [string, (single: any) => number];\nexport type styleColor =\n | string\n | [string, (single: any) => string]\n | [string, [string, string]];\nexport interface IDataTextureFrame {\n data: number[];\n width: number;\n height: number;\n}\n\nexport interface ICellProperty {\n attr: string;\n count: number;\n}\n\nexport default class BaseModel<ChildLayerStyleOptions = {}>\n implements ILayerModel {\n public triangulation: Triangulation;\n\n // style texture data mapping\n public createTexture2D: (\n options: ITexture2DInitializationOptions,\n ) => ITexture2D;\n\n protected layer: ILayer;\n protected dataTexture: ITexture2D; // 用于数据传递的数据纹理\n protected DATA_TEXTURE_WIDTH: number; // 默认有多少列(宽度)\n protected rowCount: number; // 计算得到的当前数据纹理有多少行(高度)\n protected cacheStyleProperties: {\n // 记录存储上一次样式字段的值\n thetaOffset: styleSingle | undefined;\n opacity: styleSingle | undefined;\n strokeOpacity: styleSingle | undefined;\n strokeWidth: styleSingle | undefined;\n stroke: styleColor | undefined;\n offsets: styleOffset | undefined;\n };\n protected cellLength: number; // 单个 cell 的长度\n protected cellProperties: ICellProperty[]; // 需要进行数据映射的属性集合\n protected cellTypeLayout: number[];\n protected stylePropertyesExist: {\n // 记录 style 属性是否存在的中间变量\n hasThetaOffset: number;\n hasOpacity: number;\n hasStrokeOpacity: number;\n hasStrokeWidth: number;\n hasStroke: number;\n hasOffsets: number;\n };\n protected dataTextureTest: boolean;\n\n @lazyInject(TYPES.IGlobalConfigService)\n protected readonly configService: IGlobalConfigService;\n\n // @lazyInject(TYPES.IIconService)\n // protected readonly iconService: IIconService;\n\n // @lazyInject(TYPES.IFontService)\n // protected readonly fontService: IFontService;\n\n // @lazyInject(TYPES.IShaderModuleService)\n protected shaderModuleService: IShaderModuleService;\n\n protected rendererService: IRendererService;\n protected iconService: IIconService;\n protected fontService: IFontService;\n protected styleAttributeService: IStyleAttributeService;\n protected mapService: IMapService;\n protected cameraService: ICameraService;\n protected layerService: ILayerService;\n\n // style texture data mapping\n\n constructor(layer: ILayer) {\n this.layer = layer;\n this.rendererService = layer\n .getContainer()\n .get<IRendererService>(TYPES.IRendererService);\n this.shaderModuleService = layer\n .getContainer()\n .get<IShaderModuleService>(TYPES.IShaderModuleService);\n\n this.styleAttributeService = layer\n .getContainer()\n .get<IStyleAttributeService>(TYPES.IStyleAttributeService);\n this.mapService = layer.getContainer().get<IMapService>(TYPES.IMapService);\n this.iconService = layer\n .getContainer()\n .get<IIconService>(TYPES.IIconService);\n this.fontService = layer\n .getContainer()\n .get<IFontService>(TYPES.IFontService);\n this.cameraService = layer\n .getContainer()\n .get<ICameraService>(TYPES.ICameraService);\n this.layerService = layer\n .getContainer()\n .get<ILayerService>(TYPES.ILayerService);\n\n // 注册 Attribute\n this.registerBuiltinAttributes();\n // 开启动画\n this.startModelAnimate();\n\n const { createTexture2D } = this.rendererService;\n this.createTexture2D = createTexture2D;\n this.DATA_TEXTURE_WIDTH = 1024; // 数据纹理固定宽度\n this.rowCount = 1;\n this.cellLength = 0;\n this.cellProperties = [];\n this.cacheStyleProperties = {\n thetaOffset: undefined,\n opacity: undefined,\n strokeOpacity: undefined,\n strokeWidth: undefined,\n stroke: undefined,\n offsets: undefined,\n };\n this.stylePropertyesExist = {\n hasThetaOffset: 0,\n hasOpacity: 0,\n hasStrokeOpacity: 0,\n hasStrokeWidth: 0,\n hasStroke: 0,\n hasOffsets: 0,\n };\n this.dataTextureTest = this.layerService.getOESTextureFloat();\n // 只有在不支持数据纹理的情况下进行赋值\n if (!this.dataTextureTest) {\n this.dataTexture = this.createTexture2D({\n // data: new Uint8ClampedArray(4),\n // 使用 Uint8ClampedArray 在 支付宝 环境中可能存在问题 UC 内核对格式有要求 L7 v2.7.18 版本发现\n // Uint8ClampedArray 和 Uint8Array 没有实质性的区别\n data: new Uint8Array(4),\n mag: gl.NEAREST,\n min: gl.NEAREST,\n width: 1,\n height: 1,\n });\n }\n }\n\n // style datatexture mapping\n\n /**\n * 清除上一次的计算结果 - 全量清除\n */\n public clearLastCalRes() {\n this.cellProperties = []; // 清空上一次计算的需要进行数据映射的属性集合\n this.cellLength = 0; // 清空上一次计算的 cell 的长度\n this.stylePropertyesExist = {\n // 全量清空上一次是否需要对 style 属性进行数据映射的判断\n hasThetaOffset: 0,\n hasOpacity: 0,\n hasStrokeOpacity: 0,\n hasStrokeWidth: 0,\n hasStroke: 0,\n hasOffsets: 0,\n };\n }\n\n public getCellTypeLayout() {\n if (this.dataTextureTest) {\n return [\n // 0\n this.rowCount, // 数据纹理有几行\n this.DATA_TEXTURE_WIDTH, // 数据纹理有几列\n 0.0,\n 0.0,\n // 1\n this.stylePropertyesExist.hasOpacity, // cell 中是否存在 opacity\n this.stylePropertyesExist.hasStrokeOpacity, // cell 中是否存在 strokeOpacity\n this.stylePropertyesExist.hasStrokeWidth, // cell 中是否存在 strokeWidth\n this.stylePropertyesExist.hasStroke, // cell 中是否存在 stroke\n // 2\n this.stylePropertyesExist.hasOffsets, // cell 中是否存在 offsets\n this.stylePropertyesExist.hasThetaOffset, // cell 中是否存在 thetaOffset\n 0.0,\n 0.0,\n // 3\n 0.0,\n 0.0,\n 0.0,\n 1.0,\n ];\n } else {\n return [\n 1.0, // 数据纹理有几行\n 1.0, // 数据纹理有几列\n 0.0,\n 0.0,\n 0.0, // cell 中是否存在 opacity\n 0.0, // cell 中是否存在 strokeOpacity\n 0.0, // cell 中是否存在 strokeWidth\n 0.0, // cell 中是否存在 stroke\n 0.0, // cell 中是否存在 offsets\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n -1.0,\n ];\n }\n }\n\n /**\n * 判断数据纹理是否需要重新计算 - 根据传入的值进行判断\n * @param options\n * @returns\n */\n public dataTextureNeedUpdate(options: {\n // TODO: thetaOffset 目前只有 lineLayer/arc 使用\n thetaOffset?: styleSingle;\n opacity?: styleSingle;\n strokeOpacity?: styleSingle;\n strokeWidth?: styleSingle;\n stroke?: styleColor;\n offsets?: styleOffset;\n textOffset?: styleOffset;\n }): boolean {\n let isUpdate = false;\n if (!isEqual(options.thetaOffset, this.cacheStyleProperties.thetaOffset)) {\n isUpdate = true;\n this.cacheStyleProperties.thetaOffset = options.thetaOffset;\n }\n if (!isEqual(options.opacity, this.cacheStyleProperties.opacity)) {\n isUpdate = true;\n this.cacheStyleProperties.opacity = options.opacity;\n }\n if (\n !isEqual(options.strokeOpacity, this.cacheStyleProperties.strokeOpacity)\n ) {\n isUpdate = true;\n this.cacheStyleProperties.strokeOpacity = options.strokeOpacity;\n }\n if (!isEqual(options.strokeWidth, this.cacheStyleProperties.strokeWidth)) {\n isUpdate = true;\n this.cacheStyleProperties.strokeWidth = options.strokeWidth;\n }\n if (!isEqual(options.stroke, this.cacheStyleProperties.stroke)) {\n isUpdate = true;\n this.cacheStyleProperties.stroke = options.stroke;\n }\n if (!isEqual(options.offsets, this.cacheStyleProperties.offsets)) {\n isUpdate = true;\n this.cacheStyleProperties.offsets = options.offsets;\n }\n if (this.dataTexture === undefined) {\n isUpdate = true;\n }\n return isUpdate;\n }\n /**\n * 判断当前的样式中哪些是需要进行数据映射的,哪些是常量,同时计算用于构建数据纹理的一些中间变量\n * @param options\n */\n public judgeStyleAttributes(options: {\n // TODO: 目前 thetaOffset 只有 lineLayer/arc 使用\n thetaOffset?: styleSingle;\n opacity?: styleSingle;\n strokeOpacity?: styleSingle;\n strokeWidth?: styleSingle;\n stroke?: styleColor;\n offsets?: styleOffset;\n }) {\n this.clearLastCalRes(); // 清除上一次的计算结果 - 全量清除\n\n if (options.opacity !== undefined && !isNumber(options.opacity)) {\n // 数据映射\n this.cellProperties.push({ attr: 'opacity', count: 1 });\n this.stylePropertyesExist.hasOpacity = 1;\n this.cellLength += 1;\n }\n\n if (\n options.strokeOpacity !== undefined &&\n !isNumber(options.strokeOpacity)\n ) {\n // 数据映射\n this.cellProperties.push({ attr: 'strokeOpacity', count: 1 });\n this.stylePropertyesExist.hasStrokeOpacity = 1;\n this.cellLength += 1;\n }\n\n if (options.strokeWidth !== undefined && !isNumber(options.strokeWidth)) {\n // 数据映射\n this.cellProperties.push({ attr: 'strokeWidth', count: 1 });\n this.stylePropertyesExist.hasStrokeWidth = 1;\n this.cellLength += 1;\n }\n\n if (options.stroke !== undefined && !this.isStaticColor(options.stroke)) {\n // 数据映射\n this.cellProperties.push({ attr: 'stroke', count: 4 });\n this.stylePropertyesExist.hasStroke = 1;\n this.cellLength += 4;\n }\n\n if (\n options.offsets !== undefined &&\n !this.isOffsetStatic(options.offsets)\n ) {\n // 数据映射\n this.cellProperties.push({ attr: 'offsets', count: 2 });\n this.stylePropertyesExist.hasOffsets = 1;\n this.cellLength += 2;\n }\n\n if (options.thetaOffset !== undefined && !isNumber(options.thetaOffset)) {\n // 数据映射\n this.cellProperties.push({ attr: 'thetaOffset', count: 1 });\n this.stylePropertyesExist.hasThetaOffset = 1;\n this.cellLength += 1;\n }\n // console.log('this.cellLength', this.cellLength)\n }\n\n /**\n * 判断变量 stroke 是否是常量值\n * @param stroke\n * @returns\n */\n public isStaticColor(stroke: styleColor): boolean {\n if (isString(stroke)) {\n if (color(stroke)) {\n return true;\n } else {\n return false;\n }\n }\n return false;\n }\n /**\n * 获取 stroke 颜色并做兼容处理\n * @param stroke\n * @returns\n */\n public getStrokeColor(stroke: styleColor) {\n if (this.isStaticColor(stroke)) {\n const strokeColor = rgb2arr(stroke as string);\n strokeColor[0] = strokeColor[0] ? strokeColor[0] : 0;\n strokeColor[1] = strokeColor[1] ? strokeColor[1] : 0;\n strokeColor[2] = strokeColor[2] ? strokeColor[2] : 0;\n strokeColor[3] = strokeColor[3] ? strokeColor[3] : 0;\n return strokeColor;\n } else {\n return [0, 0, 0, 0];\n }\n }\n\n /**\n * 判断 offsets 是否是常量\n * @param offsets\n * @returns\n */\n public isOffsetStatic(offsets: styleOffset) {\n if (\n Array.isArray(offsets) &&\n offsets.length === 2 &&\n isNumber(offsets[0]) &&\n isNumber(offsets[1])\n ) {\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * 补空位\n * @param d\n * @param count\n */\n public patchMod(d: number[], count: number) {\n for (let i = 0; i < count; i++) {\n d.push(-1);\n }\n }\n\n /**\n * 根据映射的数据字段往推入数据\n * @param d\n * @param cellData\n * @param cellPropertiesLayouts\n */\n public patchData(\n d: number[],\n cellData: IEncodeFeature,\n cellPropertiesLayouts: ICellProperty[],\n ) {\n for (const layout of cellPropertiesLayouts) {\n const { attr, count } = layout;\n\n const value = cellData[attr];\n if (value !== undefined) {\n // 数据中存在该属性\n if (attr === 'stroke') {\n d.push(...rgb2arr(value));\n } else if (attr === 'offsets') {\n if (this.isOffsetStatic(value)) {\n d.push(-value[0], value[1]);\n } else {\n d.push(0, 0);\n }\n } else {\n d.push(isNumber(value) ? value : 1.0);\n }\n } else {\n // 若不存在时则补位\n this.patchMod(d, count);\n }\n }\n }\n\n /**\n * 计算推入数据纹理的数据\n * @param cellLength\n * @param encodeData\n * @param cellPropertiesLayouts\n * @returns\n */\n public calDataFrame(\n cellLength: number,\n encodeData: IEncodeFeature[],\n cellPropertiesLayouts: ICellProperty[],\n ): IDataTextureFrame {\n const encodeDatalength = encodeData.length;\n const rowCount = Math.ceil(\n (encodeDatalength * cellLength) / this.DATA_TEXTURE_WIDTH,\n ); // 有多少行\n\n const totalLength = rowCount * this.DATA_TEXTURE_WIDTH;\n const d: number[] = [];\n for (let i = 0; i < encodeDatalength; i++) {\n // 根据 encodeData 数据推入数据\n const cellData = encodeData[i];\n this.patchData(d, cellData, cellPropertiesLayouts);\n }\n for (let i = d.length; i < totalLength; i++) {\n // 每行不足的部分用 -1 补足(数据纹理时 width * height 的矩形数据集合)\n d.push(-1);\n }\n // console.log('data', d)\n return { data: d, width: this.DATA_TEXTURE_WIDTH, height: rowCount };\n }\n\n // style datatexture mapping\n\n public getBlend(): IBlendOptions {\n const { blend = 'normal' } = this.layer.getLayerConfig();\n return BlendTypes[BlendType[blend]] as IBlendOptions;\n }\n public getDefaultStyle(): unknown {\n return {};\n }\n public getUninforms(): IModelUniform {\n throw new Error('Method not implemented.');\n }\n\n public getAnimateUniforms(): IModelUniform {\n return {};\n }\n\n public needUpdate(): boolean {\n return false;\n }\n public buildModels(): IModel[] {\n throw new Error('Method not implemented.');\n }\n public initModels(): IModel[] {\n throw new Error('Method not implemented.');\n }\n public clearModels() {\n return;\n }\n public getAttribute(): {\n attributes: {\n [attributeName: string]: IAttribute;\n };\n elements: IElements;\n } {\n throw new Error('Method not implemented.');\n }\n public render() {\n throw new Error('Method not implemented.');\n }\n protected registerBuiltinAttributes() {\n throw new Error('Method not implemented.');\n }\n protected animateOption2Array(option: IAnimateOption): number[] {\n return [\n option.enable ? 0 : 1.0,\n option.duration || 4.0,\n option.interval || 0.2,\n option.trailLength || 0.1,\n ];\n }\n protected startModelAnimate() {\n const { animateOption } = this.layer.getLayerConfig() as ILayerConfig;\n if (animateOption.enable) {\n this.layer.setAnimateStartTime();\n }\n }\n}\n"],"file":"BaseModel.js"}
@@ -17,7 +17,7 @@ import { AttributeType, gl } from '@antv/l7-core';
17
17
  import { getCullFace, getMask } from '@antv/l7-utils';
18
18
  import BaseModel from '../../core/BaseModel';
19
19
  import { GlobelPointFillTriangulation, PointFillTriangulation } from '../../core/triangulation';
20
- var waveFillFrag = "\nuniform float u_additive;\n\nvarying mat4 styleMappingMat; // \u4F20\u9012\u4ECE\u7247\u5143\u4E2D\u4F20\u9012\u7684\u6620\u5C04\u6570\u636E\n\nvarying vec4 v_data;\nvarying vec4 v_color;\nvarying float v_radius;\nuniform float u_time;\nuniform vec4 u_aimate: [ 0, 2., 1.0, 0.2 ];\n\n#pragma include \"sdf_2d\"\n#pragma include \"picking\"\n\n\nvoid main() {\n\n vec4 textrueStroke = vec4(\n styleMappingMat[1][0],\n styleMappingMat[1][1],\n styleMappingMat[1][2],\n styleMappingMat[1][3]\n );\n\n float opacity = styleMappingMat[0][0];\n float stroke_opacity = styleMappingMat[0][1];\n float strokeWidth = styleMappingMat[0][2];\n vec4 strokeColor = textrueStroke == vec4(0) ? v_color : textrueStroke;\n\n float r = v_radius / (v_radius + strokeWidth);\n\n // 'circle'\n float outer_df = sdCircle(v_data.xy, 1.0);\n float inner_df = sdCircle(v_data.xy, r);\n \n float d = length(v_data.xy);\n if(d > 0.5) {\n discard;\n }\n float PI = 3.14159;\n float intensity = clamp(cos(d * PI), 0.0, 1.0) * clamp(cos(2.0 * PI * (d * 2.0 * u_aimate.z - u_aimate.y * u_time)), 0.0, 1.0);\n\n // TODO: \u6839\u636E\u53E0\u52A0\u6C34\u6CE2\u6548\u679C\n gl_FragColor = vec4(v_color.xyz, v_color.a * opacity * intensity);\n\n if(u_additive > 0.0) {\n gl_FragColor *= gl_FragColor.a;\n } \n\n // TODO: \u4F18\u5316\u5728\u6C34\u6CE2\u7EB9\u60C5\u51B5\u4E0B\u7684\u62FE\u53D6\n if(d < 0.5) {\n gl_FragColor = filterColor(gl_FragColor);\n }\n}\n";
20
+ var waveFillFrag = "\nuniform float u_additive;\n\nvarying mat4 styleMappingMat; // \u4F20\u9012\u4ECE\u7247\u5143\u4E2D\u4F20\u9012\u7684\u6620\u5C04\u6570\u636E\n\nvarying vec4 v_data;\nvarying vec4 v_color;\nvarying float v_radius;\nuniform float u_time;\nuniform vec4 u_aimate: [ 0, 2., 1.0, 0.2 ];\n\n#pragma include \"sdf_2d\"\n#pragma include \"picking\"\n\n\nvoid main() {\n\n vec4 textrueStroke = vec4(\n styleMappingMat[1][0],\n styleMappingMat[1][1],\n styleMappingMat[1][2],\n styleMappingMat[1][3]\n );\n\n float opacity = styleMappingMat[0][0];\n\n lowp float antialiasblur = v_data.z;\n float r = v_radius / (v_radius);\n\n float outer_df;\n float inner_df;\n // 'circle', 'triangle', 'square', 'pentagon', 'hexagon', 'octogon', 'hexagram', 'rhombus', 'vesica'\n \n outer_df = sdCircle(v_data.xy, 1.0);\n inner_df = sdCircle(v_data.xy, r);\n\n\n if(u_globel > 0.0) {\n // TODO: \u5730\u7403\u6A21\u5F0F\u4E0B\u907F\u514D\u591A\u4F59\u7247\u5143\u7ED8\u5236\uFF0C\u540C\u65F6\u4E5F\u80FD\u907F\u514D\u6709\u7528\u7247\u5143\u5728\u900F\u660E\u4E14\u91CD\u53E0\u7684\u60C5\u51B5\u4E0B\u65E0\u6CD5\u5199\u5165\n // \u4ED8\u51FA\u7684\u4EE3\u4EF7\u662F\u8FB9\u7F18\u4F1A\u6709\u4E00\u4E9B\u952F\u9F7F\n if(outer_df > antialiasblur + 0.018) discard;\n }\n float opacity_t = smoothstep(0.0, antialiasblur, outer_df);\n\n float color_t = smoothstep(\n antialiasblur,\n 0.0,\n inner_df\n );\n float PI = 3.14159;\n float N_RINGS = 3.0;\n float FREQ = 1.0;\n\n gl_FragColor = vec4(v_color.rgb, v_color.a * opacity);\n\n float d = length(v_data.xy);\n if(d > 0.5) {\n discard;\n }\n float intensity = clamp(cos(d * PI), 0.0, 1.0) * clamp(cos(2.0 * PI * (d * 2.0 * u_aimate.z - u_aimate.y * u_time)), 0.0, 1.0);\n \n // TODO: \u6839\u636E\u53E0\u52A0\u6A21\u5F0F\u9009\u62E9\u6548\u679C\n if(u_additive > 0.0) {\n gl_FragColor *= intensity;\n gl_FragColor = filterColorAnimate(gl_FragColor);\n } else {\n gl_FragColor = vec4(gl_FragColor.xyz, gl_FragColor.a * intensity);\n gl_FragColor = filterColor(gl_FragColor);\n }\n}\n";
21
21
  var pointFillFrag = "\nuniform float u_globel;\nuniform float u_additive;\n\nvarying mat4 styleMappingMat; // \u4F20\u9012\u4ECE\u7247\u5143\u4E2D\u4F20\u9012\u7684\u6620\u5C04\u6570\u636E\n\nvarying vec4 v_data;\nvarying vec4 v_color;\nvarying float v_radius;\n\n#pragma include \"sdf_2d\"\n#pragma include \"picking\"\n\n\nvoid main() {\n int shape = int(floor(v_data.w + 0.5));\n\n vec4 textrueStroke = vec4(\n styleMappingMat[1][0],\n styleMappingMat[1][1],\n styleMappingMat[1][2],\n styleMappingMat[1][3]\n );\n\n float opacity = styleMappingMat[0][0];\n float stroke_opacity = styleMappingMat[0][1];\n float strokeWidth = styleMappingMat[0][2];\n vec4 strokeColor = textrueStroke == vec4(0) ? v_color : textrueStroke;\n\n lowp float antialiasblur = v_data.z;\n float r = v_radius / (v_radius + strokeWidth);\n\n float outer_df;\n float inner_df;\n // 'circle', 'triangle', 'square', 'pentagon', 'hexagon', 'octogon', 'hexagram', 'rhombus', 'vesica'\n if (shape == 0) {\n outer_df = sdCircle(v_data.xy, 1.0);\n inner_df = sdCircle(v_data.xy, r);\n } else if (shape == 1) {\n outer_df = sdEquilateralTriangle(1.1 * v_data.xy);\n inner_df = sdEquilateralTriangle(1.1 / r * v_data.xy);\n } else if (shape == 2) {\n outer_df = sdBox(v_data.xy, vec2(1.));\n inner_df = sdBox(v_data.xy, vec2(r));\n } else if (shape == 3) {\n outer_df = sdPentagon(v_data.xy, 0.8);\n inner_df = sdPentagon(v_data.xy, r * 0.8);\n } else if (shape == 4) {\n outer_df = sdHexagon(v_data.xy, 0.8);\n inner_df = sdHexagon(v_data.xy, r * 0.8);\n } else if (shape == 5) {\n outer_df = sdOctogon(v_data.xy, 1.0);\n inner_df = sdOctogon(v_data.xy, r);\n } else if (shape == 6) {\n outer_df = sdHexagram(v_data.xy, 0.52);\n inner_df = sdHexagram(v_data.xy, r * 0.52);\n } else if (shape == 7) {\n outer_df = sdRhombus(v_data.xy, vec2(1.0));\n inner_df = sdRhombus(v_data.xy, vec2(r));\n } else if (shape == 8) {\n outer_df = sdVesica(v_data.xy, 1.1, 0.8);\n inner_df = sdVesica(v_data.xy, r * 1.1, r * 0.8);\n }\n\n if(u_globel > 0.0) {\n // TODO: \u5730\u7403\u6A21\u5F0F\u4E0B\u907F\u514D\u591A\u4F59\u7247\u5143\u7ED8\u5236\uFF0C\u540C\u65F6\u4E5F\u80FD\u907F\u514D\u6709\u7528\u7247\u5143\u5728\u900F\u660E\u4E14\u91CD\u53E0\u7684\u60C5\u51B5\u4E0B\u65E0\u6CD5\u5199\u5165\n // \u4ED8\u51FA\u7684\u4EE3\u4EF7\u662F\u8FB9\u7F18\u4F1A\u6709\u4E00\u4E9B\u952F\u9F7F\n if(outer_df > antialiasblur + 0.018) discard;\n }\n float opacity_t = smoothstep(0.0, antialiasblur, outer_df);\n\n float color_t = strokeWidth < 0.01 ? 0.0 : smoothstep(\n antialiasblur,\n 0.0,\n inner_df\n );\n\n if(strokeWidth < 0.01) {\n gl_FragColor = vec4(v_color.rgb, v_color.a * opacity);\n } else {\n gl_FragColor = mix(vec4(v_color.rgb, v_color.a * opacity), strokeColor * stroke_opacity, color_t);\n }\n\n if(u_additive > 0.0) {\n gl_FragColor *= opacity_t;\n } else {\n gl_FragColor.a *= opacity_t;\n }\n\n if(gl_FragColor.a > 0.0) {\n gl_FragColor = filterColor(gl_FragColor);\n }\n}\n";
22
22
  var pointFillVert = "attribute vec4 a_Color;\nattribute vec3 a_Position;\nattribute vec3 a_Extrude;\nattribute float a_Size;\nattribute float a_Shape;\n\nvarying mat4 styleMappingMat; // \u7528\u4E8E\u5C06\u5728\u9876\u70B9\u7740\u8272\u5668\u4E2D\u8BA1\u7B97\u597D\u7684\u6837\u5F0F\u503C\u4F20\u9012\u7ED9\u7247\u5143\n\nuniform float u_globel;\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\nuniform float u_isMeter;\n\nvarying vec4 v_data;\nvarying vec4 v_color;\nvarying float v_radius;\n\nuniform float u_opacity : 1;\nuniform float u_stroke_opacity : 1;\nuniform float u_stroke_width : 2;\nuniform vec4 u_stroke_color : [0.0, 0.0, 0.0, 0.0];\nuniform vec2 u_offsets;\n\nuniform float u_blur : 0.0;\n\n#pragma include \"styleMapping\"\n#pragma include \"styleMappingCalOpacity\"\n#pragma include \"styleMappingCalStrokeOpacity\"\n#pragma include \"styleMappingCalStrokeWidth\"\n\n#pragma include \"projection\"\n#pragma include \"picking\"\n\n\nvoid main() {\n vec3 extrude = a_Extrude;\n float shape_type = a_Shape;\n float newSize = setPickingSize(a_Size);\n\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n styleMappingMat = mat4(\n 0.0, 0.0, 0.0, 0.0, // opacity - strokeOpacity - strokeWidth - empty\n 0.0, 0.0, 0.0, 0.0, // strokeR - strokeG - strokeB - strokeA\n 0.0, 0.0, 0.0, 0.0, // offsets[0] - offsets[1]\n 0.0, 0.0, 0.0, 0.0\n );\n\n float rowCount = u_cellTypeLayout[0][0]; // \u5F53\u524D\u7684\u6570\u636E\u7EB9\u7406\u6709\u51E0\u884C\n float columnCount = u_cellTypeLayout[0][1]; // \u5F53\u770B\u5230\u6570\u636E\u7EB9\u7406\u6709\u51E0\u5217\n float columnWidth = 1.0/columnCount; // \u5217\u5BBD\n float rowHeight = 1.0/rowCount; // \u884C\u9AD8\n float cellCount = calCellCount(); // opacity - strokeOpacity - strokeWidth - stroke - offsets\n float id = a_vertexId; // \u7B2Cn\u4E2A\u9876\u70B9\n float cellCurrentRow = floor(id * cellCount / columnCount) + 1.0; // \u8D77\u59CB\u70B9\u5728\u7B2C\u51E0\u884C\n float cellCurrentColumn = mod(id * cellCount, columnCount) + 1.0; // \u8D77\u59CB\u70B9\u5728\u7B2C\u51E0\u5217\n \n // cell \u56FA\u5B9A\u987A\u5E8F opacity -> strokeOpacity -> strokeWidth -> stroke ... \n // \u6309\u987A\u5E8F\u4ECE cell \u4E2D\u53D6\u503C\u3001\u82E5\u6CA1\u6709\u5219\u81EA\u52A8\u5F80\u4E0B\u53D6\u503C\n float textureOffset = 0.0; // \u5728 cell \u4E2D\u53D6\u503C\u7684\u504F\u79FB\u91CF\n\n vec2 opacityAndOffset = calOpacityAndOffset(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset, columnWidth, rowHeight);\n styleMappingMat[0][0] = opacityAndOffset.r;\n textureOffset = opacityAndOffset.g;\n\n vec2 strokeOpacityAndOffset = calStrokeOpacityAndOffset(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset, columnWidth, rowHeight);\n styleMappingMat[0][1] = strokeOpacityAndOffset.r;\n textureOffset = strokeOpacityAndOffset.g;\n\n vec2 strokeWidthAndOffset = calStrokeWidthAndOffset(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset, columnWidth, rowHeight);\n styleMappingMat[0][2] = strokeWidthAndOffset.r;\n textureOffset = strokeWidthAndOffset.g;\n\n vec4 textrueStroke = vec4(-1.0, -1.0, -1.0, -1.0);\n if(hasStroke()) {\n vec2 valueRPos = nextPos(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset);\n styleMappingMat[1][0] = pos2value(valueRPos, columnWidth, rowHeight); // R\n textureOffset += 1.0;\n\n vec2 valueGPos = nextPos(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset);\n styleMappingMat[1][1] = pos2value(valueGPos, columnWidth, rowHeight); // G\n textureOffset += 1.0;\n\n vec2 valueBPos = nextPos(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset);\n styleMappingMat[1][2] = pos2value(valueBPos, columnWidth, rowHeight); // B\n textureOffset += 1.0;\n\n vec2 valueAPos = nextPos(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset);\n styleMappingMat[1][3] = pos2value(valueAPos, columnWidth, rowHeight); // A\n textureOffset += 1.0;\n } else {\n if(u_stroke_color == vec4(0.0)) {\n styleMappingMat[1][0] = v_color.r;\n styleMappingMat[1][1] = v_color.g;\n styleMappingMat[1][2] = v_color.b;\n styleMappingMat[1][3] = v_color.a;\n } else {\n styleMappingMat[1][0] = u_stroke_color.r;\n styleMappingMat[1][1] = u_stroke_color.g;\n styleMappingMat[1][2] = u_stroke_color.b;\n styleMappingMat[1][3] = u_stroke_color.a;\n }\n }\n\n vec2 textrueOffsets = vec2(0.0, 0.0);\n if(hasOffsets()) {\n vec2 valueXPos = nextPos(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset);\n textrueOffsets.r = pos2value(valueXPos, columnWidth, rowHeight); // x\n textureOffset += 1.0;\n\n vec2 valueYPos = nextPos(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset);\n textrueOffsets.g = pos2value(valueYPos, columnWidth, rowHeight); // x\n textureOffset += 1.0;\n } else {\n textrueOffsets = u_offsets;\n }\n\n // cal style mapping\n\n // unpack color(vec2)\n v_color = a_Color;\n\n // radius(16-bit)\n v_radius = newSize;\n\n // TODO: billboard\n // anti-alias\n // float antialiased_blur = -max(u_blur, antialiasblur);\n float antialiasblur = -max(2.0 / u_DevicePixelRatio / a_Size, u_blur);\n\n vec2 offset = (extrude.xy * (newSize + u_stroke_width) + textrueOffsets);\n vec3 aPosition = a_Position;\n if(u_isMeter < 1.0) {\n // \u4E0D\u4EE5\u7C73\u4E3A\u5B9E\u9645\u5355\u4F4D\n offset = project_pixel(offset);\n } else {\n // \u4EE5\u7C73\u4E3A\u5B9E\u9645\u5355\u4F4D\n antialiasblur *= pow(19.0 - u_Zoom, 2.0);\n antialiasblur = max(antialiasblur, -0.01);\n // offset *= 0.5;\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {\n aPosition.xy += offset;\n offset.x = 0.0;\n offset.y = 0.0;\n }\n }\n\n // TODP: /abs(extrude.x) \u662F\u4E3A\u4E86\u517C\u5BB9\u5730\u7403\u6A21\u5F0F\n v_data = vec4(extrude.x/abs(extrude.x), extrude.y/abs(extrude.y), antialiasblur,shape_type);\n\n\n // vec4 project_pos = project_position(vec4(a_Position.xy, 0.0, 1.0));\n vec4 project_pos = project_position(vec4(aPosition.xy, 0.0, 1.0));\n // gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, project_pixel(setPickingOrder(0.0)), 1.0));\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n gl_Position = u_Mvp * vec4(project_pos.xy + offset, 0.0, 1.0);\n } else {\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, project_pixel(setPickingOrder(0.0)), 1.0));\n }\n\n if(u_globel > 0.0) {\n gl_Position = u_ViewProjectionMatrix * vec4(a_Position + extrude * newSize * 0.1, 1.0);\n }\n \n // gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, 0.0, 1.0));\n\n setPickingColor(a_PickingColor);\n}\n";
23
23
  import { Version } from '@antv/l7-maps';
@@ -17,7 +17,7 @@ import { getCullFace, getMask } from '@antv/l7-utils';
17
17
  import BaseModel from '../../core/BaseModel';
18
18
  import { PointFillTriangulation } from '../../core/triangulation';
19
19
  var pointFillFrag = "uniform sampler2D u_texture;\nuniform vec2 u_textSize;\n\nuniform float u_additive;\n\nvarying mat4 styleMappingMat; // \u4F20\u9012\u4ECE\u7247\u5143\u4E2D\u4F20\u9012\u7684\u6620\u5C04\u6570\u636E\n\nvarying float v_radius;\n\n#pragma include \"sdf_2d\"\n#pragma include \"picking\"\nvarying vec2 v_uv; // \u672C\u8EAB\u7684 uv \u5750\u6807\nvarying vec2 v_Iconuv;\n\nvoid main() {\n\n float opacity = styleMappingMat[0][0];\n\n vec2 pos = v_Iconuv / u_textSize + v_uv / u_textSize * 64.;\n gl_FragColor = texture2D(u_texture, pos);\n gl_FragColor.a *= opacity;\n\n gl_FragColor = filterColor(gl_FragColor);\n}\n";
20
- var pointFillVert = "attribute vec4 a_Color;\nattribute vec3 a_Position;\nattribute vec3 a_Extrude;\nattribute float a_Size;\nattribute vec2 a_Uv;\n\nvarying mat4 styleMappingMat; // \u7528\u4E8E\u5C06\u5728\u9876\u70B9\u7740\u8272\u5668\u4E2D\u8BA1\u7B97\u597D\u7684\u6837\u5F0F\u503C\u4F20\u9012\u7ED9\u7247\u5143\n\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\nuniform mat2 u_RotateMatrix;\nuniform float u_isMeter;\n\nvarying float v_radius;\nvarying vec2 v_uv; // \u672C\u8EAB\u7684 uv \u5750\u6807\nvarying vec2 v_Iconuv; // icon \u8D34\u56FE\u7684 uv \u5750\u6807\n\nuniform float u_opacity : 1;\nuniform vec2 u_offsets;\n\n#pragma include \"styleMapping\"\n#pragma include \"styleMappingCalOpacity\"\n\n#pragma include \"projection\"\n#pragma include \"picking\"\n\n\nvoid main() {\n vec3 extrude = a_Extrude;\n\n v_uv = (a_Extrude.xy + 1.0)/2.0;\n v_uv.y = 1.0 - v_uv.y;\n v_Iconuv = a_Uv;\n\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n styleMappingMat = mat4(\n 0.0, 0.0, 0.0, 0.0, // opacity - empty - empty - empty\n 0.0, 0.0, 0.0, 0.0, // empty - empty - empty - empty\n 0.0, 0.0, 0.0, 0.0, // offsets[0] - offsets[1]\n 0.0, 0.0, 0.0, 0.0\n );\n\n float rowCount = u_cellTypeLayout[0][0]; // \u5F53\u524D\u7684\u6570\u636E\u7EB9\u7406\u6709\u51E0\u884C\n float columnCount = u_cellTypeLayout[0][1]; // \u5F53\u770B\u5230\u6570\u636E\u7EB9\u7406\u6709\u51E0\u5217\n float columnWidth = 1.0/columnCount; // \u5217\u5BBD\n float rowHeight = 1.0/rowCount; // \u884C\u9AD8\n float cellCount = calCellCount(); // opacity - strokeOpacity - strokeWidth - stroke - offsets\n float id = a_vertexId; // \u7B2Cn\u4E2A\u9876\u70B9\n float cellCurrentRow = floor(id * cellCount / columnCount) + 1.0; // \u8D77\u59CB\u70B9\u5728\u7B2C\u51E0\u884C\n float cellCurrentColumn = mod(id * cellCount, columnCount) + 1.0; // \u8D77\u59CB\u70B9\u5728\u7B2C\u51E0\u5217\n \n // cell \u56FA\u5B9A\u987A\u5E8F opacity -> strokeOpacity -> strokeWidth -> stroke ... \n // \u6309\u987A\u5E8F\u4ECE cell \u4E2D\u53D6\u503C\u3001\u82E5\u6CA1\u6709\u5219\u81EA\u52A8\u5F80\u4E0B\u53D6\u503C\n float textureOffset = 0.0; // \u5728 cell \u4E2D\u53D6\u503C\u7684\u504F\u79FB\u91CF\n\n vec2 opacityAndOffset = calOpacityAndOffset(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset, columnWidth, rowHeight);\n styleMappingMat[0][0] = opacityAndOffset.r;\n textureOffset = opacityAndOffset.g;\n\n vec2 textrueOffsets = vec2(0.0, 0.0);\n if(hasOffsets()) {\n vec2 valueXPos = nextPos(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset);\n textrueOffsets.r = pos2value(valueXPos, columnWidth, rowHeight); // x\n textureOffset += 1.0;\n\n vec2 valueYPos = nextPos(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset);\n textrueOffsets.g = pos2value(valueYPos, columnWidth, rowHeight); // x\n textureOffset += 1.0;\n } else {\n textrueOffsets = u_offsets;\n }\n\n // cal style mapping\n\n // radius(16-bit)\n v_radius = a_Size;\n\n // TODO: billboard\n // anti-alias\n \n\n vec2 offset = (u_RotateMatrix * extrude.xy * (a_Size) + textrueOffsets);\n vec3 aPosition = a_Position;\n if(u_isMeter < 1.0) {\n // \u4E0D\u4EE5\u7C73\u4E3A\u5B9E\u9645\u5355\u4F4D\n offset = project_pixel(offset);\n } else {\n // \u4EE5\u7C73\u4E3A\u5B9E\u9645\u5355\u4F4D\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {\n aPosition.xy += offset;\n offset.x = 0.0;\n offset.y = 0.0;\n }\n }\n\n\n // vec4 project_pos = project_position(vec4(a_Position.xy, 0.0, 1.0));\n vec4 project_pos = project_position(vec4(aPosition.xy, 0.0, 1.0));\n // gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, project_pixel(setPickingOrder(0.0)), 1.0));\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n gl_Position = u_Mvp * vec4(project_pos.xy + offset, 0.0, 1.0);\n } else {\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, project_pixel(setPickingOrder(0.0)), 1.0));\n }\n \n // gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, 0.0, 1.0));\n\n setPickingColor(a_PickingColor);\n}\n";
20
+ var pointFillVert = "attribute vec4 a_Color;\nattribute vec3 a_Position;\nattribute vec3 a_Extrude;\nattribute float a_Size;\nattribute vec2 a_Uv;\nattribute float a_Rotate;\n\nvarying mat4 styleMappingMat; // \u7528\u4E8E\u5C06\u5728\u9876\u70B9\u7740\u8272\u5668\u4E2D\u8BA1\u7B97\u597D\u7684\u6837\u5F0F\u503C\u4F20\u9012\u7ED9\u7247\u5143\n\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\nuniform mat2 u_RotateMatrix;\nuniform float u_isMeter;\n\nvarying float v_radius;\nvarying vec2 v_uv; // \u672C\u8EAB\u7684 uv \u5750\u6807\nvarying vec2 v_Iconuv; // icon \u8D34\u56FE\u7684 uv \u5750\u6807\n\nuniform float u_opacity : 1;\nuniform vec2 u_offsets;\n\n#pragma include \"styleMapping\"\n#pragma include \"styleMappingCalOpacity\"\n\n#pragma include \"projection\"\n#pragma include \"picking\"\n\n\nvoid main() {\n vec3 extrude = a_Extrude;\n\n v_uv = (a_Extrude.xy + 1.0)/2.0;\n v_uv.y = 1.0 - v_uv.y;\n v_Iconuv = a_Uv;\n\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n styleMappingMat = mat4(\n 0.0, 0.0, 0.0, 0.0, // opacity - empty - empty - empty\n 0.0, 0.0, 0.0, 0.0, // empty - empty - empty - empty\n 0.0, 0.0, 0.0, 0.0, // offsets[0] - offsets[1]\n 0.0, 0.0, 0.0, 0.0\n );\n\n float rowCount = u_cellTypeLayout[0][0]; // \u5F53\u524D\u7684\u6570\u636E\u7EB9\u7406\u6709\u51E0\u884C\n float columnCount = u_cellTypeLayout[0][1]; // \u5F53\u770B\u5230\u6570\u636E\u7EB9\u7406\u6709\u51E0\u5217\n float columnWidth = 1.0/columnCount; // \u5217\u5BBD\n float rowHeight = 1.0/rowCount; // \u884C\u9AD8\n float cellCount = calCellCount(); // opacity - strokeOpacity - strokeWidth - stroke - offsets\n float id = a_vertexId; // \u7B2Cn\u4E2A\u9876\u70B9\n float cellCurrentRow = floor(id * cellCount / columnCount) + 1.0; // \u8D77\u59CB\u70B9\u5728\u7B2C\u51E0\u884C\n float cellCurrentColumn = mod(id * cellCount, columnCount) + 1.0; // \u8D77\u59CB\u70B9\u5728\u7B2C\u51E0\u5217\n \n // cell \u56FA\u5B9A\u987A\u5E8F opacity -> strokeOpacity -> strokeWidth -> stroke ... \n // \u6309\u987A\u5E8F\u4ECE cell \u4E2D\u53D6\u503C\u3001\u82E5\u6CA1\u6709\u5219\u81EA\u52A8\u5F80\u4E0B\u53D6\u503C\n float textureOffset = 0.0; // \u5728 cell \u4E2D\u53D6\u503C\u7684\u504F\u79FB\u91CF\n\n vec2 opacityAndOffset = calOpacityAndOffset(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset, columnWidth, rowHeight);\n styleMappingMat[0][0] = opacityAndOffset.r;\n textureOffset = opacityAndOffset.g;\n\n vec2 textrueOffsets = vec2(0.0, 0.0);\n if(hasOffsets()) {\n vec2 valueXPos = nextPos(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset);\n textrueOffsets.r = pos2value(valueXPos, columnWidth, rowHeight); // x\n textureOffset += 1.0;\n\n vec2 valueYPos = nextPos(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset);\n textrueOffsets.g = pos2value(valueYPos, columnWidth, rowHeight); // x\n textureOffset += 1.0;\n } else {\n textrueOffsets = u_offsets;\n }\n\n // cal style mapping\n\n // radius(16-bit)\n v_radius = a_Size;\n\n // TODO: billboard\n // anti-alias\n \n\n highp float angle_sin = sin(a_Rotate);\n highp float angle_cos = cos(a_Rotate);\n mat2 rotation_matrix = mat2(angle_cos, -1.0 * angle_sin, angle_sin, angle_cos);\n\n // vec2 offset = (u_RotateMatrix * extrude.xy * (a_Size) + textrueOffsets);\n vec2 offset = (rotation_matrix * u_RotateMatrix * extrude.xy * (a_Size) + textrueOffsets);\n vec3 aPosition = a_Position;\n if(u_isMeter < 1.0) {\n // \u4E0D\u4EE5\u7C73\u4E3A\u5B9E\u9645\u5355\u4F4D\n offset = project_pixel(offset);\n } else {\n // \u4EE5\u7C73\u4E3A\u5B9E\u9645\u5355\u4F4D\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {\n aPosition.xy += offset;\n offset.x = 0.0;\n offset.y = 0.0;\n }\n }\n\n\n // vec4 project_pos = project_position(vec4(a_Position.xy, 0.0, 1.0));\n vec4 project_pos = project_position(vec4(aPosition.xy, 0.0, 1.0));\n // gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, project_pixel(setPickingOrder(0.0)), 1.0));\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n gl_Position = u_Mvp * vec4(project_pos.xy + offset, 0.0, 1.0);\n } else {\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, project_pixel(setPickingOrder(0.0)), 1.0));\n }\n \n // gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, 0.0, 1.0));\n\n setPickingColor(a_PickingColor);\n}\n";
21
21
  import { Version } from '@antv/l7-maps';
22
22
 
23
23
  var FillImageModel = function (_BaseModel) {
@@ -101,7 +101,7 @@ var FillImageModel = function (_BaseModel) {
101
101
  rotateFlag = -1;
102
102
  }
103
103
 
104
- this.radian = rotation ? rotateFlag * Math.PI * rotation / 180 : rotateFlag * Math.PI * (this.mapService.getRotation() % 360) / 180;
104
+ this.radian = rotation !== undefined ? rotateFlag * Math.PI * rotation / 180 : rotateFlag * Math.PI * (this.mapService.getRotation() % 360) / 180;
105
105
 
106
106
  if (this.dataTextureTest && this.dataTextureNeedUpdate({
107
107
  opacity: opacity,
@@ -264,6 +264,24 @@ var FillImageModel = function (_BaseModel) {
264
264
  value: function registerBuiltinAttributes() {
265
265
  var _this2 = this;
266
266
 
267
+ this.styleAttributeService.registerStyleAttribute({
268
+ name: 'rotate',
269
+ type: AttributeType.Attribute,
270
+ descriptor: {
271
+ name: 'a_Rotate',
272
+ buffer: {
273
+ usage: gl.DYNAMIC_DRAW,
274
+ data: [],
275
+ type: gl.FLOAT
276
+ },
277
+ size: 1,
278
+ update: function update(feature, featureIdx, vertex, attributeIdx) {
279
+ var _feature$rotate = feature.rotate,
280
+ rotate = _feature$rotate === void 0 ? 0 : _feature$rotate;
281
+ return Array.isArray(rotate) ? [rotate[0]] : [rotate];
282
+ }
283
+ }
284
+ });
267
285
  this.styleAttributeService.registerStyleAttribute({
268
286
  name: 'uv',
269
287
  type: AttributeType.Attribute,