@antv/l7-layers 2.8.20 → 2.8.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/core/BaseModel.ts"],"names":["BaseModel","TYPES","IGlobalConfigService","layer","rendererService","getContainer","get","IRendererService","shaderModuleService","IShaderModuleService","styleAttributeService","IStyleAttributeService","mapService","IMapService","iconService","IIconService","fontService","IFontService","cameraService","ICameraService","layerService","ILayerService","registerBuiltinAttributes","startModelAnimate","createTexture2D","DATA_TEXTURE_WIDTH","rowCount","cellLength","cellProperties","cacheStyleProperties","thetaOffset","undefined","opacity","strokeOpacity","strokeWidth","stroke","offsets","stylePropertyesExist","hasThetaOffset","hasOpacity","hasStrokeOpacity","hasStrokeWidth","hasStroke","hasOffsets","dataTextureTest","getOESTextureFloat","dataTexture","data","Uint8Array","mag","gl","NEAREST","min","width","height","options","isUpdate","clearLastCalRes","push","attr","count","isStaticColor","isOffsetStatic","strokeColor","length","d","i","cellData","cellPropertiesLayouts","layout","value","patchMod","encodeData","encodeDatalength","Math","ceil","totalLength","patchData","getLayerConfig","blend","BlendTypes","BlendType","Error","option","enable","duration","interval","trailLength","animateOption","setAnimateStartTime"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AA4BA;;AACA;;AAEA;;;;;;;;;;IA0BqBA,S,WAoClB,wBAAWC,cAAMC,oBAAjB,C;AAsBD,qBAAYC,KAAZ,EAA2B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACzB,SAAKA,KAAL,GAAaA,KAAb;AACA,SAAKC,eAAL,GAAuBD,KAAK,CACzBE,YADoB,GAEpBC,GAFoB,CAEEL,cAAMM,gBAFR,CAAvB;AAGA,SAAKC,mBAAL,GAA2BL,KAAK,CAC7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AAV,CAAN;AACD;;;WACD,qCAAsC;AACpC,YAAM,IAAIA,KAAJ,CAAU,yBAAV,CAAN;AACD;;;WACD,6BAA8BC,MAA9B,EAAgE;AAC9D,aAAO,CACLA,MAAM,CAACC,MAAP,GAAgB,CAAhB,GAAoB,GADf,EAELD,MAAM,CAACE,QAAP,IAAmB,GAFd,EAGLF,MAAM,CAACG,QAAP,IAAmB,GAHd,EAILH,MAAM,CAACI,WAAP,IAAsB,GAJjB,CAAP;AAMD;;;WACD,6BAA8B;AAC5B,iBAA0B,KAAKpF,KAAL,CAAW2E,cAAX,EAA1B;AAAA,UAAQU,aAAR,QAAQA,aAAR;;AACA,UAAIA,aAAa,CAACJ,MAAlB,EAA0B;AACxB,aAAKjF,KAAL,CAAWsF,mBAAX;AACD;AACF","sourcesContent":["import {\n BlendType,\n gl,\n IAnimateOption,\n IAttribute,\n IBlendOptions,\n ICameraService,\n IElements,\n IEncodeFeature,\n IFontService,\n IGlobalConfigService,\n IIconService,\n ILayer,\n ILayerConfig,\n ILayerModel,\n ILayerService,\n IMapService,\n IModel,\n IModelUniform,\n IRendererService,\n IShaderModuleService,\n IStyleAttributeService,\n ITexture2D,\n ITexture2DInitializationOptions,\n lazyInject,\n Triangulation,\n TYPES,\n} from '@antv/l7-core';\nimport { rgb2arr } from '@antv/l7-utils';\nimport { color } from 'd3-color';\nimport { isArray, isEqual, isFunction, isNumber, isString } from 'lodash';\nimport { BlendTypes } from '../utils/blend';\n\nexport type styleSingle =\n | number\n | string\n | [string, (single: any) => number]\n | [string, [number, number]];\nexport type styleOffset =\n | string\n | [number, number]\n | [string, (single: any) => number];\nexport type styleColor =\n | string\n | [string, (single: any) => string]\n | [string, [string, string]];\nexport interface IDataTextureFrame {\n data: number[];\n width: number;\n height: number;\n}\n\nexport interface ICellProperty {\n attr: string;\n count: number;\n}\n\nexport default class BaseModel<ChildLayerStyleOptions = {}>\n implements ILayerModel {\n public triangulation: Triangulation;\n\n // style texture data mapping\n public createTexture2D: (\n options: ITexture2DInitializationOptions,\n ) => ITexture2D;\n\n protected layer: ILayer;\n protected dataTexture: ITexture2D; // 用于数据传递的数据纹理\n protected DATA_TEXTURE_WIDTH: number; // 默认有多少列(宽度)\n protected rowCount: number; // 计算得到的当前数据纹理有多少行(高度)\n protected cacheStyleProperties: {\n // 记录存储上一次样式字段的值\n thetaOffset: styleSingle | undefined;\n opacity: styleSingle | undefined;\n strokeOpacity: styleSingle | undefined;\n strokeWidth: styleSingle | undefined;\n stroke: styleColor | undefined;\n offsets: styleOffset | undefined;\n };\n protected cellLength: number; // 单个 cell 的长度\n protected cellProperties: ICellProperty[]; // 需要进行数据映射的属性集合\n protected cellTypeLayout: number[];\n protected stylePropertyesExist: {\n // 记录 style 属性是否存在的中间变量\n hasThetaOffset: number;\n hasOpacity: number;\n hasStrokeOpacity: number;\n hasStrokeWidth: number;\n hasStroke: number;\n hasOffsets: number;\n };\n protected dataTextureTest: boolean;\n\n @lazyInject(TYPES.IGlobalConfigService)\n protected readonly configService: IGlobalConfigService;\n\n // @lazyInject(TYPES.IIconService)\n // protected readonly iconService: IIconService;\n\n // @lazyInject(TYPES.IFontService)\n // protected readonly fontService: IFontService;\n\n // @lazyInject(TYPES.IShaderModuleService)\n protected shaderModuleService: IShaderModuleService;\n\n protected rendererService: IRendererService;\n protected iconService: IIconService;\n protected fontService: IFontService;\n protected styleAttributeService: IStyleAttributeService;\n protected mapService: IMapService;\n protected cameraService: ICameraService;\n protected layerService: ILayerService;\n\n // style texture data mapping\n\n constructor(layer: ILayer) {\n this.layer = layer;\n this.rendererService = layer\n .getContainer()\n .get<IRendererService>(TYPES.IRendererService);\n this.shaderModuleService = layer\n .getContainer()\n .get<IShaderModuleService>(TYPES.IShaderModuleService);\n\n this.styleAttributeService = layer\n .getContainer()\n .get<IStyleAttributeService>(TYPES.IStyleAttributeService);\n this.mapService = layer.getContainer().get<IMapService>(TYPES.IMapService);\n this.iconService = layer\n .getContainer()\n .get<IIconService>(TYPES.IIconService);\n this.fontService = layer\n .getContainer()\n .get<IFontService>(TYPES.IFontService);\n this.cameraService = layer\n .getContainer()\n .get<ICameraService>(TYPES.ICameraService);\n this.layerService = layer\n .getContainer()\n .get<ILayerService>(TYPES.ILayerService);\n\n // 注册 Attribute\n this.registerBuiltinAttributes();\n // 开启动画\n this.startModelAnimate();\n\n const { createTexture2D } = this.rendererService;\n this.createTexture2D = createTexture2D;\n this.DATA_TEXTURE_WIDTH = 1024; // 数据纹理固定宽度\n this.rowCount = 1;\n this.cellLength = 0;\n this.cellProperties = [];\n this.cacheStyleProperties = {\n thetaOffset: undefined,\n opacity: undefined,\n strokeOpacity: undefined,\n strokeWidth: undefined,\n stroke: undefined,\n offsets: undefined,\n };\n this.stylePropertyesExist = {\n hasThetaOffset: 0,\n hasOpacity: 0,\n hasStrokeOpacity: 0,\n hasStrokeWidth: 0,\n hasStroke: 0,\n hasOffsets: 0,\n };\n this.dataTextureTest = this.layerService.getOESTextureFloat();\n // 只有在不支持数据纹理的情况下进行赋值\n if (!this.dataTextureTest) {\n this.dataTexture = this.createTexture2D({\n // data: new Uint8ClampedArray(4),\n // 使用 Uint8ClampedArray 在 支付宝 环境中可能存在问题 UC 内核对格式有要求 L7 v2.7.18 版本发现\n // Uint8ClampedArray 和 Uint8Array 没有实质性的区别\n data: new Uint8Array(4),\n mag: gl.NEAREST,\n min: gl.NEAREST,\n width: 1,\n height: 1,\n });\n }\n }\n\n // style datatexture mapping\n\n /**\n * 清除上一次的计算结果 - 全量清除\n */\n public clearLastCalRes() {\n this.cellProperties = []; // 清空上一次计算的需要进行数据映射的属性集合\n this.cellLength = 0; // 清空上一次计算的 cell 的长度\n this.stylePropertyesExist = {\n // 全量清空上一次是否需要对 style 属性进行数据映射的判断\n hasThetaOffset: 0,\n hasOpacity: 0,\n hasStrokeOpacity: 0,\n hasStrokeWidth: 0,\n hasStroke: 0,\n hasOffsets: 0,\n };\n }\n\n public getCellTypeLayout() {\n if (this.dataTextureTest) {\n return [\n // 0\n this.rowCount, // 数据纹理有几行\n this.DATA_TEXTURE_WIDTH, // 数据纹理有几列\n 0.0,\n 0.0,\n // 1\n this.stylePropertyesExist.hasOpacity, // cell 中是否存在 opacity\n this.stylePropertyesExist.hasStrokeOpacity, // cell 中是否存在 strokeOpacity\n this.stylePropertyesExist.hasStrokeWidth, // cell 中是否存在 strokeWidth\n this.stylePropertyesExist.hasStroke, // cell 中是否存在 stroke\n // 2\n this.stylePropertyesExist.hasOffsets, // cell 中是否存在 offsets\n this.stylePropertyesExist.hasThetaOffset, // cell 中是否存在 thetaOffset\n 0.0,\n 0.0,\n // 3\n 0.0,\n 0.0,\n 0.0,\n 1.0,\n ];\n } else {\n return [\n 1.0, // 数据纹理有几行\n 1.0, // 数据纹理有几列\n 0.0,\n 0.0,\n 0.0, // cell 中是否存在 opacity\n 0.0, // cell 中是否存在 strokeOpacity\n 0.0, // cell 中是否存在 strokeWidth\n 0.0, // cell 中是否存在 stroke\n 0.0, // cell 中是否存在 offsets\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n -1.0,\n ];\n }\n }\n\n /**\n * 判断数据纹理是否需要重新计算 - 根据传入的值进行判断\n * @param options\n * @returns\n */\n public dataTextureNeedUpdate(options: {\n // TODO: thetaOffset 目前只有 lineLayer/arc 使用\n thetaOffset?: styleSingle;\n opacity?: styleSingle;\n strokeOpacity?: styleSingle;\n strokeWidth?: styleSingle;\n stroke?: styleColor;\n offsets?: styleOffset;\n textOffset?: styleOffset;\n }): boolean {\n let isUpdate = false;\n if (!isEqual(options.thetaOffset, this.cacheStyleProperties.thetaOffset)) {\n isUpdate = true;\n this.cacheStyleProperties.thetaOffset = options.thetaOffset;\n }\n if (!isEqual(options.opacity, this.cacheStyleProperties.opacity)) {\n isUpdate = true;\n this.cacheStyleProperties.opacity = options.opacity;\n }\n if (\n !isEqual(options.strokeOpacity, this.cacheStyleProperties.strokeOpacity)\n ) {\n isUpdate = true;\n this.cacheStyleProperties.strokeOpacity = options.strokeOpacity;\n }\n if (!isEqual(options.strokeWidth, this.cacheStyleProperties.strokeWidth)) {\n isUpdate = true;\n this.cacheStyleProperties.strokeWidth = options.strokeWidth;\n }\n if (!isEqual(options.stroke, this.cacheStyleProperties.stroke)) {\n isUpdate = true;\n this.cacheStyleProperties.stroke = options.stroke;\n }\n if (!isEqual(options.offsets, this.cacheStyleProperties.offsets)) {\n isUpdate = true;\n this.cacheStyleProperties.offsets = options.offsets;\n }\n if (this.dataTexture === undefined) {\n isUpdate = true;\n }\n return isUpdate;\n }\n /**\n * 判断当前的样式中哪些是需要进行数据映射的,哪些是常量,同时计算用于构建数据纹理的一些中间变量\n * @param options\n */\n public judgeStyleAttributes(options: {\n // TODO: 目前 thetaOffset 只有 lineLayer/arc 使用\n thetaOffset?: styleSingle;\n opacity?: styleSingle;\n strokeOpacity?: styleSingle;\n strokeWidth?: styleSingle;\n stroke?: styleColor;\n offsets?: styleOffset;\n }) {\n this.clearLastCalRes(); // 清除上一次的计算结果 - 全量清除\n\n if (options.opacity !== undefined && !isNumber(options.opacity)) {\n // 数据映射\n this.cellProperties.push({ attr: 'opacity', count: 1 });\n this.stylePropertyesExist.hasOpacity = 1;\n this.cellLength += 1;\n }\n\n if (\n options.strokeOpacity !== undefined &&\n !isNumber(options.strokeOpacity)\n ) {\n // 数据映射\n this.cellProperties.push({ attr: 'strokeOpacity', count: 1 });\n this.stylePropertyesExist.hasStrokeOpacity = 1;\n this.cellLength += 1;\n }\n\n if (options.strokeWidth !== undefined && !isNumber(options.strokeWidth)) {\n // 数据映射\n this.cellProperties.push({ attr: 'strokeWidth', count: 1 });\n this.stylePropertyesExist.hasStrokeWidth = 1;\n this.cellLength += 1;\n }\n\n if (options.stroke !== undefined && !this.isStaticColor(options.stroke)) {\n // 数据映射\n this.cellProperties.push({ attr: 'stroke', count: 4 });\n this.stylePropertyesExist.hasStroke = 1;\n this.cellLength += 4;\n }\n\n if (\n options.offsets !== undefined &&\n !this.isOffsetStatic(options.offsets)\n ) {\n // 数据映射\n this.cellProperties.push({ attr: 'offsets', count: 2 });\n this.stylePropertyesExist.hasOffsets = 1;\n this.cellLength += 2;\n }\n\n if (options.thetaOffset !== undefined && !isNumber(options.thetaOffset)) {\n // 数据映射\n this.cellProperties.push({ attr: 'thetaOffset', count: 1 });\n this.stylePropertyesExist.hasThetaOffset = 1;\n this.cellLength += 1;\n }\n // console.log('this.cellLength', this.cellLength)\n }\n\n /**\n * 判断变量 stroke 是否是常量值\n * @param stroke\n * @returns\n */\n public isStaticColor(stroke: styleColor): boolean {\n if (isString(stroke)) {\n if (color(stroke)) {\n return true;\n } else {\n return false;\n }\n }\n return false;\n }\n /**\n * 获取 stroke 颜色并做兼容处理\n * @param stroke\n * @returns\n */\n public getStrokeColor(stroke: styleColor) {\n if (this.isStaticColor(stroke)) {\n const strokeColor = rgb2arr(stroke as string);\n strokeColor[0] = strokeColor[0] ? strokeColor[0] : 0;\n strokeColor[1] = strokeColor[1] ? strokeColor[1] : 0;\n strokeColor[2] = strokeColor[2] ? strokeColor[2] : 0;\n strokeColor[3] = strokeColor[3] ? strokeColor[3] : 0;\n return strokeColor;\n } else {\n return [0, 0, 0, 0];\n }\n }\n\n /**\n * 判断 offsets 是否是常量\n * @param offsets\n * @returns\n */\n public isOffsetStatic(offsets: styleOffset) {\n if (\n isArray(offsets) &&\n offsets.length === 2 &&\n isNumber(offsets[0]) &&\n isNumber(offsets[1])\n ) {\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * 补空位\n * @param d\n * @param count\n */\n public patchMod(d: number[], count: number) {\n for (let i = 0; i < count; i++) {\n d.push(-1);\n }\n }\n\n /**\n * 根据映射的数据字段往推入数据\n * @param d\n * @param cellData\n * @param cellPropertiesLayouts\n */\n public patchData(\n d: number[],\n cellData: IEncodeFeature,\n cellPropertiesLayouts: ICellProperty[],\n ) {\n for (const layout of cellPropertiesLayouts) {\n const { attr, count } = layout;\n\n const value = cellData[attr];\n if (value !== undefined) {\n // 数据中存在该属性\n if (attr === 'stroke') {\n d.push(...rgb2arr(value));\n } else if (attr === 'offsets') {\n if (this.isOffsetStatic(value)) {\n d.push(-value[0], value[1]);\n } else {\n d.push(0, 0);\n }\n } else {\n d.push(isNumber(value) ? value : 1.0);\n }\n } else {\n // 若不存在时则补位\n this.patchMod(d, count);\n }\n }\n }\n\n /**\n * 计算推入数据纹理的数据\n * @param cellLength\n * @param encodeData\n * @param cellPropertiesLayouts\n * @returns\n */\n public calDataFrame(\n cellLength: number,\n encodeData: IEncodeFeature[],\n cellPropertiesLayouts: ICellProperty[],\n ): IDataTextureFrame {\n const encodeDatalength = encodeData.length;\n const rowCount = Math.ceil(\n (encodeDatalength * cellLength) / this.DATA_TEXTURE_WIDTH,\n ); // 有多少行\n\n const totalLength = rowCount * this.DATA_TEXTURE_WIDTH;\n const d: number[] = [];\n for (let i = 0; i < encodeDatalength; i++) {\n // 根据 encodeData 数据推入数据\n const cellData = encodeData[i];\n this.patchData(d, cellData, cellPropertiesLayouts);\n }\n for (let i = d.length; i < totalLength; i++) {\n // 每行不足的部分用 -1 补足(数据纹理时 width * height 的矩形数据集合)\n d.push(-1);\n }\n // console.log('data', d)\n return { data: d, width: this.DATA_TEXTURE_WIDTH, height: rowCount };\n }\n\n // style datatexture mapping\n\n public getBlend(): IBlendOptions {\n const { blend = 'normal' } = this.layer.getLayerConfig();\n return BlendTypes[BlendType[blend]] as IBlendOptions;\n }\n public getDefaultStyle(): unknown {\n return {};\n }\n public getUninforms(): IModelUniform {\n throw new Error('Method not implemented.');\n }\n\n public getAnimateUniforms(): IModelUniform {\n return {};\n }\n\n public needUpdate(): boolean {\n return false;\n }\n public buildModels(): IModel[] {\n throw new Error('Method not implemented.');\n }\n public initModels(): IModel[] {\n throw new Error('Method not implemented.');\n }\n public clearModels() {\n return;\n }\n public getAttribute(): {\n attributes: {\n [attributeName: string]: IAttribute;\n };\n elements: IElements;\n } {\n throw new Error('Method not implemented.');\n }\n public render() {\n throw new Error('Method not implemented.');\n }\n protected registerBuiltinAttributes() {\n throw new Error('Method not implemented.');\n }\n protected animateOption2Array(option: IAnimateOption): number[] {\n return [\n option.enable ? 0 : 1.0,\n option.duration || 4.0,\n option.interval || 0.2,\n option.trailLength || 0.1,\n ];\n }\n protected startModelAnimate() {\n const { animateOption } = this.layer.getLayerConfig() as ILayerConfig;\n if (animateOption.enable) {\n this.layer.setAnimateStartTime();\n }\n }\n}\n"],"file":"BaseModel.js"}
1
+ {"version":3,"sources":["../../src/core/BaseModel.ts"],"names":["BaseModel","TYPES","IGlobalConfigService","layer","rendererService","getContainer","get","IRendererService","shaderModuleService","IShaderModuleService","styleAttributeService","IStyleAttributeService","mapService","IMapService","iconService","IIconService","fontService","IFontService","cameraService","ICameraService","layerService","ILayerService","registerBuiltinAttributes","startModelAnimate","createTexture2D","DATA_TEXTURE_WIDTH","rowCount","cellLength","cellProperties","cacheStyleProperties","thetaOffset","undefined","opacity","strokeOpacity","strokeWidth","stroke","offsets","stylePropertyesExist","hasThetaOffset","hasOpacity","hasStrokeOpacity","hasStrokeWidth","hasStroke","hasOffsets","dataTextureTest","getOESTextureFloat","dataTexture","data","Uint8Array","mag","gl","NEAREST","min","width","height","options","isUpdate","clearLastCalRes","push","attr","count","isStaticColor","isOffsetStatic","strokeColor","Array","isArray","length","d","i","cellData","cellPropertiesLayouts","layout","value","patchMod","encodeData","encodeDatalength","Math","ceil","totalLength","patchData","getLayerConfig","blend","BlendTypes","BlendType","Error","option","enable","duration","interval","trailLength","animateOption","setAnimateStartTime"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AA4BA;;AACA;;AAEA;;;;;;;;;;IA0BqBA,S,WAoClB,wBAAWC,cAAMC,oBAAjB,C;AAsBD,qBAAYC,KAAZ,EAA2B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACzB,SAAKA,KAAL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J,CAAU,yBAAV,CAAN;AACD;;;WACD,uBAAqB;AACnB;AACD;;;WACD,wBAKE;AACA,YAAM,IAAIA,KAAJ,CAAU,yBAAV,CAAN;AACD;;;WACD,kBAAgB;AACd,YAAM,IAAIA,KAAJ,CAAU,yBAAV,CAAN;AACD;;;WACD,qCAAsC;AACpC,YAAM,IAAIA,KAAJ,CAAU,yBAAV,CAAN;AACD;;;WACD,6BAA8BC,MAA9B,EAAgE;AAC9D,aAAO,CACLA,MAAM,CAACC,MAAP,GAAgB,CAAhB,GAAoB,GADf,EAELD,MAAM,CAACE,QAAP,IAAmB,GAFd,EAGLF,MAAM,CAACG,QAAP,IAAmB,GAHd,EAILH,MAAM,CAACI,WAAP,IAAsB,GAJjB,CAAP;AAMD;;;WACD,6BAA8B;AAC5B,iBAA0B,KAAKtF,KAAL,CAAW6E,cAAX,EAA1B;AAAA,UAAQU,aAAR,QAAQA,aAAR;;AACA,UAAIA,aAAa,CAACJ,MAAlB,EAA0B;AACxB,aAAKnF,KAAL,CAAWwF,mBAAX;AACD;AACF","sourcesContent":["import {\n BlendType,\n gl,\n IAnimateOption,\n IAttribute,\n IBlendOptions,\n ICameraService,\n IElements,\n IEncodeFeature,\n IFontService,\n IGlobalConfigService,\n IIconService,\n ILayer,\n ILayerConfig,\n ILayerModel,\n ILayerService,\n IMapService,\n IModel,\n IModelUniform,\n IRendererService,\n IShaderModuleService,\n IStyleAttributeService,\n ITexture2D,\n ITexture2DInitializationOptions,\n lazyInject,\n Triangulation,\n TYPES,\n} from '@antv/l7-core';\nimport { rgb2arr } from '@antv/l7-utils';\nimport { color } from 'd3-color';\nimport { isEqual, isFunction, isNumber, isString } from 'lodash';\nimport { BlendTypes } from '../utils/blend';\n\nexport type styleSingle =\n | number\n | string\n | [string, (single: any) => number]\n | [string, [number, number]];\nexport type styleOffset =\n | string\n | [number, number]\n | [string, (single: any) => number];\nexport type styleColor =\n | string\n | [string, (single: any) => string]\n | [string, [string, string]];\nexport interface IDataTextureFrame {\n data: number[];\n width: number;\n height: number;\n}\n\nexport interface ICellProperty {\n attr: string;\n count: number;\n}\n\nexport default class BaseModel<ChildLayerStyleOptions = {}>\n implements ILayerModel {\n public triangulation: Triangulation;\n\n // style texture data mapping\n public createTexture2D: (\n options: ITexture2DInitializationOptions,\n ) => ITexture2D;\n\n protected layer: ILayer;\n protected dataTexture: ITexture2D; // 用于数据传递的数据纹理\n protected DATA_TEXTURE_WIDTH: number; // 默认有多少列(宽度)\n protected rowCount: number; // 计算得到的当前数据纹理有多少行(高度)\n protected cacheStyleProperties: {\n // 记录存储上一次样式字段的值\n thetaOffset: styleSingle | undefined;\n opacity: styleSingle | undefined;\n strokeOpacity: styleSingle | undefined;\n strokeWidth: styleSingle | undefined;\n stroke: styleColor | undefined;\n offsets: styleOffset | undefined;\n };\n protected cellLength: number; // 单个 cell 的长度\n protected cellProperties: ICellProperty[]; // 需要进行数据映射的属性集合\n protected cellTypeLayout: number[];\n protected stylePropertyesExist: {\n // 记录 style 属性是否存在的中间变量\n hasThetaOffset: number;\n hasOpacity: number;\n hasStrokeOpacity: number;\n hasStrokeWidth: number;\n hasStroke: number;\n hasOffsets: number;\n };\n protected dataTextureTest: boolean;\n\n @lazyInject(TYPES.IGlobalConfigService)\n protected readonly configService: IGlobalConfigService;\n\n // @lazyInject(TYPES.IIconService)\n // protected readonly iconService: IIconService;\n\n // @lazyInject(TYPES.IFontService)\n // protected readonly fontService: IFontService;\n\n // @lazyInject(TYPES.IShaderModuleService)\n protected shaderModuleService: IShaderModuleService;\n\n protected rendererService: IRendererService;\n protected iconService: IIconService;\n protected fontService: IFontService;\n protected styleAttributeService: IStyleAttributeService;\n protected mapService: IMapService;\n protected cameraService: ICameraService;\n protected layerService: ILayerService;\n\n // style texture data mapping\n\n constructor(layer: ILayer) {\n this.layer = layer;\n this.rendererService = layer\n .getContainer()\n .get<IRendererService>(TYPES.IRendererService);\n this.shaderModuleService = layer\n .getContainer()\n .get<IShaderModuleService>(TYPES.IShaderModuleService);\n\n this.styleAttributeService = layer\n .getContainer()\n .get<IStyleAttributeService>(TYPES.IStyleAttributeService);\n this.mapService = layer.getContainer().get<IMapService>(TYPES.IMapService);\n this.iconService = layer\n .getContainer()\n .get<IIconService>(TYPES.IIconService);\n this.fontService = layer\n .getContainer()\n .get<IFontService>(TYPES.IFontService);\n this.cameraService = layer\n .getContainer()\n .get<ICameraService>(TYPES.ICameraService);\n this.layerService = layer\n .getContainer()\n .get<ILayerService>(TYPES.ILayerService);\n\n // 注册 Attribute\n this.registerBuiltinAttributes();\n // 开启动画\n this.startModelAnimate();\n\n const { createTexture2D } = this.rendererService;\n this.createTexture2D = createTexture2D;\n this.DATA_TEXTURE_WIDTH = 1024; // 数据纹理固定宽度\n this.rowCount = 1;\n this.cellLength = 0;\n this.cellProperties = [];\n this.cacheStyleProperties = {\n thetaOffset: undefined,\n opacity: undefined,\n strokeOpacity: undefined,\n strokeWidth: undefined,\n stroke: undefined,\n offsets: undefined,\n };\n this.stylePropertyesExist = {\n hasThetaOffset: 0,\n hasOpacity: 0,\n hasStrokeOpacity: 0,\n hasStrokeWidth: 0,\n hasStroke: 0,\n hasOffsets: 0,\n };\n this.dataTextureTest = this.layerService.getOESTextureFloat();\n // 只有在不支持数据纹理的情况下进行赋值\n if (!this.dataTextureTest) {\n this.dataTexture = this.createTexture2D({\n // data: new Uint8ClampedArray(4),\n // 使用 Uint8ClampedArray 在 支付宝 环境中可能存在问题 UC 内核对格式有要求 L7 v2.7.18 版本发现\n // Uint8ClampedArray 和 Uint8Array 没有实质性的区别\n data: new Uint8Array(4),\n mag: gl.NEAREST,\n min: gl.NEAREST,\n width: 1,\n height: 1,\n });\n }\n }\n\n // style datatexture mapping\n\n /**\n * 清除上一次的计算结果 - 全量清除\n */\n public clearLastCalRes() {\n this.cellProperties = []; // 清空上一次计算的需要进行数据映射的属性集合\n this.cellLength = 0; // 清空上一次计算的 cell 的长度\n this.stylePropertyesExist = {\n // 全量清空上一次是否需要对 style 属性进行数据映射的判断\n hasThetaOffset: 0,\n hasOpacity: 0,\n hasStrokeOpacity: 0,\n hasStrokeWidth: 0,\n hasStroke: 0,\n hasOffsets: 0,\n };\n }\n\n public getCellTypeLayout() {\n if (this.dataTextureTest) {\n return [\n // 0\n this.rowCount, // 数据纹理有几行\n this.DATA_TEXTURE_WIDTH, // 数据纹理有几列\n 0.0,\n 0.0,\n // 1\n this.stylePropertyesExist.hasOpacity, // cell 中是否存在 opacity\n this.stylePropertyesExist.hasStrokeOpacity, // cell 中是否存在 strokeOpacity\n this.stylePropertyesExist.hasStrokeWidth, // cell 中是否存在 strokeWidth\n this.stylePropertyesExist.hasStroke, // cell 中是否存在 stroke\n // 2\n this.stylePropertyesExist.hasOffsets, // cell 中是否存在 offsets\n this.stylePropertyesExist.hasThetaOffset, // cell 中是否存在 thetaOffset\n 0.0,\n 0.0,\n // 3\n 0.0,\n 0.0,\n 0.0,\n 1.0,\n ];\n } else {\n return [\n 1.0, // 数据纹理有几行\n 1.0, // 数据纹理有几列\n 0.0,\n 0.0,\n 0.0, // cell 中是否存在 opacity\n 0.0, // cell 中是否存在 strokeOpacity\n 0.0, // cell 中是否存在 strokeWidth\n 0.0, // cell 中是否存在 stroke\n 0.0, // cell 中是否存在 offsets\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n -1.0,\n ];\n }\n }\n\n /**\n * 判断数据纹理是否需要重新计算 - 根据传入的值进行判断\n * @param options\n * @returns\n */\n public dataTextureNeedUpdate(options: {\n // TODO: thetaOffset 目前只有 lineLayer/arc 使用\n thetaOffset?: styleSingle;\n opacity?: styleSingle;\n strokeOpacity?: styleSingle;\n strokeWidth?: styleSingle;\n stroke?: styleColor;\n offsets?: styleOffset;\n textOffset?: styleOffset;\n }): boolean {\n let isUpdate = false;\n if (!isEqual(options.thetaOffset, this.cacheStyleProperties.thetaOffset)) {\n isUpdate = true;\n this.cacheStyleProperties.thetaOffset = options.thetaOffset;\n }\n if (!isEqual(options.opacity, this.cacheStyleProperties.opacity)) {\n isUpdate = true;\n this.cacheStyleProperties.opacity = options.opacity;\n }\n if (\n !isEqual(options.strokeOpacity, this.cacheStyleProperties.strokeOpacity)\n ) {\n isUpdate = true;\n this.cacheStyleProperties.strokeOpacity = options.strokeOpacity;\n }\n if (!isEqual(options.strokeWidth, this.cacheStyleProperties.strokeWidth)) {\n isUpdate = true;\n this.cacheStyleProperties.strokeWidth = options.strokeWidth;\n }\n if (!isEqual(options.stroke, this.cacheStyleProperties.stroke)) {\n isUpdate = true;\n this.cacheStyleProperties.stroke = options.stroke;\n }\n if (!isEqual(options.offsets, this.cacheStyleProperties.offsets)) {\n isUpdate = true;\n this.cacheStyleProperties.offsets = options.offsets;\n }\n if (this.dataTexture === undefined) {\n isUpdate = true;\n }\n return isUpdate;\n }\n /**\n * 判断当前的样式中哪些是需要进行数据映射的,哪些是常量,同时计算用于构建数据纹理的一些中间变量\n * @param options\n */\n public judgeStyleAttributes(options: {\n // TODO: 目前 thetaOffset 只有 lineLayer/arc 使用\n thetaOffset?: styleSingle;\n opacity?: styleSingle;\n strokeOpacity?: styleSingle;\n strokeWidth?: styleSingle;\n stroke?: styleColor;\n offsets?: styleOffset;\n }) {\n this.clearLastCalRes(); // 清除上一次的计算结果 - 全量清除\n\n if (options.opacity !== undefined && !isNumber(options.opacity)) {\n // 数据映射\n this.cellProperties.push({ attr: 'opacity', count: 1 });\n this.stylePropertyesExist.hasOpacity = 1;\n this.cellLength += 1;\n }\n\n if (\n options.strokeOpacity !== undefined &&\n !isNumber(options.strokeOpacity)\n ) {\n // 数据映射\n this.cellProperties.push({ attr: 'strokeOpacity', count: 1 });\n this.stylePropertyesExist.hasStrokeOpacity = 1;\n this.cellLength += 1;\n }\n\n if (options.strokeWidth !== undefined && !isNumber(options.strokeWidth)) {\n // 数据映射\n this.cellProperties.push({ attr: 'strokeWidth', count: 1 });\n this.stylePropertyesExist.hasStrokeWidth = 1;\n this.cellLength += 1;\n }\n\n if (options.stroke !== undefined && !this.isStaticColor(options.stroke)) {\n // 数据映射\n this.cellProperties.push({ attr: 'stroke', count: 4 });\n this.stylePropertyesExist.hasStroke = 1;\n this.cellLength += 4;\n }\n\n if (\n options.offsets !== undefined &&\n !this.isOffsetStatic(options.offsets)\n ) {\n // 数据映射\n this.cellProperties.push({ attr: 'offsets', count: 2 });\n this.stylePropertyesExist.hasOffsets = 1;\n this.cellLength += 2;\n }\n\n if (options.thetaOffset !== undefined && !isNumber(options.thetaOffset)) {\n // 数据映射\n this.cellProperties.push({ attr: 'thetaOffset', count: 1 });\n this.stylePropertyesExist.hasThetaOffset = 1;\n this.cellLength += 1;\n }\n // console.log('this.cellLength', this.cellLength)\n }\n\n /**\n * 判断变量 stroke 是否是常量值\n * @param stroke\n * @returns\n */\n public isStaticColor(stroke: styleColor): boolean {\n if (isString(stroke)) {\n if (color(stroke)) {\n return true;\n } else {\n return false;\n }\n }\n return false;\n }\n /**\n * 获取 stroke 颜色并做兼容处理\n * @param stroke\n * @returns\n */\n public getStrokeColor(stroke: styleColor) {\n if (this.isStaticColor(stroke)) {\n const strokeColor = rgb2arr(stroke as string);\n strokeColor[0] = strokeColor[0] ? strokeColor[0] : 0;\n strokeColor[1] = strokeColor[1] ? strokeColor[1] : 0;\n strokeColor[2] = strokeColor[2] ? strokeColor[2] : 0;\n strokeColor[3] = strokeColor[3] ? strokeColor[3] : 0;\n return strokeColor;\n } else {\n return [0, 0, 0, 0];\n }\n }\n\n /**\n * 判断 offsets 是否是常量\n * @param offsets\n * @returns\n */\n public isOffsetStatic(offsets: styleOffset) {\n if (\n Array.isArray(offsets) &&\n offsets.length === 2 &&\n isNumber(offsets[0]) &&\n isNumber(offsets[1])\n ) {\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * 补空位\n * @param d\n * @param count\n */\n public patchMod(d: number[], count: number) {\n for (let i = 0; i < count; i++) {\n d.push(-1);\n }\n }\n\n /**\n * 根据映射的数据字段往推入数据\n * @param d\n * @param cellData\n * @param cellPropertiesLayouts\n */\n public patchData(\n d: number[],\n cellData: IEncodeFeature,\n cellPropertiesLayouts: ICellProperty[],\n ) {\n for (const layout of cellPropertiesLayouts) {\n const { attr, count } = layout;\n\n const value = cellData[attr];\n if (value !== undefined) {\n // 数据中存在该属性\n if (attr === 'stroke') {\n d.push(...rgb2arr(value));\n } else if (attr === 'offsets') {\n if (this.isOffsetStatic(value)) {\n d.push(-value[0], value[1]);\n } else {\n d.push(0, 0);\n }\n } else {\n d.push(isNumber(value) ? value : 1.0);\n }\n } else {\n // 若不存在时则补位\n this.patchMod(d, count);\n }\n }\n }\n\n /**\n * 计算推入数据纹理的数据\n * @param cellLength\n * @param encodeData\n * @param cellPropertiesLayouts\n * @returns\n */\n public calDataFrame(\n cellLength: number,\n encodeData: IEncodeFeature[],\n cellPropertiesLayouts: ICellProperty[],\n ): IDataTextureFrame {\n const encodeDatalength = encodeData.length;\n const rowCount = Math.ceil(\n (encodeDatalength * cellLength) / this.DATA_TEXTURE_WIDTH,\n ); // 有多少行\n\n const totalLength = rowCount * this.DATA_TEXTURE_WIDTH;\n const d: number[] = [];\n for (let i = 0; i < encodeDatalength; i++) {\n // 根据 encodeData 数据推入数据\n const cellData = encodeData[i];\n this.patchData(d, cellData, cellPropertiesLayouts);\n }\n for (let i = d.length; i < totalLength; i++) {\n // 每行不足的部分用 -1 补足(数据纹理时 width * height 的矩形数据集合)\n d.push(-1);\n }\n // console.log('data', d)\n return { data: d, width: this.DATA_TEXTURE_WIDTH, height: rowCount };\n }\n\n // style datatexture mapping\n\n public getBlend(): IBlendOptions {\n const { blend = 'normal' } = this.layer.getLayerConfig();\n return BlendTypes[BlendType[blend]] as IBlendOptions;\n }\n public getDefaultStyle(): unknown {\n return {};\n }\n public getUninforms(): IModelUniform {\n throw new Error('Method not implemented.');\n }\n\n public getAnimateUniforms(): IModelUniform {\n return {};\n }\n\n public needUpdate(): boolean {\n return false;\n }\n public buildModels(): IModel[] {\n throw new Error('Method not implemented.');\n }\n public initModels(): IModel[] {\n throw new Error('Method not implemented.');\n }\n public clearModels() {\n return;\n }\n public getAttribute(): {\n attributes: {\n [attributeName: string]: IAttribute;\n };\n elements: IElements;\n } {\n throw new Error('Method not implemented.');\n }\n public render() {\n throw new Error('Method not implemented.');\n }\n protected registerBuiltinAttributes() {\n throw new Error('Method not implemented.');\n }\n protected animateOption2Array(option: IAnimateOption): number[] {\n return [\n option.enable ? 0 : 1.0,\n option.duration || 4.0,\n option.interval || 0.2,\n option.trailLength || 0.1,\n ];\n }\n protected startModelAnimate() {\n const { animateOption } = this.layer.getLayerConfig() as ILayerConfig;\n if (animateOption.enable) {\n this.layer.setAnimateStartTime();\n }\n }\n}\n"],"file":"BaseModel.js"}
@@ -43,7 +43,7 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
43
43
 
44
44
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
45
45
 
46
- var waveFillFrag = "\nuniform float u_additive;\n\nvarying mat4 styleMappingMat; // \u4F20\u9012\u4ECE\u7247\u5143\u4E2D\u4F20\u9012\u7684\u6620\u5C04\u6570\u636E\n\nvarying vec4 v_data;\nvarying vec4 v_color;\nvarying float v_radius;\nuniform float u_time;\nuniform vec4 u_aimate: [ 0, 2., 1.0, 0.2 ];\n\n#pragma include \"sdf_2d\"\n#pragma include \"picking\"\n\n\nvoid main() {\n\n vec4 textrueStroke = vec4(\n styleMappingMat[1][0],\n styleMappingMat[1][1],\n styleMappingMat[1][2],\n styleMappingMat[1][3]\n );\n\n float opacity = styleMappingMat[0][0];\n float stroke_opacity = styleMappingMat[0][1];\n float strokeWidth = styleMappingMat[0][2];\n vec4 strokeColor = textrueStroke == vec4(0) ? v_color : textrueStroke;\n\n float r = v_radius / (v_radius + strokeWidth);\n\n // 'circle'\n float outer_df = sdCircle(v_data.xy, 1.0);\n float inner_df = sdCircle(v_data.xy, r);\n \n float d = length(v_data.xy);\n if(d > 0.5) {\n discard;\n }\n float PI = 3.14159;\n float intensity = clamp(cos(d * PI), 0.0, 1.0) * clamp(cos(2.0 * PI * (d * 2.0 * u_aimate.z - u_aimate.y * u_time)), 0.0, 1.0);\n\n // TODO: \u6839\u636E\u53E0\u52A0\u6C34\u6CE2\u6548\u679C\n gl_FragColor = vec4(v_color.xyz, v_color.a * opacity * intensity);\n\n if(u_additive > 0.0) {\n gl_FragColor *= gl_FragColor.a;\n } \n\n // TODO: \u4F18\u5316\u5728\u6C34\u6CE2\u7EB9\u60C5\u51B5\u4E0B\u7684\u62FE\u53D6\n if(d < 0.5) {\n gl_FragColor = filterColor(gl_FragColor);\n }\n}\n";
46
+ var waveFillFrag = "\nuniform float u_additive;\n\nvarying mat4 styleMappingMat; // \u4F20\u9012\u4ECE\u7247\u5143\u4E2D\u4F20\u9012\u7684\u6620\u5C04\u6570\u636E\n\nvarying vec4 v_data;\nvarying vec4 v_color;\nvarying float v_radius;\nuniform float u_time;\nuniform vec4 u_aimate: [ 0, 2., 1.0, 0.2 ];\n\n#pragma include \"sdf_2d\"\n#pragma include \"picking\"\n\n\nvoid main() {\n\n vec4 textrueStroke = vec4(\n styleMappingMat[1][0],\n styleMappingMat[1][1],\n styleMappingMat[1][2],\n styleMappingMat[1][3]\n );\n\n float opacity = styleMappingMat[0][0];\n\n lowp float antialiasblur = v_data.z;\n float r = v_radius / (v_radius);\n\n float outer_df;\n float inner_df;\n // 'circle', 'triangle', 'square', 'pentagon', 'hexagon', 'octogon', 'hexagram', 'rhombus', 'vesica'\n \n outer_df = sdCircle(v_data.xy, 1.0);\n inner_df = sdCircle(v_data.xy, r);\n\n\n if(u_globel > 0.0) {\n // TODO: \u5730\u7403\u6A21\u5F0F\u4E0B\u907F\u514D\u591A\u4F59\u7247\u5143\u7ED8\u5236\uFF0C\u540C\u65F6\u4E5F\u80FD\u907F\u514D\u6709\u7528\u7247\u5143\u5728\u900F\u660E\u4E14\u91CD\u53E0\u7684\u60C5\u51B5\u4E0B\u65E0\u6CD5\u5199\u5165\n // \u4ED8\u51FA\u7684\u4EE3\u4EF7\u662F\u8FB9\u7F18\u4F1A\u6709\u4E00\u4E9B\u952F\u9F7F\n if(outer_df > antialiasblur + 0.018) discard;\n }\n float opacity_t = smoothstep(0.0, antialiasblur, outer_df);\n\n float color_t = smoothstep(\n antialiasblur,\n 0.0,\n inner_df\n );\n float PI = 3.14159;\n float N_RINGS = 3.0;\n float FREQ = 1.0;\n\n gl_FragColor = vec4(v_color.rgb, v_color.a * opacity);\n\n float d = length(v_data.xy);\n if(d > 0.5) {\n discard;\n }\n float intensity = clamp(cos(d * PI), 0.0, 1.0) * clamp(cos(2.0 * PI * (d * 2.0 * u_aimate.z - u_aimate.y * u_time)), 0.0, 1.0);\n \n // TODO: \u6839\u636E\u53E0\u52A0\u6A21\u5F0F\u9009\u62E9\u6548\u679C\n if(u_additive > 0.0) {\n gl_FragColor *= intensity;\n gl_FragColor = filterColorAnimate(gl_FragColor);\n } else {\n gl_FragColor = vec4(gl_FragColor.xyz, gl_FragColor.a * intensity);\n gl_FragColor = filterColor(gl_FragColor);\n }\n}\n";
47
47
  var pointFillFrag = "\nuniform float u_globel;\nuniform float u_additive;\n\nvarying mat4 styleMappingMat; // \u4F20\u9012\u4ECE\u7247\u5143\u4E2D\u4F20\u9012\u7684\u6620\u5C04\u6570\u636E\n\nvarying vec4 v_data;\nvarying vec4 v_color;\nvarying float v_radius;\n\n#pragma include \"sdf_2d\"\n#pragma include \"picking\"\n\n\nvoid main() {\n int shape = int(floor(v_data.w + 0.5));\n\n vec4 textrueStroke = vec4(\n styleMappingMat[1][0],\n styleMappingMat[1][1],\n styleMappingMat[1][2],\n styleMappingMat[1][3]\n );\n\n float opacity = styleMappingMat[0][0];\n float stroke_opacity = styleMappingMat[0][1];\n float strokeWidth = styleMappingMat[0][2];\n vec4 strokeColor = textrueStroke == vec4(0) ? v_color : textrueStroke;\n\n lowp float antialiasblur = v_data.z;\n float r = v_radius / (v_radius + strokeWidth);\n\n float outer_df;\n float inner_df;\n // 'circle', 'triangle', 'square', 'pentagon', 'hexagon', 'octogon', 'hexagram', 'rhombus', 'vesica'\n if (shape == 0) {\n outer_df = sdCircle(v_data.xy, 1.0);\n inner_df = sdCircle(v_data.xy, r);\n } else if (shape == 1) {\n outer_df = sdEquilateralTriangle(1.1 * v_data.xy);\n inner_df = sdEquilateralTriangle(1.1 / r * v_data.xy);\n } else if (shape == 2) {\n outer_df = sdBox(v_data.xy, vec2(1.));\n inner_df = sdBox(v_data.xy, vec2(r));\n } else if (shape == 3) {\n outer_df = sdPentagon(v_data.xy, 0.8);\n inner_df = sdPentagon(v_data.xy, r * 0.8);\n } else if (shape == 4) {\n outer_df = sdHexagon(v_data.xy, 0.8);\n inner_df = sdHexagon(v_data.xy, r * 0.8);\n } else if (shape == 5) {\n outer_df = sdOctogon(v_data.xy, 1.0);\n inner_df = sdOctogon(v_data.xy, r);\n } else if (shape == 6) {\n outer_df = sdHexagram(v_data.xy, 0.52);\n inner_df = sdHexagram(v_data.xy, r * 0.52);\n } else if (shape == 7) {\n outer_df = sdRhombus(v_data.xy, vec2(1.0));\n inner_df = sdRhombus(v_data.xy, vec2(r));\n } else if (shape == 8) {\n outer_df = sdVesica(v_data.xy, 1.1, 0.8);\n inner_df = sdVesica(v_data.xy, r * 1.1, r * 0.8);\n }\n\n if(u_globel > 0.0) {\n // TODO: \u5730\u7403\u6A21\u5F0F\u4E0B\u907F\u514D\u591A\u4F59\u7247\u5143\u7ED8\u5236\uFF0C\u540C\u65F6\u4E5F\u80FD\u907F\u514D\u6709\u7528\u7247\u5143\u5728\u900F\u660E\u4E14\u91CD\u53E0\u7684\u60C5\u51B5\u4E0B\u65E0\u6CD5\u5199\u5165\n // \u4ED8\u51FA\u7684\u4EE3\u4EF7\u662F\u8FB9\u7F18\u4F1A\u6709\u4E00\u4E9B\u952F\u9F7F\n if(outer_df > antialiasblur + 0.018) discard;\n }\n float opacity_t = smoothstep(0.0, antialiasblur, outer_df);\n\n float color_t = strokeWidth < 0.01 ? 0.0 : smoothstep(\n antialiasblur,\n 0.0,\n inner_df\n );\n\n if(strokeWidth < 0.01) {\n gl_FragColor = vec4(v_color.rgb, v_color.a * opacity);\n } else {\n gl_FragColor = mix(vec4(v_color.rgb, v_color.a * opacity), strokeColor * stroke_opacity, color_t);\n }\n\n if(u_additive > 0.0) {\n gl_FragColor *= opacity_t;\n } else {\n gl_FragColor.a *= opacity_t;\n }\n\n if(gl_FragColor.a > 0.0) {\n gl_FragColor = filterColor(gl_FragColor);\n }\n}\n";
48
48
  var pointFillVert = "attribute vec4 a_Color;\nattribute vec3 a_Position;\nattribute vec3 a_Extrude;\nattribute float a_Size;\nattribute float a_Shape;\n\nvarying mat4 styleMappingMat; // \u7528\u4E8E\u5C06\u5728\u9876\u70B9\u7740\u8272\u5668\u4E2D\u8BA1\u7B97\u597D\u7684\u6837\u5F0F\u503C\u4F20\u9012\u7ED9\u7247\u5143\n\nuniform float u_globel;\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\nuniform float u_isMeter;\n\nvarying vec4 v_data;\nvarying vec4 v_color;\nvarying float v_radius;\n\nuniform float u_opacity : 1;\nuniform float u_stroke_opacity : 1;\nuniform float u_stroke_width : 2;\nuniform vec4 u_stroke_color : [0.0, 0.0, 0.0, 0.0];\nuniform vec2 u_offsets;\n\nuniform float u_blur : 0.0;\n\n#pragma include \"styleMapping\"\n#pragma include \"styleMappingCalOpacity\"\n#pragma include \"styleMappingCalStrokeOpacity\"\n#pragma include \"styleMappingCalStrokeWidth\"\n\n#pragma include \"projection\"\n#pragma include \"picking\"\n\n\nvoid main() {\n vec3 extrude = a_Extrude;\n float shape_type = a_Shape;\n float newSize = setPickingSize(a_Size);\n\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n styleMappingMat = mat4(\n 0.0, 0.0, 0.0, 0.0, // opacity - strokeOpacity - strokeWidth - empty\n 0.0, 0.0, 0.0, 0.0, // strokeR - strokeG - strokeB - strokeA\n 0.0, 0.0, 0.0, 0.0, // offsets[0] - offsets[1]\n 0.0, 0.0, 0.0, 0.0\n );\n\n float rowCount = u_cellTypeLayout[0][0]; // \u5F53\u524D\u7684\u6570\u636E\u7EB9\u7406\u6709\u51E0\u884C\n float columnCount = u_cellTypeLayout[0][1]; // \u5F53\u770B\u5230\u6570\u636E\u7EB9\u7406\u6709\u51E0\u5217\n float columnWidth = 1.0/columnCount; // \u5217\u5BBD\n float rowHeight = 1.0/rowCount; // \u884C\u9AD8\n float cellCount = calCellCount(); // opacity - strokeOpacity - strokeWidth - stroke - offsets\n float id = a_vertexId; // \u7B2Cn\u4E2A\u9876\u70B9\n float cellCurrentRow = floor(id * cellCount / columnCount) + 1.0; // \u8D77\u59CB\u70B9\u5728\u7B2C\u51E0\u884C\n float cellCurrentColumn = mod(id * cellCount, columnCount) + 1.0; // \u8D77\u59CB\u70B9\u5728\u7B2C\u51E0\u5217\n \n // cell \u56FA\u5B9A\u987A\u5E8F opacity -> strokeOpacity -> strokeWidth -> stroke ... \n // \u6309\u987A\u5E8F\u4ECE cell \u4E2D\u53D6\u503C\u3001\u82E5\u6CA1\u6709\u5219\u81EA\u52A8\u5F80\u4E0B\u53D6\u503C\n float textureOffset = 0.0; // \u5728 cell \u4E2D\u53D6\u503C\u7684\u504F\u79FB\u91CF\n\n vec2 opacityAndOffset = calOpacityAndOffset(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset, columnWidth, rowHeight);\n styleMappingMat[0][0] = opacityAndOffset.r;\n textureOffset = opacityAndOffset.g;\n\n vec2 strokeOpacityAndOffset = calStrokeOpacityAndOffset(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset, columnWidth, rowHeight);\n styleMappingMat[0][1] = strokeOpacityAndOffset.r;\n textureOffset = strokeOpacityAndOffset.g;\n\n vec2 strokeWidthAndOffset = calStrokeWidthAndOffset(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset, columnWidth, rowHeight);\n styleMappingMat[0][2] = strokeWidthAndOffset.r;\n textureOffset = strokeWidthAndOffset.g;\n\n vec4 textrueStroke = vec4(-1.0, -1.0, -1.0, -1.0);\n if(hasStroke()) {\n vec2 valueRPos = nextPos(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset);\n styleMappingMat[1][0] = pos2value(valueRPos, columnWidth, rowHeight); // R\n textureOffset += 1.0;\n\n vec2 valueGPos = nextPos(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset);\n styleMappingMat[1][1] = pos2value(valueGPos, columnWidth, rowHeight); // G\n textureOffset += 1.0;\n\n vec2 valueBPos = nextPos(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset);\n styleMappingMat[1][2] = pos2value(valueBPos, columnWidth, rowHeight); // B\n textureOffset += 1.0;\n\n vec2 valueAPos = nextPos(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset);\n styleMappingMat[1][3] = pos2value(valueAPos, columnWidth, rowHeight); // A\n textureOffset += 1.0;\n } else {\n if(u_stroke_color == vec4(0.0)) {\n styleMappingMat[1][0] = v_color.r;\n styleMappingMat[1][1] = v_color.g;\n styleMappingMat[1][2] = v_color.b;\n styleMappingMat[1][3] = v_color.a;\n } else {\n styleMappingMat[1][0] = u_stroke_color.r;\n styleMappingMat[1][1] = u_stroke_color.g;\n styleMappingMat[1][2] = u_stroke_color.b;\n styleMappingMat[1][3] = u_stroke_color.a;\n }\n }\n\n vec2 textrueOffsets = vec2(0.0, 0.0);\n if(hasOffsets()) {\n vec2 valueXPos = nextPos(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset);\n textrueOffsets.r = pos2value(valueXPos, columnWidth, rowHeight); // x\n textureOffset += 1.0;\n\n vec2 valueYPos = nextPos(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset);\n textrueOffsets.g = pos2value(valueYPos, columnWidth, rowHeight); // x\n textureOffset += 1.0;\n } else {\n textrueOffsets = u_offsets;\n }\n\n // cal style mapping\n\n // unpack color(vec2)\n v_color = a_Color;\n\n // radius(16-bit)\n v_radius = newSize;\n\n // TODO: billboard\n // anti-alias\n // float antialiased_blur = -max(u_blur, antialiasblur);\n float antialiasblur = -max(2.0 / u_DevicePixelRatio / a_Size, u_blur);\n\n vec2 offset = (extrude.xy * (newSize + u_stroke_width) + textrueOffsets);\n vec3 aPosition = a_Position;\n if(u_isMeter < 1.0) {\n // \u4E0D\u4EE5\u7C73\u4E3A\u5B9E\u9645\u5355\u4F4D\n offset = project_pixel(offset);\n } else {\n // \u4EE5\u7C73\u4E3A\u5B9E\u9645\u5355\u4F4D\n antialiasblur *= pow(19.0 - u_Zoom, 2.0);\n antialiasblur = max(antialiasblur, -0.01);\n // offset *= 0.5;\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {\n aPosition.xy += offset;\n offset.x = 0.0;\n offset.y = 0.0;\n }\n }\n\n // TODP: /abs(extrude.x) \u662F\u4E3A\u4E86\u517C\u5BB9\u5730\u7403\u6A21\u5F0F\n v_data = vec4(extrude.x/abs(extrude.x), extrude.y/abs(extrude.y), antialiasblur,shape_type);\n\n\n // vec4 project_pos = project_position(vec4(a_Position.xy, 0.0, 1.0));\n vec4 project_pos = project_position(vec4(aPosition.xy, 0.0, 1.0));\n // gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, project_pixel(setPickingOrder(0.0)), 1.0));\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n gl_Position = u_Mvp * vec4(project_pos.xy + offset, 0.0, 1.0);\n } else {\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, project_pixel(setPickingOrder(0.0)), 1.0));\n }\n\n if(u_globel > 0.0) {\n gl_Position = u_ViewProjectionMatrix * vec4(a_Position + extrude * newSize * 0.1, 1.0);\n }\n \n // gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, 0.0, 1.0));\n\n setPickingColor(a_PickingColor);\n}\n";
49
49
 
@@ -40,7 +40,7 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
40
40
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
41
41
 
42
42
  var pointFillFrag = "uniform sampler2D u_texture;\nuniform vec2 u_textSize;\n\nuniform float u_additive;\n\nvarying mat4 styleMappingMat; // \u4F20\u9012\u4ECE\u7247\u5143\u4E2D\u4F20\u9012\u7684\u6620\u5C04\u6570\u636E\n\nvarying float v_radius;\n\n#pragma include \"sdf_2d\"\n#pragma include \"picking\"\nvarying vec2 v_uv; // \u672C\u8EAB\u7684 uv \u5750\u6807\nvarying vec2 v_Iconuv;\n\nvoid main() {\n\n float opacity = styleMappingMat[0][0];\n\n vec2 pos = v_Iconuv / u_textSize + v_uv / u_textSize * 64.;\n gl_FragColor = texture2D(u_texture, pos);\n gl_FragColor.a *= opacity;\n\n gl_FragColor = filterColor(gl_FragColor);\n}\n";
43
- var pointFillVert = "attribute vec4 a_Color;\nattribute vec3 a_Position;\nattribute vec3 a_Extrude;\nattribute float a_Size;\nattribute vec2 a_Uv;\n\nvarying mat4 styleMappingMat; // \u7528\u4E8E\u5C06\u5728\u9876\u70B9\u7740\u8272\u5668\u4E2D\u8BA1\u7B97\u597D\u7684\u6837\u5F0F\u503C\u4F20\u9012\u7ED9\u7247\u5143\n\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\nuniform mat2 u_RotateMatrix;\nuniform float u_isMeter;\n\nvarying float v_radius;\nvarying vec2 v_uv; // \u672C\u8EAB\u7684 uv \u5750\u6807\nvarying vec2 v_Iconuv; // icon \u8D34\u56FE\u7684 uv \u5750\u6807\n\nuniform float u_opacity : 1;\nuniform vec2 u_offsets;\n\n#pragma include \"styleMapping\"\n#pragma include \"styleMappingCalOpacity\"\n\n#pragma include \"projection\"\n#pragma include \"picking\"\n\n\nvoid main() {\n vec3 extrude = a_Extrude;\n\n v_uv = (a_Extrude.xy + 1.0)/2.0;\n v_uv.y = 1.0 - v_uv.y;\n v_Iconuv = a_Uv;\n\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n styleMappingMat = mat4(\n 0.0, 0.0, 0.0, 0.0, // opacity - empty - empty - empty\n 0.0, 0.0, 0.0, 0.0, // empty - empty - empty - empty\n 0.0, 0.0, 0.0, 0.0, // offsets[0] - offsets[1]\n 0.0, 0.0, 0.0, 0.0\n );\n\n float rowCount = u_cellTypeLayout[0][0]; // \u5F53\u524D\u7684\u6570\u636E\u7EB9\u7406\u6709\u51E0\u884C\n float columnCount = u_cellTypeLayout[0][1]; // \u5F53\u770B\u5230\u6570\u636E\u7EB9\u7406\u6709\u51E0\u5217\n float columnWidth = 1.0/columnCount; // \u5217\u5BBD\n float rowHeight = 1.0/rowCount; // \u884C\u9AD8\n float cellCount = calCellCount(); // opacity - strokeOpacity - strokeWidth - stroke - offsets\n float id = a_vertexId; // \u7B2Cn\u4E2A\u9876\u70B9\n float cellCurrentRow = floor(id * cellCount / columnCount) + 1.0; // \u8D77\u59CB\u70B9\u5728\u7B2C\u51E0\u884C\n float cellCurrentColumn = mod(id * cellCount, columnCount) + 1.0; // \u8D77\u59CB\u70B9\u5728\u7B2C\u51E0\u5217\n \n // cell \u56FA\u5B9A\u987A\u5E8F opacity -> strokeOpacity -> strokeWidth -> stroke ... \n // \u6309\u987A\u5E8F\u4ECE cell \u4E2D\u53D6\u503C\u3001\u82E5\u6CA1\u6709\u5219\u81EA\u52A8\u5F80\u4E0B\u53D6\u503C\n float textureOffset = 0.0; // \u5728 cell \u4E2D\u53D6\u503C\u7684\u504F\u79FB\u91CF\n\n vec2 opacityAndOffset = calOpacityAndOffset(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset, columnWidth, rowHeight);\n styleMappingMat[0][0] = opacityAndOffset.r;\n textureOffset = opacityAndOffset.g;\n\n vec2 textrueOffsets = vec2(0.0, 0.0);\n if(hasOffsets()) {\n vec2 valueXPos = nextPos(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset);\n textrueOffsets.r = pos2value(valueXPos, columnWidth, rowHeight); // x\n textureOffset += 1.0;\n\n vec2 valueYPos = nextPos(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset);\n textrueOffsets.g = pos2value(valueYPos, columnWidth, rowHeight); // x\n textureOffset += 1.0;\n } else {\n textrueOffsets = u_offsets;\n }\n\n // cal style mapping\n\n // radius(16-bit)\n v_radius = a_Size;\n\n // TODO: billboard\n // anti-alias\n \n\n vec2 offset = (u_RotateMatrix * extrude.xy * (a_Size) + textrueOffsets);\n vec3 aPosition = a_Position;\n if(u_isMeter < 1.0) {\n // \u4E0D\u4EE5\u7C73\u4E3A\u5B9E\u9645\u5355\u4F4D\n offset = project_pixel(offset);\n } else {\n // \u4EE5\u7C73\u4E3A\u5B9E\u9645\u5355\u4F4D\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {\n aPosition.xy += offset;\n offset.x = 0.0;\n offset.y = 0.0;\n }\n }\n\n\n // vec4 project_pos = project_position(vec4(a_Position.xy, 0.0, 1.0));\n vec4 project_pos = project_position(vec4(aPosition.xy, 0.0, 1.0));\n // gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, project_pixel(setPickingOrder(0.0)), 1.0));\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n gl_Position = u_Mvp * vec4(project_pos.xy + offset, 0.0, 1.0);\n } else {\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, project_pixel(setPickingOrder(0.0)), 1.0));\n }\n \n // gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, 0.0, 1.0));\n\n setPickingColor(a_PickingColor);\n}\n";
43
+ var pointFillVert = "attribute vec4 a_Color;\nattribute vec3 a_Position;\nattribute vec3 a_Extrude;\nattribute float a_Size;\nattribute vec2 a_Uv;\nattribute float a_Rotate;\n\nvarying mat4 styleMappingMat; // \u7528\u4E8E\u5C06\u5728\u9876\u70B9\u7740\u8272\u5668\u4E2D\u8BA1\u7B97\u597D\u7684\u6837\u5F0F\u503C\u4F20\u9012\u7ED9\u7247\u5143\n\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\nuniform mat2 u_RotateMatrix;\nuniform float u_isMeter;\n\nvarying float v_radius;\nvarying vec2 v_uv; // \u672C\u8EAB\u7684 uv \u5750\u6807\nvarying vec2 v_Iconuv; // icon \u8D34\u56FE\u7684 uv \u5750\u6807\n\nuniform float u_opacity : 1;\nuniform vec2 u_offsets;\n\n#pragma include \"styleMapping\"\n#pragma include \"styleMappingCalOpacity\"\n\n#pragma include \"projection\"\n#pragma include \"picking\"\n\n\nvoid main() {\n vec3 extrude = a_Extrude;\n\n v_uv = (a_Extrude.xy + 1.0)/2.0;\n v_uv.y = 1.0 - v_uv.y;\n v_Iconuv = a_Uv;\n\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n styleMappingMat = mat4(\n 0.0, 0.0, 0.0, 0.0, // opacity - empty - empty - empty\n 0.0, 0.0, 0.0, 0.0, // empty - empty - empty - empty\n 0.0, 0.0, 0.0, 0.0, // offsets[0] - offsets[1]\n 0.0, 0.0, 0.0, 0.0\n );\n\n float rowCount = u_cellTypeLayout[0][0]; // \u5F53\u524D\u7684\u6570\u636E\u7EB9\u7406\u6709\u51E0\u884C\n float columnCount = u_cellTypeLayout[0][1]; // \u5F53\u770B\u5230\u6570\u636E\u7EB9\u7406\u6709\u51E0\u5217\n float columnWidth = 1.0/columnCount; // \u5217\u5BBD\n float rowHeight = 1.0/rowCount; // \u884C\u9AD8\n float cellCount = calCellCount(); // opacity - strokeOpacity - strokeWidth - stroke - offsets\n float id = a_vertexId; // \u7B2Cn\u4E2A\u9876\u70B9\n float cellCurrentRow = floor(id * cellCount / columnCount) + 1.0; // \u8D77\u59CB\u70B9\u5728\u7B2C\u51E0\u884C\n float cellCurrentColumn = mod(id * cellCount, columnCount) + 1.0; // \u8D77\u59CB\u70B9\u5728\u7B2C\u51E0\u5217\n \n // cell \u56FA\u5B9A\u987A\u5E8F opacity -> strokeOpacity -> strokeWidth -> stroke ... \n // \u6309\u987A\u5E8F\u4ECE cell \u4E2D\u53D6\u503C\u3001\u82E5\u6CA1\u6709\u5219\u81EA\u52A8\u5F80\u4E0B\u53D6\u503C\n float textureOffset = 0.0; // \u5728 cell \u4E2D\u53D6\u503C\u7684\u504F\u79FB\u91CF\n\n vec2 opacityAndOffset = calOpacityAndOffset(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset, columnWidth, rowHeight);\n styleMappingMat[0][0] = opacityAndOffset.r;\n textureOffset = opacityAndOffset.g;\n\n vec2 textrueOffsets = vec2(0.0, 0.0);\n if(hasOffsets()) {\n vec2 valueXPos = nextPos(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset);\n textrueOffsets.r = pos2value(valueXPos, columnWidth, rowHeight); // x\n textureOffset += 1.0;\n\n vec2 valueYPos = nextPos(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset);\n textrueOffsets.g = pos2value(valueYPos, columnWidth, rowHeight); // x\n textureOffset += 1.0;\n } else {\n textrueOffsets = u_offsets;\n }\n\n // cal style mapping\n\n // radius(16-bit)\n v_radius = a_Size;\n\n // TODO: billboard\n // anti-alias\n \n\n highp float angle_sin = sin(a_Rotate);\n highp float angle_cos = cos(a_Rotate);\n mat2 rotation_matrix = mat2(angle_cos, -1.0 * angle_sin, angle_sin, angle_cos);\n\n // vec2 offset = (u_RotateMatrix * extrude.xy * (a_Size) + textrueOffsets);\n vec2 offset = (rotation_matrix * u_RotateMatrix * extrude.xy * (a_Size) + textrueOffsets);\n vec3 aPosition = a_Position;\n if(u_isMeter < 1.0) {\n // \u4E0D\u4EE5\u7C73\u4E3A\u5B9E\u9645\u5355\u4F4D\n offset = project_pixel(offset);\n } else {\n // \u4EE5\u7C73\u4E3A\u5B9E\u9645\u5355\u4F4D\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {\n aPosition.xy += offset;\n offset.x = 0.0;\n offset.y = 0.0;\n }\n }\n\n\n // vec4 project_pos = project_position(vec4(a_Position.xy, 0.0, 1.0));\n vec4 project_pos = project_position(vec4(aPosition.xy, 0.0, 1.0));\n // gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, project_pixel(setPickingOrder(0.0)), 1.0));\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n gl_Position = u_Mvp * vec4(project_pos.xy + offset, 0.0, 1.0);\n } else {\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, project_pixel(setPickingOrder(0.0)), 1.0));\n }\n \n // gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, 0.0, 1.0));\n\n setPickingColor(a_PickingColor);\n}\n";
44
44
 
45
45
  var FillImageModel = function (_BaseModel) {
46
46
  (0, _inherits2.default)(FillImageModel, _BaseModel);
@@ -117,7 +117,7 @@ var FillImageModel = function (_BaseModel) {
117
117
  rotateFlag = -1;
118
118
  }
119
119
 
120
- this.radian = rotation ? rotateFlag * Math.PI * rotation / 180 : rotateFlag * Math.PI * (this.mapService.getRotation() % 360) / 180;
120
+ this.radian = rotation !== undefined ? rotateFlag * Math.PI * rotation / 180 : rotateFlag * Math.PI * (this.mapService.getRotation() % 360) / 180;
121
121
 
122
122
  if (this.dataTextureTest && this.dataTextureNeedUpdate({
123
123
  opacity: opacity,
@@ -280,6 +280,24 @@ var FillImageModel = function (_BaseModel) {
280
280
  value: function registerBuiltinAttributes() {
281
281
  var _this2 = this;
282
282
 
283
+ this.styleAttributeService.registerStyleAttribute({
284
+ name: 'rotate',
285
+ type: _l7Core.AttributeType.Attribute,
286
+ descriptor: {
287
+ name: 'a_Rotate',
288
+ buffer: {
289
+ usage: _l7Core.gl.DYNAMIC_DRAW,
290
+ data: [],
291
+ type: _l7Core.gl.FLOAT
292
+ },
293
+ size: 1,
294
+ update: function update(feature, featureIdx, vertex, attributeIdx) {
295
+ var _feature$rotate = feature.rotate,
296
+ rotate = _feature$rotate === void 0 ? 0 : _feature$rotate;
297
+ return Array.isArray(rotate) ? [rotate[0]] : [rotate];
298
+ }
299
+ }
300
+ });
283
301
  this.styleAttributeService.registerStyleAttribute({
284
302
  name: 'uv',
285
303
  type: _l7Core.AttributeType.Attribute,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/point/models/fillmage.ts"],"names":["FillImageModel","createTexture2D","rendererService","texture","update","data","iconService","getCanvas","mag","min","mipmap","layer","renderLayers","gl","LINEAR","LINEAR_MIPMAP_LINEAR","premultiplyAlpha","width","height","canvasHeight","getLayerConfig","opacity","strokeOpacity","strokeWidth","stroke","offsets","blend","rotation","getDirty","bind","rotateFlag","mapService","version","radian","Math","PI","getRotation","dataTextureTest","dataTextureNeedUpdate","judgeStyleAttributes","encodeData","getEncodedData","calDataFrame","cellLength","cellProperties","rowCount","dataTexture","length","flipY","format","LUMINANCE","type","FLOAT","u_isMeter","Number","isMeter","u_RotateMatrix","Float32Array","cos","sin","u_additive","u_dataTexture","u_cellTypeLayout","getCellTypeLayout","u_texture","u_textSize","u_opacity","u_offsets","isOffsetStatic","styleAttributeService","createAttributesAndIndices","PointFillTriangulation","updateTexture","on","unit","Version","L7MAP","GLOBEL","calMeter2Coord","buildModels","getSource","extent","minLng","minLat","maxLng","maxLat","center","MAPBOX","window","mapboxgl","MercatorCoordinate","coord","fromLngLat","lng","lat","offsetInMeters","offsetInMercatorCoordinateUnits","meterInMercatorCoordinateUnits","westCoord","x","y","z","westLnglat","toLngLat","meter2coord","m1","meterToCoord","m2","Boolean","mask","maskInside","getShaders","frag","vert","buildLayerModel","moduleName","vertexShader","fragmentShader","triangulation","depth","enable","getBlend","stencil","cull","face","pointFillFrag","pointFillVert","off","destroy","registerStyleAttribute","name","AttributeType","Attribute","descriptor","buffer","usage","DYNAMIC_DRAW","size","feature","featureIdx","vertex","attributeIdx","iconMap","getIconMap","shape","extrude","extrudeIndex","Array","isArray","BaseModel"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AAUA;;AACA;;AAEA;;AAOA;;;;;;;;;IAEqBA,c;;;;;;;;;;;;;;;8FACU,C;;0FAEF,K;yFACF,C;gGA+SD,YAAM;AAC5B,UAAQC,eAAR,GAA4B,MAAKC,eAAjC,CAAQD,eAAR;;AACA,UAAI,MAAKE,OAAT,EAAkB;AAChB,cAAKA,OAAL,CAAaC,MAAb,CAAoB;AAClBC,UAAAA,IAAI,EAAE,MAAKC,WAAL,CAAiBC,SAAjB,EADY;AAElBC,UAAAA,GAAG,EAAE,QAFa;AAGlBC,UAAAA,GAAG,EAAE,uBAHa;AAIlBC,UAAAA,MAAM,EAAE;AAJU,SAApB;;AAQA,cAAKC,KAAL,CAAWC,YAAX;;AACA;AACD;;AACD,YAAKT,OAAL,GAAeF,eAAe,CAAC;AAC7BI,QAAAA,IAAI,EAAE,MAAKC,WAAL,CAAiBC,SAAjB,EADuB;AAE7BC,QAAAA,GAAG,EAAEK,WAAGC,MAFqB;AAI7BL,QAAAA,GAAG,EAAEI,WAAGE,oBAJqB;AAK7BC,QAAAA,gBAAgB,EAAE,KALW;AAM7BC,QAAAA,KAAK,EAAE,IANsB;AAO7BC,QAAAA,MAAM,EAAE,MAAKZ,WAAL,CAAiBa,YAAjB,IAAiC,GAPZ;AAQ7BT,QAAAA,MAAM,EAAE;AARqB,OAAD,CAA9B;AAUD,K;;;;;;WAtUD,wBAAqC;AACnC,iBAQI,KAAKC,KAAL,CAAWS,cA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,YAJM,EAKH;AACH,gCAAqBH,OAArB,CAAQD,IAAR;AAAA,gBAAQA,IAAR,8BAAe,CAAf;AAEA,mBAAOU,KAAK,CAACC,OAAN,CAAcX,IAAd,IACH,CAACA,IAAI,CAAC,CAAD,CAAJ,GAAU,MAAI,CAACjC,WAAhB,CADG,GAEH,CAAEiC,IAAD,GAAmB,MAAI,CAACjC,WAAzB,CAFJ;AAGD;AApBS;AAHoC,OAAlD;AA0BD;;;EAjTyC6C,mB","sourcesContent":["import {\n AttributeType,\n gl,\n IAttribute,\n IElements,\n IEncodeFeature,\n IModel,\n IModelUniform,\n ITexture2D,\n} from '@antv/l7-core';\nimport { getCullFace, getMask } from '@antv/l7-utils';\nimport BaseModel from '../../core/BaseModel';\nimport { IPointLayerStyleOptions } from '../../core/interface';\nimport { PointFillTriangulation } from '../../core/triangulation';\n// static pointLayer shader - not support animate\nimport pointFillFrag from '../shaders/image/fillImage_frag.glsl';\nimport pointFillVert from '../shaders/image/fillImage_vert.glsl';\n\nimport { isNumber } from 'lodash';\n\nimport { Version } from '@antv/l7-maps';\n\nexport default class FillImageModel extends BaseModel {\n public meter2coord: number = 1;\n private texture: ITexture2D;\n private isMeter: boolean = false;\n private radian: number = 0; // 旋转的弧度\n public getUninforms(): IModelUniform {\n const {\n opacity = 1,\n strokeOpacity = 1,\n strokeWidth = 0,\n stroke = 'rgba(0,0,0,0)',\n offsets = [0, 0],\n blend,\n rotation,\n } = this.layer.getLayerConfig() as IPointLayerStyleOptions;\n\n if (this.rendererService.getDirty()) {\n this.texture.bind();\n }\n\n /**\n * rotateFlag\n * L7MAP 1\n * MAPBOX 1\n * GAODE2.x -1\n * GAODE1.x -1\n */\n let rotateFlag = 1;\n if (\n this.mapService.version === 'GAODE2.x' ||\n this.mapService.version === 'GAODE1.x'\n ) {\n rotateFlag = -1;\n }\n // 控制图标的旋转角度(绕 Z 轴旋转)\n this.radian = rotation\n ? (rotateFlag * Math.PI * rotation) / 180\n : (rotateFlag * Math.PI * (this.mapService.getRotation() % 360)) / 180;\n\n if (\n this.dataTextureTest &&\n this.dataTextureNeedUpdate({\n opacity,\n strokeOpacity,\n strokeWidth,\n stroke,\n offsets,\n })\n ) {\n // 判断当前的样式中哪些是需要进行数据映射的,哪些是常量,同时计算用于构建数据纹理的一些中间变量\n this.judgeStyleAttributes({\n opacity,\n strokeOpacity,\n strokeWidth,\n stroke,\n offsets,\n });\n\n const encodeData = this.layer.getEncodedData();\n const { data, width, height } = this.calDataFrame(\n this.cellLength,\n encodeData,\n this.cellProperties,\n );\n this.rowCount = height; // 当前数据纹理有多少行\n\n this.dataTexture =\n this.cellLength > 0 && data.length > 0\n ? this.createTexture2D({\n flipY: true,\n data,\n format: gl.LUMINANCE,\n type: gl.FLOAT,\n width,\n height,\n })\n : this.createTexture2D({\n flipY: true,\n data: [1],\n format: gl.LUMINANCE,\n type: gl.FLOAT,\n width: 1,\n height: 1,\n });\n }\n return {\n u_isMeter: Number(this.isMeter),\n u_RotateMatrix: new Float32Array([\n Math.cos(this.radian),\n Math.sin(this.radian),\n -Math.sin(this.radian),\n Math.cos(this.radian),\n ]),\n u_additive: blend === 'additive' ? 1.0 : 0.0,\n\n u_dataTexture: this.dataTexture, // 数据纹理 - 有数据映射的时候纹理中带数据,若没有任何数据映射时纹理是 [1]\n u_cellTypeLayout: this.getCellTypeLayout(),\n\n u_texture: this.texture,\n u_textSize: [1024, this.iconService.canvasHeight || 128],\n\n u_opacity: isNumber(opacity) ? opacity : 1.0,\n u_offsets: this.isOffsetStatic(offsets)\n ? (offsets as [number, number])\n : [0, 0],\n };\n }\n\n public getAttribute(): {\n attributes: {\n [attributeName: string]: IAttribute;\n };\n elements: IElements;\n } {\n return this.styleAttributeService.createAttributesAndIndices(\n this.layer.getEncodedData(),\n PointFillTriangulation,\n );\n }\n\n public initModels(): IModel[] {\n this.updateTexture();\n this.iconService.on('imageUpdate', this.updateTexture);\n\n const {\n unit = 'l7size',\n } = this.layer.getLayerConfig() as IPointLayerStyleOptions;\n const { version } = this.mapService;\n if (\n unit === 'meter' &&\n version !== Version.L7MAP &&\n version !== Version.GLOBEL\n ) {\n this.isMeter = true;\n this.calMeter2Coord();\n }\n\n return this.buildModels();\n }\n\n /**\n * 计算等面积点图层(unit meter)笛卡尔坐标标度与世界坐标标度的比例\n * @returns\n */\n public calMeter2Coord() {\n // @ts-ignore\n const [minLng, minLat, maxLng, maxLat] = this.layer.getSource().extent;\n const center = [(minLng + maxLng) / 2, (minLat + maxLat) / 2];\n\n const { version } = this.mapService;\n if (version === Version.MAPBOX && window.mapboxgl.MercatorCoordinate) {\n const coord = window.mapboxgl.MercatorCoordinate.fromLngLat(\n { lng: center[0], lat: center[1] },\n 0,\n );\n const offsetInMeters = 1;\n const offsetInMercatorCoordinateUnits =\n offsetInMeters * coord.meterInMercatorCoordinateUnits();\n const westCoord = new window.mapboxgl.MercatorCoordinate(\n coord.x - offsetInMercatorCoordinateUnits,\n coord.y,\n coord.z,\n );\n const westLnglat = westCoord.toLngLat();\n\n this.meter2coord = center[0] - westLnglat.lng;\n return;\n }\n\n // @ts-ignore\n const m1 = this.mapService.meterToCoord(center, [minLng, minLat]);\n // @ts-ignore\n const m2 = this.mapService.meterToCoord(center, [\n maxLng === minLng ? maxLng + 0.1 : maxLng,\n maxLat === minLat ? minLat + 0.1 : maxLat,\n ]);\n this.meter2coord = (m1 + m2) / 2;\n if (!Boolean(this.meter2coord)) {\n // Tip: 兼容单个数据导致的 m1、m2 为 NaN\n this.meter2coord = 7.70681090738883;\n }\n }\n\n public buildModels(): IModel[] {\n const {\n mask = false,\n maskInside = true,\n } = this.layer.getLayerConfig() as IPointLayerStyleOptions;\n const { frag, vert, type } = this.getShaders();\n return [\n this.layer.buildLayerModel({\n moduleName: 'pointfill_' + type,\n vertexShader: vert,\n fragmentShader: frag,\n triangulation: PointFillTriangulation,\n depth: { enable: false },\n blend: this.getBlend(),\n stencil: getMask(mask, maskInside),\n cull: {\n enable: true,\n face: getCullFace(this.mapService.version),\n },\n }),\n ];\n }\n\n public getShaders(): { frag: string; vert: string; type: string } {\n return {\n frag: pointFillFrag,\n vert: pointFillVert,\n type: 'normal',\n };\n }\n\n public clearModels() {\n this.iconService.off('imageUpdate', this.updateTexture);\n this.texture?.destroy();\n this.dataTexture?.destroy();\n }\n\n // overwrite baseModel func\n protected registerBuiltinAttributes() {\n this.styleAttributeService.registerStyleAttribute({\n name: 'uv',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_Uv',\n buffer: {\n // give the WebGL driver a hint that this buffer may change\n usage: gl.DYNAMIC_DRAW,\n data: [],\n type: gl.FLOAT,\n },\n size: 2,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n ) => {\n const iconMap = this.iconService.getIconMap();\n const { shape } = feature;\n const { x, y } = iconMap[shape as string] || { x: 0, y: 0 };\n return [x, y];\n },\n },\n });\n\n this.styleAttributeService.registerStyleAttribute({\n name: 'extrude',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_Extrude',\n buffer: {\n // give the WebGL driver a hint that this buffer may change\n usage: gl.DYNAMIC_DRAW,\n data: [],\n type: gl.FLOAT,\n },\n size: 3,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n ) => {\n const extrude = [1, 1, 0, -1, 1, 0, -1, -1, 0, 1, -1, 0];\n\n const extrudeIndex = (attributeIdx % 4) * 3;\n return [\n extrude[extrudeIndex],\n extrude[extrudeIndex + 1],\n extrude[extrudeIndex + 2],\n ];\n },\n },\n });\n\n // point layer size;\n this.styleAttributeService.registerStyleAttribute({\n name: 'size',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_Size',\n buffer: {\n // give the WebGL driver a hint that this buffer may change\n usage: gl.DYNAMIC_DRAW,\n data: [],\n type: gl.FLOAT,\n },\n size: 1,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n ) => {\n const { size = 5 } = feature;\n // console.log('featureIdx', featureIdx, feature)\n return Array.isArray(size)\n ? [size[0] * this.meter2coord]\n : [(size as number) * this.meter2coord];\n },\n },\n });\n }\n\n private updateTexture = () => {\n const { createTexture2D } = this.rendererService;\n if (this.texture) {\n this.texture.update({\n data: this.iconService.getCanvas(),\n mag: 'linear',\n min: 'linear mipmap nearest',\n mipmap: true,\n });\n // this.layer.render();\n // TODO: 更新完纹理后在更新的图层的时候需要更新所有的图层\n this.layer.renderLayers();\n return;\n }\n this.texture = createTexture2D({\n data: this.iconService.getCanvas(),\n mag: gl.LINEAR,\n // min: gl.LINEAR,\n min: gl.LINEAR_MIPMAP_LINEAR,\n premultiplyAlpha: false,\n width: 1024,\n height: this.iconService.canvasHeight || 128,\n mipmap: true,\n });\n };\n}\n"],"file":"fillmage.js"}
1
+ {"version":3,"sources":["../../../src/point/models/fillmage.ts"],"names":["FillImageModel","createTexture2D","rendererService","texture","update","data","iconService","getCanvas","mag","min","mipmap","layer","renderLayers","gl","LINEAR","LINEAR_MIPMAP_LINEAR","premultiplyAlpha","width","height","canvasHeight","getLayerConfig","opacity","strokeOpacity","strokeWidth","stroke","offsets","blend","rotation","getDirty","bind","rotateFlag","mapService","version","radian","undefined","Math","PI","getRotation","dataTextureTest","dataTextureNeedUpdate","judgeStyleAttributes","encodeData","getEncodedData","calDataFrame","cellLength","cellProperties","rowCount","dataTexture","length","flipY","format","LUMINANCE","type","FLOAT","u_isMeter","Number","isMeter","u_RotateMatrix","Float32Array","cos","sin","u_additive","u_dataTexture","u_cellTypeLayout","getCellTypeLayout","u_texture","u_textSize","u_opacity","u_offsets","isOffsetStatic","styleAttributeService","createAttributesAndIndices","PointFillTriangulation","updateTexture","on","unit","Version","L7MAP","GLOBEL","calMeter2Coord","buildModels","getSource","extent","minLng","minLat","maxLng","maxLat","center","MAPBOX","window","mapboxgl","MercatorCoordinate","coord","fromLngLat","lng","lat","offsetInMeters","offsetInMercatorCoordinateUnits","meterInMercatorCoordinateUnits","westCoord","x","y","z","westLnglat","toLngLat","meter2coord","m1","meterToCoord","m2","Boolean","mask","maskInside","getShaders","frag","vert","buildLayerModel","moduleName","vertexShader","fragmentShader","triangulation","depth","enable","getBlend","stencil","cull","face","pointFillFrag","pointFillVert","off","destroy","registerStyleAttribute","name","AttributeType","Attribute","descriptor","buffer","usage","DYNAMIC_DRAW","size","feature","featureIdx","vertex","attributeIdx","rotate","Array","isArray","iconMap","getIconMap","shape","extrude","extrudeIndex","BaseModel"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AAUA;;AACA;;AAEA;;AAOA;;;;;;;;;IAEqBA,c;;;;;;;;;;;;;;;8FACU,C;;0FAEF,K;yFACF,C;gGAsUD,YAAM;AAC5B,UAAQC,eAAR,GAA4B,MAAKC,eAAjC,CAAQD,eAAR;;AACA,UAAI,MAAKE,OAAT,EAAkB;AAChB,cAAKA,OAAL,CAAaC,MAAb,CAAoB;AAClBC,UAAAA,IAAI,EAAE,MAAKC,WAAL,CAAiBC,SAAjB,EADY;AAElBC,UAAAA,GAAG,EAAE,QAFa;AAGlBC,UAAAA,GAAG,EAAE,uBAHa;AAIlBC,UAAAA,MAAM,EAAE;AAJU,SAApB;;AAQA,cAAKC,KAAL,CAAWC,YAAX;;AACA;AACD;;AACD,YAAKT,OAAL,GAAeF,eAAe,CAAC;AAC7BI,QAAAA,IAAI,EAAE,MAAKC,WAAL,CAAiBC,SAAjB,EADuB;AAE7BC,QAAAA,GAAG,EAAEK,WAAGC,MAFqB;AAI7BL,QAAAA,GAAG,EAAEI,WAAGE,oBAJqB;AAK7BC,QAAAA,gBAAgB,EAAE,KALW;AAM7BC,QAAAA,KAAK,EAAE,IANsB;AAO7BC,QAAAA,MAAM,EAAE,MAAKZ,WAAL,CAAiBa,YAAjB,IAAiC,GAPZ;AAQ7BT,QAAAA,MAAM,EAAE;AARqB,OAAD,CAA9B;AAUD,K;;;;;;WA7VD,wBAAqC;AACnC,iBAQI,KAAKC,KAAL,CAAWS,cAAX,EARJ;AAA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B;AAEA,gBAAMC,YAAY,GAAIR,YAAY,GAAG,CAAhB,GAAqB,CAA1C;AACA,mBAAO,CACLO,OAAO,CAACC,YAAD,CADF,EAELD,OAAO,CAACC,YAAY,GAAG,CAAhB,CAFF,EAGLD,OAAO,CAACC,YAAY,GAAG,CAAhB,CAHF,CAAP;AAKD;AAvBS;AAHoC,OAAlD;AA+BA,WAAKhF,qBAAL,CAA2B4D,sBAA3B,CAAkD;AAChDC,QAAAA,IAAI,EAAE,MAD0C;AAEhD/E,QAAAA,IAAI,EAAEgF,sBAAcC,SAF4B;AAGhDC,QAAAA,UAAU,EAAE;AACVH,UAAAA,IAAI,EAAE,QADI;AAEVI,UAAAA,MAAM,EAAE;AAENC,YAAAA,KAAK,EAAE3H,WAAG4H,YAFJ;AAGNpI,YAAAA,IAAI,EAAE,EAHA;AAIN+C,YAAAA,IAAI,EAAEvC,WAAGwC;AAJH,WAFE;AAQVqF,UAAAA,IAAI,EAAE,CARI;AASVtI,UAAAA,MAAM,EAAE,gBACNuI,OADM,EAENC,UAFM,EAGNC,MAHM,EAINC,YAJM,EAKH;AACH,gCAAqBH,OAArB,CAAQD,IAAR;AAAA,gBAAQA,IAAR,8BAAe,CAAf;AAEA,mBAAOM,KAAK,CAACC,OAAN,CAAcP,IAAd,IACH,CAACA,IAAI,CAAC,CAAD,CAAJ,GAAU,MAAI,CAACjC,WAAhB,CADG,GAEH,CAAEiC,IAAD,GAAmB,MAAI,CAACjC,WAAzB,CAFJ;AAGD;AApBS;AAHoC,OAAlD;AA0BD;;;EAxUyC8C,mB","sourcesContent":["import {\n AttributeType,\n gl,\n IAttribute,\n IElements,\n IEncodeFeature,\n IModel,\n IModelUniform,\n ITexture2D,\n} from '@antv/l7-core';\nimport { getCullFace, getMask } from '@antv/l7-utils';\nimport BaseModel from '../../core/BaseModel';\nimport { IPointLayerStyleOptions } from '../../core/interface';\nimport { PointFillTriangulation } from '../../core/triangulation';\n// static pointLayer shader - not support animate\nimport pointFillFrag from '../shaders/image/fillImage_frag.glsl';\nimport pointFillVert from '../shaders/image/fillImage_vert.glsl';\n\nimport { isNumber } from 'lodash';\n\nimport { Version } from '@antv/l7-maps';\n\nexport default class FillImageModel extends BaseModel {\n public meter2coord: number = 1;\n private texture: ITexture2D;\n private isMeter: boolean = false;\n private radian: number = 0; // 旋转的弧度\n public getUninforms(): IModelUniform {\n const {\n opacity = 1,\n strokeOpacity = 1,\n strokeWidth = 0,\n stroke = 'rgba(0,0,0,0)',\n offsets = [0, 0],\n blend,\n rotation,\n } = this.layer.getLayerConfig() as IPointLayerStyleOptions;\n\n if (this.rendererService.getDirty()) {\n this.texture.bind();\n }\n\n /**\n * rotateFlag\n * L7MAP 1\n * MAPBOX 1\n * GAODE2.x -1\n * GAODE1.x -1\n */\n let rotateFlag = 1;\n if (\n this.mapService.version === 'GAODE2.x' ||\n this.mapService.version === 'GAODE1.x'\n ) {\n rotateFlag = -1;\n }\n // 控制图标的旋转角度(绕 Z 轴旋转)\n this.radian =\n rotation !== undefined\n ? (rotateFlag * Math.PI * rotation) / 180\n : (rotateFlag * Math.PI * (this.mapService.getRotation() % 360)) / 180;\n\n if (\n this.dataTextureTest &&\n this.dataTextureNeedUpdate({\n opacity,\n strokeOpacity,\n strokeWidth,\n stroke,\n offsets,\n })\n ) {\n // 判断当前的样式中哪些是需要进行数据映射的,哪些是常量,同时计算用于构建数据纹理的一些中间变量\n this.judgeStyleAttributes({\n opacity,\n strokeOpacity,\n strokeWidth,\n stroke,\n offsets,\n });\n\n const encodeData = this.layer.getEncodedData();\n const { data, width, height } = this.calDataFrame(\n this.cellLength,\n encodeData,\n this.cellProperties,\n );\n this.rowCount = height; // 当前数据纹理有多少行\n\n this.dataTexture =\n this.cellLength > 0 && data.length > 0\n ? this.createTexture2D({\n flipY: true,\n data,\n format: gl.LUMINANCE,\n type: gl.FLOAT,\n width,\n height,\n })\n : this.createTexture2D({\n flipY: true,\n data: [1],\n format: gl.LUMINANCE,\n type: gl.FLOAT,\n width: 1,\n height: 1,\n });\n }\n return {\n u_isMeter: Number(this.isMeter),\n u_RotateMatrix: new Float32Array([\n Math.cos(this.radian),\n Math.sin(this.radian),\n -Math.sin(this.radian),\n Math.cos(this.radian),\n ]),\n u_additive: blend === 'additive' ? 1.0 : 0.0,\n\n u_dataTexture: this.dataTexture, // 数据纹理 - 有数据映射的时候纹理中带数据,若没有任何数据映射时纹理是 [1]\n u_cellTypeLayout: this.getCellTypeLayout(),\n\n u_texture: this.texture,\n u_textSize: [1024, this.iconService.canvasHeight || 128],\n\n u_opacity: isNumber(opacity) ? opacity : 1.0,\n u_offsets: this.isOffsetStatic(offsets)\n ? (offsets as [number, number])\n : [0, 0],\n };\n }\n\n public getAttribute(): {\n attributes: {\n [attributeName: string]: IAttribute;\n };\n elements: IElements;\n } {\n return this.styleAttributeService.createAttributesAndIndices(\n this.layer.getEncodedData(),\n PointFillTriangulation,\n );\n }\n\n public initModels(): IModel[] {\n this.updateTexture();\n this.iconService.on('imageUpdate', this.updateTexture);\n\n const {\n unit = 'l7size',\n } = this.layer.getLayerConfig() as IPointLayerStyleOptions;\n const { version } = this.mapService;\n if (\n unit === 'meter' &&\n version !== Version.L7MAP &&\n version !== Version.GLOBEL\n ) {\n this.isMeter = true;\n this.calMeter2Coord();\n }\n\n return this.buildModels();\n }\n\n /**\n * 计算等面积点图层(unit meter)笛卡尔坐标标度与世界坐标标度的比例\n * @returns\n */\n public calMeter2Coord() {\n // @ts-ignore\n const [minLng, minLat, maxLng, maxLat] = this.layer.getSource().extent;\n const center = [(minLng + maxLng) / 2, (minLat + maxLat) / 2];\n\n const { version } = this.mapService;\n if (version === Version.MAPBOX && window.mapboxgl.MercatorCoordinate) {\n const coord = window.mapboxgl.MercatorCoordinate.fromLngLat(\n { lng: center[0], lat: center[1] },\n 0,\n );\n const offsetInMeters = 1;\n const offsetInMercatorCoordinateUnits =\n offsetInMeters * coord.meterInMercatorCoordinateUnits();\n const westCoord = new window.mapboxgl.MercatorCoordinate(\n coord.x - offsetInMercatorCoordinateUnits,\n coord.y,\n coord.z,\n );\n const westLnglat = westCoord.toLngLat();\n\n this.meter2coord = center[0] - westLnglat.lng;\n return;\n }\n\n // @ts-ignore\n const m1 = this.mapService.meterToCoord(center, [minLng, minLat]);\n // @ts-ignore\n const m2 = this.mapService.meterToCoord(center, [\n maxLng === minLng ? maxLng + 0.1 : maxLng,\n maxLat === minLat ? minLat + 0.1 : maxLat,\n ]);\n this.meter2coord = (m1 + m2) / 2;\n if (!Boolean(this.meter2coord)) {\n // Tip: 兼容单个数据导致的 m1、m2 为 NaN\n this.meter2coord = 7.70681090738883;\n }\n }\n\n public buildModels(): IModel[] {\n const {\n mask = false,\n maskInside = true,\n } = this.layer.getLayerConfig() as IPointLayerStyleOptions;\n const { frag, vert, type } = this.getShaders();\n return [\n this.layer.buildLayerModel({\n moduleName: 'pointfill_' + type,\n vertexShader: vert,\n fragmentShader: frag,\n triangulation: PointFillTriangulation,\n depth: { enable: false },\n blend: this.getBlend(),\n stencil: getMask(mask, maskInside),\n cull: {\n enable: true,\n face: getCullFace(this.mapService.version),\n },\n }),\n ];\n }\n\n public getShaders(): { frag: string; vert: string; type: string } {\n return {\n frag: pointFillFrag,\n vert: pointFillVert,\n type: 'normal',\n };\n }\n\n public clearModels() {\n this.iconService.off('imageUpdate', this.updateTexture);\n this.texture?.destroy();\n this.dataTexture?.destroy();\n }\n\n // overwrite baseModel func\n protected registerBuiltinAttributes() {\n this.styleAttributeService.registerStyleAttribute({\n name: 'rotate',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_Rotate',\n buffer: {\n usage: gl.DYNAMIC_DRAW,\n data: [],\n type: gl.FLOAT,\n },\n size: 1,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n ) => {\n const { rotate = 0 } = feature;\n return Array.isArray(rotate) ? [rotate[0]] : [rotate as number];\n },\n },\n });\n this.styleAttributeService.registerStyleAttribute({\n name: 'uv',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_Uv',\n buffer: {\n // give the WebGL driver a hint that this buffer may change\n usage: gl.DYNAMIC_DRAW,\n data: [],\n type: gl.FLOAT,\n },\n size: 2,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n ) => {\n const iconMap = this.iconService.getIconMap();\n const { shape } = feature;\n const { x, y } = iconMap[shape as string] || { x: 0, y: 0 };\n return [x, y];\n },\n },\n });\n\n this.styleAttributeService.registerStyleAttribute({\n name: 'extrude',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_Extrude',\n buffer: {\n // give the WebGL driver a hint that this buffer may change\n usage: gl.DYNAMIC_DRAW,\n data: [],\n type: gl.FLOAT,\n },\n size: 3,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n ) => {\n const extrude = [1, 1, 0, -1, 1, 0, -1, -1, 0, 1, -1, 0];\n\n const extrudeIndex = (attributeIdx % 4) * 3;\n return [\n extrude[extrudeIndex],\n extrude[extrudeIndex + 1],\n extrude[extrudeIndex + 2],\n ];\n },\n },\n });\n\n // point layer size;\n this.styleAttributeService.registerStyleAttribute({\n name: 'size',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_Size',\n buffer: {\n // give the WebGL driver a hint that this buffer may change\n usage: gl.DYNAMIC_DRAW,\n data: [],\n type: gl.FLOAT,\n },\n size: 1,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n ) => {\n const { size = 5 } = feature;\n // console.log('featureIdx', featureIdx, feature)\n return Array.isArray(size)\n ? [size[0] * this.meter2coord]\n : [(size as number) * this.meter2coord];\n },\n },\n });\n }\n\n private updateTexture = () => {\n const { createTexture2D } = this.rendererService;\n if (this.texture) {\n this.texture.update({\n data: this.iconService.getCanvas(),\n mag: 'linear',\n min: 'linear mipmap nearest',\n mipmap: true,\n });\n // this.layer.render();\n // TODO: 更新完纹理后在更新的图层的时候需要更新所有的图层\n this.layer.renderLayers();\n return;\n }\n this.texture = createTexture2D({\n data: this.iconService.getCanvas(),\n mag: gl.LINEAR,\n // min: gl.LINEAR,\n min: gl.LINEAR_MIPMAP_LINEAR,\n premultiplyAlpha: false,\n width: 1024,\n height: this.iconService.canvasHeight || 128,\n mipmap: true,\n });\n };\n}\n"],"file":"fillmage.js"}
@@ -15,8 +15,6 @@ var _isNumber2 = _interopRequireDefault(require("lodash/isNumber"));
15
15
 
16
16
  var _isFunction2 = _interopRequireDefault(require("lodash/isFunction"));
17
17
 
18
- var _isArray2 = _interopRequireDefault(require("lodash/isArray"));
19
-
20
18
  var WIDTH = 1024;
21
19
 
22
20
  function registerStyleAttribute(fieldName, layer, field, values, updateOptions) {
@@ -60,10 +58,10 @@ function handleStyleFloat(fieldName, layer, styleFloat) {
60
58
  });
61
59
  } else if ((0, _isNumber2.default)(styleFloat)) {
62
60
  registerStyleAttribute(fieldName, layer, [styleFloat], undefined);
63
- } else if ((0, _isArray2.default)(styleFloat) && styleFloat.length === 2) {
61
+ } else if (Array.isArray(styleFloat) && styleFloat.length === 2) {
64
62
  if ((0, _isString2.default)(styleFloat[0]) && (0, _isFunction2.default)(styleFloat[1])) {
65
63
  registerStyleAttribute(fieldName, layer, styleFloat[0], styleFloat[1]);
66
- } else if ((0, _isString2.default)(styleFloat[0]) && (0, _isArray2.default)(styleFloat[1]) && (0, _isNumber2.default)(styleFloat[1][0]) && (0, _isNumber2.default)(styleFloat[1][1])) {
64
+ } else if ((0, _isString2.default)(styleFloat[0]) && Array.isArray(styleFloat[1]) && (0, _isNumber2.default)(styleFloat[1][0]) && (0, _isNumber2.default)(styleFloat[1][1])) {
67
65
  registerStyleAttribute(fieldName, layer, styleFloat[0], styleFloat[1]);
68
66
  } else {
69
67
  registerStyleAttribute(fieldName, layer, [1.0], undefined);
@@ -78,9 +76,9 @@ function handleStyleOffsets(fieldName, layer, styleOffsets) {
78
76
  registerStyleAttribute(fieldName, layer, styleOffsets, function (value) {
79
77
  return value;
80
78
  });
81
- } else if ((0, _isArray2.default)(styleOffsets) && styleOffsets.length === 2 && (0, _isString2.default)(styleOffsets[0]) && (0, _isFunction2.default)(styleOffsets[1])) {
79
+ } else if (Array.isArray(styleOffsets) && styleOffsets.length === 2 && (0, _isString2.default)(styleOffsets[0]) && (0, _isFunction2.default)(styleOffsets[1])) {
82
80
  registerStyleAttribute(fieldName, layer, styleOffsets[0], styleOffsets[1]);
83
- } else if ((0, _isArray2.default)(styleOffsets) && styleOffsets.length === 2 && (0, _isNumber2.default)(styleOffsets[0]) && (0, _isNumber2.default)(styleOffsets[1])) {
81
+ } else if (Array.isArray(styleOffsets) && styleOffsets.length === 2 && (0, _isNumber2.default)(styleOffsets[0]) && (0, _isNumber2.default)(styleOffsets[1])) {
84
82
  registerStyleAttribute(fieldName, layer, styleOffsets, undefined);
85
83
  } else {
86
84
  registerStyleAttribute(fieldName, layer, [0, 0], undefined);
@@ -90,10 +88,10 @@ function handleStyleOffsets(fieldName, layer, styleOffsets) {
90
88
  function handleStyleColor(fieldName, layer, styleColor) {
91
89
  if ((0, _isString2.default)(styleColor)) {
92
90
  registerStyleAttribute(fieldName, layer, styleColor, undefined);
93
- } else if ((0, _isArray2.default)(styleColor) && styleColor.length === 2) {
91
+ } else if (Array.isArray(styleColor) && styleColor.length === 2) {
94
92
  if ((0, _isString2.default)(styleColor[0]) && (0, _isFunction2.default)(styleColor[1])) {
95
93
  registerStyleAttribute(fieldName, layer, styleColor[0], styleColor[1]);
96
- } else if ((0, _isString2.default)(styleColor[0]) && (0, _isArray2.default)(styleColor[1]) && styleColor[1].length > 0) {
94
+ } else if ((0, _isString2.default)(styleColor[0]) && Array.isArray(styleColor[1]) && styleColor[1].length > 0) {
97
95
  registerStyleAttribute(fieldName, layer, styleColor[0], styleColor[1]);
98
96
  } else {
99
97
  registerStyleAttribute(fieldName, layer, '#fff', undefined);
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/utils/dataMappingStyle.ts"],"names":["WIDTH","registerStyleAttribute","fieldName","layer","field","values","updateOptions","updateStyleAttribute","handleStyleDataMapping","configToUpdate","opacity","handleStyleFloat","strokeWidth","strokeOpacity","stroke","handleStyleColor","offsets","handleStyleOffsets","textOffset","thetaOffset","styleFloat","value","undefined","length","styleOffsets","styleColor"],"mappings":";;;;;;;;;;;;;;;;;;;AAyBA,IAAMA,KAAK,GAAG,IAAd;;AAQA,SAASC,sBAAT,CACEC,SADF,EAEEC,KAFF,EAGEC,KAHF,EAIEC,MAJF,EAKEC,aALF,EAME;AACAH,EAAAA,KAAK,CAACI,oBAAN,CAA2BL,SAA3B,EAAsCE,KAAtC,EAA6CC,MAA7C,EAAqDC,aAArD;AACD;;AAOD,SAASE,sBAAT,CAAgCC,cAAhC,EAAiEN,KAAjE,EAA6E;AAC3E,MAAIM,cAAc,CAACC,OAAnB,EAA4B;AAE1BC,IAAAA,gBAAgB,CAAC,SAAD,EAAYR,KAAZ,EAAmBM,cAAc,CAACC,OAAlC,CAAhB;AACD;;AAED,MAAID,cAAc,CAACG,WAAnB,EAAgC;AAG9BD,IAAAA,gBAAgB,CAAC,aAAD,EAAgBR,KAAhB,EAAuBM,cAAc,CAACG,WAAtC,CAAhB;AACD;;AAED,MAAIH,cAAc,CAACI,aAAnB,EAAkC;AAEhCF,IAAAA,gBAAgB,CAAC,eAAD,EAAkBR,KAAlB,EAAyBM,cAAc,CAACI,aAAxC,CAAhB;AACD;;AAED,MAAIJ,cAAc,CAACK,MAAnB,EAA2B;AAEzBC,IAAAA,gBAAgB,CAAC,QAAD,EAAWZ,KAAX,EAAkBM,cAAc,CAACK,MAAjC,CAAhB;AACD;;AAED,MAAIL,cAAc,CAACO,OAAnB,EAA4B;AAE1BC,IAAAA,kBAAkB,CAAC,SAAD,EAAYd,KAAZ,EAAmBM,cAAc,CAACO,OAAlC,CAAlB;AACD;;AAED,MAAIP,cAAc,CAACS,UAAnB,EAA+B;AAE7BD,IAAAA,kBAAkB,CAAC,YAAD,EAAed,KAAf,EAAsB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A4DsB,UAA5D,EAA6E;AAC3E,MAAI,wBAASA,UAAT,CAAJ,EAA0B;AAExBxB,IAAAA,sBAAsB,CAACC,SAAD,EAAYC,KAAZ,EAAmBsB,UAAnB,EAA+BH,SAA/B,CAAtB;AACD,GAHD,MAGO,IAAI,uBAAQG,UAAR,KAAuBA,UAAU,CAACF,MAAX,KAAsB,CAAjD,EAAoD;AAEzD,QAAI,wBAASE,UAAU,CAAC,CAAD,CAAnB,KAA2B,0BAAWA,UAAU,CAAC,CAAD,CAArB,CAA/B,EAA0D;AAExDxB,MAAAA,sBAAsB,CAACC,SAAD,EAAYC,KAAZ,EAAmBsB,UAAU,CAAC,CAAD,CAA7B,EAAkCA,UAAU,CAAC,CAAD,CAA5C,CAAtB;AACD,KAHD,MAGO,IACL,wBAASA,UAAU,CAAC,CAAD,CAAnB,KACA,uBAAQA,UAAU,CAAC,CAAD,CAAlB,CADA,IAEAA,UAAU,CAAC,CAAD,CAAV,CAAcF,MAAd,GAAuB,CAHlB,EAIL;AAEAtB,MAAAA,sBAAsB,CAACC,SAAD,EAAYC,KAAZ,EAAmBsB,UAAU,CAAC,CAAD,CAA7B,EAAkCA,UAAU,CAAC,CAAD,CAA5C,CAAtB;AACD,KAPM,MAOA;AAELxB,MAAAA,sBAAsB,CAACC,SAAD,EAAYC,KAAZ,EAAmB,MAAnB,EAA2BmB,SAA3B,CAAtB;AACD;AACF,GAhBM,MAgBA;AAELrB,IAAAA,sBAAsB,CAACC,SAAD,EAAYC,KAAZ,EAAmB,MAAnB,EAA2BmB,SAA3B,CAAtB;AACD;AACF","sourcesContent":["import {\n gl,\n ILayer,\n IStyleAttributeUpdateOptions,\n ITexture2D,\n StyleAttributeField,\n StyleAttributeOption,\n} from '@antv/l7-core';\nimport { rgb2arr } from '@antv/l7-utils';\nimport { isArray, isFunction, isNumber, isString } from 'lodash';\n/**\n * 该文件中的工具方法主要用于对 style 中的属性进行 数据映射\n */\n\ninterface IConfigToUpdate {\n thetaOffset?: any;\n opacity?: any;\n strokeOpacity?: any;\n stroke?: any;\n strokeWidth?: any;\n offsets?: any;\n textOffset?: any;\n}\n\n// 画布默认的宽度\nconst WIDTH = 1024;\n\n/**\n * 当 style 中使用的 opacity 不是常数的时候根据数据进行映射\n * @param field\n * @param values\n * @param updateOptions\n */\nfunction registerStyleAttribute(\n fieldName: string,\n layer: ILayer,\n field: StyleAttributeField,\n values?: StyleAttributeOption,\n updateOptions?: Partial<IStyleAttributeUpdateOptions>,\n) {\n layer.updateStyleAttribute(fieldName, field, values, updateOptions);\n}\n\n/**\n * 当样式发生变化时判断是否需要进行数据映射\n * @param configToUpdate\n * @param layer\n */\nfunction handleStyleDataMapping(configToUpdate: IConfigToUpdate, layer: any) {\n if (configToUpdate.opacity) {\n // 处理 style 中 opacity 属性的数据映射\n handleStyleFloat('opacity', layer, configToUpdate.opacity);\n }\n\n if (configToUpdate.strokeWidth) {\n // 处理 style 中 strokeWidth 属性的数据映射\n\n handleStyleFloat('strokeWidth', layer, configToUpdate.strokeWidth);\n }\n\n if (configToUpdate.strokeOpacity) {\n // 处理 style 中 strokeOpacity 属性的数据映射\n handleStyleFloat('strokeOpacity', layer, configToUpdate.strokeOpacity);\n }\n\n if (configToUpdate.stroke) {\n // 处理 style 中 stroke (strokeColor) 属性的数据映射\n handleStyleColor('stroke', layer, configToUpdate.stroke);\n }\n\n if (configToUpdate.offsets) {\n // 处理 style 中 offsets 属性的数据映射\n handleStyleOffsets('offsets', layer, configToUpdate.offsets);\n }\n\n if (configToUpdate.textOffset) {\n // 处理 style 中 textOffset 属性的数据映射\n handleStyleOffsets('textOffset', layer, configToUpdate.textOffset);\n }\n\n if (configToUpdate.thetaOffset) {\n // 处理 style 中 thetaOffset 属性的数据映射\n handleStyleFloat('thetaOffset', layer, configToUpdate.thetaOffset);\n }\n}\n\n/**\n * 根据传入参数 float 的类型和值做相应的操作\n */\nfunction handleStyleFloat(fieldName: string, layer: ILayer, styleFloat: any) {\n if (isString(styleFloat)) {\n // 如果传入的 styleFloat 是 string 类型,那么就认为其对应的是传入数据的字段\n registerStyleAttribute(fieldName, layer, styleFloat, (value: any) => {\n return value;\n });\n } else if (isNumber(styleFloat)) {\n // 传入 number、默认值处理\n registerStyleAttribute(fieldName, layer, [styleFloat], undefined);\n } else if (isArray(styleFloat) && styleFloat.length === 2) {\n // 传入的 styleFloat 是长度为 2 的数组\n if (isString(styleFloat[0]) && isFunction(styleFloat[1])) {\n // 字段回调函数 [string, callback]\n registerStyleAttribute(fieldName, layer, styleFloat[0], styleFloat[1]);\n } else if (\n isString(styleFloat[0]) &&\n isArray(styleFloat[1]) &&\n isNumber(styleFloat[1][0]) &&\n isNumber(styleFloat[1][1])\n ) {\n // 字段映射 [string, [start: number, end: number]]\n registerStyleAttribute(fieldName, layer, styleFloat[0], styleFloat[1]);\n } else {\n // 兼容\n registerStyleAttribute(fieldName, layer, [1.0], undefined);\n }\n } else {\n // 兼容\n registerStyleAttribute(fieldName, layer, [1.0], undefined);\n }\n}\n/**\n * 根据传入参数 offsets 的类型和值做相应的操作\n * @param fieldName\n * @param layer\n * @param styleOffsets\n */\nfunction handleStyleOffsets(\n fieldName: string,\n layer: ILayer,\n styleOffsets: any,\n) {\n if (isString(styleOffsets)) {\n // 如果传入的 styleOffsets 是 string 类型,那么就认为其对应的是传入数据的字段\n registerStyleAttribute(fieldName, layer, styleOffsets, (value: any) => {\n return value;\n });\n } else if (\n isArray(styleOffsets) &&\n styleOffsets.length === 2 &&\n isString(styleOffsets[0]) &&\n isFunction(styleOffsets[1])\n ) {\n // 字段回调函数 [string, callback]\n registerStyleAttribute(fieldName, layer, styleOffsets[0], styleOffsets[1]);\n } else if (\n isArray(styleOffsets) &&\n styleOffsets.length === 2 &&\n isNumber(styleOffsets[0]) &&\n isNumber(styleOffsets[1])\n ) {\n // 字段映射 [string, [start: number, end: number]]\n registerStyleAttribute(fieldName, layer, styleOffsets, undefined);\n } else {\n // 兼容\n registerStyleAttribute(fieldName, layer, [0, 0], undefined);\n }\n}\n\n/**\n * 根据传入参数 stroke / color 的类型和值做相应的操作\n * @param fieldName\n * @param layer\n * @param styleColor\n */\nfunction handleStyleColor(fieldName: string, layer: ILayer, styleColor: any) {\n if (isString(styleColor)) {\n // 如果传入的 styleColor 是 string 类型,那么就认为其是颜色值\n registerStyleAttribute(fieldName, layer, styleColor, undefined);\n } else if (isArray(styleColor) && styleColor.length === 2) {\n // 传入的 styleColor 是长度为 2 的数组\n if (isString(styleColor[0]) && isFunction(styleColor[1])) {\n // 字段回调函数 [string, callback]\n registerStyleAttribute(fieldName, layer, styleColor[0], styleColor[1]);\n } else if (\n isString(styleColor[0]) &&\n isArray(styleColor[1]) &&\n styleColor[1].length > 0\n ) {\n // 字段映射 [string, [start: string, end: string]]\n registerStyleAttribute(fieldName, layer, styleColor[0], styleColor[1]);\n } else {\n // 兼容\n registerStyleAttribute(fieldName, layer, '#fff', undefined);\n }\n } else {\n // 兼容\n registerStyleAttribute(fieldName, layer, '#fff', undefined);\n }\n}\n\nexport { handleStyleDataMapping, handleStyleFloat, handleStyleColor };\n"],"file":"dataMappingStyle.js"}
1
+ {"version":3,"sources":["../../src/utils/dataMappingStyle.ts"],"names":["WIDTH","registerStyleAttribute","fieldName","layer","field","values","updateOptions","updateStyleAttribute","handleStyleDataMapping","configToUpdate","opacity","handleStyleFloat","strokeWidth","strokeOpacity","stroke","handleStyleColor","offsets","handleStyleOffsets","textOffset","thetaOffset","styleFloat","value","undefined","Array","isArray","length","styleOffsets","styleColor"],"mappings":";;;;;;;;;;;;;;;;;AAyBA,IAAMA,KAAK,GAAG,IAAd;;AAQA,SAASC,sBAAT,CACEC,SADF,EAEEC,KAFF,EAGEC,KAHF,EAIEC,MAJF,EAKEC,aALF,EAME;AACAH,EAAAA,KAAK,CAACI,oBAAN,CAA2BL,SAA3B,EAAsCE,KAAtC,EAA6CC,MAA7C,EAAqDC,aAArD;AACD;;AAOD,SAASE,sBAAT,CAAgCC,cAAhC,EAAiEN,KAAjE,EAA6E;AAC3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B,UAAU,CAAC,CAAD,CAA7B,EAAkCA,UAAU,CAAC,CAAD,CAA5C,CAAtB;AACD,KAHD,MAGO,IACL,wBAASA,UAAU,CAAC,CAAD,CAAnB,KACAJ,KAAK,CAACC,OAAN,CAAcG,UAAU,CAAC,CAAD,CAAxB,CADA,IAEAA,UAAU,CAAC,CAAD,CAAV,CAAcF,MAAd,GAAuB,CAHlB,EAIL;AAEAxB,MAAAA,sBAAsB,CAACC,SAAD,EAAYC,KAAZ,EAAmBwB,UAAU,CAAC,CAAD,CAA7B,EAAkCA,UAAU,CAAC,CAAD,CAA5C,CAAtB;AACD,KAPM,MAOA;AAEL1B,MAAAA,sBAAsB,CAACC,SAAD,EAAYC,KAAZ,EAAmB,MAAnB,EAA2BmB,SAA3B,CAAtB;AACD;AACF,GAhBM,MAgBA;AAELrB,IAAAA,sBAAsB,CAACC,SAAD,EAAYC,KAAZ,EAAmB,MAAnB,EAA2BmB,SAA3B,CAAtB;AACD;AACF","sourcesContent":["import {\n gl,\n ILayer,\n IStyleAttributeUpdateOptions,\n ITexture2D,\n StyleAttributeField,\n StyleAttributeOption,\n} from '@antv/l7-core';\nimport { rgb2arr } from '@antv/l7-utils';\nimport { isFunction, isNumber, isString } from 'lodash';\n/**\n * 该文件中的工具方法主要用于对 style 中的属性进行 数据映射\n */\n\ninterface IConfigToUpdate {\n thetaOffset?: any;\n opacity?: any;\n strokeOpacity?: any;\n stroke?: any;\n strokeWidth?: any;\n offsets?: any;\n textOffset?: any;\n}\n\n// 画布默认的宽度\nconst WIDTH = 1024;\n\n/**\n * 当 style 中使用的 opacity 不是常数的时候根据数据进行映射\n * @param field\n * @param values\n * @param updateOptions\n */\nfunction registerStyleAttribute(\n fieldName: string,\n layer: ILayer,\n field: StyleAttributeField,\n values?: StyleAttributeOption,\n updateOptions?: Partial<IStyleAttributeUpdateOptions>,\n) {\n layer.updateStyleAttribute(fieldName, field, values, updateOptions);\n}\n\n/**\n * 当样式发生变化时判断是否需要进行数据映射\n * @param configToUpdate\n * @param layer\n */\nfunction handleStyleDataMapping(configToUpdate: IConfigToUpdate, layer: any) {\n if (configToUpdate.opacity) {\n // 处理 style 中 opacity 属性的数据映射\n handleStyleFloat('opacity', layer, configToUpdate.opacity);\n }\n\n if (configToUpdate.strokeWidth) {\n // 处理 style 中 strokeWidth 属性的数据映射\n\n handleStyleFloat('strokeWidth', layer, configToUpdate.strokeWidth);\n }\n\n if (configToUpdate.strokeOpacity) {\n // 处理 style 中 strokeOpacity 属性的数据映射\n handleStyleFloat('strokeOpacity', layer, configToUpdate.strokeOpacity);\n }\n\n if (configToUpdate.stroke) {\n // 处理 style 中 stroke (strokeColor) 属性的数据映射\n handleStyleColor('stroke', layer, configToUpdate.stroke);\n }\n\n if (configToUpdate.offsets) {\n // 处理 style 中 offsets 属性的数据映射\n handleStyleOffsets('offsets', layer, configToUpdate.offsets);\n }\n\n if (configToUpdate.textOffset) {\n // 处理 style 中 textOffset 属性的数据映射\n handleStyleOffsets('textOffset', layer, configToUpdate.textOffset);\n }\n\n if (configToUpdate.thetaOffset) {\n // 处理 style 中 thetaOffset 属性的数据映射\n handleStyleFloat('thetaOffset', layer, configToUpdate.thetaOffset);\n }\n}\n\n/**\n * 根据传入参数 float 的类型和值做相应的操作\n */\nfunction handleStyleFloat(fieldName: string, layer: ILayer, styleFloat: any) {\n if (isString(styleFloat)) {\n // 如果传入的 styleFloat 是 string 类型,那么就认为其对应的是传入数据的字段\n registerStyleAttribute(fieldName, layer, styleFloat, (value: any) => {\n return value;\n });\n } else if (isNumber(styleFloat)) {\n // 传入 number、默认值处理\n registerStyleAttribute(fieldName, layer, [styleFloat], undefined);\n } else if (Array.isArray(styleFloat) && styleFloat.length === 2) {\n // 传入的 styleFloat 是长度为 2 的数组\n if (isString(styleFloat[0]) && isFunction(styleFloat[1])) {\n // 字段回调函数 [string, callback]\n registerStyleAttribute(fieldName, layer, styleFloat[0], styleFloat[1]);\n } else if (\n isString(styleFloat[0]) &&\n Array.isArray(styleFloat[1]) &&\n isNumber(styleFloat[1][0]) &&\n isNumber(styleFloat[1][1])\n ) {\n // 字段映射 [string, [start: number, end: number]]\n registerStyleAttribute(fieldName, layer, styleFloat[0], styleFloat[1]);\n } else {\n // 兼容\n registerStyleAttribute(fieldName, layer, [1.0], undefined);\n }\n } else {\n // 兼容\n registerStyleAttribute(fieldName, layer, [1.0], undefined);\n }\n}\n/**\n * 根据传入参数 offsets 的类型和值做相应的操作\n * @param fieldName\n * @param layer\n * @param styleOffsets\n */\nfunction handleStyleOffsets(\n fieldName: string,\n layer: ILayer,\n styleOffsets: any,\n) {\n if (isString(styleOffsets)) {\n // 如果传入的 styleOffsets 是 string 类型,那么就认为其对应的是传入数据的字段\n registerStyleAttribute(fieldName, layer, styleOffsets, (value: any) => {\n return value;\n });\n } else if (\n Array.isArray(styleOffsets) &&\n styleOffsets.length === 2 &&\n isString(styleOffsets[0]) &&\n isFunction(styleOffsets[1])\n ) {\n // 字段回调函数 [string, callback]\n registerStyleAttribute(fieldName, layer, styleOffsets[0], styleOffsets[1]);\n } else if (\n Array.isArray(styleOffsets) &&\n styleOffsets.length === 2 &&\n isNumber(styleOffsets[0]) &&\n isNumber(styleOffsets[1])\n ) {\n // 字段映射 [string, [start: number, end: number]]\n registerStyleAttribute(fieldName, layer, styleOffsets, undefined);\n } else {\n // 兼容\n registerStyleAttribute(fieldName, layer, [0, 0], undefined);\n }\n}\n\n/**\n * 根据传入参数 stroke / color 的类型和值做相应的操作\n * @param fieldName\n * @param layer\n * @param styleColor\n */\nfunction handleStyleColor(fieldName: string, layer: ILayer, styleColor: any) {\n if (isString(styleColor)) {\n // 如果传入的 styleColor 是 string 类型,那么就认为其是颜色值\n registerStyleAttribute(fieldName, layer, styleColor, undefined);\n } else if (Array.isArray(styleColor) && styleColor.length === 2) {\n // 传入的 styleColor 是长度为 2 的数组\n if (isString(styleColor[0]) && isFunction(styleColor[1])) {\n // 字段回调函数 [string, callback]\n registerStyleAttribute(fieldName, layer, styleColor[0], styleColor[1]);\n } else if (\n isString(styleColor[0]) &&\n Array.isArray(styleColor[1]) &&\n styleColor[1].length > 0\n ) {\n // 字段映射 [string, [start: string, end: string]]\n registerStyleAttribute(fieldName, layer, styleColor[0], styleColor[1]);\n } else {\n // 兼容\n registerStyleAttribute(fieldName, layer, '#fff', undefined);\n }\n } else {\n // 兼容\n registerStyleAttribute(fieldName, layer, '#fff', undefined);\n }\n}\n\nexport { handleStyleDataMapping, handleStyleFloat, handleStyleColor };\n"],"file":"dataMappingStyle.js"}
@@ -8,9 +8,15 @@ var shapeUpdateList = [['circle', 'cylinder'], ['square', 'cylinder'], ['triangl
8
8
 
9
9
  function updateShape(layer, lastShape, currentShape) {
10
10
  if (typeof lastShape === 'string' && typeof currentShape === 'string' && lastShape !== currentShape) {
11
+ if (layer.type === 'PointLayer') {
12
+ layer.dataState.dataSourceNeedUpdate = true;
13
+ return;
14
+ }
15
+
11
16
  shapeUpdateList.map(function (shapes) {
12
17
  if (shapes.includes(lastShape) && shapes.includes(currentShape)) {
13
18
  layer.dataState.dataSourceNeedUpdate = true;
19
+ return;
14
20
  }
15
21
  });
16
22
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/utils/updateShape.ts"],"names":["shapeUpdateList","updateShape","layer","lastShape","currentShape","map","shapes","includes","dataState","dataSourceNeedUpdate"],"mappings":";;;;;;AAGA,IAAMA,eAAe,GAAG,CAEtB,CAAC,QAAD,EAAW,UAAX,CAFsB,EAGtB,CAAC,QAAD,EAAW,UAAX,CAHsB,EAItB,CAAC,UAAD,EAAa,UAAb,CAJsB,EAKtB,CAAC,UAAD,EAAa,UAAb,CALsB,EAMtB,CAAC,SAAD,EAAY,UAAZ,CANsB,EAOtB,CAAC,SAAD,EAAY,UAAZ,CAPsB,EAQtB,CAAC,UAAD,EAAa,UAAb,CARsB,EAStB,CAAC,SAAD,EAAY,UAAZ,CATsB,EAUtB,CAAC,QAAD,EAAW,UAAX,CAVsB,CAAxB;;AAYO,SAASC,WAAT,CACLC,KADK,EAELC,SAFK,EAGLC,YAHK,EAIC;AACN,MACE,OAAOD,SAAP,KAAqB,QAArB,IACA,OAAOC,YAAP,KAAwB,QADxB,IAEAD,SAAS,KAAKC,YAHhB,EAIE;AACAJ,IAAAA,eAAe,CAACK,GAAhB,CAAoB,UAACC,MAAD,EAAY;AAC9B,UAAIA,MAAM,CAACC,QAAP,CAAgBJ,SAAhB,KAA8BG,MAAM,CAACC,QAAP,CAAgBH,YAAhB,CAAlC,EAAiE;AAE/DF,QAAAA,KAAK,CAACM,SAAN,CAAgBC,oBAAhB,GAAuC,IAAvC;AACD;AACF,KALD;AAMD;AACF","sourcesContent":["import { ILayer, StyleAttributeField } from '@antv/l7-core';\n// TODO: shapeUpdateList 存储一系列的 shape 类型\n// 当这一系列的 shape 相互切换的时候需要重构 layer 的 model (顶点数据集)\nconst shapeUpdateList = [\n // PointLayer\n ['circle', 'cylinder'],\n ['square', 'cylinder'],\n ['triangle', 'cylinder'],\n ['pentagon', 'cylinder'],\n ['hexagon', 'cylinder'],\n ['octogon', 'cylinder'],\n ['hexagram', 'cylinder'],\n ['rhombus', 'cylinder'],\n ['vesica', 'cylinder'],\n];\nexport function updateShape(\n layer: ILayer,\n lastShape: StyleAttributeField | undefined,\n currentShape: StyleAttributeField | undefined,\n): void {\n if (\n typeof lastShape === 'string' &&\n typeof currentShape === 'string' &&\n lastShape !== currentShape\n ) {\n shapeUpdateList.map((shapes) => {\n if (shapes.includes(lastShape) && shapes.includes(currentShape)) {\n // TODO: dataSourceNeedUpdate 借用数据更新时更新 layer model 的工作流\n layer.dataState.dataSourceNeedUpdate = true;\n }\n });\n }\n}\n"],"file":"updateShape.js"}
1
+ {"version":3,"sources":["../../src/utils/updateShape.ts"],"names":["shapeUpdateList","updateShape","layer","lastShape","currentShape","type","dataState","dataSourceNeedUpdate","map","shapes","includes"],"mappings":";;;;;;AAGA,IAAMA,eAAe,GAAG,CAEtB,CAAC,QAAD,EAAW,UAAX,CAFsB,EAGtB,CAAC,QAAD,EAAW,UAAX,CAHsB,EAItB,CAAC,UAAD,EAAa,UAAb,CAJsB,EAKtB,CAAC,UAAD,EAAa,UAAb,CALsB,EAMtB,CAAC,SAAD,EAAY,UAAZ,CANsB,EAOtB,CAAC,SAAD,EAAY,UAAZ,CAPsB,EAQtB,CAAC,UAAD,EAAa,UAAb,CARsB,EAStB,CAAC,SAAD,EAAY,UAAZ,CATsB,EAUtB,CAAC,QAAD,EAAW,UAAX,CAVsB,CAAxB;;AAYO,SAASC,WAAT,CACLC,KADK,EAELC,SAFK,EAGLC,YAHK,EAIC;AACN,MACE,OAAOD,SAAP,KAAqB,QAArB,IACA,OAAOC,YAAP,KAAwB,QADxB,IAEAD,SAAS,KAAKC,YAHhB,EAIE;AACA,QAAIF,KAAK,CAACG,IAAN,KAAe,YAAnB,EAAiC;AAC/BH,MAAAA,KAAK,CAACI,SAAN,CAAgBC,oBAAhB,GAAuC,IAAvC;AACA;AACD;;AAEDP,IAAAA,eAAe,CAACQ,GAAhB,CAAoB,UAACC,MAAD,EAAY;AAC9B,UAAIA,MAAM,CAACC,QAAP,CAAgBP,SAAhB,KAA8BM,MAAM,CAACC,QAAP,CAAgBN,YAAhB,CAAlC,EAAiE;AAE/DF,QAAAA,KAAK,CAACI,SAAN,CAAgBC,oBAAhB,GAAuC,IAAvC;AACA;AACD;AACF,KAND;AAOD;AACF","sourcesContent":["import { ILayer, StyleAttributeField } from '@antv/l7-core';\n// TODO: shapeUpdateList 存储一系列的 shape 类型\n// 当这一系列的 shape 相互切换的时候需要重构 layer 的 model (顶点数据集)\nconst shapeUpdateList = [\n // PointLayer\n ['circle', 'cylinder'],\n ['square', 'cylinder'],\n ['triangle', 'cylinder'],\n ['pentagon', 'cylinder'],\n ['hexagon', 'cylinder'],\n ['octogon', 'cylinder'],\n ['hexagram', 'cylinder'],\n ['rhombus', 'cylinder'],\n ['vesica', 'cylinder'],\n];\nexport function updateShape(\n layer: ILayer,\n lastShape: StyleAttributeField | undefined,\n currentShape: StyleAttributeField | undefined,\n): void {\n if (\n typeof lastShape === 'string' &&\n typeof currentShape === 'string' &&\n lastShape !== currentShape\n ) {\n if (layer.type === 'PointLayer') {\n layer.dataState.dataSourceNeedUpdate = true;\n return;\n }\n\n shapeUpdateList.map((shapes) => {\n if (shapes.includes(lastShape) && shapes.includes(currentShape)) {\n // TODO: dataSourceNeedUpdate 借用数据更新时更新 layer model 的工作流\n layer.dataState.dataSourceNeedUpdate = true;\n return;\n }\n });\n }\n}\n"],"file":"updateShape.js"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antv/l7-layers",
3
- "version": "2.8.20",
3
+ "version": "2.8.23",
4
4
  "description": "L7's collection of built-in layers",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",
@@ -24,9 +24,9 @@
24
24
  "license": "ISC",
25
25
  "dependencies": {
26
26
  "@antv/geo-coord": "^1.0.8",
27
- "@antv/l7-core": "^2.8.20",
28
- "@antv/l7-source": "^2.8.20",
29
- "@antv/l7-utils": "^2.8.20",
27
+ "@antv/l7-core": "^2.8.23",
28
+ "@antv/l7-source": "^2.8.23",
29
+ "@antv/l7-utils": "^2.8.23",
30
30
  "@babel/runtime": "^7.7.7",
31
31
  "@mapbox/martini": "^0.2.0",
32
32
  "@turf/meta": "^6.0.2",
@@ -52,7 +52,7 @@
52
52
  "@types/gl-matrix": "^2.4.5",
53
53
  "@types/lodash": "^4.14.138"
54
54
  },
55
- "gitHead": "1b4784d51403b6ee3130b918bc1847c680c0c455",
55
+ "gitHead": "e94d7c069ff11441981c03f170d1393432efb2c7",
56
56
  "publishConfig": {
57
57
  "access": "public"
58
58
  }