@antv/l7-layers 2.8.15 → 2.8.18

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 (65) hide show
  1. package/es/Geometry/models/plane.js +16 -4
  2. package/es/Geometry/models/plane.js.map +1 -1
  3. package/es/citybuliding/models/build.js +5 -1
  4. package/es/citybuliding/models/build.js.map +1 -1
  5. package/es/core/BaseLayer.js +0 -2
  6. package/es/core/BaseLayer.js.map +1 -1
  7. package/es/core/interface.d.ts +6 -0
  8. package/es/core/interface.js.map +1 -1
  9. package/es/heatmap/models/heatmap.js +5 -1
  10. package/es/heatmap/models/heatmap.js.map +1 -1
  11. package/es/line/models/line.js +11 -6
  12. package/es/line/models/line.js.map +1 -1
  13. package/es/plugins/DataMappingPlugin.js +1 -0
  14. package/es/plugins/DataMappingPlugin.js.map +1 -1
  15. package/es/point/models/extrude.js +2 -2
  16. package/es/point/models/extrude.js.map +1 -1
  17. package/es/point/models/fill.js +7 -3
  18. package/es/point/models/fill.js.map +1 -1
  19. package/es/point/models/fillmage.js +8 -4
  20. package/es/point/models/fillmage.js.map +1 -1
  21. package/es/point/models/radar.js +6 -2
  22. package/es/point/models/radar.js.map +1 -1
  23. package/es/point/models/text.js +5 -2
  24. package/es/point/models/text.js.map +1 -1
  25. package/es/polygon/models/extrude.d.ts +7 -2
  26. package/es/polygon/models/extrude.js +121 -8
  27. package/es/polygon/models/extrude.js.map +1 -1
  28. package/es/polygon/models/fill.js +4 -0
  29. package/es/polygon/models/fill.js.map +1 -1
  30. package/es/polygon/models/ocean.js +1 -1
  31. package/es/polygon/models/ocean.js.map +1 -1
  32. package/es/polygon/models/water.js +3 -3
  33. package/es/polygon/models/water.js.map +1 -1
  34. package/lib/Geometry/models/plane.js +16 -4
  35. package/lib/Geometry/models/plane.js.map +1 -1
  36. package/lib/citybuliding/models/build.js +5 -1
  37. package/lib/citybuliding/models/build.js.map +1 -1
  38. package/lib/core/BaseLayer.js +0 -2
  39. package/lib/core/BaseLayer.js.map +1 -1
  40. package/lib/core/interface.js.map +1 -1
  41. package/lib/heatmap/models/heatmap.js +4 -0
  42. package/lib/heatmap/models/heatmap.js.map +1 -1
  43. package/lib/line/models/line.js +11 -6
  44. package/lib/line/models/line.js.map +1 -1
  45. package/lib/plugins/DataMappingPlugin.js +1 -0
  46. package/lib/plugins/DataMappingPlugin.js.map +1 -1
  47. package/lib/point/models/extrude.js +1 -1
  48. package/lib/point/models/extrude.js.map +1 -1
  49. package/lib/point/models/fill.js +6 -2
  50. package/lib/point/models/fill.js.map +1 -1
  51. package/lib/point/models/fillmage.js +7 -3
  52. package/lib/point/models/fillmage.js.map +1 -1
  53. package/lib/point/models/radar.js +5 -1
  54. package/lib/point/models/radar.js.map +1 -1
  55. package/lib/point/models/text.js +5 -2
  56. package/lib/point/models/text.js.map +1 -1
  57. package/lib/polygon/models/extrude.js +122 -7
  58. package/lib/polygon/models/extrude.js.map +1 -1
  59. package/lib/polygon/models/fill.js +4 -0
  60. package/lib/polygon/models/fill.js.map +1 -1
  61. package/lib/polygon/models/ocean.js +1 -1
  62. package/lib/polygon/models/ocean.js.map +1 -1
  63. package/lib/polygon/models/water.js +3 -3
  64. package/lib/polygon/models/water.js.map +1 -1
  65. package/package.json +5 -5
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/point/models/fill.ts"],"names":["AttributeType","gl","getMask","BaseModel","GlobelPointFillTriangulation","PointFillTriangulation","Version","mat4","vec3","FillModel","layer","getLayerConfig","opacity","strokeOpacity","strokeWidth","stroke","offsets","blend","dataTextureTest","dataTextureNeedUpdate","judgeStyleAttributes","encodeData","getEncodedData","calDataFrame","cellLength","cellProperties","data","width","height","rowCount","dataTexture","length","createTexture2D","flipY","format","LUMINANCE","type","FLOAT","u_isMeter","Number","isMeter","u_additive","u_globel","mapService","version","GLOBEL","u_dataTexture","u_cellTypeLayout","getCellTypeLayout","u_opacity","u_stroke_opacity","u_stroke_width","u_stroke_color","getStrokeColor","u_offsets","isOffsetStatic","animateOption","enable","u_aimate","animateOption2Array","u_time","getLayerAnimateTime","styleAttributeService","createAttributesAndIndices","unit","L7MAP","calMeter2Coord","buildModels","getSource","extent","minLng","minLat","maxLng","maxLat","center","MAPBOX","window","mapboxgl","MercatorCoordinate","coord","fromLngLat","lng","lat","offsetInMeters","offsetInMercatorCoordinateUnits","meterInMercatorCoordinateUnits","westCoord","x","y","z","westLnglat","toLngLat","meter2coord","m1","meterToCoord","m2","Boolean","mask","maskInside","getShaders","frag","vert","isGlobel","buildLayerModel","moduleName","vertexShader","fragmentShader","triangulation","depth","getBlend","stencil","waveFillFrag","pointFillVert","pointFillFrag","destroy","option","speed","rings","registerStyleAttribute","name","Attribute","descriptor","buffer","usage","DYNAMIC_DRAW","size","update","feature","featureIdx","vertex","attributeIdx","extrude","n1","fromValues","n2","xzReg","angle","Math","PI","yReg","asin","m","create","rotateY","rotateX","v1","transformMat4","normalize","v2","v3","v4","extrudeIndex","Array","isArray","shape","shape2d","shapeIndex","indexOf"],"mappings":";;;;;;;;;;;;;;;AAAA,SACEA,aADF,EAEEC,EAFF,QAUO,eAVP;AAWA,SAASC,OAAT,QAAwB,gBAAxB;AACA,OAAOC,SAAP,MAAsB,sBAAtB;AAEA,SACEC,4BADF,EAEEC,sBAFF,QAGO,0BAHP;;;;AAYA,SAASC,OAAT,QAAwB,eAAxB;AACA,SAASC,IAAT,EAAeC,IAAf,QAA2B,WAA3B;;IACqBC,S;;;;;;;;;;;;;;;;kEACU,C;;8DACF,K;;;;;;;WAC3B,wBAAqC;AACnC,iBAOI,KAAKC,KAAL,CAAWC,cAAX,EAPJ;AAAA,8BACEC,OADF;AAAA,UACEA,OADF,6BACY,CADZ;AAAA,oCAEEC,aAFF;AAAA,UAEEA,aAFF,mCAEkB,CAFlB;AAAA,kCAGEC,WAHF;AAAA,UAGEA,WAHF,iCAGgB,CAHhB;AAAA,6BAIEC,MAJF;AAAA,UAIEA,MAJF,4BAIW,eAJX;AAAA,8BAKEC,O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C,OAAN,CAAc5B,IAAd,IACH,CAACA,IAAI,CAAC,CAAD,CAAJ,GAAU,MAAI,CAACjC,WAAhB,CADG,GAEH,CAAEiC,IAAD,GAAmB,MAAI,CAACjC,WAAzB,CAFJ;AAGD;AApBS;AAHoC,OAAlD;AA4BA,WAAK9B,qBAAL,CAA2BwD,sBAA3B,CAAkD;AAChDC,QAAAA,IAAI,EAAE,OAD0C;AAEhDnF,QAAAA,IAAI,EAAEpC,aAAa,CAACwH,SAF4B;AAGhDC,QAAAA,UAAU,EAAE;AACVF,UAAAA,IAAI,EAAE,SADI;AAEVG,UAAAA,MAAM,EAAE;AAENC,YAAAA,KAAK,EAAE1H,EAAE,CAAC2H,YAFJ;AAGNlG,YAAAA,IAAI,EAAE,EAHA;AAINU,YAAAA,IAAI,EAAEnC,EAAE,CAACoC;AAJH,WAFE;AAQVwF,UAAAA,IAAI,EAAE,CARI;AASVC,UAAAA,MAAM,EAAE,gBACNC,OADM,EAENC,UAFM,EAGNC,MAHM,EAINC,YAJM,EAKH;AACH,iCAAsBH,OAAtB,CAAQ2B,KAAR;AAAA,gBAAQA,KAAR,+BAAgB,CAAhB;;AACA,gBAAMC,OAAO,GAAG,MAAI,CAACjJ,KAAL,CAAWC,cAAX,GAA4BgJ,OAA5C;;AACA,gBAAMC,UAAU,GAAGD,OAAO,CAACE,OAAR,CAAgBH,KAAhB,CAAnB;AACA,mBAAO,CAACE,UAAD,CAAP;AACD;AAnBS;AAHoC,OAAlD;AAyBD;;;;EA7VoCzJ,S;;SAAlBM,S","sourcesContent":["import {\n AttributeType,\n gl,\n IAnimateOption,\n IAttribute,\n IElements,\n IEncodeFeature,\n ILayerConfig,\n IModel,\n IModelUniform,\n} from '@antv/l7-core';\nimport { getMask } from '@antv/l7-utils';\nimport BaseModel from '../../core/BaseModel';\nimport { IPointLayerStyleOptions } from '../../core/interface';\nimport {\n GlobelPointFillTriangulation,\n PointFillTriangulation,\n} from '../../core/triangulation';\n// animate pointLayer shader - support animate\nimport waveFillFrag from '../shaders/animate/wave_frag.glsl';\n// static pointLayer shader - not support animate\nimport pointFillFrag from '../shaders/fill_frag.glsl';\nimport pointFillVert from '../shaders/fill_vert.glsl';\n\nimport { isNumber } from 'lodash';\n\nimport { Version } from '@antv/l7-maps';\nimport { mat4, vec3 } from 'gl-matrix';\nexport default class FillModel extends BaseModel {\n public meter2coord: number = 1;\n private isMeter: boolean = false;\n public getUninforms(): IModelUniform {\n const {\n opacity = 1,\n strokeOpacity = 1,\n strokeWidth = 0,\n stroke = 'rgba(0,0,0,0)',\n offsets = [0, 0],\n blend,\n } = this.layer.getLayerConfig() as IPointLayerStyleOptions;\n\n if (\n this.dataTextureTest &&\n this.dataTextureNeedUpdate({\n opacity,\n strokeOpacity,\n strokeWidth,\n stroke,\n offsets,\n })\n ) {\n // 判断当前的样式中哪些是需要进行数据映射的,哪些是常量,同时计算用于构建数据纹理的一些中间变量\n this.judgeStyleAttributes({\n opacity,\n strokeOpacity,\n strokeWidth,\n stroke,\n offsets,\n });\n\n const encodeData = this.layer.getEncodedData();\n const { data, width, height } = this.calDataFrame(\n this.cellLength,\n encodeData,\n this.cellProperties,\n );\n this.rowCount = height; // 当前数据纹理有多少行\n\n this.dataTexture =\n this.cellLength > 0 && data.length > 0\n ? this.createTexture2D({\n flipY: true,\n data,\n format: gl.LUMINANCE,\n type: gl.FLOAT,\n width,\n height,\n })\n : this.createTexture2D({\n flipY: true,\n data: [1],\n format: gl.LUMINANCE,\n type: gl.FLOAT,\n width: 1,\n height: 1,\n });\n }\n return {\n u_isMeter: Number(this.isMeter),\n\n u_additive: blend === 'additive' ? 1.0 : 0.0,\n u_globel: this.mapService.version === Version.GLOBEL ? 1 : 0,\n u_dataTexture: this.dataTexture, // 数据纹理 - 有数据映射的时候纹理中带数据,若没有任何数据映射时纹理是 [1]\n u_cellTypeLayout: this.getCellTypeLayout(),\n\n u_opacity: isNumber(opacity) ? opacity : 1.0,\n u_stroke_opacity: isNumber(strokeOpacity) ? strokeOpacity : 1.0,\n u_stroke_width: isNumber(strokeWidth) ? strokeWidth : 0.0,\n u_stroke_color: this.getStrokeColor(stroke),\n u_offsets: this.isOffsetStatic(offsets)\n ? (offsets as [number, number])\n : [0, 0],\n };\n }\n public getAnimateUniforms(): IModelUniform {\n const {\n animateOption = { enable: false },\n } = this.layer.getLayerConfig() as ILayerConfig;\n return {\n u_aimate: this.animateOption2Array(animateOption),\n u_time: this.layer.getLayerAnimateTime(),\n };\n }\n\n public getAttribute(): {\n attributes: {\n [attributeName: string]: IAttribute;\n };\n elements: IElements;\n } {\n return this.styleAttributeService.createAttributesAndIndices(\n this.layer.getEncodedData(),\n PointFillTriangulation,\n );\n }\n\n public initModels(): IModel[] {\n const {\n unit = 'l7size',\n } = this.layer.getLayerConfig() as IPointLayerStyleOptions;\n const { version } = this.mapService;\n if (\n unit === 'meter' &&\n version !== Version.L7MAP &&\n version !== Version.GLOBEL\n ) {\n this.isMeter = true;\n this.calMeter2Coord();\n }\n\n return this.buildModels();\n }\n\n /**\n * 计算等面积点图层(unit meter)笛卡尔坐标标度与世界坐标标度的比例\n * @returns\n */\n public calMeter2Coord() {\n // @ts-ignore\n const [minLng, minLat, maxLng, maxLat] = this.layer.getSource().extent;\n const center = [(minLng + maxLng) / 2, (minLat + maxLat) / 2];\n\n const { version } = this.mapService;\n if (version === Version.MAPBOX && window.mapboxgl.MercatorCoordinate) {\n const coord = window.mapboxgl.MercatorCoordinate.fromLngLat(\n { lng: center[0], lat: center[1] },\n 0,\n );\n const offsetInMeters = 1;\n const offsetInMercatorCoordinateUnits =\n offsetInMeters * coord.meterInMercatorCoordinateUnits();\n const westCoord = new window.mapboxgl.MercatorCoordinate(\n coord.x - offsetInMercatorCoordinateUnits,\n coord.y,\n coord.z,\n );\n const westLnglat = westCoord.toLngLat();\n\n this.meter2coord = center[0] - westLnglat.lng;\n return;\n }\n\n // @ts-ignore\n const m1 = this.mapService.meterToCoord(center, [minLng, minLat]);\n // @ts-ignore\n const m2 = this.mapService.meterToCoord(center, [\n maxLng === minLng ? maxLng + 0.1 : maxLng,\n maxLat === minLat ? minLat + 0.1 : maxLat,\n ]);\n this.meter2coord = (m1 + m2) / 2;\n if (!Boolean(this.meter2coord)) {\n // Tip: 兼容单个数据导致的 m1、m2 为 NaN\n this.meter2coord = 7.70681090738883;\n }\n }\n\n public buildModels(): IModel[] {\n const {\n mask = false,\n maskInside = true,\n animateOption = { enable: false },\n } = this.layer.getLayerConfig() as Partial<\n ILayerConfig & IPointLayerStyleOptions\n >;\n const { frag, vert, type } = this.getShaders(animateOption);\n\n // TODO: 判断当前的点图层的模型是普通地图模式还是地球模式\n const isGlobel = this.mapService.version === 'GLOBEL';\n return [\n this.layer.buildLayerModel({\n moduleName: 'pointfill-' + type,\n vertexShader: vert,\n fragmentShader: frag,\n triangulation: isGlobel\n ? GlobelPointFillTriangulation\n : PointFillTriangulation,\n // depth: { enable: false },\n depth: { enable: isGlobel },\n blend: this.getBlend(),\n stencil: getMask(mask, maskInside),\n }),\n ];\n }\n\n /**\n * 根据 animateOption 的值返回对应的 shader 代码\n * @returns\n */\n public getShaders(\n animateOption: Partial<IAnimateOption>,\n ): { frag: string; vert: string; type: string } {\n if (animateOption.enable) {\n switch (animateOption.type) {\n case 'wave':\n return {\n frag: waveFillFrag,\n vert: pointFillVert,\n type: 'wave',\n };\n default:\n return {\n frag: waveFillFrag,\n vert: pointFillVert,\n type: 'wave',\n };\n }\n } else {\n return {\n frag: pointFillFrag,\n vert: pointFillVert,\n type: 'normal',\n };\n }\n }\n\n public clearModels() {\n this.dataTexture?.destroy();\n }\n\n // overwrite baseModel func\n protected animateOption2Array(option: Partial<IAnimateOption>): number[] {\n return [option.enable ? 0 : 1.0, option.speed || 1, option.rings || 3, 0];\n }\n protected registerBuiltinAttributes() {\n // TODO: 判断当前的点图层的模型是普通地图模式还是地球模式\n const isGlobel = this.mapService.version === 'GLOBEL';\n\n this.styleAttributeService.registerStyleAttribute({\n name: 'extrude',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_Extrude',\n buffer: {\n // give the WebGL driver a hint that this buffer may change\n usage: gl.DYNAMIC_DRAW,\n data: [],\n type: gl.FLOAT,\n },\n size: 3,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n ) => {\n let extrude;\n // 地球模式\n if (isGlobel) {\n const [x, y, z] = vertex;\n const n1 = vec3.fromValues(0, 0, 1);\n const n2 = vec3.fromValues(x, 0, z);\n\n const xzReg =\n x >= 0 ? vec3.angle(n1, n2) : Math.PI * 2 - vec3.angle(n1, n2);\n\n const yReg = Math.PI * 2 - Math.asin(y / 100);\n\n const m = mat4.create();\n mat4.rotateY(m, m, xzReg);\n mat4.rotateX(m, m, yReg);\n\n const v1 = vec3.fromValues(1, 1, 0);\n vec3.transformMat4(v1, v1, m);\n vec3.normalize(v1, v1);\n\n const v2 = vec3.fromValues(-1, 1, 0);\n vec3.transformMat4(v2, v2, m);\n vec3.normalize(v2, v2);\n\n const v3 = vec3.fromValues(-1, -1, 0);\n vec3.transformMat4(v3, v3, m);\n vec3.normalize(v3, v3);\n\n const v4 = vec3.fromValues(1, -1, 0);\n vec3.transformMat4(v4, v4, m);\n vec3.normalize(v4, v4);\n\n extrude = [...v1, ...v2, ...v3, ...v4];\n } else {\n // 平面模式\n extrude = [1, 1, 0, -1, 1, 0, -1, -1, 0, 1, -1, 0];\n }\n\n const extrudeIndex = (attributeIdx % 4) * 3;\n return [\n extrude[extrudeIndex],\n extrude[extrudeIndex + 1],\n extrude[extrudeIndex + 2],\n ];\n },\n },\n });\n\n // point layer size;\n this.styleAttributeService.registerStyleAttribute({\n name: 'size',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_Size',\n buffer: {\n // give the WebGL driver a hint that this buffer may change\n usage: gl.DYNAMIC_DRAW,\n data: [],\n type: gl.FLOAT,\n },\n size: 1,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n ) => {\n const { size = 5 } = feature;\n // console.log('featureIdx', featureIdx, feature)\n return Array.isArray(size)\n ? [size[0] * this.meter2coord]\n : [(size as number) * this.meter2coord];\n },\n },\n });\n\n // point layer size;\n this.styleAttributeService.registerStyleAttribute({\n name: 'shape',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_Shape',\n buffer: {\n // give the WebGL driver a hint that this buffer may change\n usage: gl.DYNAMIC_DRAW,\n data: [],\n type: gl.FLOAT,\n },\n size: 1,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n ) => {\n const { shape = 2 } = feature;\n const shape2d = this.layer.getLayerConfig().shape2d as string[];\n const shapeIndex = shape2d.indexOf(shape as string);\n return [shapeIndex];\n },\n },\n });\n }\n}\n"],"file":"fill.js"}
1
+ {"version":3,"sources":["../../../src/point/models/fill.ts"],"names":["AttributeType","gl","getCullFace","getMask","BaseModel","GlobelPointFillTriangulation","PointFillTriangulation","Version","mat4","vec3","FillModel","layer","getLayerConfig","opacity","strokeOpacity","strokeWidth","stroke","offsets","blend","dataTextureTest","dataTextureNeedUpdate","judgeStyleAttributes","encodeData","getEncodedData","calDataFrame","cellLength","cellProperties","data","width","height","rowCount","dataTexture","length","createTexture2D","flipY","format","LUMINANCE","type","FLOAT","u_isMeter","Number","isMeter","u_additive","u_globel","mapService","version","GLOBEL","u_dataTexture","u_cellTypeLayout","getCellTypeLayout","u_opacity","u_stroke_opacity","u_stroke_width","u_stroke_color","getStrokeColor","u_offsets","isOffsetStatic","animateOption","enable","u_aimate","animateOption2Array","u_time","getLayerAnimateTime","styleAttributeService","createAttributesAndIndices","unit","L7MAP","calMeter2Coord","buildModels","getSource","extent","minLng","minLat","maxLng","maxLat","center","MAPBOX","window","mapboxgl","MercatorCoordinate","coord","fromLngLat","lng","lat","offsetInMeters","offsetInMercatorCoordinateUnits","meterInMercatorCoordinateUnits","westCoord","x","y","z","westLnglat","toLngLat","meter2coord","m1","meterToCoord","m2","Boolean","mask","maskInside","getShaders","frag","vert","isGlobel","buildLayerModel","moduleName","vertexShader","fragmentShader","triangulation","depth","getBlend","stencil","cull","face","waveFillFrag","pointFillVert","pointFillFrag","destroy","option","speed","rings","registerStyleAttribute","name","Attribute","descriptor","buffer","usage","DYNAMIC_DRAW","size","update","feature","featureIdx","vertex","attributeIdx","extrude","n1","fromValues","n2","xzReg","angle","Math","PI","yReg","asin","m","create","rotateY","rotateX","v1","transformMat4","normalize","v2","v3","v4","extrudeIndex","Array","isArray","shape","shape2d","shapeIndex","indexOf"],"mappings":";;;;;;;;;;;;;;;AAAA,SACEA,aADF,EAEEC,EAFF,QAUO,eAVP;AAWA,SAASC,WAAT,EAAsBC,OAAtB,QAAqC,gBAArC;AACA,OAAOC,SAAP,MAAsB,sBAAtB;AAEA,SACEC,4BADF,EAEEC,sBAFF,QAGO,0BAHP;;;;AAYA,SAASC,OAAT,QAAwB,eAAxB;AACA,SAASC,IAAT,EAAeC,IAAf,QAA2B,WAA3B;;IACqBC,S;;;;;;;;;;;;;;;;kEACU,C;;8DACF,K;;;;;;;WAC3B,wBAAqC;AACnC,iBAOI,KAAKC,KAAL,CAAWC,cAAX,EAPJ;AAAA,8BACEC,OADF;AAAA,UACEA,OADF,6BACY,CADZ;AAAA,oCAEEC,aAFF;AAAA,UAEEA,aAFF,mCAEkB,CAFlB;AAAA,kCAGEC,WAHF;AAAA,UAGEA,WAHF,iCAGgB,CAHhB;AAAA,6BAIEC,MAJF;AAAA,UAIEA,MAJF,4BAIW,eAJX;AAAA,8BAKEC,OALF;AAAA,UAKEA,OALF,6BAKY,CAAC,CAAD,EAAI,CAAJ,CALZ;AAAA,UAMEC,KANF,QAMEA,KANF;;AASA,UACE,KAAKC,eAAL,IACA,KAAKC,qBAAL,CAA2B;AACzBP,QAAAA,OAAO,EAAPA,OADyB;AAEzBC,QAAAA,aAAa,EAAbA,aAFyB;AAGzBC,QAAAA,WAAW,EAAXA,WAHyB;AAIzBC,QAAAA,MAAM,EAANA,MAJyB;AAKzB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WAAzB,CAFJ;AAGD;AApBS;AAHoC,OAAlD;AA4BA,WAAK9B,qBAAL,CAA2B0D,sBAA3B,CAAkD;AAChDC,QAAAA,IAAI,EAAE,OAD0C;AAEhDrF,QAAAA,IAAI,EAAErC,aAAa,CAAC2H,SAF4B;AAGhDC,QAAAA,UAAU,EAAE;AACVF,UAAAA,IAAI,EAAE,SADI;AAEVG,UAAAA,MAAM,EAAE;AAENC,YAAAA,KAAK,EAAE7H,EAAE,CAAC8H,YAFJ;AAGNpG,YAAAA,IAAI,EAAE,EAHA;AAINU,YAAAA,IAAI,EAAEpC,EAAE,CAACqC;AAJH,WAFE;AAQV0F,UAAAA,IAAI,EAAE,CARI;AASVC,UAAAA,MAAM,EAAE,gBACNC,OADM,EAENC,UAFM,EAGNC,MAHM,EAINC,YAJM,EAKH;AACH,iCAAsBH,OAAtB,CAAQ2B,KAAR;AAAA,gBAAQA,KAAR,+BAAgB,CAAhB;;AACA,gBAAMC,OAAO,GAAG,MAAI,CAACnJ,KAAL,CAAWC,cAAX,GAA4BkJ,OAA5C;;AACA,gBAAMC,UAAU,GAAGD,OAAO,CAACE,OAAR,CAAgBH,KAAhB,CAAnB;AACA,mBAAO,CAACE,UAAD,CAAP;AACD;AAnBS;AAHoC,OAAlD;AAyBD;;;;EAjWoC3J,S;;SAAlBM,S","sourcesContent":["import {\n AttributeType,\n gl,\n IAnimateOption,\n IAttribute,\n IElements,\n IEncodeFeature,\n ILayerConfig,\n IModel,\n IModelUniform,\n} from '@antv/l7-core';\nimport { getCullFace, getMask } from '@antv/l7-utils';\nimport BaseModel from '../../core/BaseModel';\nimport { IPointLayerStyleOptions } from '../../core/interface';\nimport {\n GlobelPointFillTriangulation,\n PointFillTriangulation,\n} from '../../core/triangulation';\n// animate pointLayer shader - support animate\nimport waveFillFrag from '../shaders/animate/wave_frag.glsl';\n// static pointLayer shader - not support animate\nimport pointFillFrag from '../shaders/fill_frag.glsl';\nimport pointFillVert from '../shaders/fill_vert.glsl';\n\nimport { isNumber } from 'lodash';\n\nimport { Version } from '@antv/l7-maps';\nimport { mat4, vec3 } from 'gl-matrix';\nexport default class FillModel extends BaseModel {\n public meter2coord: number = 1;\n private isMeter: boolean = false;\n public getUninforms(): IModelUniform {\n const {\n opacity = 1,\n strokeOpacity = 1,\n strokeWidth = 0,\n stroke = 'rgba(0,0,0,0)',\n offsets = [0, 0],\n blend,\n } = this.layer.getLayerConfig() as IPointLayerStyleOptions;\n\n if (\n this.dataTextureTest &&\n this.dataTextureNeedUpdate({\n opacity,\n strokeOpacity,\n strokeWidth,\n stroke,\n offsets,\n })\n ) {\n // 判断当前的样式中哪些是需要进行数据映射的,哪些是常量,同时计算用于构建数据纹理的一些中间变量\n this.judgeStyleAttributes({\n opacity,\n strokeOpacity,\n strokeWidth,\n stroke,\n offsets,\n });\n\n const encodeData = this.layer.getEncodedData();\n const { data, width, height } = this.calDataFrame(\n this.cellLength,\n encodeData,\n this.cellProperties,\n );\n this.rowCount = height; // 当前数据纹理有多少行\n\n this.dataTexture =\n this.cellLength > 0 && data.length > 0\n ? this.createTexture2D({\n flipY: true,\n data,\n format: gl.LUMINANCE,\n type: gl.FLOAT,\n width,\n height,\n })\n : this.createTexture2D({\n flipY: true,\n data: [1],\n format: gl.LUMINANCE,\n type: gl.FLOAT,\n width: 1,\n height: 1,\n });\n }\n return {\n u_isMeter: Number(this.isMeter),\n\n u_additive: blend === 'additive' ? 1.0 : 0.0,\n u_globel: this.mapService.version === Version.GLOBEL ? 1 : 0,\n u_dataTexture: this.dataTexture, // 数据纹理 - 有数据映射的时候纹理中带数据,若没有任何数据映射时纹理是 [1]\n u_cellTypeLayout: this.getCellTypeLayout(),\n\n u_opacity: isNumber(opacity) ? opacity : 1.0,\n u_stroke_opacity: isNumber(strokeOpacity) ? strokeOpacity : 1.0,\n u_stroke_width: isNumber(strokeWidth) ? strokeWidth : 0.0,\n u_stroke_color: this.getStrokeColor(stroke),\n u_offsets: this.isOffsetStatic(offsets)\n ? (offsets as [number, number])\n : [0, 0],\n };\n }\n public getAnimateUniforms(): IModelUniform {\n const {\n animateOption = { enable: false },\n } = this.layer.getLayerConfig() as ILayerConfig;\n return {\n u_aimate: this.animateOption2Array(animateOption),\n u_time: this.layer.getLayerAnimateTime(),\n };\n }\n\n public getAttribute(): {\n attributes: {\n [attributeName: string]: IAttribute;\n };\n elements: IElements;\n } {\n return this.styleAttributeService.createAttributesAndIndices(\n this.layer.getEncodedData(),\n PointFillTriangulation,\n );\n }\n\n public initModels(): IModel[] {\n const {\n unit = 'l7size',\n } = this.layer.getLayerConfig() as IPointLayerStyleOptions;\n const { version } = this.mapService;\n if (\n unit === 'meter' &&\n version !== Version.L7MAP &&\n version !== Version.GLOBEL\n ) {\n this.isMeter = true;\n this.calMeter2Coord();\n }\n\n return this.buildModels();\n }\n\n /**\n * 计算等面积点图层(unit meter)笛卡尔坐标标度与世界坐标标度的比例\n * @returns\n */\n public calMeter2Coord() {\n // @ts-ignore\n const [minLng, minLat, maxLng, maxLat] = this.layer.getSource().extent;\n const center = [(minLng + maxLng) / 2, (minLat + maxLat) / 2];\n\n const { version } = this.mapService;\n if (version === Version.MAPBOX && window.mapboxgl.MercatorCoordinate) {\n const coord = window.mapboxgl.MercatorCoordinate.fromLngLat(\n { lng: center[0], lat: center[1] },\n 0,\n );\n const offsetInMeters = 1;\n const offsetInMercatorCoordinateUnits =\n offsetInMeters * coord.meterInMercatorCoordinateUnits();\n const westCoord = new window.mapboxgl.MercatorCoordinate(\n coord.x - offsetInMercatorCoordinateUnits,\n coord.y,\n coord.z,\n );\n const westLnglat = westCoord.toLngLat();\n\n this.meter2coord = center[0] - westLnglat.lng;\n return;\n }\n\n // @ts-ignore\n const m1 = this.mapService.meterToCoord(center, [minLng, minLat]);\n // @ts-ignore\n const m2 = this.mapService.meterToCoord(center, [\n maxLng === minLng ? maxLng + 0.1 : maxLng,\n maxLat === minLat ? minLat + 0.1 : maxLat,\n ]);\n this.meter2coord = (m1 + m2) / 2;\n if (!Boolean(this.meter2coord)) {\n // Tip: 兼容单个数据导致的 m1、m2 为 NaN\n this.meter2coord = 7.70681090738883;\n }\n }\n\n public buildModels(): IModel[] {\n const {\n mask = false,\n maskInside = true,\n animateOption = { enable: false },\n } = this.layer.getLayerConfig() as Partial<\n ILayerConfig & IPointLayerStyleOptions\n >;\n const { frag, vert, type } = this.getShaders(animateOption);\n\n // TODO: 判断当前的点图层的模型是普通地图模式还是地球模式\n const isGlobel = this.mapService.version === 'GLOBEL';\n return [\n this.layer.buildLayerModel({\n moduleName: 'pointfill_' + type,\n vertexShader: vert,\n fragmentShader: frag,\n triangulation: isGlobel\n ? GlobelPointFillTriangulation\n : PointFillTriangulation,\n // depth: { enable: false },\n depth: { enable: isGlobel },\n blend: this.getBlend(),\n stencil: getMask(mask, maskInside),\n cull: {\n enable: true,\n face: getCullFace(this.mapService.version),\n },\n }),\n ];\n }\n\n /**\n * 根据 animateOption 的值返回对应的 shader 代码\n * @returns\n */\n public getShaders(\n animateOption: Partial<IAnimateOption>,\n ): { frag: string; vert: string; type: string } {\n if (animateOption.enable) {\n switch (animateOption.type) {\n case 'wave':\n return {\n frag: waveFillFrag,\n vert: pointFillVert,\n type: 'wave',\n };\n default:\n return {\n frag: waveFillFrag,\n vert: pointFillVert,\n type: 'wave',\n };\n }\n } else {\n return {\n frag: pointFillFrag,\n vert: pointFillVert,\n type: 'normal',\n };\n }\n }\n\n public clearModels() {\n this.dataTexture?.destroy();\n }\n\n // overwrite baseModel func\n protected animateOption2Array(option: Partial<IAnimateOption>): number[] {\n return [option.enable ? 0 : 1.0, option.speed || 1, option.rings || 3, 0];\n }\n protected registerBuiltinAttributes() {\n // TODO: 判断当前的点图层的模型是普通地图模式还是地球模式\n const isGlobel = this.mapService.version === 'GLOBEL';\n\n this.styleAttributeService.registerStyleAttribute({\n name: 'extrude',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_Extrude',\n buffer: {\n // give the WebGL driver a hint that this buffer may change\n usage: gl.DYNAMIC_DRAW,\n data: [],\n type: gl.FLOAT,\n },\n size: 3,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n ) => {\n let extrude;\n // 地球模式\n if (isGlobel) {\n const [x, y, z] = vertex;\n const n1 = vec3.fromValues(0, 0, 1);\n const n2 = vec3.fromValues(x, 0, z);\n\n const xzReg =\n x >= 0 ? vec3.angle(n1, n2) : Math.PI * 2 - vec3.angle(n1, n2);\n\n const yReg = Math.PI * 2 - Math.asin(y / 100);\n\n const m = mat4.create();\n mat4.rotateY(m, m, xzReg);\n mat4.rotateX(m, m, yReg);\n\n const v1 = vec3.fromValues(1, 1, 0);\n vec3.transformMat4(v1, v1, m);\n vec3.normalize(v1, v1);\n\n const v2 = vec3.fromValues(-1, 1, 0);\n vec3.transformMat4(v2, v2, m);\n vec3.normalize(v2, v2);\n\n const v3 = vec3.fromValues(-1, -1, 0);\n vec3.transformMat4(v3, v3, m);\n vec3.normalize(v3, v3);\n\n const v4 = vec3.fromValues(1, -1, 0);\n vec3.transformMat4(v4, v4, m);\n vec3.normalize(v4, v4);\n\n extrude = [...v1, ...v2, ...v3, ...v4];\n } else {\n // 平面模式\n extrude = [1, 1, 0, -1, 1, 0, -1, -1, 0, 1, -1, 0];\n }\n\n const extrudeIndex = (attributeIdx % 4) * 3;\n return [\n extrude[extrudeIndex],\n extrude[extrudeIndex + 1],\n extrude[extrudeIndex + 2],\n ];\n },\n },\n });\n\n // point layer size;\n this.styleAttributeService.registerStyleAttribute({\n name: 'size',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_Size',\n buffer: {\n // give the WebGL driver a hint that this buffer may change\n usage: gl.DYNAMIC_DRAW,\n data: [],\n type: gl.FLOAT,\n },\n size: 1,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n ) => {\n const { size = 5 } = feature;\n // console.log('featureIdx', featureIdx, feature)\n return Array.isArray(size)\n ? [size[0] * this.meter2coord]\n : [(size as number) * this.meter2coord];\n },\n },\n });\n\n // point layer size;\n this.styleAttributeService.registerStyleAttribute({\n name: 'shape',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_Shape',\n buffer: {\n // give the WebGL driver a hint that this buffer may change\n usage: gl.DYNAMIC_DRAW,\n data: [],\n type: gl.FLOAT,\n },\n size: 1,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n ) => {\n const { shape = 2 } = feature;\n const shape2d = this.layer.getLayerConfig().shape2d as string[];\n const shapeIndex = shape2d.indexOf(shape as string);\n return [shapeIndex];\n },\n },\n });\n }\n}\n"],"file":"fill.js"}
@@ -13,7 +13,7 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
13
13
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
14
14
 
15
15
  import { AttributeType, gl } from '@antv/l7-core';
16
- import { getMask } from '@antv/l7-utils';
16
+ import { getCullFace, getMask } from '@antv/l7-utils';
17
17
  import BaseModel from '../../core/BaseModel';
18
18
  import { PointFillTriangulation } from '../../core/triangulation';
19
19
  var pointFillFrag = "uniform sampler2D u_texture;\nuniform vec2 u_textSize;\n\nuniform float u_additive;\n\nvarying mat4 styleMappingMat; // \u4F20\u9012\u4ECE\u7247\u5143\u4E2D\u4F20\u9012\u7684\u6620\u5C04\u6570\u636E\n\nvarying float v_radius;\n\n#pragma include \"sdf_2d\"\n#pragma include \"picking\"\nvarying vec2 v_uv; // \u672C\u8EAB\u7684 uv \u5750\u6807\nvarying vec2 v_Iconuv;\n\nvoid main() {\n\n float opacity = styleMappingMat[0][0];\n\n vec2 pos = v_Iconuv / u_textSize + v_uv / u_textSize * 64.;\n gl_FragColor = texture2D(u_texture, pos);\n gl_FragColor.a *= opacity;\n\n gl_FragColor = filterColor(gl_FragColor);\n}\n";
@@ -234,7 +234,11 @@ var FillImageModel = function (_BaseModel) {
234
234
  enable: false
235
235
  },
236
236
  blend: this.getBlend(),
237
- stencil: getMask(mask, maskInside)
237
+ stencil: getMask(mask, maskInside),
238
+ cull: {
239
+ enable: true,
240
+ face: getCullFace(this.mapService.version)
241
+ }
238
242
  })];
239
243
  }
240
244
  }, {
@@ -249,10 +253,10 @@ var FillImageModel = function (_BaseModel) {
249
253
  }, {
250
254
  key: "clearModels",
251
255
  value: function clearModels() {
252
- var _this$dataTexture;
256
+ var _this$texture, _this$dataTexture;
253
257
 
254
258
  this.iconService.off('imageUpdate', this.updateTexture);
255
- this.texture.destroy();
259
+ (_this$texture = this.texture) === null || _this$texture === void 0 ? void 0 : _this$texture.destroy();
256
260
  (_this$dataTexture = this.dataTexture) === null || _this$dataTexture === void 0 ? void 0 : _this$dataTexture.destroy();
257
261
  }
258
262
  }, {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/point/models/fillmage.ts"],"names":["AttributeType","gl","getMask","BaseModel","PointFillTriangulation","Version","FillImageModel","createTexture2D","rendererService","texture","update","data","iconService","getCanvas","mag","min","mipmap","layer","renderLayers","LINEAR","LINEAR_MIPMAP_LINEAR","premultiplyAlpha","width","height","canvasHeight","getLayerConfig","opacity","strokeOpacity","strokeWidth","stroke","offsets","blend","rotation","getDirty","bind","rotateFlag","mapService","version","radian","Math","PI","getRotation","dataTextureTest","dataTextureNeedUpdate","judgeStyleAttributes","encodeData","getEncodedData","calDataFrame","cellLength","cellProperties","rowCount","dataTexture","length","flipY","format","LUMINANCE","type","FLOAT","u_isMeter","Number","isMeter","u_RotateMatrix","Float32Array","cos","sin","u_additive","u_dataTexture","u_cellTypeLayout","getCellTypeLayout","u_texture","u_textSize","u_opacity","u_offsets","isOffsetStatic","styleAttributeService","createAttributesAndIndices","updateTexture","on","unit","L7MAP","GLOBEL","calMeter2Coord","buildModels","getSource","extent","minLng","minLat","maxLng","maxLat","center","MAPBOX","window","mapboxgl","MercatorCoordinate","coord","fromLngLat","lng","lat","offsetInMeters","offsetInMercatorCoordinateUnits","meterInMercatorCoordinateUnits","westCoord","x","y","z","westLnglat","toLngLat","meter2coord","m1","meterToCoord","m2","Boolean","mask","maskInside","getShaders","frag","vert","buildLayerModel","moduleName","vertexShader","fragmentShader","triangulation","depth","enable","getBlend","stencil","pointFillFrag","pointFillVert","off","destroy","registerStyleAttribute","name","Attribute","descriptor","buffer","usage","DYNAMIC_DRAW","size","feature","featureIdx","vertex","attributeIdx","iconMap","getIconMap","shape","extrude","extrudeIndex","Array","isArray"],"mappings":";;;;;;;;;;;;;;AAAA,SACEA,aADF,EAEEC,EAFF,QASO,eATP;AAUA,SAASC,OAAT,QAAwB,gBAAxB;AACA,OAAOC,SAAP,MAAsB,sBAAtB;AAEA,SAASC,sBAAT,QAAuC,0BAAvC;;;AAOA,SAASC,OAAT,QAAwB,eAAxB;;IAEqBC,c;;;;;;;;;;;;;;;;kEACU,C;;;;8DAEF,K;;6DACF,C;;oEA2SD,YAAM;AAC5B,UAAQC,eAAR,GAA4B,MAAKC,eAAjC,CAAQD,eAAR;;AACA,UAAI,MAAKE,OAAT,EAAkB;AAChB,cAAKA,OAAL,CAAaC,MAAb,CAAoB;AAClBC,UAAAA,IAAI,EAAE,MAAKC,WAAL,CAAiBC,SAAjB,EADY;AAElBC,UAAAA,GAAG,EAAE,QAFa;AAGlBC,UAAAA,GAAG,EAAE,uBAHa;AAIlBC,UAAAA,MAAM,EAAE;AAJU,SAApB;;AAQA,cAAKC,KAAL,CAAWC,YAAX;;AACA;AACD;;AACD,YAAKT,OAAL,GAAeF,eAAe,CAAC;AAC7BI,QAAAA,IAAI,EAAE,MAAKC,WAAL,CAAiBC,SAAjB,EADuB;AAE7BC,QAAAA,GAAG,EAAEb,EAAE,CAACkB,MAFqB;AAI7BJ,QAAAA,GAAG,EAAEd,EAAE,CAACmB,oBAJqB;AAK7BC,QAAAA,gBAAgB,EAAE,KALW;AAM7BC,QAA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AAA,IAAI,EAAEvD,EAAE,CAACwD;AAJH,WAFE;AAQVgF,UAAAA,IAAI,EAAE,CARI;AASV/H,UAAAA,MAAM,EAAE,gBACNgI,OADM,EAENC,UAFM,EAGNC,MAHM,EAINC,YAJM,EAKH;AACH,gCAAqBH,OAArB,CAAQD,IAAR;AAAA,gBAAQA,IAAR,8BAAe,CAAf;AAEA,mBAAOU,KAAK,CAACC,OAAN,CAAcX,IAAd,IACH,CAACA,IAAI,CAAC,CAAD,CAAJ,GAAU,MAAI,CAAC9B,WAAhB,CADG,GAEH,CAAE8B,IAAD,GAAmB,MAAI,CAAC9B,WAAzB,CAFJ;AAGD;AApBS;AAHoC,OAAlD;AA0BD;;;;EA7SyCxG,S;;SAAvBG,c","sourcesContent":["import {\n AttributeType,\n gl,\n IAttribute,\n IElements,\n IEncodeFeature,\n IModel,\n IModelUniform,\n ITexture2D,\n} from '@antv/l7-core';\nimport { getMask } from '@antv/l7-utils';\nimport BaseModel from '../../core/BaseModel';\nimport { IPointLayerStyleOptions } from '../../core/interface';\nimport { PointFillTriangulation } from '../../core/triangulation';\n// static pointLayer shader - not support animate\nimport pointFillFrag from '../shaders/image/fillImage_frag.glsl';\nimport pointFillVert from '../shaders/image/fillImage_vert.glsl';\n\nimport { isNumber } from 'lodash';\n\nimport { Version } from '@antv/l7-maps';\n\nexport default class FillImageModel extends BaseModel {\n public meter2coord: number = 1;\n private texture: ITexture2D;\n private isMeter: boolean = false;\n private radian: number = 0; // 旋转的弧度\n public getUninforms(): IModelUniform {\n const {\n opacity = 1,\n strokeOpacity = 1,\n strokeWidth = 0,\n stroke = 'rgba(0,0,0,0)',\n offsets = [0, 0],\n blend,\n rotation,\n } = this.layer.getLayerConfig() as IPointLayerStyleOptions;\n\n if (this.rendererService.getDirty()) {\n this.texture.bind();\n }\n\n /**\n * rotateFlag\n * L7MAP 1\n * MAPBOX 1\n * GAODE2.x -1\n * GAODE1.x -1\n */\n let rotateFlag = 1;\n if (\n this.mapService.version === 'GAODE2.x' ||\n this.mapService.version === 'GAODE1.x'\n ) {\n rotateFlag = -1;\n }\n // 控制图标的旋转角度(绕 Z 轴旋转)\n this.radian = rotation\n ? (rotateFlag * Math.PI * rotation) / 180\n : (rotateFlag * Math.PI * (this.mapService.getRotation() % 360)) / 180;\n\n if (\n this.dataTextureTest &&\n this.dataTextureNeedUpdate({\n opacity,\n strokeOpacity,\n strokeWidth,\n stroke,\n offsets,\n })\n ) {\n // 判断当前的样式中哪些是需要进行数据映射的,哪些是常量,同时计算用于构建数据纹理的一些中间变量\n this.judgeStyleAttributes({\n opacity,\n strokeOpacity,\n strokeWidth,\n stroke,\n offsets,\n });\n\n const encodeData = this.layer.getEncodedData();\n const { data, width, height } = this.calDataFrame(\n this.cellLength,\n encodeData,\n this.cellProperties,\n );\n this.rowCount = height; // 当前数据纹理有多少行\n\n this.dataTexture =\n this.cellLength > 0 && data.length > 0\n ? this.createTexture2D({\n flipY: true,\n data,\n format: gl.LUMINANCE,\n type: gl.FLOAT,\n width,\n height,\n })\n : this.createTexture2D({\n flipY: true,\n data: [1],\n format: gl.LUMINANCE,\n type: gl.FLOAT,\n width: 1,\n height: 1,\n });\n }\n return {\n u_isMeter: Number(this.isMeter),\n u_RotateMatrix: new Float32Array([\n Math.cos(this.radian),\n Math.sin(this.radian),\n -Math.sin(this.radian),\n Math.cos(this.radian),\n ]),\n u_additive: blend === 'additive' ? 1.0 : 0.0,\n\n u_dataTexture: this.dataTexture, // 数据纹理 - 有数据映射的时候纹理中带数据,若没有任何数据映射时纹理是 [1]\n u_cellTypeLayout: this.getCellTypeLayout(),\n\n u_texture: this.texture,\n u_textSize: [1024, this.iconService.canvasHeight || 128],\n\n u_opacity: isNumber(opacity) ? opacity : 1.0,\n u_offsets: this.isOffsetStatic(offsets)\n ? (offsets as [number, number])\n : [0, 0],\n };\n }\n\n public getAttribute(): {\n attributes: {\n [attributeName: string]: IAttribute;\n };\n elements: IElements;\n } {\n return this.styleAttributeService.createAttributesAndIndices(\n this.layer.getEncodedData(),\n PointFillTriangulation,\n );\n }\n\n public initModels(): IModel[] {\n this.updateTexture();\n this.iconService.on('imageUpdate', this.updateTexture);\n\n const {\n unit = 'l7size',\n } = this.layer.getLayerConfig() as IPointLayerStyleOptions;\n const { version } = this.mapService;\n if (\n unit === 'meter' &&\n version !== Version.L7MAP &&\n version !== Version.GLOBEL\n ) {\n this.isMeter = true;\n this.calMeter2Coord();\n }\n\n return this.buildModels();\n }\n\n /**\n * 计算等面积点图层(unit meter)笛卡尔坐标标度与世界坐标标度的比例\n * @returns\n */\n public calMeter2Coord() {\n // @ts-ignore\n const [minLng, minLat, maxLng, maxLat] = this.layer.getSource().extent;\n const center = [(minLng + maxLng) / 2, (minLat + maxLat) / 2];\n\n const { version } = this.mapService;\n if (version === Version.MAPBOX && window.mapboxgl.MercatorCoordinate) {\n const coord = window.mapboxgl.MercatorCoordinate.fromLngLat(\n { lng: center[0], lat: center[1] },\n 0,\n );\n const offsetInMeters = 1;\n const offsetInMercatorCoordinateUnits =\n offsetInMeters * coord.meterInMercatorCoordinateUnits();\n const westCoord = new window.mapboxgl.MercatorCoordinate(\n coord.x - offsetInMercatorCoordinateUnits,\n coord.y,\n coord.z,\n );\n const westLnglat = westCoord.toLngLat();\n\n this.meter2coord = center[0] - westLnglat.lng;\n return;\n }\n\n // @ts-ignore\n const m1 = this.mapService.meterToCoord(center, [minLng, minLat]);\n // @ts-ignore\n const m2 = this.mapService.meterToCoord(center, [\n maxLng === minLng ? maxLng + 0.1 : maxLng,\n maxLat === minLat ? minLat + 0.1 : maxLat,\n ]);\n this.meter2coord = (m1 + m2) / 2;\n if (!Boolean(this.meter2coord)) {\n // Tip: 兼容单个数据导致的 m1、m2 为 NaN\n this.meter2coord = 7.70681090738883;\n }\n }\n\n public buildModels(): IModel[] {\n const {\n mask = false,\n maskInside = true,\n } = this.layer.getLayerConfig() as IPointLayerStyleOptions;\n const { frag, vert, type } = this.getShaders();\n return [\n this.layer.buildLayerModel({\n moduleName: 'pointfill_' + type,\n vertexShader: vert,\n fragmentShader: frag,\n triangulation: PointFillTriangulation,\n depth: { enable: false },\n blend: this.getBlend(),\n stencil: getMask(mask, maskInside),\n }),\n ];\n }\n\n public getShaders(): { frag: string; vert: string; type: string } {\n return {\n frag: pointFillFrag,\n vert: pointFillVert,\n type: 'normal',\n };\n }\n\n public clearModels() {\n this.iconService.off('imageUpdate', this.updateTexture);\n this.texture.destroy();\n this.dataTexture?.destroy();\n }\n\n // overwrite baseModel func\n protected registerBuiltinAttributes() {\n this.styleAttributeService.registerStyleAttribute({\n name: 'uv',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_Uv',\n buffer: {\n // give the WebGL driver a hint that this buffer may change\n usage: gl.DYNAMIC_DRAW,\n data: [],\n type: gl.FLOAT,\n },\n size: 2,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n ) => {\n const iconMap = this.iconService.getIconMap();\n const { shape } = feature;\n const { x, y } = iconMap[shape as string] || { x: 0, y: 0 };\n return [x, y];\n },\n },\n });\n\n this.styleAttributeService.registerStyleAttribute({\n name: 'extrude',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_Extrude',\n buffer: {\n // give the WebGL driver a hint that this buffer may change\n usage: gl.DYNAMIC_DRAW,\n data: [],\n type: gl.FLOAT,\n },\n size: 3,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n ) => {\n const extrude = [1, 1, 0, -1, 1, 0, -1, -1, 0, 1, -1, 0];\n\n const extrudeIndex = (attributeIdx % 4) * 3;\n return [\n extrude[extrudeIndex],\n extrude[extrudeIndex + 1],\n extrude[extrudeIndex + 2],\n ];\n },\n },\n });\n\n // point layer size;\n this.styleAttributeService.registerStyleAttribute({\n name: 'size',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_Size',\n buffer: {\n // give the WebGL driver a hint that this buffer may change\n usage: gl.DYNAMIC_DRAW,\n data: [],\n type: gl.FLOAT,\n },\n size: 1,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n ) => {\n const { size = 5 } = feature;\n // console.log('featureIdx', featureIdx, feature)\n return Array.isArray(size)\n ? [size[0] * this.meter2coord]\n : [(size as number) * this.meter2coord];\n },\n },\n });\n }\n\n private updateTexture = () => {\n const { createTexture2D } = this.rendererService;\n if (this.texture) {\n this.texture.update({\n data: this.iconService.getCanvas(),\n mag: 'linear',\n min: 'linear mipmap nearest',\n mipmap: true,\n });\n // this.layer.render();\n // TODO: 更新完纹理后在更新的图层的时候需要更新所有的图层\n this.layer.renderLayers();\n return;\n }\n this.texture = createTexture2D({\n data: this.iconService.getCanvas(),\n mag: gl.LINEAR,\n // min: gl.LINEAR,\n min: gl.LINEAR_MIPMAP_LINEAR,\n premultiplyAlpha: false,\n width: 1024,\n height: this.iconService.canvasHeight || 128,\n mipmap: true,\n });\n };\n}\n"],"file":"fillmage.js"}
1
+ {"version":3,"sources":["../../../src/point/models/fillmage.ts"],"names":["AttributeType","gl","getCullFace","getMask","BaseModel","PointFillTriangulation","Version","FillImageModel","createTexture2D","rendererService","texture","update","data","iconService","getCanvas","mag","min","mipmap","layer","renderLayers","LINEAR","LINEAR_MIPMAP_LINEAR","premultiplyAlpha","width","height","canvasHeight","getLayerConfig","opacity","strokeOpacity","strokeWidth","stroke","offsets","blend","rotation","getDirty","bind","rotateFlag","mapService","version","radian","Math","PI","getRotation","dataTextureTest","dataTextureNeedUpdate","judgeStyleAttributes","encodeData","getEncodedData","calDataFrame","cellLength","cellProperties","rowCount","dataTexture","length","flipY","format","LUMINANCE","type","FLOAT","u_isMeter","Number","isMeter","u_RotateMatrix","Float32Array","cos","sin","u_additive","u_dataTexture","u_cellTypeLayout","getCellTypeLayout","u_texture","u_textSize","u_opacity","u_offsets","isOffsetStatic","styleAttributeService","createAttributesAndIndices","updateTexture","on","unit","L7MAP","GLOBEL","calMeter2Coord","buildModels","getSource","extent","minLng","minLat","maxLng","maxLat","center","MAPBOX","window","mapboxgl","MercatorCoordinate","coord","fromLngLat","lng","lat","offsetInMeters","offsetInMercatorCoordinateUnits","meterInMercatorCoordinateUnits","westCoord","x","y","z","westLnglat","toLngLat","meter2coord","m1","meterToCoord","m2","Boolean","mask","maskInside","getShaders","frag","vert","buildLayerModel","moduleName","vertexShader","fragmentShader","triangulation","depth","enable","getBlend","stencil","cull","face","pointFillFrag","pointFillVert","off","destroy","registerStyleAttribute","name","Attribute","descriptor","buffer","usage","DYNAMIC_DRAW","size","feature","featureIdx","vertex","attributeIdx","iconMap","getIconMap","shape","extrude","extrudeIndex","Array","isArray"],"mappings":";;;;;;;;;;;;;;AAAA,SACEA,aADF,EAEEC,EAFF,QASO,eATP;AAUA,SAASC,WAAT,EAAsBC,OAAtB,QAAqC,gBAArC;AACA,OAAOC,SAAP,MAAsB,sBAAtB;AAEA,SAASC,sBAAT,QAAuC,0BAAvC;;;AAOA,SAASC,OAAT,QAAwB,eAAxB;;IAEqBC,c;;;;;;;;;;;;;;;;kEACU,C;;;;8DAEF,K;;6DACF,C;;oEA+SD,YAAM;AAC5B,UAAQC,eAAR,GAA4B,MAAKC,eAAjC,CAAQD,eAAR;;AACA,UAAI,MAAKE,OAAT,EAAkB;AAChB,cAAKA,OAAL,CAAaC,MAAb,CAAoB;AAClBC,UAAAA,IAAI,EAAE,MAAKC,WAAL,CAAiBC,SAAjB,EADY;AAElBC,UAAAA,GAAG,EAAE,QAFa;AAGlBC,UAAAA,GAAG,EAAE,uBAHa;AAIlBC,UAAAA,MAAM,EAAE;AAJU,SAApB;;AAQA,cAAKC,KAAL,CAAWC,YAAX;;AACA;AACD;;AACD,YAAKT,OAAL,GAAeF,eAAe,CAAC;AAC7BI,QAAAA,IAAI,EAAE,MAAKC,WAAL,CAAiBC,SAAjB,EADuB;AAE7BC,QAAAA,GAAG,EAAEd,EAAE,CAACmB,MAFqB;AAI7BJ,QAAAA,GAAG,EAAEf,EAAE,CAACoB,oBAJqB;A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aAAa,CAACuI,SAF4B;AAGhDC,QAAAA,UAAU,EAAE;AACVF,UAAAA,IAAI,EAAE,QADI;AAEVG,UAAAA,MAAM,EAAE;AAENC,YAAAA,KAAK,EAAEzI,EAAE,CAAC0I,YAFJ;AAGN/H,YAAAA,IAAI,EAAE,EAHA;AAIN6C,YAAAA,IAAI,EAAExD,EAAE,CAACyD;AAJH,WAFE;AAQVkF,UAAAA,IAAI,EAAE,CARI;AASVjI,UAAAA,MAAM,EAAE,gBACNkI,OADM,EAENC,UAFM,EAGNC,MAHM,EAINC,YAJM,EAKH;AACH,gCAAqBH,OAArB,CAAQD,IAAR;AAAA,gBAAQA,IAAR,8BAAe,CAAf;AAEA,mBAAOU,KAAK,CAACC,OAAN,CAAcX,IAAd,IACH,CAACA,IAAI,CAAC,CAAD,CAAJ,GAAU,MAAI,CAAChC,WAAhB,CADG,GAEH,CAAEgC,IAAD,GAAmB,MAAI,CAAChC,WAAzB,CAFJ;AAGD;AApBS;AAHoC,OAAlD;AA0BD;;;;EAjTyCxG,S;;SAAvBG,c","sourcesContent":["import {\n AttributeType,\n gl,\n IAttribute,\n IElements,\n IEncodeFeature,\n IModel,\n IModelUniform,\n ITexture2D,\n} from '@antv/l7-core';\nimport { getCullFace, getMask } from '@antv/l7-utils';\nimport BaseModel from '../../core/BaseModel';\nimport { IPointLayerStyleOptions } from '../../core/interface';\nimport { PointFillTriangulation } from '../../core/triangulation';\n// static pointLayer shader - not support animate\nimport pointFillFrag from '../shaders/image/fillImage_frag.glsl';\nimport pointFillVert from '../shaders/image/fillImage_vert.glsl';\n\nimport { isNumber } from 'lodash';\n\nimport { Version } from '@antv/l7-maps';\n\nexport default class FillImageModel extends BaseModel {\n public meter2coord: number = 1;\n private texture: ITexture2D;\n private isMeter: boolean = false;\n private radian: number = 0; // 旋转的弧度\n public getUninforms(): IModelUniform {\n const {\n opacity = 1,\n strokeOpacity = 1,\n strokeWidth = 0,\n stroke = 'rgba(0,0,0,0)',\n offsets = [0, 0],\n blend,\n rotation,\n } = this.layer.getLayerConfig() as IPointLayerStyleOptions;\n\n if (this.rendererService.getDirty()) {\n this.texture.bind();\n }\n\n /**\n * rotateFlag\n * L7MAP 1\n * MAPBOX 1\n * GAODE2.x -1\n * GAODE1.x -1\n */\n let rotateFlag = 1;\n if (\n this.mapService.version === 'GAODE2.x' ||\n this.mapService.version === 'GAODE1.x'\n ) {\n rotateFlag = -1;\n }\n // 控制图标的旋转角度(绕 Z 轴旋转)\n this.radian = rotation\n ? (rotateFlag * Math.PI * rotation) / 180\n : (rotateFlag * Math.PI * (this.mapService.getRotation() % 360)) / 180;\n\n if (\n this.dataTextureTest &&\n this.dataTextureNeedUpdate({\n opacity,\n strokeOpacity,\n strokeWidth,\n stroke,\n offsets,\n })\n ) {\n // 判断当前的样式中哪些是需要进行数据映射的,哪些是常量,同时计算用于构建数据纹理的一些中间变量\n this.judgeStyleAttributes({\n opacity,\n strokeOpacity,\n strokeWidth,\n stroke,\n offsets,\n });\n\n const encodeData = this.layer.getEncodedData();\n const { data, width, height } = this.calDataFrame(\n this.cellLength,\n encodeData,\n this.cellProperties,\n );\n this.rowCount = height; // 当前数据纹理有多少行\n\n this.dataTexture =\n this.cellLength > 0 && data.length > 0\n ? this.createTexture2D({\n flipY: true,\n data,\n format: gl.LUMINANCE,\n type: gl.FLOAT,\n width,\n height,\n })\n : this.createTexture2D({\n flipY: true,\n data: [1],\n format: gl.LUMINANCE,\n type: gl.FLOAT,\n width: 1,\n height: 1,\n });\n }\n return {\n u_isMeter: Number(this.isMeter),\n u_RotateMatrix: new Float32Array([\n Math.cos(this.radian),\n Math.sin(this.radian),\n -Math.sin(this.radian),\n Math.cos(this.radian),\n ]),\n u_additive: blend === 'additive' ? 1.0 : 0.0,\n\n u_dataTexture: this.dataTexture, // 数据纹理 - 有数据映射的时候纹理中带数据,若没有任何数据映射时纹理是 [1]\n u_cellTypeLayout: this.getCellTypeLayout(),\n\n u_texture: this.texture,\n u_textSize: [1024, this.iconService.canvasHeight || 128],\n\n u_opacity: isNumber(opacity) ? opacity : 1.0,\n u_offsets: this.isOffsetStatic(offsets)\n ? (offsets as [number, number])\n : [0, 0],\n };\n }\n\n public getAttribute(): {\n attributes: {\n [attributeName: string]: IAttribute;\n };\n elements: IElements;\n } {\n return this.styleAttributeService.createAttributesAndIndices(\n this.layer.getEncodedData(),\n PointFillTriangulation,\n );\n }\n\n public initModels(): IModel[] {\n this.updateTexture();\n this.iconService.on('imageUpdate', this.updateTexture);\n\n const {\n unit = 'l7size',\n } = this.layer.getLayerConfig() as IPointLayerStyleOptions;\n const { version } = this.mapService;\n if (\n unit === 'meter' &&\n version !== Version.L7MAP &&\n version !== Version.GLOBEL\n ) {\n this.isMeter = true;\n this.calMeter2Coord();\n }\n\n return this.buildModels();\n }\n\n /**\n * 计算等面积点图层(unit meter)笛卡尔坐标标度与世界坐标标度的比例\n * @returns\n */\n public calMeter2Coord() {\n // @ts-ignore\n const [minLng, minLat, maxLng, maxLat] = this.layer.getSource().extent;\n const center = [(minLng + maxLng) / 2, (minLat + maxLat) / 2];\n\n const { version } = this.mapService;\n if (version === Version.MAPBOX && window.mapboxgl.MercatorCoordinate) {\n const coord = window.mapboxgl.MercatorCoordinate.fromLngLat(\n { lng: center[0], lat: center[1] },\n 0,\n );\n const offsetInMeters = 1;\n const offsetInMercatorCoordinateUnits =\n offsetInMeters * coord.meterInMercatorCoordinateUnits();\n const westCoord = new window.mapboxgl.MercatorCoordinate(\n coord.x - offsetInMercatorCoordinateUnits,\n coord.y,\n coord.z,\n );\n const westLnglat = westCoord.toLngLat();\n\n this.meter2coord = center[0] - westLnglat.lng;\n return;\n }\n\n // @ts-ignore\n const m1 = this.mapService.meterToCoord(center, [minLng, minLat]);\n // @ts-ignore\n const m2 = this.mapService.meterToCoord(center, [\n maxLng === minLng ? maxLng + 0.1 : maxLng,\n maxLat === minLat ? minLat + 0.1 : maxLat,\n ]);\n this.meter2coord = (m1 + m2) / 2;\n if (!Boolean(this.meter2coord)) {\n // Tip: 兼容单个数据导致的 m1、m2 为 NaN\n this.meter2coord = 7.70681090738883;\n }\n }\n\n public buildModels(): IModel[] {\n const {\n mask = false,\n maskInside = true,\n } = this.layer.getLayerConfig() as IPointLayerStyleOptions;\n const { frag, vert, type } = this.getShaders();\n return [\n this.layer.buildLayerModel({\n moduleName: 'pointfill_' + type,\n vertexShader: vert,\n fragmentShader: frag,\n triangulation: PointFillTriangulation,\n depth: { enable: false },\n blend: this.getBlend(),\n stencil: getMask(mask, maskInside),\n cull: {\n enable: true,\n face: getCullFace(this.mapService.version),\n },\n }),\n ];\n }\n\n public getShaders(): { frag: string; vert: string; type: string } {\n return {\n frag: pointFillFrag,\n vert: pointFillVert,\n type: 'normal',\n };\n }\n\n public clearModels() {\n this.iconService.off('imageUpdate', this.updateTexture);\n this.texture?.destroy();\n this.dataTexture?.destroy();\n }\n\n // overwrite baseModel func\n protected registerBuiltinAttributes() {\n this.styleAttributeService.registerStyleAttribute({\n name: 'uv',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_Uv',\n buffer: {\n // give the WebGL driver a hint that this buffer may change\n usage: gl.DYNAMIC_DRAW,\n data: [],\n type: gl.FLOAT,\n },\n size: 2,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n ) => {\n const iconMap = this.iconService.getIconMap();\n const { shape } = feature;\n const { x, y } = iconMap[shape as string] || { x: 0, y: 0 };\n return [x, y];\n },\n },\n });\n\n this.styleAttributeService.registerStyleAttribute({\n name: 'extrude',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_Extrude',\n buffer: {\n // give the WebGL driver a hint that this buffer may change\n usage: gl.DYNAMIC_DRAW,\n data: [],\n type: gl.FLOAT,\n },\n size: 3,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n ) => {\n const extrude = [1, 1, 0, -1, 1, 0, -1, -1, 0, 1, -1, 0];\n\n const extrudeIndex = (attributeIdx % 4) * 3;\n return [\n extrude[extrudeIndex],\n extrude[extrudeIndex + 1],\n extrude[extrudeIndex + 2],\n ];\n },\n },\n });\n\n // point layer size;\n this.styleAttributeService.registerStyleAttribute({\n name: 'size',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_Size',\n buffer: {\n // give the WebGL driver a hint that this buffer may change\n usage: gl.DYNAMIC_DRAW,\n data: [],\n type: gl.FLOAT,\n },\n size: 1,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n ) => {\n const { size = 5 } = feature;\n // console.log('featureIdx', featureIdx, feature)\n return Array.isArray(size)\n ? [size[0] * this.meter2coord]\n : [(size as number) * this.meter2coord];\n },\n },\n });\n }\n\n private updateTexture = () => {\n const { createTexture2D } = this.rendererService;\n if (this.texture) {\n this.texture.update({\n data: this.iconService.getCanvas(),\n mag: 'linear',\n min: 'linear mipmap nearest',\n mipmap: true,\n });\n // this.layer.render();\n // TODO: 更新完纹理后在更新的图层的时候需要更新所有的图层\n this.layer.renderLayers();\n return;\n }\n this.texture = createTexture2D({\n data: this.iconService.getCanvas(),\n mag: gl.LINEAR,\n // min: gl.LINEAR,\n min: gl.LINEAR_MIPMAP_LINEAR,\n premultiplyAlpha: false,\n width: 1024,\n height: this.iconService.canvasHeight || 128,\n mipmap: true,\n });\n };\n}\n"],"file":"fillmage.js"}
@@ -13,7 +13,7 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
13
13
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
14
14
 
15
15
  import { AttributeType, gl } from '@antv/l7-core';
16
- import { getMask } from '@antv/l7-utils';
16
+ import { getCullFace, getMask } from '@antv/l7-utils';
17
17
  import BaseModel from '../../core/BaseModel';
18
18
  import { PointFillTriangulation } from '../../core/triangulation';
19
19
  var pointFillFrag = "\nuniform float u_additive;\n\nvarying mat4 styleMappingMat; // \u4F20\u9012\u4ECE\u7247\u5143\u4E2D\u4F20\u9012\u7684\u6620\u5C04\u6570\u636E\n\nvarying vec4 v_data;\nvarying vec4 v_color;\nvarying float v_radius;\n\n#pragma include \"sdf_2d\"\n#pragma include \"picking\"\n\nvoid main() {\n int shape = int(floor(v_data.w + 0.5));\n\n vec4 textrueStroke = vec4(\n styleMappingMat[1][0],\n styleMappingMat[1][1],\n styleMappingMat[1][2],\n styleMappingMat[1][3]\n );\n\n float opacity = styleMappingMat[0][0];\n\n lowp float antialiasblur = v_data.z;\n float r = v_radius / (v_radius);\n\n float outer_df = sdCircle(v_data.xy, 1.0);\n float inner_df = sdCircle(v_data.xy, r);\n\n float opacity_t = smoothstep(0.0, antialiasblur, outer_df);\n\n gl_FragColor = vec4(v_color.rgb, v_color.a * opacity);\n\n if(u_additive > 0.0) {\n gl_FragColor *= opacity_t;\n } else {\n gl_FragColor.a *= opacity_t;\n }\n\n if(gl_FragColor.a > 0.0) {\n gl_FragColor = filterColor(gl_FragColor);\n }\n\n vec2 extrude = styleMappingMat[2].ba;\n vec2 dir = normalize(extrude);\n vec2 baseDir = vec2(1.0, 0.0);\n float pi = 3.14159265359;\n // full circle\n // float rades = dot(dir, baseDir);\n // float flag = sign(dir.y);\n // float radar_v = (flag - 1.0) * -0.5 + flag * acos(rades)/pi/2.0;\n \n // half circle\n float flag = sign(dir.y);\n float rades = dot(dir, baseDir);\n float radar_v = (flag - 1.0) * -0.5 * acos(rades)/pi;\n // simple AA\n if(radar_v > 0.99) {\n radar_v = 1.0 - (radar_v - 0.99)/0.01;\n }\n\n\n\n gl_FragColor.a *= radar_v;\n}\n";
@@ -201,7 +201,11 @@ var RadarModel = function (_BaseModel) {
201
201
  enable: false
202
202
  },
203
203
  blend: this.getBlend(),
204
- stencil: getMask(mask, maskInside)
204
+ stencil: getMask(mask, maskInside),
205
+ cull: {
206
+ enable: true,
207
+ face: getCullFace(this.mapService.version)
208
+ }
205
209
  })];
206
210
  }
207
211
  }, {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/point/models/radar.ts"],"names":["AttributeType","gl","getMask","BaseModel","PointFillTriangulation","Version","RadarModel","layer","getLayerConfig","opacity","strokeOpacity","strokeWidth","stroke","offsets","blend","speed","dataTextureTest","dataTextureNeedUpdate","judgeStyleAttributes","encodeData","getEncodedData","calDataFrame","cellLength","cellProperties","data","width","height","rowCount","dataTexture","length","createTexture2D","flipY","format","LUMINANCE","type","FLOAT","u_isMeter","Number","isMeter","u_speed","u_additive","u_dataTexture","u_cellTypeLayout","getCellTypeLayout","u_opacity","u_offsets","isOffsetStatic","animateOption","enable","u_aimate","animateOption2Array","u_time","getLayerAnimateTime","styleAttributeService","createAttributesAndIndices","unit","version","mapService","L7MAP","GLOBEL","calMeter2Coord","buildModels","getSource","extent","minLng","minLat","maxLng","maxLat","center","MAPBOX","window","mapboxgl","MercatorCoordinate","coord","fromLngLat","lng","lat","offsetInMeters","offsetInMercatorCoordinateUnits","meterInMercatorCoordinateUnits","westCoord","x","y","z","westLnglat","toLngLat","meter2coord","m1","meterToCoord","m2","Boolean","mask","maskInside","getShaders","frag","vert","buildLayerModel","moduleName","vertexShader","fragmentShader","triangulation","depth","getBlend","stencil","pointFillFrag","pointFillVert","destroy","option","rings","registerStyleAttribute","name","Attribute","descriptor","buffer","usage","DYNAMIC_DRAW","size","update","feature","featureIdx","vertex","attributeIdx","extrude","extrudeIndex","Array","isArray","shape","shape2d","shapeIndex","indexOf"],"mappings":";;;;;;;;;;;;;;AAAA,SACEA,aADF,EAEEC,EAFF,QAUO,eAVP;AAWA,SAASC,OAAT,QAAwB,gBAAxB;AACA,OAAOC,SAAP,MAAsB,sBAAtB;AAEA,SAASC,sBAAT,QAAuC,0BAAvC;;;AAOA,SAASC,OAAT,QAAwB,eAAxB;;IAEqBC,U;;;;;;;;;;;;;;;;kEACU,C;;8DACF,K;;;;;;;WAC3B,wBAA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AAC9B,WAAzB,CAFJ;AAGD;AApBS;AAHoC,OAAlD;AA4BA,WAAKjC,qBAAL,CAA2BwD,sBAA3B,CAAkD;AAChDC,QAAAA,IAAI,EAAE,OAD0C;AAEhD5E,QAAAA,IAAI,EAAElC,aAAa,CAAC+G,SAF4B;AAGhDC,QAAAA,UAAU,EAAE;AACVF,UAAAA,IAAI,EAAE,SADI;AAEVG,UAAAA,MAAM,EAAE;AAENC,YAAAA,KAAK,EAAEjH,EAAE,CAACkH,YAFJ;AAGN3F,YAAAA,IAAI,EAAE,EAHA;AAINU,YAAAA,IAAI,EAAEjC,EAAE,CAACkC;AAJH,WAFE;AAQViF,UAAAA,IAAI,EAAE,CARI;AASVC,UAAAA,MAAM,EAAE,gBACNC,OADM,EAENC,UAFM,EAGNC,MAHM,EAINC,YAJM,EAKH;AACH,iCAAsBH,OAAtB,CAAQQ,KAAR;AAAA,gBAAQA,KAAR,+BAAgB,CAAhB;;AACA,gBAAMC,OAAO,GAAG,MAAI,CAACxH,KAAL,CAAWC,cAAX,GAA4BuH,OAA5C;;AACA,gBAAMC,UAAU,GAAGD,OAAO,CAACE,OAAR,CAAgBH,KAAhB,CAAnB;AACA,mBAAO,CAACE,UAAD,CAAP;AACD;AAnBS;AAHoC,OAAlD;AAyBD;;;;EAzRqC7H,S;;SAAnBG,U","sourcesContent":["import {\n AttributeType,\n gl,\n IAnimateOption,\n IAttribute,\n IElements,\n IEncodeFeature,\n ILayerConfig,\n IModel,\n IModelUniform,\n} from '@antv/l7-core';\nimport { getMask } from '@antv/l7-utils';\nimport BaseModel from '../../core/BaseModel';\nimport { IPointLayerStyleOptions } from '../../core/interface';\nimport { PointFillTriangulation } from '../../core/triangulation';\n\nimport pointFillFrag from '../shaders/radar/radar_frag.glsl';\nimport pointFillVert from '../shaders/radar/radar_vert.glsl';\n\nimport { isNumber } from 'lodash';\n\nimport { Version } from '@antv/l7-maps';\n\nexport default class RadarModel extends BaseModel {\n public meter2coord: number = 1;\n private isMeter: boolean = false;\n public getUninforms(): IModelUniform {\n const {\n opacity = 1,\n strokeOpacity = 1,\n strokeWidth = 0,\n stroke = 'rgba(0,0,0,0)',\n offsets = [0, 0],\n blend,\n speed = 1,\n } = this.layer.getLayerConfig() as IPointLayerStyleOptions;\n\n if (\n this.dataTextureTest &&\n this.dataTextureNeedUpdate({\n opacity,\n strokeOpacity,\n strokeWidth,\n stroke,\n offsets,\n })\n ) {\n // 判断当前的样式中哪些是需要进行数据映射的,哪些是常量,同时计算用于构建数据纹理的一些中间变量\n this.judgeStyleAttributes({\n opacity,\n strokeOpacity,\n strokeWidth,\n stroke,\n offsets,\n });\n\n const encodeData = this.layer.getEncodedData();\n const { data, width, height } = this.calDataFrame(\n this.cellLength,\n encodeData,\n this.cellProperties,\n );\n this.rowCount = height; // 当前数据纹理有多少行\n\n this.dataTexture =\n this.cellLength > 0 && data.length > 0\n ? this.createTexture2D({\n flipY: true,\n data,\n format: gl.LUMINANCE,\n type: gl.FLOAT,\n width,\n height,\n })\n : this.createTexture2D({\n flipY: true,\n data: [1],\n format: gl.LUMINANCE,\n type: gl.FLOAT,\n width: 1,\n height: 1,\n });\n }\n return {\n u_isMeter: Number(this.isMeter),\n u_speed: speed,\n u_additive: blend === 'additive' ? 1.0 : 0.0,\n u_dataTexture: this.dataTexture, // 数据纹理 - 有数据映射的时候纹理中带数据,若没有任何数据映射时纹理是 [1]\n u_cellTypeLayout: this.getCellTypeLayout(),\n\n u_opacity: isNumber(opacity) ? opacity : 1.0,\n u_offsets: this.isOffsetStatic(offsets)\n ? (offsets as [number, number])\n : [0, 0],\n };\n }\n public getAnimateUniforms(): IModelUniform {\n const {\n animateOption = { enable: false },\n } = this.layer.getLayerConfig() as ILayerConfig;\n return {\n u_aimate: this.animateOption2Array(animateOption),\n u_time: this.layer.getLayerAnimateTime(),\n };\n }\n\n public getAttribute(): {\n attributes: {\n [attributeName: string]: IAttribute;\n };\n elements: IElements;\n } {\n return this.styleAttributeService.createAttributesAndIndices(\n this.layer.getEncodedData(),\n PointFillTriangulation,\n );\n }\n\n public initModels(): IModel[] {\n const {\n unit = 'l7size',\n } = this.layer.getLayerConfig() as IPointLayerStyleOptions;\n const { version } = this.mapService;\n if (\n unit === 'meter' &&\n version !== Version.L7MAP &&\n version !== Version.GLOBEL\n ) {\n this.isMeter = true;\n this.calMeter2Coord();\n }\n\n return this.buildModels();\n }\n\n /**\n * 计算等面积点图层(unit meter)笛卡尔坐标标度与世界坐标标度的比例\n * @returns\n */\n public calMeter2Coord() {\n // @ts-ignore\n const [minLng, minLat, maxLng, maxLat] = this.layer.getSource().extent;\n const center = [(minLng + maxLng) / 2, (minLat + maxLat) / 2];\n\n const { version } = this.mapService;\n if (version === Version.MAPBOX && window.mapboxgl.MercatorCoordinate) {\n const coord = window.mapboxgl.MercatorCoordinate.fromLngLat(\n { lng: center[0], lat: center[1] },\n 0,\n );\n const offsetInMeters = 1;\n const offsetInMercatorCoordinateUnits =\n offsetInMeters * coord.meterInMercatorCoordinateUnits();\n const westCoord = new window.mapboxgl.MercatorCoordinate(\n coord.x - offsetInMercatorCoordinateUnits,\n coord.y,\n coord.z,\n );\n const westLnglat = westCoord.toLngLat();\n\n this.meter2coord = center[0] - westLnglat.lng;\n return;\n }\n\n // @ts-ignore\n const m1 = this.mapService.meterToCoord(center, [minLng, minLat]);\n // @ts-ignore\n const m2 = this.mapService.meterToCoord(center, [\n maxLng === minLng ? maxLng + 0.1 : maxLng,\n maxLat === minLat ? minLat + 0.1 : maxLat,\n ]);\n this.meter2coord = (m1 + m2) / 2;\n if (!Boolean(this.meter2coord)) {\n // Tip: 兼容单个数据导致的 m1、m2 为 NaN\n this.meter2coord = 7.70681090738883;\n }\n }\n\n public buildModels(): IModel[] {\n const {\n mask = false,\n maskInside = true,\n } = this.layer.getLayerConfig() as IPointLayerStyleOptions;\n const { frag, vert, type } = this.getShaders();\n\n return [\n this.layer.buildLayerModel({\n moduleName: 'pointfill_' + type,\n vertexShader: vert,\n fragmentShader: frag,\n triangulation: PointFillTriangulation,\n depth: { enable: false },\n blend: this.getBlend(),\n stencil: getMask(mask, maskInside),\n }),\n ];\n }\n\n /**\n * 根据 animateOption 的值返回对应的 shader 代码\n * @returns\n */\n public getShaders(): { frag: string; vert: string; type: string } {\n return {\n frag: pointFillFrag,\n vert: pointFillVert,\n type: 'radar',\n };\n }\n\n public clearModels() {\n this.dataTexture?.destroy();\n }\n\n // overwrite baseModel func\n protected animateOption2Array(option: Partial<IAnimateOption>): number[] {\n return [option.enable ? 0 : 1.0, option.speed || 1, option.rings || 3, 0];\n }\n protected registerBuiltinAttributes() {\n this.styleAttributeService.registerStyleAttribute({\n name: 'extrude',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_Extrude',\n buffer: {\n // give the WebGL driver a hint that this buffer may change\n usage: gl.DYNAMIC_DRAW,\n data: [],\n type: gl.FLOAT,\n },\n size: 3,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n ) => {\n let extrude;\n extrude = [1, 1, 0, -1, 1, 0, -1, -1, 0, 1, -1, 0];\n\n const extrudeIndex = (attributeIdx % 4) * 3;\n return [\n extrude[extrudeIndex],\n extrude[extrudeIndex + 1],\n extrude[extrudeIndex + 2],\n ];\n },\n },\n });\n\n // point layer size;\n this.styleAttributeService.registerStyleAttribute({\n name: 'size',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_Size',\n buffer: {\n // give the WebGL driver a hint that this buffer may change\n usage: gl.DYNAMIC_DRAW,\n data: [],\n type: gl.FLOAT,\n },\n size: 1,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n ) => {\n const { size = 5 } = feature;\n // console.log('featureIdx', featureIdx, feature)\n return Array.isArray(size)\n ? [size[0] * this.meter2coord]\n : [(size as number) * this.meter2coord];\n },\n },\n });\n\n // point layer size;\n this.styleAttributeService.registerStyleAttribute({\n name: 'shape',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_Shape',\n buffer: {\n // give the WebGL driver a hint that this buffer may change\n usage: gl.DYNAMIC_DRAW,\n data: [],\n type: gl.FLOAT,\n },\n size: 1,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n ) => {\n const { shape = 2 } = feature;\n const shape2d = this.layer.getLayerConfig().shape2d as string[];\n const shapeIndex = shape2d.indexOf(shape as string);\n return [shapeIndex];\n },\n },\n });\n }\n}\n"],"file":"radar.js"}
1
+ {"version":3,"sources":["../../../src/point/models/radar.ts"],"names":["AttributeType","gl","getCullFace","getMask","BaseModel","PointFillTriangulation","Version","RadarModel","layer","getLayerConfig","opacity","strokeOpacity","strokeWidth","stroke","offsets","blend","speed","dataTextureTest","dataTextureNeedUpdate","judgeStyleAttributes","encodeData","getEncodedData","calDataFrame","cellLength","cellProperties","data","width","height","rowCount","dataTexture","length","createTexture2D","flipY","format","LUMINANCE","type","FLOAT","u_isMeter","Number","isMeter","u_speed","u_additive","u_dataTexture","u_cellTypeLayout","getCellTypeLayout","u_opacity","u_offsets","isOffsetStatic","animateOption","enable","u_aimate","animateOption2Array","u_time","getLayerAnimateTime","styleAttributeService","createAttributesAndIndices","unit","version","mapService","L7MAP","GLOBEL","calMeter2Coord","buildModels","getSource","extent","minLng","minLat","maxLng","maxLat","center","MAPBOX","window","mapboxgl","MercatorCoordinate","coord","fromLngLat","lng","lat","offsetInMeters","offsetInMercatorCoordinateUnits","meterInMercatorCoordinateUnits","westCoord","x","y","z","westLnglat","toLngLat","meter2coord","m1","meterToCoord","m2","Boolean","mask","maskInside","getShaders","frag","vert","buildLayerModel","moduleName","vertexShader","fragmentShader","triangulation","depth","getBlend","stencil","cull","face","pointFillFrag","pointFillVert","destroy","option","rings","registerStyleAttribute","name","Attribute","descriptor","buffer","usage","DYNAMIC_DRAW","size","update","feature","featureIdx","vertex","attributeIdx","extrude","extrudeIndex","Array","isArray","shape","shape2d","shapeIndex","indexOf"],"mappings":";;;;;;;;;;;;;;AAAA,SAC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ributeType,\n gl,\n IAnimateOption,\n IAttribute,\n IElements,\n IEncodeFeature,\n ILayerConfig,\n IModel,\n IModelUniform,\n} from '@antv/l7-core';\nimport { getCullFace, getMask } from '@antv/l7-utils';\nimport BaseModel from '../../core/BaseModel';\nimport { IPointLayerStyleOptions } from '../../core/interface';\nimport { PointFillTriangulation } from '../../core/triangulation';\n\nimport pointFillFrag from '../shaders/radar/radar_frag.glsl';\nimport pointFillVert from '../shaders/radar/radar_vert.glsl';\n\nimport { isNumber } from 'lodash';\n\nimport { Version } from '@antv/l7-maps';\n\nexport default class RadarModel extends BaseModel {\n public meter2coord: number = 1;\n private isMeter: boolean = false;\n public getUninforms(): IModelUniform {\n const {\n opacity = 1,\n strokeOpacity = 1,\n strokeWidth = 0,\n stroke = 'rgba(0,0,0,0)',\n offsets = [0, 0],\n blend,\n speed = 1,\n } = this.layer.getLayerConfig() as IPointLayerStyleOptions;\n\n if (\n this.dataTextureTest &&\n this.dataTextureNeedUpdate({\n opacity,\n strokeOpacity,\n strokeWidth,\n stroke,\n offsets,\n })\n ) {\n // 判断当前的样式中哪些是需要进行数据映射的,哪些是常量,同时计算用于构建数据纹理的一些中间变量\n this.judgeStyleAttributes({\n opacity,\n strokeOpacity,\n strokeWidth,\n stroke,\n offsets,\n });\n\n const encodeData = this.layer.getEncodedData();\n const { data, width, height } = this.calDataFrame(\n this.cellLength,\n encodeData,\n this.cellProperties,\n );\n this.rowCount = height; // 当前数据纹理有多少行\n\n this.dataTexture =\n this.cellLength > 0 && data.length > 0\n ? this.createTexture2D({\n flipY: true,\n data,\n format: gl.LUMINANCE,\n type: gl.FLOAT,\n width,\n height,\n })\n : this.createTexture2D({\n flipY: true,\n data: [1],\n format: gl.LUMINANCE,\n type: gl.FLOAT,\n width: 1,\n height: 1,\n });\n }\n return {\n u_isMeter: Number(this.isMeter),\n u_speed: speed,\n u_additive: blend === 'additive' ? 1.0 : 0.0,\n u_dataTexture: this.dataTexture, // 数据纹理 - 有数据映射的时候纹理中带数据,若没有任何数据映射时纹理是 [1]\n u_cellTypeLayout: this.getCellTypeLayout(),\n\n u_opacity: isNumber(opacity) ? opacity : 1.0,\n u_offsets: this.isOffsetStatic(offsets)\n ? (offsets as [number, number])\n : [0, 0],\n };\n }\n public getAnimateUniforms(): IModelUniform {\n const {\n animateOption = { enable: false },\n } = this.layer.getLayerConfig() as ILayerConfig;\n return {\n u_aimate: this.animateOption2Array(animateOption),\n u_time: this.layer.getLayerAnimateTime(),\n };\n }\n\n public getAttribute(): {\n attributes: {\n [attributeName: string]: IAttribute;\n };\n elements: IElements;\n } {\n return this.styleAttributeService.createAttributesAndIndices(\n this.layer.getEncodedData(),\n PointFillTriangulation,\n );\n }\n\n public initModels(): IModel[] {\n const {\n unit = 'l7size',\n } = this.layer.getLayerConfig() as IPointLayerStyleOptions;\n const { version } = this.mapService;\n if (\n unit === 'meter' &&\n version !== Version.L7MAP &&\n version !== Version.GLOBEL\n ) {\n this.isMeter = true;\n this.calMeter2Coord();\n }\n\n return this.buildModels();\n }\n\n /**\n * 计算等面积点图层(unit meter)笛卡尔坐标标度与世界坐标标度的比例\n * @returns\n */\n public calMeter2Coord() {\n // @ts-ignore\n const [minLng, minLat, maxLng, maxLat] = this.layer.getSource().extent;\n const center = [(minLng + maxLng) / 2, (minLat + maxLat) / 2];\n\n const { version } = this.mapService;\n if (version === Version.MAPBOX && window.mapboxgl.MercatorCoordinate) {\n const coord = window.mapboxgl.MercatorCoordinate.fromLngLat(\n { lng: center[0], lat: center[1] },\n 0,\n );\n const offsetInMeters = 1;\n const offsetInMercatorCoordinateUnits =\n offsetInMeters * coord.meterInMercatorCoordinateUnits();\n const westCoord = new window.mapboxgl.MercatorCoordinate(\n coord.x - offsetInMercatorCoordinateUnits,\n coord.y,\n coord.z,\n );\n const westLnglat = westCoord.toLngLat();\n\n this.meter2coord = center[0] - westLnglat.lng;\n return;\n }\n\n // @ts-ignore\n const m1 = this.mapService.meterToCoord(center, [minLng, minLat]);\n // @ts-ignore\n const m2 = this.mapService.meterToCoord(center, [\n maxLng === minLng ? maxLng + 0.1 : maxLng,\n maxLat === minLat ? minLat + 0.1 : maxLat,\n ]);\n this.meter2coord = (m1 + m2) / 2;\n if (!Boolean(this.meter2coord)) {\n // Tip: 兼容单个数据导致的 m1、m2 为 NaN\n this.meter2coord = 7.70681090738883;\n }\n }\n\n public buildModels(): IModel[] {\n const {\n mask = false,\n maskInside = true,\n } = this.layer.getLayerConfig() as IPointLayerStyleOptions;\n const { frag, vert, type } = this.getShaders();\n\n return [\n this.layer.buildLayerModel({\n moduleName: 'pointfill_' + type,\n vertexShader: vert,\n fragmentShader: frag,\n triangulation: PointFillTriangulation,\n depth: { enable: false },\n blend: this.getBlend(),\n stencil: getMask(mask, maskInside),\n cull: {\n enable: true,\n face: getCullFace(this.mapService.version),\n },\n }),\n ];\n }\n\n /**\n * 根据 animateOption 的值返回对应的 shader 代码\n * @returns\n */\n public getShaders(): { frag: string; vert: string; type: string } {\n return {\n frag: pointFillFrag,\n vert: pointFillVert,\n type: 'radar',\n };\n }\n\n public clearModels() {\n this.dataTexture?.destroy();\n }\n\n // overwrite baseModel func\n protected animateOption2Array(option: Partial<IAnimateOption>): number[] {\n return [option.enable ? 0 : 1.0, option.speed || 1, option.rings || 3, 0];\n }\n protected registerBuiltinAttributes() {\n this.styleAttributeService.registerStyleAttribute({\n name: 'extrude',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_Extrude',\n buffer: {\n // give the WebGL driver a hint that this buffer may change\n usage: gl.DYNAMIC_DRAW,\n data: [],\n type: gl.FLOAT,\n },\n size: 3,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n ) => {\n let extrude;\n extrude = [1, 1, 0, -1, 1, 0, -1, -1, 0, 1, -1, 0];\n\n const extrudeIndex = (attributeIdx % 4) * 3;\n return [\n extrude[extrudeIndex],\n extrude[extrudeIndex + 1],\n extrude[extrudeIndex + 2],\n ];\n },\n },\n });\n\n // point layer size;\n this.styleAttributeService.registerStyleAttribute({\n name: 'size',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_Size',\n buffer: {\n // give the WebGL driver a hint that this buffer may change\n usage: gl.DYNAMIC_DRAW,\n data: [],\n type: gl.FLOAT,\n },\n size: 1,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n ) => {\n const { size = 5 } = feature;\n // console.log('featureIdx', featureIdx, feature)\n return Array.isArray(size)\n ? [size[0] * this.meter2coord]\n : [(size as number) * this.meter2coord];\n },\n },\n });\n\n // point layer size;\n this.styleAttributeService.registerStyleAttribute({\n name: 'shape',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_Shape',\n buffer: {\n // give the WebGL driver a hint that this buffer may change\n usage: gl.DYNAMIC_DRAW,\n data: [],\n type: gl.FLOAT,\n },\n size: 1,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n ) => {\n const { shape = 2 } = feature;\n const shape2d = this.layer.getLayerConfig().shape2d as string[];\n const shapeIndex = shape2d.indexOf(shape as string);\n return [shapeIndex];\n },\n },\n });\n }\n}\n"],"file":"radar.js"}
@@ -25,7 +25,7 @@ import CollisionIndex from '../../utils/collision-index';
25
25
  import { calculateCentroid } from '../../utils/geo';
26
26
  import { getGlyphQuads, shapeText } from '../../utils/symbol-layout';
27
27
  var textFrag = "#define SDF_PX 8.0\n#define EDGE_GAMMA 0.105\n#define FONT_SIZE 48.0\nuniform sampler2D u_sdf_map;\nuniform float u_gamma_scale : 0.5;\n// uniform float u_font_size : 24.0;\nuniform float u_opacity : 1.0;\nuniform vec4 u_stroke_color : [0, 0, 0, 1];\nuniform float u_stroke_width : 2.0;\nuniform float u_halo_blur : 0.5;\nuniform float u_DevicePixelRatio;\n\nvarying vec4 v_color;\nvarying vec2 v_uv;\nvarying float v_gamma_scale;\nvarying float v_fontScale;\n\nvarying mat4 styleMappingMat; // \u4F20\u9012\u4ECE\u7247\u5143\u4E2D\u4F20\u9012\u7684\u6620\u5C04\u6570\u636E\n\n#pragma include \"picking\"\nvoid main() {\n // get style data mapping\n float opacity = styleMappingMat[0][0];\n float strokeWidth = styleMappingMat[0][2];\n vec4 textrueStroke = vec4(\n styleMappingMat[1][0],\n styleMappingMat[1][1],\n styleMappingMat[1][2],\n styleMappingMat[1][3]\n );\n\n // get sdf from atlas\n float dist = texture2D(u_sdf_map, v_uv).a;\n\n // float fontScale = u_font_size / FONT_SIZE;\n\n // lowp float buff = (6.0 - u_stroke_width / v_fontScale) / SDF_PX;\n lowp float buff = (6.0 - strokeWidth / v_fontScale) / SDF_PX;\n highp float gamma = (u_halo_blur * 1.19 / SDF_PX + EDGE_GAMMA) / (v_fontScale * u_gamma_scale) / 1.0;\n\n highp float gamma_scaled = gamma * v_gamma_scale;\n\n highp float alpha = smoothstep(buff - gamma_scaled, buff + gamma_scaled, dist);\n // gl_FragColor = mix(vec4(v_color.rgb, v_color.a * u_opacity), vec4(u_stroke_color.rgb, u_stroke_color.a * u_opacity), smoothstep(0., 0.5, 1. - dist));\n gl_FragColor = mix(vec4(v_color.rgb, v_color.a * opacity), vec4(textrueStroke.rgb, textrueStroke.a * opacity), smoothstep(0., 0.5, 1. - dist));\n gl_FragColor.a= gl_FragColor.a * alpha;\n gl_FragColor = filterColor(gl_FragColor);\n}\n";
28
- var textVert = "#define SDF_PX 8.0\n#define EDGE_GAMMA 0.105\n#define FONT_SIZE 24.0\nattribute vec3 a_Position;\nattribute vec2 a_tex;\nattribute vec2 a_textOffsets;\nattribute vec4 a_Color;\nattribute float a_Size;\nattribute float a_Rotate;\n\nuniform vec2 u_sdf_map_size;\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\n\nvarying vec2 v_uv;\nvarying float v_gamma_scale;\nvarying vec4 v_color;\nvarying float v_fontScale;\n\nvarying mat4 styleMappingMat; // \u7528\u4E8E\u5C06\u5728\u9876\u70B9\u7740\u8272\u5668\u4E2D\u8BA1\u7B97\u597D\u7684\u6837\u5F0F\u503C\u4F20\u9012\u7ED9\u7247\u5143\n\nuniform float u_opacity : 1;\nuniform float u_stroke_width : 2;\nuniform vec4 u_stroke_color : [0.0, 0.0, 0.0, 0.0];\n\n#pragma include \"styleMapping\"\n#pragma include \"styleMappingCalOpacity\"\n#pragma include \"styleMappingCalStrokeWidth\"\n\n#pragma include \"projection\"\n#pragma include \"picking\"\n\nvoid main() {\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n styleMappingMat = mat4(\n 0.0, 0.0, 0.0, 0.0, // opacity - strokeOpacity - strokeWidth - empty\n 0.0, 0.0, 0.0, 0.0, // strokeR - strokeG - strokeB - strokeA\n 0.0, 0.0, 0.0, 0.0, // offsets[0] - offsets[1]\n 0.0, 0.0, 0.0, 0.0\n );\n\n float rowCount = u_cellTypeLayout[0][0]; // \u5F53\u524D\u7684\u6570\u636E\u7EB9\u7406\u6709\u51E0\u884C\n float columnCount = u_cellTypeLayout[0][1]; // \u5F53\u770B\u5230\u6570\u636E\u7EB9\u7406\u6709\u51E0\u5217\n float columnWidth = 1.0/columnCount; // \u5217\u5BBD\n float rowHeight = 1.0/rowCount; // \u884C\u9AD8\n float cellCount = calCellCount(); // opacity - strokeOpacity - strokeWidth - stroke - offsets\n float id = a_vertexId; // \u7B2Cn\u4E2A\u9876\u70B9\n float cellCurrentRow = floor(id * cellCount / columnCount) + 1.0; // \u8D77\u59CB\u70B9\u5728\u7B2C\u51E0\u884C\n float cellCurrentColumn = mod(id * cellCount, columnCount) + 1.0; // \u8D77\u59CB\u70B9\u5728\u7B2C\u51E0\u5217\n \n // cell \u56FA\u5B9A\u987A\u5E8F opacity -> strokeOpacity -> strokeWidth -> stroke ... \n // \u6309\u987A\u5E8F\u4ECE cell \u4E2D\u53D6\u503C\u3001\u82E5\u6CA1\u6709\u5219\u81EA\u52A8\u5F80\u4E0B\u53D6\u503C\n float textureOffset = 0.0; // \u5728 cell \u4E2D\u53D6\u503C\u7684\u504F\u79FB\u91CF\n\n vec2 opacityAndOffset = calOpacityAndOffset(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset, columnWidth, rowHeight);\n styleMappingMat[0][0] = opacityAndOffset.r;\n textureOffset = opacityAndOffset.g;\n\n vec2 strokeWidthAndOffset = calStrokeWidthAndOffset(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset, columnWidth, rowHeight);\n styleMappingMat[0][2] = strokeWidthAndOffset.r;\n textureOffset = strokeWidthAndOffset.g;\n\n vec4 textrueStroke = vec4(-1.0, -1.0, -1.0, -1.0);\n if(hasStroke()) {\n vec2 valueRPos = nextPos(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset);\n styleMappingMat[1][0] = pos2value(valueRPos, columnWidth, rowHeight); // R\n textureOffset += 1.0;\n\n vec2 valueGPos = nextPos(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset);\n styleMappingMat[1][1] = pos2value(valueGPos, columnWidth, rowHeight); // G\n textureOffset += 1.0;\n\n vec2 valueBPos = nextPos(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset);\n styleMappingMat[1][2] = pos2value(valueBPos, columnWidth, rowHeight); // B\n textureOffset += 1.0;\n\n vec2 valueAPos = nextPos(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset);\n styleMappingMat[1][3] = pos2value(valueAPos, columnWidth, rowHeight); // A\n textureOffset += 1.0;\n } else {\n if(u_stroke_color == vec4(0.0)) {\n styleMappingMat[1][0] = v_color.r;\n styleMappingMat[1][1] = v_color.g;\n styleMappingMat[1][2] = v_color.b;\n styleMappingMat[1][3] = v_color.a;\n } else {\n styleMappingMat[1][0] = u_stroke_color.r;\n styleMappingMat[1][1] = u_stroke_color.g;\n styleMappingMat[1][2] = u_stroke_color.b;\n styleMappingMat[1][3] = u_stroke_color.a;\n }\n }\n \n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n\n v_color = a_Color;\n v_uv = a_tex / u_sdf_map_size;\n\n // \u6587\u672C\u7F29\u653E\u6BD4\u4F8B\n float fontScale = a_Size / FONT_SIZE;\n v_fontScale = fontScale;\n\n vec4 project_pos = project_position(vec4(a_Position, 1.0));\n // vec4 projected_position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));\n\n highp float angle_sin = sin(a_Rotate);\n highp float angle_cos = cos(a_Rotate);\n mat2 rotation_matrix = mat2(angle_cos, -1.0 * angle_sin, angle_sin, angle_cos);\n \n // gl_Position = vec4(projected_position.xy / projected_position.w + rotation_matrix * a_textOffsets * fontScale / u_ViewportSize * 2.0 * u_DevicePixelRatio, 0.0, 1.0);\n\n vec4 projected_position;\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n projected_position = u_Mvp * (vec4(a_Position.xyz, 1.0));\n } else { // else\n projected_position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));\n }\n\n gl_Position = vec4(projected_position.xy / projected_position.w + rotation_matrix * a_textOffsets * fontScale / u_ViewportSize * 2.0 * u_DevicePixelRatio, 0.0, 1.0);\n v_gamma_scale = gl_Position.w;\n setPickingColor(a_PickingColor);\n\n}\n";
28
+ var textVert = "#define SDF_PX 8.0\n#define EDGE_GAMMA 0.105\n#define FONT_SIZE 24.0\nattribute vec3 a_Position;\nattribute vec2 a_tex;\nattribute vec2 a_textOffsets;\nattribute vec4 a_Color;\nattribute float a_Size;\nattribute float a_Rotate;\n\nuniform vec2 u_sdf_map_size;\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\nuniform float u_raisingHeight: 0.0;\n\nvarying vec2 v_uv;\nvarying float v_gamma_scale;\nvarying vec4 v_color;\nvarying float v_fontScale;\n\nvarying mat4 styleMappingMat; // \u7528\u4E8E\u5C06\u5728\u9876\u70B9\u7740\u8272\u5668\u4E2D\u8BA1\u7B97\u597D\u7684\u6837\u5F0F\u503C\u4F20\u9012\u7ED9\u7247\u5143\n\nuniform float u_opacity : 1;\nuniform float u_stroke_width : 2;\nuniform vec4 u_stroke_color : [0.0, 0.0, 0.0, 0.0];\n\n#pragma include \"styleMapping\"\n#pragma include \"styleMappingCalOpacity\"\n#pragma include \"styleMappingCalStrokeWidth\"\n\n#pragma include \"projection\"\n#pragma include \"picking\"\n\nvoid main() {\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n styleMappingMat = mat4(\n 0.0, 0.0, 0.0, 0.0, // opacity - strokeOpacity - strokeWidth - empty\n 0.0, 0.0, 0.0, 0.0, // strokeR - strokeG - strokeB - strokeA\n 0.0, 0.0, 0.0, 0.0, // offsets[0] - offsets[1]\n 0.0, 0.0, 0.0, 0.0\n );\n\n float rowCount = u_cellTypeLayout[0][0]; // \u5F53\u524D\u7684\u6570\u636E\u7EB9\u7406\u6709\u51E0\u884C\n float columnCount = u_cellTypeLayout[0][1]; // \u5F53\u770B\u5230\u6570\u636E\u7EB9\u7406\u6709\u51E0\u5217\n float columnWidth = 1.0/columnCount; // \u5217\u5BBD\n float rowHeight = 1.0/rowCount; // \u884C\u9AD8\n float cellCount = calCellCount(); // opacity - strokeOpacity - strokeWidth - stroke - offsets\n float id = a_vertexId; // \u7B2Cn\u4E2A\u9876\u70B9\n float cellCurrentRow = floor(id * cellCount / columnCount) + 1.0; // \u8D77\u59CB\u70B9\u5728\u7B2C\u51E0\u884C\n float cellCurrentColumn = mod(id * cellCount, columnCount) + 1.0; // \u8D77\u59CB\u70B9\u5728\u7B2C\u51E0\u5217\n \n // cell \u56FA\u5B9A\u987A\u5E8F opacity -> strokeOpacity -> strokeWidth -> stroke ... \n // \u6309\u987A\u5E8F\u4ECE cell \u4E2D\u53D6\u503C\u3001\u82E5\u6CA1\u6709\u5219\u81EA\u52A8\u5F80\u4E0B\u53D6\u503C\n float textureOffset = 0.0; // \u5728 cell \u4E2D\u53D6\u503C\u7684\u504F\u79FB\u91CF\n\n vec2 opacityAndOffset = calOpacityAndOffset(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset, columnWidth, rowHeight);\n styleMappingMat[0][0] = opacityAndOffset.r;\n textureOffset = opacityAndOffset.g;\n\n vec2 strokeWidthAndOffset = calStrokeWidthAndOffset(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset, columnWidth, rowHeight);\n styleMappingMat[0][2] = strokeWidthAndOffset.r;\n textureOffset = strokeWidthAndOffset.g;\n\n vec4 textrueStroke = vec4(-1.0, -1.0, -1.0, -1.0);\n if(hasStroke()) {\n vec2 valueRPos = nextPos(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset);\n styleMappingMat[1][0] = pos2value(valueRPos, columnWidth, rowHeight); // R\n textureOffset += 1.0;\n\n vec2 valueGPos = nextPos(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset);\n styleMappingMat[1][1] = pos2value(valueGPos, columnWidth, rowHeight); // G\n textureOffset += 1.0;\n\n vec2 valueBPos = nextPos(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset);\n styleMappingMat[1][2] = pos2value(valueBPos, columnWidth, rowHeight); // B\n textureOffset += 1.0;\n\n vec2 valueAPos = nextPos(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset);\n styleMappingMat[1][3] = pos2value(valueAPos, columnWidth, rowHeight); // A\n textureOffset += 1.0;\n } else {\n if(u_stroke_color == vec4(0.0)) {\n styleMappingMat[1][0] = v_color.r;\n styleMappingMat[1][1] = v_color.g;\n styleMappingMat[1][2] = v_color.b;\n styleMappingMat[1][3] = v_color.a;\n } else {\n styleMappingMat[1][0] = u_stroke_color.r;\n styleMappingMat[1][1] = u_stroke_color.g;\n styleMappingMat[1][2] = u_stroke_color.b;\n styleMappingMat[1][3] = u_stroke_color.a;\n }\n }\n \n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n\n v_color = a_Color;\n v_uv = a_tex / u_sdf_map_size;\n\n // \u6587\u672C\u7F29\u653E\u6BD4\u4F8B\n float fontScale = a_Size / FONT_SIZE;\n v_fontScale = fontScale;\n\n vec4 project_pos = project_position(vec4(a_Position, 1.0));\n // vec4 projected_position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));\n\n highp float angle_sin = sin(a_Rotate);\n highp float angle_cos = cos(a_Rotate);\n mat2 rotation_matrix = mat2(angle_cos, -1.0 * angle_sin, angle_sin, angle_cos);\n \n // gl_Position = vec4(projected_position.xy / projected_position.w + rotation_matrix * a_textOffsets * fontScale / u_ViewportSize * 2.0 * u_DevicePixelRatio, 0.0, 1.0);\n\n float raiseHeight = u_raisingHeight;\n if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {\n float mapboxZoomScale = 4.0/pow(2.0, 21.0 - u_Zoom);\n raiseHeight = u_raisingHeight * mapboxZoomScale;\n }\n\n vec4 projected_position;\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n projected_position = u_Mvp * (vec4(a_Position.xyz + vec3(0.0, 0.0, raiseHeight), 1.0));\n } else { // else\n projected_position = project_common_position_to_clipspace(vec4(project_pos.xyz + vec3(0.0, 0.0, raiseHeight), 1.0));\n }\n\n gl_Position = vec4(\n projected_position.xy / projected_position.w + rotation_matrix * a_textOffsets * fontScale / u_ViewportSize * 2.0 * u_DevicePixelRatio, 0.0, 1.0);\n v_gamma_scale = gl_Position.w;\n setPickingColor(a_PickingColor);\n\n}\n";
29
29
  export function TextTriangulation(feature) {
30
30
  var that = this;
31
31
  var id = feature.id;
@@ -133,7 +133,9 @@ var TextModel = function (_BaseModel) {
133
133
  _ref2$halo = _ref2.halo,
134
134
  halo = _ref2$halo === void 0 ? 0.5 : _ref2$halo,
135
135
  _ref2$gamma = _ref2.gamma,
136
- gamma = _ref2$gamma === void 0 ? 2.0 : _ref2$gamma;
136
+ gamma = _ref2$gamma === void 0 ? 2.0 : _ref2$gamma,
137
+ _ref2$raisingHeight = _ref2.raisingHeight,
138
+ raisingHeight = _ref2$raisingHeight === void 0 ? 0 : _ref2$raisingHeight;
137
139
 
138
140
  var _this$fontService = this.fontService,
139
141
  canvas = _this$fontService.canvas,
@@ -187,6 +189,7 @@ var TextModel = function (_BaseModel) {
187
189
  return {
188
190
  u_dataTexture: this.dataTexture,
189
191
  u_cellTypeLayout: this.getCellTypeLayout(),
192
+ u_raisingHeight: Number(raisingHeight),
190
193
  u_opacity: _isNumber(opacity) ? opacity : 1.0,
191
194
  u_stroke_width: _isNumber(strokeWidth) ? strokeWidth : 0.0,
192
195
  u_stroke_color: this.getStrokeColor(stroke),