@antv/l7-layers 2.9.17-alpha.0 → 2.9.19

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 (81) hide show
  1. package/es/core/BaseLayer.js +10 -6
  2. package/es/core/BaseLayer.js.map +1 -1
  3. package/es/core/interface.d.ts +13 -0
  4. package/es/core/interface.js.map +1 -1
  5. package/es/core/triangulation.d.ts +0 -1
  6. package/es/core/triangulation.js +9 -36
  7. package/es/core/triangulation.js.map +1 -1
  8. package/es/image/index.d.ts +1 -1
  9. package/es/image/index.js +14 -2
  10. package/es/image/index.js.map +1 -1
  11. package/es/image/models/dataImage.d.ts +22 -0
  12. package/es/image/models/dataImage.js +235 -0
  13. package/es/image/models/dataImage.js.map +1 -0
  14. package/es/image/models/image.d.ts +1 -0
  15. package/es/image/models/image.js +8 -1
  16. package/es/image/models/image.js.map +1 -1
  17. package/es/image/models/index.d.ts +1 -1
  18. package/es/image/models/index.js +3 -1
  19. package/es/image/models/index.js.map +1 -1
  20. package/es/line/models/arc.js +2 -2
  21. package/es/line/models/arc.js.map +1 -1
  22. package/es/line/models/great_circle.js +2 -2
  23. package/es/line/models/line.js +1 -1
  24. package/es/line/models/simpleLine.d.ts +0 -1
  25. package/es/line/models/simpleLine.js +10 -53
  26. package/es/line/models/simpleLine.js.map +1 -1
  27. package/es/plugins/LayerModelPlugin.js +2 -0
  28. package/es/plugins/LayerModelPlugin.js.map +1 -1
  29. package/es/point/index.js +11 -7
  30. package/es/point/index.js.map +1 -1
  31. package/es/point/models/text.js +2 -0
  32. package/es/point/models/text.js.map +1 -1
  33. package/es/tile/manager/tileLayerManager.js +22 -2
  34. package/es/tile/manager/tileLayerManager.js.map +1 -1
  35. package/es/utils/extrude_polyline.d.ts +0 -15
  36. package/es/utils/extrude_polyline.js +6 -138
  37. package/es/utils/extrude_polyline.js.map +1 -1
  38. package/es/utils/simpleLine.d.ts +23 -0
  39. package/es/utils/simpleLine.js +105 -0
  40. package/es/utils/simpleLine.js.map +1 -0
  41. package/es/wind/models/wind.d.ts +2 -0
  42. package/es/wind/models/wind.js +62 -33
  43. package/es/wind/models/wind.js.map +1 -1
  44. package/es/wind/models/windRender.js +1 -1
  45. package/es/wind/models/windRender.js.map +1 -1
  46. package/lib/core/BaseLayer.js +10 -6
  47. package/lib/core/BaseLayer.js.map +1 -1
  48. package/lib/core/interface.js.map +1 -1
  49. package/lib/core/triangulation.js +10 -36
  50. package/lib/core/triangulation.js.map +1 -1
  51. package/lib/image/index.js +14 -2
  52. package/lib/image/index.js.map +1 -1
  53. package/lib/image/models/dataImage.js +250 -0
  54. package/lib/image/models/dataImage.js.map +1 -0
  55. package/lib/image/models/image.js +8 -1
  56. package/lib/image/models/image.js.map +1 -1
  57. package/lib/image/models/index.js +4 -1
  58. package/lib/image/models/index.js.map +1 -1
  59. package/lib/line/models/arc.js +2 -2
  60. package/lib/line/models/arc.js.map +1 -1
  61. package/lib/line/models/great_circle.js +2 -2
  62. package/lib/line/models/line.js +1 -1
  63. package/lib/line/models/simpleLine.js +10 -53
  64. package/lib/line/models/simpleLine.js.map +1 -1
  65. package/lib/plugins/LayerModelPlugin.js +2 -0
  66. package/lib/plugins/LayerModelPlugin.js.map +1 -1
  67. package/lib/point/index.js +11 -7
  68. package/lib/point/index.js.map +1 -1
  69. package/lib/point/models/text.js +2 -0
  70. package/lib/point/models/text.js.map +1 -1
  71. package/lib/tile/manager/tileLayerManager.js +22 -2
  72. package/lib/tile/manager/tileLayerManager.js.map +1 -1
  73. package/lib/utils/extrude_polyline.js +6 -140
  74. package/lib/utils/extrude_polyline.js.map +1 -1
  75. package/lib/utils/simpleLine.js +117 -0
  76. package/lib/utils/simpleLine.js.map +1 -0
  77. package/lib/wind/models/wind.js +61 -33
  78. package/lib/wind/models/wind.js.map +1 -1
  79. package/lib/wind/models/windRender.js +1 -1
  80. package/lib/wind/models/windRender.js.map +1 -1
  81. package/package.json +5 -5
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/wind/models/windRender.ts"],"names":["glUtils","drawFrag","drawVert","fullScreenFrag","fullScreenVert","updateFrag","updateVert","getColorRamp","colors","canvas","document","createElement","ctx","getContext","width","height","gradient","createLinearGradient","Object","keys","stop","addColorStop","fillStyle","fillRect","Uint8Array","getImageData","data","bindAttribute","gl","buffer","attribute","numComponents","bindBuffer","ARRAY_BUFFER","enableVertexAttribArray","vertexAttribPointer","FLOAT","bindFramebuffer","framebuffer","texture","FRAMEBUFFER","framebufferTexture2D","COLOR_ATTACHMENT0","TEXTURE_2D","Wind","options","glContext","imageWidth","imageHeight","fadeOpacity","speedFactor","dropRate","dropRateBump","rampColors","init","drawProgram","createProgram","fullScreenProgram","updateProgram","quadBuffer","createBuffer","Float32Array","createFramebuffer","colorRampTexture","createTexture","LINEAR","emptyPixels","backgroundTexture","NEAREST","screenTexture","particleRes","particleStateResolution","Math","ceil","sqrt","numParticles","numParticlesSize","particleState","i","length","floor","random","particleStateTexture0","particleStateTexture1","particleIndices","i$1","particleIndexBuffer","windData","windTexture","createDataTexture","image","num","uMin","uMax","vMin","vMax","isColorChanged","deleteTexture","item","key","Number","bindTexture","drawScreen","updateParticles","d","pixels","w","h","viewport","drawFullTexture","drawParticles","disable","BLEND","readPixels","RGBA","UNSIGNED_BYTE","temp","opacity","program","useProgram","a_pos","uniform1i","u_screen","uniform1f","u_opacity","drawArrays","TRIANGLES","a_index","u_wind","u_particles","u_color_ramp","u_particles_res","uniform2f","u_wind_min","u_wind_max","POINTS","u_rand_seed","u_wind_res","u_speed_factor","u_drop_rate","u_drop_rate_bump","deleteBuffer","deleteFramebuffer","deleteShader","vertexShader","fragmentShader","deleteProgram"],"mappings":";;;AAAA,OAAO,KAAKA,OAAZ,MAAyB,SAAzB;AACA,SACEC,QADF,EAEEC,QAFF,EAGEC,cAHF,EAIEC,cAJF,EAKEC,UALF,EAMEC,UANF,QAOO,cAPP;;AASA,SAASC,YAAT,CAAsBC,MAAtB,EAAyD;AACvD,MAAIC,MAA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n} from './windShader';\n\nfunction getColorRamp(colors: { [key: number]: string }) {\n let canvas = document.createElement('canvas') as HTMLCanvasElement;\n const ctx = canvas.getContext('2d') as CanvasRenderingContext2D;\n\n canvas.width = 256;\n canvas.height = 1;\n\n const gradient = ctx.createLinearGradient(0, 0, 256, 0);\n for (const stop of Object.keys(colors)) {\n gradient.addColorStop(+stop, colors[+stop]);\n }\n\n ctx.fillStyle = gradient;\n ctx.fillRect(0, 0, 256, 1);\n\n // @ts-ignore dispose canvas element\n canvas = null;\n\n return new Uint8Array(ctx.getImageData(0, 0, 256, 1).data);\n}\n\nfunction bindAttribute(\n gl: WebGLRenderingContext,\n buffer: any,\n attribute: any,\n numComponents: any,\n) {\n gl.bindBuffer(gl.ARRAY_BUFFER, buffer);\n gl.enableVertexAttribArray(attribute);\n gl.vertexAttribPointer(attribute, numComponents, gl.FLOAT, false, 0, 0);\n}\n\nfunction bindFramebuffer(\n gl: WebGLRenderingContext,\n framebuffer: any,\n texture: any,\n) {\n gl.bindFramebuffer(gl.FRAMEBUFFER, framebuffer);\n if (texture) {\n gl.framebufferTexture2D(\n gl.FRAMEBUFFER,\n gl.COLOR_ATTACHMENT0,\n gl.TEXTURE_2D,\n texture,\n 0,\n );\n }\n}\n\nexport interface IWindData {\n uMin: number;\n uMax: number;\n vMin: number;\n vMax: number;\n image: HTMLImageElement;\n}\n\nexport interface IWind {\n width: number;\n height: number;\n\n fadeOpacity: number;\n speedFactor: number;\n dropRate: number;\n dropRateBump: number;\n\n setWind: (windData: IWindData) => void;\n draw: () => { d: Uint8Array; w: number; h: number };\n updateParticelNum: (num: number) => void;\n updateWindDir: (\n uMin: number,\n uMax: number,\n vMin: number,\n vMax: number,\n ) => void;\n updateColorRampTexture: (rampColors: { [key: number]: string }) => void;\n\n reSize: (width: number, height: number) => void;\n destroy: () => void;\n}\n\nexport interface IWindProps {\n glContext: WebGLRenderingContext;\n imageWidth: number;\n imageHeight: number;\n fadeOpacity: number;\n speedFactor: number;\n dropRate: number;\n dropRateBump: number;\n rampColors: { [key: number]: string };\n}\n\nexport class Wind {\n public width: number = 512;\n public height: number = 512;\n\n public pixels: Uint8Array;\n\n public fadeOpacity: number;\n public speedFactor: number;\n public dropRate: number;\n public dropRateBump: number;\n private gl: WebGLRenderingContext;\n private drawProgram: WebGLProgram;\n private fullScreenProgram: WebGLProgram;\n private updateProgram: WebGLProgram;\n\n private rampColors: { [key: number]: string };\n\n private numParticles: number = 65536;\n private numParticlesSize: number;\n private particleStateResolution: number;\n\n private quadBuffer: WebGLBuffer | null;\n private particleIndexBuffer: WebGLBuffer | null;\n\n private framebuffer: WebGLFramebuffer | null;\n\n private colorRampTexture: WebGLTexture | null;\n private backgroundTexture: WebGLTexture | null;\n private screenTexture: WebGLTexture | null;\n private particleStateTexture0: WebGLTexture | null;\n private particleStateTexture1: WebGLTexture | null;\n private windTexture: WebGLTexture | null;\n\n private windData: IWindData;\n\n constructor(options: IWindProps) {\n this.gl = options.glContext;\n this.width = options.imageWidth;\n this.height = options.imageHeight;\n this.fadeOpacity = options.fadeOpacity;\n this.speedFactor = options.speedFactor;\n this.dropRate = options.dropRate;\n this.dropRateBump = options.dropRateBump;\n\n this.rampColors = options.rampColors;\n this.init();\n }\n\n public init() {\n const gl = this.gl;\n\n this.fadeOpacity = 0.996; // how fast the particle trails fade on each frame\n this.speedFactor = 0.25; // how fast the particles move\n this.dropRate = 0.003; // how often the particles move to a random place\n this.dropRateBump = 0.01; // drop rate increase relative to individual particle speed\n\n this.drawProgram = glUtils.createProgram(\n gl,\n drawVert,\n drawFrag,\n ) as WebGLProgram;\n this.fullScreenProgram = glUtils.createProgram(\n gl,\n fullScreenVert,\n fullScreenFrag,\n ) as WebGLProgram;\n this.updateProgram = glUtils.createProgram(\n gl,\n updateVert,\n updateFrag,\n ) as WebGLProgram;\n\n this.quadBuffer = glUtils.createBuffer(\n gl,\n new Float32Array([0, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1]),\n );\n\n this.framebuffer = gl.createFramebuffer();\n\n this.colorRampTexture = glUtils.createTexture(\n this.gl,\n this.gl.LINEAR,\n getColorRamp(this.rampColors),\n 16,\n 16,\n );\n\n const emptyPixels = new Uint8Array(this.width * this.height * 4);\n\n // screen textures to hold the drawn screen for the previous and the current frame\n\n this.backgroundTexture = glUtils.createTexture(\n gl,\n gl.NEAREST,\n emptyPixels,\n this.width,\n this.height,\n );\n this.screenTexture = glUtils.createTexture(\n gl,\n gl.NEAREST,\n emptyPixels,\n this.width,\n this.height,\n );\n\n // we create a square texture where each pixel will hold a particle position encoded as RGBA\n const particleRes = (this.particleStateResolution = Math.ceil(\n Math.sqrt(this.numParticles),\n ));\n // particleRes size\n this.numParticlesSize = particleRes * particleRes;\n\n const particleState = new Uint8Array(this.numParticlesSize * 4);\n for (let i = 0; i < particleState.length; i++) {\n particleState[i] = Math.floor(Math.random() * 256); // randomize the initial particle positions\n }\n // textures to hold the particle state for the current and the next frame\n this.particleStateTexture0 = glUtils.createTexture(\n gl,\n gl.NEAREST,\n particleState,\n particleRes,\n particleRes,\n );\n this.particleStateTexture1 = glUtils.createTexture(\n gl,\n gl.NEAREST,\n particleState,\n particleRes,\n particleRes,\n );\n\n const particleIndices = new Float32Array(this.numParticlesSize);\n for (let i$1 = 0; i$1 < this.numParticlesSize; i$1++) {\n particleIndices[i$1] = i$1;\n }\n this.particleIndexBuffer = glUtils.createBuffer(gl, particleIndices);\n }\n\n public setWind(windData: IWindData) {\n this.windData = windData;\n this.windTexture = glUtils.createDataTexture(\n this.gl,\n this.gl.LINEAR,\n windData.image,\n );\n }\n\n /**\n * 更新风场粒子数量\n * @param num\n */\n public updateParticelNum(num: number) {\n const gl = this.gl;\n if (num !== this.numParticles) {\n this.numParticles = num; // params number\n\n // we create a square texture where each pixel will hold a particle position encoded as RGBA\n const particleRes = (this.particleStateResolution = Math.ceil(\n Math.sqrt(this.numParticles),\n ));\n this.numParticlesSize = particleRes * particleRes;\n\n const particleState = new Uint8Array(this.numParticlesSize * 4);\n for (let i = 0; i < particleState.length; i++) {\n particleState[i] = Math.floor(Math.random() * 256); // randomize the initial particle positions\n }\n // textures to hold the particle state for the current and the next frame\n this.particleStateTexture0 = glUtils.createTexture(\n gl,\n gl.NEAREST,\n particleState,\n particleRes,\n particleRes,\n );\n this.particleStateTexture1 = glUtils.createTexture(\n gl,\n gl.NEAREST,\n particleState,\n particleRes,\n particleRes,\n );\n\n const particleIndices = new Float32Array(this.numParticlesSize);\n for (let i$1 = 0; i$1 < this.numParticlesSize; i$1++) {\n particleIndices[i$1] = i$1;\n }\n this.particleIndexBuffer = glUtils.createBuffer(gl, particleIndices);\n }\n }\n\n /**\n * 更新风场风向风速\n * @param uMin\n * @param uMax\n * @param vMin\n * @param vMax\n */\n public updateWindDir(uMin: number, uMax: number, vMin: number, vMax: number) {\n this.windData.uMin = uMin;\n this.windData.uMax = uMax;\n this.windData.vMin = vMin;\n this.windData.vMax = vMax;\n }\n\n /**\n * update rampColors\n * @param rampColors\n */\n public updateColorRampTexture(rampColors: { [key: number]: string }) {\n if (this.isColorChanged(rampColors)) {\n this.rampColors = rampColors;\n\n const gl = this.gl;\n gl.deleteTexture(this.colorRampTexture);\n this.colorRampTexture = glUtils.createTexture(\n gl,\n gl.LINEAR,\n getColorRamp(rampColors),\n 16,\n 16,\n );\n }\n }\n\n public isColorChanged(rampColors: { [key: number]: string }): boolean {\n const keys = Object.keys(rampColors);\n for (const item of keys) {\n const key = Number(item);\n // exist new key -> color need update\n if (!this.rampColors[key]) {\n return true;\n }\n // value changed -> color need update\n if (this.rampColors[key] && this.rampColors[key] !== rampColors[key]) {\n return true;\n }\n }\n return false;\n }\n\n public reSize(width: number, height: number) {\n if (width !== this.width || height !== this.height) {\n const gl = this.gl;\n gl.deleteTexture(this.backgroundTexture);\n gl.deleteTexture(this.screenTexture);\n\n this.width = width;\n this.height = height;\n const emptyPixels = new Uint8Array(width * height * 4);\n // screen textures to hold the drawn screen for the previous and the current frame\n this.backgroundTexture = glUtils.createTexture(\n gl,\n gl.NEAREST,\n emptyPixels,\n width,\n height,\n );\n this.screenTexture = glUtils.createTexture(\n gl,\n gl.NEAREST,\n emptyPixels,\n width,\n height,\n );\n }\n }\n\n public draw() {\n if (this.windData?.image) {\n const gl = this.gl;\n\n glUtils.bindTexture(gl, this.windTexture as WebGLTexture, 0);\n glUtils.bindTexture(gl, this.particleStateTexture0 as WebGLTexture, 1);\n\n this.drawScreen(); // draw Particles into framebuffer\n this.updateParticles();\n\n return { d: this.pixels, w: this.width, h: this.height };\n } else {\n return { d: new Uint8Array([0, 0, 0, 0]), w: 1, h: 1 };\n }\n }\n\n public drawScreen() {\n const gl = this.gl;\n\n // draw the screen into a temporary framebuffer to retain it as the background on the next frame\n bindFramebuffer(gl, this.framebuffer, this.screenTexture);\n\n gl.viewport(0, 0, this.width, this.height);\n\n this.drawFullTexture(this.backgroundTexture, this.fadeOpacity);\n this.drawParticles();\n\n gl.disable(gl.BLEND);\n\n this.pixels = new Uint8Array(4 * this.width * this.height);\n gl.readPixels(\n 0,\n 0,\n this.width,\n this.height,\n gl.RGBA,\n gl.UNSIGNED_BYTE,\n this.pixels,\n );\n\n bindFramebuffer(gl, null, null);\n gl.viewport(0, 0, this.gl.canvas.width, this.gl.canvas.height);\n\n // save the current screen as the background for the next frame\n const temp = this.backgroundTexture;\n this.backgroundTexture = this.screenTexture;\n this.screenTexture = temp;\n }\n\n public drawFullTexture(texture: any, opacity: number) {\n const gl = this.gl;\n const program = this.fullScreenProgram as any;\n gl.useProgram(program);\n\n // bindAttribute(gl, this.quadBuffer, program.a_pos, 2);\n\n gl.bindBuffer(gl.ARRAY_BUFFER, this.quadBuffer);\n gl.vertexAttribPointer(program.a_pos, 2, gl.FLOAT, false, 0, 0);\n gl.enableVertexAttribArray(program.a_pos);\n\n gl.bindBuffer(gl.ARRAY_BUFFER, null);\n\n glUtils.bindTexture(gl, texture, 2);\n gl.uniform1i(program.u_screen, 2);\n gl.uniform1f(program.u_opacity, opacity);\n\n gl.drawArrays(gl.TRIANGLES, 0, 6);\n // gl.drawArrays(gl.POINTS, 0, 6);\n }\n\n public drawParticles() {\n const gl = this.gl;\n const program = this.drawProgram as any;\n gl.useProgram(program);\n\n bindAttribute(gl, this.particleIndexBuffer, program.a_index, 1);\n glUtils.bindTexture(gl, this.colorRampTexture as WebGLTexture, 2);\n\n gl.uniform1i(program.u_wind, 0);\n gl.uniform1i(program.u_particles, 1);\n gl.uniform1i(program.u_color_ramp, 2);\n\n gl.uniform1f(program.u_particles_res, this.particleStateResolution);\n gl.uniform2f(program.u_wind_min, this.windData.uMin, this.windData.vMin);\n gl.uniform2f(program.u_wind_max, this.windData.uMax, this.windData.vMax);\n\n gl.drawArrays(gl.POINTS, 0, this.numParticlesSize);\n }\n\n public updateParticles() {\n const gl = this.gl;\n bindFramebuffer(gl, this.framebuffer, this.particleStateTexture1);\n gl.viewport(\n 0,\n 0,\n this.particleStateResolution,\n this.particleStateResolution,\n );\n\n const program = this.updateProgram as any;\n gl.useProgram(program);\n\n bindAttribute(gl, this.quadBuffer, program.a_pos, 2);\n\n gl.uniform1i(program.u_wind, 0);\n gl.uniform1i(program.u_particles, 1);\n\n gl.uniform1f(program.u_rand_seed, Math.random());\n gl.uniform2f(\n program.u_wind_res,\n this.windData.image.width * 2,\n this.windData.image.height * 2,\n );\n gl.uniform2f(program.u_wind_min, this.windData.uMin, this.windData.vMin);\n gl.uniform2f(program.u_wind_max, this.windData.uMax, this.windData.vMax);\n gl.uniform1f(program.u_speed_factor, this.speedFactor);\n gl.uniform1f(program.u_drop_rate, this.dropRate);\n gl.uniform1f(program.u_drop_rate_bump, this.dropRateBump);\n\n gl.drawArrays(gl.TRIANGLES, 0, 6);\n\n // swap the particle state textures so the new one becomes the current one\n const temp = this.particleStateTexture0;\n this.particleStateTexture0 = this.particleStateTexture1;\n this.particleStateTexture1 = temp;\n\n bindFramebuffer(gl, null, null);\n\n // gl.viewport(0, 0, this.gl.canvas.width, this.gl.canvas.height);\n }\n\n public destroy() {\n // private drawProgram: WebGLProgram;\n // private fullScreenProgram: WebGLProgram;\n // private updateProgram: WebGLProgram;\n\n // private quadBuffer: WebGLBuffer | null;\n // private particleIndexBuffer: WebGLBuffer | null;\n\n // private framebuffer: WebGLFramebuffer | null;\n\n // private colorRampTexture: WebGLTexture | null;\n // private backgroundTexture: WebGLTexture | null;\n // private screenTexture: WebGLTexture | null;\n // private particleStateTexture0: WebGLTexture | null;\n // private particleStateTexture1: WebGLTexture | null;\n // private windTexture: WebGLTexture | null;\n\n this.gl.deleteBuffer(this.quadBuffer);\n this.gl.deleteBuffer(this.particleIndexBuffer);\n\n this.gl.deleteFramebuffer(this.framebuffer);\n\n // @ts-ignore\n this.gl.deleteShader(this.drawProgram.vertexShader);\n // @ts-ignore\n this.gl.deleteShader(this.drawProgram.fragmentShader);\n this.gl.deleteProgram(this.drawProgram);\n\n // @ts-ignore\n this.gl.deleteShader(this.fullScreenProgram.vertexShader);\n // @ts-ignore\n this.gl.deleteShader(this.fullScreenProgram.fragmentShader);\n this.gl.deleteProgram(this.fullScreenProgram);\n\n // @ts-ignore\n this.gl.deleteShader(this.updateProgram.vertexShader);\n // @ts-ignore\n this.gl.deleteShader(this.updateProgram.fragmentShader);\n this.gl.deleteProgram(this.updateProgram);\n\n this.gl.deleteTexture(this.colorRampTexture);\n this.gl.deleteTexture(this.backgroundTexture);\n this.gl.deleteTexture(this.screenTexture);\n this.gl.deleteTexture(this.particleStateTexture0);\n this.gl.deleteTexture(this.particleStateTexture1);\n this.gl.deleteTexture(this.windTexture);\n }\n}\n"],"file":"windRender.js"}
1
+ {"version":3,"sources":["../../../src/wind/models/windRender.ts"],"names":["glUtils","drawFrag","drawVert","fullScreenFrag","fullScreenVert","updateFrag","updateVert","getColorRamp","colors","canvas","document","createElement","ctx","getContext","width","height","gradient","createLinearGradient","Object","keys","stop","addColorStop","fillStyle","fillRect","Uint8Array","getImageData","data","bindAttribute","gl","buffer","attribute","numComponents","bindBuffer","ARRAY_BUFFER","enableVertexAttribArray","vertexAttribPointer","FLOAT","bindFramebuffer","framebuffer","texture","FRAMEBUFFER","framebufferTexture2D","COLOR_ATTACHMENT0","TEXTURE_2D","Wind","options","glContext","imageWidth","imageHeight","fadeOpacity","speedFactor","dropRate","dropRateBump","rampColors","init","drawProgram","createProgram","fullScreenProgram","updateProgram","quadBuffer","createBuffer","Float32Array","createFramebuffer","colorRampTexture","createTexture","LINEAR","emptyPixels","backgroundTexture","NEAREST","screenTexture","particleRes","particleStateResolution","Math","ceil","sqrt","numParticles","numParticlesSize","particleState","i","length","floor","random","particleStateTexture0","particleStateTexture1","particleIndices","i$1","particleIndexBuffer","windData","windTexture","createDataTexture","image","num","uMin","uMax","vMin","vMax","isColorChanged","deleteTexture","item","key","Number","bindTexture","drawScreen","updateParticles","d","pixels","w","h","viewport","disable","BLEND","drawFullTexture","drawParticles","readPixels","RGBA","UNSIGNED_BYTE","temp","opacity","program","useProgram","a_pos","uniform1i","u_screen","uniform1f","u_opacity","drawArrays","TRIANGLES","a_index","u_wind","u_particles","u_color_ramp","u_particles_res","uniform2f","u_wind_min","u_wind_max","POINTS","u_rand_seed","u_wind_res","u_speed_factor","u_drop_rate","u_drop_rate_bump","deleteBuffer","deleteFramebuffer","deleteShader","vertexShader","fragmentShader","deleteProgram"],"mappings":";;;AAAA,OAAO,KAAKA,OAAZ,MAAyB,SAAzB;AACA,SACEC,QADF,EAEEC,QAFF,EAGEC,cAHF,EAIEC,cAJF,EAKEC,UALF,EAMEC,UANF,QAOO,cAPP;;AASA,SAASC,YAAT,CAAsBC,MAAtB,EAAyD;AACvD,MAAIC,MAAM,GAAGC,QAAQ,CAACC,aAAT,CAAuB,QAAvB,CAAb;AACA,MAAMC,GAAG,GAAGH,MAAM,CAACI,UAAP,CAAkB,IAAlB,CAAZ;AAEAJ,EAAAA,MAAM,CAACK,KAAP,GAAe,GAAf;AACAL,EAAAA,MAAM,CAACM,MAAP,GAAgB,CAAhB;AAEA,MAAMC,QAAQ,GAAGJ,GAAG,CAAC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EAAL,CAAQmH,YAAR,CAAqB,KAAKxF,WAAL,CAAiB0F,cAAtC;AACA,WAAKrH,EAAL,CAAQsH,aAAR,CAAsB,KAAK3F,WAA3B;AAGA,WAAK3B,EAAL,CAAQmH,YAAR,CAAqB,KAAKtF,iBAAL,CAAuBuF,YAA5C;AAEA,WAAKpH,EAAL,CAAQmH,YAAR,CAAqB,KAAKtF,iBAAL,CAAuBwF,cAA5C;AACA,WAAKrH,EAAL,CAAQsH,aAAR,CAAsB,KAAKzF,iBAA3B;AAGA,WAAK7B,EAAL,CAAQmH,YAAR,CAAqB,KAAKrF,aAAL,CAAmBsF,YAAxC;AAEA,WAAKpH,EAAL,CAAQmH,YAAR,CAAqB,KAAKrF,aAAL,CAAmBuF,cAAxC;AACA,WAAKrH,EAAL,CAAQsH,aAAR,CAAsB,KAAKxF,aAA3B;AAEA,WAAK9B,EAAL,CAAQqE,aAAR,CAAsB,KAAKlC,gBAA3B;AACA,WAAKnC,EAAL,CAAQqE,aAAR,CAAsB,KAAK9B,iBAA3B;AACA,WAAKvC,EAAL,CAAQqE,aAAR,CAAsB,KAAK5B,aAA3B;AACA,WAAKzC,EAAL,CAAQqE,aAAR,CAAsB,KAAKf,qBAA3B;AACA,WAAKtD,EAAL,CAAQqE,aAAR,CAAsB,KAAKd,qBAA3B;AACA,WAAKvD,EAAL,CAAQqE,aAAR,CAAsB,KAAKT,WAA3B;AACD;AA5bH;;AAAA;AAAA","sourcesContent":["import * as glUtils from './utils';\nimport {\n drawFrag,\n drawVert,\n fullScreenFrag,\n fullScreenVert,\n updateFrag,\n updateVert,\n} from './windShader';\n\nfunction getColorRamp(colors: { [key: number]: string }) {\n let canvas = document.createElement('canvas') as HTMLCanvasElement;\n const ctx = canvas.getContext('2d') as CanvasRenderingContext2D;\n\n canvas.width = 256;\n canvas.height = 1;\n\n const gradient = ctx.createLinearGradient(0, 0, 256, 0);\n for (const stop of Object.keys(colors)) {\n gradient.addColorStop(+stop, colors[+stop]);\n }\n\n ctx.fillStyle = gradient;\n ctx.fillRect(0, 0, 256, 1);\n\n // @ts-ignore dispose canvas element\n canvas = null;\n\n return new Uint8Array(ctx.getImageData(0, 0, 256, 1).data);\n}\n\nfunction bindAttribute(\n gl: WebGLRenderingContext,\n buffer: any,\n attribute: any,\n numComponents: any,\n) {\n gl.bindBuffer(gl.ARRAY_BUFFER, buffer);\n gl.enableVertexAttribArray(attribute);\n gl.vertexAttribPointer(attribute, numComponents, gl.FLOAT, false, 0, 0);\n}\n\nfunction bindFramebuffer(\n gl: WebGLRenderingContext,\n framebuffer: any,\n texture: any,\n) {\n gl.bindFramebuffer(gl.FRAMEBUFFER, framebuffer);\n if (texture) {\n gl.framebufferTexture2D(\n gl.FRAMEBUFFER,\n gl.COLOR_ATTACHMENT0,\n gl.TEXTURE_2D,\n texture,\n 0,\n );\n }\n}\n\nexport interface IWindData {\n uMin: number;\n uMax: number;\n vMin: number;\n vMax: number;\n image: HTMLImageElement;\n}\n\nexport interface IWind {\n width: number;\n height: number;\n\n fadeOpacity: number;\n speedFactor: number;\n dropRate: number;\n dropRateBump: number;\n\n setWind: (windData: IWindData) => void;\n draw: () => { d: Uint8Array; w: number; h: number };\n updateParticelNum: (num: number) => void;\n updateWindDir: (\n uMin: number,\n uMax: number,\n vMin: number,\n vMax: number,\n ) => void;\n updateColorRampTexture: (rampColors: { [key: number]: string }) => void;\n\n reSize: (width: number, height: number) => void;\n destroy: () => void;\n}\n\nexport interface IWindProps {\n glContext: WebGLRenderingContext;\n imageWidth: number;\n imageHeight: number;\n fadeOpacity: number;\n speedFactor: number;\n dropRate: number;\n dropRateBump: number;\n rampColors: { [key: number]: string };\n}\n\nexport class Wind {\n public width: number = 512;\n public height: number = 512;\n\n public pixels: Uint8Array;\n\n public fadeOpacity: number;\n public speedFactor: number;\n public dropRate: number;\n public dropRateBump: number;\n private gl: WebGLRenderingContext;\n private drawProgram: WebGLProgram;\n private fullScreenProgram: WebGLProgram;\n private updateProgram: WebGLProgram;\n\n private rampColors: { [key: number]: string };\n\n private numParticles: number = 65536;\n private numParticlesSize: number;\n private particleStateResolution: number;\n\n private quadBuffer: WebGLBuffer | null;\n private particleIndexBuffer: WebGLBuffer | null;\n\n private framebuffer: WebGLFramebuffer | null;\n\n private colorRampTexture: WebGLTexture | null;\n private backgroundTexture: WebGLTexture | null;\n private screenTexture: WebGLTexture | null;\n private particleStateTexture0: WebGLTexture | null;\n private particleStateTexture1: WebGLTexture | null;\n private windTexture: WebGLTexture | null;\n\n private windData: IWindData;\n\n constructor(options: IWindProps) {\n this.gl = options.glContext;\n this.width = options.imageWidth;\n this.height = options.imageHeight;\n this.fadeOpacity = options.fadeOpacity;\n this.speedFactor = options.speedFactor;\n this.dropRate = options.dropRate;\n this.dropRateBump = options.dropRateBump;\n\n this.rampColors = options.rampColors;\n this.init();\n }\n\n public init() {\n const gl = this.gl;\n\n this.fadeOpacity = 0.996; // how fast the particle trails fade on each frame\n this.speedFactor = 0.25; // how fast the particles move\n this.dropRate = 0.003; // how often the particles move to a random place\n this.dropRateBump = 0.01; // drop rate increase relative to individual particle speed\n\n this.drawProgram = glUtils.createProgram(\n gl,\n drawVert,\n drawFrag,\n ) as WebGLProgram;\n this.fullScreenProgram = glUtils.createProgram(\n gl,\n fullScreenVert,\n fullScreenFrag,\n ) as WebGLProgram;\n this.updateProgram = glUtils.createProgram(\n gl,\n updateVert,\n updateFrag,\n ) as WebGLProgram;\n\n this.quadBuffer = glUtils.createBuffer(\n gl,\n new Float32Array([0, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1]),\n );\n\n this.framebuffer = gl.createFramebuffer();\n\n this.colorRampTexture = glUtils.createTexture(\n this.gl,\n this.gl.LINEAR,\n getColorRamp(this.rampColors),\n 16,\n 16,\n );\n\n const emptyPixels = new Uint8Array(this.width * this.height * 4);\n\n // screen textures to hold the drawn screen for the previous and the current frame\n\n this.backgroundTexture = glUtils.createTexture(\n gl,\n gl.NEAREST,\n emptyPixels,\n this.width,\n this.height,\n );\n this.screenTexture = glUtils.createTexture(\n gl,\n gl.NEAREST,\n emptyPixels,\n this.width,\n this.height,\n );\n\n // we create a square texture where each pixel will hold a particle position encoded as RGBA\n const particleRes = (this.particleStateResolution = Math.ceil(\n Math.sqrt(this.numParticles),\n ));\n // particleRes size\n this.numParticlesSize = particleRes * particleRes;\n\n const particleState = new Uint8Array(this.numParticlesSize * 4);\n for (let i = 0; i < particleState.length; i++) {\n particleState[i] = Math.floor(Math.random() * 256); // randomize the initial particle positions\n }\n // textures to hold the particle state for the current and the next frame\n this.particleStateTexture0 = glUtils.createTexture(\n gl,\n gl.NEAREST,\n particleState,\n particleRes,\n particleRes,\n );\n this.particleStateTexture1 = glUtils.createTexture(\n gl,\n gl.NEAREST,\n particleState,\n particleRes,\n particleRes,\n );\n\n const particleIndices = new Float32Array(this.numParticlesSize);\n for (let i$1 = 0; i$1 < this.numParticlesSize; i$1++) {\n particleIndices[i$1] = i$1;\n }\n this.particleIndexBuffer = glUtils.createBuffer(gl, particleIndices);\n }\n\n public setWind(windData: IWindData) {\n this.windData = windData;\n this.windTexture = glUtils.createDataTexture(\n this.gl,\n this.gl.LINEAR,\n windData.image,\n );\n }\n\n /**\n * 更新风场粒子数量\n * @param num\n */\n public updateParticelNum(num: number) {\n const gl = this.gl;\n if (num !== this.numParticles) {\n this.numParticles = num; // params number\n\n // we create a square texture where each pixel will hold a particle position encoded as RGBA\n const particleRes = (this.particleStateResolution = Math.ceil(\n Math.sqrt(this.numParticles),\n ));\n this.numParticlesSize = particleRes * particleRes;\n\n const particleState = new Uint8Array(this.numParticlesSize * 4);\n for (let i = 0; i < particleState.length; i++) {\n particleState[i] = Math.floor(Math.random() * 256); // randomize the initial particle positions\n }\n // textures to hold the particle state for the current and the next frame\n this.particleStateTexture0 = glUtils.createTexture(\n gl,\n gl.NEAREST,\n particleState,\n particleRes,\n particleRes,\n );\n this.particleStateTexture1 = glUtils.createTexture(\n gl,\n gl.NEAREST,\n particleState,\n particleRes,\n particleRes,\n );\n\n const particleIndices = new Float32Array(this.numParticlesSize);\n for (let i$1 = 0; i$1 < this.numParticlesSize; i$1++) {\n particleIndices[i$1] = i$1;\n }\n this.particleIndexBuffer = glUtils.createBuffer(gl, particleIndices);\n }\n }\n\n /**\n * 更新风场风向风速\n * @param uMin\n * @param uMax\n * @param vMin\n * @param vMax\n */\n public updateWindDir(uMin: number, uMax: number, vMin: number, vMax: number) {\n this.windData.uMin = uMin;\n this.windData.uMax = uMax;\n this.windData.vMin = vMin;\n this.windData.vMax = vMax;\n }\n\n /**\n * update rampColors\n * @param rampColors\n */\n public updateColorRampTexture(rampColors: { [key: number]: string }) {\n if (this.isColorChanged(rampColors)) {\n this.rampColors = rampColors;\n\n const gl = this.gl;\n gl.deleteTexture(this.colorRampTexture);\n this.colorRampTexture = glUtils.createTexture(\n gl,\n gl.LINEAR,\n getColorRamp(rampColors),\n 16,\n 16,\n );\n }\n }\n\n public isColorChanged(rampColors: { [key: number]: string }): boolean {\n const keys = Object.keys(rampColors);\n for (const item of keys) {\n const key = Number(item);\n // exist new key -> color need update\n if (!this.rampColors[key]) {\n return true;\n }\n // value changed -> color need update\n if (this.rampColors[key] && this.rampColors[key] !== rampColors[key]) {\n return true;\n }\n }\n return false;\n }\n\n public reSize(width: number, height: number) {\n if (width !== this.width || height !== this.height) {\n const gl = this.gl;\n gl.deleteTexture(this.backgroundTexture);\n gl.deleteTexture(this.screenTexture);\n\n this.width = width;\n this.height = height;\n const emptyPixels = new Uint8Array(width * height * 4);\n // screen textures to hold the drawn screen for the previous and the current frame\n this.backgroundTexture = glUtils.createTexture(\n gl,\n gl.NEAREST,\n emptyPixels,\n width,\n height,\n );\n this.screenTexture = glUtils.createTexture(\n gl,\n gl.NEAREST,\n emptyPixels,\n width,\n height,\n );\n }\n }\n public draw() {\n if (this.windData?.image) {\n const gl = this.gl;\n\n glUtils.bindTexture(gl, this.windTexture as WebGLTexture, 0);\n glUtils.bindTexture(gl, this.particleStateTexture0 as WebGLTexture, 1);\n\n this.drawScreen(); // draw Particles into framebuffer\n this.updateParticles();\n\n return { d: this.pixels, w: this.width, h: this.height };\n } else {\n return { d: new Uint8Array([0, 0, 0, 0]), w: 1, h: 1 };\n }\n }\n\n public drawScreen() {\n const gl = this.gl;\n\n // draw the screen into a temporary framebuffer to retain it as the background on the next frame\n bindFramebuffer(gl, this.framebuffer, this.screenTexture);\n\n gl.viewport(0, 0, this.width, this.height);\n\n gl.disable(gl.BLEND);\n this.drawFullTexture(this.backgroundTexture, this.fadeOpacity);\n this.drawParticles();\n\n this.pixels = new Uint8Array(4 * this.width * this.height);\n gl.readPixels(\n 0,\n 0,\n this.width,\n this.height,\n gl.RGBA,\n gl.UNSIGNED_BYTE,\n this.pixels,\n );\n\n bindFramebuffer(gl, null, null);\n gl.viewport(0, 0, this.gl.canvas.width, this.gl.canvas.height);\n\n // save the current screen as the background for the next frame\n const temp = this.backgroundTexture;\n this.backgroundTexture = this.screenTexture;\n this.screenTexture = temp;\n }\n\n public drawFullTexture(texture: any, opacity: number) {\n const gl = this.gl;\n const program = this.fullScreenProgram as any;\n gl.useProgram(program);\n\n // bindAttribute(gl, this.quadBuffer, program.a_pos, 2);\n\n gl.bindBuffer(gl.ARRAY_BUFFER, this.quadBuffer);\n gl.vertexAttribPointer(program.a_pos, 2, gl.FLOAT, false, 0, 0);\n gl.enableVertexAttribArray(program.a_pos);\n\n gl.bindBuffer(gl.ARRAY_BUFFER, null);\n\n glUtils.bindTexture(gl, texture, 2);\n gl.uniform1i(program.u_screen, 2);\n gl.uniform1f(program.u_opacity, opacity);\n\n gl.drawArrays(gl.TRIANGLES, 0, 6);\n // gl.drawArrays(gl.POINTS, 0, 6);\n }\n\n public drawParticles() {\n const gl = this.gl;\n const program = this.drawProgram as any;\n gl.useProgram(program);\n\n bindAttribute(gl, this.particleIndexBuffer, program.a_index, 1);\n glUtils.bindTexture(gl, this.colorRampTexture as WebGLTexture, 2);\n\n gl.uniform1i(program.u_wind, 0);\n gl.uniform1i(program.u_particles, 1);\n gl.uniform1i(program.u_color_ramp, 2);\n\n gl.uniform1f(program.u_particles_res, this.particleStateResolution);\n gl.uniform2f(program.u_wind_min, this.windData.uMin, this.windData.vMin);\n gl.uniform2f(program.u_wind_max, this.windData.uMax, this.windData.vMax);\n\n gl.drawArrays(gl.POINTS, 0, this.numParticlesSize);\n }\n\n public updateParticles() {\n const gl = this.gl;\n bindFramebuffer(gl, this.framebuffer, this.particleStateTexture1);\n gl.viewport(\n 0,\n 0,\n this.particleStateResolution,\n this.particleStateResolution,\n );\n\n const program = this.updateProgram as any;\n gl.useProgram(program);\n\n bindAttribute(gl, this.quadBuffer, program.a_pos, 2);\n\n gl.uniform1i(program.u_wind, 0);\n gl.uniform1i(program.u_particles, 1);\n\n gl.uniform1f(program.u_rand_seed, Math.random());\n gl.uniform2f(\n program.u_wind_res,\n this.windData.image.width * 2,\n this.windData.image.height * 2,\n );\n gl.uniform2f(program.u_wind_min, this.windData.uMin, this.windData.vMin);\n gl.uniform2f(program.u_wind_max, this.windData.uMax, this.windData.vMax);\n gl.uniform1f(program.u_speed_factor, this.speedFactor);\n gl.uniform1f(program.u_drop_rate, this.dropRate);\n gl.uniform1f(program.u_drop_rate_bump, this.dropRateBump);\n\n gl.drawArrays(gl.TRIANGLES, 0, 6);\n\n // swap the particle state textures so the new one becomes the current one\n const temp = this.particleStateTexture0;\n this.particleStateTexture0 = this.particleStateTexture1;\n this.particleStateTexture1 = temp;\n\n bindFramebuffer(gl, null, null);\n\n // gl.viewport(0, 0, this.gl.canvas.width, this.gl.canvas.height);\n }\n\n public destroy() {\n // private drawProgram: WebGLProgram;\n // private fullScreenProgram: WebGLProgram;\n // private updateProgram: WebGLProgram;\n\n // private quadBuffer: WebGLBuffer | null;\n // private particleIndexBuffer: WebGLBuffer | null;\n\n // private framebuffer: WebGLFramebuffer | null;\n\n // private colorRampTexture: WebGLTexture | null;\n // private backgroundTexture: WebGLTexture | null;\n // private screenTexture: WebGLTexture | null;\n // private particleStateTexture0: WebGLTexture | null;\n // private particleStateTexture1: WebGLTexture | null;\n // private windTexture: WebGLTexture | null;\n\n this.gl.deleteBuffer(this.quadBuffer);\n this.gl.deleteBuffer(this.particleIndexBuffer);\n\n this.gl.deleteFramebuffer(this.framebuffer);\n\n // @ts-ignore\n this.gl.deleteShader(this.drawProgram.vertexShader);\n // @ts-ignore\n this.gl.deleteShader(this.drawProgram.fragmentShader);\n this.gl.deleteProgram(this.drawProgram);\n\n // @ts-ignore\n this.gl.deleteShader(this.fullScreenProgram.vertexShader);\n // @ts-ignore\n this.gl.deleteShader(this.fullScreenProgram.fragmentShader);\n this.gl.deleteProgram(this.fullScreenProgram);\n\n // @ts-ignore\n this.gl.deleteShader(this.updateProgram.vertexShader);\n // @ts-ignore\n this.gl.deleteShader(this.updateProgram.fragmentShader);\n this.gl.deleteProgram(this.updateProgram);\n\n this.gl.deleteTexture(this.colorRampTexture);\n this.gl.deleteTexture(this.backgroundTexture);\n this.gl.deleteTexture(this.screenTexture);\n this.gl.deleteTexture(this.particleStateTexture0);\n this.gl.deleteTexture(this.particleStateTexture1);\n this.gl.deleteTexture(this.windTexture);\n }\n}\n"],"file":"windRender.js"}
@@ -354,7 +354,9 @@ var BaseLayer = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
354
354
  }, {
355
355
  key: "createModelData",
356
356
  value: function createModelData(data, option) {
357
- if (this.layerModel.createModelData) {
357
+ var _this$layerModel;
358
+
359
+ if ((_this$layerModel = this.layerModel) !== null && _this$layerModel !== void 0 && _this$layerModel.createModelData) {
358
360
  return this.layerModel.createModelData(option);
359
361
  }
360
362
 
@@ -906,7 +908,7 @@ var BaseLayer = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
906
908
  }, {
907
909
  key: "destroy",
908
910
  value: function destroy() {
909
- var _this$layerModel;
911
+ var _this$layerModel2;
910
912
 
911
913
  var refresh = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
912
914
 
@@ -927,7 +929,7 @@ var BaseLayer = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
927
929
  this.multiPassRenderer.destroy();
928
930
  this.styleAttributeService.clearAllAttributes();
929
931
  this.hooks.afterDestroy.call();
930
- (_this$layerModel = this.layerModel) === null || _this$layerModel === void 0 ? void 0 : _this$layerModel.clearModels();
932
+ (_this$layerModel2 = this.layerModel) === null || _this$layerModel2 === void 0 ? void 0 : _this$layerModel2.clearModels();
931
933
  this.models = [];
932
934
  this.layerService.cleanRemove(this, refresh);
933
935
  this.emit('remove', {
@@ -949,12 +951,12 @@ var BaseLayer = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
949
951
  }, {
950
952
  key: "clearModels",
951
953
  value: function clearModels() {
952
- var _this$layerModel2;
954
+ var _this$layerModel3;
953
955
 
954
956
  this.models.forEach(function (model) {
955
957
  return model.destroy();
956
958
  });
957
- (_this$layerModel2 = this.layerModel) === null || _this$layerModel2 === void 0 ? void 0 : _this$layerModel2.clearModels();
959
+ (_this$layerModel3 = this.layerModel) === null || _this$layerModel3 === void 0 ? void 0 : _this$layerModel3.clearModels();
958
960
  this.models = [];
959
961
  }
960
962
  }, {
@@ -1226,6 +1228,8 @@ var BaseLayer = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
1226
1228
  var _this10 = this;
1227
1229
 
1228
1230
  if (this.getEncodedData() && this.getEncodedData().length > 0) {
1231
+ var _this$layerModel4;
1232
+
1229
1233
  if (this.layerModelNeedUpdate && this.layerModel) {
1230
1234
  this.layerModel.buildModels(function (models) {
1231
1235
  _this10.models = models;
@@ -1236,7 +1240,7 @@ var BaseLayer = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
1236
1240
  });
1237
1241
  }
1238
1242
 
1239
- if (this.layerModel.renderUpdate) {
1243
+ if (this !== null && this !== void 0 && (_this$layerModel4 = this.layerModel) !== null && _this$layerModel4 !== void 0 && _this$layerModel4.renderUpdate) {
1240
1244
  this.layerModel.renderUpdate();
1241
1245
  }
1242
1246
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/core/BaseLayer.ts"],"names":["layerIdCounter","BaseLayer","TYPES","IGlobalConfigService","config","dataSourceNeedUpdate","dataMappingNeedUpdate","filterNeedUpdate","featureScaleNeedUpdate","StyleAttrNeedUpdate","init","SyncBailHook","afterInit","beforeRender","beforeRenderData","SyncWaterfallHook","afterRender","SyncHook","beforePickingEncode","afterPickingEncode","beforeHighlight","afterHighlight","beforeSelect","afterSelect","beforeDestroy","afterDestroy","enable","dataState","layerConfig","getLayerConfig","autoFit","fitBounds","fitBoundsOptions","reRender","name","id","zIndex","rawConfig","maskLayer","masks","push","layerIndex","indexOf","splice","destroy","styleAttributeService","getLayerStyleAttribute","configService","configToUpdate","Object","keys","map","key","inited","needUpdateConfig","sceneId","container","get","SceneID","setLayerConfig","sceneContainer","color","bottomColor","plugin","plugins","layerType","iconService","IIconService","fontService","IFontService","rendererService","IRendererService","layerService","ILayerService","interactionService","IInteractionService","pickingService","IPickingService","mapService","IMapService","enableMultiPassRenderer","passes","length","on","renderLayers","cameraService","ICameraService","coordinateService","ICoordinateSystemService","shaderModuleService","IShaderModuleService","postProcessingPassFactory","IFactoryPostProcessingPass","normalPassFactory","IFactoryNormalPass","IStyleAttributeService","multiPassRenderer","IMultiPassRenderer","setLayer","pendingStyleAttributes","forEach","attributeName","attributeField","attributeValues","updateOptions","updateStyleAttribute","scale","field","splitValuesAndCallbackInAttribute","getAll","ILayerPlugin","apply","hooks","call","emit","target","type","data","attributes","elements","models","m","updateAttributesAndElements","console","warn","option","layerModel","createModelData","calEncodeData","calculateEncodeData","triangulation","createAttributesAndIndices","undefined","updateLayerConfig","getDefaultConfig","animateOption","startAnimate","aniamateStatus","values","lastShape","currentShape","shapeOption","tileLayer","options","rawAnimate","setSource","sourceOption","clusterZoom","layerSource","setData","currentSource","getSource","source","Source","sourceEvent","lastConfig","rest","pass","postProcessingPass","getPostProcessor","getPostProcessingPassByName","styleNeedUpdate","mask","clearModels","buildModels","cfg","scaleOptions","rendering","render","getEncodedData","renderModels","getRenderFlag","activeOption","enableHighlight","highlightColor","mix","activeMix","x","y","pick","pickedFeatureID","then","setTimeout","enableSelect","selectColor","selectMix","blend","layerModelNeedUpdate","visible","clearCanvas","index","updateLayerRenderList","currentPickId","selectedFeatureID","zoom","getZoom","minZoom","Infinity","maxZoom","enableMultiPass","currentPasses","setRenderFlag","getViewportSize","width","height","resize","extent","isValid","some","v","Math","abs","refresh","isDestroied","layerChildren","child","off","clearAllAttributes","cleanRemove","removeAllListeners","model","getLayerStyleAttributes","filter","attribute","needRescale","needRemapping","needRegenerateVertices","cluster","updateClusterData","encodedData","getLayerAttributeScale","invertExtent","items","range","item","value","ticks","domain","triggerHover","box","cb","boxPickLayer","moduleName","vertexShader","fragmentShader","segmentNumber","workerEnabled","workerOptions","registerModule","vs","fs","getModule","uniforms","createModel","Promise","resolve","reject","modelType","WorkerSourceMap","createAttributesAndIndicesAscy","BlendTypes","BlendType","normal","catch","err","createAttributes","clock","getDelta","animateStartTime","getElapsedTime","stopAnimate","isPick","eventNames","isVisible","Error","isPicking","renderUpdate","draw","getUninforms","getShaderPickStat","time","valuesOrCallback","defaultValues","callback","EventEmitter"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA;;AACA;;AAiDA;;AACA;;AACA;;AAGA;;AACA;;AACA;;AACA;;AAIA;;;;;;;;;;;;;;;;;;;;;AAIA,IAAIA,cAAc,GAAG,CAArB;IAEqBC,S,WA0ElB,wBAAWC,cAAMC,oBAAjB,C;;;;;AA2ED,uBAAyE;AAAA;;AAAA,QAA7DC,MAA6D,uEAAJ,EAAI;AAAA;AACvE;AADuE,+FAlJlDJ,cAAc,EAkJoC;AAAA,iGAjJhDA,cAiJgD;AAAA;AAAA,0FA/I/C,IA+I+C;AAAA,yFA9IjD,CA8IiD;AAAA;AAAA;AAAA,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BADF,EAEEC,aAFF,EAGE;AACA,aAAO;AACLhJ,QAAAA,MAAM,EAAE,0BAAW+I,gBAAX,IACJrJ,SADI,GAEJqJ,gBAAgB,IAAIC,aAHnB;AAILC,QAAAA,QAAQ,EAAE,0BAAWF,gBAAX,IAA+BA,gBAA/B,GAAkDrJ;AAJvD,OAAP;AAMD;;;EA1yCOwJ,0B","sourcesContent":["// @ts-ignore\nimport { SyncBailHook, SyncHook, SyncWaterfallHook } from '@antv/async-hook';\nimport {\n BlendType,\n gl,\n IActiveOption,\n IAnimateOption,\n IAttrubuteAndElements,\n ICameraService,\n ICoordinateSystemService,\n IDataState,\n IEncodeFeature,\n IFontService,\n IGlobalConfigService,\n IIconService,\n IInteractionService,\n ILayer,\n ILayerConfig,\n ILayerModel,\n ILayerModelInitializationOptions,\n ILayerPlugin,\n ILayerService,\n ILegendClassificaItem,\n ILegendSegmentItem,\n IMapService,\n IModel,\n IModelInitializationOptions,\n IMultiPassRenderer,\n IPass,\n IPickingService,\n IPostProcessingPass,\n IRendererService,\n IScale,\n IScaleOptions,\n IShaderModuleService,\n ISource,\n ISourceCFG,\n IStyleAttributeInitializationOptions,\n IStyleAttributeService,\n IStyleAttributeUpdateOptions,\n LayerEventType,\n lazyInject,\n LegendItems,\n ScaleAttributeType,\n ScaleTypeName,\n ScaleTypes,\n StyleAttributeField,\n StyleAttributeOption,\n Triangulation,\n TYPES,\n} from '@antv/l7-core';\nimport Source from '@antv/l7-source';\nimport { encodePickingColor, WorkerSourceMap } from '@antv/l7-utils';\nimport { EventEmitter } from 'eventemitter3';\nimport { Container } from 'inversify';\nimport { isFunction, isObject, isUndefined } from 'lodash';\nimport { BlendTypes } from '../utils/blend';\nimport { handleStyleDataMapping } from '../utils/dataMappingStyle';\nimport { calculateData } from '../utils/layerData';\nimport {\n createMultiPassRenderer,\n normalizePasses,\n} from '../utils/multiPassRender';\nimport { updateShape } from '../utils/updateShape';\n/**\n * 分配 layer id\n */\nlet layerIdCounter = 0;\n\nexport default class BaseLayer<ChildLayerStyleOptions = {}>\n extends EventEmitter<LayerEventType>\n implements ILayer {\n public id: string = `${layerIdCounter++}`;\n public name: string = `${layerIdCounter}`;\n public type: string;\n public visible: boolean = true;\n public zIndex: number = 0;\n public minZoom: number;\n public maxZoom: number;\n public inited: boolean = false;\n public layerModelNeedUpdate: boolean = false;\n public pickedFeatureID: number | null = null;\n public selectedFeatureID: number | null = null;\n public styleNeedUpdate: boolean = false;\n public rendering: boolean;\n public clusterZoom: number = 0; // 聚合等级标记\n public layerType?: string | undefined;\n public triangulation?: Triangulation | undefined;\n\n public dataState: IDataState = {\n dataSourceNeedUpdate: false,\n dataMappingNeedUpdate: false,\n filterNeedUpdate: false,\n featureScaleNeedUpdate: false,\n StyleAttrNeedUpdate: false,\n };\n // 生命周期钩子\n public hooks = {\n init: new SyncBailHook(),\n afterInit: new SyncBailHook(),\n beforeRender: new SyncBailHook(),\n beforeRenderData: new SyncWaterfallHook(),\n afterRender: new SyncHook(),\n beforePickingEncode: new SyncHook(),\n afterPickingEncode: new SyncHook(),\n beforeHighlight: new SyncHook(['pickedColor']),\n afterHighlight: new SyncHook(),\n beforeSelect: new SyncHook(['pickedColor']),\n afterSelect: new SyncHook(),\n beforeDestroy: new SyncHook(),\n afterDestroy: new SyncHook(),\n };\n\n // 待渲染 model 列表\n public models: IModel[] = [];\n\n // 每个 Layer 都有一个\n public multiPassRenderer: IMultiPassRenderer;\n\n // 注入插件集\n public plugins: ILayerPlugin[];\n\n public sourceOption: {\n data: any;\n options?: ISourceCFG;\n };\n\n public layerModel: ILayerModel;\n\n public shapeOption: {\n field: any;\n values: any;\n };\n\n // TODO: 记录 sceneContainer 供创建子图层的时候使用 如 imageTileLayer\n public sceneContainer: Container | undefined;\n public tileLayer: any | undefined;\n // TODO: 用于保存子图层对象\n public layerChildren: ILayer[] = [];\n public masks: ILayer[] = [];\n // Tip: 用于标识矢量图层\n public isVector: boolean = false;\n\n @lazyInject(TYPES.IGlobalConfigService)\n protected readonly configService: IGlobalConfigService;\n\n // @lazyInject(TYPES.IShaderModuleService)\n // protected readonly shaderModuleService: IShaderModuleService;\n\n protected shaderModuleService: IShaderModuleService;\n protected cameraService: ICameraService;\n\n protected coordinateService: ICoordinateSystemService;\n\n protected iconService: IIconService;\n\n protected fontService: IFontService;\n\n protected pickingService: IPickingService;\n\n protected rendererService: IRendererService;\n\n protected layerService: ILayerService;\n\n protected interactionService: IInteractionService;\n\n protected mapService: IMapService;\n\n protected styleAttributeService: IStyleAttributeService;\n\n protected layerSource: Source;\n\n protected postProcessingPassFactory: (\n name: string,\n ) => IPostProcessingPass<unknown>;\n protected normalPassFactory: (name: string) => IPass<unknown>;\n\n protected animateOptions: IAnimateOption = { enable: false };\n\n /**\n * 图层容器\n */\n private container: Container;\n\n private encodedData: IEncodeFeature[];\n\n private configSchema: object;\n\n private currentPickId: number | null = null;\n\n private rawConfig: Partial<ILayerConfig & ChildLayerStyleOptions>;\n\n private needUpdateConfig: Partial<ILayerConfig & ChildLayerStyleOptions>;\n\n /**\n * 待更新样式属性,在初始化阶段完成注册\n */\n private pendingStyleAttributes: Array<{\n attributeName: string;\n attributeField: StyleAttributeField;\n attributeValues?: StyleAttributeOption;\n defaultName?: string;\n updateOptions?: Partial<IStyleAttributeUpdateOptions>;\n }> = [];\n\n private scaleOptions: IScaleOptions = {};\n\n private animateStartTime: number;\n\n private aniamateStatus: boolean = false;\n\n // TODO: layer 保底颜色\n private bottomColor = 'rgba(0, 0, 0, 0)';\n\n private isDestroied: boolean = false;\n\n // private pickingPassRender: IPass<'pixelPicking'>;\n\n constructor(config: Partial<ILayerConfig & ChildLayerStyleOptions> = {}) {\n super();\n this.name = config.name || this.id;\n this.zIndex = config.zIndex || 0;\n this.rawConfig = config;\n }\n\n public addMaskLayer(maskLayer: ILayer) {\n this.masks.push(maskLayer);\n }\n\n public removeMaskLayer(maskLayer: ILayer) {\n const layerIndex = this.masks.indexOf(maskLayer);\n if (layerIndex > -1) {\n this.masks.splice(layerIndex, 1);\n }\n maskLayer.destroy();\n }\n\n public getAttribute(name: string) {\n return this.styleAttributeService.getLayerStyleAttribute(name);\n }\n\n public getLayerConfig() {\n return this.configService.getLayerConfig<ChildLayerStyleOptions>(this.id);\n }\n\n public updateLayerConfig(\n configToUpdate: Partial<ILayerConfig | ChildLayerStyleOptions>,\n ) {\n // 同步 rawConfig\n Object.keys(configToUpdate).map((key) => {\n if (key in this.rawConfig) {\n // @ts-ignore\n this.rawConfig[key] = configToUpdate[key];\n }\n });\n if (!this.inited) {\n this.needUpdateConfig = {\n ...this.needUpdateConfig,\n ...configToUpdate,\n };\n } else {\n const sceneId = this.container.get<string>(TYPES.SceneID);\n\n // @ts-ignore\n handleStyleDataMapping(configToUpdate, this); // 处理 style 中进行数据映射的属性字段\n\n this.configService.setLayerConfig(sceneId, this.id, {\n ...this.configService.getLayerConfig(this.id),\n ...this.needUpdateConfig,\n ...configToUpdate,\n });\n this.needUpdateConfig = {};\n }\n }\n\n /**\n * 注入图层容器,父容器为场景容器\n * RootContainer 1\n * -> SceneContainer 1.*\n * -> LayerContainer 1.*\n */\n public setContainer(container: Container, sceneContainer: Container) {\n this.container = container;\n this.sceneContainer = sceneContainer;\n }\n\n public getContainer() {\n return this.container;\n }\n\n public setBottomColor(color: string) {\n this.bottomColor = color;\n }\n\n public getBottomColor() {\n return this.bottomColor;\n }\n\n public addPlugin(plugin: ILayerPlugin): ILayer {\n // TODO: 控制插件注册顺序\n // @example:\n // pointLayer.addPlugin(new MyCustomPlugin(), {\n // before: 'L7BuiltinPlugin'\n // });\n this.plugins.push(plugin);\n return this;\n }\n\n public init() {\n // 设置配置项\n const sceneId = this.container.get<string>(TYPES.SceneID);\n // 初始化图层配置项\n // const { enableMultiPassRenderer = false } = this.rawConfig;\n // this.configService.setLayerConfig(sceneId, this.id, {\n // enableMultiPassRenderer,\n // });\n this.configService.setLayerConfig(sceneId, this.id, this.rawConfig);\n this.layerType = this.rawConfig.layerType;\n\n // 全局容器服务\n\n // 场景容器服务\n this.iconService = this.container.get<IIconService>(TYPES.IIconService);\n this.fontService = this.container.get<IFontService>(TYPES.IFontService);\n\n this.rendererService = this.container.get<IRendererService>(\n TYPES.IRendererService,\n );\n this.layerService = this.container.get<ILayerService>(TYPES.ILayerService);\n this.interactionService = this.container.get<IInteractionService>(\n TYPES.IInteractionService,\n );\n\n this.pickingService = this.container.get<IPickingService>(\n TYPES.IPickingService,\n );\n this.mapService = this.container.get<IMapService>(TYPES.IMapService);\n const { enableMultiPassRenderer, passes } = this.getLayerConfig();\n if (enableMultiPassRenderer && passes?.length && passes.length > 0) {\n // Tip: 兼容 multiPassRender 在 amap1 时存在的图层不同步问题 zoom\n this.mapService.on('mapAfterFrameChange', () => {\n this.renderLayers();\n });\n }\n\n this.cameraService = this.container.get<ICameraService>(\n TYPES.ICameraService,\n );\n this.coordinateService = this.container.get<ICoordinateSystemService>(\n TYPES.ICoordinateSystemService,\n );\n this.shaderModuleService = this.container.get<IShaderModuleService>(\n TYPES.IShaderModuleService,\n );\n this.postProcessingPassFactory = this.container.get(\n TYPES.IFactoryPostProcessingPass,\n );\n this.normalPassFactory = this.container.get(TYPES.IFactoryNormalPass);\n\n // 图层容器服务\n this.styleAttributeService = this.container.get<IStyleAttributeService>(\n TYPES.IStyleAttributeService,\n );\n this.multiPassRenderer = this.container.get<IMultiPassRenderer>(\n TYPES.IMultiPassRenderer,\n );\n this.multiPassRenderer.setLayer(this);\n\n // 完成样式服务注册完成前添加的属性\n this.pendingStyleAttributes.forEach(\n ({ attributeName, attributeField, attributeValues, updateOptions }) => {\n this.styleAttributeService.updateStyleAttribute(\n attributeName,\n {\n // @ts-ignore\n scale: {\n field: attributeField,\n ...this.splitValuesAndCallbackInAttribute(\n // @ts-ignore\n attributeValues,\n // @ts-ignore\n this.getLayerConfig()[attributeName],\n ),\n },\n },\n // @ts-ignore\n updateOptions,\n );\n },\n );\n this.pendingStyleAttributes = [];\n\n // 获取插件集\n this.plugins = this.container.getAll<ILayerPlugin>(TYPES.ILayerPlugin);\n // 完成插件注册,传入场景和图层容器内的服务\n for (const plugin of this.plugins) {\n plugin.apply(this, {\n rendererService: this.rendererService,\n mapService: this.mapService,\n styleAttributeService: this.styleAttributeService,\n normalPassFactory: this.normalPassFactory,\n postProcessingPassFactory: this.postProcessingPassFactory,\n });\n }\n\n // 触发 init 生命周期插件\n this.hooks.init.call();\n // this.pickingPassRender = this.normalPassFactory('pixelPicking');\n // this.pickingPassRender.init(this);\n this.hooks.afterInit.call();\n // 触发初始化完成事件;\n this.emit('inited', {\n target: this,\n type: 'inited',\n });\n this.emit('add', {\n target: this,\n type: 'add',\n });\n\n return this;\n }\n\n public updateModelData(data: IAttrubuteAndElements) {\n if (data.attributes && data.elements) {\n this.models.map((m) => {\n m.updateAttributesAndElements(data.attributes, data.elements);\n });\n } else {\n console.warn('data error');\n }\n }\n\n public createModelData(data: any, option?: ISourceCFG) {\n if (this.layerModel.createModelData) {\n // 在某些特殊图层中单独构建 attribute & elements\n return this.layerModel.createModelData(option);\n }\n const calEncodeData = this.calculateEncodeData(data, option);\n const triangulation = this.triangulation;\n\n if (calEncodeData && triangulation) {\n return this.styleAttributeService.createAttributesAndIndices(\n calEncodeData,\n triangulation,\n );\n } else {\n return {\n attributes: undefined,\n elements: undefined,\n };\n }\n }\n\n public calculateEncodeData(data: any, option?: ISourceCFG) {\n if (this.inited) {\n return calculateData(\n this,\n this.fontService,\n this.mapService,\n this.styleAttributeService,\n data,\n option,\n );\n } else {\n console.warn('layer not inited!');\n return null;\n }\n }\n /**\n * Model初始化前需要更新Model样式\n */\n public prepareBuildModel() {\n this.inited = true;\n this.updateLayerConfig({\n ...(this.getDefaultConfig() as object),\n ...this.rawConfig,\n });\n\n // 启动动画\n const { animateOption } = this.getLayerConfig();\n if (animateOption?.enable) {\n this.layerService.startAnimate();\n this.aniamateStatus = true;\n }\n }\n public color(\n field: StyleAttributeField,\n values?: StyleAttributeOption,\n updateOptions?: Partial<IStyleAttributeUpdateOptions>,\n ) {\n // 设置 color、size、shape、style 时由于场景服务尚未完成(并没有调用 scene.addLayer),因此暂时加入待更新属性列表\n this.updateStyleAttribute('color', field, values, updateOptions);\n\n // this.pendingStyleAttributes.push({\n // attributeName: 'color',\n // attributeField: field,\n // attributeValues: values,\n // defaultName: 'colors',\n // updateOptions,\n // });\n return this;\n }\n\n // 为对应的图层传入纹理的编号名称(point/image 在 shape 方法中传入纹理名称的方法并不通用)\n public texture(\n field: StyleAttributeField,\n values?: StyleAttributeOption,\n updateOptions?: Partial<IStyleAttributeUpdateOptions>,\n ) {\n this.updateStyleAttribute('texture', field, values, updateOptions);\n return this;\n }\n\n public rotate(\n field: StyleAttributeField,\n values?: StyleAttributeOption,\n updateOptions?: Partial<IStyleAttributeUpdateOptions>,\n ) {\n this.updateStyleAttribute('rotate', field, values, updateOptions);\n return this;\n }\n public size(\n field: StyleAttributeField,\n values?: StyleAttributeOption,\n updateOptions?: Partial<IStyleAttributeUpdateOptions>,\n ) {\n this.updateStyleAttribute('size', field, values, updateOptions);\n return this;\n }\n // 对mapping后的数据过滤,scale保持不变\n public filter(\n field: StyleAttributeField,\n values?: StyleAttributeOption,\n updateOptions?: Partial<IStyleAttributeUpdateOptions>,\n ) {\n this.updateStyleAttribute('filter', field, values, updateOptions);\n return this;\n }\n\n public shape(\n field: StyleAttributeField,\n values?: StyleAttributeOption,\n updateOptions?: Partial<IStyleAttributeUpdateOptions>,\n ) {\n const lastShape = this.styleAttributeService?.getLayerStyleAttribute(\n 'shape',\n )?.scale?.field;\n const currentShape = field;\n this.shapeOption = {\n field,\n values,\n };\n this.updateStyleAttribute('shape', field, values, updateOptions);\n // TODO: 根据 shape 判断是否需要更新 model\n if (!this.tileLayer) {\n updateShape(this, lastShape, currentShape);\n }\n return this;\n }\n public label(\n field: StyleAttributeField,\n values?: StyleAttributeOption,\n updateOptions?: Partial<IStyleAttributeUpdateOptions>,\n ) {\n this.pendingStyleAttributes.push({\n attributeName: 'label',\n attributeField: field,\n attributeValues: values,\n updateOptions,\n });\n return this;\n }\n public animate(options: IAnimateOption | boolean) {\n let rawAnimate: Partial<IAnimateOption> = {};\n if (isObject(options)) {\n rawAnimate.enable = true;\n rawAnimate = {\n ...rawAnimate,\n ...options,\n };\n } else {\n rawAnimate.enable = options;\n }\n this.updateLayerConfig({\n animateOption: rawAnimate,\n });\n // this.animateOptions = options;\n return this;\n }\n\n public source(data: any, options?: ISourceCFG): ILayer {\n if (data?.data) {\n // 判断是否为source\n this.setSource(data);\n return this;\n }\n this.sourceOption = {\n data,\n options,\n };\n this.clusterZoom = 0;\n return this;\n }\n\n public setData(data: any, options?: ISourceCFG) {\n if (this.inited) {\n this.layerSource.setData(data, options);\n } else {\n this.on('inited', () => {\n const currentSource = this.getSource();\n if (!currentSource) {\n // 执行 setData 的时候 source 还不存在(还未执行 addLayer)\n this.source(new Source(data, options));\n this.sourceEvent();\n } else {\n this.layerSource.setData(data, options);\n }\n // this.layerSource.setData(data, options);\n });\n }\n\n return this;\n }\n public style(\n options: Partial<ChildLayerStyleOptions> & Partial<ILayerConfig>,\n ): ILayer {\n const lastConfig = this.getLayerConfig();\n const { passes, ...rest } = options;\n\n // passes 特殊处理\n if (passes) {\n normalizePasses(passes).forEach(\n (pass: [string, { [key: string]: unknown }]) => {\n const postProcessingPass = this.multiPassRenderer\n .getPostProcessor()\n .getPostProcessingPassByName(pass[0]);\n if (postProcessingPass) {\n postProcessingPass.updateOptions(pass[1]);\n }\n },\n );\n }\n\n this.rawConfig = {\n ...this.rawConfig,\n ...rest,\n };\n if (this.container) {\n this.updateLayerConfig(this.rawConfig);\n this.styleNeedUpdate = true;\n }\n\n // @ts-ignore\n if (lastConfig && lastConfig.mask === true && options.mask === false) {\n this.clearModels();\n this.layerModel.buildModels((models) => {\n this.models = models;\n });\n }\n return this;\n }\n public scale(field: string | number | IScaleOptions, cfg?: IScale) {\n if (isObject(field)) {\n this.scaleOptions = {\n ...this.scaleOptions,\n ...field,\n };\n } else {\n this.scaleOptions[field] = cfg;\n }\n return this;\n }\n\n /**\n * 渲染所有的图层\n */\n public renderLayers(): void {\n this.rendering = true;\n\n this.layerService.renderLayers();\n\n this.rendering = false;\n }\n\n public render(): ILayer {\n if (this.tileLayer !== undefined) {\n // 瓦片图层执行单独的 render 渲染队列\n this.tileLayer.render();\n return this;\n }\n // TODO: this.getEncodedData().length !== 0 这个判断是为了解决在 2.5.x 引入数据纹理后产生的 空数据渲染导致 texture 超出上限问题\n if (this.getEncodedData() && this.getEncodedData().length !== 0) {\n this.renderModels();\n }\n return this;\n }\n\n /**\n * renderMultiPass 专门用于渲染支持 multipass 的 layer\n */\n public async renderMultiPass() {\n if (this.getEncodedData() && this.getEncodedData().length !== 0) {\n if (this.multiPassRenderer && this.multiPassRenderer.getRenderFlag()) {\n // multi render 开始执行 multiPassRender 的渲染流程\n await this.multiPassRenderer.render();\n } else if (this.multiPassRenderer) {\n // renderPass 触发的渲染\n this.renderModels();\n } else {\n this.renderModels();\n }\n }\n }\n\n public active(options: IActiveOption | boolean) {\n const activeOption: Partial<ILayerConfig> = {};\n activeOption.enableHighlight = isObject(options) ? true : options;\n if (isObject(options)) {\n activeOption.enableHighlight = true;\n if (options.color) {\n activeOption.highlightColor = options.color;\n }\n if (options.mix) {\n activeOption.activeMix = options.mix;\n }\n } else {\n activeOption.enableHighlight = !!options;\n }\n this.updateLayerConfig(activeOption);\n return this;\n }\n public setActive(\n id: number | { x: number; y: number },\n options?: IActiveOption,\n ): void {\n if (isObject(id)) {\n const { x = 0, y = 0 } = id;\n this.updateLayerConfig({\n highlightColor: isObject(options)\n ? options.color\n : this.getLayerConfig().highlightColor,\n activeMix: isObject(options)\n ? options.mix\n : this.getLayerConfig().activeMix,\n });\n this.pick({ x, y });\n } else {\n this.updateLayerConfig({\n pickedFeatureID: id,\n highlightColor: isObject(options)\n ? options.color\n : this.getLayerConfig().highlightColor,\n activeMix: isObject(options)\n ? options.mix\n : this.getLayerConfig().activeMix,\n });\n this.hooks.beforeSelect\n .call(encodePickingColor(id as number) as number[])\n // @ts-ignore\n .then(() => {\n setTimeout(() => {\n this.reRender();\n }, 1);\n });\n }\n }\n\n public select(option: IActiveOption | boolean): ILayer {\n const activeOption: Partial<ILayerConfig> = {};\n activeOption.enableSelect = isObject(option) ? true : option;\n if (isObject(option)) {\n activeOption.enableSelect = true;\n if (option.color) {\n activeOption.selectColor = option.color;\n }\n if (option.mix) {\n activeOption.selectMix = option.mix;\n }\n } else {\n activeOption.enableSelect = !!option;\n }\n this.updateLayerConfig(activeOption);\n return this;\n }\n\n public setSelect(\n id: number | { x: number; y: number },\n options?: IActiveOption,\n ): void {\n if (isObject(id)) {\n const { x = 0, y = 0 } = id;\n this.updateLayerConfig({\n selectColor: isObject(options)\n ? options.color\n : this.getLayerConfig().selectColor,\n selectMix: isObject(options)\n ? options.mix\n : this.getLayerConfig().selectMix,\n });\n this.pick({ x, y });\n } else {\n this.updateLayerConfig({\n pickedFeatureID: id,\n selectColor: isObject(options)\n ? options.color\n : this.getLayerConfig().selectColor,\n selectMix: isObject(options)\n ? options.mix\n : this.getLayerConfig().selectMix,\n });\n this.hooks.beforeSelect\n .call(encodePickingColor(id as number) as number[])\n // @ts-ignore\n .then(() => {\n setTimeout(() => {\n this.reRender();\n }, 1);\n });\n }\n }\n public setBlend(type: keyof typeof BlendType): ILayer {\n this.updateLayerConfig({\n blend: type,\n });\n this.layerModelNeedUpdate = true;\n this.reRender();\n return this;\n }\n public show(): ILayer {\n this.updateLayerConfig({\n visible: true,\n });\n this.reRender();\n return this;\n }\n\n public hide(): ILayer {\n if (this.type === 'CanvasLayer' && this.layerModel.clearCanvas) {\n // 对 canvasLayer 的 hide 操作做特殊处理\n this.layerModel.clearCanvas();\n }\n this.updateLayerConfig({\n visible: false,\n });\n this.reRender();\n return this;\n }\n public setIndex(index: number): ILayer {\n this.zIndex = index;\n this.layerService.updateLayerRenderList();\n this.layerService.renderLayers();\n return this;\n }\n\n public setCurrentPickId(id: number) {\n this.currentPickId = id;\n }\n\n public getCurrentPickId(): number | null {\n return this.currentPickId;\n }\n\n public setCurrentSelectedId(id: number) {\n this.selectedFeatureID = id;\n }\n\n public getCurrentSelectedId(): number | null {\n return this.selectedFeatureID;\n }\n public isVisible(): boolean {\n const zoom = this.mapService.getZoom();\n const {\n visible,\n minZoom = -Infinity,\n maxZoom = Infinity,\n } = this.getLayerConfig();\n return !!visible && zoom >= minZoom && zoom <= maxZoom;\n }\n\n public setMultiPass(\n enableMultiPass: boolean,\n currentPasses?: Array<string | [string, { [key: string]: unknown }]>,\n ) {\n this.updateLayerConfig({\n enableMultiPassRenderer: enableMultiPass,\n });\n if (currentPasses) {\n this.updateLayerConfig({\n passes: currentPasses,\n });\n }\n\n if (enableMultiPass) {\n const { passes = [] } = this.getLayerConfig();\n this.multiPassRenderer = createMultiPassRenderer(\n this,\n passes,\n this.postProcessingPassFactory,\n this.normalPassFactory,\n );\n this.multiPassRenderer.setRenderFlag(true);\n const { width, height } = this.rendererService.getViewportSize();\n this.multiPassRenderer.resize(width, height);\n }\n\n return this;\n }\n\n public setMinZoom(minZoom: number): ILayer {\n this.updateLayerConfig({\n minZoom,\n });\n return this;\n }\n\n public getMinZoom(): number {\n const { minZoom } = this.getLayerConfig();\n return minZoom as number;\n }\n\n public getMaxZoom(): number {\n const { maxZoom } = this.getLayerConfig();\n return maxZoom as number;\n }\n\n public get(name: string) {\n const cfg = this.getLayerConfig();\n // @ts-ignore\n return cfg[name];\n }\n\n public setMaxZoom(maxZoom: number): ILayer {\n this.updateLayerConfig({\n maxZoom,\n });\n return this;\n }\n\n public setAutoFit(autoFit: boolean): ILayer {\n this.updateLayerConfig({\n autoFit,\n });\n return this;\n }\n\n /**\n * zoom to layer Bounds\n */\n public fitBounds(fitBoundsOptions?: unknown): ILayer {\n if (!this.inited) {\n this.updateLayerConfig({\n autoFit: true,\n });\n return this;\n }\n const source = this.getSource();\n const extent = source.extent;\n const isValid = extent.some((v) => Math.abs(v) === Infinity);\n if (isValid) {\n return this;\n }\n this.mapService.fitBounds(\n [\n [extent[0], extent[1]],\n [extent[2], extent[3]],\n ],\n fitBoundsOptions,\n );\n return this;\n }\n\n public destroy(refresh = true) {\n if (this.isDestroied) {\n return;\n }\n\n // remove child layer\n this.layerChildren.map((child: ILayer) => child.destroy());\n this.layerChildren = [];\n\n // remove mask list\n this.masks.map((mask: ILayer) => mask.destroy());\n this.masks = [];\n\n this.hooks.beforeDestroy.call();\n // 清除sources事件\n this.layerSource.off('sourceUpdate', this.sourceEvent);\n\n this.multiPassRenderer.destroy();\n // console.log(this.styleAttributeService.getAttributes())\n // 清除所有属性以及关联的 vao == 销毁所有 => model this.models.forEach((model) => model.destroy());\n this.styleAttributeService.clearAllAttributes();\n\n // 执行每个图层单独的 clearModels 方法 (清除一些额外的 texture、program、buffer 等)\n\n this.hooks.afterDestroy.call();\n\n // TODO: 清除各个图层自定义的 models 资源\n this.layerModel?.clearModels();\n\n this.models = [];\n\n this.layerService.cleanRemove(this, refresh);\n\n this.emit('remove', {\n target: this,\n type: 'remove',\n });\n\n this.emit('destroy', {\n target: this,\n type: 'destroy',\n });\n\n this.removeAllListeners();\n // 解绑图层容器中的服务\n // this.container.unbind(TYPES.IStyleAttributeService);\n\n this.isDestroied = true;\n }\n public clear() {\n this.styleAttributeService.clearAllAttributes();\n // 销毁所有 model\n }\n public clearModels() {\n this.models.forEach((model) => model.destroy());\n this.layerModel?.clearModels();\n this.models = [];\n }\n\n public isDirty() {\n return !!(\n this.styleAttributeService.getLayerStyleAttributes() || []\n ).filter(\n (attribute) =>\n attribute.needRescale ||\n attribute.needRemapping ||\n attribute.needRegenerateVertices,\n ).length;\n }\n\n public setSource(source: Source) {\n // 清除旧 sources 事件\n if (this.layerSource) {\n this.layerSource.off('sourceUpdate', this.sourceEvent);\n }\n\n this.layerSource = source;\n this.clusterZoom = 0;\n\n // 已 inited 且启用聚合进行更新聚合数据\n if (this.inited && this.layerSource.cluster) {\n const zoom = this.mapService.getZoom();\n this.layerSource.updateClusterData(zoom);\n }\n // source 可能会复用,会在其它layer被修改\n if (this.layerSource.inited) {\n this.sourceEvent();\n }\n // this.layerSource.inited 为 true 后,sourceUpdate 事件不会再触发\n this.layerSource.on('sourceUpdate', () => {\n this.sourceEvent();\n });\n }\n public getSource() {\n return this.layerSource;\n }\n\n public getScaleOptions() {\n return this.scaleOptions;\n }\n\n public setEncodedData(encodedData: IEncodeFeature[]) {\n this.encodedData = encodedData;\n }\n public getEncodedData() {\n return this.encodedData;\n }\n\n public getScale(name: string): any {\n return this.styleAttributeService.getLayerAttributeScale(name);\n }\n\n public getLegendItems(name: string): LegendItems {\n const scale = this.styleAttributeService.getLayerAttributeScale(name);\n\n // 函数自定义映射,没有 scale 返回为空数组\n if (!scale) {\n return [];\n }\n\n if (scale.invertExtent) {\n // 分段类型 Quantize、Quantile、Threshold\n const items: ILegendSegmentItem[] = scale.range().map((item: number) => {\n return {\n value: scale.invertExtent(item),\n [name]: item,\n };\n });\n\n return items;\n } else if (scale.ticks) {\n // 连续类型 Continuous (Linear, Power, Log, Identity, Time)\n const items: ILegendClassificaItem[] = scale\n .ticks()\n .map((item: string) => {\n return {\n value: item,\n [name]: scale(item),\n };\n });\n\n return items;\n } else if (scale?.domain) {\n // 枚举类型 Cat\n const items: ILegendClassificaItem[] = scale\n .domain()\n .filter((item: string | number | undefined) => !isUndefined(item))\n .map((item: string | number) => {\n return {\n value: item,\n [name]: scale(item) as string,\n };\n });\n\n return items;\n }\n\n return [];\n }\n\n public pick({ x, y }: { x: number; y: number }) {\n this.interactionService.triggerHover({ x, y });\n }\n\n public boxSelect(\n box: [number, number, number, number],\n cb: (...args: any[]) => void,\n ) {\n this.pickingService.boxPickLayer(this, box, cb);\n }\n\n public buildLayerModel(\n options: ILayerModelInitializationOptions &\n Partial<IModelInitializationOptions>,\n ): Promise<IModel> {\n const {\n moduleName,\n vertexShader,\n fragmentShader,\n triangulation,\n segmentNumber,\n workerEnabled = false,\n workerOptions,\n ...rest\n } = options;\n\n this.shaderModuleService.registerModule(moduleName, {\n vs: vertexShader,\n fs: fragmentShader,\n });\n const { vs, fs, uniforms } = this.shaderModuleService.getModule(moduleName);\n const { createModel } = this.rendererService;\n return new Promise((resolve, reject) => {\n // filter supported worker & worker enabled layer\n if (\n workerOptions &&\n workerOptions.modelType in WorkerSourceMap &&\n workerEnabled\n ) {\n this.styleAttributeService\n .createAttributesAndIndicesAscy(\n this.encodedData,\n segmentNumber,\n workerOptions,\n )\n .then(({ attributes, elements }) => {\n const m = createModel({\n attributes,\n uniforms,\n fs,\n vs,\n elements,\n blend: BlendTypes[BlendType.normal],\n ...rest,\n });\n resolve(m);\n })\n .catch((err) => reject(err));\n } else {\n const {\n attributes,\n elements,\n } = this.styleAttributeService.createAttributesAndIndices(\n this.encodedData,\n triangulation,\n segmentNumber,\n );\n const m = createModel({\n attributes,\n uniforms,\n fs,\n vs,\n elements,\n blend: BlendTypes[BlendType.normal],\n ...rest,\n });\n resolve(m);\n }\n });\n }\n\n public createAttrubutes(\n options: ILayerModelInitializationOptions &\n Partial<IModelInitializationOptions>,\n ) {\n const { triangulation } = options;\n // @ts-ignore\n const { attributes } = this.styleAttributeService.createAttributes(\n this.encodedData,\n triangulation,\n );\n return attributes;\n }\n\n public getTime() {\n return this.layerService.clock.getDelta();\n }\n public setAnimateStartTime() {\n this.animateStartTime = this.layerService.clock.getElapsedTime();\n }\n public stopAnimate() {\n if (this.aniamateStatus) {\n this.layerService.stopAnimate();\n this.aniamateStatus = false;\n this.updateLayerConfig({\n animateOption: {\n enable: false,\n },\n });\n }\n }\n public getLayerAnimateTime(): number {\n return this.layerService.clock.getElapsedTime() - this.animateStartTime;\n }\n\n public needPick(type: string): boolean {\n const {\n enableHighlight = true,\n enableSelect = true,\n } = this.getLayerConfig();\n // 判断layer是否监听事件;\n let isPick =\n this.eventNames().indexOf(type) !== -1 ||\n this.eventNames().indexOf('un' + type) !== -1;\n if ((type === 'click' || type === 'dblclick') && enableSelect) {\n isPick = true;\n }\n if (\n type === 'mousemove' &&\n (enableHighlight ||\n this.eventNames().indexOf('mouseenter') !== -1 ||\n this.eventNames().indexOf('unmousemove') !== -1 ||\n this.eventNames().indexOf('mouseout') !== -1)\n ) {\n isPick = true;\n }\n return this.isVisible() && isPick;\n }\n\n public buildModels() {\n throw new Error('Method not implemented.');\n }\n public rebuildModels() {\n throw new Error('Method not implemented.');\n }\n\n public async renderMulPass(multiPassRenderer: IMultiPassRenderer) {\n await multiPassRenderer.render();\n }\n\n public renderModels(isPicking?: boolean) {\n // TODO: this.getEncodedData().length > 0 这个判断是为了解决在 2.5.x 引入数据纹理后产生的 空数据渲染导致 texture 超出上限问题\n if (this.getEncodedData() && this.getEncodedData().length > 0) {\n if (this.layerModelNeedUpdate && this.layerModel) {\n this.layerModel.buildModels((models: IModel[]) => {\n this.models = models;\n this.hooks.beforeRender.call();\n this.layerModelNeedUpdate = false;\n });\n }\n if (this.layerModel.renderUpdate) {\n this.layerModel.renderUpdate();\n }\n\n this.models.forEach((model) => {\n model.draw(\n {\n uniforms: this.layerModel.getUninforms(),\n },\n isPicking,\n );\n });\n }\n return this;\n }\n\n public updateStyleAttribute(\n type: string,\n field: StyleAttributeField,\n values?: StyleAttributeOption,\n updateOptions?: Partial<IStyleAttributeUpdateOptions>,\n ) {\n if (!this.inited) {\n this.pendingStyleAttributes.push({\n attributeName: type,\n attributeField: field,\n attributeValues: values,\n updateOptions,\n });\n } else {\n this.styleAttributeService.updateStyleAttribute(\n type,\n {\n // @ts-ignore\n scale: {\n field,\n ...this.splitValuesAndCallbackInAttribute(\n // @ts-ignore\n values,\n // @ts-ignore\n this.getLayerConfig()[field],\n ),\n },\n },\n // @ts-ignore\n updateOptions,\n );\n }\n }\n\n public getShaderPickStat() {\n return this.layerService.getShaderPickStat();\n }\n\n /**\n * 继承空方法\n * @param time\n */\n public setEarthTime(time: number) {\n console.warn('empty fn');\n }\n\n protected getConfigSchema() {\n throw new Error('Method not implemented.');\n }\n\n protected getModelType(): unknown {\n throw new Error('Method not implemented.');\n }\n protected getDefaultConfig() {\n return {};\n }\n\n private sourceEvent = () => {\n this.dataState.dataSourceNeedUpdate = true;\n const layerConfig = this.getLayerConfig();\n if (layerConfig && layerConfig.autoFit) {\n this.fitBounds(layerConfig.fitBoundsOptions);\n }\n // 对外暴露事件 迁移到 DataMappingPlugin generateMapping,保证在重新重新映射后触发\n // this.emit('dataUpdate');\n this.reRender();\n };\n\n private reRender() {\n if (this.inited) {\n this.layerService.updateLayerRenderList();\n this.layerService.renderLayers();\n }\n }\n private splitValuesAndCallbackInAttribute(\n valuesOrCallback?: unknown[],\n defaultValues?: unknown[],\n ) {\n return {\n values: isFunction(valuesOrCallback)\n ? undefined\n : valuesOrCallback || defaultValues,\n callback: isFunction(valuesOrCallback) ? valuesOrCallback : undefined,\n };\n }\n}\n"],"file":"BaseLayer.js"}
1
+ {"version":3,"sources":["../../src/core/BaseLayer.ts"],"names":["layerIdCounter","BaseLayer","TYPES","IGlobalConfigService","config","dataSourceNeedUpdate","dataMappingNeedUpdate","filterNeedUpdate","featureScaleNeedUpdate","StyleAttrNeedUpdate","init","SyncBailHook","afterInit","beforeRender","beforeRenderData","SyncWaterfallHook","afterRender","SyncHook","beforePickingEncode","afterPickingEncode","beforeHighlight","afterHighlight","beforeSelect","afterSelect","beforeDestroy","afterDestroy","enable","dataState","layerConfig","getLayerConfig","autoFit","fitBounds","fitBoundsOptions","reRender","name","id","zIndex","rawConfig","maskLayer","masks","push","layerIndex","indexOf","splice","destroy","styleAttributeService","getLayerStyleAttribute","configService","configToUpdate","Object","keys","map","key","inited","needUpdateConfig","sceneId","container","get","SceneID","setLayerConfig","sceneContainer","color","bottomColor","plugin","plugins","layerType","iconService","IIconService","fontService","IFontService","rendererService","IRendererService","layerService","ILayerService","interactionService","IInteractionService","pickingService","IPickingService","mapService","IMapService","enableMultiPassRenderer","passes","length","on","renderLayers","cameraService","ICameraService","coordinateService","ICoordinateSystemService","shaderModuleService","IShaderModuleService","postProcessingPassFactory","IFactoryPostProcessingPass","normalPassFactory","IFactoryNormalPass","IStyleAttributeService","multiPassRenderer","IMultiPassRenderer","setLayer","pendingStyleAttributes","forEach","attributeName","attributeField","attributeValues","updateOptions","updateStyleAttribute","scale","field","splitValuesAndCallbackInAttribute","getAll","ILayerPlugin","apply","hooks","call","emit","target","type","data","attributes","elements","models","m","updateAttributesAndElements","console","warn","option","layerModel","createModelData","calEncodeData","calculateEncodeData","triangulation","createAttributesAndIndices","undefined","updateLayerConfig","getDefaultConfig","animateOption","startAnimate","aniamateStatus","values","lastShape","currentShape","shapeOption","tileLayer","options","rawAnimate","setSource","sourceOption","clusterZoom","layerSource","setData","currentSource","getSource","source","Source","sourceEvent","lastConfig","rest","pass","postProcessingPass","getPostProcessor","getPostProcessingPassByName","styleNeedUpdate","mask","clearModels","buildModels","cfg","scaleOptions","rendering","render","getEncodedData","renderModels","getRenderFlag","activeOption","enableHighlight","highlightColor","mix","activeMix","x","y","pick","pickedFeatureID","then","setTimeout","enableSelect","selectColor","selectMix","blend","layerModelNeedUpdate","visible","clearCanvas","index","updateLayerRenderList","currentPickId","selectedFeatureID","zoom","getZoom","minZoom","Infinity","maxZoom","enableMultiPass","currentPasses","setRenderFlag","getViewportSize","width","height","resize","extent","isValid","some","v","Math","abs","refresh","isDestroied","layerChildren","child","off","clearAllAttributes","cleanRemove","removeAllListeners","model","getLayerStyleAttributes","filter","attribute","needRescale","needRemapping","needRegenerateVertices","cluster","updateClusterData","encodedData","getLayerAttributeScale","invertExtent","items","range","item","value","ticks","domain","triggerHover","box","cb","boxPickLayer","moduleName","vertexShader","fragmentShader","segmentNumber","workerEnabled","workerOptions","registerModule","vs","fs","getModule","uniforms","createModel","Promise","resolve","reject","modelType","WorkerSourceMap","createAttributesAndIndicesAscy","BlendTypes","BlendType","normal","catch","err","createAttributes","clock","getDelta","animateStartTime","getElapsedTime","stopAnimate","isPick","eventNames","isVisible","Error","isPicking","renderUpdate","draw","getUninforms","getShaderPickStat","time","valuesOrCallback","defaultValues","callback","EventEmitter"],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iBD;AACF;;;WAED,6BAA2B;AACzB,aAAO,KAAKhC,YAAL,CAAkB+M,iBAAlB,EAAP;AACD;;;WAMD,sBAAoBC,IAApB,EAAkC;AAChC7J,MAAAA,OAAO,CAACC,IAAR,CAAa,UAAb;AACD;;;WAED,2BAA4B;AAC1B,YAAM,IAAIsJ,KAAJ,CAAU,yBAAV,CAAN;AACD;;;WAED,wBAAkC;AAChC,YAAM,IAAIA,KAAJ,CAAU,yBAAV,CAAN;AACD;;;WACD,4BAA6B;AAC3B,aAAO,EAAP;AACD;;;WAaD,oBAAmB;AACjB,UAAI,KAAK7N,MAAT,EAAiB;AACf,aAAKmB,YAAL,CAAkBuH,qBAAlB;AACA,aAAKvH,YAAL,CAAkBY,YAAlB;AACD;AACF;;;WACD,2CACEqM,gBADF,EAEEC,aAFF,EAGE;AACA,aAAO;AACLhJ,QAAAA,MAAM,EAAE,0BAAW+I,gBAAX,IACJrJ,SADI,GAEJqJ,gBAAgB,IAAIC,aAHnB;AAILC,QAAAA,QAAQ,EAAE,0BAAWF,gBAAX,IAA+BA,gBAA/B,GAAkDrJ;AAJvD,OAAP;AAMD;;;EA1yCOwJ,0B","sourcesContent":["// @ts-ignore\nimport { SyncBailHook, SyncHook, SyncWaterfallHook } from '@antv/async-hook';\nimport {\n BlendType,\n gl,\n IActiveOption,\n IAnimateOption,\n IAttrubuteAndElements,\n ICameraService,\n ICoordinateSystemService,\n IDataState,\n IEncodeFeature,\n IFontService,\n IGlobalConfigService,\n IIconService,\n IInteractionService,\n ILayer,\n ILayerConfig,\n ILayerModel,\n ILayerModelInitializationOptions,\n ILayerPlugin,\n ILayerService,\n ILegendClassificaItem,\n ILegendSegmentItem,\n IMapService,\n IModel,\n IModelInitializationOptions,\n IMultiPassRenderer,\n IPass,\n IPickingService,\n IPostProcessingPass,\n IRendererService,\n IScale,\n IScaleOptions,\n IShaderModuleService,\n ISource,\n ISourceCFG,\n IStyleAttributeInitializationOptions,\n IStyleAttributeService,\n IStyleAttributeUpdateOptions,\n LayerEventType,\n lazyInject,\n LegendItems,\n ScaleAttributeType,\n ScaleTypeName,\n ScaleTypes,\n StyleAttributeField,\n StyleAttributeOption,\n Triangulation,\n TYPES,\n} from '@antv/l7-core';\nimport Source from '@antv/l7-source';\nimport { encodePickingColor, WorkerSourceMap } from '@antv/l7-utils';\nimport { EventEmitter } from 'eventemitter3';\nimport { Container } from 'inversify';\nimport { isFunction, isObject, isUndefined } from 'lodash';\nimport { BlendTypes } from '../utils/blend';\nimport { handleStyleDataMapping } from '../utils/dataMappingStyle';\nimport { calculateData } from '../utils/layerData';\nimport {\n createMultiPassRenderer,\n normalizePasses,\n} from '../utils/multiPassRender';\nimport { updateShape } from '../utils/updateShape';\n/**\n * 分配 layer id\n */\nlet layerIdCounter = 0;\n\nexport default class BaseLayer<ChildLayerStyleOptions = {}>\n extends EventEmitter<LayerEventType>\n implements ILayer {\n public id: string = `${layerIdCounter++}`;\n public name: string = `${layerIdCounter}`;\n public type: string;\n public visible: boolean = true;\n public zIndex: number = 0;\n public minZoom: number;\n public maxZoom: number;\n public inited: boolean = false;\n public layerModelNeedUpdate: boolean = false;\n public pickedFeatureID: number | null = null;\n public selectedFeatureID: number | null = null;\n public styleNeedUpdate: boolean = false;\n public rendering: boolean;\n public clusterZoom: number = 0; // 聚合等级标记\n public layerType?: string | undefined;\n public triangulation?: Triangulation | undefined;\n\n public dataState: IDataState = {\n dataSourceNeedUpdate: false,\n dataMappingNeedUpdate: false,\n filterNeedUpdate: false,\n featureScaleNeedUpdate: false,\n StyleAttrNeedUpdate: false,\n };\n // 生命周期钩子\n public hooks = {\n init: new SyncBailHook(),\n afterInit: new SyncBailHook(),\n beforeRender: new SyncBailHook(),\n beforeRenderData: new SyncWaterfallHook(),\n afterRender: new SyncHook(),\n beforePickingEncode: new SyncHook(),\n afterPickingEncode: new SyncHook(),\n beforeHighlight: new SyncHook(['pickedColor']),\n afterHighlight: new SyncHook(),\n beforeSelect: new SyncHook(['pickedColor']),\n afterSelect: new SyncHook(),\n beforeDestroy: new SyncHook(),\n afterDestroy: new SyncHook(),\n };\n\n // 待渲染 model 列表\n public models: IModel[] = [];\n\n // 每个 Layer 都有一个\n public multiPassRenderer: IMultiPassRenderer;\n\n // 注入插件集\n public plugins: ILayerPlugin[];\n\n public sourceOption: {\n data: any;\n options?: ISourceCFG;\n };\n\n public layerModel: ILayerModel;\n\n public shapeOption: {\n field: any;\n values: any;\n };\n\n // TODO: 记录 sceneContainer 供创建子图层的时候使用 如 imageTileLayer\n public sceneContainer: Container | undefined;\n public tileLayer: any | undefined;\n // TODO: 用于保存子图层对象\n public layerChildren: ILayer[] = [];\n public masks: ILayer[] = [];\n // Tip: 用于标识矢量图层\n public isVector: boolean = false;\n\n @lazyInject(TYPES.IGlobalConfigService)\n protected readonly configService: IGlobalConfigService;\n\n // @lazyInject(TYPES.IShaderModuleService)\n // protected readonly shaderModuleService: IShaderModuleService;\n\n protected shaderModuleService: IShaderModuleService;\n protected cameraService: ICameraService;\n\n protected coordinateService: ICoordinateSystemService;\n\n protected iconService: IIconService;\n\n protected fontService: IFontService;\n\n protected pickingService: IPickingService;\n\n protected rendererService: IRendererService;\n\n protected layerService: ILayerService;\n\n protected interactionService: IInteractionService;\n\n protected mapService: IMapService;\n\n protected styleAttributeService: IStyleAttributeService;\n\n protected layerSource: Source;\n\n protected postProcessingPassFactory: (\n name: string,\n ) => IPostProcessingPass<unknown>;\n protected normalPassFactory: (name: string) => IPass<unknown>;\n\n protected animateOptions: IAnimateOption = { enable: false };\n\n /**\n * 图层容器\n */\n private container: Container;\n\n private encodedData: IEncodeFeature[];\n\n private configSchema: object;\n\n private currentPickId: number | null = null;\n\n private rawConfig: Partial<ILayerConfig & ChildLayerStyleOptions>;\n\n private needUpdateConfig: Partial<ILayerConfig & ChildLayerStyleOptions>;\n\n /**\n * 待更新样式属性,在初始化阶段完成注册\n */\n private pendingStyleAttributes: Array<{\n attributeName: string;\n attributeField: StyleAttributeField;\n attributeValues?: StyleAttributeOption;\n defaultName?: string;\n updateOptions?: Partial<IStyleAttributeUpdateOptions>;\n }> = [];\n\n private scaleOptions: IScaleOptions = {};\n\n private animateStartTime: number;\n\n private aniamateStatus: boolean = false;\n\n // TODO: layer 保底颜色\n private bottomColor = 'rgba(0, 0, 0, 0)';\n\n private isDestroied: boolean = false;\n\n // private pickingPassRender: IPass<'pixelPicking'>;\n\n constructor(config: Partial<ILayerConfig & ChildLayerStyleOptions> = {}) {\n super();\n this.name = config.name || this.id;\n this.zIndex = config.zIndex || 0;\n this.rawConfig = config;\n }\n\n public addMaskLayer(maskLayer: ILayer) {\n this.masks.push(maskLayer);\n }\n\n public removeMaskLayer(maskLayer: ILayer) {\n const layerIndex = this.masks.indexOf(maskLayer);\n if (layerIndex > -1) {\n this.masks.splice(layerIndex, 1);\n }\n maskLayer.destroy();\n }\n\n public getAttribute(name: string) {\n return this.styleAttributeService.getLayerStyleAttribute(name);\n }\n\n public getLayerConfig() {\n return this.configService.getLayerConfig<ChildLayerStyleOptions>(this.id);\n }\n\n public updateLayerConfig(\n configToUpdate: Partial<ILayerConfig | ChildLayerStyleOptions>,\n ) {\n // 同步 rawConfig\n Object.keys(configToUpdate).map((key) => {\n if (key in this.rawConfig) {\n // @ts-ignore\n this.rawConfig[key] = configToUpdate[key];\n }\n });\n if (!this.inited) {\n this.needUpdateConfig = {\n ...this.needUpdateConfig,\n ...configToUpdate,\n };\n } else {\n const sceneId = this.container.get<string>(TYPES.SceneID);\n\n // @ts-ignore\n handleStyleDataMapping(configToUpdate, this); // 处理 style 中进行数据映射的属性字段\n\n this.configService.setLayerConfig(sceneId, this.id, {\n ...this.configService.getLayerConfig(this.id),\n ...this.needUpdateConfig,\n ...configToUpdate,\n });\n this.needUpdateConfig = {};\n }\n }\n\n /**\n * 注入图层容器,父容器为场景容器\n * RootContainer 1\n * -> SceneContainer 1.*\n * -> LayerContainer 1.*\n */\n public setContainer(container: Container, sceneContainer: Container) {\n this.container = container;\n this.sceneContainer = sceneContainer;\n }\n\n public getContainer() {\n return this.container;\n }\n\n public setBottomColor(color: string) {\n this.bottomColor = color;\n }\n\n public getBottomColor() {\n return this.bottomColor;\n }\n\n public addPlugin(plugin: ILayerPlugin): ILayer {\n // TODO: 控制插件注册顺序\n // @example:\n // pointLayer.addPlugin(new MyCustomPlugin(), {\n // before: 'L7BuiltinPlugin'\n // });\n this.plugins.push(plugin);\n return this;\n }\n\n public init() {\n // 设置配置项\n const sceneId = this.container.get<string>(TYPES.SceneID);\n // 初始化图层配置项\n // const { enableMultiPassRenderer = false } = this.rawConfig;\n // this.configService.setLayerConfig(sceneId, this.id, {\n // enableMultiPassRenderer,\n // });\n this.configService.setLayerConfig(sceneId, this.id, this.rawConfig);\n this.layerType = this.rawConfig.layerType;\n\n // 全局容器服务\n\n // 场景容器服务\n this.iconService = this.container.get<IIconService>(TYPES.IIconService);\n this.fontService = this.container.get<IFontService>(TYPES.IFontService);\n\n this.rendererService = this.container.get<IRendererService>(\n TYPES.IRendererService,\n );\n this.layerService = this.container.get<ILayerService>(TYPES.ILayerService);\n this.interactionService = this.container.get<IInteractionService>(\n TYPES.IInteractionService,\n );\n\n this.pickingService = this.container.get<IPickingService>(\n TYPES.IPickingService,\n );\n this.mapService = this.container.get<IMapService>(TYPES.IMapService);\n const { enableMultiPassRenderer, passes } = this.getLayerConfig();\n if (enableMultiPassRenderer && passes?.length && passes.length > 0) {\n // Tip: 兼容 multiPassRender 在 amap1 时存在的图层不同步问题 zoom\n this.mapService.on('mapAfterFrameChange', () => {\n this.renderLayers();\n });\n }\n\n this.cameraService = this.container.get<ICameraService>(\n TYPES.ICameraService,\n );\n this.coordinateService = this.container.get<ICoordinateSystemService>(\n TYPES.ICoordinateSystemService,\n );\n this.shaderModuleService = this.container.get<IShaderModuleService>(\n TYPES.IShaderModuleService,\n );\n this.postProcessingPassFactory = this.container.get(\n TYPES.IFactoryPostProcessingPass,\n );\n this.normalPassFactory = this.container.get(TYPES.IFactoryNormalPass);\n\n // 图层容器服务\n this.styleAttributeService = this.container.get<IStyleAttributeService>(\n TYPES.IStyleAttributeService,\n );\n this.multiPassRenderer = this.container.get<IMultiPassRenderer>(\n TYPES.IMultiPassRenderer,\n );\n this.multiPassRenderer.setLayer(this);\n\n // 完成样式服务注册完成前添加的属性\n this.pendingStyleAttributes.forEach(\n ({ attributeName, attributeField, attributeValues, updateOptions }) => {\n this.styleAttributeService.updateStyleAttribute(\n attributeName,\n {\n // @ts-ignore\n scale: {\n field: attributeField,\n ...this.splitValuesAndCallbackInAttribute(\n // @ts-ignore\n attributeValues,\n // @ts-ignore\n this.getLayerConfig()[attributeName],\n ),\n },\n },\n // @ts-ignore\n updateOptions,\n );\n },\n );\n this.pendingStyleAttributes = [];\n\n // 获取插件集\n this.plugins = this.container.getAll<ILayerPlugin>(TYPES.ILayerPlugin);\n // 完成插件注册,传入场景和图层容器内的服务\n for (const plugin of this.plugins) {\n plugin.apply(this, {\n rendererService: this.rendererService,\n mapService: this.mapService,\n styleAttributeService: this.styleAttributeService,\n normalPassFactory: this.normalPassFactory,\n postProcessingPassFactory: this.postProcessingPassFactory,\n });\n }\n\n // 触发 init 生命周期插件\n this.hooks.init.call();\n // this.pickingPassRender = this.normalPassFactory('pixelPicking');\n // this.pickingPassRender.init(this);\n this.hooks.afterInit.call();\n // 触发初始化完成事件;\n this.emit('inited', {\n target: this,\n type: 'inited',\n });\n this.emit('add', {\n target: this,\n type: 'add',\n });\n\n return this;\n }\n\n public updateModelData(data: IAttrubuteAndElements) {\n if (data.attributes && data.elements) {\n this.models.map((m) => {\n m.updateAttributesAndElements(data.attributes, data.elements);\n });\n } else {\n console.warn('data error');\n }\n }\n\n public createModelData(data: any, option?: ISourceCFG) {\n if (this.layerModel?.createModelData) {\n // 在某些特殊图层中单独构建 attribute & elements\n return this.layerModel.createModelData(option);\n }\n const calEncodeData = this.calculateEncodeData(data, option);\n const triangulation = this.triangulation;\n\n if (calEncodeData && triangulation) {\n return this.styleAttributeService.createAttributesAndIndices(\n calEncodeData,\n triangulation,\n );\n } else {\n return {\n attributes: undefined,\n elements: undefined,\n };\n }\n }\n\n public calculateEncodeData(data: any, option?: ISourceCFG) {\n if (this.inited) {\n return calculateData(\n this,\n this.fontService,\n this.mapService,\n this.styleAttributeService,\n data,\n option,\n );\n } else {\n console.warn('layer not inited!');\n return null;\n }\n }\n /**\n * Model初始化前需要更新Model样式\n */\n public prepareBuildModel() {\n this.inited = true;\n this.updateLayerConfig({\n ...(this.getDefaultConfig() as object),\n ...this.rawConfig,\n });\n\n // 启动动画\n const { animateOption } = this.getLayerConfig();\n if (animateOption?.enable) {\n this.layerService.startAnimate();\n this.aniamateStatus = true;\n }\n }\n public color(\n field: StyleAttributeField,\n values?: StyleAttributeOption,\n updateOptions?: Partial<IStyleAttributeUpdateOptions>,\n ) {\n // 设置 color、size、shape、style 时由于场景服务尚未完成(并没有调用 scene.addLayer),因此暂时加入待更新属性列表\n this.updateStyleAttribute('color', field, values, updateOptions);\n\n // this.pendingStyleAttributes.push({\n // attributeName: 'color',\n // attributeField: field,\n // attributeValues: values,\n // defaultName: 'colors',\n // updateOptions,\n // });\n return this;\n }\n\n // 为对应的图层传入纹理的编号名称(point/image 在 shape 方法中传入纹理名称的方法并不通用)\n public texture(\n field: StyleAttributeField,\n values?: StyleAttributeOption,\n updateOptions?: Partial<IStyleAttributeUpdateOptions>,\n ) {\n this.updateStyleAttribute('texture', field, values, updateOptions);\n return this;\n }\n\n public rotate(\n field: StyleAttributeField,\n values?: StyleAttributeOption,\n updateOptions?: Partial<IStyleAttributeUpdateOptions>,\n ) {\n this.updateStyleAttribute('rotate', field, values, updateOptions);\n return this;\n }\n public size(\n field: StyleAttributeField,\n values?: StyleAttributeOption,\n updateOptions?: Partial<IStyleAttributeUpdateOptions>,\n ) {\n this.updateStyleAttribute('size', field, values, updateOptions);\n return this;\n }\n // 对mapping后的数据过滤,scale保持不变\n public filter(\n field: StyleAttributeField,\n values?: StyleAttributeOption,\n updateOptions?: Partial<IStyleAttributeUpdateOptions>,\n ) {\n this.updateStyleAttribute('filter', field, values, updateOptions);\n return this;\n }\n\n public shape(\n field: StyleAttributeField,\n values?: StyleAttributeOption,\n updateOptions?: Partial<IStyleAttributeUpdateOptions>,\n ) {\n const lastShape = this.styleAttributeService?.getLayerStyleAttribute(\n 'shape',\n )?.scale?.field;\n const currentShape = field;\n this.shapeOption = {\n field,\n values,\n };\n this.updateStyleAttribute('shape', field, values, updateOptions);\n // TODO: 根据 shape 判断是否需要更新 model\n if (!this.tileLayer) {\n updateShape(this, lastShape, currentShape);\n }\n return this;\n }\n public label(\n field: StyleAttributeField,\n values?: StyleAttributeOption,\n updateOptions?: Partial<IStyleAttributeUpdateOptions>,\n ) {\n this.pendingStyleAttributes.push({\n attributeName: 'label',\n attributeField: field,\n attributeValues: values,\n updateOptions,\n });\n return this;\n }\n public animate(options: IAnimateOption | boolean) {\n let rawAnimate: Partial<IAnimateOption> = {};\n if (isObject(options)) {\n rawAnimate.enable = true;\n rawAnimate = {\n ...rawAnimate,\n ...options,\n };\n } else {\n rawAnimate.enable = options;\n }\n this.updateLayerConfig({\n animateOption: rawAnimate,\n });\n // this.animateOptions = options;\n return this;\n }\n\n public source(data: any, options?: ISourceCFG): ILayer {\n if (data?.data) {\n // 判断是否为source\n this.setSource(data);\n return this;\n }\n this.sourceOption = {\n data,\n options,\n };\n this.clusterZoom = 0;\n return this;\n }\n\n public setData(data: any, options?: ISourceCFG) {\n if (this.inited) {\n this.layerSource.setData(data, options);\n } else {\n this.on('inited', () => {\n const currentSource = this.getSource();\n if (!currentSource) {\n // 执行 setData 的时候 source 还不存在(还未执行 addLayer)\n this.source(new Source(data, options));\n this.sourceEvent();\n } else {\n this.layerSource.setData(data, options);\n }\n // this.layerSource.setData(data, options);\n });\n }\n\n return this;\n }\n public style(\n options: Partial<ChildLayerStyleOptions> & Partial<ILayerConfig>,\n ): ILayer {\n const lastConfig = this.getLayerConfig();\n const { passes, ...rest } = options;\n\n // passes 特殊处理\n if (passes) {\n normalizePasses(passes).forEach(\n (pass: [string, { [key: string]: unknown }]) => {\n const postProcessingPass = this.multiPassRenderer\n .getPostProcessor()\n .getPostProcessingPassByName(pass[0]);\n if (postProcessingPass) {\n postProcessingPass.updateOptions(pass[1]);\n }\n },\n );\n }\n\n this.rawConfig = {\n ...this.rawConfig,\n ...rest,\n };\n if (this.container) {\n this.updateLayerConfig(this.rawConfig);\n this.styleNeedUpdate = true;\n }\n\n // @ts-ignore\n if (lastConfig && lastConfig.mask === true && options.mask === false) {\n this.clearModels();\n this.layerModel.buildModels((models) => {\n this.models = models;\n });\n }\n return this;\n }\n public scale(field: string | number | IScaleOptions, cfg?: IScale) {\n if (isObject(field)) {\n this.scaleOptions = {\n ...this.scaleOptions,\n ...field,\n };\n } else {\n this.scaleOptions[field] = cfg;\n }\n return this;\n }\n\n /**\n * 渲染所有的图层\n */\n public renderLayers(): void {\n this.rendering = true;\n\n this.layerService.renderLayers();\n\n this.rendering = false;\n }\n\n public render(): ILayer {\n if (this.tileLayer !== undefined) {\n // 瓦片图层执行单独的 render 渲染队列\n this.tileLayer.render();\n return this;\n }\n // TODO: this.getEncodedData().length !== 0 这个判断是为了解决在 2.5.x 引入数据纹理后产生的 空数据渲染导致 texture 超出上限问题\n if (this.getEncodedData() && this.getEncodedData().length !== 0) {\n this.renderModels();\n }\n return this;\n }\n\n /**\n * renderMultiPass 专门用于渲染支持 multipass 的 layer\n */\n public async renderMultiPass() {\n if (this.getEncodedData() && this.getEncodedData().length !== 0) {\n if (this.multiPassRenderer && this.multiPassRenderer.getRenderFlag()) {\n // multi render 开始执行 multiPassRender 的渲染流程\n await this.multiPassRenderer.render();\n } else if (this.multiPassRenderer) {\n // renderPass 触发的渲染\n this.renderModels();\n } else {\n this.renderModels();\n }\n }\n }\n\n public active(options: IActiveOption | boolean) {\n const activeOption: Partial<ILayerConfig> = {};\n activeOption.enableHighlight = isObject(options) ? true : options;\n if (isObject(options)) {\n activeOption.enableHighlight = true;\n if (options.color) {\n activeOption.highlightColor = options.color;\n }\n if (options.mix) {\n activeOption.activeMix = options.mix;\n }\n } else {\n activeOption.enableHighlight = !!options;\n }\n this.updateLayerConfig(activeOption);\n return this;\n }\n public setActive(\n id: number | { x: number; y: number },\n options?: IActiveOption,\n ): void {\n if (isObject(id)) {\n const { x = 0, y = 0 } = id;\n this.updateLayerConfig({\n highlightColor: isObject(options)\n ? options.color\n : this.getLayerConfig().highlightColor,\n activeMix: isObject(options)\n ? options.mix\n : this.getLayerConfig().activeMix,\n });\n this.pick({ x, y });\n } else {\n this.updateLayerConfig({\n pickedFeatureID: id,\n highlightColor: isObject(options)\n ? options.color\n : this.getLayerConfig().highlightColor,\n activeMix: isObject(options)\n ? options.mix\n : this.getLayerConfig().activeMix,\n });\n this.hooks.beforeSelect\n .call(encodePickingColor(id as number) as number[])\n // @ts-ignore\n .then(() => {\n setTimeout(() => {\n this.reRender();\n }, 1);\n });\n }\n }\n\n public select(option: IActiveOption | boolean): ILayer {\n const activeOption: Partial<ILayerConfig> = {};\n activeOption.enableSelect = isObject(option) ? true : option;\n if (isObject(option)) {\n activeOption.enableSelect = true;\n if (option.color) {\n activeOption.selectColor = option.color;\n }\n if (option.mix) {\n activeOption.selectMix = option.mix;\n }\n } else {\n activeOption.enableSelect = !!option;\n }\n this.updateLayerConfig(activeOption);\n return this;\n }\n\n public setSelect(\n id: number | { x: number; y: number },\n options?: IActiveOption,\n ): void {\n if (isObject(id)) {\n const { x = 0, y = 0 } = id;\n this.updateLayerConfig({\n selectColor: isObject(options)\n ? options.color\n : this.getLayerConfig().selectColor,\n selectMix: isObject(options)\n ? options.mix\n : this.getLayerConfig().selectMix,\n });\n this.pick({ x, y });\n } else {\n this.updateLayerConfig({\n pickedFeatureID: id,\n selectColor: isObject(options)\n ? options.color\n : this.getLayerConfig().selectColor,\n selectMix: isObject(options)\n ? options.mix\n : this.getLayerConfig().selectMix,\n });\n this.hooks.beforeSelect\n .call(encodePickingColor(id as number) as number[])\n // @ts-ignore\n .then(() => {\n setTimeout(() => {\n this.reRender();\n }, 1);\n });\n }\n }\n public setBlend(type: keyof typeof BlendType): ILayer {\n this.updateLayerConfig({\n blend: type,\n });\n this.layerModelNeedUpdate = true;\n this.reRender();\n return this;\n }\n public show(): ILayer {\n this.updateLayerConfig({\n visible: true,\n });\n this.reRender();\n return this;\n }\n\n public hide(): ILayer {\n if (this.type === 'CanvasLayer' && this.layerModel.clearCanvas) {\n // 对 canvasLayer 的 hide 操作做特殊处理\n this.layerModel.clearCanvas();\n }\n this.updateLayerConfig({\n visible: false,\n });\n this.reRender();\n return this;\n }\n public setIndex(index: number): ILayer {\n this.zIndex = index;\n this.layerService.updateLayerRenderList();\n this.layerService.renderLayers();\n return this;\n }\n\n public setCurrentPickId(id: number) {\n this.currentPickId = id;\n }\n\n public getCurrentPickId(): number | null {\n return this.currentPickId;\n }\n\n public setCurrentSelectedId(id: number) {\n this.selectedFeatureID = id;\n }\n\n public getCurrentSelectedId(): number | null {\n return this.selectedFeatureID;\n }\n public isVisible(): boolean {\n const zoom = this.mapService.getZoom();\n const {\n visible,\n minZoom = -Infinity,\n maxZoom = Infinity,\n } = this.getLayerConfig();\n return !!visible && zoom >= minZoom && zoom <= maxZoom;\n }\n\n public setMultiPass(\n enableMultiPass: boolean,\n currentPasses?: Array<string | [string, { [key: string]: unknown }]>,\n ) {\n this.updateLayerConfig({\n enableMultiPassRenderer: enableMultiPass,\n });\n if (currentPasses) {\n this.updateLayerConfig({\n passes: currentPasses,\n });\n }\n\n if (enableMultiPass) {\n const { passes = [] } = this.getLayerConfig();\n this.multiPassRenderer = createMultiPassRenderer(\n this,\n passes,\n this.postProcessingPassFactory,\n this.normalPassFactory,\n );\n this.multiPassRenderer.setRenderFlag(true);\n const { width, height } = this.rendererService.getViewportSize();\n this.multiPassRenderer.resize(width, height);\n }\n\n return this;\n }\n\n public setMinZoom(minZoom: number): ILayer {\n this.updateLayerConfig({\n minZoom,\n });\n return this;\n }\n\n public getMinZoom(): number {\n const { minZoom } = this.getLayerConfig();\n return minZoom as number;\n }\n\n public getMaxZoom(): number {\n const { maxZoom } = this.getLayerConfig();\n return maxZoom as number;\n }\n\n public get(name: string) {\n const cfg = this.getLayerConfig();\n // @ts-ignore\n return cfg[name];\n }\n\n public setMaxZoom(maxZoom: number): ILayer {\n this.updateLayerConfig({\n maxZoom,\n });\n return this;\n }\n\n public setAutoFit(autoFit: boolean): ILayer {\n this.updateLayerConfig({\n autoFit,\n });\n return this;\n }\n\n /**\n * zoom to layer Bounds\n */\n public fitBounds(fitBoundsOptions?: unknown): ILayer {\n if (!this.inited) {\n this.updateLayerConfig({\n autoFit: true,\n });\n return this;\n }\n const source = this.getSource();\n const extent = source.extent;\n const isValid = extent.some((v) => Math.abs(v) === Infinity);\n if (isValid) {\n return this;\n }\n this.mapService.fitBounds(\n [\n [extent[0], extent[1]],\n [extent[2], extent[3]],\n ],\n fitBoundsOptions,\n );\n return this;\n }\n\n public destroy(refresh = true) {\n if (this.isDestroied) {\n return;\n }\n\n // remove child layer\n this.layerChildren.map((child: ILayer) => child.destroy());\n this.layerChildren = [];\n\n // remove mask list\n this.masks.map((mask: ILayer) => mask.destroy());\n this.masks = [];\n\n this.hooks.beforeDestroy.call();\n // 清除sources事件\n this.layerSource.off('sourceUpdate', this.sourceEvent);\n\n this.multiPassRenderer.destroy();\n // console.log(this.styleAttributeService.getAttributes())\n // 清除所有属性以及关联的 vao == 销毁所有 => model this.models.forEach((model) => model.destroy());\n this.styleAttributeService.clearAllAttributes();\n\n // 执行每个图层单独的 clearModels 方法 (清除一些额外的 texture、program、buffer 等)\n\n this.hooks.afterDestroy.call();\n\n // TODO: 清除各个图层自定义的 models 资源\n this.layerModel?.clearModels();\n\n this.models = [];\n\n this.layerService.cleanRemove(this, refresh);\n\n this.emit('remove', {\n target: this,\n type: 'remove',\n });\n\n this.emit('destroy', {\n target: this,\n type: 'destroy',\n });\n\n this.removeAllListeners();\n // 解绑图层容器中的服务\n // this.container.unbind(TYPES.IStyleAttributeService);\n\n this.isDestroied = true;\n }\n public clear() {\n this.styleAttributeService.clearAllAttributes();\n // 销毁所有 model\n }\n public clearModels() {\n this.models.forEach((model) => model.destroy());\n this.layerModel?.clearModels();\n this.models = [];\n }\n\n public isDirty() {\n return !!(\n this.styleAttributeService.getLayerStyleAttributes() || []\n ).filter(\n (attribute) =>\n attribute.needRescale ||\n attribute.needRemapping ||\n attribute.needRegenerateVertices,\n ).length;\n }\n\n public setSource(source: Source) {\n // 清除旧 sources 事件\n if (this.layerSource) {\n this.layerSource.off('sourceUpdate', this.sourceEvent);\n }\n\n this.layerSource = source;\n this.clusterZoom = 0;\n\n // 已 inited 且启用聚合进行更新聚合数据\n if (this.inited && this.layerSource.cluster) {\n const zoom = this.mapService.getZoom();\n this.layerSource.updateClusterData(zoom);\n }\n // source 可能会复用,会在其它layer被修改\n if (this.layerSource.inited) {\n this.sourceEvent();\n }\n // this.layerSource.inited 为 true 后,sourceUpdate 事件不会再触发\n this.layerSource.on('sourceUpdate', () => {\n this.sourceEvent();\n });\n }\n public getSource() {\n return this.layerSource;\n }\n\n public getScaleOptions() {\n return this.scaleOptions;\n }\n\n public setEncodedData(encodedData: IEncodeFeature[]) {\n this.encodedData = encodedData;\n }\n public getEncodedData() {\n return this.encodedData;\n }\n\n public getScale(name: string): any {\n return this.styleAttributeService.getLayerAttributeScale(name);\n }\n\n public getLegendItems(name: string): LegendItems {\n const scale = this.styleAttributeService.getLayerAttributeScale(name);\n\n // 函数自定义映射,没有 scale 返回为空数组\n if (!scale) {\n return [];\n }\n\n if (scale.invertExtent) {\n // 分段类型 Quantize、Quantile、Threshold\n const items: ILegendSegmentItem[] = scale.range().map((item: number) => {\n return {\n value: scale.invertExtent(item),\n [name]: item,\n };\n });\n\n return items;\n } else if (scale.ticks) {\n // 连续类型 Continuous (Linear, Power, Log, Identity, Time)\n const items: ILegendClassificaItem[] = scale\n .ticks()\n .map((item: string) => {\n return {\n value: item,\n [name]: scale(item),\n };\n });\n\n return items;\n } else if (scale?.domain) {\n // 枚举类型 Cat\n const items: ILegendClassificaItem[] = scale\n .domain()\n .filter((item: string | number | undefined) => !isUndefined(item))\n .map((item: string | number) => {\n return {\n value: item,\n [name]: scale(item) as string,\n };\n });\n\n return items;\n }\n\n return [];\n }\n\n public pick({ x, y }: { x: number; y: number }) {\n this.interactionService.triggerHover({ x, y });\n }\n\n public boxSelect(\n box: [number, number, number, number],\n cb: (...args: any[]) => void,\n ) {\n this.pickingService.boxPickLayer(this, box, cb);\n }\n\n public buildLayerModel(\n options: ILayerModelInitializationOptions &\n Partial<IModelInitializationOptions>,\n ): Promise<IModel> {\n const {\n moduleName,\n vertexShader,\n fragmentShader,\n triangulation,\n segmentNumber,\n workerEnabled = false,\n workerOptions,\n ...rest\n } = options;\n\n this.shaderModuleService.registerModule(moduleName, {\n vs: vertexShader,\n fs: fragmentShader,\n });\n const { vs, fs, uniforms } = this.shaderModuleService.getModule(moduleName);\n const { createModel } = this.rendererService;\n return new Promise((resolve, reject) => {\n // filter supported worker & worker enabled layer\n if (\n workerOptions &&\n workerOptions.modelType in WorkerSourceMap &&\n workerEnabled\n ) {\n this.styleAttributeService\n .createAttributesAndIndicesAscy(\n this.encodedData,\n segmentNumber,\n workerOptions,\n )\n .then(({ attributes, elements }) => {\n const m = createModel({\n attributes,\n uniforms,\n fs,\n vs,\n elements,\n blend: BlendTypes[BlendType.normal],\n ...rest,\n });\n resolve(m);\n })\n .catch((err) => reject(err));\n } else {\n const {\n attributes,\n elements,\n } = this.styleAttributeService.createAttributesAndIndices(\n this.encodedData,\n triangulation,\n segmentNumber,\n );\n const m = createModel({\n attributes,\n uniforms,\n fs,\n vs,\n elements,\n blend: BlendTypes[BlendType.normal],\n ...rest,\n });\n resolve(m);\n }\n });\n }\n\n public createAttrubutes(\n options: ILayerModelInitializationOptions &\n Partial<IModelInitializationOptions>,\n ) {\n const { triangulation } = options;\n // @ts-ignore\n const { attributes } = this.styleAttributeService.createAttributes(\n this.encodedData,\n triangulation,\n );\n return attributes;\n }\n\n public getTime() {\n return this.layerService.clock.getDelta();\n }\n public setAnimateStartTime() {\n this.animateStartTime = this.layerService.clock.getElapsedTime();\n }\n public stopAnimate() {\n if (this.aniamateStatus) {\n this.layerService.stopAnimate();\n this.aniamateStatus = false;\n this.updateLayerConfig({\n animateOption: {\n enable: false,\n },\n });\n }\n }\n public getLayerAnimateTime(): number {\n return this.layerService.clock.getElapsedTime() - this.animateStartTime;\n }\n\n public needPick(type: string): boolean {\n const {\n enableHighlight = true,\n enableSelect = true,\n } = this.getLayerConfig();\n // 判断layer是否监听事件;\n let isPick =\n this.eventNames().indexOf(type) !== -1 ||\n this.eventNames().indexOf('un' + type) !== -1;\n if ((type === 'click' || type === 'dblclick') && enableSelect) {\n isPick = true;\n }\n if (\n type === 'mousemove' &&\n (enableHighlight ||\n this.eventNames().indexOf('mouseenter') !== -1 ||\n this.eventNames().indexOf('unmousemove') !== -1 ||\n this.eventNames().indexOf('mouseout') !== -1)\n ) {\n isPick = true;\n }\n return this.isVisible() && isPick;\n }\n\n public buildModels() {\n throw new Error('Method not implemented.');\n }\n public rebuildModels() {\n throw new Error('Method not implemented.');\n }\n\n public async renderMulPass(multiPassRenderer: IMultiPassRenderer) {\n await multiPassRenderer.render();\n }\n\n public renderModels(isPicking?: boolean) {\n // TODO: this.getEncodedData().length > 0 这个判断是为了解决在 2.5.x 引入数据纹理后产生的 空数据渲染导致 texture 超出上限问题\n if (this.getEncodedData() && this.getEncodedData().length > 0) {\n if (this.layerModelNeedUpdate && this.layerModel) {\n this.layerModel.buildModels((models: IModel[]) => {\n this.models = models;\n this.hooks.beforeRender.call();\n this.layerModelNeedUpdate = false;\n });\n }\n if (this?.layerModel?.renderUpdate) {\n this.layerModel.renderUpdate();\n }\n\n this.models.forEach((model) => {\n model.draw(\n {\n uniforms: this.layerModel.getUninforms(),\n },\n isPicking,\n );\n });\n }\n return this;\n }\n\n public updateStyleAttribute(\n type: string,\n field: StyleAttributeField,\n values?: StyleAttributeOption,\n updateOptions?: Partial<IStyleAttributeUpdateOptions>,\n ) {\n if (!this.inited) {\n this.pendingStyleAttributes.push({\n attributeName: type,\n attributeField: field,\n attributeValues: values,\n updateOptions,\n });\n } else {\n this.styleAttributeService.updateStyleAttribute(\n type,\n {\n // @ts-ignore\n scale: {\n field,\n ...this.splitValuesAndCallbackInAttribute(\n // @ts-ignore\n values,\n // @ts-ignore\n this.getLayerConfig()[field],\n ),\n },\n },\n // @ts-ignore\n updateOptions,\n );\n }\n }\n\n public getShaderPickStat() {\n return this.layerService.getShaderPickStat();\n }\n\n /**\n * 继承空方法\n * @param time\n */\n public setEarthTime(time: number) {\n console.warn('empty fn');\n }\n\n protected getConfigSchema() {\n throw new Error('Method not implemented.');\n }\n\n protected getModelType(): unknown {\n throw new Error('Method not implemented.');\n }\n protected getDefaultConfig() {\n return {};\n }\n\n private sourceEvent = () => {\n this.dataState.dataSourceNeedUpdate = true;\n const layerConfig = this.getLayerConfig();\n if (layerConfig && layerConfig.autoFit) {\n this.fitBounds(layerConfig.fitBoundsOptions);\n }\n // 对外暴露事件 迁移到 DataMappingPlugin generateMapping,保证在重新重新映射后触发\n // this.emit('dataUpdate');\n this.reRender();\n };\n\n private reRender() {\n if (this.inited) {\n this.layerService.updateLayerRenderList();\n this.layerService.renderLayers();\n }\n }\n private splitValuesAndCallbackInAttribute(\n valuesOrCallback?: unknown[],\n defaultValues?: unknown[],\n ) {\n return {\n values: isFunction(valuesOrCallback)\n ? undefined\n : valuesOrCallback || defaultValues,\n callback: isFunction(valuesOrCallback) ? valuesOrCallback : undefined,\n };\n }\n}\n"],"file":"BaseLayer.js"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/core/interface.ts"],"names":["lineStyleType","CanvasUpdateType"],"mappings":";;;;;;IAIYA,a;;;WAAAA,a;AAAAA,EAAAA,a,CAAAA,a;AAAAA,EAAAA,a,CAAAA,a;GAAAA,a,6BAAAA,a;;IA4MAC,gB;;;WAAAA,gB;AAAAA,EAAAA,gB;AAAAA,EAAAA,gB;GAAAA,gB,gCAAAA,gB","sourcesContent":["import { IAnimateOption, IMapService } from '@antv/l7-core';\nimport { IColorRamp, IImagedata } from '@antv/l7-utils';\nimport { styleOffset, styleSingle } from '../core/BaseModel';\nimport { anchorType } from '../utils/symbol-layout';\nexport enum lineStyleType {\n 'solid' = 0.0,\n 'dash' = 1.0,\n}\n\ninterface ILineArrow {\n enable: boolean;\n arrowWidth: number;\n arrowHeight: number;\n tailWidth: number;\n}\n\nexport interface ILineLayerStyleOptions {\n tileOrigin?: number[];\n coord?: string;\n\n opacity: styleSingle;\n lineType?: keyof typeof lineStyleType; // 可选参数、线类型(all - dash/solid)\n dashArray?: [number, number]; // 可选参数、虚线间隔\n segmentNumber?: number;\n\n depth?: boolean;\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 raisingHeight?: number; // 线图层抬升高度\n\n mask?: boolean; // 可选参数 时候允许蒙层\n maskInside?: boolean; // 可选参数 控制图层是否显示在蒙层的内部\n\n arrow?: ILineArrow;\n\n rampColors?: IColorRamp;\n featureId?: string;\n sourceLayer?: string;\n enablePicking?: boolean;\n workerEnabled?: boolean;\n}\n\nexport interface IPointLayerStyleOptions {\n tileOrigin?: number[];\n coord?: string;\n opacity: number;\n strokeOpacity: number;\n strokeWidth: number;\n stroke: string;\n\n blur?: number;\n\n // text\n textOffset?: [number, number];\n textAnchor?: anchorType;\n spacing?: number;\n padding?: [number, number];\n halo?: number;\n gamma?: number;\n fontWeight?: string;\n fontFamily?: string;\n textAllowOverlap?: boolean;\n\n raisingHeight?: number; // 线图层抬升高度\n\n // cylinder\n pickLight?: boolean;\n depth?: boolean;\n sourceColor?: string; // 可选参数、设置渐变色的起始颜色(all)\n targetColor?: string; // 可选参数、设置渐变色的终点颜色(all)\n opacityLinear?: {\n enable: boolean;\n dir: string;\n };\n lightEnable: boolean;\n heightfixed?: boolean; // 圆柱体高度是否固定(不随 zoom 发生变化)\n\n offsets?: styleOffset;\n blend?: string;\n unit?: string;\n mask?: boolean;\n maskInside?: boolean;\n\n rotation?: number; // angle\n speed?: number;\n featureId?: string;\n sourceLayer?: string;\n}\n\nexport interface IPolygonLayerStyleOptions {\n tileOrigin?: number[];\n coord?: string;\n opacity?: number;\n\n opacityLinear?: {\n enable: boolean;\n dir: string;\n };\n\n topsurface?: boolean;\n sidesurface?: boolean;\n\n mapTexture?: string; // 挤出几何体顶面贴图\n raisingHeight?: number; // 挤出几何体抬升高度\n sourceColor?: string; // 可选参数、设置渐变色的起始颜色(all)\n targetColor?: string; // 可选参数、设置渐变色的终点颜色(all)\n heightfixed?: boolean; // 挤出几何体高度是否固定(不随 zoom 发生变化)\n\n pickLight: boolean;\n mask?: boolean;\n maskInside?: boolean;\n\n // water\n waterTexture?: string;\n speed?: number;\n // ocean\n watercolor?: string;\n watercolor2?: string;\n\n featureId?: string;\n sourceLayer?: string;\n}\n\n// 栅格瓦片图层\nexport interface IRasterTileLayerStyleOptions {\n // TODO: define\n zIndex?: number;\n opacity?: number;\n}\nexport interface IMaskLayerStyleOptions {\n opacity: styleSingle;\n}\n\nexport interface IWindLayerStyleOptions {\n uMin?: number;\n uMax?: number;\n vMin?: number;\n vMax?: number;\n fadeOpacity?: number;\n speedFactor?: number;\n dropRate?: number;\n dropRateBump?: number;\n opacity?: number;\n numParticles?: number;\n rampColors?: {\n [key: number]: string;\n };\n sizeScale?: number;\n}\n\nexport interface IImageLayerStyleOptions {\n opacity: number;\n mask?: boolean;\n maskInside?: boolean;\n}\n\nexport interface IGeometryLayerStyleOptions {\n opacity: number;\n mask?: boolean;\n maskInside?: boolean;\n\n mapTexture?: string;\n terrainTexture?: string;\n\n // planeGeometry\n center?: [number, number];\n width?: number;\n height?: number;\n\n widthSegments?: number;\n heightSegments?: number;\n\n terrainClipHeight?: number;\n rgb2height?: (r: number, g: number, b: number) => number;\n\n // billboard\n raisingHeight?: number; // 抬升高度\n canvasWidth?: number;\n canvasHeight?: number;\n drawCanvas?: (canvas: HTMLCanvasElement) => void;\n\n // sprite\n spriteAnimate?: string;\n spriteRadius?: number;\n spriteCount?: number;\n spriteSpeed?: number;\n spriteTop?: number;\n spriteBottom?: number;\n spriteUpdate?: number;\n spriteScale?: number;\n\n animateOption?: IAnimateOption;\n}\n\nexport enum CanvasUpdateType {\n 'ALWAYS' = 'always',\n 'DRAGEND' = 'dragend',\n}\n\nexport interface IDrawingOnCanvas {\n canvas: HTMLCanvasElement;\n ctx: CanvasRenderingContext2D;\n mapService: IMapService;\n size: [number, number];\n}\nexport interface ICanvasLayerStyleOptions {\n zIndex: number;\n update: CanvasUpdateType | string;\n drawingOnCanvas: (option: IDrawingOnCanvas) => void;\n}\n\nexport interface IHeatMapLayerStyleOptions {\n opacity: number;\n intensity: number;\n radius: number;\n angle: number;\n rampColors: IColorRamp;\n mask?: boolean;\n maskInside?: boolean;\n\n coverage?: number;\n}\n\nexport interface IRasterLayerStyleOptions {\n opacity: number;\n domain: [number, number];\n noDataValue: number;\n clampLow: boolean;\n clampHigh: boolean;\n rampColors: IColorRamp;\n mask?: boolean;\n maskInside?: boolean;\n rampColorsData?: ImageData | IImagedata;\n}\n"],"file":"interface.js"}
1
+ {"version":3,"sources":["../../src/core/interface.ts"],"names":["lineStyleType","CanvasUpdateType"],"mappings":";;;;;;IAIYA,a;;;WAAAA,a;AAAAA,EAAAA,a,CAAAA,a;AAAAA,EAAAA,a,CAAAA,a;GAAAA,a,6BAAAA,a;;IA2NAC,gB;;;WAAAA,gB;AAAAA,EAAAA,gB;AAAAA,EAAAA,gB;GAAAA,gB,gCAAAA,gB","sourcesContent":["import { IAnimateOption, IMapService } from '@antv/l7-core';\nimport { IColorRamp, IImagedata } from '@antv/l7-utils';\nimport { styleOffset, styleSingle } from '../core/BaseModel';\nimport { anchorType } from '../utils/symbol-layout';\nexport enum lineStyleType {\n 'solid' = 0.0,\n 'dash' = 1.0,\n}\n\ninterface ILineArrow {\n enable: boolean;\n arrowWidth: number;\n arrowHeight: number;\n tailWidth: number;\n}\n\nexport interface ILineLayerStyleOptions {\n tileOrigin?: number[];\n coord?: string;\n\n opacity: styleSingle;\n lineType?: keyof typeof lineStyleType; // 可选参数、线类型(all - dash/solid)\n dashArray?: [number, number]; // 可选参数、虚线间隔\n segmentNumber?: number;\n\n depth?: boolean;\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 raisingHeight?: number; // 线图层抬升高度\n\n mask?: boolean; // 可选参数 时候允许蒙层\n maskInside?: boolean; // 可选参数 控制图层是否显示在蒙层的内部\n\n arrow?: ILineArrow;\n\n rampColors?: IColorRamp;\n featureId?: string;\n sourceLayer?: string;\n enablePicking?: boolean;\n workerEnabled?: boolean;\n}\n\nexport interface IPointLayerStyleOptions {\n tileOrigin?: number[];\n coord?: string;\n opacity: number;\n strokeOpacity: number;\n strokeWidth: number;\n stroke: string;\n\n blur?: number;\n\n // text\n textOffset?: [number, number];\n textAnchor?: anchorType;\n spacing?: number;\n padding?: [number, number];\n halo?: number;\n gamma?: number;\n fontWeight?: string;\n fontFamily?: string;\n textAllowOverlap?: boolean;\n\n raisingHeight?: number; // 线图层抬升高度\n\n // cylinder\n pickLight?: boolean;\n depth?: boolean;\n sourceColor?: string; // 可选参数、设置渐变色的起始颜色(all)\n targetColor?: string; // 可选参数、设置渐变色的终点颜色(all)\n opacityLinear?: {\n enable: boolean;\n dir: string;\n };\n lightEnable: boolean;\n heightfixed?: boolean; // 圆柱体高度是否固定(不随 zoom 发生变化)\n\n offsets?: styleOffset;\n blend?: string;\n unit?: string;\n mask?: boolean;\n maskInside?: boolean;\n\n rotation?: number; // angle\n speed?: number;\n featureId?: string;\n sourceLayer?: string;\n}\n\nexport interface IPolygonLayerStyleOptions {\n tileOrigin?: number[];\n coord?: string;\n opacity?: number;\n\n opacityLinear?: {\n enable: boolean;\n dir: string;\n };\n\n topsurface?: boolean;\n sidesurface?: boolean;\n\n mapTexture?: string; // 挤出几何体顶面贴图\n raisingHeight?: number; // 挤出几何体抬升高度\n sourceColor?: string; // 可选参数、设置渐变色的起始颜色(all)\n targetColor?: string; // 可选参数、设置渐变色的终点颜色(all)\n heightfixed?: boolean; // 挤出几何体高度是否固定(不随 zoom 发生变化)\n\n pickLight: boolean;\n mask?: boolean;\n maskInside?: boolean;\n\n // water\n waterTexture?: string;\n speed?: number;\n // ocean\n watercolor?: string;\n watercolor2?: string;\n\n featureId?: string;\n sourceLayer?: string;\n}\n\n// 栅格瓦片图层\nexport interface IRasterTileLayerStyleOptions {\n // TODO: define\n zIndex?: number;\n opacity?: number;\n}\nexport interface IMaskLayerStyleOptions {\n opacity: styleSingle;\n}\n\nexport interface IWindLayerStyleOptions {\n uMin?: number;\n uMax?: number;\n vMin?: number;\n vMax?: number;\n fadeOpacity?: number;\n speedFactor?: number;\n dropRate?: number;\n dropRateBump?: number;\n opacity?: number;\n numParticles?: number;\n rampColors?: {\n [key: number]: string;\n };\n sizeScale?: number;\n\n mask?: boolean;\n maskInside?: boolean;\n}\n\nexport interface IImageLayerStyleOptions {\n opacity: number;\n mask?: boolean;\n maskInside?: boolean;\n\n domain?: [number, number];\n noDataValue?: number;\n clampLow?: boolean;\n clampHigh?: boolean;\n rampColors?: IColorRamp;\n rampColorsData?: ImageData | IImagedata;\n pixelConstant?: number;\n pixelConstantR?: number;\n pixelConstantG?: number;\n pixelConstantB?: number;\n pixelConstantRGB?: number;\n}\n\nexport interface IGeometryLayerStyleOptions {\n opacity: number;\n mask?: boolean;\n maskInside?: boolean;\n\n mapTexture?: string;\n terrainTexture?: string;\n\n // planeGeometry\n center?: [number, number];\n width?: number;\n height?: number;\n\n widthSegments?: number;\n heightSegments?: number;\n\n terrainClipHeight?: number;\n rgb2height?: (r: number, g: number, b: number) => number;\n\n // billboard\n raisingHeight?: number; // 抬升高度\n canvasWidth?: number;\n canvasHeight?: number;\n drawCanvas?: (canvas: HTMLCanvasElement) => void;\n\n // sprite\n spriteAnimate?: string;\n spriteRadius?: number;\n spriteCount?: number;\n spriteSpeed?: number;\n spriteTop?: number;\n spriteBottom?: number;\n spriteUpdate?: number;\n spriteScale?: number;\n\n animateOption?: IAnimateOption;\n}\n\nexport enum CanvasUpdateType {\n 'ALWAYS' = 'always',\n 'DRAGEND' = 'dragend',\n}\n\nexport interface IDrawingOnCanvas {\n canvas: HTMLCanvasElement;\n ctx: CanvasRenderingContext2D;\n mapService: IMapService;\n size: [number, number];\n}\nexport interface ICanvasLayerStyleOptions {\n zIndex: number;\n update: CanvasUpdateType | string;\n drawingOnCanvas: (option: IDrawingOnCanvas) => void;\n}\n\nexport interface IHeatMapLayerStyleOptions {\n opacity: number;\n intensity: number;\n radius: number;\n angle: number;\n rampColors: IColorRamp;\n mask?: boolean;\n maskInside?: boolean;\n\n coverage?: number;\n}\n\nexport interface IRasterLayerStyleOptions {\n opacity: number;\n domain: [number, number];\n noDataValue: number;\n clampLow: boolean;\n clampHigh: boolean;\n rampColors: IColorRamp;\n mask?: boolean;\n maskInside?: boolean;\n rampColorsData?: ImageData | IImagedata;\n}\n"],"file":"interface.js"}