@antv/l7-layers 2.6.7 → 2.6.8
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.
- package/es/core/BaseLayer.js +1 -0
- package/es/core/BaseLayer.js.map +1 -1
- package/es/core/BaseModel.d.ts +4 -0
- package/es/core/BaseModel.js +19 -2
- package/es/core/BaseModel.js.map +1 -1
- package/es/index.d.ts +2 -1
- package/es/index.js +2 -1
- package/es/index.js.map +1 -1
- package/es/line/models/arc.js +6 -4
- package/es/line/models/arc.js.map +1 -1
- package/es/utils/dataMappingStyle.d.ts +1 -0
- package/es/utils/dataMappingStyle.js +4 -0
- package/es/utils/dataMappingStyle.js.map +1 -1
- package/es/wind/index.d.ts +36 -0
- package/es/wind/index.js +91 -0
- package/es/wind/index.js.map +1 -0
- package/es/wind/models/index.d.ts +5 -0
- package/es/wind/models/index.js +6 -0
- package/es/wind/models/index.js.map +1 -0
- package/es/wind/models/utils.d.ts +19 -0
- package/es/wind/models/utils.js +201 -0
- package/es/wind/models/utils.js.map +1 -0
- package/es/wind/models/wind.d.ts +31 -0
- package/es/wind/models/wind.js +298 -0
- package/es/wind/models/wind.js.map +1 -0
- package/es/wind/models/windRender.d.ts +104 -0
- package/es/wind/models/windRender.js +346 -0
- package/es/wind/models/windRender.js.map +1 -0
- package/es/wind/models/windShader.d.ts +12 -0
- package/es/wind/models/windShader.js +7 -0
- package/es/wind/models/windShader.js.map +1 -0
- package/lib/core/BaseLayer.js +1 -0
- package/lib/core/BaseLayer.js.map +1 -1
- package/lib/core/BaseModel.js +19 -2
- package/lib/core/BaseModel.js.map +1 -1
- package/lib/index.js +8 -0
- package/lib/index.js.map +1 -1
- package/lib/line/models/arc.js +6 -4
- package/lib/line/models/arc.js.map +1 -1
- package/lib/utils/dataMappingStyle.js +4 -0
- package/lib/utils/dataMappingStyle.js.map +1 -1
- package/lib/wind/index.js +104 -0
- package/lib/wind/index.js.map +1 -0
- package/lib/wind/models/index.js +17 -0
- package/lib/wind/models/index.js.map +1 -0
- package/lib/wind/models/utils.js +228 -0
- package/lib/wind/models/utils.js.map +1 -0
- package/lib/wind/models/wind.js +310 -0
- package/lib/wind/models/wind.js.map +1 -0
- package/lib/wind/models/windRender.js +340 -0
- package/lib/wind/models/windRender.js.map +1 -0
- package/lib/wind/models/windShader.js +19 -0
- package/lib/wind/models/windShader.js.map +1 -0
- package/package.json +5 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/core/BaseLayer.ts"],"names":["layerIdCounter","BaseLayer","TYPES","IGlobalConfigService","IShaderModuleService","config","dataSourceNeedUpdate","dataMappingNeedUpdate","filterNeedUpdate","featureScaleNeedUpdate","StyleAttrNeedUpdate","init","SyncBailHook","afterInit","beforeRender","beforeRenderData","SyncWaterfallHook","afterRender","SyncHook","beforePickingEncode","afterPickingEncode","beforeHighlight","afterHighlight","beforeSelect","afterSelect","beforeDestroy","afterDestroy","enable","dataState","getLayerConfig","autoFit","fitBoundsOptions","fitBounds","emit","reRender","name","id","zIndex","rawConfig","configService","configToUpdate","inited","needUpdateConfig","sceneId","container","get","SceneID","setLayerConfig","sceneContainer","plugin","plugins","push","enableMultiPassRenderer","iconService","IIconService","fontService","IFontService","rendererService","IRendererService","layerService","ILayerService","interactionService","IInteractionService","pickingService","IPickingService","mapService","IMapService","cameraService","ICameraService","coordinateService","ICoordinateSystemService","postProcessingPassFactory","IFactoryPostProcessingPass","normalPassFactory","IFactoryNormalPass","styleAttributeService","IStyleAttributeService","multiPassRenderer","IMultiPassRenderer","setLayer","pendingStyleAttributes","forEach","attributeName","attributeField","attributeValues","updateOptions","updateStyleAttribute","scale","field","splitValuesAndCallbackInAttribute","getAll","ILayerPlugin","apply","hooks","call","target","type","updateLayerConfig","getDefaultConfig","animateOption","startAnimate","aniamateStatus","values","lastShape","getLayerStyleAttribute","currentShape","options","rawAnimate","data","setSource","sourceOption","layerSource","setData","on","passes","rest","pass","postProcessingPass","getPostProcessor","getPostProcessingPassByName","styleNeedUpdate","cfg","scaleOptions","rendering","renderLayers","getEncodedData","length","renderModels","activeOption","enableHighlight","color","highlightColor","x","y","pick","pickedFeatureID","then","setTimeout","option","enableSelect","selectColor","blend","layerModelNeedUpdate","visible","index","updateLayerRenderList","currentPickId","selectedFeatureID","zoom","getZoom","minZoom","Infinity","maxZoom","source","getSource","extent","isValid","some","v","Math","abs","off","sourceEvent","destroy","clearAllAttributes","layerModel","clearModels","encodedData","removeAllListeners","models","model","getLayerStyleAttributes","filter","attribute","needRescale","needRemapping","needRegenerateVertices","cluster","updateClusterData","getLayerAttributeScale","ticks","items","map","item","value","invertExtent","range","triggerHover","box","cb","boxPickLayer","moduleName","vertexShader","fragmentShader","triangulation","segmentNumber","shaderModuleService","registerModule","vs","fs","getModule","uniforms","createModel","createAttributesAndIndices","attributes","elements","BlendTypes","BlendType","normal","clock","getDelta","animateStartTime","getElapsedTime","stopAnimate","isPick","eventNames","indexOf","isVisible","Error","buildModels","draw","getUninforms","getShaderPickStat","time","console","warn","valuesOrCallback","defaultValues","undefined","callback","EventEmitter"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA;;AACA;;AA4CA;;AACA;;AAGA;;AACA;;AACA;;AACA;;;;;;;;;;;;;;;;;;;;;AAKA,IAAIA,cAAc,GAAG,CAArB;IAEqBC,S,WA6DlB,wBAAWC,cAAMC,oBAAjB,C,UAGA,wBAAWD,cAAME,oBAAjB,C;;;;;AAkED,uBAAyE;AAAA;;AAAA,QAA7DC,MAA6D,uEAAJ,EAAI;AAAA;AACvE;AADuE,+FAhIlDL,cAAc,EAgIoC;AAAA,iGA/HhDA,cA+HgD;AAAA;AAAA,0FA7H/C,IA6H+C;AAAA,yFA5HjD,CA4HiD;AAAA;AAAA;AAAA,yFAzHhD,KAyHgD;AAAA,uGAxHlC,KAwHkC;AAAA,kGAvHjC,IAuHiC;AAAA,oGAtH/B,IAsH+B;AAAA,kGArHvC,KAqHuC;AAAA;AAAA,4F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BAAV,CAAN;AACD;;;WACD,4BAA6B;AAC3B,aAAO,EAAP;AACD;;;WAaD,oBAAmB;AACjB,UAAI,KAAKjL,MAAT,EAAiB;AACf,aAAKkB,YAAL,CAAkBsF,qBAAlB;AACA,aAAKtF,YAAL,CAAkBiE,YAAlB;AACD;AACF;;;WACD,2CACEsG,gBADF,EAEEC,aAFF,EAGE;AACA,aAAO;AACL7H,QAAAA,MAAM,EAAE,0BAAW4H,gBAAX,IACJE,SADI,GAEJF,gBAAgB,IAAIC,aAHnB;AAILE,QAAAA,QAAQ,EAAE,0BAAWH,gBAAX,IAA+BA,gBAA/B,GAAkDE;AAJvD,OAAP;AAMD;;;EA9+BiEE,0B","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 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 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 } from 'lodash';\nimport { normalizePasses } from '../plugins/MultiPassRendererPlugin';\nimport { BlendTypes } from '../utils/blend';\nimport { handleStyleDataMapping } from '../utils/dataMappingStyle';\nimport { updateShape } from '../utils/updateShape';\nimport baseLayerSchema from './schema';\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\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 // 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 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 // 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 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\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 this.cameraService = this.container.get<ICameraService>(\n TYPES.ICameraService,\n );\n this.coordinateService = this.container.get<ICoordinateSystemService>(\n TYPES.ICoordinateSystemService,\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.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 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 // if (\n // this.needPick() &&\n // this.multiPassRenderer &&\n // this.multiPassRenderer.getRenderFlag()\n // ) {\n // this.multiPassRenderer.render();\n // } else if (this.needPick() && this.multiPassRenderer) {\n // this.renderModels();\n // } else {\n // this.renderModels();\n // }\n // TODO: this.getEncodedData().length !== 0 这个判断是为了解决在 2.5.x 引入数据纹理后产生的 空数据渲染导致 texture 超出上限问题\n if (this.getEncodedData().length !== 0) {\n this.renderModels();\n }\n // this.renderModels();\n\n // this.multiPassRenderer.render();\n // this.renderModels();\n return this;\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 } 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 });\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 });\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 } 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 });\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 });\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): void {\n this.updateLayerConfig({\n blend: type,\n });\n this.layerModelNeedUpdate = true;\n this.reRender();\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 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 * 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 this.hooks.beforeDestroy.call();\n // 清除sources事件\n this.layerSource.off('update', this.sourceEvent);\n\n this.multiPassRenderer.destroy();\n\n // 清除所有属性以及关联的 vao\n this.styleAttributeService.clearAllAttributes();\n // 销毁所有 model\n // this.models.forEach((model) => model.destroy());\n\n this.hooks.afterDestroy.call();\n\n // TODO: 清除各个图层自定义的 models 资源\n this.layerModel?.clearModels();\n // @ts-ignore\n this.encodedData = null;\n\n this.emit('remove', {\n target: this,\n type: 'remove',\n });\n\n this.removeAllListeners();\n\n // 解绑图层容器中的服务\n // this.container.unbind(TYPES.IStyleAttributeService);\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\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 public getLegendItems(name: string): any {\n const scale = this.styleAttributeService.getLayerAttributeScale(name);\n if (scale) {\n if (scale.ticks) {\n const items = scale.ticks().map((item: any) => {\n return {\n value: item,\n [name]: scale(item),\n };\n });\n return items;\n } else if (scale.invertExtent) {\n const items = scale.range().map((item: any) => {\n return {\n value: scale.invertExtent(item),\n [name]: item,\n };\n });\n return items;\n }\n } else {\n return [];\n }\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 renderModels() {\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 this.models.forEach((model) => {\n model.draw({\n uniforms: this.layerModel.getUninforms(),\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\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":["layerIdCounter","BaseLayer","TYPES","IGlobalConfigService","IShaderModuleService","config","dataSourceNeedUpdate","dataMappingNeedUpdate","filterNeedUpdate","featureScaleNeedUpdate","StyleAttrNeedUpdate","init","SyncBailHook","afterInit","beforeRender","beforeRenderData","SyncWaterfallHook","afterRender","SyncHook","beforePickingEncode","afterPickingEncode","beforeHighlight","afterHighlight","beforeSelect","afterSelect","beforeDestroy","afterDestroy","enable","dataState","getLayerConfig","autoFit","fitBoundsOptions","fitBounds","emit","reRender","name","id","zIndex","rawConfig","configService","configToUpdate","inited","needUpdateConfig","sceneId","container","get","SceneID","setLayerConfig","sceneContainer","plugin","plugins","push","enableMultiPassRenderer","iconService","IIconService","fontService","IFontService","rendererService","IRendererService","layerService","ILayerService","interactionService","IInteractionService","pickingService","IPickingService","mapService","IMapService","cameraService","ICameraService","coordinateService","ICoordinateSystemService","postProcessingPassFactory","IFactoryPostProcessingPass","normalPassFactory","IFactoryNormalPass","styleAttributeService","IStyleAttributeService","multiPassRenderer","IMultiPassRenderer","setLayer","pendingStyleAttributes","forEach","attributeName","attributeField","attributeValues","updateOptions","updateStyleAttribute","scale","field","splitValuesAndCallbackInAttribute","getAll","ILayerPlugin","apply","hooks","call","target","type","updateLayerConfig","getDefaultConfig","animateOption","startAnimate","aniamateStatus","values","lastShape","getLayerStyleAttribute","currentShape","options","rawAnimate","data","setSource","sourceOption","layerSource","setData","on","passes","rest","pass","postProcessingPass","getPostProcessor","getPostProcessingPassByName","styleNeedUpdate","cfg","scaleOptions","rendering","renderLayers","getEncodedData","length","renderModels","activeOption","enableHighlight","color","highlightColor","x","y","pick","pickedFeatureID","then","setTimeout","option","enableSelect","selectColor","blend","layerModelNeedUpdate","visible","index","updateLayerRenderList","currentPickId","selectedFeatureID","zoom","getZoom","minZoom","Infinity","maxZoom","source","getSource","extent","isValid","some","v","Math","abs","off","sourceEvent","destroy","clearAllAttributes","layerModel","clearModels","encodedData","removeAllListeners","models","model","getLayerStyleAttributes","filter","attribute","needRescale","needRemapping","needRegenerateVertices","cluster","updateClusterData","getLayerAttributeScale","ticks","items","map","item","value","invertExtent","range","triggerHover","box","cb","boxPickLayer","moduleName","vertexShader","fragmentShader","triangulation","segmentNumber","shaderModuleService","registerModule","vs","fs","getModule","uniforms","createModel","createAttributesAndIndices","attributes","elements","BlendTypes","BlendType","normal","clock","getDelta","animateStartTime","getElapsedTime","stopAnimate","isPick","eventNames","indexOf","isVisible","Error","buildModels","draw","getUninforms","getShaderPickStat","time","console","warn","valuesOrCallback","defaultValues","undefined","callback","EventEmitter"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA;;AACA;;AA4CA;;AACA;;AAGA;;AACA;;AACA;;AACA;;;;;;;;;;;;;;;;;;;;;AAKA,IAAIA,cAAc,GAAG,CAArB;IAEqBC,S,WA6DlB,wBAAWC,cAAMC,oBAAjB,C,UAGA,wBAAWD,cAAME,oBAAjB,C;;;;;AAkED,uBAAyE;AAAA;;AAAA,QAA7DC,MAA6D,uEAAJ,EAAI;AAAA;AACvE;AADuE,+FAhIlDL,cAAc,EAgIoC;AAAA,iGA/HhDA,cA+HgD;AAAA;AAAA,0FA7H/C,IA6H+C;AAAA,yFA5HjD,CA4HiD;AAAA;AAAA;AAAA,yFAzHhD,KAyHgD;AAAA,uGAxHlC,KAwHkC;AAAA,kGAvHjC,IAuHiC;AAAA,oGAtH/B,IAsH+B;AAAA,kGArHvC,KAqHuC;AAAA;AAAA,4FAlH1C;AAC7BM,MAAAA,oBAAoB,EAAE,KADO;AAE7BC,MAAAA,qBAAqB,EAAE,KAFM;AAG7BC,MAAAA,gBAAgB,EAAE,KAHW;AAI7BC,MAAAA,sBAAsB,EAAE,KAJK;AAK7BC,MAAAA,mBAAmB,EAAE;AALQ,KAkH0C;AAAA,wFA1G1D;AACbC,MAAAA,IAAI,EAAE,IAAIC,uBAAJ,EADO;AAEbC,MAAAA,SAAS,EAAE,IAAID,uBAAJ,EAFE;AAGbE,MAAAA,YAAY,EAAE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I,GAEJF,gBAAgB,IAAIC,aAHnB;AAILE,QAAAA,QAAQ,EAAE,0BAAWH,gBAAX,IAA+BA,gBAA/B,GAAkDE;AAJvD,OAAP;AAMD;;;EAh/BiEE,0B","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 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 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 } from 'lodash';\nimport { normalizePasses } from '../plugins/MultiPassRendererPlugin';\nimport { BlendTypes } from '../utils/blend';\nimport { handleStyleDataMapping } from '../utils/dataMappingStyle';\nimport { updateShape } from '../utils/updateShape';\nimport baseLayerSchema from './schema';\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\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 // 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 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 // 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 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\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 this.cameraService = this.container.get<ICameraService>(\n TYPES.ICameraService,\n );\n this.coordinateService = this.container.get<ICoordinateSystemService>(\n TYPES.ICoordinateSystemService,\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.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 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 // if (\n // this.needPick() &&\n // this.multiPassRenderer &&\n // this.multiPassRenderer.getRenderFlag()\n // ) {\n // this.multiPassRenderer.render();\n // } else if (this.needPick() && this.multiPassRenderer) {\n // this.renderModels();\n // } else {\n // this.renderModels();\n // }\n // TODO: this.getEncodedData().length !== 0 这个判断是为了解决在 2.5.x 引入数据纹理后产生的 空数据渲染导致 texture 超出上限问题\n if (this.getEncodedData().length !== 0) {\n this.renderModels();\n }\n // this.renderModels();\n\n // this.multiPassRenderer.render();\n // this.renderModels();\n return this;\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 } 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 });\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 });\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 } 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 });\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 });\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): void {\n this.updateLayerConfig({\n blend: type,\n });\n this.layerModelNeedUpdate = true;\n this.reRender();\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 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 * 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 this.hooks.beforeDestroy.call();\n // 清除sources事件\n this.layerSource.off('update', this.sourceEvent);\n\n this.multiPassRenderer.destroy();\n\n // 清除所有属性以及关联的 vao == 销毁所有 => model this.models.forEach((model) => model.destroy());\n this.styleAttributeService.clearAllAttributes();\n\n // 执行每个图层单独的 clearModels 方法 (清除一些额外的 texture、program、buffer 等)\n this.layerModel.clearModels();\n\n this.hooks.afterDestroy.call();\n\n // TODO: 给外部使用\n // TODO: 清除各个图层自定义的 models 资源\n this.layerModel?.clearModels();\n // @ts-ignore\n this.encodedData = null;\n\n this.emit('remove', {\n target: this,\n type: 'remove',\n });\n\n this.removeAllListeners();\n\n // 解绑图层容器中的服务\n // this.container.unbind(TYPES.IStyleAttributeService);\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\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 public getLegendItems(name: string): any {\n const scale = this.styleAttributeService.getLayerAttributeScale(name);\n if (scale) {\n if (scale.ticks) {\n const items = scale.ticks().map((item: any) => {\n return {\n value: item,\n [name]: scale(item),\n };\n });\n return items;\n } else if (scale.invertExtent) {\n const items = scale.range().map((item: any) => {\n return {\n value: scale.invertExtent(item),\n [name]: item,\n };\n });\n return items;\n }\n } else {\n return [];\n }\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 renderModels() {\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 this.models.forEach((model) => {\n model.draw({\n uniforms: this.layerModel.getUninforms(),\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\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"}
|
package/lib/core/BaseModel.js
CHANGED
|
@@ -86,6 +86,7 @@ var BaseModel = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
|
|
|
86
86
|
this.cellLength = 0;
|
|
87
87
|
this.cellProperties = [];
|
|
88
88
|
this.cacheStyleProperties = {
|
|
89
|
+
thetaOffset: undefined,
|
|
89
90
|
opacity: undefined,
|
|
90
91
|
strokeOpacity: undefined,
|
|
91
92
|
strokeWidth: undefined,
|
|
@@ -93,6 +94,7 @@ var BaseModel = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
|
|
|
93
94
|
offsets: undefined
|
|
94
95
|
};
|
|
95
96
|
this.stylePropertyesExist = {
|
|
97
|
+
hasThetaOffset: 0,
|
|
96
98
|
hasOpacity: 0,
|
|
97
99
|
hasStrokeOpacity: 0,
|
|
98
100
|
hasStrokeWidth: 0,
|
|
@@ -118,6 +120,7 @@ var BaseModel = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
|
|
|
118
120
|
this.cellProperties = [];
|
|
119
121
|
this.cellLength = 0;
|
|
120
122
|
this.stylePropertyesExist = {
|
|
123
|
+
hasThetaOffset: 0,
|
|
121
124
|
hasOpacity: 0,
|
|
122
125
|
hasStrokeOpacity: 0,
|
|
123
126
|
hasStrokeWidth: 0,
|
|
@@ -129,7 +132,7 @@ var BaseModel = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
|
|
|
129
132
|
key: "getCellTypeLayout",
|
|
130
133
|
value: function getCellTypeLayout() {
|
|
131
134
|
if (this.dataTextureTest) {
|
|
132
|
-
return [this.rowCount, this.DATA_TEXTURE_WIDTH, 0.0, 0.0, this.stylePropertyesExist.hasOpacity, this.stylePropertyesExist.hasStrokeOpacity, this.stylePropertyesExist.hasStrokeWidth, this.stylePropertyesExist.hasStroke, this.stylePropertyesExist.hasOffsets,
|
|
135
|
+
return [this.rowCount, this.DATA_TEXTURE_WIDTH, 0.0, 0.0, this.stylePropertyesExist.hasOpacity, this.stylePropertyesExist.hasStrokeOpacity, this.stylePropertyesExist.hasStrokeWidth, this.stylePropertyesExist.hasStroke, this.stylePropertyesExist.hasOffsets, this.stylePropertyesExist.hasThetaOffset, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0];
|
|
133
136
|
} else {
|
|
134
137
|
return [1.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -1.0];
|
|
135
138
|
}
|
|
@@ -139,6 +142,11 @@ var BaseModel = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
|
|
|
139
142
|
value: function dataTextureNeedUpdate(options) {
|
|
140
143
|
var isUpdate = false;
|
|
141
144
|
|
|
145
|
+
if (!(0, _isEqual2.default)(options.thetaOffset, this.cacheStyleProperties.thetaOffset)) {
|
|
146
|
+
isUpdate = true;
|
|
147
|
+
this.cacheStyleProperties.thetaOffset = options.thetaOffset;
|
|
148
|
+
}
|
|
149
|
+
|
|
142
150
|
if (!(0, _isEqual2.default)(options.opacity, this.cacheStyleProperties.opacity)) {
|
|
143
151
|
isUpdate = true;
|
|
144
152
|
this.cacheStyleProperties.opacity = options.opacity;
|
|
@@ -219,6 +227,15 @@ var BaseModel = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
|
|
|
219
227
|
this.stylePropertyesExist.hasOffsets = 1;
|
|
220
228
|
this.cellLength += 2;
|
|
221
229
|
}
|
|
230
|
+
|
|
231
|
+
if (options.thetaOffset !== undefined && !(0, _isNumber2.default)(options.thetaOffset)) {
|
|
232
|
+
this.cellProperties.push({
|
|
233
|
+
attr: 'thetaOffset',
|
|
234
|
+
count: 1
|
|
235
|
+
});
|
|
236
|
+
this.stylePropertyesExist.hasThetaOffset = 1;
|
|
237
|
+
this.cellLength += 1;
|
|
238
|
+
}
|
|
222
239
|
}
|
|
223
240
|
}, {
|
|
224
241
|
key: "isStaticColor",
|
|
@@ -276,7 +293,7 @@ var BaseModel = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
|
|
|
276
293
|
count = layout.count;
|
|
277
294
|
var value = cellData[attr];
|
|
278
295
|
|
|
279
|
-
if (value) {
|
|
296
|
+
if (value !== undefined) {
|
|
280
297
|
if (attr === 'stroke') {
|
|
281
298
|
d.push.apply(d, (0, _toConsumableArray2.default)((0, _l7Utils.rgb2arr)(value)));
|
|
282
299
|
} else if (attr === 'offsets') {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/core/BaseModel.ts"],"names":["BaseModel","TYPES","IGlobalConfigService","IShaderModuleService","layer","rendererService","getContainer","get","IRendererService","styleAttributeService","IStyleAttributeService","mapService","IMapService","iconService","IIconService","fontService","IFontService","cameraService","ICameraService","layerService","ILayerService","registerBuiltinAttributes","startModelAnimate","createTexture2D","DATA_TEXTURE_WIDTH","rowCount","cellLength","cellProperties","cacheStyleProperties","opacity","undefined","strokeOpacity","strokeWidth","stroke","offsets","stylePropertyesExist","hasOpacity","hasStrokeOpacity","hasStrokeWidth","hasStroke","hasOffsets","dataTextureTest","getOESTextureFloat","dataTexture","data","Uint8ClampedArray","mag","gl","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","BlendTypes","BlendType","Error","option","enable","duration","interval","trailLength","animateOption","setAnimateStartTime"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AA4BA;;AACA;;AAEA;;;;;;;;;;IA0BqBA,S,WAkClB,wBAAWC,cAAMC,oBAAjB,C,UASA,wBAAWD,cAAME,oBAAjB,C;AAaD,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,CAEEN,cAAMO,gBAFR,CAAvB;AAGA,SAAKC,qBAAL,GAA6BL,KAAK,CAC/BE,YAD0B,GAE1BC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,2BAAkC;AAChC,aAAO,EAAP;AACD;;;WACD,wBAAqC;AACnC,YAAM,IAAIG,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,KAAKhF,KAAL,CAAWuE,cAAX,EAA1B;AAAA,UAAQU,aAAR,QAAQA,aAAR;;AACA,UAAIA,aAAa,CAACJ,MAAlB,EAA0B;AACxB,aAAK7E,KAAL,CAAWkF,mBAAX;AACD;AACF","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 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 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 readonly 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.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 opacity: undefined,\n strokeOpacity: undefined,\n strokeWidth: undefined,\n stroke: undefined,\n offsets: undefined,\n };\n this.stylePropertyesExist = {\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 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 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 this.rowCount, // 数据纹理有几行\n this.DATA_TEXTURE_WIDTH, // 数据纹理有几列\n 0.0,\n 0.0,\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 this.stylePropertyesExist.hasOffsets, // 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 } 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 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.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 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 // 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) {\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":["BaseModel","TYPES","IGlobalConfigService","IShaderModuleService","layer","rendererService","getContainer","get","IRendererService","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","Uint8ClampedArray","mag","gl","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","BlendTypes","BlendType","Error","option","enable","duration","interval","trailLength","animateOption","setAnimateStartTime"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AA4BA;;AACA;;AAEA;;;;;;;;;;IA0BqBA,S,WAoClB,wBAAWC,cAAMC,oBAAjB,C,UASA,wBAAWD,cAAME,oBAAjB,C;AAaD,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,CAEEN,cAAMO,gBAFR,CAAvB;AAGA,SAAKC,qBAAL,GAA6BL,KAAK,CAC/BE,YAD0B,GAE1BC,GAF0B,CAEEN,cAAMS,sBAFR,CAA7B;AAGA,SAAKC,UAAL,GAAk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ADf,EAELD,MAAM,CAACE,QAAP,IAAmB,GAFd,EAGLF,MAAM,CAACG,QAAP,IAAmB,GAHd,EAILH,MAAM,CAACI,WAAP,IAAsB,GAJjB,CAAP;AAMD;;;WACD,6BAA8B;AAC5B,iBAA0B,KAAKlF,KAAL,CAAWyE,cAAX,EAA1B;AAAA,UAAQU,aAAR,QAAQA,aAAR;;AACA,UAAIA,aAAa,CAACJ,MAAlB,EAA0B;AACxB,aAAK/E,KAAL,CAAWoF,mBAAX;AACD;AACF","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 readonly 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.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 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"}
|
package/lib/index.js
CHANGED
|
@@ -65,6 +65,12 @@ Object.defineProperty(exports, "RasterLayer", {
|
|
|
65
65
|
return _raster.default;
|
|
66
66
|
}
|
|
67
67
|
});
|
|
68
|
+
Object.defineProperty(exports, "WindLayer", {
|
|
69
|
+
enumerable: true,
|
|
70
|
+
get: function get() {
|
|
71
|
+
return _wind.default;
|
|
72
|
+
}
|
|
73
|
+
});
|
|
68
74
|
|
|
69
75
|
var _l7Core = require("@antv/l7-core");
|
|
70
76
|
|
|
@@ -90,6 +96,8 @@ var _raster = _interopRequireDefault(require("./raster"));
|
|
|
90
96
|
|
|
91
97
|
var _earth = _interopRequireDefault(require("./earth"));
|
|
92
98
|
|
|
99
|
+
var _wind = _interopRequireDefault(require("./wind"));
|
|
100
|
+
|
|
93
101
|
var _DataMappingPlugin = _interopRequireDefault(require("./plugins/DataMappingPlugin"));
|
|
94
102
|
|
|
95
103
|
var _DataSourcePlugin = _interopRequireDefault(require("./plugins/DataSourcePlugin"));
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"names":["container","bind","TYPES","ILayerPlugin","to","DataSourcePlugin","inRequestScope","RegisterStyleAttributePlugin","FeatureScalePlugin","DataMappingPlugin","LayerStylePlugin","UpdateStyleAttributePlugin","UpdateModelPlugin","MultiPassRendererPlugin","ShaderUniformPlugin","LayerAnimateStylePlugin","LightingPlugin","PixelPickingPlugin","LayerModelPlugin"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"names":["container","bind","TYPES","ILayerPlugin","to","DataSourcePlugin","inRequestScope","RegisterStyleAttributePlugin","FeatureScalePlugin","DataMappingPlugin","LayerStylePlugin","UpdateStyleAttributePlugin","UpdateModelPlugin","MultiPassRendererPlugin","ShaderUniformPlugin","LayerAnimateStylePlugin","LightingPlugin","PixelPickingPlugin","LayerModelPlugin"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA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port CityBuildingLayer from './citybuliding/building';\nimport BaseLayer from './core/BaseLayer';\nimport './glsl.d';\nimport HeatmapLayer from './heatmap';\nimport ImageLayer from './image';\nimport ImageTileLayer from './imagetile';\nimport LineLayer from './line/index';\nimport PointLayer from './point';\nimport PolygonLayer from './polygon';\nimport RasterLayer from './raster';\n\nimport EarthLayer from './earth';\n\nimport WindLayer from './wind';\n\n// import ConfigSchemaValidationPlugin from './plugins/ConfigSchemaValidationPlugin';\nimport DataMappingPlugin from './plugins/DataMappingPlugin';\nimport DataSourcePlugin from './plugins/DataSourcePlugin';\nimport FeatureScalePlugin from './plugins/FeatureScalePlugin';\nimport LayerAnimateStylePlugin from './plugins/LayerAnimateStylePlugin';\nimport LayerModelPlugin from './plugins/LayerModelPlugin';\nimport LayerStylePlugin from './plugins/LayerStylePlugin';\nimport LightingPlugin from './plugins/LightingPlugin';\nimport MultiPassRendererPlugin from './plugins/MultiPassRendererPlugin';\nimport PixelPickingPlugin from './plugins/PixelPickingPlugin';\nimport RegisterStyleAttributePlugin from './plugins/RegisterStyleAttributePlugin';\nimport ShaderUniformPlugin from './plugins/ShaderUniformPlugin';\nimport UpdateModelPlugin from './plugins/UpdateModelPlugin';\nimport UpdateStyleAttributePlugin from './plugins/UpdateStyleAttributePlugin';\n\n/**\n * 校验传入参数配置项的正确性\n * @see /dev-docs/ConfigSchemaValidation.md\n */\n// container\n// .bind<ILayerPlugin>(TYPES.ILayerPlugin)\n// .to(ConfigSchemaValidationPlugin)\n// .inRequestScope();\n/**\n * 获取 Source\n */\ncontainer\n .bind<ILayerPlugin>(TYPES.ILayerPlugin)\n .to(DataSourcePlugin)\n .inRequestScope();\n/**\n * 根据 StyleAttribute 创建 VertexAttribute\n */\ncontainer\n .bind<ILayerPlugin>(TYPES.ILayerPlugin)\n .to(RegisterStyleAttributePlugin)\n .inRequestScope();\n/**\n * 根据 Source 创建 Scale\n */\ncontainer\n .bind<ILayerPlugin>(TYPES.ILayerPlugin)\n .to(FeatureScalePlugin)\n .inRequestScope();\n/**\n * 使用 Scale 进行数据映射\n */\ncontainer\n .bind<ILayerPlugin>(TYPES.ILayerPlugin)\n .to(DataMappingPlugin)\n .inRequestScope();\n\n/**\n * 更新地图样式配置项 如active, show, hide\n */\ncontainer\n .bind<ILayerPlugin>(TYPES.ILayerPlugin)\n .to(LayerStylePlugin)\n .inRequestScope();\n\n/**\n * 负责属性更新\n */\ncontainer\n .bind<ILayerPlugin>(TYPES.ILayerPlugin)\n .to(UpdateStyleAttributePlugin)\n .inRequestScope();\n\n/**\n * 负责Model更新\n */\ncontainer\n .bind<ILayerPlugin>(TYPES.ILayerPlugin)\n .to(UpdateModelPlugin)\n .inRequestScope();\n\n/**\n * Multi Pass 自定义渲染管线\n */\ncontainer\n .bind<ILayerPlugin>(TYPES.ILayerPlugin)\n .to(MultiPassRendererPlugin)\n .inRequestScope();\n/**\n * 传入相机坐标系参数\n */\ncontainer\n .bind<ILayerPlugin>(TYPES.ILayerPlugin)\n .to(ShaderUniformPlugin)\n .inRequestScope();\n\n/**\n * 传入动画参数\n */\ncontainer\n .bind<ILayerPlugin>(TYPES.ILayerPlugin)\n .to(LayerAnimateStylePlugin)\n .inRequestScope();\n/**\n * 传入光照相关参数\n */\ncontainer\n .bind<ILayerPlugin>(TYPES.ILayerPlugin)\n .to(LightingPlugin)\n .inRequestScope();\n/**\n * 负责拾取过程中 Encode 以及 Highlight 阶段及结束后恢复\n */\ncontainer\n .bind<ILayerPlugin>(TYPES.ILayerPlugin)\n .to(PixelPickingPlugin)\n .inRequestScope();\n/**\n * 初始化Model\n */\ncontainer\n .bind<ILayerPlugin>(TYPES.ILayerPlugin)\n .to(LayerModelPlugin)\n .inRequestScope();\n\nexport {\n BaseLayer,\n PointLayer,\n PolygonLayer,\n LineLayer,\n CityBuildingLayer,\n ImageLayer,\n ImageTileLayer,\n RasterLayer,\n HeatmapLayer,\n EarthLayer,\n WindLayer,\n};\n"],"file":"index.js"}
|
package/lib/line/models/arc.js
CHANGED
|
@@ -36,7 +36,7 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
|
|
|
36
36
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
37
37
|
|
|
38
38
|
var line_arc_frag = "#define LineTypeSolid 0.0\n#define LineTypeDash 1.0\n#define Animate 0.0\n#define LineTexture 1.0\n\nuniform float u_opacity;\nuniform float u_textureBlend;\nuniform float u_blur : 0.9;\nuniform float u_line_type: 0.0;\n// varying vec2 v_normal;\nvarying vec4 v_dash_array;\nvarying vec4 v_color;\n\nuniform float u_time;\nuniform vec4 u_aimate: [ 0, 2., 1.0, 0.2 ];\n\nuniform float u_line_texture;\nuniform sampler2D u_texture;\nuniform vec2 u_textSize;\n\nuniform float segmentNumber;\nvarying vec2 v_iconMapUV;\n\nvarying mat4 styleMappingMat; // \u4F20\u9012\u4ECE\u7247\u5143\u4E2D\u4F20\u9012\u7684\u6620\u5C04\u6570\u636E\n\nuniform float u_linearColor: 0;\nuniform vec4 u_sourceColor;\nuniform vec4 u_targetColor;\n\n#pragma include \"picking\"\n\nvoid main() {\n float opacity = styleMappingMat[0][0];\n float animateSpeed = 0.0; // \u8FD0\u52A8\u901F\u5EA6\n float d_segmentIndex = styleMappingMat[3].r; // \u5F53\u524D\u9876\u70B9\u5728\u5F27\u7EBF\u4E2D\u6240\u5904\u7684\u5206\u6BB5\u4F4D\u7F6E\n float d_distance_ratio = styleMappingMat[3].b; // \u5F53\u524D\u9876\u70B9\u5728\u5F27\u7EBF\u4E2D\u6240\u5904\u7684\u5206\u6BB5\u6BD4\u4F8B\n\n // \u8BBE\u7F6E\u5F27\u7EBF\u7684\u5E95\u8272\n if(u_linearColor == 1.0) { // \u4F7F\u7528\u6E10\u53D8\u989C\u8272\n gl_FragColor = mix(u_sourceColor, u_targetColor, d_segmentIndex/segmentNumber);\n } else { // \u4F7F\u7528 color \u65B9\u6CD5\u4F20\u5165\u7684\u989C\u8272\n gl_FragColor = v_color;\n }\n \n // float blur = 1.- smoothstep(u_blur, 1., length(v_normal.xy));\n // float blur = smoothstep(1.0, u_blur, length(v_normal.xy));\n gl_FragColor.a *= opacity;\n if(u_line_type == LineTypeDash) {\n float flag = 0.;\n float dashLength = mod(d_distance_ratio, v_dash_array.x + v_dash_array.y + v_dash_array.z + v_dash_array.w);\n if(dashLength < v_dash_array.x || (dashLength > (v_dash_array.x + v_dash_array.y) && dashLength < v_dash_array.x + v_dash_array.y + v_dash_array.z)) {\n flag = 1.;\n }\n gl_FragColor.a *=flag;\n }\n\n if(u_aimate.x == Animate && u_line_texture != LineTexture) {\n animateSpeed = u_time / u_aimate.y;\n float alpha =1.0 - fract( mod(1.0- d_distance_ratio, u_aimate.z)* (1.0/ u_aimate.z) + u_time / u_aimate.y);\n alpha = (alpha + u_aimate.w -1.0) / u_aimate.w;\n // alpha = smoothstep(0., 1., alpha);\n alpha = clamp(alpha, 0.0, 1.0);\n gl_FragColor.a *= alpha;\n }\n\n // \u5F53\u5B58\u5728\u8D34\u56FE\u65F6\u5728\u5E95\u8272\u4E0A\u8D34\u4E0A\u8D34\u56FE\n if(u_line_texture == LineTexture && u_line_type != LineTypeDash) { // while load texture\n float arcRadio = smoothstep( 0.0, 1.0, (d_segmentIndex / segmentNumber));\n // float arcRadio = smoothstep( 0.0, 1.0, d_distance_ratio);\n\n float count = styleMappingMat[3].g; // \u8D34\u56FE\u5728\u5F27\u7EBF\u4E0A\u91CD\u590D\u7684\u6570\u91CF\n\n float time = 0.0;\n if(u_aimate.x == Animate) {\n time = u_time / u_aimate.y;\n }\n float redioCount = arcRadio * count;\n\n float u = fract(redioCount - time);\n float v = styleMappingMat[3].a; // \u6A2A\u5411 v\n vec2 uv= v_iconMapUV / u_textSize + vec2(u, v) / u_textSize * 64.;\n\n vec4 pattern = texture2D(u_texture, uv);\n\n if(u_aimate.x == Animate) {\n float currentPlane = floor(redioCount - time);\n float textureStep = floor(count * u_aimate.z);\n float a = mod(currentPlane, textureStep);\n if(a < textureStep - 1.0) {\n pattern = vec4(0.0);\n }\n }\n\n if(u_textureBlend == 0.0) { // normal\n pattern.a = 0.0;\n gl_FragColor = filterColor(gl_FragColor + pattern);\n } else { // replace\n pattern.a *= opacity;\n if(gl_FragColor.a <= 0.0) {\n pattern.a = 0.0;\n }\n gl_FragColor = filterColor(pattern);\n }\n \n } else {\n gl_FragColor = filterColor(gl_FragColor);\n }\n // gl_FragColor = filterColor(gl_FragColor);\n}";
|
|
39
|
-
var line_arc2d_vert = "#define LineTypeSolid 0.0\n#define LineTypeDash 1.0\n#define Animate 0.0\n#define LineTexture 1.0\n\nattribute vec4 a_Color;\nattribute vec3 a_Position;\nattribute vec4 a_Instance;\nattribute float a_Size;\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\nuniform float segmentNumber;\nuniform vec4 u_aimate: [ 0, 2., 1.0, 0.2 ];\nvarying vec4 v_color;\n// varying vec2 v_normal;\n\nuniform float u_line_type: 0.0;\nuniform vec4 u_dash_array: [10.0, 5., 0, 0];\nuniform float u_lineDir: 1.0;\nvarying vec4 v_dash_array;\n\nuniform float u_thetaOffset: 0.314;\nuniform float u_icon_step: 100;\nuniform float u_line_texture: 0.0;\nattribute vec2 a_iconMapUV;\nvarying vec2 v_iconMapUV;\n\nuniform float u_opacity: 1.0;\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\n#pragma include \"styleMapping\"\n#pragma include \"styleMappingCalOpacity\"\n\n#pragma include \"projection\"\n#pragma include \"project\"\n#pragma include \"picking\"\n\nfloat bezier3(vec3 arr, float t) {\n float ut = 1. - t;\n return (arr.x * ut + arr.y * t) * ut + (arr.y * ut + arr.z * t) * t;\n}\nvec2 midPoint(vec2 source, vec2 target) {\n vec2 center = target - source;\n float r = length(center);\n float theta = atan(center.y, center.x);\n float thetaOffset =
|
|
39
|
+
var line_arc2d_vert = "#define LineTypeSolid 0.0\n#define LineTypeDash 1.0\n#define Animate 0.0\n#define LineTexture 1.0\n\nattribute vec4 a_Color;\nattribute vec3 a_Position;\nattribute vec4 a_Instance;\nattribute float a_Size;\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\nuniform float segmentNumber;\nuniform vec4 u_aimate: [ 0, 2., 1.0, 0.2 ];\nvarying vec4 v_color;\n// varying vec2 v_normal;\n\nuniform float u_line_type: 0.0;\nuniform vec4 u_dash_array: [10.0, 5., 0, 0];\nuniform float u_lineDir: 1.0;\nvarying vec4 v_dash_array;\n\nuniform float u_thetaOffset: 0.314;\nuniform float u_icon_step: 100;\nuniform float u_line_texture: 0.0;\nattribute vec2 a_iconMapUV;\nvarying vec2 v_iconMapUV;\n\nuniform float u_opacity: 1.0;\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\n#pragma include \"styleMapping\"\n#pragma include \"styleMappingCalOpacity\"\n#pragma include \"styleMappingCalThetaOffset\"\n\n#pragma include \"projection\"\n#pragma include \"project\"\n#pragma include \"picking\"\n\nfloat bezier3(vec3 arr, float t) {\n float ut = 1. - t;\n return (arr.x * ut + arr.y * t) * ut + (arr.y * ut + arr.z * t) * t;\n}\nvec2 midPoint(vec2 source, vec2 target, float arcThetaOffset) {\n vec2 center = target - source;\n float r = length(center);\n float theta = atan(center.y, center.x);\n float thetaOffset = arcThetaOffset;\n float r2 = r / 2.0 / cos(thetaOffset);\n float theta2 = theta + thetaOffset;\n vec2 mid = vec2(r2*cos(theta2) + source.x, r2*sin(theta2) + source.y);\n if(u_lineDir == 1.0) { // \u6B63\u5411\n return mid;\n } else { // \u9006\u5411\n // (mid + vmin)/2 = (s + t)/2\n vec2 vmid = source + target - mid;\n return vmid;\n }\n // return mid;\n}\nfloat getSegmentRatio(float index) {\n return smoothstep(0.0, 1.0, index / (segmentNumber - 1.));\n}\nvec2 interpolate (vec2 source, vec2 target, float t, float arcThetaOffset) {\n // if the angularDist is PI, linear interpolation is applied. otherwise, use spherical interpolation\n vec2 mid = midPoint(source, target, arcThetaOffset);\n vec3 x = vec3(source.x, mid.x, target.x);\n vec3 y = vec3(source.y, mid.y, target.y);\n return vec2(bezier3(x ,t), bezier3(y,t));\n}\nvec2 getExtrusionOffset(vec2 line_clipspace, float offset_direction) {\n // normalized direction of the line\n vec2 dir_screenspace = normalize(line_clipspace);\n // rotate by 90 degrees\n dir_screenspace = vec2(-dir_screenspace.y, dir_screenspace.x);\n vec2 offset = dir_screenspace * offset_direction * setPickingSize(a_Size) / 2.0;\n return offset;\n}\nvec2 getNormal(vec2 line_clipspace, float offset_direction) {\n // normalized direction of the line\n vec2 dir_screenspace = normalize(line_clipspace);\n // rotate by 90 degrees\n dir_screenspace = vec2(-dir_screenspace.y, dir_screenspace.x);\n return reverse_offset_normal(vec3(dir_screenspace,1.0)).xy * sign(offset_direction);\n}\n\nvoid main() {\n v_color = a_Color;\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 // dataset \u6570\u636E\u96C6\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 -> thetaOffset... \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 thetaOffsetAndOffset = calThetaOffsetAndOffset(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset, columnWidth, rowHeight);\n styleMappingMat[0][1] = thetaOffsetAndOffset.r;\n textureOffset = thetaOffsetAndOffset.g;\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n\n \n vec2 source = a_Instance.rg; // \u8D77\u59CB\u70B9\n vec2 target = a_Instance.ba; // \u7EC8\u70B9\n float segmentIndex = a_Position.x;\n float segmentRatio = getSegmentRatio(segmentIndex);\n\n float indexDir = mix(-1.0, 1.0, step(segmentIndex, 0.0));\n float nextSegmentRatio = getSegmentRatio(segmentIndex + indexDir);\n float d_distance_ratio;\n if(u_line_type == LineTypeDash) {\n d_distance_ratio = segmentIndex / segmentNumber;\n\n vec2 s = source;\n vec2 t = target;\n \n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n s = unProjCustomCoord(source);\n t = unProjCustomCoord(target);\n }\n float total_Distance = pixelDistance(s, t) / 2.0 * PI;\n // float total_Distance = pixelDistance(a_Instance.rg, a_Instance.ba) / 2.0 * PI;\n v_dash_array = pow(2.0, 20.0 - u_Zoom) * u_dash_array / (total_Distance / segmentNumber * segmentIndex);\n }\n \n if(u_aimate.x == Animate) {\n d_distance_ratio = segmentIndex / segmentNumber;\n if(u_lineDir != 1.0) {\n d_distance_ratio = 1.0 - d_distance_ratio;\n }\n }\n\n styleMappingMat[3].b = d_distance_ratio;\n\n // styleMappingMat[0][1] - arcThetaOffset\n vec4 curr = project_position(vec4(interpolate(source, target, segmentRatio, styleMappingMat[0][1]), 0.0, 1.0));\n vec4 next = project_position(vec4(interpolate(source, target, nextSegmentRatio, styleMappingMat[0][1]), 0.0, 1.0));\n // v_normal = getNormal((next.xy - curr.xy) * indexDir, a_Position.y);\n //unProjCustomCoord\n \n vec2 offset = project_pixel(getExtrusionOffset((next.xy - curr.xy) * indexDir, a_Position.y));\n\n\n float d_segmentIndex = a_Position.x + 1.0; // \u5F53\u524D\u9876\u70B9\u5728\u5F27\u7EBF\u4E2D\u6240\u5904\u7684\u5206\u6BB5\u4F4D\u7F6E\n styleMappingMat[3].r = d_segmentIndex;\n\n if(LineTexture == u_line_texture) { // \u5F00\u542F\u8D34\u56FE\u6A21\u5F0F\n\n float arcDistrance = length(source - target); // \u8D77\u59CB\u70B9\u548C\u7EC8\u70B9\u7684\u8DDD\u79BB\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20) { // amap\n arcDistrance *= 1000000.0;\n }\n if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) { // mapbox\n // arcDistrance *= 8.0;\n arcDistrance = project_pixel_allmap(arcDistrance);\n }\n v_iconMapUV = a_iconMapUV;\n\n float pixelLen = project_pixel(u_icon_step); // \u8D34\u56FE\u6CBF\u5F27\u7EBF\u65B9\u5411\u7684\u957F\u5EA6 - \u968F\u5730\u56FE\u7F29\u653E\u6539\u53D8\n float texCount = floor(arcDistrance/pixelLen); // \u8D34\u56FE\u5728\u5F27\u7EBF\u4E0A\u91CD\u590D\u7684\u6570\u91CF\n styleMappingMat[3].g = texCount;\n\n float lineOffsetWidth = length(offset + offset * sign(a_Position.y)); // \u7EBF\u6A2A\u5411\u504F\u79FB\u7684\u8DDD\u79BB\n float linePixelSize = project_pixel(a_Size); // \u5B9A\u70B9\u4F4D\u7F6E\u504F\u79FB\n styleMappingMat[3].a = lineOffsetWidth/linePixelSize; // \u7EBF\u56FE\u5C42\u8D34\u56FE\u90E8\u5206\u7684 v \u5750\u6807\u503C\n }\n \n\n // gl_Position = project_common_position_to_clipspace(vec4(curr.xy + offset, 0, 1.0));\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n // gl_Position = u_Mvp * (vec4(curr.xy + offset, 0, 1.0));\n gl_Position = u_Mvp * (vec4(curr.xy + offset, 0, 1.0));\n } else {\n gl_Position = project_common_position_to_clipspace(vec4(curr.xy + offset, 0, 1.0));\n }\n setPickingColor(a_PickingColor);\n}\n";
|
|
40
40
|
var lineStyleObj = {
|
|
41
41
|
solid: 0.0,
|
|
42
42
|
dash: 1.0
|
|
@@ -108,10 +108,12 @@ var ArcModel = function (_BaseModel) {
|
|
|
108
108
|
thetaOffset = _ref$thetaOffset === void 0 ? 0.314 : _ref$thetaOffset;
|
|
109
109
|
|
|
110
110
|
if (this.dataTextureTest && this.dataTextureNeedUpdate({
|
|
111
|
-
opacity: opacity
|
|
111
|
+
opacity: opacity,
|
|
112
|
+
thetaOffset: thetaOffset
|
|
112
113
|
})) {
|
|
113
114
|
this.judgeStyleAttributes({
|
|
114
|
-
opacity: opacity
|
|
115
|
+
opacity: opacity,
|
|
116
|
+
thetaOffset: thetaOffset
|
|
115
117
|
});
|
|
116
118
|
var encodeData = this.layer.getEncodedData();
|
|
117
119
|
|
|
@@ -157,9 +159,9 @@ var ArcModel = function (_BaseModel) {
|
|
|
157
159
|
}
|
|
158
160
|
|
|
159
161
|
return {
|
|
160
|
-
u_thetaOffset: thetaOffset,
|
|
161
162
|
u_dataTexture: this.dataTexture,
|
|
162
163
|
u_cellTypeLayout: this.getCellTypeLayout(),
|
|
164
|
+
u_thetaOffset: (0, _isNumber2.default)(thetaOffset) ? thetaOffset : 0.0,
|
|
163
165
|
u_opacity: (0, _isNumber2.default)(opacity) ? opacity : 1.0,
|
|
164
166
|
u_textureBlend: textureBlend === 'normal' ? 0.0 : 1.0,
|
|
165
167
|
segmentNumber: segmentNumber,
|