@antv/l7-layers 2.5.25 → 2.5.26
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.d.ts +5 -0
- package/es/core/BaseLayer.js +5 -0
- package/es/core/BaseLayer.js.map +1 -1
- package/es/core/triangulation.d.ts +19 -0
- package/es/core/triangulation.js +106 -1
- package/es/core/triangulation.js.map +1 -1
- package/es/earth/index.d.ts +15 -0
- package/es/earth/index.js +62 -0
- package/es/earth/index.js.map +1 -0
- package/es/earth/models/base.d.ts +16 -0
- package/es/earth/models/base.js +192 -0
- package/es/earth/models/base.js.map +1 -0
- package/es/index.d.ts +2 -1
- package/es/index.js +2 -1
- package/es/index.js.map +1 -1
- package/es/plugins/ShaderUniformPlugin.js +1 -1
- package/es/plugins/ShaderUniformPlugin.js.map +1 -1
- package/es/point/models/fill.js +48 -9
- package/es/point/models/fill.js.map +1 -1
- package/lib/core/BaseLayer.js +5 -0
- package/lib/core/BaseLayer.js.map +1 -1
- package/lib/core/triangulation.js +121 -0
- package/lib/core/triangulation.js.map +1 -1
- package/lib/earth/index.js +76 -0
- package/lib/earth/index.js.map +1 -0
- package/lib/earth/models/base.js +202 -0
- package/lib/earth/models/base.js.map +1 -0
- package/lib/index.js +8 -0
- package/lib/index.js.map +1 -1
- package/lib/plugins/ShaderUniformPlugin.js +1 -1
- package/lib/plugins/ShaderUniformPlugin.js.map +1 -1
- package/lib/point/models/fill.js +68 -8
- package/lib/point/models/fill.js.map +1 -1
- package/package.json +5 -5
package/es/core/BaseLayer.d.ts
CHANGED
|
@@ -160,6 +160,11 @@ export default class BaseLayer<ChildLayerStyleOptions = {}> extends EventEmitter
|
|
|
160
160
|
rebuildModels(): void;
|
|
161
161
|
renderModels(): this;
|
|
162
162
|
updateStyleAttribute(type: string, field: StyleAttributeField, values?: StyleAttributeOption, updateOptions?: Partial<IStyleAttributeUpdateOptions>): void;
|
|
163
|
+
/**
|
|
164
|
+
* 继承空方法
|
|
165
|
+
* @param time
|
|
166
|
+
*/
|
|
167
|
+
setEarthTime(time: number): void;
|
|
163
168
|
protected getConfigSchema(): void;
|
|
164
169
|
protected getModelType(): unknown;
|
|
165
170
|
protected getDefaultConfig(): {};
|
package/es/core/BaseLayer.js
CHANGED
|
@@ -916,6 +916,11 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), _dec2 = lazyInje
|
|
|
916
916
|
}, updateOptions);
|
|
917
917
|
}
|
|
918
918
|
}
|
|
919
|
+
}, {
|
|
920
|
+
key: "setEarthTime",
|
|
921
|
+
value: function setEarthTime(time) {
|
|
922
|
+
console.warn('empty fn');
|
|
923
|
+
}
|
|
919
924
|
}, {
|
|
920
925
|
key: "getConfigSchema",
|
|
921
926
|
value: function getConfigSchema() {
|
package/es/core/BaseLayer.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/core/BaseLayer.ts"],"names":["SyncBailHook","SyncHook","SyncWaterfallHook","BlendType","lazyInject","TYPES","encodePickingColor","EventEmitter","normalizePasses","BlendTypes","handleStyleDataMapping","layerIdCounter","BaseLayer","IGlobalConfigService","IShaderModuleService","config","dataSourceNeedUpdate","dataMappingNeedUpdate","filterNeedUpdate","featureScaleNeedUpdate","StyleAttrNeedUpdate","init","afterInit","beforeRender","beforeRenderData","afterRender","beforePickingEncode","afterPickingEncode","beforeHighlight","afterHighlight","beforeSelect","afterSelect","beforeDestroy","afterDestroy","enable","dataState","getLayerConfig","autoFit","fitBoundsOptions","fitBounds","emit","reRender","name","id","zIndex","rawConfig","configService","configToUpdate","inited","needUpdateConfig","sceneId","container","get","SceneID","setLayerConfig","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","options","rawAnimate","data","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","updateRenderOrder","currentPickId","selectedFeatureID","zoom","getZoom","minZoom","Infinity","maxZoom","source","getSource","extent","isValid","some","v","Math","abs","off","sourceEvent","destroy","clearAllAttributes","removeAllListeners","models","model","layerModel","clearModels","getLayerStyleAttributes","filter","attribute","needRescale","needRemapping","needRegenerateVertices","cluster","updateClusterData","encodedData","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","normal","clock","getDelta","animateStartTime","getElapsedTime","stopAnimate","isPick","eventNames","indexOf","isVisible","Error","buildModels","draw","getUninforms","valuesOrCallback","defaultValues","undefined","callback"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,SAASA,YAAT,EAAuBC,QAAvB,EAAiCC,iBAAjC,QAA0D,kBAA1D;AACA,SACEC,SADF,EAkCEC,UAlCF,EAwCEC,KAxCF,QAyCO,eAzCP;AA2CA,SAASC,kBAAT,QAAmC,gBAAnC;AACA,SAASC,YAAT,QAA6B,eAA7B;AAGA,SAASC,eAAT,QAAgC,oCAAhC;AACA,SAASC,UAAT,QAA2B,gBAA3B;AACA,SAASC,sB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V,CAAN;AACD;;;WACD,4BAA6B;AAC3B,aAAO,EAAP;AACD;;;WAaD,oBAAmB;AACjB,UAAI,KAAK1K,MAAT,EAAiB;AACf,aAAKiB,YAAL,CAAkB6D,YAAlB;AACD;AACF;;;WACD,2CACEgG,gBADF,EAEEC,aAFF,EAGE;AACA,aAAO;AACLnH,QAAAA,MAAM,EAAE,YAAWkH,gBAAX,IACJE,SADI,GAEJF,gBAAgB,IAAIC,aAHnB;AAILE,QAAAA,QAAQ,EAAE,YAAWH,gBAAX,IAA+BA,gBAA/B,GAAkDE;AAJvD,OAAP;AAMD;;;;EA18BiEzN,Y;;;;;;;;;;;SAA/CK,S","sourcesContent":["// @ts-ignore\nimport { SyncBailHook, SyncHook, SyncWaterfallHook } from '@antv/async-hook';\nimport {\n BlendType,\n gl,\n IActiveOption,\n IAnimateOption,\n ICameraService,\n ICoordinateSystemService,\n IDataState,\n IEncodeFeature,\n IFontService,\n IGlobalConfigService,\n IIconService,\n IInteractionService,\n ILayer,\n ILayerConfig,\n ILayerModel,\n ILayerModelInitializationOptions,\n ILayerPlugin,\n ILayerService,\n IMapService,\n IModel,\n IModelInitializationOptions,\n IMultiPassRenderer,\n IPass,\n IPickingService,\n IPostProcessingPass,\n IRendererService,\n IScale,\n IScaleOptions,\n IShaderModuleService,\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 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 @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) {\n this.container = container;\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 this.updateStyleAttribute('shape', field, values, updateOptions);\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 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.updateRenderOrder();\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 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 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.renderLayers();\n }\n }\n private splitValuesAndCallbackInAttribute(\n valuesOrCallback?: unknown[],\n defaultValues?: unknown[],\n ) {\n return {\n values: isFunction(valuesOrCallback)\n ? undefined\n : valuesOrCallback || defaultValues,\n callback: isFunction(valuesOrCallback) ? valuesOrCallback : undefined,\n };\n }\n}\n"],"file":"BaseLayer.js"}
|
|
1
|
+
{"version":3,"sources":["../../src/core/BaseLayer.ts"],"names":["SyncBailHook","SyncHook","SyncWaterfallHook","BlendType","lazyInject","TYPES","encodePickingColor","EventEmitter","normalizePasses","BlendTypes","handleStyleDataMapping","layerIdCounter","BaseLayer","IGlobalConfigService","IShaderModuleService","config","dataSourceNeedUpdate","dataMappingNeedUpdate","filterNeedUpdate","featureScaleNeedUpdate","StyleAttrNeedUpdate","init","afterInit","beforeRender","beforeRenderData","afterRender","beforePickingEncode","afterPickingEncode","beforeHighlight","afterHighlight","beforeSelect","afterSelect","beforeDestroy","afterDestroy","enable","dataState","getLayerConfig","autoFit","fitBoundsOptions","fitBounds","emit","reRender","name","id","zIndex","rawConfig","configService","configToUpdate","inited","needUpdateConfig","sceneId","container","get","SceneID","setLayerConfig","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","options","rawAnimate","data","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","updateRenderOrder","currentPickId","selectedFeatureID","zoom","getZoom","minZoom","Infinity","maxZoom","source","getSource","extent","isValid","some","v","Math","abs","off","sourceEvent","destroy","clearAllAttributes","removeAllListeners","models","model","layerModel","clearModels","getLayerStyleAttributes","filter","attribute","needRescale","needRemapping","needRegenerateVertices","cluster","updateClusterData","encodedData","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","normal","clock","getDelta","animateStartTime","getElapsedTime","stopAnimate","isPick","eventNames","indexOf","isVisible","Error","buildModels","draw","getUninforms","time","console","warn","valuesOrCallback","defaultValues","undefined","callback"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,SAASA,YAAT,EAAuBC,QAAvB,EAAiCC,iBAAjC,QAA0D,kBAA1D;AACA,SACEC,SADF,EAkCEC,UAlCF,EAwCEC,KAxCF,QAyCO,eAzCP;AA2CA,SAASC,kBAAT,QAAmC,gBAAnC;AACA,SAASC,YAAT,QAA6B,eAA7B;AAGA,SAASC,eAAT,QAAg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CAAa,UAAb;AACD;;;WAED,2BAA4B;AAC1B,YAAM,IAAIN,KAAJ,CAAU,yBAAV,CAAN;AACD;;;WAED,wBAAkC;AAChC,YAAM,IAAIA,KAAJ,CAAU,yBAAV,CAAN;AACD;;;WACD,4BAA6B;AAC3B,aAAO,EAAP;AACD;;;WAaD,oBAAmB;AACjB,UAAI,KAAK1K,MAAT,EAAiB;AACf,aAAKiB,YAAL,CAAkB6D,YAAlB;AACD;AACF;;;WACD,2CACEmG,gBADF,EAEEC,aAFF,EAGE;AACA,aAAO;AACLtH,QAAAA,MAAM,EAAE,YAAWqH,gBAAX,IACJE,SADI,GAEJF,gBAAgB,IAAIC,aAHnB;AAILE,QAAAA,QAAQ,EAAE,YAAWH,gBAAX,IAA+BA,gBAA/B,GAAkDE;AAJvD,OAAP;AAMD;;;;EAl9BiE5N,Y;;;;;;;;;;;SAA/CK,S","sourcesContent":["// @ts-ignore\nimport { SyncBailHook, SyncHook, SyncWaterfallHook } from '@antv/async-hook';\nimport {\n BlendType,\n gl,\n IActiveOption,\n IAnimateOption,\n ICameraService,\n ICoordinateSystemService,\n IDataState,\n IEncodeFeature,\n IFontService,\n IGlobalConfigService,\n IIconService,\n IInteractionService,\n ILayer,\n ILayerConfig,\n ILayerModel,\n ILayerModelInitializationOptions,\n ILayerPlugin,\n ILayerService,\n IMapService,\n IModel,\n IModelInitializationOptions,\n IMultiPassRenderer,\n IPass,\n IPickingService,\n IPostProcessingPass,\n IRendererService,\n IScale,\n IScaleOptions,\n IShaderModuleService,\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 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 @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) {\n this.container = container;\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 this.updateStyleAttribute('shape', field, values, updateOptions);\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 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.updateRenderOrder();\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 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 /**\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.renderLayers();\n }\n }\n private splitValuesAndCallbackInAttribute(\n valuesOrCallback?: unknown[],\n defaultValues?: unknown[],\n ) {\n return {\n values: isFunction(valuesOrCallback)\n ? undefined\n : valuesOrCallback || defaultValues,\n callback: isFunction(valuesOrCallback) ? valuesOrCallback : undefined,\n };\n }\n}\n"],"file":"BaseLayer.js"}
|
|
@@ -8,6 +8,15 @@ export declare function PointFillTriangulation(feature: IEncodeFeature): {
|
|
|
8
8
|
indices: number[];
|
|
9
9
|
size: number;
|
|
10
10
|
};
|
|
11
|
+
/**
|
|
12
|
+
* 计算2D 填充点图顶点 (地球模式)
|
|
13
|
+
* @param feature 映射feature
|
|
14
|
+
*/
|
|
15
|
+
export declare function GlobelPointFillTriangulation(feature: IEncodeFeature): {
|
|
16
|
+
vertices: number[];
|
|
17
|
+
indices: number[];
|
|
18
|
+
size: number;
|
|
19
|
+
};
|
|
11
20
|
/**
|
|
12
21
|
* 计算3D 拉伸点图
|
|
13
22
|
* @param feature 映射feature
|
|
@@ -82,3 +91,13 @@ export declare function HeatmapTriangulation(feature: IEncodeFeature): {
|
|
|
82
91
|
indices: number[];
|
|
83
92
|
size: number;
|
|
84
93
|
};
|
|
94
|
+
/**
|
|
95
|
+
* 构建地球三角网格
|
|
96
|
+
* @returns
|
|
97
|
+
*/
|
|
98
|
+
export declare function earthTriangulation(): {
|
|
99
|
+
vertices: number[];
|
|
100
|
+
indices: number[];
|
|
101
|
+
size: number;
|
|
102
|
+
normals: number[];
|
|
103
|
+
};
|
package/es/core/triangulation.js
CHANGED
|
@@ -2,12 +2,14 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
|
2
2
|
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
3
3
|
import { lngLatToMeters } from '@antv/l7-utils';
|
|
4
4
|
import earcut from 'earcut';
|
|
5
|
-
import { vec3 } from 'gl-matrix';
|
|
5
|
+
import { mat4, vec3 } from 'gl-matrix';
|
|
6
6
|
import ExtrudePolyline from '../utils/extrude_polyline';
|
|
7
7
|
import { calculateCentroid } from '../utils/geo';
|
|
8
8
|
import extrudePolygon, { extrude_PolygonNormal, fillPolygon } from './shape/extrude';
|
|
9
9
|
import { geometryShape } from './shape/Path';
|
|
10
10
|
var GeometryCache = {};
|
|
11
|
+
var EARTH_RADIUS = 100;
|
|
12
|
+
var EARTH_SEGMENTS = 36;
|
|
11
13
|
export function PointFillTriangulation(feature) {
|
|
12
14
|
var coordinates = calculateCentroid(feature.coordinates);
|
|
13
15
|
return {
|
|
@@ -16,6 +18,29 @@ export function PointFillTriangulation(feature) {
|
|
|
16
18
|
size: coordinates.length
|
|
17
19
|
};
|
|
18
20
|
}
|
|
21
|
+
export function GlobelPointFillTriangulation(feature) {
|
|
22
|
+
var coordinates = calculateCentroid(feature.coordinates);
|
|
23
|
+
var xyz = lglt2xyz(coordinates);
|
|
24
|
+
return {
|
|
25
|
+
vertices: [].concat(_toConsumableArray(xyz), _toConsumableArray(xyz), _toConsumableArray(xyz), _toConsumableArray(xyz)),
|
|
26
|
+
indices: [0, 1, 2, 2, 3, 0],
|
|
27
|
+
size: xyz.length
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function torad(deg) {
|
|
32
|
+
return deg / 180 * Math.acos(-1);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function lglt2xyz(lnglat) {
|
|
36
|
+
var lng = torad(lnglat[0]) + Math.PI / 2;
|
|
37
|
+
var lat = torad(lnglat[1]);
|
|
38
|
+
var z = EARTH_RADIUS * Math.cos(lat) * Math.cos(lng);
|
|
39
|
+
var x = EARTH_RADIUS * Math.cos(lat) * Math.sin(lng);
|
|
40
|
+
var y = EARTH_RADIUS * Math.sin(lat);
|
|
41
|
+
return [x, y, z];
|
|
42
|
+
}
|
|
43
|
+
|
|
19
44
|
export function PointExtrudeTriangulation(feature) {
|
|
20
45
|
var shape = feature.shape;
|
|
21
46
|
|
|
@@ -286,4 +311,84 @@ function addDir(dirX, dirY) {
|
|
|
286
311
|
var y = (dirY + 1) / 2;
|
|
287
312
|
return [x, y];
|
|
288
313
|
}
|
|
314
|
+
|
|
315
|
+
export function earthTriangulation() {
|
|
316
|
+
var mesh = primitiveSphere(EARTH_RADIUS, {
|
|
317
|
+
segments: EARTH_SEGMENTS
|
|
318
|
+
});
|
|
319
|
+
var positionsArr = mesh.positionsArr,
|
|
320
|
+
indicesArr = mesh.indicesArr,
|
|
321
|
+
normalArr = mesh.normalArr;
|
|
322
|
+
return {
|
|
323
|
+
vertices: positionsArr,
|
|
324
|
+
indices: indicesArr,
|
|
325
|
+
size: 5,
|
|
326
|
+
normals: normalArr
|
|
327
|
+
};
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
function primitiveSphere(radius, opt) {
|
|
331
|
+
var matRotY = mat4.create();
|
|
332
|
+
var matRotZ = mat4.create();
|
|
333
|
+
var up = vec3.fromValues(0, 1, 0);
|
|
334
|
+
var tmpVec3 = vec3.fromValues(0, 0, 0);
|
|
335
|
+
opt = opt || {};
|
|
336
|
+
radius = typeof radius !== 'undefined' ? radius : 1;
|
|
337
|
+
var segments = typeof opt.segments !== 'undefined' ? opt.segments : 32;
|
|
338
|
+
var totalZRotationSteps = 2 + segments;
|
|
339
|
+
var totalYRotationSteps = 2 * totalZRotationSteps;
|
|
340
|
+
var indices = [];
|
|
341
|
+
var indicesArr = [];
|
|
342
|
+
var positions = [];
|
|
343
|
+
var positionsArr = [];
|
|
344
|
+
var normals = [];
|
|
345
|
+
var normalArr = [];
|
|
346
|
+
var uvs = [];
|
|
347
|
+
|
|
348
|
+
for (var zRotationStep = 0; zRotationStep <= totalZRotationSteps; zRotationStep++) {
|
|
349
|
+
var normalizedZ = zRotationStep / totalZRotationSteps;
|
|
350
|
+
var angleZ = normalizedZ * Math.PI;
|
|
351
|
+
|
|
352
|
+
for (var yRotationStep = 0; yRotationStep <= totalYRotationSteps; yRotationStep++) {
|
|
353
|
+
var normalizedY = yRotationStep / totalYRotationSteps;
|
|
354
|
+
var angleY = normalizedY * Math.PI * 2;
|
|
355
|
+
mat4.identity(matRotZ);
|
|
356
|
+
mat4.rotateZ(matRotZ, matRotZ, -angleZ);
|
|
357
|
+
mat4.identity(matRotY);
|
|
358
|
+
mat4.rotateY(matRotY, matRotY, angleY);
|
|
359
|
+
vec3.transformMat4(tmpVec3, up, matRotZ);
|
|
360
|
+
vec3.transformMat4(tmpVec3, tmpVec3, matRotY);
|
|
361
|
+
vec3.scale(tmpVec3, tmpVec3, -radius);
|
|
362
|
+
positions.push(tmpVec3.slice());
|
|
363
|
+
positionsArr.push.apply(positionsArr, _toConsumableArray(tmpVec3.slice()));
|
|
364
|
+
vec3.normalize(tmpVec3, tmpVec3);
|
|
365
|
+
normals.push(tmpVec3.slice());
|
|
366
|
+
normalArr.push.apply(normalArr, _toConsumableArray(tmpVec3.slice()));
|
|
367
|
+
uvs.push([normalizedY, 1 - normalizedZ]);
|
|
368
|
+
positionsArr.push(normalizedY, 1 - normalizedZ);
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
if (zRotationStep > 0) {
|
|
372
|
+
var verticesCount = positions.length;
|
|
373
|
+
var firstIndex = verticesCount - 2 * (totalYRotationSteps + 1);
|
|
374
|
+
|
|
375
|
+
for (; firstIndex + totalYRotationSteps + 2 < verticesCount; firstIndex++) {
|
|
376
|
+
indices.push([firstIndex, firstIndex + 1, firstIndex + totalYRotationSteps + 1]);
|
|
377
|
+
indicesArr.push(firstIndex, firstIndex + 1, firstIndex + totalYRotationSteps + 1);
|
|
378
|
+
indices.push([firstIndex + totalYRotationSteps + 1, firstIndex + 1, firstIndex + totalYRotationSteps + 2]);
|
|
379
|
+
indicesArr.push(firstIndex + totalYRotationSteps + 1, firstIndex + 1, firstIndex + totalYRotationSteps + 2);
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
return {
|
|
385
|
+
cells: indices,
|
|
386
|
+
positions: positions,
|
|
387
|
+
normals: normals,
|
|
388
|
+
uvs: uvs,
|
|
389
|
+
positionsArr: positionsArr,
|
|
390
|
+
indicesArr: indicesArr,
|
|
391
|
+
normalArr: normalArr
|
|
392
|
+
};
|
|
393
|
+
}
|
|
289
394
|
//# sourceMappingURL=triangulation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/core/triangulation.ts"],"names":["lngLatToMeters","earcut","vec3","ExtrudePolyline","calculateCentroid","extrudePolygon","extrude_PolygonNormal","fillPolygon","geometryShape","GeometryCache","PointFillTriangulation","feature","coordinates","vertices","indices","size","length","PointExtrudeTriangulation","shape","getGeometry","positions","index","normals","PointImageTriangulation","LineTriangulation","originCoordinates","version","line","dash","join","path1","Array","isArray","path2","i","item1","item2","extrude_gaode2","path","forEach","item","extrude","linebuffer","complex","polygonTriangulation","flattengeo","flatten","dimensions","holes","PolygonExtrudeTriangulation","HeatmapGridTriangulation","getHeatmapGeometry","RasterImageTriangulation","indexs","LineArcTriangulation","segmentNumber","segNum","indexArray","push","map","v","HeatmapTriangulation","dir","addDir","dir1","dir2","dir3","needFlat","cylinder","geometry","computeVertexNormals","dim","Float32Array","vA","vB","vC","cb","create","ab","normal","li","p1","p2","p3","ax","ay","pA","fromValues","bx","by","pB","cx","cy","pC","sub","cross","normalizeNormals","newNormal","normalize","set","checkIsClosed","points","shape3d","circle","indexOf","dirX","dirY","x","y"],"mappings":";;AACA,SAAuBA,cAAvB,QAA6C,gBAA7C;AACA,OAAOC,MAAP,MAAmB,QAAnB;AACA,SAASC,IAAT,QAAqB,WAArB;AACA,OAAOC,eAAP,MAA4B,2BAA5B;AACA,SAASC,iBAAT,QAAkC,cAAlC;AACA,OAAOC,cAAP,IACEC,qBADF,EAEEC,WAFF,QAIO,iBAJP;AAKA,SACEC,aADF,QAKO,cALP;AAUA,IAAMC,aAA6B,GAAG,EAAtC;AAMA,OAAO,SAASC,sBAAT,CAAgCC,OAAhC,EAAyD;AAC9D,MAAMC,WAAW,GAAGR,iBAAiB,CAACO,OAAO,CAACC,WAAT,CAArC;AACA,SAAO;AACLC,IAAAA,QAAQ,+BAAMD,WAAN,sBAAsBA,WAAtB,sBAAsCA,WAAtC,sBAAsDA,WAAtD,EADH;AAELE,IAAAA,OAAO,EAAE,CAAC,CAAD,EAAI,CAAJ,EAAO,CAAP,EAAU,CAAV,EAAa,CAAb,EAAgB,CAAhB,CAFJ;AAGLC,IAAAA,IAAI,EAAEH,WAAW,CAACI;AAHb,GAAP;AAKD;AAMD,OAAO,SAASC,yBAAT,CAAmCN,OAAnC,EAA4D;AACjE,MAAQO,KAAR,GAAkBP,OAAlB,CAAQO,KAAR;;AAEA,qBAAsCC,WAAW,CAC/CD,KAD+C,EAE/C,KAF+C,CAAjD;AAAA,MAAQE,SAAR,gBAAQA,SAAR;AAAA,MAAmBC,KAAnB,gBAAmBA,KAAnB;AAAA,MAA0BC,OAA1B,gBAA0BA,OAA1B;;AAIA,SAAO;AACLT,IAAAA,QAAQ,EAAEO,SADL;AAELN,IAAAA,OAAO,EAAEO,KAFJ;A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CAACE,OAAR,CAAgBtF,KAAhB,MAA2B,CAAC,CAA5B,GACIX,WAAW,CAAC,CAAC+B,IAAD,CAAD,CADf,GAEIjC,cAAc,CAAC,CAACiC,IAAD,CAAD,CAHpB;AAKA,SAAO+B,QAAP;AACD;;AAED,SAASN,MAAT,CAAgB0C,IAAhB,EAA8BC,IAA9B,EAA4C;AAC1C,MAAMC,CAAC,GAAG,CAACF,IAAI,GAAG,CAAR,IAAa,CAAvB;AACA,MAAMG,CAAC,GAAG,CAACF,IAAI,GAAG,CAAR,IAAa,CAAvB;AACA,SAAO,CAACC,CAAD,EAAIC,CAAJ,CAAP;AACD","sourcesContent":["import { IEncodeFeature } from '@antv/l7-core';\nimport { aProjectFlat, lngLatToMeters } from '@antv/l7-utils';\nimport earcut from 'earcut';\nimport { vec3 } from 'gl-matrix';\nimport ExtrudePolyline from '../utils/extrude_polyline';\nimport { calculateCentroid } from '../utils/geo';\nimport extrudePolygon, {\n extrude_PolygonNormal,\n fillPolygon,\n IExtrudeGeomety,\n} from './shape/extrude';\nimport {\n geometryShape,\n IPosition,\n ShapeType2D,\n ShapeType3D,\n} from './shape/Path';\ntype IShape = ShapeType2D & ShapeType3D;\ninterface IGeometryCache {\n [key: string]: IExtrudeGeomety;\n}\nconst GeometryCache: IGeometryCache = {};\n/**\n * 计算2D 填充点图顶点\n * @param feature 映射feature\n */\n\nexport function PointFillTriangulation(feature: IEncodeFeature) {\n const coordinates = calculateCentroid(feature.coordinates);\n return {\n vertices: [...coordinates, ...coordinates, ...coordinates, ...coordinates],\n indices: [0, 1, 2, 2, 3, 0],\n size: coordinates.length,\n };\n}\n\n/**\n * 计算3D 拉伸点图\n * @param feature 映射feature\n */\nexport function PointExtrudeTriangulation(feature: IEncodeFeature) {\n const { shape } = feature;\n // console.log('PointExtrudeTriangulation', feature)\n const { positions, index, normals } = getGeometry(\n shape as ShapeType3D,\n false,\n );\n return {\n vertices: positions,\n indices: index,\n normals,\n size: 5,\n };\n}\n\n/**\n * 计算图片标注\n * @param feature 映射feature\n */\nexport function PointImageTriangulation(feature: IEncodeFeature) {\n const coordinates = calculateCentroid(feature.coordinates);\n return {\n vertices: [...coordinates],\n indices: [0],\n size: coordinates.length,\n };\n}\n\n/**\n * 线三角化\n * @param feature 映射feature\n */\nexport function LineTriangulation(feature: IEncodeFeature) {\n const { coordinates, originCoordinates, version } = feature;\n // let path = coordinates as number[][][] | number[][];\n // if (!Array.isArray(path[0][0])) {\n // path = [coordinates] as number[][][];\n // }\n\n const line = new ExtrudePolyline({\n dash: true,\n join: 'bevel',\n });\n\n if (version === 'GAODE2.x') {\n // 处理高德2.0几何体构建\n let path1 = coordinates as number[][][] | number[][]; // 计算位置\n if (!Array.isArray(path1[0][0])) {\n path1 = [coordinates] as number[][][];\n }\n let path2 = originCoordinates as number[][][] | number[][]; // 计算法线\n if (!Array.isArray(path2[0][0])) {\n path2 = [originCoordinates] as number[][][];\n }\n\n for (let i = 0; i < path1.length; i++) {\n // 高德2.0在计算线时,需要使用经纬度计算发现,使用 customCoords.lnglatToCoords 计算的数据来计算顶点的位置\n const item1 = path1[i];\n const item2 = path2[i];\n line.extrude_gaode2(item1 as number[][], item2 as number[][]);\n }\n } else {\n // 处理非高德2.0的几何体构建\n let path = coordinates as number[][][] | number[][];\n if (!Array.isArray(path[0][0])) {\n path = [coordinates] as number[][][];\n }\n path.forEach((item: any) => {\n line.extrude(item as number[][]);\n });\n }\n\n const linebuffer = line.complex;\n return {\n vertices: linebuffer.positions, // [ x,y,z, distance, miter,total ]\n indices: linebuffer.indices,\n normals: linebuffer.normals,\n size: 6,\n };\n}\n\nexport function polygonTriangulation(feature: IEncodeFeature) {\n const { coordinates } = feature;\n const flattengeo = earcut.flatten(coordinates as number[][][]);\n const { vertices, dimensions, holes } = flattengeo;\n\n return {\n indices: earcut(vertices, holes, dimensions),\n vertices,\n size: dimensions,\n };\n}\n\nexport function PolygonExtrudeTriangulation(feature: IEncodeFeature) {\n const coordinates = feature.coordinates as IPosition[][];\n const { positions, index, normals } = extrude_PolygonNormal(\n coordinates,\n true,\n );\n\n return {\n vertices: positions, // [ x, y, z, uv.x,uv.y ]\n indices: index,\n normals,\n size: 5,\n };\n}\n\nexport function HeatmapGridTriangulation(feature: IEncodeFeature) {\n const { shape } = feature;\n const { positions, index } = getHeatmapGeometry(shape as IShape);\n return {\n vertices: positions, // [ x, y, z ] 多边形顶点\n indices: index,\n size: 3,\n };\n}\n\n/**\n * 图片图层顶点构造\n * @param feature 数据\n */\nexport function RasterImageTriangulation(feature: IEncodeFeature) {\n const coordinates = feature.coordinates as IPosition[];\n // [ x, y, z. uv.x, uv.y]\n const positions: number[] = [\n ...coordinates[0],\n 0,\n 0,\n 1,\n coordinates[1][0],\n coordinates[0][1],\n 0,\n 1,\n 1,\n ...coordinates[1],\n 0,\n 1,\n 0,\n ...coordinates[0],\n 0,\n 0,\n 1,\n ...coordinates[1],\n 0,\n 1,\n 0,\n coordinates[0][0],\n coordinates[1][1],\n 0,\n 0,\n 0,\n ];\n const indexs = [0, 1, 2, 3, 4, 5];\n return {\n vertices: positions,\n indices: indexs,\n size: 5,\n };\n}\n/**\n * 计算3D弧线顶点\n * @param feature 映射数据\n * @param segNum 弧线线段数\n */\nexport function LineArcTriangulation(\n feature: IEncodeFeature,\n segmentNumber?: number,\n) {\n const segNum = segmentNumber ? segmentNumber : 30;\n const coordinates = feature.coordinates as IPosition[];\n const positions = [];\n const indexArray = [];\n for (let i = 0; i < segNum; i++) {\n // 上线两个顶点\n // [ x, y, z, sx,sy, tx,ty]\n positions.push(\n i,\n 1,\n i,\n coordinates[0][0],\n coordinates[0][1],\n coordinates[1][0],\n coordinates[1][1],\n i,\n -1,\n i,\n coordinates[0][0],\n coordinates[0][1],\n coordinates[1][0],\n coordinates[1][1],\n );\n\n if (i !== segNum - 1) {\n indexArray.push(\n ...[0, 1, 2, 1, 3, 2].map((v) => {\n return i * 2 + v;\n }),\n );\n }\n }\n return {\n vertices: positions,\n indices: indexArray,\n size: 7,\n };\n}\n\n/**\n * 构建热力图密度图的顶点\n * @param feature\n * @returns\n */\nexport function HeatmapTriangulation(feature: IEncodeFeature) {\n const coordinates = feature.coordinates as number[];\n if (coordinates.length === 2) {\n coordinates.push(0);\n }\n const size = feature.size as number;\n const dir = addDir(-1, 1);\n const dir1 = addDir(1, 1);\n const dir2 = addDir(-1, -1);\n const dir3 = addDir(1, -1);\n // [x,y,z, dirx ,diry, weight]\n const positions = [\n ...coordinates,\n ...dir,\n ...coordinates,\n ...dir2,\n ...coordinates,\n ...dir3,\n ...coordinates,\n ...dir1,\n ];\n const indexArray = [0, 1, 2, 3, 0, 2];\n return {\n vertices: positions,\n indices: indexArray,\n size: 5,\n };\n}\n\n/**\n * 点图层3d geomerty\n * @param shape 3D形状\n */\nfunction getGeometry(shape: ShapeType3D, needFlat = false): IExtrudeGeomety {\n if (GeometryCache && GeometryCache[shape]) {\n return GeometryCache[shape];\n }\n const path = geometryShape[shape]\n ? geometryShape[shape]()\n : geometryShape.cylinder();\n const geometry = extrude_PolygonNormal([path], needFlat);\n GeometryCache[shape] = geometry;\n // console.log('geometry', geometry)\n return geometry;\n}\n\nfunction computeVertexNormals(\n positions: number[],\n indexArray: number[],\n dim: number = 3,\n needFlat: boolean = false,\n) {\n const normals = new Float32Array((positions.length / dim) * 3);\n let vA: number;\n let vB: number;\n let vC: number;\n const cb = vec3.create();\n const ab = vec3.create();\n const normal = vec3.create();\n for (let i = 0, li = indexArray.length; i < li; i += 3) {\n vA = indexArray[i + 0] * 3;\n vB = indexArray[i + 1] * 3;\n vC = indexArray[i + 2] * 3;\n let p1 = [positions[vA], positions[vA + 1]];\n let p2 = [positions[vB], positions[vB + 1]];\n let p3 = [positions[vC], positions[vC + 1]];\n if (needFlat) {\n p1 = lngLatToMeters(p1);\n p2 = lngLatToMeters(p2);\n p3 = lngLatToMeters(p3);\n }\n const [ax, ay] = p1;\n const pA = vec3.fromValues(ax, ay, positions[vA + 2]);\n const [bx, by] = p2;\n const pB = vec3.fromValues(bx, by, positions[vB + 2]);\n const [cx, cy] = p3;\n const pC = vec3.fromValues(cx, cy, positions[vC + 2]);\n vec3.sub(cb, pC, pB);\n vec3.sub(ab, pA, pB);\n vec3.cross(normal, cb, ab);\n normals[vA] += cb[0];\n normals[vA + 1] += cb[1];\n normals[vA + 2] += cb[2];\n normals[vB] += cb[0];\n normals[vB + 1] += cb[1];\n normals[vB + 2] += cb[2];\n normals[vC] += cb[0];\n normals[vC + 1] += cb[1];\n normals[vC + 2] += cb[2];\n }\n normalizeNormals(normals);\n return normals;\n}\n\nfunction normalizeNormals(normals: Float32Array) {\n for (let i = 0, li = normals.length; i < li; i += 3) {\n const normal = vec3.fromValues(normals[i], normals[i + 1], normals[i + 2]);\n const newNormal = vec3.create();\n vec3.normalize(newNormal, normal);\n normals.set(newNormal, i);\n }\n}\n\nfunction checkIsClosed(points: number[][][]) {\n const p1 = points[0][0];\n const p2 = points[0][points[0].length - 1];\n return p1[0] === p2[0] && p1[1] === p2[1];\n}\n\nfunction getHeatmapGeometry(shape: ShapeType2D | ShapeType3D): IExtrudeGeomety {\n const shape3d = [\n 'cylinder',\n 'triangleColumn',\n 'hexagonColumn',\n 'squareColumn',\n ];\n const path = geometryShape[shape]\n ? geometryShape[shape]()\n : geometryShape.circle();\n const geometry =\n shape3d.indexOf(shape) === -1\n ? fillPolygon([path])\n : extrudePolygon([path]);\n // const geometry = fillPolygon([path]);\n return geometry;\n}\n// 热力图计算范围\nfunction addDir(dirX: number, dirY: number) {\n const x = (dirX + 1) / 2;\n const y = (dirY + 1) / 2;\n return [x, y];\n}\n"],"file":"triangulation.js"}
|
|
1
|
+
{"version":3,"sources":["../../src/core/triangulation.ts"],"names":["lngLatToMeters","earcut","mat4","vec3","ExtrudePolyline","calculateCentroid","extrudePolygon","extrude_PolygonNormal","fillPolygon","geometryShape","GeometryCache","EARTH_RADIUS","EARTH_SEGMENTS","PointFillTriangulation","feature","coordinates","vertices","indices","size","length","GlobelPointFillTriangulation","xyz","lglt2xyz","torad","deg","Math","acos","lnglat","lng","PI","lat","z","cos","x","sin","y","PointExtrudeTriangulation","shape","getGeometry","positions","index","normals","PointImageTriangulation","LineTriangulation","originCoordinates","version","line","dash","join","path1","Array","isArray","path2","i","item1","item2","extrude_gaode2","path","forEach","item","extrude","linebuffer","complex","polygonTriangulation","flattengeo","flatten","dimensions","holes","PolygonExtrudeTriangulation","HeatmapGridTriangulation","getHeatmapGeometry","RasterImageTriangulation","indexs","LineArcTriangulation","segmentNumber","segNum","indexArray","push","map","v","HeatmapTriangulation","dir","addDir","dir1","dir2","dir3","needFlat","cylinder","geometry","computeVertexNormals","dim","Float32Array","vA","vB","vC","cb","create","ab","normal","li","p1","p2","p3","ax","ay","pA","fromValues","bx","by","pB","cx","cy","pC","sub","cross","normalizeNormals","newNormal","normalize","set","checkIsClosed","points","shape3d","circle","indexOf","dirX","dirY","earthTriangulation","mesh","primitiveSphere","segments","positionsArr","indicesArr","normalArr","radius","opt","matRotY","matRotZ","up","tmpVec3","totalZRotationSteps","totalYRotationSteps","uvs","zRotationStep","normalizedZ","angleZ","yRotationStep","normalizedY","angleY","identity","rotateZ","rotateY","transformMat4","scale","slice","verticesCount","firstIndex","cells"],"mappings":";;AACA,SAAuBA,cAAvB,QAA6C,gBAA7C;AACA,OAAOC,MAAP,MAAmB,QAAnB;AAEA,SAASC,IAAT,EAAeC,IAAf,QAA2B,WAA3B;AACA,OAAOC,eAAP,MAA4B,2BAA5B;AACA,SAASC,iBAAT,QAAkC,cAAlC;AACA,OAAOC,cAAP,IACEC,qBADF,EAEEC,WAFF,QAIO,iBAJP;AAKA,SACEC,aADF,QAKO,cALP;AAUA,IAAMC,aAA6B,GAAG,EAAtC;AAGA,IAAMC,YAAY,GAAG,GAArB;AACA,IAAMC,cAAc,GAAG,EAAvB;AAMA,OAAO,SAASC,sBAAT,CAAgCC,OAAhC,EAAyD;AAC9D,MAAMC,WAAW,GAAGV,iBAAiB,CAACS,OAAO,CAACC,WAAT,CAArC;AACA,S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at, lngLatToMeters } from '@antv/l7-utils';\nimport earcut from 'earcut';\n// @ts-ignore\nimport { mat4, vec3 } from 'gl-matrix';\nimport ExtrudePolyline from '../utils/extrude_polyline';\nimport { calculateCentroid } from '../utils/geo';\nimport extrudePolygon, {\n extrude_PolygonNormal,\n fillPolygon,\n IExtrudeGeomety,\n} from './shape/extrude';\nimport {\n geometryShape,\n IPosition,\n ShapeType2D,\n ShapeType3D,\n} from './shape/Path';\ntype IShape = ShapeType2D & ShapeType3D;\ninterface IGeometryCache {\n [key: string]: IExtrudeGeomety;\n}\nconst GeometryCache: IGeometryCache = {};\n\n// 地球网格半径\nconst EARTH_RADIUS = 100;\nconst EARTH_SEGMENTS = 36;\n/**\n * 计算2D 填充点图顶点\n * @param feature 映射feature\n */\n\nexport function PointFillTriangulation(feature: IEncodeFeature) {\n const coordinates = calculateCentroid(feature.coordinates);\n return {\n vertices: [...coordinates, ...coordinates, ...coordinates, ...coordinates],\n indices: [0, 1, 2, 2, 3, 0],\n size: coordinates.length,\n };\n}\n/**\n * 计算2D 填充点图顶点 (地球模式)\n * @param feature 映射feature\n */\nexport function GlobelPointFillTriangulation(feature: IEncodeFeature) {\n const coordinates = calculateCentroid(feature.coordinates);\n const xyz = lglt2xyz(coordinates as [number, number]);\n return {\n vertices: [...xyz, ...xyz, ...xyz, ...xyz],\n indices: [0, 1, 2, 2, 3, 0],\n size: xyz.length,\n };\n}\n\nfunction torad(deg: number) {\n return (deg / 180) * Math.acos(-1);\n}\n/**\n * 经纬度转xyz\n * @param longitude 经度\n * @param latitude 纬度\n * @param radius 半径\n */\nfunction lglt2xyz(lnglat: [number, number]) {\n // TODO: + Math.PI/2 是为了对齐坐标\n const lng = torad(lnglat[0]) + Math.PI / 2;\n const lat = torad(lnglat[1]);\n\n const z = EARTH_RADIUS * Math.cos(lat) * Math.cos(lng);\n const x = EARTH_RADIUS * Math.cos(lat) * Math.sin(lng);\n const y = EARTH_RADIUS * Math.sin(lat);\n return [x, y, z];\n}\n\n/**\n * 计算3D 拉伸点图\n * @param feature 映射feature\n */\nexport function PointExtrudeTriangulation(feature: IEncodeFeature) {\n const { shape } = feature;\n // console.log('PointExtrudeTriangulation', feature)\n const { positions, index, normals } = getGeometry(\n shape as ShapeType3D,\n false,\n );\n return {\n vertices: positions,\n indices: index,\n normals,\n size: 5,\n };\n}\n\n/**\n * 计算图片标注\n * @param feature 映射feature\n */\nexport function PointImageTriangulation(feature: IEncodeFeature) {\n const coordinates = calculateCentroid(feature.coordinates);\n return {\n vertices: [...coordinates],\n indices: [0],\n size: coordinates.length,\n };\n}\n\n/**\n * 线三角化\n * @param feature 映射feature\n */\nexport function LineTriangulation(feature: IEncodeFeature) {\n const { coordinates, originCoordinates, version } = feature;\n // let path = coordinates as number[][][] | number[][];\n // if (!Array.isArray(path[0][0])) {\n // path = [coordinates] as number[][][];\n // }\n\n const line = new ExtrudePolyline({\n dash: true,\n join: 'bevel',\n });\n\n if (version === 'GAODE2.x') {\n // 处理高德2.0几何体构建\n let path1 = coordinates as number[][][] | number[][]; // 计算位置\n if (!Array.isArray(path1[0][0])) {\n path1 = [coordinates] as number[][][];\n }\n let path2 = originCoordinates as number[][][] | number[][]; // 计算法线\n if (!Array.isArray(path2[0][0])) {\n path2 = [originCoordinates] as number[][][];\n }\n\n for (let i = 0; i < path1.length; i++) {\n // 高德2.0在计算线时,需要使用经纬度计算发现,使用 customCoords.lnglatToCoords 计算的数据来计算顶点的位置\n const item1 = path1[i];\n const item2 = path2[i];\n line.extrude_gaode2(item1 as number[][], item2 as number[][]);\n }\n } else {\n // 处理非高德2.0的几何体构建\n let path = coordinates as number[][][] | number[][];\n if (!Array.isArray(path[0][0])) {\n path = [coordinates] as number[][][];\n }\n path.forEach((item: any) => {\n line.extrude(item as number[][]);\n });\n }\n\n const linebuffer = line.complex;\n return {\n vertices: linebuffer.positions, // [ x,y,z, distance, miter,total ]\n indices: linebuffer.indices,\n normals: linebuffer.normals,\n size: 6,\n };\n}\n\nexport function polygonTriangulation(feature: IEncodeFeature) {\n const { coordinates } = feature;\n const flattengeo = earcut.flatten(coordinates as number[][][]);\n const { vertices, dimensions, holes } = flattengeo;\n return {\n indices: earcut(vertices, holes, dimensions),\n vertices,\n size: dimensions,\n };\n}\n\nexport function PolygonExtrudeTriangulation(feature: IEncodeFeature) {\n const coordinates = feature.coordinates as IPosition[][];\n const { positions, index, normals } = extrude_PolygonNormal(\n coordinates,\n true,\n );\n return {\n vertices: positions, // [ x, y, z, uv.x,uv.y ]\n indices: index,\n normals,\n size: 5,\n };\n}\n\nexport function HeatmapGridTriangulation(feature: IEncodeFeature) {\n const { shape } = feature;\n const { positions, index } = getHeatmapGeometry(shape as IShape);\n return {\n vertices: positions, // [ x, y, z ] 多边形顶点\n indices: index,\n size: 3,\n };\n}\n\n/**\n * 图片图层顶点构造\n * @param feature 数据\n */\nexport function RasterImageTriangulation(feature: IEncodeFeature) {\n const coordinates = feature.coordinates as IPosition[];\n // [ x, y, z. uv.x, uv.y]\n const positions: number[] = [\n ...coordinates[0],\n 0,\n 0,\n 1,\n coordinates[1][0],\n coordinates[0][1],\n 0,\n 1,\n 1,\n ...coordinates[1],\n 0,\n 1,\n 0,\n ...coordinates[0],\n 0,\n 0,\n 1,\n ...coordinates[1],\n 0,\n 1,\n 0,\n coordinates[0][0],\n coordinates[1][1],\n 0,\n 0,\n 0,\n ];\n const indexs = [0, 1, 2, 3, 4, 5];\n return {\n vertices: positions,\n indices: indexs,\n size: 5,\n };\n}\n/**\n * 计算3D弧线顶点\n * @param feature 映射数据\n * @param segNum 弧线线段数\n */\nexport function LineArcTriangulation(\n feature: IEncodeFeature,\n segmentNumber?: number,\n) {\n const segNum = segmentNumber ? segmentNumber : 30;\n const coordinates = feature.coordinates as IPosition[];\n const positions = [];\n const indexArray = [];\n for (let i = 0; i < segNum; i++) {\n // 上线两个顶点\n // [ x, y, z, sx,sy, tx,ty]\n positions.push(\n i,\n 1,\n i,\n coordinates[0][0],\n coordinates[0][1],\n coordinates[1][0],\n coordinates[1][1],\n i,\n -1,\n i,\n coordinates[0][0],\n coordinates[0][1],\n coordinates[1][0],\n coordinates[1][1],\n );\n\n if (i !== segNum - 1) {\n indexArray.push(\n ...[0, 1, 2, 1, 3, 2].map((v) => {\n return i * 2 + v;\n }),\n );\n }\n }\n return {\n vertices: positions,\n indices: indexArray,\n size: 7,\n };\n}\n\n/**\n * 构建热力图密度图的顶点\n * @param feature\n * @returns\n */\nexport function HeatmapTriangulation(feature: IEncodeFeature) {\n const coordinates = feature.coordinates as number[];\n if (coordinates.length === 2) {\n coordinates.push(0);\n }\n const size = feature.size as number;\n const dir = addDir(-1, 1);\n const dir1 = addDir(1, 1);\n const dir2 = addDir(-1, -1);\n const dir3 = addDir(1, -1);\n // [x,y,z, dirx ,diry, weight]\n const positions = [\n ...coordinates,\n ...dir,\n ...coordinates,\n ...dir2,\n ...coordinates,\n ...dir3,\n ...coordinates,\n ...dir1,\n ];\n const indexArray = [0, 1, 2, 3, 0, 2];\n return {\n vertices: positions,\n indices: indexArray,\n size: 5,\n };\n}\n\n/**\n * 点图层3d geomerty\n * @param shape 3D形状\n */\nfunction getGeometry(shape: ShapeType3D, needFlat = false): IExtrudeGeomety {\n if (GeometryCache && GeometryCache[shape]) {\n return GeometryCache[shape];\n }\n const path = geometryShape[shape]\n ? geometryShape[shape]()\n : geometryShape.cylinder();\n const geometry = extrude_PolygonNormal([path], needFlat);\n GeometryCache[shape] = geometry;\n // console.log('geometry', geometry)\n return geometry;\n}\n\nfunction computeVertexNormals(\n positions: number[],\n indexArray: number[],\n dim: number = 3,\n needFlat: boolean = false,\n) {\n const normals = new Float32Array((positions.length / dim) * 3);\n let vA: number;\n let vB: number;\n let vC: number;\n const cb = vec3.create();\n const ab = vec3.create();\n const normal = vec3.create();\n for (let i = 0, li = indexArray.length; i < li; i += 3) {\n vA = indexArray[i + 0] * 3;\n vB = indexArray[i + 1] * 3;\n vC = indexArray[i + 2] * 3;\n let p1 = [positions[vA], positions[vA + 1]];\n let p2 = [positions[vB], positions[vB + 1]];\n let p3 = [positions[vC], positions[vC + 1]];\n if (needFlat) {\n p1 = lngLatToMeters(p1);\n p2 = lngLatToMeters(p2);\n p3 = lngLatToMeters(p3);\n }\n const [ax, ay] = p1;\n const pA = vec3.fromValues(ax, ay, positions[vA + 2]);\n const [bx, by] = p2;\n const pB = vec3.fromValues(bx, by, positions[vB + 2]);\n const [cx, cy] = p3;\n const pC = vec3.fromValues(cx, cy, positions[vC + 2]);\n vec3.sub(cb, pC, pB);\n vec3.sub(ab, pA, pB);\n vec3.cross(normal, cb, ab);\n normals[vA] += cb[0];\n normals[vA + 1] += cb[1];\n normals[vA + 2] += cb[2];\n normals[vB] += cb[0];\n normals[vB + 1] += cb[1];\n normals[vB + 2] += cb[2];\n normals[vC] += cb[0];\n normals[vC + 1] += cb[1];\n normals[vC + 2] += cb[2];\n }\n normalizeNormals(normals);\n return normals;\n}\n\nfunction normalizeNormals(normals: Float32Array) {\n for (let i = 0, li = normals.length; i < li; i += 3) {\n const normal = vec3.fromValues(normals[i], normals[i + 1], normals[i + 2]);\n const newNormal = vec3.create();\n vec3.normalize(newNormal, normal);\n normals.set(newNormal, i);\n }\n}\n\nfunction checkIsClosed(points: number[][][]) {\n const p1 = points[0][0];\n const p2 = points[0][points[0].length - 1];\n return p1[0] === p2[0] && p1[1] === p2[1];\n}\n\nfunction getHeatmapGeometry(shape: ShapeType2D | ShapeType3D): IExtrudeGeomety {\n const shape3d = [\n 'cylinder',\n 'triangleColumn',\n 'hexagonColumn',\n 'squareColumn',\n ];\n const path = geometryShape[shape]\n ? geometryShape[shape]()\n : geometryShape.circle();\n const geometry =\n shape3d.indexOf(shape) === -1\n ? fillPolygon([path])\n : extrudePolygon([path]);\n // const geometry = fillPolygon([path]);\n return geometry;\n}\n// 热力图计算范围\nfunction addDir(dirX: number, dirY: number) {\n const x = (dirX + 1) / 2;\n const y = (dirY + 1) / 2;\n return [x, y];\n}\n\n/**\n * 构建地球三角网格\n * @returns\n */\nexport function earthTriangulation() {\n const mesh = primitiveSphere(EARTH_RADIUS, { segments: EARTH_SEGMENTS });\n const { positionsArr, indicesArr, normalArr } = mesh;\n return {\n vertices: positionsArr,\n indices: indicesArr,\n size: 5,\n normals: normalArr,\n };\n}\n\n/**\n * 构建地球球体网格\n * @param radius\n * @param opt\n * @returns\n */\nfunction primitiveSphere(\n radius: number,\n opt: {\n segments: number;\n },\n) {\n const matRotY = mat4.create();\n const matRotZ = mat4.create();\n const up = vec3.fromValues(0, 1, 0);\n const tmpVec3 = vec3.fromValues(0, 0, 0);\n\n opt = opt || {};\n radius = typeof radius !== 'undefined' ? radius : 1;\n const segments = typeof opt.segments !== 'undefined' ? opt.segments : 32;\n\n const totalZRotationSteps = 2 + segments;\n const totalYRotationSteps = 2 * totalZRotationSteps;\n\n const indices = [];\n const indicesArr = [];\n const positions = [];\n const positionsArr = [];\n const normals = [];\n const normalArr = [];\n const uvs = [];\n\n for (\n let zRotationStep = 0;\n zRotationStep <= totalZRotationSteps;\n zRotationStep++\n ) {\n const normalizedZ = zRotationStep / totalZRotationSteps;\n const angleZ = normalizedZ * Math.PI;\n\n for (\n let yRotationStep = 0;\n yRotationStep <= totalYRotationSteps;\n yRotationStep++\n ) {\n const normalizedY = yRotationStep / totalYRotationSteps;\n const angleY = normalizedY * Math.PI * 2;\n\n mat4.identity(matRotZ);\n mat4.rotateZ(matRotZ, matRotZ, -angleZ);\n\n mat4.identity(matRotY);\n mat4.rotateY(matRotY, matRotY, angleY);\n\n vec3.transformMat4(tmpVec3, up, matRotZ);\n vec3.transformMat4(tmpVec3, tmpVec3, matRotY);\n\n vec3.scale(tmpVec3, tmpVec3, -radius);\n\n positions.push(tmpVec3.slice());\n positionsArr.push(...tmpVec3.slice());\n\n vec3.normalize(tmpVec3, tmpVec3);\n normals.push(tmpVec3.slice());\n normalArr.push(...tmpVec3.slice());\n\n uvs.push([normalizedY, 1 - normalizedZ]);\n\n // position 和 uv 一起存储\n positionsArr.push(normalizedY, 1 - normalizedZ);\n }\n\n if (zRotationStep > 0) {\n const verticesCount = positions.length;\n let firstIndex = verticesCount - 2 * (totalYRotationSteps + 1);\n for (\n ;\n firstIndex + totalYRotationSteps + 2 < verticesCount;\n firstIndex++\n ) {\n indices.push([\n firstIndex,\n firstIndex + 1,\n firstIndex + totalYRotationSteps + 1,\n ]);\n\n indicesArr.push(\n firstIndex,\n firstIndex + 1,\n firstIndex + totalYRotationSteps + 1,\n );\n indices.push([\n firstIndex + totalYRotationSteps + 1,\n firstIndex + 1,\n firstIndex + totalYRotationSteps + 2,\n ]);\n indicesArr.push(\n firstIndex + totalYRotationSteps + 1,\n firstIndex + 1,\n firstIndex + totalYRotationSteps + 2,\n );\n }\n }\n }\n\n return {\n cells: indices,\n positions,\n normals,\n uvs,\n positionsArr,\n indicesArr,\n normalArr,\n };\n}\n"],"file":"triangulation.js"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import BaseLayer from '../core/BaseLayer';
|
|
2
|
+
export declare type EarthType = 'base';
|
|
3
|
+
interface IEarthLayerStyleOptions {
|
|
4
|
+
setEarthTime(time: number): void;
|
|
5
|
+
}
|
|
6
|
+
export default class EarthLayer extends BaseLayer<IEarthLayerStyleOptions> {
|
|
7
|
+
type: string;
|
|
8
|
+
buildModels(): void;
|
|
9
|
+
/**
|
|
10
|
+
* 设置当前地球时间
|
|
11
|
+
* @param time
|
|
12
|
+
*/
|
|
13
|
+
setEarthTime(time: number): void;
|
|
14
|
+
}
|
|
15
|
+
export {};
|