@antv/l7-layers 2.6.28 → 2.6.32

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.
Files changed (53) hide show
  1. package/es/citybuliding/models/build.js +3 -2
  2. package/es/citybuliding/models/build.js.map +1 -1
  3. package/es/core/BaseLayer.d.ts +2 -1
  4. package/es/core/BaseLayer.js +12 -12
  5. package/es/core/BaseLayer.js.map +1 -1
  6. package/es/core/BaseModel.d.ts +1 -1
  7. package/es/core/BaseModel.js +4 -8
  8. package/es/core/BaseModel.js.map +1 -1
  9. package/es/core/interface.d.ts +4 -0
  10. package/es/core/interface.js.map +1 -1
  11. package/es/heatmap/models/heatmap.js +2 -2
  12. package/es/line/index.d.ts +1 -1
  13. package/es/line/index.js +1 -0
  14. package/es/line/index.js.map +1 -1
  15. package/es/line/models/index.d.ts +1 -1
  16. package/es/line/models/index.js +2 -0
  17. package/es/line/models/index.js.map +1 -1
  18. package/es/line/models/line.js +9 -3
  19. package/es/line/models/line.js.map +1 -1
  20. package/es/line/models/wall.d.ts +12 -0
  21. package/es/line/models/wall.js +311 -0
  22. package/es/line/models/wall.js.map +1 -0
  23. package/es/plugins/DataMappingPlugin.js +2 -2
  24. package/es/plugins/LayerAnimateStylePlugin.js +2 -2
  25. package/es/plugins/LightingPlugin.js +2 -2
  26. package/es/point/models/icon-font.js +1 -1
  27. package/es/point/models/image.js +4 -3
  28. package/es/point/models/image.js.map +1 -1
  29. package/es/raster/raster.js +2 -2
  30. package/lib/citybuliding/models/build.js +3 -2
  31. package/lib/citybuliding/models/build.js.map +1 -1
  32. package/lib/core/BaseLayer.js +11 -12
  33. package/lib/core/BaseLayer.js.map +1 -1
  34. package/lib/core/BaseModel.js +4 -8
  35. package/lib/core/BaseModel.js.map +1 -1
  36. package/lib/core/interface.js.map +1 -1
  37. package/lib/heatmap/models/heatmap.js +2 -2
  38. package/lib/line/index.js +1 -0
  39. package/lib/line/index.js.map +1 -1
  40. package/lib/line/models/index.js +3 -0
  41. package/lib/line/models/index.js.map +1 -1
  42. package/lib/line/models/line.js +9 -3
  43. package/lib/line/models/line.js.map +1 -1
  44. package/lib/line/models/wall.js +327 -0
  45. package/lib/line/models/wall.js.map +1 -0
  46. package/lib/plugins/DataMappingPlugin.js +2 -2
  47. package/lib/plugins/LayerAnimateStylePlugin.js +2 -2
  48. package/lib/plugins/LightingPlugin.js +2 -2
  49. package/lib/point/models/icon-font.js +1 -1
  50. package/lib/point/models/image.js +4 -3
  51. package/lib/point/models/image.js.map +1 -1
  52. package/lib/raster/raster.js +2 -2
  53. package/package.json +5 -5
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/core/BaseModel.ts"],"names":["BaseModel","TYPES","IGlobalConfigService","IShaderModuleService","layer","rendererService","getContainer","get","IRendererService","styleAttributeService","IStyleAttributeService","mapService","IMapService","iconService","IIconService","fontService","IFontService","cameraService","ICameraService","layerService","ILayerService","registerBuiltinAttributes","startModelAnimate","createTexture2D","DATA_TEXTURE_WIDTH","rowCount","cellLength","cellProperties","cacheStyleProperties","thetaOffset","undefined","opacity","strokeOpacity","strokeWidth","stroke","offsets","stylePropertyesExist","hasThetaOffset","hasOpacity","hasStrokeOpacity","hasStrokeWidth","hasStroke","hasOffsets","dataTextureTest","getOESTextureFloat","dataTexture","data","Uint8ClampedArray","mag","gl","NEAREST","min","width","height","options","isUpdate","clearLastCalRes","push","attr","count","isStaticColor","isOffsetStatic","strokeColor","length","d","i","cellData","cellPropertiesLayouts","layout","value","patchMod","encodeData","encodeDatalength","Math","ceil","totalLength","patchData","getLayerConfig","blend","BlendTypes","BlendType","Error","option","enable","duration","interval","trailLength","animateOption","setAnimateStartTime"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AA4BA;;AACA;;AAEA;;;;;;;;;;IA0BqBA,S,WAoClB,wBAAWC,cAAMC,oBAAjB,C,UASA,wBAAWD,cAAME,oBAAjB,C;AAaD,qBAAYC,KAAZ,EAA2B;AAAA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A8B;AAC5B,YAAM,IAAIA,KAAJ,CAAU,yBAAV,CAAN;AACD;;;WACD,uBAAqB;AACnB;AACD;;;WACD,wBAKE;AACA,YAAM,IAAIA,KAAJ,CAAU,yBAAV,CAAN;AACD;;;WACD,kBAAgB;AACd,YAAM,IAAIA,KAAJ,CAAU,yBAAV,CAAN;AACD;;;WACD,qCAAsC;AACpC,YAAM,IAAIA,KAAJ,CAAU,yBAAV,CAAN;AACD;;;WACD,6BAA8BC,MAA9B,EAAgE;AAC9D,aAAO,CACLA,MAAM,CAACC,MAAP,GAAgB,CAAhB,GAAoB,GADf,EAELD,MAAM,CAACE,QAAP,IAAmB,GAFd,EAGLF,MAAM,CAACG,QAAP,IAAmB,GAHd,EAILH,MAAM,CAACI,WAAP,IAAsB,GAJjB,CAAP;AAMD;;;WACD,6BAA8B;AAC5B,iBAA0B,KAAKlF,KAAL,CAAWyE,cAAX,EAA1B;AAAA,UAAQU,aAAR,QAAQA,aAAR;;AACA,UAAIA,aAAa,CAACJ,MAAlB,EAA0B;AACxB,aAAK/E,KAAL,CAAWoF,mBAAX;AACD;AACF","sourcesContent":["import {\n BlendType,\n gl,\n IAnimateOption,\n IAttribute,\n IBlendOptions,\n ICameraService,\n IElements,\n IEncodeFeature,\n IFontService,\n IGlobalConfigService,\n IIconService,\n ILayer,\n ILayerConfig,\n ILayerModel,\n ILayerService,\n IMapService,\n IModel,\n IModelUniform,\n IRendererService,\n IShaderModuleService,\n IStyleAttributeService,\n ITexture2D,\n ITexture2DInitializationOptions,\n lazyInject,\n Triangulation,\n TYPES,\n} from '@antv/l7-core';\nimport { rgb2arr } from '@antv/l7-utils';\nimport { color } from 'd3-color';\nimport { isArray, isEqual, isFunction, isNumber, isString } from 'lodash';\nimport { BlendTypes } from '../utils/blend';\n\nexport type styleSingle =\n | number\n | string\n | [string, (single: any) => number]\n | [string, [number, number]];\nexport type styleOffset =\n | string\n | [number, number]\n | [string, (single: any) => number];\nexport type styleColor =\n | string\n | [string, (single: any) => string]\n | [string, [string, string]];\nexport interface IDataTextureFrame {\n data: number[];\n width: number;\n height: number;\n}\n\nexport interface ICellProperty {\n attr: string;\n count: number;\n}\n\nexport default class BaseModel<ChildLayerStyleOptions = {}>\n implements ILayerModel {\n public triangulation: Triangulation;\n\n // style texture data mapping\n public createTexture2D: (\n options: ITexture2DInitializationOptions,\n ) => ITexture2D;\n\n protected layer: ILayer;\n protected dataTexture: ITexture2D; // 用于数据传递的数据纹理\n protected DATA_TEXTURE_WIDTH: number; // 默认有多少列(宽度)\n protected rowCount: number; // 计算得到的当前数据纹理有多少行(高度)\n protected cacheStyleProperties: {\n // 记录存储上一次样式字段的值\n thetaOffset: styleSingle | undefined;\n opacity: styleSingle | undefined;\n strokeOpacity: styleSingle | undefined;\n strokeWidth: styleSingle | undefined;\n stroke: styleColor | undefined;\n offsets: styleOffset | undefined;\n };\n protected cellLength: number; // 单个 cell 的长度\n protected cellProperties: ICellProperty[]; // 需要进行数据映射的属性集合\n protected cellTypeLayout: number[];\n protected stylePropertyesExist: {\n // 记录 style 属性是否存在的中间变量\n hasThetaOffset: number;\n hasOpacity: number;\n hasStrokeOpacity: number;\n hasStrokeWidth: number;\n hasStroke: number;\n hasOffsets: number;\n };\n protected dataTextureTest: boolean;\n\n @lazyInject(TYPES.IGlobalConfigService)\n protected readonly configService: IGlobalConfigService;\n\n // @lazyInject(TYPES.IIconService)\n // protected readonly iconService: IIconService;\n\n // @lazyInject(TYPES.IFontService)\n // protected readonly fontService: IFontService;\n\n @lazyInject(TYPES.IShaderModuleService)\n protected readonly shaderModuleService: IShaderModuleService;\n\n protected rendererService: IRendererService;\n protected iconService: IIconService;\n protected fontService: IFontService;\n protected styleAttributeService: IStyleAttributeService;\n protected mapService: IMapService;\n protected cameraService: ICameraService;\n protected layerService: ILayerService;\n\n // style texture data mapping\n\n constructor(layer: ILayer) {\n this.layer = layer;\n this.rendererService = layer\n .getContainer()\n .get<IRendererService>(TYPES.IRendererService);\n this.styleAttributeService = layer\n .getContainer()\n .get<IStyleAttributeService>(TYPES.IStyleAttributeService);\n this.mapService = layer.getContainer().get<IMapService>(TYPES.IMapService);\n this.iconService = layer\n .getContainer()\n .get<IIconService>(TYPES.IIconService);\n this.fontService = layer\n .getContainer()\n .get<IFontService>(TYPES.IFontService);\n this.cameraService = layer\n .getContainer()\n .get<ICameraService>(TYPES.ICameraService);\n this.layerService = layer\n .getContainer()\n .get<ILayerService>(TYPES.ILayerService);\n\n // 注册 Attribute\n this.registerBuiltinAttributes();\n // 开启动画\n this.startModelAnimate();\n\n const { createTexture2D } = this.rendererService;\n this.createTexture2D = createTexture2D;\n this.DATA_TEXTURE_WIDTH = 1024; // 数据纹理固定宽度\n this.rowCount = 1;\n this.cellLength = 0;\n this.cellProperties = [];\n this.cacheStyleProperties = {\n thetaOffset: undefined,\n opacity: undefined,\n strokeOpacity: undefined,\n strokeWidth: undefined,\n stroke: undefined,\n offsets: undefined,\n };\n this.stylePropertyesExist = {\n hasThetaOffset: 0,\n hasOpacity: 0,\n hasStrokeOpacity: 0,\n hasStrokeWidth: 0,\n hasStroke: 0,\n hasOffsets: 0,\n };\n this.dataTextureTest = this.layerService.getOESTextureFloat();\n // 只有在不支持数据纹理的情况下进行赋值\n if (!this.dataTextureTest) {\n this.dataTexture = this.createTexture2D({\n data: new Uint8ClampedArray(4),\n mag: gl.NEAREST,\n min: gl.NEAREST,\n width: 1,\n height: 1,\n });\n }\n }\n\n // style datatexture mapping\n\n /**\n * 清除上一次的计算结果 - 全量清除\n */\n public clearLastCalRes() {\n this.cellProperties = []; // 清空上一次计算的需要进行数据映射的属性集合\n this.cellLength = 0; // 清空上一次计算的 cell 的长度\n this.stylePropertyesExist = {\n // 全量清空上一次是否需要对 style 属性进行数据映射的判断\n hasThetaOffset: 0,\n hasOpacity: 0,\n hasStrokeOpacity: 0,\n hasStrokeWidth: 0,\n hasStroke: 0,\n hasOffsets: 0,\n };\n }\n\n public getCellTypeLayout() {\n if (this.dataTextureTest) {\n return [\n // 0\n this.rowCount, // 数据纹理有几行\n this.DATA_TEXTURE_WIDTH, // 数据纹理有几列\n 0.0,\n 0.0,\n // 1\n this.stylePropertyesExist.hasOpacity, // cell 中是否存在 opacity\n this.stylePropertyesExist.hasStrokeOpacity, // cell 中是否存在 strokeOpacity\n this.stylePropertyesExist.hasStrokeWidth, // cell 中是否存在 strokeWidth\n this.stylePropertyesExist.hasStroke, // cell 中是否存在 stroke\n // 2\n this.stylePropertyesExist.hasOffsets, // cell 中是否存在 offsets\n this.stylePropertyesExist.hasThetaOffset, // cell 中是否存在 thetaOffset\n 0.0,\n 0.0,\n // 3\n 0.0,\n 0.0,\n 0.0,\n 1.0,\n ];\n } else {\n return [\n 1.0, // 数据纹理有几行\n 1.0, // 数据纹理有几列\n 0.0,\n 0.0,\n 0.0, // cell 中是否存在 opacity\n 0.0, // cell 中是否存在 strokeOpacity\n 0.0, // cell 中是否存在 strokeWidth\n 0.0, // cell 中是否存在 stroke\n 0.0, // cell 中是否存在 offsets\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n -1.0,\n ];\n }\n }\n\n /**\n * 判断数据纹理是否需要重新计算 - 根据传入的值进行判断\n * @param options\n * @returns\n */\n public dataTextureNeedUpdate(options: {\n // TODO: thetaOffset 目前只有 lineLayer/arc 使用\n thetaOffset?: styleSingle;\n opacity?: styleSingle;\n strokeOpacity?: styleSingle;\n strokeWidth?: styleSingle;\n stroke?: styleColor;\n offsets?: styleOffset;\n textOffset?: styleOffset;\n }): boolean {\n let isUpdate = false;\n if (!isEqual(options.thetaOffset, this.cacheStyleProperties.thetaOffset)) {\n isUpdate = true;\n this.cacheStyleProperties.thetaOffset = options.thetaOffset;\n }\n if (!isEqual(options.opacity, this.cacheStyleProperties.opacity)) {\n isUpdate = true;\n this.cacheStyleProperties.opacity = options.opacity;\n }\n if (\n !isEqual(options.strokeOpacity, this.cacheStyleProperties.strokeOpacity)\n ) {\n isUpdate = true;\n this.cacheStyleProperties.strokeOpacity = options.strokeOpacity;\n }\n if (!isEqual(options.strokeWidth, this.cacheStyleProperties.strokeWidth)) {\n isUpdate = true;\n this.cacheStyleProperties.strokeWidth = options.strokeWidth;\n }\n if (!isEqual(options.stroke, this.cacheStyleProperties.stroke)) {\n isUpdate = true;\n this.cacheStyleProperties.stroke = options.stroke;\n }\n if (!isEqual(options.offsets, this.cacheStyleProperties.offsets)) {\n isUpdate = true;\n this.cacheStyleProperties.offsets = options.offsets;\n }\n if (this.dataTexture === undefined) {\n isUpdate = true;\n }\n return isUpdate;\n }\n /**\n * 判断当前的样式中哪些是需要进行数据映射的,哪些是常量,同时计算用于构建数据纹理的一些中间变量\n * @param options\n */\n public judgeStyleAttributes(options: {\n // TODO: 目前 thetaOffset 只有 lineLayer/arc 使用\n thetaOffset?: styleSingle;\n opacity?: styleSingle;\n strokeOpacity?: styleSingle;\n strokeWidth?: styleSingle;\n stroke?: styleColor;\n offsets?: styleOffset;\n }) {\n this.clearLastCalRes(); // 清除上一次的计算结果 - 全量清除\n\n if (options.opacity !== undefined && !isNumber(options.opacity)) {\n // 数据映射\n this.cellProperties.push({ attr: 'opacity', count: 1 });\n this.stylePropertyesExist.hasOpacity = 1;\n this.cellLength += 1;\n }\n\n if (\n options.strokeOpacity !== undefined &&\n !isNumber(options.strokeOpacity)\n ) {\n // 数据映射\n this.cellProperties.push({ attr: 'strokeOpacity', count: 1 });\n this.stylePropertyesExist.hasStrokeOpacity = 1;\n this.cellLength += 1;\n }\n\n if (options.strokeWidth !== undefined && !isNumber(options.strokeWidth)) {\n // 数据映射\n this.cellProperties.push({ attr: 'strokeWidth', count: 1 });\n this.stylePropertyesExist.hasStrokeWidth = 1;\n this.cellLength += 1;\n }\n\n if (options.stroke !== undefined && !this.isStaticColor(options.stroke)) {\n // 数据映射\n this.cellProperties.push({ attr: 'stroke', count: 4 });\n this.stylePropertyesExist.hasStroke = 1;\n this.cellLength += 4;\n }\n\n if (\n options.offsets !== undefined &&\n !this.isOffsetStatic(options.offsets)\n ) {\n // 数据映射\n this.cellProperties.push({ attr: 'offsets', count: 2 });\n this.stylePropertyesExist.hasOffsets = 1;\n this.cellLength += 2;\n }\n\n if (options.thetaOffset !== undefined && !isNumber(options.thetaOffset)) {\n // 数据映射\n this.cellProperties.push({ attr: 'thetaOffset', count: 1 });\n this.stylePropertyesExist.hasThetaOffset = 1;\n this.cellLength += 1;\n }\n // console.log('this.cellLength', this.cellLength)\n }\n\n /**\n * 判断变量 stroke 是否是常量值\n * @param stroke\n * @returns\n */\n public isStaticColor(stroke: styleColor): boolean {\n if (isString(stroke)) {\n if (color(stroke)) {\n return true;\n } else {\n return false;\n }\n }\n return false;\n }\n /**\n * 获取 stroke 颜色并做兼容处理\n * @param stroke\n * @returns\n */\n public getStrokeColor(stroke: styleColor) {\n if (this.isStaticColor(stroke)) {\n const strokeColor = rgb2arr(stroke as string);\n strokeColor[0] = strokeColor[0] ? strokeColor[0] : 0;\n strokeColor[1] = strokeColor[1] ? strokeColor[1] : 0;\n strokeColor[2] = strokeColor[2] ? strokeColor[2] : 0;\n strokeColor[3] = strokeColor[3] ? strokeColor[3] : 0;\n return strokeColor;\n } else {\n return [0, 0, 0, 0];\n }\n }\n\n /**\n * 判断 offsets 是否是常量\n * @param offsets\n * @returns\n */\n public isOffsetStatic(offsets: styleOffset) {\n if (\n isArray(offsets) &&\n offsets.length === 2 &&\n isNumber(offsets[0]) &&\n isNumber(offsets[1])\n ) {\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * 补空位\n * @param d\n * @param count\n */\n public patchMod(d: number[], count: number) {\n for (let i = 0; i < count; i++) {\n d.push(-1);\n }\n }\n\n /**\n * 根据映射的数据字段往推入数据\n * @param d\n * @param cellData\n * @param cellPropertiesLayouts\n */\n public patchData(\n d: number[],\n cellData: IEncodeFeature,\n cellPropertiesLayouts: ICellProperty[],\n ) {\n for (const layout of cellPropertiesLayouts) {\n const { attr, count } = layout;\n\n const value = cellData[attr];\n if (value !== undefined) {\n // 数据中存在该属性\n if (attr === 'stroke') {\n d.push(...rgb2arr(value));\n } else if (attr === 'offsets') {\n if (this.isOffsetStatic(value)) {\n d.push(-value[0], value[1]);\n } else {\n d.push(0, 0);\n }\n } else {\n d.push(isNumber(value) ? value : 1.0);\n }\n } else {\n // 若不存在时则补位\n this.patchMod(d, count);\n }\n }\n }\n\n /**\n * 计算推入数据纹理的数据\n * @param cellLength\n * @param encodeData\n * @param cellPropertiesLayouts\n * @returns\n */\n public calDataFrame(\n cellLength: number,\n encodeData: IEncodeFeature[],\n cellPropertiesLayouts: ICellProperty[],\n ): IDataTextureFrame {\n const encodeDatalength = encodeData.length;\n const rowCount = Math.ceil(\n (encodeDatalength * cellLength) / this.DATA_TEXTURE_WIDTH,\n ); // 有多少行\n\n const totalLength = rowCount * this.DATA_TEXTURE_WIDTH;\n const d: number[] = [];\n for (let i = 0; i < encodeDatalength; i++) {\n // 根据 encodeData 数据推入数据\n const cellData = encodeData[i];\n this.patchData(d, cellData, cellPropertiesLayouts);\n }\n for (let i = d.length; i < totalLength; i++) {\n // 每行不足的部分用 -1 补足(数据纹理时 width * height 的矩形数据集合)\n d.push(-1);\n }\n // console.log('data', d)\n return { data: d, width: this.DATA_TEXTURE_WIDTH, height: rowCount };\n }\n\n // style datatexture mapping\n\n public getBlend(): IBlendOptions {\n const { blend = 'normal' } = this.layer.getLayerConfig();\n return BlendTypes[BlendType[blend]] as IBlendOptions;\n }\n public getDefaultStyle(): unknown {\n return {};\n }\n public getUninforms(): IModelUniform {\n throw new Error('Method not implemented.');\n }\n\n public getAnimateUniforms(): IModelUniform {\n return {};\n }\n\n public needUpdate(): boolean {\n return false;\n }\n public buildModels(): IModel[] {\n throw new Error('Method not implemented.');\n }\n public initModels(): IModel[] {\n throw new Error('Method not implemented.');\n }\n public clearModels() {\n return;\n }\n public getAttribute(): {\n attributes: {\n [attributeName: string]: IAttribute;\n };\n elements: IElements;\n } {\n throw new Error('Method not implemented.');\n }\n public render() {\n throw new Error('Method not implemented.');\n }\n protected registerBuiltinAttributes() {\n throw new Error('Method not implemented.');\n }\n protected animateOption2Array(option: IAnimateOption): number[] {\n return [\n option.enable ? 0 : 1.0,\n option.duration || 4.0,\n option.interval || 0.2,\n option.trailLength || 0.1,\n ];\n }\n protected startModelAnimate() {\n const { animateOption } = this.layer.getLayerConfig() as ILayerConfig;\n if (animateOption.enable) {\n this.layer.setAnimateStartTime();\n }\n }\n}\n"],"file":"BaseModel.js"}
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","Uint8ClampedArray","mag","gl","NEAREST","min","width","height","options","isUpdate","clearLastCalRes","push","attr","count","isStaticColor","isOffsetStatic","strokeColor","length","d","i","cellData","cellPropertiesLayouts","layout","value","patchMod","encodeData","encodeDatalength","Math","ceil","totalLength","patchData","getLayerConfig","blend","BlendTypes","BlendType","Error","option","enable","duration","interval","trailLength","animateOption","setAnimateStartTime"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AA4BA;;AACA;;AAEA;;;;;;;;;;IA0BqBA,S,WAoClB,wBAAWC,cAAMC,oBAAjB,C;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,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,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,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 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 +1 @@
1
- {"version":3,"sources":["../../src/core/interface.ts"],"names":["lineStyleType"],"mappings":";;;;;;IACYA,a;;;WAAAA,a;AAAAA,EAAAA,a,CAAAA,a;AAAAA,EAAAA,a,CAAAA,a;GAAAA,a,6BAAAA,a","sourcesContent":["import { styleSingle } from '../core/BaseModel';\nexport enum lineStyleType {\n 'solid' = 0.0,\n 'dash' = 1.0,\n}\n\nexport interface ILineLayerStyleOptions {\n opacity: styleSingle;\n lineType?: keyof typeof lineStyleType; // 可选参数、线类型(all - dash/solid)\n dashArray?: [number, number]; // 可选参数、虚线间隔\n segmentNumber?: number;\n\n forward?: boolean; // 可选参数、是否反向(arcLine)\n lineTexture?: boolean; // 可选参数、是否开启纹理贴图功能(all)\n iconStep?: number; // 可选参数、纹理贴图步长(all)\n textureBlend?: string; // 可选参数、供给纹理贴图使用(all)\n sourceColor?: string; // 可选参数、设置渐变色的起始颜色(all)\n targetColor?: string; // 可选参数、设置渐变色的终点颜色(all)\n thetaOffset?: number; // 可选参数、设置弧线的偏移量\n\n globalArcHeight?: number; // 可选参数、地球模式下 3D 弧线的高度\n vertexHeightScale?: number; // 可选参数、lineLayer vertex height scale\n}\n"],"file":"interface.js"}
1
+ {"version":3,"sources":["../../src/core/interface.ts"],"names":["lineStyleType"],"mappings":";;;;;;IACYA,a;;;WAAAA,a;AAAAA,EAAAA,a,CAAAA,a;AAAAA,EAAAA,a,CAAAA,a;GAAAA,a,6BAAAA,a","sourcesContent":["import { styleSingle } from '../core/BaseModel';\nexport enum lineStyleType {\n 'solid' = 0.0,\n 'dash' = 1.0,\n}\n\nexport interface ILineLayerStyleOptions {\n opacity: styleSingle;\n lineType?: keyof typeof lineStyleType; // 可选参数、线类型(all - dash/solid)\n dashArray?: [number, number]; // 可选参数、虚线间隔\n segmentNumber?: number;\n\n forward?: boolean; // 可选参数、是否反向(arcLine)\n lineTexture?: boolean; // 可选参数、是否开启纹理贴图功能(all)\n iconStep?: number; // 可选参数、纹理贴图步长(all)\n iconStepCount?: number; // 可选参数、纹理贴图间隔\n textureBlend?: string; // 可选参数、供给纹理贴图使用(all)\n sourceColor?: string; // 可选参数、设置渐变色的起始颜色(all)\n targetColor?: string; // 可选参数、设置渐变色的终点颜色(all)\n thetaOffset?: number; // 可选参数、设置弧线的偏移量\n\n globalArcHeight?: number; // 可选参数、地球模式下 3D 弧线的高度\n vertexHeightScale?: number; // 可选参数、lineLayer vertex height scale\n\n borderWidth?: number; // 可选参数 线边框宽度\n borderColor?: string; // 可选参数 线边框颜色\n\n heightfixed?: boolean; // 可选参数 高度是否固定\n}\n"],"file":"interface.js"}
@@ -41,9 +41,9 @@ var _triangulation2 = require("../triangulation");
41
41
 
42
42
  var _dec, _class;
43
43
 
44
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
44
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
45
45
 
46
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
46
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
47
47
 
48
48
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
49
49
 
package/lib/line/index.js CHANGED
@@ -79,6 +79,7 @@ var LineLayer = function (_BaseLayer) {
79
79
  var type = this.getModelType();
80
80
  var defaultConfig = {
81
81
  line: {},
82
+ wall: {},
82
83
  arc3d: {
83
84
  blend: 'additive'
84
85
  },
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/line/index.ts"],"names":["LineLayer","shape","getModelType","layerModel","LineModels","models","initModels","buildModels","properties","opacity","type","minimum","maximum","defaultConfig","line","arc3d","blend","arc","arcmini","greatcircle","shapeAttribute","styleAttributeService","getLayerStyleAttribute","scale","field","BaseLayer"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;;AAEA;;;;;;IAEqBA,S;;;;;;;;;;;;;;;uFACG,W;;;;;;WAEtB,uBAAqB;AACnB,UAAMC,KAAK,GAAG,KAAKC,YAAL,EAAd;AACA,WAAKC,UAAL,GAAkB,IAAIC,gBAAWH,KAAX,CAAJ,CAAsB,IAAtB,CAAlB;AACA,WAAKI,MAAL,GAAc,KAAKF,UAAL,CAAgBG,UAAhB,EAAd;AACD;;;WACD,yBAAuB;AACrB,WAAKD,MAAL,GAAc,KAAKF,UAAL,CAAgBI,WAAhB,EAAd;AACD;;;WAED,2BAA4B;AAC1B,aAAO;AACLC,QAAAA,UAAU,EAAE;AACVC,UAAAA,OAAO,EAAE;AACPC,YAAAA,IAAI,EAAE,QADC;AAEPC,YAAAA,OAAO,EAAE,CAFF;AAGPC,YAAAA,OAAO,EAAE;AAHF;AADC;AADP,OAAP;AASD;;;WACD,4BAA6B;AAC3B,UAAMF,IAAI,GAAG,KAAKR,YAAL,EAAb;AACA,UAAMW,aAAa,GAAG;AACpBC,QAAAA,IAAI,EAAE,EADc;AAEpBC,QAAAA,KAAK,EAAE;AAAEC,UAAAA,KAAK,EAAE;AAAT,SAFa;AAGpBC,QAAAA,GAAG,EAAE;AAAED,UAAAA,KAAK,EAAE;AAAT,SAHe;AAIpBE,QAAAA,OAAO,EAAE;AAAEF,UAAAA,KAAK,EAAE;AAAT,SAJW;AAKpBG,QAAAA,WAAW,EAAE;AAAEH,UAAAA,KAAK,EAAE;AAAT;AALO,OAAtB;AAOA,aAAOH,aAAa,CAACH,IAAD,CAApB;AACD;;;WACD,wBAAwC;AAAA;;AACtC,UAAMU,cAAc,GAAG,KAAKC,qBAAL,CAA2BC,sBAA3B,CACrB,OADqB,CAAvB;AAGA,UAAMrB,KAAK,GAAGmB,cAAH,aAAGA,cAAH,gDAAGA,cAAc,CAAEG,KAAnB,0DAAG,sBAAuBC,KAArC;AACA,aAAOvB,KAAK,IAAI,MAAhB;AACD;;;EAxCoCwB,mB","sourcesContent":["import BaseLayer from '../core/BaseLayer';\nimport { ILineLayerStyleOptions } from '../core/interface';\nimport LineModels, { LineModelType } from './models';\n\nexport default class LineLayer extends BaseLayer<ILineLayerStyleOptions> {\n public type: string = 'LineLayer';\n\n public buildModels() {\n const shape = this.getModelType();\n this.layerModel = new LineModels[shape](this);\n this.models = this.layerModel.initModels();\n }\n public rebuildModels() {\n this.models = this.layerModel.buildModels();\n }\n\n protected getConfigSchema() {\n return {\n properties: {\n opacity: {\n type: 'number',\n minimum: 0,\n maximum: 1,\n },\n },\n };\n }\n protected getDefaultConfig() {\n const type = this.getModelType();\n const defaultConfig = {\n line: {},\n arc3d: { blend: 'additive' },\n arc: { blend: 'additive' },\n arcmini: { blend: 'additive' },\n greatcircle: { blend: 'additive' },\n };\n return defaultConfig[type];\n }\n protected getModelType(): LineModelType {\n const shapeAttribute = this.styleAttributeService.getLayerStyleAttribute(\n 'shape',\n );\n const shape = shapeAttribute?.scale?.field as LineModelType;\n return shape || 'line';\n }\n}\n"],"file":"index.js"}
1
+ {"version":3,"sources":["../../src/line/index.ts"],"names":["LineLayer","shape","getModelType","layerModel","LineModels","models","initModels","buildModels","properties","opacity","type","minimum","maximum","defaultConfig","line","wall","arc3d","blend","arc","arcmini","greatcircle","shapeAttribute","styleAttributeService","getLayerStyleAttribute","scale","field","BaseLayer"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;;AAEA;;;;;;IAEqBA,S;;;;;;;;;;;;;;;uFACG,W;;;;;;WAEtB,uBAAqB;AACnB,UAAMC,KAAK,GAAG,KAAKC,YAAL,EAAd;AACA,WAAKC,UAAL,GAAkB,IAAIC,gBAAWH,KAAX,CAAJ,CAAsB,IAAtB,CAAlB;AACA,WAAKI,MAAL,GAAc,KAAKF,UAAL,CAAgBG,UAAhB,EAAd;AACD;;;WACD,yBAAuB;AACrB,WAAKD,MAAL,GAAc,KAAKF,UAAL,CAAgBI,WAAhB,EAAd;AACD;;;WAED,2BAA4B;AAC1B,aAAO;AACLC,QAAAA,UAAU,EAAE;AACVC,UAAAA,OAAO,EAAE;AACPC,YAAAA,IAAI,EAAE,QADC;AAEPC,YAAAA,OAAO,EAAE,CAFF;AAGPC,YAAAA,OAAO,EAAE;AAHF;AADC;AADP,OAAP;AASD;;;WACD,4BAA6B;AAC3B,UAAMF,IAAI,GAAG,KAAKR,YAAL,EAAb;AACA,UAAMW,aAAa,GAAG;AACpBC,QAAAA,IAAI,EAAE,EADc;AAEpBC,QAAAA,IAAI,EAAE,EAFc;AAGpBC,QAAAA,KAAK,EAAE;AAAEC,UAAAA,KAAK,EAAE;AAAT,SAHa;AAIpBC,QAAAA,GAAG,EAAE;AAAED,UAAAA,KAAK,EAAE;AAAT,SAJe;AAKpBE,QAAAA,OAAO,EAAE;AAAEF,UAAAA,KAAK,EAAE;AAAT,SALW;AAMpBG,QAAAA,WAAW,EAAE;AAAEH,UAAAA,KAAK,EAAE;AAAT;AANO,OAAtB;AAQA,aAAOJ,aAAa,CAACH,IAAD,CAApB;AACD;;;WACD,wBAAwC;AAAA;;AACtC,UAAMW,cAAc,GAAG,KAAKC,qBAAL,CAA2BC,sBAA3B,CACrB,OADqB,CAAvB;AAGA,UAAMtB,KAAK,GAAGoB,cAAH,aAAGA,cAAH,gDAAGA,cAAc,CAAEG,KAAnB,0DAAG,sBAAuBC,KAArC;AACA,aAAOxB,KAAK,IAAI,MAAhB;AACD;;;EAzCoCyB,mB","sourcesContent":["import BaseLayer from '../core/BaseLayer';\nimport { ILineLayerStyleOptions } from '../core/interface';\nimport LineModels, { LineModelType } from './models';\n\nexport default class LineLayer extends BaseLayer<ILineLayerStyleOptions> {\n public type: string = 'LineLayer';\n\n public buildModels() {\n const shape = this.getModelType();\n this.layerModel = new LineModels[shape](this);\n this.models = this.layerModel.initModels();\n }\n public rebuildModels() {\n this.models = this.layerModel.buildModels();\n }\n\n protected getConfigSchema() {\n return {\n properties: {\n opacity: {\n type: 'number',\n minimum: 0,\n maximum: 1,\n },\n },\n };\n }\n protected getDefaultConfig() {\n const type = this.getModelType();\n const defaultConfig = {\n line: {},\n wall: {},\n arc3d: { blend: 'additive' },\n arc: { blend: 'additive' },\n arcmini: { blend: 'additive' },\n greatcircle: { blend: 'additive' },\n };\n return defaultConfig[type];\n }\n protected getModelType(): LineModelType {\n const shapeAttribute = this.styleAttributeService.getLayerStyleAttribute(\n 'shape',\n );\n const shape = shapeAttribute?.scale?.field as LineModelType;\n return shape || 'line';\n }\n}\n"],"file":"index.js"}
@@ -17,11 +17,14 @@ var _great_circle = _interopRequireDefault(require("./great_circle"));
17
17
 
18
18
  var _line = _interopRequireDefault(require("./line"));
19
19
 
20
+ var _wall = _interopRequireDefault(require("./wall"));
21
+
20
22
  var LineModels = {
21
23
  arc: _arc.default,
22
24
  arcmini: _arcmini.default,
23
25
  arc3d: _arc_3d.default,
24
26
  greatcircle: _great_circle.default,
27
+ wall: _wall.default,
25
28
  line: _line.default
26
29
  };
27
30
  var _default = LineModels;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/line/models/index.ts"],"names":["LineModels","arc","ArcModel","arcmini","ArcMiniModel","arc3d","Arc3DModel","greatcircle","GreatCircleModel","line","LineModel"],"mappings":";;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AASA,IAAMA,UAA2C,GAAG;AAClDC,EAAAA,GAAG,EAAEC,YAD6C;AAElDC,EAAAA,OAAO,EAAEC,gBAFyC;AAGlDC,EAAAA,KAAK,EAAEC,eAH2C;AAIlDC,EAAAA,WAAW,EAAEC,qBAJqC;AAKlDC,EAAAA,IAAI,EAAEC;AAL4C,CAApD;eAQeV,U","sourcesContent":["import ArcModel from './arc';\nimport Arc3DModel from './arc_3d';\nimport ArcMiniModel from './arcmini';\nimport GreatCircleModel from './great_circle';\nimport LineModel from './line';\n\nexport type LineModelType =\n | 'arc'\n | 'arcmini'\n | 'arc3d'\n | 'greatcircle'\n | 'line';\n\nconst LineModels: { [key in LineModelType]: any } = {\n arc: ArcModel,\n arcmini: ArcMiniModel,\n arc3d: Arc3DModel,\n greatcircle: GreatCircleModel,\n line: LineModel,\n};\n\nexport default LineModels;\n"],"file":"index.js"}
1
+ {"version":3,"sources":["../../../src/line/models/index.ts"],"names":["LineModels","arc","ArcModel","arcmini","ArcMiniModel","arc3d","Arc3DModel","greatcircle","GreatCircleModel","wall","LineWallModel","line","LineModel"],"mappings":";;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAUA,IAAMA,UAA2C,GAAG;AAClDC,EAAAA,GAAG,EAAEC,YAD6C;AAElDC,EAAAA,OAAO,EAAEC,gBAFyC;AAGlDC,EAAAA,KAAK,EAAEC,eAH2C;AAIlDC,EAAAA,WAAW,EAAEC,qBAJqC;AAKlDC,EAAAA,IAAI,EAAEC,aAL4C;AAMlDC,EAAAA,IAAI,EAAEC;AAN4C,CAApD;eASeZ,U","sourcesContent":["import ArcModel from './arc';\nimport Arc3DModel from './arc_3d';\nimport ArcMiniModel from './arcmini';\nimport GreatCircleModel from './great_circle';\nimport LineModel from './line';\nimport LineWallModel from './wall';\n\nexport type LineModelType =\n | 'arc'\n | 'arcmini'\n | 'arc3d'\n | 'greatcircle'\n | 'wall'\n | 'line';\n\nconst LineModels: { [key in LineModelType]: any } = {\n arc: ArcModel,\n arcmini: ArcMiniModel,\n arc3d: Arc3DModel,\n greatcircle: GreatCircleModel,\n wall: LineWallModel,\n line: LineModel,\n};\n\nexport default LineModels;\n"],"file":"index.js"}
@@ -35,8 +35,8 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
35
35
 
36
36
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
37
37
 
38
- var line_frag = "#define LineTypeSolid 0.0\n#define LineTypeDash 1.0\n#define Animate 0.0\n#define LineTexture 1.0\nuniform float u_blur : 0.99;\nuniform float u_line_type: 0.0;\nuniform float u_opacity : 1.0;\nuniform float u_textureBlend;\nvarying vec4 v_color;\n// varying vec2 v_normal;\n\n// line texture\nuniform float u_line_texture;\nuniform sampler2D u_texture;\nuniform vec2 u_textSize;\n\n// dash\nuniform float u_dash_offset : 0.0;\nuniform float u_dash_ratio : 0.1;\nvarying vec4 v_dash_array;\n\nvarying vec2 v_iconMapUV;\n\nuniform float u_linearColor: 0;\nuniform vec4 u_sourceColor;\nuniform vec4 u_targetColor;\n\n#pragma include \"picking\"\n\nuniform float u_time;\nuniform vec4 u_aimate: [ 0, 2., 1.0, 0.2 ]; // \u63A7\u5236\u8FD0\u52A8\n\nvarying mat4 styleMappingMat;\n// [animate, duration, interval, trailLength],\nvoid main() {\n float opacity = styleMappingMat[0][0];\n float animateSpeed = 0.0; // \u8FD0\u52A8\u901F\u5EA6\n float d_distance_ratio = styleMappingMat[3].r; // \u5F53\u524D\u70B9\u4F4D\u8DDD\u79BB\u5360\u7EBF\u603B\u957F\u7684\u6BD4\u4F8B\n\n if(u_linearColor == 1.0) { // \u4F7F\u7528\u6E10\u53D8\u989C\u8272\n gl_FragColor = mix(u_sourceColor, u_targetColor, d_distance_ratio);\n } else { // \u4F7F\u7528 color \u65B9\u6CD5\u4F20\u5165\u7684\u989C\u8272\n gl_FragColor = v_color;\n }\n\n // anti-alias\n // float blur = 1.0 - smoothstep(u_blur, 1., length(v_normal.xy));\n gl_FragColor.a *= opacity; // \u5168\u5C40\u900F\u660E\u5EA6\n if(u_aimate.x == Animate) {\n animateSpeed = u_time / u_aimate.y;\n float alpha =1.0 - fract( mod(1.0- d_distance_ratio, u_aimate.z)* (1.0/ u_aimate.z) + animateSpeed);\n alpha = (alpha + u_aimate.w -1.0) / u_aimate.w;\n alpha = smoothstep(0., 1., alpha);\n gl_FragColor.a *= alpha;\n }\n // dash line\n if(u_line_type == LineTypeDash) {\n float flag = 0.;\n float dashLength = mod(d_distance_ratio, v_dash_array.x + v_dash_array.y + v_dash_array.z + v_dash_array.w);\n if(dashLength < v_dash_array.x || (dashLength > (v_dash_array.x + v_dash_array.y) && dashLength < v_dash_array.x + v_dash_array.y + v_dash_array.z)) {\n flag = 1.;\n }\n gl_FragColor.a *=flag;\n }\n\n if(u_line_texture == LineTexture && u_line_type != LineTypeDash) { // while load texture\n float aDistance = styleMappingMat[3].g; // \u5F53\u524D\u9876\u70B9\u7684\u8DDD\u79BB\n float d_texPixelLen = styleMappingMat[3].b; // \u8D34\u56FE\u7684\u50CF\u7D20\u957F\u5EA6\uFF0C\u6839\u636E\u5730\u56FE\u5C42\u7EA7\u7F29\u653E\n float u = fract(mod(aDistance, d_texPixelLen)/d_texPixelLen - animateSpeed);\n float v = styleMappingMat[3].a; // \u7EBF\u56FE\u5C42\u8D34\u56FE\u90E8\u5206\u7684 v \u5750\u6807\u503C\n\n v = max(smoothstep(0.95, 1.0, v), v);\n vec2 uv= v_iconMapUV / u_textSize + vec2(u, v) / u_textSize * 64.;\n \n // gl_FragColor = filterColor(gl_FragColor + texture2D(u_texture, vec2(u, v)));\n // gl_FragColor = filterColor(gl_FragColor + texture2D(u_texture, uv));\n vec4 pattern = texture2D(u_texture, uv);\n\n if(u_textureBlend == 0.0) { // normal\n pattern.a = 0.0;\n gl_FragColor = filterColor(gl_FragColor + pattern);\n } else { // replace\n pattern.a *= opacity;\n if(gl_FragColor.a <= 0.0) {\n pattern.a = 0.0;\n }\n gl_FragColor = filterColor(pattern);\n }\n } else {\n gl_FragColor = filterColor(gl_FragColor);\n }\n\n // gl_FragColor = (vec4(1.0, 0.0, 0.0, 1.0));\n \n // if(rV < r || rV > 1.0 - r) {\n // gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);\n // } \n // if(v > 0.9) {\n // gl_FragColor = vec4(0.17647, 0.43921568, 0.2, 1.0);\n // } else if(v < 0.1) {\n // gl_FragColor = vec4(0.17647, 0.43921568, 0.2, 1.0);\n // }\n\n // gl_FragColor = filterColor(gl_FragColor);\n}\n";
39
- var line_vert = "#define LineTypeSolid 0.0\n#define LineTypeDash 1.0\n#define Animate 0.0\n\nattribute float a_Miter;\nattribute vec4 a_Color;\nattribute vec2 a_Size;\nattribute vec3 a_Normal;\nattribute vec3 a_Position;\n\nattribute vec2 a_iconMapUV;\n\n// dash line\nattribute float a_Total_Distance;\nattribute float a_Distance;\n\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\nuniform float u_line_type: 0.0;\nuniform vec4 u_dash_array: [10.0, 5., 0, 0];\nuniform vec4 u_aimate: [ 0, 2., 1.0, 0.2 ];\nuniform float u_icon_step: 100;\n\nuniform float u_vertexScale: 1.0;\n\n#pragma include \"projection\"\n#pragma include \"picking\"\n\nvarying vec4 v_color;\nvarying vec4 v_dash_array;\nvarying vec2 v_normal;\n\n// texV \u7EBF\u56FE\u5C42 - \u8D34\u56FE\u90E8\u5206\u7684 v \u5750\u6807\uFF08\u7EBF\u7684\u5BBD\u5EA6\u65B9\u5411\uFF09\nvarying vec2 v_iconMapUV;\n\n\nuniform float u_linearColor: 0;\n\nuniform float u_opacity: 1.0;\nvarying mat4 styleMappingMat; // \u7528\u4E8E\u5C06\u5728\u9876\u70B9\u7740\u8272\u5668\u4E2D\u8BA1\u7B97\u597D\u7684\u6837\u5F0F\u503C\u4F20\u9012\u7ED9\u7247\u5143\n\n#pragma include \"styleMapping\"\n#pragma include \"styleMappingCalOpacity\"\n\nvoid main() {\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 // distance_ratio/distance/pixelLen/texV\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 // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n\n float d_distance_ratio; // \u5F53\u524D\u70B9\u4F4D\u8DDD\u79BB\u5360\u7EBF\u603B\u957F\u7684\u6BD4\u4F8B\n float d_texPixelLen; // \u8D34\u56FE\u7684\u50CF\u7D20\u957F\u5EA6\uFF0C\u6839\u636E\u5730\u56FE\u5C42\u7EA7\u7F29\u653E\n\n v_iconMapUV = a_iconMapUV;\n d_texPixelLen = project_pixel(u_icon_step);\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) {\n d_texPixelLen *= 10.0;\n }\n\n if(u_line_type == LineTypeDash) {\n d_distance_ratio = a_Distance / a_Total_Distance;\n v_dash_array = pow(2.0, 20.0 - u_Zoom) * u_dash_array / a_Total_Distance;\n }\n if(u_aimate.x == Animate || u_linearColor == 1.0) {\n d_distance_ratio = a_Distance / a_Total_Distance;\n }\n v_normal = vec2(reverse_offset_normal(a_Normal) * sign(a_Miter));\n\n v_color = a_Color;\n\n vec3 size = a_Miter * setPickingSize(a_Size.x) * reverse_offset_normal(a_Normal);\n\n vec2 offset = project_pixel(size.xy);\n\n float lineOffsetWidth = length(offset + offset * sign(a_Miter)); // \u7EBF\u6A2A\u5411\u504F\u79FB\u7684\u8DDD\u79BB\uFF08\u5411\u4E24\u4FA7\u504F\u79FB\u7684\u548C\uFF09\n float linePixelSize = project_pixel(a_Size.x) * 2.0; // \u5B9A\u70B9\u4F4D\u7F6E\u504F\u79FB\uFF0C\u6309\u5730\u56FE\u7B49\u7EA7\u7F29\u653E\u540E\u7684\u8DDD\u79BB \u5355\u4FA7 * 2\n float texV = lineOffsetWidth/linePixelSize; // \u7EBF\u56FE\u5C42\u8D34\u56FE\u90E8\u5206\u7684 v \u5750\u6807\u503C\n\n // \u8BBE\u7F6E\u6570\u636E\u96C6\u7684\u53C2\u6570\n styleMappingMat[3][0] = d_distance_ratio; // \u5F53\u524D\u70B9\u4F4D\u8DDD\u79BB\u5360\u7EBF\u603B\u957F\u7684\u6BD4\u4F8B\n styleMappingMat[3][1] = a_Distance; // \u5F53\u524D\u9876\u70B9\u7684\u8DDD\u79BB\n styleMappingMat[3][2] = d_texPixelLen; // \u8D34\u56FE\u7684\u50CF\u7D20\u957F\u5EA6\uFF0C\u6839\u636E\u5730\u56FE\u5C42\u7EA7\u7F29\u653E\n styleMappingMat[3][3] = texV; // \u7EBF\u56FE\u5C42\u8D34\u56FE\u90E8\u5206\u7684 v \u5750\u6807\u503C\n\n vec4 project_pos = project_position(vec4(a_Position.xy, 0, 1.0));\n\n // gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, a_Size.y, 1.0));\n\n float h = float((a_Position.z)) * u_vertexScale; // \u7EBF\u9876\u70B9\u7684\u9AD8\u5EA6 - \u517C\u5BB9\u4E0D\u5B58\u5728\u7B2C\u4E09\u4E2A\u6570\u503C\u7684\u60C5\u51B5\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n // gl_Position = u_Mvp * (vec4(project_pos.xy + offset, a_Size.y, 1.0));\n gl_Position = u_Mvp * (vec4(project_pos.xy + offset, a_Size.y / 8.0 + h, 1.0)); // \u989D\u5916\u9664 8.0 \u662F\u4E3A\u4E86\u548Cgaode1.x\u7684\u9AD8\u5EA6\u517C\u5BB9\n } else {\n float lineHeight = a_Size.y;\n // \u517C\u5BB9 mapbox \u5728\u7EBF\u9AD8\u5EA6\u4E0A\u7684\u6548\u679C\u8868\u73B0\u57FA\u672C\u4E00\u81F4\n if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {\n lineHeight = lineHeight*2.0/pow(2.0, 20.0 - u_Zoom);\n }\n \n\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, lineHeight + h, 1.0));\n }\n\n setPickingColor(a_PickingColor);\n}\n";
38
+ var line_frag = "#define LineTypeSolid 0.0\n#define LineTypeDash 1.0\n#define Animate 0.0\n#define LineTexture 1.0\nuniform float u_blur : 0.99;\nuniform float u_line_type: 0.0;\nuniform float u_opacity : 1.0;\nuniform float u_textureBlend;\n\nuniform float u_borderWidth: 0.0;\nuniform vec4 u_borderColor;\nvarying vec4 v_color;\n\n// line texture\nuniform float u_line_texture;\nuniform sampler2D u_texture;\nuniform vec2 u_textSize;\n\n// dash\nuniform float u_dash_offset : 0.0;\nuniform float u_dash_ratio : 0.1;\nvarying vec4 v_dash_array;\n\nvarying vec2 v_iconMapUV;\n\nuniform float u_linearColor: 0;\nuniform vec4 u_sourceColor;\nuniform vec4 u_targetColor;\n\n#pragma include \"picking\"\n\nuniform float u_time;\nuniform vec4 u_aimate: [ 0, 2., 1.0, 0.2 ]; // \u63A7\u5236\u8FD0\u52A8\n\nvarying mat4 styleMappingMat;\n// [animate, duration, interval, trailLength],\nvoid main() {\n float opacity = styleMappingMat[0][0];\n float animateSpeed = 0.0; // \u8FD0\u52A8\u901F\u5EA6\n float d_distance_ratio = styleMappingMat[3].r; // \u5F53\u524D\u70B9\u4F4D\u8DDD\u79BB\u5360\u7EBF\u603B\u957F\u7684\u6BD4\u4F8B\n\n if(u_linearColor == 1.0) { // \u4F7F\u7528\u6E10\u53D8\u989C\u8272\n gl_FragColor = mix(u_sourceColor, u_targetColor, d_distance_ratio);\n } else { // \u4F7F\u7528 color \u65B9\u6CD5\u4F20\u5165\u7684\u989C\u8272\n gl_FragColor = v_color;\n }\n\n // anti-alias\n // float blur = 1.0 - smoothstep(u_blur, 1., length(v_normal.xy));\n gl_FragColor.a *= opacity; // \u5168\u5C40\u900F\u660E\u5EA6\n if(u_aimate.x == Animate) {\n animateSpeed = u_time / u_aimate.y;\n float alpha =1.0 - fract( mod(1.0- d_distance_ratio, u_aimate.z)* (1.0/ u_aimate.z) + animateSpeed);\n alpha = (alpha + u_aimate.w -1.0) / u_aimate.w;\n alpha = smoothstep(0., 1., alpha);\n gl_FragColor.a *= alpha;\n }\n // dash line\n if(u_line_type == LineTypeDash) {\n float flag = 0.;\n float dashLength = mod(d_distance_ratio, v_dash_array.x + v_dash_array.y + v_dash_array.z + v_dash_array.w);\n if(dashLength < v_dash_array.x || (dashLength > (v_dash_array.x + v_dash_array.y) && dashLength < v_dash_array.x + v_dash_array.y + v_dash_array.z)) {\n flag = 1.;\n }\n gl_FragColor.a *=flag;\n }\n\n if(u_line_texture == LineTexture && u_line_type != LineTypeDash) { // while load texture\n float aDistance = styleMappingMat[3].g; // \u5F53\u524D\u9876\u70B9\u7684\u8DDD\u79BB\n float d_texPixelLen = styleMappingMat[3].b; // \u8D34\u56FE\u7684\u50CF\u7D20\u957F\u5EA6\uFF0C\u6839\u636E\u5730\u56FE\u5C42\u7EA7\u7F29\u653E\n float u = fract(mod(aDistance, d_texPixelLen)/d_texPixelLen - animateSpeed);\n float v = styleMappingMat[3].a; // \u7EBF\u56FE\u5C42\u8D34\u56FE\u90E8\u5206\u7684 v \u5750\u6807\u503C\n\n // v = max(smoothstep(0.95, 1.0, v), v);\n vec2 uv= v_iconMapUV / u_textSize + vec2(u, v) / u_textSize * 64.;\n \n // gl_FragColor = filterColor(gl_FragColor + texture2D(u_texture, vec2(u, v)));\n // gl_FragColor = filterColor(gl_FragColor + texture2D(u_texture, uv));\n vec4 pattern = texture2D(u_texture, uv);\n\n if(u_textureBlend == 0.0) { // normal\n pattern.a = 0.0;\n gl_FragColor = filterColor(gl_FragColor + pattern);\n } else { // replace\n pattern.a *= opacity;\n if(gl_FragColor.a <= 0.0) {\n pattern.a = 0.0;\n }\n gl_FragColor = filterColor(pattern);\n }\n } else {\n\n float v = styleMappingMat[3].a;\n float borderWidth = min(0.5, u_borderWidth);\n // \u7ED8\u5236 border\n if(borderWidth > 0.0) {\n float borderOuterWidth = borderWidth/2.0;\n\n if(v >= 1.0 - borderWidth || v <= borderWidth) {\n if(v > borderWidth) {\n float linear = smoothstep(0.0, 1.0, (v - (1.0 - borderWidth))/borderWidth);\n gl_FragColor.rgb = mix(gl_FragColor.rgb, u_borderColor.rgb, linear);\n } else if(v <= borderWidth) {\n float linear = smoothstep(0.0, 1.0, v/borderWidth);\n gl_FragColor.rgb = mix(u_borderColor.rgb, gl_FragColor.rgb, linear);\n }\n }\n\n if(v < borderOuterWidth) {\n gl_FragColor.a = mix(0.0, gl_FragColor.a, v/borderOuterWidth);\n } else if(v > 1.0 - borderOuterWidth) {\n gl_FragColor.a = mix(gl_FragColor.a, 0.0, (v - (1.0 - borderOuterWidth))/borderOuterWidth);\n }\n }\n\n gl_FragColor = filterColor(gl_FragColor);\n }\n\n \n \n \n}\n";
39
+ var line_vert = "#define LineTypeSolid 0.0\n#define LineTypeDash 1.0\n#define Animate 0.0\n\nattribute float a_Miter;\nattribute vec4 a_Color;\nattribute vec2 a_Size;\nattribute vec3 a_Normal;\nattribute vec3 a_Position;\n\nattribute vec2 a_iconMapUV;\n\n// dash line\nattribute float a_Total_Distance;\nattribute float a_Distance;\n\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\nuniform float u_line_type: 0.0;\nuniform vec4 u_dash_array: [10.0, 5., 0, 0];\nuniform vec4 u_aimate: [ 0, 2., 1.0, 0.2 ];\nuniform float u_icon_step: 100;\n\nuniform float u_vertexScale: 1.0;\n\n#pragma include \"projection\"\n#pragma include \"picking\"\n\nvarying vec4 v_color;\nvarying vec4 v_dash_array;\n\n// texV \u7EBF\u56FE\u5C42 - \u8D34\u56FE\u90E8\u5206\u7684 v \u5750\u6807\uFF08\u7EBF\u7684\u5BBD\u5EA6\u65B9\u5411\uFF09\nvarying vec2 v_iconMapUV;\n\n\nuniform float u_linearColor: 0;\n\nuniform float u_opacity: 1.0;\nvarying mat4 styleMappingMat; // \u7528\u4E8E\u5C06\u5728\u9876\u70B9\u7740\u8272\u5668\u4E2D\u8BA1\u7B97\u597D\u7684\u6837\u5F0F\u503C\u4F20\u9012\u7ED9\u7247\u5143\n\n#pragma include \"styleMapping\"\n#pragma include \"styleMappingCalOpacity\"\n\nvoid main() {\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 // distance_ratio/distance/pixelLen/texV\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 // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n\n float d_distance_ratio; // \u5F53\u524D\u70B9\u4F4D\u8DDD\u79BB\u5360\u7EBF\u603B\u957F\u7684\u6BD4\u4F8B\n float d_texPixelLen; // \u8D34\u56FE\u7684\u50CF\u7D20\u957F\u5EA6\uFF0C\u6839\u636E\u5730\u56FE\u5C42\u7EA7\u7F29\u653E\n\n v_iconMapUV = a_iconMapUV;\n d_texPixelLen = project_pixel(u_icon_step);\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) {\n d_texPixelLen *= 10.0;\n }\n\n if(u_line_type == LineTypeDash) {\n d_distance_ratio = a_Distance / a_Total_Distance;\n v_dash_array = pow(2.0, 20.0 - u_Zoom) * u_dash_array / a_Total_Distance;\n }\n if(u_aimate.x == Animate || u_linearColor == 1.0) {\n d_distance_ratio = a_Distance / a_Total_Distance;\n }\n v_color = a_Color;\n\n vec3 size = a_Miter * setPickingSize(a_Size.x) * reverse_offset_normal(a_Normal);\n\n vec2 offset = project_pixel(size.xy);\n\n float lineOffsetWidth = length(offset + offset * sign(a_Miter)); // \u7EBF\u6A2A\u5411\u504F\u79FB\u7684\u8DDD\u79BB\uFF08\u5411\u4E24\u4FA7\u504F\u79FB\u7684\u548C\uFF09\n float linePixelSize = project_pixel(a_Size.x) * 2.0; // \u5B9A\u70B9\u4F4D\u7F6E\u504F\u79FB\uFF0C\u6309\u5730\u56FE\u7B49\u7EA7\u7F29\u653E\u540E\u7684\u8DDD\u79BB \u5355\u4FA7 * 2\n float texV = lineOffsetWidth/linePixelSize; // \u7EBF\u56FE\u5C42\u8D34\u56FE\u90E8\u5206\u7684 v \u5750\u6807\u503C\n\n // \u8BBE\u7F6E\u6570\u636E\u96C6\u7684\u53C2\u6570\n styleMappingMat[3][0] = d_distance_ratio; // \u5F53\u524D\u70B9\u4F4D\u8DDD\u79BB\u5360\u7EBF\u603B\u957F\u7684\u6BD4\u4F8B\n styleMappingMat[3][1] = a_Distance; // \u5F53\u524D\u9876\u70B9\u7684\u8DDD\u79BB\n styleMappingMat[3][2] = d_texPixelLen; // \u8D34\u56FE\u7684\u50CF\u7D20\u957F\u5EA6\uFF0C\u6839\u636E\u5730\u56FE\u5C42\u7EA7\u7F29\u653E\n styleMappingMat[3][3] = texV; // \u7EBF\u56FE\u5C42\u8D34\u56FE\u90E8\u5206\u7684 v \u5750\u6807\u503C\n\n vec4 project_pos = project_position(vec4(a_Position.xy, 0, 1.0));\n\n // gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, a_Size.y, 1.0));\n\n float h = float((a_Position.z)) * u_vertexScale; // \u7EBF\u9876\u70B9\u7684\u9AD8\u5EA6 - \u517C\u5BB9\u4E0D\u5B58\u5728\u7B2C\u4E09\u4E2A\u6570\u503C\u7684\u60C5\u51B5\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n // gl_Position = u_Mvp * (vec4(project_pos.xy + offset, a_Size.y, 1.0));\n gl_Position = u_Mvp * (vec4(project_pos.xy + offset, a_Size.y / 8.0 + h, 1.0)); // \u989D\u5916\u9664 8.0 \u662F\u4E3A\u4E86\u548Cgaode1.x\u7684\u9AD8\u5EA6\u517C\u5BB9\n } else {\n float lineHeight = a_Size.y;\n // \u517C\u5BB9 mapbox \u5728\u7EBF\u9AD8\u5EA6\u4E0A\u7684\u6548\u679C\u8868\u73B0\u57FA\u672C\u4E00\u81F4\n if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {\n lineHeight = lineHeight*2.0/pow(2.0, 20.0 - u_Zoom);\n }\n \n\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, lineHeight + h, 1.0));\n }\n\n setPickingColor(a_PickingColor);\n}\n";
40
40
  var lineStyleObj = {
41
41
  solid: 0.0,
42
42
  dash: 1.0
@@ -101,7 +101,11 @@ var LineModel = function (_BaseModel) {
101
101
  _ref$iconStep = _ref.iconStep,
102
102
  iconStep = _ref$iconStep === void 0 ? 100 : _ref$iconStep,
103
103
  _ref$vertexHeightScal = _ref.vertexHeightScale,
104
- vertexHeightScale = _ref$vertexHeightScal === void 0 ? 20.0 : _ref$vertexHeightScal;
104
+ vertexHeightScale = _ref$vertexHeightScal === void 0 ? 20.0 : _ref$vertexHeightScal,
105
+ _ref$borderWidth = _ref.borderWidth,
106
+ borderWidth = _ref$borderWidth === void 0 ? 0.0 : _ref$borderWidth,
107
+ _ref$borderColor = _ref.borderColor,
108
+ borderColor = _ref$borderColor === void 0 ? '#ccc' : _ref$borderColor;
105
109
 
106
110
  if (dashArray.length === 2) {
107
111
  dashArray.push(0, 0);
@@ -163,6 +167,8 @@ var LineModel = function (_BaseModel) {
163
167
  u_line_texture: lineTexture ? 1.0 : 0.0,
164
168
  u_icon_step: iconStep,
165
169
  u_textSize: [1024, this.iconService.canvasHeight || 128],
170
+ u_borderWidth: borderWidth,
171
+ u_borderColor: (0, _l7Utils.rgb2arr)(borderColor),
166
172
  u_linearColor: useLinearColor,
167
173
  u_sourceColor: sourceColorArr,
168
174
  u_targetColor: targetColorArr,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/line/models/line.ts"],"names":["lineStyleObj","solid","dash","LineModel","createTexture2D","rendererService","texture","update","data","iconService","getCanvas","layer","render","mag","gl","NEAREST","min","premultiplyAlpha","width","height","canvasHeight","getLayerConfig","opacity","sourceColor","targetColor","textureBlend","lineType","dashArray","lineTexture","iconStep","vertexHeightScale","length","push","getDirty","bind","useLinearColor","sourceColorArr","targetColorArr","dataTextureTest","dataTextureNeedUpdate","judgeStyleAttributes","encodeData","getEncodedData","calDataFrame","cellLength","cellProperties","rowCount","dataTexture","flipY","format","LUMINANCE","type","FLOAT","u_dataTexture","u_cellTypeLayout","getCellTypeLayout","u_opacity","u_textureBlend","u_line_type","u_dash_array","u_texture","u_line_texture","u_icon_step","u_textSize","u_linearColor","u_sourceColor","u_targetColor","u_vertexScale","animateOption","u_aimate","animateOption2Array","u_time","getLayerAnimateTime","updateTexture","on","buildModels","destroy","off","buildLayerModel","moduleName","vertexShader","line_vert","fragmentShader","line_frag","triangulation","LineTriangulation","primitive","TRIANGLES","blend","getBlend","depth","enable","styleAttributeService","registerStyleAttribute","name","AttributeType","Attribute","descriptor","buffer","usage","STATIC_DRAW","size","feature","featureIdx","vertex","attributeIdx","DYNAMIC_DRAW","Array","isArray","normal","iconMap","getIconMap","x","y","url","Promise","resolve","reject","HTMLImageElement","image","Image","crossOrigin","onload","onerror","Error","src","File","URL","createObjectURL","BaseModel"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AAYA;;AAEA;;AAEA;;;;;;;;AAGA,IAAMA,YAAuC,GAAG;AAC9CC,EAAAA,KAAK,EAAE,GADuC;AAE9CC,EAAAA,IAAI,EAAE;AAFwC,CAAhD;;IAIqBC,S;;;;;;;;;;;;;;;;gGAkSK,YAAM;AAC5B,UAA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AK,CAACI,OAAN,GAAgB,YAAM;AACpBN,UAAAA,MAAM,CAAC,IAAIO,KAAJ,CAAU,6BAA6BV,GAAvC,CAAD,CAAN;AACD,SAFD;;AAGAK,QAAAA,KAAK,CAACM,GAAN,GAAYX,GAAG,YAAYY,IAAf,GAAsBC,GAAG,CAACC,eAAJ,CAAoBd,GAApB,CAAtB,GAAiDA,GAA7D;AACD,OAdM,CAAP;AAeD;;;EAhSoCe,mB","sourcesContent":["import {\n AttributeType,\n gl,\n IAnimateOption,\n IEncodeFeature,\n IImage,\n ILayerConfig,\n IModel,\n IModelUniform,\n ITexture2D,\n} from '@antv/l7-core';\n\nimport { rgb2arr } from '@antv/l7-utils';\nimport { isNumber } from 'lodash';\nimport BaseModel from '../../core/BaseModel';\nimport { ILineLayerStyleOptions, lineStyleType } from '../../core/interface';\nimport { LineTriangulation } from '../../core/triangulation';\nimport line_frag from '../shaders/line_frag.glsl';\nimport line_vert from '../shaders/line_vert.glsl';\nconst lineStyleObj: { [key: string]: number } = {\n solid: 0.0,\n dash: 1.0,\n};\nexport default class LineModel extends BaseModel {\n protected texture: ITexture2D;\n public getUninforms(): IModelUniform {\n const {\n opacity,\n sourceColor,\n targetColor,\n textureBlend = 'normal',\n lineType = 'solid',\n dashArray = [10, 5, 0, 0],\n lineTexture = false,\n iconStep = 100,\n vertexHeightScale = 20.0,\n } = this.layer.getLayerConfig() as ILineLayerStyleOptions;\n if (dashArray.length === 2) {\n dashArray.push(0, 0);\n }\n\n if (this.rendererService.getDirty()) {\n this.texture.bind();\n }\n\n // 转化渐变色\n let useLinearColor = 0; // 默认不生效\n let sourceColorArr = [0, 0, 0, 0];\n let targetColorArr = [0, 0, 0, 0];\n if (sourceColor && targetColor) {\n sourceColorArr = rgb2arr(sourceColor);\n targetColorArr = rgb2arr(targetColor);\n useLinearColor = 1;\n }\n\n if (this.dataTextureTest && this.dataTextureNeedUpdate({ opacity })) {\n this.judgeStyleAttributes({ opacity });\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\n return {\n u_dataTexture: this.dataTexture, // 数据纹理 - 有数据映射的时候纹理中带数据,若没有任何数据映射时纹理是 [1]\n u_cellTypeLayout: this.getCellTypeLayout(),\n // u_opacity: opacity === undefined ? 1 : opacity,\n u_opacity: isNumber(opacity) ? opacity : 1.0,\n u_textureBlend: textureBlend === 'normal' ? 0.0 : 1.0,\n u_line_type: lineStyleObj[lineType],\n u_dash_array: dashArray,\n\n // 纹理支持参数\n u_texture: this.texture, // 贴图\n u_line_texture: lineTexture ? 1.0 : 0.0, // 传入线的标识\n u_icon_step: iconStep,\n u_textSize: [1024, this.iconService.canvasHeight || 128],\n\n // 渐变色支持参数\n u_linearColor: useLinearColor,\n u_sourceColor: sourceColorArr,\n u_targetColor: targetColorArr,\n\n // 顶点高度 scale\n u_vertexScale: vertexHeightScale,\n };\n }\n public getAnimateUniforms(): IModelUniform {\n const { animateOption } = this.layer.getLayerConfig() as ILayerConfig;\n return {\n u_aimate: this.animateOption2Array(animateOption as IAnimateOption),\n u_time: this.layer.getLayerAnimateTime(),\n };\n }\n\n public initModels(): IModel[] {\n this.updateTexture();\n this.iconService.on('imageUpdate', this.updateTexture);\n\n return this.buildModels();\n }\n\n public clearModels() {\n this.texture?.destroy();\n this.dataTexture?.destroy();\n this.iconService.off('imageUpdate', this.updateTexture);\n }\n\n public buildModels(): IModel[] {\n return [\n this.layer.buildLayerModel({\n moduleName: 'line',\n vertexShader: line_vert,\n fragmentShader: line_frag,\n triangulation: LineTriangulation,\n primitive: gl.TRIANGLES,\n blend: this.getBlend(),\n depth: { enable: false },\n }),\n ];\n }\n protected registerBuiltinAttributes() {\n // const lineType = this\n // point layer size;\n const {\n lineType = 'solid',\n } = this.layer.getLayerConfig() as ILineLayerStyleOptions;\n // if (lineType === 'dash') {\n this.styleAttributeService.registerStyleAttribute({\n name: 'distance',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_Distance',\n buffer: {\n // give the WebGL driver a hint that this buffer may change\n usage: gl.STATIC_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 return [vertex[3]];\n },\n },\n });\n this.styleAttributeService.registerStyleAttribute({\n name: 'total_distance',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_Total_Distance',\n buffer: {\n // give the WebGL driver a hint that this buffer may change\n usage: gl.STATIC_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 return [vertex[5]];\n },\n },\n });\n // }\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: 2,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n ) => {\n const { size = 1 } = feature;\n return Array.isArray(size) ? [size[0], size[1]] : [size as number, 0];\n },\n },\n });\n\n // point layer size;\n this.styleAttributeService.registerStyleAttribute({\n name: 'normal',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_Normal',\n buffer: {\n // give the WebGL driver a hint that this buffer may change\n usage: gl.STATIC_DRAW,\n data: [],\n type: gl.FLOAT,\n },\n size: 3,\n // @ts-ignore\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n normal: number[],\n ) => {\n return normal;\n },\n },\n });\n\n this.styleAttributeService.registerStyleAttribute({\n name: 'miter',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_Miter',\n buffer: {\n // give the WebGL driver a hint that this buffer may change\n usage: gl.STATIC_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 return [vertex[4]];\n },\n },\n });\n\n this.styleAttributeService.registerStyleAttribute({\n name: 'uv',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_iconMapUV',\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 { texture } = feature;\n const { x, y } = iconMap[texture as string] || { x: 0, y: 0 };\n return [x, y];\n },\n },\n });\n }\n\n private loadImage(url: IImage) {\n return new Promise((resolve, reject) => {\n if (url instanceof HTMLImageElement) {\n resolve(url);\n return;\n }\n const image = new Image();\n image.crossOrigin = 'anonymous';\n image.onload = () => {\n resolve(image);\n };\n image.onerror = () => {\n reject(new Error('Could not load image at ' + url));\n };\n image.src = url instanceof File ? URL.createObjectURL(url) : url;\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 });\n this.layer.render();\n return;\n }\n this.texture = createTexture2D({\n data: this.iconService.getCanvas(),\n mag: gl.NEAREST,\n min: gl.NEAREST,\n premultiplyAlpha: false,\n width: 1024,\n height: this.iconService.canvasHeight || 128,\n });\n };\n}\n"],"file":"line.js"}
1
+ {"version":3,"sources":["../../../src/line/models/line.ts"],"names":["lineStyleObj","solid","dash","LineModel","createTexture2D","rendererService","texture","update","data","iconService","getCanvas","layer","render","mag","gl","NEAREST","min","premultiplyAlpha","width","height","canvasHeight","getLayerConfig","opacity","sourceColor","targetColor","textureBlend","lineType","dashArray","lineTexture","iconStep","vertexHeightScale","borderWidth","borderColor","length","push","getDirty","bind","useLinearColor","sourceColorArr","targetColorArr","dataTextureTest","dataTextureNeedUpdate","judgeStyleAttributes","encodeData","getEncodedData","calDataFrame","cellLength","cellProperties","rowCount","dataTexture","flipY","format","LUMINANCE","type","FLOAT","u_dataTexture","u_cellTypeLayout","getCellTypeLayout","u_opacity","u_textureBlend","u_line_type","u_dash_array","u_texture","u_line_texture","u_icon_step","u_textSize","u_borderWidth","u_borderColor","u_linearColor","u_sourceColor","u_targetColor","u_vertexScale","animateOption","u_aimate","animateOption2Array","u_time","getLayerAnimateTime","updateTexture","on","buildModels","destroy","off","buildLayerModel","moduleName","vertexShader","line_vert","fragmentShader","line_frag","triangulation","LineTriangulation","primitive","TRIANGLES","blend","getBlend","depth","enable","styleAttributeService","registerStyleAttribute","name","AttributeType","Attribute","descriptor","buffer","usage","STATIC_DRAW","size","feature","featureIdx","vertex","attributeIdx","DYNAMIC_DRAW","Array","isArray","normal","iconMap","getIconMap","x","y","url","Promise","resolve","reject","HTMLImageElement","image","Image","crossOrigin","onload","onerror","Error","src","File","URL","createObjectURL","BaseModel"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AAYA;;AAEA;;AAEA;;;;;;;;AAGA,IAAMA,YAAuC,GAAG;AAC9CC,EAAAA,KAAK,EAAE,GADuC;AAE9CC,EAAAA,IAAI,EAAE;AAFwC,CAAhD;;IAIqBC,S;;;;;;;;;;;;;;;;gGAwSK,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;AADY,SAApB;;AAGA,cAAKC,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AP;AACD,SAFD;;AAGAA,QAAAA,KAAK,CAACI,OAAN,GAAgB,YAAM;AACpBN,UAAAA,MAAM,CAAC,IAAIO,KAAJ,CAAU,6BAA6BV,GAAvC,CAAD,CAAN;AACD,SAFD;;AAGAK,QAAAA,KAAK,CAACM,GAAN,GAAYX,GAAG,YAAYY,IAAf,GAAsBC,GAAG,CAACC,eAAJ,CAAoBd,GAApB,CAAtB,GAAiDA,GAA7D;AACD,OAdM,CAAP;AAeD;;;EAtSoCe,mB","sourcesContent":["import {\n AttributeType,\n gl,\n IAnimateOption,\n IEncodeFeature,\n IImage,\n ILayerConfig,\n IModel,\n IModelUniform,\n ITexture2D,\n} from '@antv/l7-core';\n\nimport { rgb2arr } from '@antv/l7-utils';\nimport { isNumber } from 'lodash';\nimport BaseModel from '../../core/BaseModel';\nimport { ILineLayerStyleOptions, lineStyleType } from '../../core/interface';\nimport { LineTriangulation } from '../../core/triangulation';\nimport line_frag from '../shaders/line_frag.glsl';\nimport line_vert from '../shaders/line_vert.glsl';\nconst lineStyleObj: { [key: string]: number } = {\n solid: 0.0,\n dash: 1.0,\n};\nexport default class LineModel extends BaseModel {\n protected texture: ITexture2D;\n public getUninforms(): IModelUniform {\n const {\n opacity,\n sourceColor,\n targetColor,\n textureBlend = 'normal',\n lineType = 'solid',\n dashArray = [10, 5, 0, 0],\n lineTexture = false,\n iconStep = 100,\n vertexHeightScale = 20.0,\n borderWidth = 0.0,\n borderColor = '#ccc',\n } = this.layer.getLayerConfig() as ILineLayerStyleOptions;\n if (dashArray.length === 2) {\n dashArray.push(0, 0);\n }\n\n if (this.rendererService.getDirty()) {\n this.texture.bind();\n }\n\n // 转化渐变色\n let useLinearColor = 0; // 默认不生效\n let sourceColorArr = [0, 0, 0, 0];\n let targetColorArr = [0, 0, 0, 0];\n if (sourceColor && targetColor) {\n sourceColorArr = rgb2arr(sourceColor);\n targetColorArr = rgb2arr(targetColor);\n useLinearColor = 1;\n }\n\n if (this.dataTextureTest && this.dataTextureNeedUpdate({ opacity })) {\n this.judgeStyleAttributes({ opacity });\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\n return {\n u_dataTexture: this.dataTexture, // 数据纹理 - 有数据映射的时候纹理中带数据,若没有任何数据映射时纹理是 [1]\n u_cellTypeLayout: this.getCellTypeLayout(),\n // u_opacity: opacity === undefined ? 1 : opacity,\n u_opacity: isNumber(opacity) ? opacity : 1.0,\n u_textureBlend: textureBlend === 'normal' ? 0.0 : 1.0,\n u_line_type: lineStyleObj[lineType],\n u_dash_array: dashArray,\n\n // 纹理支持参数\n u_texture: this.texture, // 贴图\n u_line_texture: lineTexture ? 1.0 : 0.0, // 传入线的标识\n u_icon_step: iconStep,\n u_textSize: [1024, this.iconService.canvasHeight || 128],\n\n // line border 参数\n u_borderWidth: borderWidth,\n u_borderColor: rgb2arr(borderColor),\n\n // 渐变色支持参数\n u_linearColor: useLinearColor,\n u_sourceColor: sourceColorArr,\n u_targetColor: targetColorArr,\n\n // 顶点高度 scale\n u_vertexScale: vertexHeightScale,\n };\n }\n public getAnimateUniforms(): IModelUniform {\n const { animateOption } = this.layer.getLayerConfig() as ILayerConfig;\n return {\n u_aimate: this.animateOption2Array(animateOption as IAnimateOption),\n u_time: this.layer.getLayerAnimateTime(),\n };\n }\n\n public initModels(): IModel[] {\n this.updateTexture();\n this.iconService.on('imageUpdate', this.updateTexture);\n\n return this.buildModels();\n }\n\n public clearModels() {\n this.texture?.destroy();\n this.dataTexture?.destroy();\n this.iconService.off('imageUpdate', this.updateTexture);\n }\n\n public buildModels(): IModel[] {\n return [\n this.layer.buildLayerModel({\n moduleName: 'line',\n vertexShader: line_vert,\n fragmentShader: line_frag,\n triangulation: LineTriangulation,\n primitive: gl.TRIANGLES,\n blend: this.getBlend(),\n depth: { enable: false },\n }),\n ];\n }\n protected registerBuiltinAttributes() {\n // const lineType = this\n // point layer size;\n const {\n lineType = 'solid',\n } = this.layer.getLayerConfig() as ILineLayerStyleOptions;\n // if (lineType === 'dash') {\n this.styleAttributeService.registerStyleAttribute({\n name: 'distance',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_Distance',\n buffer: {\n // give the WebGL driver a hint that this buffer may change\n usage: gl.STATIC_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 return [vertex[3]];\n },\n },\n });\n this.styleAttributeService.registerStyleAttribute({\n name: 'total_distance',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_Total_Distance',\n buffer: {\n // give the WebGL driver a hint that this buffer may change\n usage: gl.STATIC_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 return [vertex[5]];\n },\n },\n });\n // }\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: 2,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n ) => {\n const { size = 1 } = feature;\n return Array.isArray(size) ? [size[0], size[1]] : [size as number, 0];\n },\n },\n });\n\n // point layer size;\n this.styleAttributeService.registerStyleAttribute({\n name: 'normal',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_Normal',\n buffer: {\n // give the WebGL driver a hint that this buffer may change\n usage: gl.STATIC_DRAW,\n data: [],\n type: gl.FLOAT,\n },\n size: 3,\n // @ts-ignore\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n normal: number[],\n ) => {\n return normal;\n },\n },\n });\n\n this.styleAttributeService.registerStyleAttribute({\n name: 'miter',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_Miter',\n buffer: {\n // give the WebGL driver a hint that this buffer may change\n usage: gl.STATIC_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 return [vertex[4]];\n },\n },\n });\n\n this.styleAttributeService.registerStyleAttribute({\n name: 'uv',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_iconMapUV',\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 { texture } = feature;\n const { x, y } = iconMap[texture as string] || { x: 0, y: 0 };\n return [x, y];\n },\n },\n });\n }\n\n private loadImage(url: IImage) {\n return new Promise((resolve, reject) => {\n if (url instanceof HTMLImageElement) {\n resolve(url);\n return;\n }\n const image = new Image();\n image.crossOrigin = 'anonymous';\n image.onload = () => {\n resolve(image);\n };\n image.onerror = () => {\n reject(new Error('Could not load image at ' + url));\n };\n image.src = url instanceof File ? URL.createObjectURL(url) : url;\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 });\n this.layer.render();\n return;\n }\n this.texture = createTexture2D({\n data: this.iconService.getCanvas(),\n mag: gl.NEAREST,\n min: gl.NEAREST,\n premultiplyAlpha: false,\n width: 1024,\n height: this.iconService.canvasHeight || 128,\n });\n };\n}\n"],"file":"line.js"}