@antv/l7-layers 2.9.18 → 2.9.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/Geometry/index.js +12 -2
- package/es/Geometry/index.js.map +1 -1
- package/es/Geometry/models/billboard.d.ts +3 -3
- package/es/Geometry/models/billboard.js +11 -6
- package/es/Geometry/models/billboard.js.map +1 -1
- package/es/Geometry/models/plane.d.ts +3 -3
- package/es/Geometry/models/plane.js +12 -7
- package/es/Geometry/models/plane.js.map +1 -1
- package/es/Geometry/models/sprite.d.ts +3 -3
- package/es/Geometry/models/sprite.js +11 -6
- package/es/Geometry/models/sprite.js.map +1 -1
- package/es/canvas/index.js +12 -2
- package/es/canvas/index.js.map +1 -1
- package/es/citybuliding/building.js +12 -2
- package/es/citybuliding/building.js.map +1 -1
- package/es/citybuliding/models/build.d.ts +2 -1
- package/es/citybuliding/models/build.js +16 -3
- package/es/citybuliding/models/build.js.map +1 -1
- package/es/core/BaseLayer.d.ts +1 -1
- package/es/core/BaseLayer.js +105 -62
- package/es/core/BaseLayer.js.map +1 -1
- package/es/core/BaseModel.d.ts +2 -2
- package/es/core/BaseModel.js +2 -2
- package/es/core/BaseModel.js.map +1 -1
- package/es/core/interface.d.ts +13 -1
- package/es/core/interface.js +14 -0
- package/es/core/interface.js.map +1 -1
- package/es/core/triangulation.d.ts +1 -0
- package/es/core/triangulation.js +37 -11
- package/es/core/triangulation.js.map +1 -1
- package/es/earth/index.js +8 -2
- package/es/earth/index.js.map +1 -1
- package/es/earth/models/atmosphere.d.ts +2 -2
- package/es/earth/models/atmosphere.js +11 -6
- package/es/earth/models/atmosphere.js.map +1 -1
- package/es/earth/models/base.d.ts +2 -2
- package/es/earth/models/base.js +11 -6
- package/es/earth/models/base.js.map +1 -1
- package/es/earth/models/bloomsphere.d.ts +2 -2
- package/es/earth/models/bloomsphere.js +11 -6
- package/es/earth/models/bloomsphere.js.map +1 -1
- package/es/heatmap/index.js +17 -5
- package/es/heatmap/index.js.map +1 -1
- package/es/heatmap/models/grid.d.ts +2 -2
- package/es/heatmap/models/grid.js +12 -8
- package/es/heatmap/models/grid.js.map +1 -1
- package/es/heatmap/models/grid3d.d.ts +2 -2
- package/es/heatmap/models/grid3d.js +12 -6
- package/es/heatmap/models/grid3d.js.map +1 -1
- package/es/heatmap/models/heatmap.d.ts +2 -2
- package/es/heatmap/models/heatmap.js +112 -62
- package/es/heatmap/models/heatmap.js.map +1 -1
- package/es/heatmap/models/hexagon.d.ts +2 -2
- package/es/heatmap/models/hexagon.js +11 -6
- package/es/heatmap/models/hexagon.js.map +1 -1
- package/es/image/index.js +12 -2
- package/es/image/index.js.map +1 -1
- package/es/image/models/dataImage.d.ts +3 -3
- package/es/image/models/dataImage.js +10 -5
- package/es/image/models/dataImage.js.map +1 -1
- package/es/image/models/image.d.ts +3 -3
- package/es/image/models/image.js +11 -7
- package/es/image/models/image.js.map +1 -1
- package/es/line/index.d.ts +0 -2
- package/es/line/index.js +12 -5
- package/es/line/index.js.map +1 -1
- package/es/line/models/arc.d.ts +2 -2
- package/es/line/models/arc.js +14 -9
- package/es/line/models/arc.js.map +1 -1
- package/es/line/models/arc_3d.d.ts +2 -2
- package/es/line/models/arc_3d.js +13 -8
- package/es/line/models/arc_3d.js.map +1 -1
- package/es/line/models/earthArc_3d.d.ts +2 -2
- package/es/line/models/earthArc_3d.js +17 -9
- package/es/line/models/earthArc_3d.js.map +1 -1
- package/es/line/models/great_circle.d.ts +2 -2
- package/es/line/models/great_circle.js +11 -6
- package/es/line/models/great_circle.js.map +1 -1
- package/es/line/models/half.d.ts +2 -2
- package/es/line/models/half.js +46 -29
- package/es/line/models/half.js.map +1 -1
- package/es/line/models/index.d.ts +1 -1
- package/es/line/models/index.js +0 -2
- package/es/line/models/index.js.map +1 -1
- package/es/line/models/line.d.ts +2 -2
- package/es/line/models/line.js +37 -18
- package/es/line/models/line.js.map +1 -1
- package/es/line/models/linearline.d.ts +2 -11
- package/es/line/models/linearline.js +21 -27
- package/es/line/models/linearline.js.map +1 -1
- package/es/line/models/simpleLine.d.ts +2 -2
- package/es/line/models/simpleLine.js +13 -8
- package/es/line/models/simpleLine.js.map +1 -1
- package/es/line/models/tile.d.ts +2 -11
- package/es/line/models/tile.js +45 -39
- package/es/line/models/tile.js.map +1 -1
- package/es/line/models/wall.d.ts +2 -2
- package/es/line/models/wall.js +13 -9
- package/es/line/models/wall.js.map +1 -1
- package/es/mask/index.js +12 -2
- package/es/mask/index.js.map +1 -1
- package/es/mask/models/fill.d.ts +2 -2
- package/es/mask/models/fill.js +53 -27
- package/es/mask/models/fill.js.map +1 -1
- package/es/plugins/DataMappingPlugin.js +29 -8
- package/es/plugins/DataMappingPlugin.js.map +1 -1
- package/es/plugins/DataSourcePlugin.js +14 -5
- package/es/plugins/DataSourcePlugin.js.map +1 -1
- package/es/plugins/LayerModelPlugin.d.ts +2 -0
- package/es/plugins/LayerModelPlugin.js +35 -7
- package/es/plugins/LayerModelPlugin.js.map +1 -1
- package/es/plugins/PixelPickingPlugin.js +16 -13
- package/es/plugins/PixelPickingPlugin.js.map +1 -1
- package/es/point/index.d.ts +1 -1
- package/es/point/index.js +26 -15
- package/es/point/index.js.map +1 -1
- package/es/point/models/earthExtrude.d.ts +2 -2
- package/es/point/models/earthExtrude.js +16 -14
- package/es/point/models/earthExtrude.js.map +1 -1
- package/es/point/models/earthFill.d.ts +2 -11
- package/es/point/models/earthFill.js +13 -22
- package/es/point/models/earthFill.js.map +1 -1
- package/es/point/models/extrude.d.ts +2 -2
- package/es/point/models/extrude.js +49 -27
- package/es/point/models/extrude.js.map +1 -1
- package/es/point/models/fill.d.ts +2 -2
- package/es/point/models/fill.js +59 -41
- package/es/point/models/fill.js.map +1 -1
- package/es/point/models/fillmage.d.ts +2 -7
- package/es/point/models/fillmage.js +13 -22
- package/es/point/models/fillmage.js.map +1 -1
- package/es/point/models/image.d.ts +2 -2
- package/es/point/models/image.js +11 -6
- package/es/point/models/image.js.map +1 -1
- package/es/point/models/index.d.ts +1 -1
- package/es/point/models/index.js +0 -2
- package/es/point/models/index.js.map +1 -1
- package/es/point/models/normal.d.ts +2 -2
- package/es/point/models/normal.js +11 -6
- package/es/point/models/normal.js.map +1 -1
- package/es/point/models/radar.d.ts +2 -11
- package/es/point/models/radar.js +13 -22
- package/es/point/models/radar.js.map +1 -1
- package/es/point/models/simplePoint.d.ts +2 -2
- package/es/point/models/simplePoint.js +11 -6
- package/es/point/models/simplePoint.js.map +1 -1
- package/es/point/models/text.d.ts +3 -2
- package/es/point/models/text.js +110 -75
- package/es/point/models/text.js.map +1 -1
- package/es/point/models/tile.d.ts +2 -11
- package/es/point/models/tile.js +22 -25
- package/es/point/models/tile.js.map +1 -1
- package/es/polygon/index.js +12 -2
- package/es/polygon/index.js.map +1 -1
- package/es/polygon/models/extrude.d.ts +2 -2
- package/es/polygon/models/extrude.js +10 -5
- package/es/polygon/models/extrude.js.map +1 -1
- package/es/polygon/models/fill.d.ts +2 -2
- package/es/polygon/models/fill.js +27 -13
- package/es/polygon/models/fill.js.map +1 -1
- package/es/polygon/models/ocean.d.ts +2 -2
- package/es/polygon/models/ocean.js +12 -6
- package/es/polygon/models/ocean.js.map +1 -1
- package/es/polygon/models/tile.d.ts +2 -3
- package/es/polygon/models/tile.js +17 -27
- package/es/polygon/models/tile.js.map +1 -1
- package/es/polygon/models/water.d.ts +2 -2
- package/es/polygon/models/water.js +12 -6
- package/es/polygon/models/water.js.map +1 -1
- package/es/raster/index.js +12 -2
- package/es/raster/index.js.map +1 -1
- package/es/raster/models/raster.d.ts +3 -3
- package/es/raster/models/raster.js +11 -7
- package/es/raster/models/raster.js.map +1 -1
- package/es/tile/manager/tileLayerManager.js +3 -0
- package/es/tile/manager/tileLayerManager.js.map +1 -1
- package/es/tile/manager/tilePickerManager.js +1 -0
- package/es/tile/manager/tilePickerManager.js.map +1 -1
- package/es/tile/tileFactory/base.js.map +1 -1
- package/es/tile/tileFactory/point.js.map +1 -1
- package/es/tile/tileFactory/rasterDataLayer.js +12 -2
- package/es/tile/tileFactory/rasterDataLayer.js.map +1 -1
- package/es/tile/tileFactory/vectorLayer.js +12 -2
- package/es/tile/tileFactory/vectorLayer.js.map +1 -1
- package/es/utils/extrude_polyline.d.ts +15 -0
- package/es/utils/extrude_polyline.js +146 -14
- package/es/utils/extrude_polyline.js.map +1 -1
- package/es/wind/index.js +12 -2
- package/es/wind/index.js.map +1 -1
- package/es/wind/models/wind.d.ts +4 -2
- package/es/wind/models/wind.js +50 -18
- package/es/wind/models/wind.js.map +1 -1
- package/es/wind/models/windRender.js +1 -1
- package/es/wind/models/windRender.js.map +1 -1
- package/lib/Geometry/index.js +12 -2
- package/lib/Geometry/index.js.map +1 -1
- package/lib/Geometry/models/billboard.js +11 -6
- package/lib/Geometry/models/billboard.js.map +1 -1
- package/lib/Geometry/models/plane.js +12 -7
- package/lib/Geometry/models/plane.js.map +1 -1
- package/lib/Geometry/models/sprite.js +11 -6
- package/lib/Geometry/models/sprite.js.map +1 -1
- package/lib/canvas/index.js +12 -2
- package/lib/canvas/index.js.map +1 -1
- package/lib/citybuliding/building.js +12 -2
- package/lib/citybuliding/building.js.map +1 -1
- package/lib/citybuliding/models/build.js +16 -3
- package/lib/citybuliding/models/build.js.map +1 -1
- package/lib/core/BaseLayer.js +104 -61
- package/lib/core/BaseLayer.js.map +1 -1
- package/lib/core/BaseModel.js +2 -2
- package/lib/core/BaseModel.js.map +1 -1
- package/lib/core/interface.js +17 -1
- package/lib/core/interface.js.map +1 -1
- package/lib/core/triangulation.js +40 -16
- package/lib/core/triangulation.js.map +1 -1
- package/lib/earth/index.js +8 -2
- package/lib/earth/index.js.map +1 -1
- package/lib/earth/models/atmosphere.js +11 -6
- package/lib/earth/models/atmosphere.js.map +1 -1
- package/lib/earth/models/base.js +11 -6
- package/lib/earth/models/base.js.map +1 -1
- package/lib/earth/models/bloomsphere.js +11 -6
- package/lib/earth/models/bloomsphere.js.map +1 -1
- package/lib/heatmap/index.js +17 -5
- package/lib/heatmap/index.js.map +1 -1
- package/lib/heatmap/models/grid.js +12 -8
- package/lib/heatmap/models/grid.js.map +1 -1
- package/lib/heatmap/models/grid3d.js +12 -6
- package/lib/heatmap/models/grid3d.js.map +1 -1
- package/lib/heatmap/models/heatmap.js +113 -62
- package/lib/heatmap/models/heatmap.js.map +1 -1
- package/lib/heatmap/models/hexagon.js +11 -6
- package/lib/heatmap/models/hexagon.js.map +1 -1
- package/lib/image/index.js +12 -2
- package/lib/image/index.js.map +1 -1
- package/lib/image/models/dataImage.js +10 -5
- package/lib/image/models/dataImage.js.map +1 -1
- package/lib/image/models/image.js +11 -7
- package/lib/image/models/image.js.map +1 -1
- package/lib/line/index.js +12 -5
- package/lib/line/index.js.map +1 -1
- package/lib/line/models/arc.js +14 -9
- package/lib/line/models/arc.js.map +1 -1
- package/lib/line/models/arc_3d.js +13 -8
- package/lib/line/models/arc_3d.js.map +1 -1
- package/lib/line/models/earthArc_3d.js +17 -9
- package/lib/line/models/earthArc_3d.js.map +1 -1
- package/lib/line/models/great_circle.js +11 -6
- package/lib/line/models/great_circle.js.map +1 -1
- package/lib/line/models/half.js +48 -29
- package/lib/line/models/half.js.map +1 -1
- package/lib/line/models/index.js +0 -3
- package/lib/line/models/index.js.map +1 -1
- package/lib/line/models/line.js +38 -19
- package/lib/line/models/line.js.map +1 -1
- package/lib/line/models/linearline.js +22 -27
- package/lib/line/models/linearline.js.map +1 -1
- package/lib/line/models/simpleLine.js +13 -8
- package/lib/line/models/simpleLine.js.map +1 -1
- package/lib/line/models/tile.js +47 -39
- package/lib/line/models/tile.js.map +1 -1
- package/lib/line/models/wall.js +13 -9
- package/lib/line/models/wall.js.map +1 -1
- package/lib/mask/index.js +12 -2
- package/lib/mask/index.js.map +1 -1
- package/lib/mask/models/fill.js +55 -27
- package/lib/mask/models/fill.js.map +1 -1
- package/lib/plugins/DataMappingPlugin.js +29 -8
- package/lib/plugins/DataMappingPlugin.js.map +1 -1
- package/lib/plugins/DataSourcePlugin.js +13 -4
- package/lib/plugins/DataSourcePlugin.js.map +1 -1
- package/lib/plugins/LayerModelPlugin.js +35 -7
- package/lib/plugins/LayerModelPlugin.js.map +1 -1
- package/lib/plugins/PixelPickingPlugin.js +16 -13
- package/lib/plugins/PixelPickingPlugin.js.map +1 -1
- package/lib/point/index.js +26 -15
- package/lib/point/index.js.map +1 -1
- package/lib/point/models/earthExtrude.js +16 -15
- package/lib/point/models/earthExtrude.js.map +1 -1
- package/lib/point/models/earthFill.js +13 -22
- package/lib/point/models/earthFill.js.map +1 -1
- package/lib/point/models/extrude.js +51 -28
- package/lib/point/models/extrude.js.map +1 -1
- package/lib/point/models/fill.js +61 -42
- package/lib/point/models/fill.js.map +1 -1
- package/lib/point/models/fillmage.js +13 -22
- package/lib/point/models/fillmage.js.map +1 -1
- package/lib/point/models/image.js +11 -6
- package/lib/point/models/image.js.map +1 -1
- package/lib/point/models/index.js +0 -3
- package/lib/point/models/index.js.map +1 -1
- package/lib/point/models/normal.js +11 -6
- package/lib/point/models/normal.js.map +1 -1
- package/lib/point/models/radar.js +13 -22
- package/lib/point/models/radar.js.map +1 -1
- package/lib/point/models/simplePoint.js +11 -6
- package/lib/point/models/simplePoint.js.map +1 -1
- package/lib/point/models/text.js +112 -78
- package/lib/point/models/text.js.map +1 -1
- package/lib/point/models/tile.js +22 -25
- package/lib/point/models/tile.js.map +1 -1
- package/lib/polygon/index.js +12 -2
- package/lib/polygon/index.js.map +1 -1
- package/lib/polygon/models/extrude.js +10 -5
- package/lib/polygon/models/extrude.js.map +1 -1
- package/lib/polygon/models/fill.js +25 -11
- package/lib/polygon/models/fill.js.map +1 -1
- package/lib/polygon/models/ocean.js +12 -6
- package/lib/polygon/models/ocean.js.map +1 -1
- package/lib/polygon/models/tile.js +17 -27
- package/lib/polygon/models/tile.js.map +1 -1
- package/lib/polygon/models/water.js +12 -6
- package/lib/polygon/models/water.js.map +1 -1
- package/lib/raster/index.js +12 -2
- package/lib/raster/index.js.map +1 -1
- package/lib/raster/models/raster.js +11 -7
- package/lib/raster/models/raster.js.map +1 -1
- package/lib/tile/manager/tileLayerManager.js +3 -0
- package/lib/tile/manager/tileLayerManager.js.map +1 -1
- package/lib/tile/manager/tilePickerManager.js +1 -0
- package/lib/tile/manager/tilePickerManager.js.map +1 -1
- package/lib/tile/tileFactory/base.js.map +1 -1
- package/lib/tile/tileFactory/point.js.map +1 -1
- package/lib/tile/tileFactory/rasterDataLayer.js +12 -2
- package/lib/tile/tileFactory/rasterDataLayer.js.map +1 -1
- package/lib/tile/tileFactory/vectorLayer.js +12 -2
- package/lib/tile/tileFactory/vectorLayer.js.map +1 -1
- package/lib/utils/extrude_polyline.js +148 -14
- package/lib/utils/extrude_polyline.js.map +1 -1
- package/lib/wind/index.js +12 -2
- package/lib/wind/index.js.map +1 -1
- package/lib/wind/models/wind.js +49 -18
- package/lib/wind/models/wind.js.map +1 -1
- package/lib/wind/models/windRender.js +1 -1
- package/lib/wind/models/windRender.js.map +1 -1
- package/package.json +9 -8
- package/es/line/models/arcmini.d.ts +0 -9
- package/es/line/models/arcmini.js +0 -145
- package/es/line/models/arcmini.js.map +0 -1
- package/es/point/models/icon-font.d.ts +0 -11
- package/es/point/models/icon-font.js +0 -181
- package/es/point/models/icon-font.js.map +0 -1
- package/es/raster/image.d.ts +0 -0
- package/es/raster/image.js +0 -2
- package/es/raster/image.js.map +0 -1
- package/es/raster/raster2d.d.ts +0 -27
- package/es/raster/raster2d.js +0 -158
- package/es/raster/raster2d.js.map +0 -1
- package/es/utils/geo.d.ts +0 -12
- package/es/utils/geo.js +0 -53
- package/es/utils/geo.js.map +0 -1
- package/lib/line/models/arcmini.js +0 -161
- package/lib/line/models/arcmini.js.map +0 -1
- package/lib/point/models/icon-font.js +0 -196
- package/lib/point/models/icon-font.js.map +0 -1
- package/lib/raster/image.js +0 -2
- package/lib/raster/image.js.map +0 -1
- package/lib/raster/raster2d.js +0 -172
- package/lib/raster/raster2d.js.map +0 -1
- package/lib/utils/geo.js +0 -65
- package/lib/utils/geo.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/line/models/line.ts"],"names":["AttributeType","gl","getMask","rgb2arr","BaseModel","LineTriangulation","lineStyleObj","solid","dash","LineModel","createTexture2D","rendererService","texture","update","data","iconService","getCanvas","layer","render","mag","NEAREST","min","premultiplyAlpha","width","height","canvasHeight","getLayerConfig","opacity","sourceColor","targetColor","textureBlend","lineType","dashArray","lineTexture","iconStep","vertexHeightScale","borderWidth","borderColor","raisingHeight","heightfixed","arrow","enable","arrowWidth","arrowHeight","tailWidth","length","push","getDirty","bind","useLinearColor","sourceColorArr","targetColorArr","dataTextureTest","dataTextureNeedUpdate","judgeStyleAttributes","encodeData","getEncodedData","calDataFrame","cellLength","cellProperties","rowCount","dataTexture","flipY","format","LUMINANCE","type","FLOAT","u_dataTexture","u_cellTypeLayout","getCellTypeLayout","u_opacity","u_textureBlend","u_line_type","u_dash_array","u_texture","u_line_texture","u_icon_step","u_textSize","u_borderWidth","u_borderColor","u_linearColor","u_sourceColor","u_targetColor","u_heightfixed","Number","u_vertexScale","u_raisingHeight","u_arrow","u_arrowHeight","u_arrowWidth","u_tailWidth","undefined","animateOption","u_aimate","animateOption2Array","u_time","getLayerAnimateTime","updateTexture","on","buildModels","destroy","off","mask","maskInside","depth","getShaders","frag","vert","triangulation","buildLayerModel","moduleName","vertexShader","fragmentShader","primitive","TRIANGLES","blend","getBlend","stencil","line_dash_frag","line_dash_vert","linear_line_frag","line_vert","line_frag","styleAttributeService","registerStyleAttribute","name","Attribute","descriptor","buffer","usage","STATIC_DRAW","size","feature","featureIdx","vertex","attributeIdx","normal","vertexIndex","DYNAMIC_DRAW","Array","isArray","iconMap","getIconMap","x","y"],"mappings":";;;;;;;;;;;;;AAAA,SACEA,aADF,EAEEC,EAFF,QAUO,eAVP;AAWA,SAASC,OAAT,EAAkBC,OAAlB,QAAiC,gBAAjC;AAEA,OAAOC,SAAP,MAAsB,sBAAtB;AAEA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;AAChDC,QAAAA,IAAI,EAAE,IAD0C;AAEhD5D,QAAAA,IAAI,EAAEjE,aAAa,CAAC8H,SAF4B;AAGhDC,QAAAA,UAAU,EAAE;AACVF,UAAAA,IAAI,EAAE,aADI;AAEVG,UAAAA,MAAM,EAAE;AAENC,YAAAA,KAAK,EAAEhI,EAAE,CAACyI,YAFJ;AAGN5H,YAAAA,IAAI,EAAE,EAHA;AAINmD,YAAAA,IAAI,EAAEhE,EAAE,CAACiE;AAJH,WAFE;AAQViE,UAAAA,IAAI,EAAE,CARI;AASVtH,UAAAA,MAAM,EAAE,gBACNuH,OADM,EAENC,UAFM,EAGNC,MAHM,EAINC,YAJM,EAKH;AACH,gBAAMM,OAAO,GAAG,MAAI,CAAC9H,WAAL,CAAiB+H,UAAjB,EAAhB;;AACA,gBAAQlI,OAAR,GAAoBwH,OAApB,CAAQxH,OAAR;;AACA,wBAAiBiI,OAAO,CAACjI,OAAD,CAAP,IAA8B;AAAEmI,cAAAA,CAAC,EAAE,CAAL;AAAQC,cAAAA,CAAC,EAAE;AAAX,aAA/C;AAAA,gBAAQD,CAAR,SAAQA,CAAR;AAAA,gBAAWC,CAAX,SAAWA,CAAX;;AACA,mBAAO,CAACD,CAAD,EAAIC,CAAJ,CAAP;AACD;AAnBS;AAHoC,OAAlD;AAyBD;;;;EA9UoC5I,S;;SAAlBK,S","sourcesContent":["import {\n AttributeType,\n gl,\n IAnimateOption,\n IEncodeFeature,\n IImage,\n ILayerConfig,\n IModel,\n IModelUniform,\n ITexture2D,\n} from '@antv/l7-core';\nimport { getMask, rgb2arr } from '@antv/l7-utils';\nimport { isNumber } from 'lodash';\nimport BaseModel from '../../core/BaseModel';\nimport { ILineLayerStyleOptions } from '../../core/interface';\nimport { LineTriangulation } from '../../core/triangulation';\n// dash line shader\nimport line_dash_frag from '../shaders/dash/line_dash_frag.glsl';\nimport line_dash_vert from '../shaders/dash/line_dash_vert.glsl';\n// basic line shader\nimport line_frag from '../shaders/line_frag.glsl';\nimport line_vert from '../shaders/line_vert.glsl';\n// other function shaders\nimport linear_line_frag from '../shaders/linear/line_linear_frag.glsl';\n\nconst lineStyleObj: { [key: string]: number } = {\n solid: 0.0,\n dash: 1.0,\n};\nexport default class LineModel extends BaseModel {\n protected texture: ITexture2D;\n public getUninforms(): IModelUniform {\n const {\n opacity = 1,\n sourceColor,\n targetColor,\n textureBlend = 'normal',\n lineType = 'solid',\n dashArray = [10, 5, 0, 0],\n lineTexture = false,\n iconStep = 100,\n vertexHeightScale = 20.0,\n borderWidth = 0.0,\n borderColor = '#ccc',\n raisingHeight = 0,\n heightfixed = false,\n arrow = {\n enable: false,\n arrowWidth: 2,\n arrowHeight: 3,\n tailWidth: 1,\n },\n } = this.layer.getLayerConfig() as ILineLayerStyleOptions;\n if (dashArray.length === 2) {\n dashArray.push(0, 0);\n }\n\n if (this.rendererService.getDirty()) {\n this.texture.bind();\n }\n\n // 转化渐变色\n let useLinearColor = 0; // 默认不生效\n let sourceColorArr = [0, 0, 0, 0];\n let targetColorArr = [0, 0, 0, 0];\n if (sourceColor && targetColor) {\n sourceColorArr = rgb2arr(sourceColor);\n targetColorArr = rgb2arr(targetColor);\n useLinearColor = 1;\n }\n\n if (this.dataTextureTest && this.dataTextureNeedUpdate({ opacity })) {\n this.judgeStyleAttributes({ opacity });\n const encodeData = this.layer.getEncodedData();\n const { data, width, height } = this.calDataFrame(\n this.cellLength,\n encodeData,\n this.cellProperties,\n );\n this.rowCount = height; // 当前数据纹理有多少行\n\n this.dataTexture =\n this.cellLength > 0 && data.length > 0\n ? this.createTexture2D({\n flipY: true,\n data,\n format: gl.LUMINANCE,\n type: gl.FLOAT,\n width,\n height,\n })\n : this.createTexture2D({\n flipY: true,\n data: [1],\n format: gl.LUMINANCE,\n type: gl.FLOAT,\n width: 1,\n height: 1,\n });\n }\n return {\n u_dataTexture: this.dataTexture, // 数据纹理 - 有数据映射的时候纹理中带数据,若没有任何数据映射时纹理是 [1]\n u_cellTypeLayout: this.getCellTypeLayout(),\n u_opacity: isNumber(opacity) ? opacity : 1.0,\n u_textureBlend: textureBlend === 'normal' ? 0.0 : 1.0,\n u_line_type: lineStyleObj[lineType],\n u_dash_array: dashArray,\n\n // 纹理支持参数\n u_texture: this.texture, // 贴图\n u_line_texture: lineTexture ? 1.0 : 0.0, // 传入线的标识\n u_icon_step: iconStep,\n u_textSize: [1024, this.iconService.canvasHeight || 128],\n\n // line border 参数\n u_borderWidth: borderWidth,\n u_borderColor: rgb2arr(borderColor),\n\n // 渐变色支持参数\n u_linearColor: useLinearColor,\n u_sourceColor: sourceColorArr,\n u_targetColor: targetColorArr,\n\n // 是否固定高度\n u_heightfixed: Number(heightfixed),\n\n // 顶点高度 scale\n u_vertexScale: vertexHeightScale,\n u_raisingHeight: Number(raisingHeight),\n\n // arrow\n u_arrow: Number(arrow.enable),\n u_arrowHeight: arrow.arrowHeight || 3,\n u_arrowWidth: arrow.arrowWidth || 2,\n u_tailWidth: arrow.tailWidth === undefined ? 1 : arrow.tailWidth,\n };\n }\n public getAnimateUniforms(): IModelUniform {\n const { animateOption } = this.layer.getLayerConfig() as ILayerConfig;\n return {\n u_aimate: this.animateOption2Array(animateOption as IAnimateOption),\n u_time: this.layer.getLayerAnimateTime(),\n };\n }\n\n public initModels(): IModel[] {\n this.updateTexture();\n this.iconService.on('imageUpdate', this.updateTexture);\n\n return this.buildModels();\n }\n\n public clearModels() {\n this.texture?.destroy();\n this.dataTexture?.destroy();\n this.iconService.off('imageUpdate', this.updateTexture);\n }\n\n public buildModels(): IModel[] {\n const {\n mask = false,\n maskInside = true,\n depth = false,\n } = this.layer.getLayerConfig() as ILineLayerStyleOptions;\n const { frag, vert, type } = this.getShaders();\n this.layer.triangulation = LineTriangulation;\n return [\n this.layer.buildLayerModel({\n moduleName: 'line_' + type,\n vertexShader: vert,\n fragmentShader: frag,\n triangulation: LineTriangulation,\n primitive: gl.TRIANGLES,\n blend: this.getBlend(),\n depth: { enable: depth },\n // depth: { enable: true },\n stencil: getMask(mask, maskInside),\n }),\n ];\n }\n\n /**\n * 根据参数获取不同的 shader 代码\n * @returns\n */\n public getShaders(): { frag: string; vert: string; type: string } {\n const {\n sourceColor,\n targetColor,\n lineType,\n } = this.layer.getLayerConfig() as ILineLayerStyleOptions;\n\n if (lineType === 'dash') {\n return {\n frag: line_dash_frag,\n vert: line_dash_vert,\n type: 'dash',\n };\n }\n\n if (sourceColor && targetColor) {\n // 分离 linear 功能\n return {\n frag: linear_line_frag,\n vert: line_vert,\n type: 'linear',\n };\n } else {\n return {\n frag: line_frag,\n vert: line_vert,\n type: 'normal',\n };\n }\n }\n\n protected registerBuiltinAttributes() {\n this.styleAttributeService.registerStyleAttribute({\n name: 'distanceAndIndex',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_DistanceAndIndex',\n buffer: {\n // give the WebGL driver a hint that this buffer may change\n usage: gl.STATIC_DRAW,\n data: [],\n type: gl.FLOAT,\n },\n size: 2,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n normal: number[],\n vertexIndex?: number,\n ) => {\n return vertexIndex === undefined\n ? [vertex[3], 10]\n : [vertex[3], vertexIndex];\n },\n },\n });\n this.styleAttributeService.registerStyleAttribute({\n name: 'total_distance',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_Total_Distance',\n buffer: {\n // give the WebGL driver a hint that this buffer may change\n usage: gl.STATIC_DRAW,\n data: [],\n type: gl.FLOAT,\n },\n size: 1,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n ) => {\n return [vertex[5]];\n },\n },\n });\n\n this.styleAttributeService.registerStyleAttribute({\n name: 'size',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_Size',\n buffer: {\n // give the WebGL driver a hint that this buffer may change\n usage: gl.DYNAMIC_DRAW,\n data: [],\n type: gl.FLOAT,\n },\n size: 2,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n ) => {\n const { size = 1 } = feature;\n return Array.isArray(size) ? [size[0], size[1]] : [size as number, 0];\n },\n },\n });\n\n // point layer size;\n this.styleAttributeService.registerStyleAttribute({\n name: 'normal',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_Normal',\n buffer: {\n // give the WebGL driver a hint that this buffer may change\n usage: gl.STATIC_DRAW,\n data: [],\n type: gl.FLOAT,\n },\n size: 3,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n normal: number[],\n ) => {\n return normal;\n },\n },\n });\n\n this.styleAttributeService.registerStyleAttribute({\n name: 'miter',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_Miter',\n buffer: {\n // give the WebGL driver a hint that this buffer may change\n usage: gl.STATIC_DRAW,\n data: [],\n type: gl.FLOAT,\n },\n size: 1,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n ) => {\n return [vertex[4]];\n },\n },\n });\n\n this.styleAttributeService.registerStyleAttribute({\n name: 'uv',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_iconMapUV',\n buffer: {\n // give the WebGL driver a hint that this buffer may change\n usage: gl.DYNAMIC_DRAW,\n data: [],\n type: gl.FLOAT,\n },\n size: 2,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n ) => {\n const iconMap = this.iconService.getIconMap();\n const { texture } = feature;\n const { x, y } = iconMap[texture as string] || { x: 0, y: 0 };\n return [x, y];\n },\n },\n });\n }\n\n private updateTexture = () => {\n const { createTexture2D } = this.rendererService;\n if (this.texture) {\n this.texture.update({\n data: this.iconService.getCanvas(),\n });\n this.layer.render();\n return;\n }\n this.texture = createTexture2D({\n data: this.iconService.getCanvas(),\n mag: gl.NEAREST,\n min: gl.NEAREST,\n premultiplyAlpha: false,\n width: 1024,\n height: this.iconService.canvasHeight || 128,\n });\n };\n}\n"],"file":"line.js"}
|
|
1
|
+
{"version":3,"sources":["../../../src/line/models/line.ts"],"names":["AttributeType","gl","getMask","LineTriangulation","rgb2arr","BaseModel","LinearDir","TextureBlend","lineStyleObj","solid","dash","LineModel","createTexture2D","rendererService","texture","update","data","iconService","getCanvas","layer","render","mag","NEAREST","min","premultiplyAlpha","width","height","canvasHeight","getLayerConfig","opacity","sourceColor","targetColor","textureBlend","lineType","dashArray","lineTexture","iconStep","vertexHeightScale","borderWidth","borderColor","raisingHeight","heightfixed","linearDir","VERTICAL","blur","arrow","enable","arrowWidth","arrowHeight","tailWidth","length","push","getDirty","bind","useLinearColor","sourceColorArr","targetColorArr","dataTextureTest","dataTextureNeedUpdate","judgeStyleAttributes","encodeData","getEncodedData","calDataFrame","cellLength","cellProperties","rowCount","dataTexture","flipY","format","LUMINANCE","type","FLOAT","u_dataTexture","u_cellTypeLayout","getCellTypeLayout","u_opacity","u_textureBlend","NORMAL","u_line_type","u_dash_array","u_blur","u_texture","u_line_texture","u_icon_step","u_textSize","u_borderWidth","u_borderColor","u_linearDir","u_linearColor","u_sourceColor","u_targetColor","u_heightfixed","Number","u_vertexScale","u_raisingHeight","u_arrow","u_arrowHeight","u_arrowWidth","u_tailWidth","undefined","animateOption","u_aimate","animateOption2Array","u_time","getLayerAnimateTime","callbackModel","updateTexture","on","buildModels","destroy","off","mask","maskInside","depth","workerEnabled","enablePicking","getShaders","frag","vert","triangulation","buildLayerModel","moduleName","vertexShader","fragmentShader","blend","getBlend","stencil","workerOptions","modelType","iconMap","getIconMap","then","model","catch","err","console","warn","line_dash_frag","line_dash_vert","linear_line_frag","line_vert","line_frag","styleAttributeService","registerStyleAttribute","name","Attribute","descriptor","buffer","usage","STATIC_DRAW","size","feature","featureIdx","vertex","attributeIdx","normal","vertexIndex","DYNAMIC_DRAW","Array","isArray","x","y"],"mappings":";;;;;;;;;;;;;AAAA,SACEA,aADF,EAEEC,EAFF,QAUO,eAVP;AAWA,SAASC,OAAT,EAAkBC,iBAAlB,EAAqCC,OAArC,QAAoD,gBAApD;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I,OADM,EAENC,UAFM,EAGNC,MAHM,EAINC,YAJM,EAKH;AACH,gBAAMzB,OAAO,GAAG,MAAI,CAAChH,WAAL,CAAiBiH,UAAjB,EAAhB;;AACA,gBAAQpH,OAAR,GAAoByI,OAApB,CAAQzI,OAAR;;AACA,wBAAiBmH,OAAO,CAACnH,OAAD,CAAP,IAA8B;AAAEkJ,cAAAA,CAAC,EAAE,CAAL;AAAQC,cAAAA,CAAC,EAAE;AAAX,aAA/C;AAAA,gBAAQD,CAAR,SAAQA,CAAR;AAAA,gBAAWC,CAAX,SAAWA,CAAX;;AACA,mBAAO,CAACD,CAAD,EAAIC,CAAJ,CAAP;AACD;AAnBS;AAHoC,OAAlD;AAyBD;;;;EA/VoC5J,S;;SAAlBM,S","sourcesContent":["import {\n AttributeType,\n gl,\n IAnimateOption,\n IEncodeFeature,\n IImage,\n ILayerConfig,\n IModel,\n IModelUniform,\n ITexture2D,\n} from '@antv/l7-core';\nimport { getMask, LineTriangulation, rgb2arr } from '@antv/l7-utils';\nimport { isNumber } from 'lodash';\nimport BaseModel from '../../core/BaseModel';\nimport {\n ILineLayerStyleOptions,\n LinearDir,\n TextureBlend,\n} from '../../core/interface';\n// import { LineTriangulation } from '../../core/triangulation';\n// dash line shader\nimport line_dash_frag from '../shaders/dash/line_dash_frag.glsl';\nimport line_dash_vert from '../shaders/dash/line_dash_vert.glsl';\n// basic line shader\nimport line_frag from '../shaders/line_frag.glsl';\nimport line_vert from '../shaders/line_vert.glsl';\n// other function shaders\nimport linear_line_frag from '../shaders/linear/line_linear_frag.glsl';\n\nconst lineStyleObj: { [key: string]: number } = {\n solid: 0.0,\n dash: 1.0,\n};\nexport default class LineModel extends BaseModel {\n protected texture: ITexture2D;\n public getUninforms(): IModelUniform {\n const {\n opacity = 1,\n sourceColor,\n targetColor,\n textureBlend = 'normal',\n lineType = 'solid',\n dashArray = [10, 5, 0, 0],\n lineTexture = false,\n iconStep = 100,\n vertexHeightScale = 20.0,\n borderWidth = 0.0,\n borderColor = '#ccc',\n raisingHeight = 0,\n heightfixed = false,\n linearDir = LinearDir.VERTICAL, // 默认纵向\n blur = [1, 1, 1],\n arrow = {\n enable: false,\n arrowWidth: 2,\n arrowHeight: 3,\n tailWidth: 1,\n },\n } = this.layer.getLayerConfig() as ILineLayerStyleOptions;\n if (dashArray.length === 2) {\n dashArray.push(0, 0);\n }\n\n if (this.rendererService.getDirty()) {\n this.texture.bind();\n }\n\n // 转化渐变色\n let useLinearColor = 0; // 默认不生效\n let sourceColorArr = [0, 0, 0, 0];\n let targetColorArr = [0, 0, 0, 0];\n if (sourceColor && targetColor) {\n sourceColorArr = rgb2arr(sourceColor);\n targetColorArr = rgb2arr(targetColor);\n useLinearColor = 1;\n }\n\n if (this.dataTextureTest && this.dataTextureNeedUpdate({ opacity })) {\n this.judgeStyleAttributes({ opacity });\n const encodeData = this.layer.getEncodedData();\n const { data, width, height } = this.calDataFrame(\n this.cellLength,\n encodeData,\n this.cellProperties,\n );\n this.rowCount = height; // 当前数据纹理有多少行\n\n this.dataTexture =\n this.cellLength > 0 && data.length > 0\n ? this.createTexture2D({\n flipY: true,\n data,\n format: gl.LUMINANCE,\n type: gl.FLOAT,\n width,\n height,\n })\n : this.createTexture2D({\n flipY: true,\n data: [1],\n format: gl.LUMINANCE,\n type: gl.FLOAT,\n width: 1,\n height: 1,\n });\n }\n return {\n u_dataTexture: this.dataTexture, // 数据纹理 - 有数据映射的时候纹理中带数据,若没有任何数据映射时纹理是 [1]\n u_cellTypeLayout: this.getCellTypeLayout(),\n u_opacity: isNumber(opacity) ? opacity : 1.0,\n u_textureBlend: textureBlend === TextureBlend.NORMAL ? 0.0 : 1.0,\n u_line_type: lineStyleObj[lineType],\n u_dash_array: dashArray,\n\n u_blur: blur,\n\n // 纹理支持参数\n u_texture: this.texture, // 贴图\n u_line_texture: lineTexture ? 1.0 : 0.0, // 传入线的标识\n u_icon_step: iconStep,\n u_textSize: [1024, this.iconService.canvasHeight || 128],\n\n // line border 参数\n u_borderWidth: borderWidth,\n u_borderColor: rgb2arr(borderColor),\n\n // 渐变色支持参数\n u_linearDir: linearDir === LinearDir.VERTICAL ? 1.0 : 0.0,\n u_linearColor: useLinearColor,\n u_sourceColor: sourceColorArr,\n u_targetColor: targetColorArr,\n\n // 是否固定高度\n u_heightfixed: Number(heightfixed),\n\n // 顶点高度 scale\n u_vertexScale: vertexHeightScale,\n u_raisingHeight: Number(raisingHeight),\n\n // arrow\n u_arrow: Number(arrow.enable),\n u_arrowHeight: arrow.arrowHeight || 3,\n u_arrowWidth: arrow.arrowWidth || 2,\n u_tailWidth: arrow.tailWidth === undefined ? 1 : arrow.tailWidth,\n };\n }\n public getAnimateUniforms(): IModelUniform {\n const { animateOption } = this.layer.getLayerConfig() as ILayerConfig;\n return {\n u_aimate: this.animateOption2Array(animateOption as IAnimateOption),\n u_time: this.layer.getLayerAnimateTime(),\n };\n }\n\n public initModels(callbackModel: (models: IModel[]) => void) {\n this.updateTexture();\n this.iconService.on('imageUpdate', this.updateTexture);\n\n this.buildModels(callbackModel);\n }\n\n public clearModels() {\n this.texture?.destroy();\n this.dataTexture?.destroy();\n this.iconService.off('imageUpdate', this.updateTexture);\n }\n\n public buildModels(callbackModel: (models: IModel[]) => void) {\n const {\n mask = false,\n maskInside = true,\n depth = false,\n workerEnabled = false,\n enablePicking,\n } = this.layer.getLayerConfig() as ILineLayerStyleOptions;\n const { frag, vert, type } = this.getShaders();\n this.layer.triangulation = LineTriangulation;\n this.layer\n .buildLayerModel({\n moduleName: 'line' + type,\n vertexShader: vert,\n fragmentShader: frag,\n triangulation: LineTriangulation,\n depth: { enable: depth },\n blend: this.getBlend(),\n stencil: getMask(mask, maskInside),\n workerEnabled,\n workerOptions: {\n modelType: 'line' + type,\n enablePicking,\n iconMap: this.iconService.getIconMap(),\n },\n })\n .then((model) => {\n callbackModel([model]);\n })\n .catch((err) => {\n console.warn(err);\n callbackModel([]);\n });\n }\n\n /**\n * 根据参数获取不同的 shader 代码\n * @returns\n */\n public getShaders(): { frag: string; vert: string; type: string } {\n const {\n sourceColor,\n targetColor,\n lineType,\n } = this.layer.getLayerConfig() as ILineLayerStyleOptions;\n\n if (lineType === 'dash') {\n return {\n frag: line_dash_frag,\n vert: line_dash_vert,\n type: 'Dash',\n };\n }\n\n if (sourceColor && targetColor) {\n // 分离 linear 功能\n return {\n frag: linear_line_frag,\n vert: line_vert,\n type: 'Linear',\n };\n } else {\n return {\n frag: line_frag,\n vert: line_vert,\n type: '',\n };\n }\n }\n\n protected registerBuiltinAttributes() {\n this.styleAttributeService.registerStyleAttribute({\n name: 'distanceAndIndex',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_DistanceAndIndex',\n buffer: {\n // give the WebGL driver a hint that this buffer may change\n usage: gl.STATIC_DRAW,\n data: [],\n type: gl.FLOAT,\n },\n size: 2,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n normal: number[],\n vertexIndex?: number,\n ) => {\n return vertexIndex === undefined\n ? [vertex[3], 10]\n : [vertex[3], vertexIndex];\n },\n },\n });\n this.styleAttributeService.registerStyleAttribute({\n name: 'total_distance',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_Total_Distance',\n buffer: {\n // give the WebGL driver a hint that this buffer may change\n usage: gl.STATIC_DRAW,\n data: [],\n type: gl.FLOAT,\n },\n size: 1,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n ) => {\n return [vertex[5]];\n },\n },\n });\n\n this.styleAttributeService.registerStyleAttribute({\n name: 'size',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_Size',\n buffer: {\n // give the WebGL driver a hint that this buffer may change\n usage: gl.DYNAMIC_DRAW,\n data: [],\n type: gl.FLOAT,\n },\n size: 2,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n ) => {\n const { size = 1 } = feature;\n return Array.isArray(size) ? [size[0], size[1]] : [size as number, 0];\n },\n },\n });\n\n // point layer size;\n this.styleAttributeService.registerStyleAttribute({\n name: 'normal',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_Normal',\n buffer: {\n // give the WebGL driver a hint that this buffer may change\n usage: gl.STATIC_DRAW,\n data: [],\n type: gl.FLOAT,\n },\n size: 3,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n normal: number[],\n ) => {\n return normal;\n },\n },\n });\n\n this.styleAttributeService.registerStyleAttribute({\n name: 'miter',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_Miter',\n buffer: {\n // give the WebGL driver a hint that this buffer may change\n usage: gl.STATIC_DRAW,\n data: [],\n type: gl.FLOAT,\n },\n size: 1,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n ) => {\n return [vertex[4]];\n },\n },\n });\n\n this.styleAttributeService.registerStyleAttribute({\n name: 'uv',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_iconMapUV',\n buffer: {\n // give the WebGL driver a hint that this buffer may change\n usage: gl.DYNAMIC_DRAW,\n data: [],\n type: gl.FLOAT,\n },\n size: 2,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n ) => {\n const iconMap = this.iconService.getIconMap();\n const { texture } = feature;\n const { x, y } = iconMap[texture as string] || { x: 0, y: 0 };\n return [x, y];\n },\n },\n });\n }\n\n private updateTexture = () => {\n const { createTexture2D } = this.rendererService;\n if (this.texture) {\n this.texture.update({\n data: this.iconService.getCanvas(),\n });\n this.layer.render();\n return;\n }\n this.texture = createTexture2D({\n data: this.iconService.getCanvas(),\n mag: gl.NEAREST,\n min: gl.NEAREST,\n premultiplyAlpha: false,\n width: 1024,\n height: this.iconService.canvasHeight || 128,\n });\n };\n}\n"],"file":"line.js"}
|
|
@@ -3,18 +3,9 @@ import BaseModel from '../../core/BaseModel';
|
|
|
3
3
|
export default class LinearLineModel extends BaseModel {
|
|
4
4
|
protected colorTexture: ITexture2D;
|
|
5
5
|
getUninforms(): IModelUniform;
|
|
6
|
-
initModels(
|
|
6
|
+
initModels(callbackModel: (models: IModel[]) => void): void;
|
|
7
7
|
clearModels(): void;
|
|
8
|
-
buildModels(
|
|
9
|
-
/**
|
|
10
|
-
* 根据参数获取不同的 shader 代码
|
|
11
|
-
* @returns
|
|
12
|
-
*/
|
|
13
|
-
getShaders(): {
|
|
14
|
-
frag: string;
|
|
15
|
-
vert: string;
|
|
16
|
-
type: string;
|
|
17
|
-
};
|
|
8
|
+
buildModels(callbackModel: (models: IModel[]) => void): void;
|
|
18
9
|
protected registerBuiltinAttributes(): void;
|
|
19
10
|
private updateTexture;
|
|
20
11
|
}
|
|
@@ -14,9 +14,10 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
|
|
|
14
14
|
import { AttributeType, gl } from '@antv/l7-core';
|
|
15
15
|
import { generateColorRamp, getMask } from '@antv/l7-utils';
|
|
16
16
|
import BaseModel from '../../core/BaseModel';
|
|
17
|
+
import { LinearDir } from '../../core/interface';
|
|
17
18
|
import { LineTriangulation } from '../../core/triangulation';
|
|
18
|
-
var linear_line_frag = "uniform float u_opacity : 1.0;\nuniform sampler2D u_texture;\n\n#pragma include \"picking\"\n\nvarying mat4 styleMappingMat;\n\nvoid main() {\n float opacity = styleMappingMat[0][0];\n float
|
|
19
|
-
var linear_line_vert = "\nattribute float a_Miter;\nattribute vec2 a_Size;\nattribute vec3 a_Normal;\nattribute vec3 a_Position;\n\n// dash line\nattribute float a_Total_Distance;\nattribute vec2 a_DistanceAndIndex;\n\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\n\nuniform float u_heightfixed: 0.0;\nuniform float u_vertexScale: 1.0;\nuniform float u_raisingHeight: 0.0;\n\nuniform float u_opacity: 1.0;\n\n#pragma include \"projection\"\n#pragma include \"picking\"\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\n#pragma include \"styleMapping\"\n#pragma include \"styleMappingCalOpacity\"\n\nvoid main() {\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n styleMappingMat = mat4(\n 0.0, 0.0, 0.0, 0.0, // opacity - strokeOpacity - strokeWidth - empty\n 0.0, 0.0, 0.0, 0.0, // strokeR - strokeG - strokeB - strokeA\n 0.0, 0.0, 0.0, 0.0, // offsets[0] - offsets[1]\n 0.0, 0.0, 0.0, 0.0 // distance_ratio/distance/pixelLen/texV\n );\n\n float rowCount = u_cellTypeLayout[0][0]; // \u5F53\u524D\u7684\u6570\u636E\u7EB9\u7406\u6709\u51E0\u884C\n float columnCount = u_cellTypeLayout[0][1]; // \u5F53\u770B\u5230\u6570\u636E\u7EB9\u7406\u6709\u51E0\u5217\n float columnWidth = 1.0/columnCount; // \u5217\u5BBD\n float rowHeight = 1.0/rowCount; // \u884C\u9AD8\n float cellCount = calCellCount(); // opacity - strokeOpacity - strokeWidth - stroke - offsets\n float id = a_vertexId; // \u7B2Cn\u4E2A\u9876\u70B9\n float cellCurrentRow = floor(id * cellCount / columnCount) + 1.0; // \u8D77\u59CB\u70B9\u5728\u7B2C\u51E0\u884C\n float cellCurrentColumn = mod(id * cellCount, columnCount) + 1.0; // \u8D77\u59CB\u70B9\u5728\u7B2C\u51E0\u5217\n \n // cell \u56FA\u5B9A\u987A\u5E8F opacity -> strokeOpacity -> strokeWidth -> stroke ... \n // \u6309\u987A\u5E8F\u4ECE cell \u4E2D\u53D6\u503C\u3001\u82E5\u6CA1\u6709\u5219\u81EA\u52A8\u5F80\u4E0B\u53D6\u503C\n float textureOffset = 0.0; // \u5728 cell \u4E2D\u53D6\u503C\u7684\u504F\u79FB\u91CF\n\n vec2 opacityAndOffset = calOpacityAndOffset(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset, columnWidth, rowHeight);\n styleMappingMat[0][0] = opacityAndOffset.r;\n textureOffset = opacityAndOffset.g;\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n\n vec3 size = a_Miter * setPickingSize(a_Size.x) * reverse_offset_normal(a_Normal);\n \n vec2 offset = project_pixel(size.xy);\n\n float lineDistance = a_DistanceAndIndex.x;\n float currentLinePointRatio = lineDistance / a_Total_Distance;\n \n\n float lineOffsetWidth = length(offset + offset * sign(a_Miter)); // \u7EBF\u6A2A\u5411\u504F\u79FB\u7684\u8DDD\u79BB\uFF08\u5411\u4E24\u4FA7\u504F\u79FB\u7684\u548C\uFF09\n float linePixelSize = project_pixel(a_Size.x) * 2.0; // \u5B9A\u70B9\u4F4D\u7F6E\u504F\u79FB\uFF0C\u6309\u5730\u56FE\u7B49\u7EA7\u7F29\u653E\u540E\u7684\u8DDD\u79BB \u5355\u4FA7 * 2\n float texV = lineOffsetWidth/linePixelSize; // \u7EBF\u56FE\u5C42\u8D34\u56FE\u90E8\u5206\u7684 v \u5750\u6807\u503C\n\n // \u8BBE\u7F6E\u6570\u636E\u96C6\u7684\u53C2\u6570\n styleMappingMat[3][0] = currentLinePointRatio; // \u5F53\u524D\u70B9\u4F4D\u8DDD\u79BB\u5360\u7EBF\u603B\u957F\u7684\u6BD4\u4F8B\n\n vec4 project_pos = project_position(vec4(a_Position.xy, 0, 1.0));\n\n // gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, a_Size.y, 1.0));\n\n float h = float(a_Position.z) * u_vertexScale; // \u7EBF\u9876\u70B9\u7684\u9AD8\u5EA6 - \u517C\u5BB9\u4E0D\u5B58\u5728\u7B2C\u4E09\u4E2A\u6570\u503C\u7684\u60C5\u51B5 vertex height\n float lineHeight = a_Size.y; // size \u7B2C\u4E8C\u4E2A\u53C2\u6570\u4EE3\u8868\u7684\u9AD8\u5EA6 [linewidth, lineheight]\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n lineHeight *= 0.2; // \u4FDD\u6301\u548C amap/mapbox \u4E00\u81F4\u7684\u6548\u679C\n h *= 0.2;\n if(u_heightfixed < 1.0) {\n lineHeight = project_pixel(a_Size.y);\n }\n gl_Position = u_Mvp * (vec4(project_pos.xy + offset, lineHeight + h + u_raisingHeight, 1.0));\n } else {\n // mapbox - amap\n \n // \u517C\u5BB9 mapbox \u5728\u7EBF\u9AD8\u5EA6\u4E0A\u7684\u6548\u679C\u8868\u73B0\u57FA\u672C\u4E00\u81F4\n if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {\n // mapbox\n // \u4FDD\u6301\u9AD8\u5EA6\u76F8\u5BF9\u4E0D\u53D8\n float mapboxZoomScale = 4.0/pow(2.0, 21.0 - u_Zoom);\n h *= mapboxZoomScale;\n h += u_raisingHeight * mapboxZoomScale;\n if(u_heightfixed > 0.0) {\n lineHeight *= mapboxZoomScale;\n }\n \n } else {\n // amap\n h += u_raisingHeight;\n // lineHeight \u9876\u70B9\u504F\u79FB\u9AD8\u5EA6\n if(u_heightfixed < 1.0) {\n lineHeight *= pow(2.0, 20.0 - u_Zoom);\n }\n }\n\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, lineHeight + h, 1.0));\n }\n\n setPickingColor(a_PickingColor);\n}\n";
|
|
19
|
+
var linear_line_frag = "uniform float u_opacity : 1.0;\nuniform sampler2D u_texture;\nuniform float u_linearDir: 1.0;\n\n#pragma include \"picking\"\n\nvarying mat4 styleMappingMat;\n\nvoid main() {\n float opacity = styleMappingMat[0][0];\n float linearRadio = styleMappingMat[3].r; // \u5F53\u524D\u70B9\u4F4D\u8DDD\u79BB\u5360\u7EBF\u603B\u957F\u7684\u6BD4\u4F8B\n if(u_linearDir < 1.0) {\n linearRadio = styleMappingMat[3][3];\n }\n\n gl_FragColor = texture2D(u_texture, vec2(linearRadio, 0.5));\n\n gl_FragColor.a *= opacity; // \u5168\u5C40\u900F\u660E\u5EA6\n gl_FragColor = filterColor(gl_FragColor);\n}\n";
|
|
20
|
+
var linear_line_vert = "\nattribute float a_Miter;\nattribute vec2 a_Size;\nattribute vec3 a_Normal;\nattribute vec3 a_Position;\n\n// dash line\nattribute float a_Total_Distance;\nattribute vec2 a_DistanceAndIndex;\n\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\n\nuniform float u_heightfixed: 0.0;\nuniform float u_vertexScale: 1.0;\nuniform float u_raisingHeight: 0.0;\n\nuniform float u_opacity: 1.0;\n\n#pragma include \"projection\"\n#pragma include \"picking\"\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\n#pragma include \"styleMapping\"\n#pragma include \"styleMappingCalOpacity\"\n\nvoid main() {\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n styleMappingMat = mat4(\n 0.0, 0.0, 0.0, 0.0, // opacity - strokeOpacity - strokeWidth - empty\n 0.0, 0.0, 0.0, 0.0, // strokeR - strokeG - strokeB - strokeA\n 0.0, 0.0, 0.0, 0.0, // offsets[0] - offsets[1]\n 0.0, 0.0, 0.0, 0.0 // distance_ratio/distance/pixelLen/texV\n );\n\n float rowCount = u_cellTypeLayout[0][0]; // \u5F53\u524D\u7684\u6570\u636E\u7EB9\u7406\u6709\u51E0\u884C\n float columnCount = u_cellTypeLayout[0][1]; // \u5F53\u770B\u5230\u6570\u636E\u7EB9\u7406\u6709\u51E0\u5217\n float columnWidth = 1.0/columnCount; // \u5217\u5BBD\n float rowHeight = 1.0/rowCount; // \u884C\u9AD8\n float cellCount = calCellCount(); // opacity - strokeOpacity - strokeWidth - stroke - offsets\n float id = a_vertexId; // \u7B2Cn\u4E2A\u9876\u70B9\n float cellCurrentRow = floor(id * cellCount / columnCount) + 1.0; // \u8D77\u59CB\u70B9\u5728\u7B2C\u51E0\u884C\n float cellCurrentColumn = mod(id * cellCount, columnCount) + 1.0; // \u8D77\u59CB\u70B9\u5728\u7B2C\u51E0\u5217\n \n // cell \u56FA\u5B9A\u987A\u5E8F opacity -> strokeOpacity -> strokeWidth -> stroke ... \n // \u6309\u987A\u5E8F\u4ECE cell \u4E2D\u53D6\u503C\u3001\u82E5\u6CA1\u6709\u5219\u81EA\u52A8\u5F80\u4E0B\u53D6\u503C\n float textureOffset = 0.0; // \u5728 cell \u4E2D\u53D6\u503C\u7684\u504F\u79FB\u91CF\n\n vec2 opacityAndOffset = calOpacityAndOffset(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset, columnWidth, rowHeight);\n styleMappingMat[0][0] = opacityAndOffset.r;\n textureOffset = opacityAndOffset.g;\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n\n vec3 size = a_Miter * setPickingSize(a_Size.x) * reverse_offset_normal(a_Normal);\n \n vec2 offset = project_pixel(size.xy);\n\n float lineDistance = a_DistanceAndIndex.x;\n float currentLinePointRatio = lineDistance / a_Total_Distance;\n \n\n float lineOffsetWidth = length(offset + offset * sign(a_Miter)); // \u7EBF\u6A2A\u5411\u504F\u79FB\u7684\u8DDD\u79BB\uFF08\u5411\u4E24\u4FA7\u504F\u79FB\u7684\u548C\uFF09\n float linePixelSize = project_pixel(a_Size.x) * 2.0; // \u5B9A\u70B9\u4F4D\u7F6E\u504F\u79FB\uFF0C\u6309\u5730\u56FE\u7B49\u7EA7\u7F29\u653E\u540E\u7684\u8DDD\u79BB \u5355\u4FA7 * 2\n float texV = lineOffsetWidth/linePixelSize; // \u7EBF\u56FE\u5C42\u8D34\u56FE\u90E8\u5206\u7684 v \u5750\u6807\u503C\n\n // \u8BBE\u7F6E\u6570\u636E\u96C6\u7684\u53C2\u6570\n styleMappingMat[3][0] = currentLinePointRatio; // \u5F53\u524D\u70B9\u4F4D\u8DDD\u79BB\u5360\u7EBF\u603B\u957F\u7684\u6BD4\u4F8B\n styleMappingMat[3][3] = texV; // \u7EBF\u56FE\u5C42\u8D34\u56FE\u90E8\u5206\u7684 v \u5750\u6807\u503C\n\n vec4 project_pos = project_position(vec4(a_Position.xy, 0, 1.0));\n\n // gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, a_Size.y, 1.0));\n\n float h = float(a_Position.z) * u_vertexScale; // \u7EBF\u9876\u70B9\u7684\u9AD8\u5EA6 - \u517C\u5BB9\u4E0D\u5B58\u5728\u7B2C\u4E09\u4E2A\u6570\u503C\u7684\u60C5\u51B5 vertex height\n float lineHeight = a_Size.y; // size \u7B2C\u4E8C\u4E2A\u53C2\u6570\u4EE3\u8868\u7684\u9AD8\u5EA6 [linewidth, lineheight]\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n lineHeight *= 0.2; // \u4FDD\u6301\u548C amap/mapbox \u4E00\u81F4\u7684\u6548\u679C\n h *= 0.2;\n if(u_heightfixed < 1.0) {\n lineHeight = project_pixel(a_Size.y);\n }\n gl_Position = u_Mvp * (vec4(project_pos.xy + offset, lineHeight + h + u_raisingHeight, 1.0));\n } else {\n // mapbox - amap\n \n // \u517C\u5BB9 mapbox \u5728\u7EBF\u9AD8\u5EA6\u4E0A\u7684\u6548\u679C\u8868\u73B0\u57FA\u672C\u4E00\u81F4\n if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {\n // mapbox\n // \u4FDD\u6301\u9AD8\u5EA6\u76F8\u5BF9\u4E0D\u53D8\n float mapboxZoomScale = 4.0/pow(2.0, 21.0 - u_Zoom);\n h *= mapboxZoomScale;\n h += u_raisingHeight * mapboxZoomScale;\n if(u_heightfixed > 0.0) {\n lineHeight *= mapboxZoomScale;\n }\n \n } else {\n // amap\n h += u_raisingHeight;\n // lineHeight \u9876\u70B9\u504F\u79FB\u9AD8\u5EA6\n if(u_heightfixed < 1.0) {\n lineHeight *= pow(2.0, 20.0 - u_Zoom);\n }\n }\n\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, lineHeight + h, 1.0));\n }\n\n setPickingColor(a_PickingColor);\n}\n";
|
|
20
21
|
|
|
21
22
|
var LinearLineModel = function (_BaseModel) {
|
|
22
23
|
_inherits(LinearLineModel, _BaseModel);
|
|
@@ -73,7 +74,9 @@ var LinearLineModel = function (_BaseModel) {
|
|
|
73
74
|
_ref2$raisingHeight = _ref2.raisingHeight,
|
|
74
75
|
raisingHeight = _ref2$raisingHeight === void 0 ? 0 : _ref2$raisingHeight,
|
|
75
76
|
_ref2$heightfixed = _ref2.heightfixed,
|
|
76
|
-
heightfixed = _ref2$heightfixed === void 0 ? false : _ref2$heightfixed
|
|
77
|
+
heightfixed = _ref2$heightfixed === void 0 ? false : _ref2$heightfixed,
|
|
78
|
+
_ref2$linearDir = _ref2.linearDir,
|
|
79
|
+
linearDir = _ref2$linearDir === void 0 ? LinearDir.VERTICAL : _ref2$linearDir;
|
|
77
80
|
|
|
78
81
|
if (this.rendererService.getDirty()) {
|
|
79
82
|
this.colorTexture.bind();
|
|
@@ -113,6 +116,7 @@ var LinearLineModel = function (_BaseModel) {
|
|
|
113
116
|
return {
|
|
114
117
|
u_dataTexture: this.dataTexture,
|
|
115
118
|
u_cellTypeLayout: this.getCellTypeLayout(),
|
|
119
|
+
u_linearDir: linearDir === LinearDir.VERTICAL ? 1.0 : 0.0,
|
|
116
120
|
u_opacity: _isNumber(opacity) ? opacity : 1.0,
|
|
117
121
|
u_texture: this.colorTexture,
|
|
118
122
|
u_heightfixed: Number(heightfixed),
|
|
@@ -122,9 +126,9 @@ var LinearLineModel = function (_BaseModel) {
|
|
|
122
126
|
}
|
|
123
127
|
}, {
|
|
124
128
|
key: "initModels",
|
|
125
|
-
value: function initModels() {
|
|
129
|
+
value: function initModels(callbackModel) {
|
|
126
130
|
this.updateTexture();
|
|
127
|
-
|
|
131
|
+
this.buildModels(callbackModel);
|
|
128
132
|
}
|
|
129
133
|
}, {
|
|
130
134
|
key: "clearModels",
|
|
@@ -136,7 +140,7 @@ var LinearLineModel = function (_BaseModel) {
|
|
|
136
140
|
}
|
|
137
141
|
}, {
|
|
138
142
|
key: "buildModels",
|
|
139
|
-
value: function buildModels() {
|
|
143
|
+
value: function buildModels(callbackModel) {
|
|
140
144
|
var _ref3 = this.layer.getLayerConfig(),
|
|
141
145
|
_ref3$mask = _ref3.mask,
|
|
142
146
|
mask = _ref3$mask === void 0 ? false : _ref3$mask,
|
|
@@ -145,33 +149,23 @@ var LinearLineModel = function (_BaseModel) {
|
|
|
145
149
|
_ref3$depth = _ref3.depth,
|
|
146
150
|
depth = _ref3$depth === void 0 ? false : _ref3$depth;
|
|
147
151
|
|
|
148
|
-
var _this$getShaders = this.getShaders(),
|
|
149
|
-
frag = _this$getShaders.frag,
|
|
150
|
-
vert = _this$getShaders.vert,
|
|
151
|
-
type = _this$getShaders.type;
|
|
152
|
-
|
|
153
152
|
this.layer.triangulation = LineTriangulation;
|
|
154
|
-
|
|
155
|
-
moduleName: '
|
|
156
|
-
vertexShader:
|
|
157
|
-
fragmentShader:
|
|
153
|
+
this.layer.buildLayerModel({
|
|
154
|
+
moduleName: 'lineRampColors',
|
|
155
|
+
vertexShader: linear_line_vert,
|
|
156
|
+
fragmentShader: linear_line_frag,
|
|
158
157
|
triangulation: LineTriangulation,
|
|
159
|
-
primitive: gl.TRIANGLES,
|
|
160
|
-
blend: this.getBlend(),
|
|
161
158
|
depth: {
|
|
162
159
|
enable: depth
|
|
163
160
|
},
|
|
161
|
+
blend: this.getBlend(),
|
|
164
162
|
stencil: getMask(mask, maskInside)
|
|
165
|
-
})
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
frag: linear_line_frag,
|
|
172
|
-
vert: linear_line_vert,
|
|
173
|
-
type: 'linear_rampColors'
|
|
174
|
-
};
|
|
163
|
+
}).then(function (model) {
|
|
164
|
+
callbackModel([model]);
|
|
165
|
+
}).catch(function (err) {
|
|
166
|
+
console.warn(err);
|
|
167
|
+
callbackModel([]);
|
|
168
|
+
});
|
|
175
169
|
}
|
|
176
170
|
}, {
|
|
177
171
|
key: "registerBuiltinAttributes",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/line/models/linearline.ts"],"names":["AttributeType","gl","generateColorRamp","getMask","BaseModel","LineTriangulation","LinearLineModel","createTexture2D","rendererService","colorTexture","destroy","layer","getLayerConfig","rampColors","imageData","data","Uint8Array","width","height","wrapS","CLAMP_TO_EDGE","wrapT","min","NEAREST","mag","flipY","opacity","vertexHeightScale","raisingHeight","heightfixed","getDirty","bind","dataTextureTest","dataTextureNeedUpdate","judgeStyleAttributes","encodeData","getEncodedData","calDataFrame","cellLength","cellProperties","rowCount","dataTexture","length","format","LUMINANCE","type","FLOAT","u_dataTexture","u_cellTypeLayout","getCellTypeLayout","u_opacity","u_texture","u_heightfixed","Number","u_vertexScale","u_raisingHeight","updateTexture","buildModels","mask","maskInside","depth","getShaders","frag","vert","triangulation","buildLayerModel","moduleName","vertexShader","fragmentShader","primitive","TRIANGLES","blend","getBlend","enable","stencil","linear_line_frag","linear_line_vert","styleAttributeService","registerStyleAttribute","name","Attribute","descriptor","buffer","usage","STATIC_DRAW","size","update","feature","featureIdx","vertex","attributeIdx","normal","vertexIndex","undefined","DYNAMIC_DRAW","Array","isArray"],"mappings":";;;;;;;;;;;;;AAAA,SACEA,aADF,EAEEC,EAFF,QAOO,eAPP;AAQA,SAASC,iBAAT,EAA4BC,OAA5B,QAAuD,gBAAvD;AAEA,OAAOC,SAAP,MAAsB,sBAAtB;AAEA,SAASC,iBAAT,QAAkC,0BAAlC;;;;IAIqBC,e;;;;;;;;;;;;;;;;;;oEAoOK,YAAM;AAC5B,UAAQC,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,EAGNC,MAHM,EAINC,YAJM,EAKNC,MALM,EAMH;AACH,mBAAOA,MAAP;AACD;AAlBS;AAHoC,OAAlD;AAyBA,WAAKd,qBAAL,CAA2BC,sBAA3B,CAAkD;AAChDC,QAAAA,IAAI,EAAE,OAD0C;AAEhDlC,QAAAA,IAAI,EAAE7C,aAAa,CAACgF,SAF4B;AAGhDC,QAAAA,UAAU,EAAE;AACVF,UAAAA,IAAI,EAAE,SADI;AAEVG,UAAAA,MAAM,EAAE;AAENC,YAAAA,KAAK,EAAElF,EAAE,CAACmF,WAFJ;AAGNrE,YAAAA,IAAI,EAAE,EAHA;AAIN8B,YAAAA,IAAI,EAAE5C,EAAE,CAAC6C;AAJH,WAFE;AAQVuC,UAAAA,IAAI,EAAE,CARI;AASVC,UAAAA,MAAM,EAAE,gBACNC,OADM,EAENC,UAFM,EAGNC,MAHM,EAINC,YAJM,EAKH;AACH,mBAAO,CAACD,MAAM,CAAC,CAAD,CAAP,CAAP;AACD;AAhBS;AAHoC,OAAlD;AAsBD;;;;EAlO0CrF,S;;SAAxBE,e","sourcesContent":["import {\n AttributeType,\n gl,\n IEncodeFeature,\n IModel,\n IModelUniform,\n ITexture2D,\n} from '@antv/l7-core';\nimport { generateColorRamp, getMask, IColorRamp } from '@antv/l7-utils';\nimport { isNumber } from 'lodash';\nimport BaseModel from '../../core/BaseModel';\nimport { ILineLayerStyleOptions } from '../../core/interface';\nimport { LineTriangulation } from '../../core/triangulation';\nimport linear_line_frag from '../shaders/linearLine/line_linear_frag.glsl';\nimport linear_line_vert from '../shaders/linearLine/line_linear_vert.glsl';\n\nexport default class LinearLineModel extends BaseModel {\n protected colorTexture: ITexture2D;\n public getUninforms(): IModelUniform {\n const {\n opacity = 1,\n vertexHeightScale = 20.0,\n raisingHeight = 0,\n heightfixed = false,\n } = this.layer.getLayerConfig() as ILineLayerStyleOptions;\n\n if (this.rendererService.getDirty()) {\n this.colorTexture.bind();\n }\n\n if (this.dataTextureTest && this.dataTextureNeedUpdate({ opacity })) {\n this.judgeStyleAttributes({ opacity });\n const encodeData = this.layer.getEncodedData();\n const { data, width, height } = this.calDataFrame(\n this.cellLength,\n encodeData,\n this.cellProperties,\n );\n this.rowCount = height; // 当前数据纹理有多少行\n\n this.dataTexture =\n this.cellLength > 0 && data.length > 0\n ? this.createTexture2D({\n flipY: true,\n data,\n format: gl.LUMINANCE,\n type: gl.FLOAT,\n width,\n height,\n })\n : this.createTexture2D({\n flipY: true,\n data: [1],\n format: gl.LUMINANCE,\n type: gl.FLOAT,\n width: 1,\n height: 1,\n });\n }\n return {\n u_dataTexture: this.dataTexture, // 数据纹理 - 有数据映射的时候纹理中带数据,若没有任何数据映射时纹理是 [1]\n u_cellTypeLayout: this.getCellTypeLayout(),\n\n u_opacity: isNumber(opacity) ? opacity : 1.0,\n // 纹理支持参数\n u_texture: this.colorTexture, // 贴图\n\n // 是否固定高度\n u_heightfixed: Number(heightfixed),\n\n // 顶点高度 scale\n u_vertexScale: vertexHeightScale,\n u_raisingHeight: Number(raisingHeight),\n };\n }\n\n public initModels(): IModel[] {\n this.updateTexture();\n return this.buildModels();\n }\n\n public clearModels() {\n this.colorTexture?.destroy();\n this.dataTexture?.destroy();\n }\n\n public buildModels(): IModel[] {\n const {\n mask = false,\n maskInside = true,\n depth = false,\n } = this.layer.getLayerConfig() as ILineLayerStyleOptions;\n const { frag, vert, type } = this.getShaders();\n this.layer.triangulation = LineTriangulation;\n return [\n this.layer.buildLayerModel({\n moduleName: 'line_' + type,\n vertexShader: vert,\n fragmentShader: frag,\n triangulation: LineTriangulation,\n primitive: gl.TRIANGLES,\n blend: this.getBlend(),\n depth: { enable: depth },\n stencil: getMask(mask, maskInside),\n }),\n ];\n }\n\n /**\n * 根据参数获取不同的 shader 代码\n * @returns\n */\n public getShaders(): { frag: string; vert: string; type: string } {\n return {\n frag: linear_line_frag,\n vert: linear_line_vert,\n type: 'linear_rampColors',\n };\n }\n\n protected registerBuiltinAttributes() {\n this.styleAttributeService.registerStyleAttribute({\n name: 'distanceAndIndex',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_DistanceAndIndex',\n buffer: {\n // give the WebGL driver a hint that this buffer may change\n usage: gl.STATIC_DRAW,\n data: [],\n type: gl.FLOAT,\n },\n size: 2,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n normal: number[],\n vertexIndex?: number,\n ) => {\n return vertexIndex === undefined\n ? [vertex[3], 10]\n : [vertex[3], vertexIndex];\n },\n },\n });\n this.styleAttributeService.registerStyleAttribute({\n name: 'total_distance',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_Total_Distance',\n buffer: {\n // give the WebGL driver a hint that this buffer may change\n usage: gl.STATIC_DRAW,\n data: [],\n type: gl.FLOAT,\n },\n size: 1,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n ) => {\n return [vertex[5]];\n },\n },\n });\n\n this.styleAttributeService.registerStyleAttribute({\n name: 'size',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_Size',\n buffer: {\n // give the WebGL driver a hint that this buffer may change\n usage: gl.DYNAMIC_DRAW,\n data: [],\n type: gl.FLOAT,\n },\n size: 2,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n ) => {\n const { size = 1 } = feature;\n return Array.isArray(size) ? [size[0], size[1]] : [size as number, 0];\n },\n },\n });\n\n // point layer size;\n this.styleAttributeService.registerStyleAttribute({\n name: 'normal',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_Normal',\n buffer: {\n // give the WebGL driver a hint that this buffer may change\n usage: gl.STATIC_DRAW,\n data: [],\n type: gl.FLOAT,\n },\n size: 3,\n // @ts-ignore\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n normal: number[],\n ) => {\n return normal;\n },\n },\n });\n\n this.styleAttributeService.registerStyleAttribute({\n name: 'miter',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_Miter',\n buffer: {\n // give the WebGL driver a hint that this buffer may change\n usage: gl.STATIC_DRAW,\n data: [],\n type: gl.FLOAT,\n },\n size: 1,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n ) => {\n return [vertex[4]];\n },\n },\n });\n }\n\n private updateTexture = () => {\n const { createTexture2D } = this.rendererService;\n if (this.colorTexture) {\n this.colorTexture.destroy();\n }\n const {\n rampColors,\n } = this.layer.getLayerConfig() as ILineLayerStyleOptions;\n const imageData = generateColorRamp(rampColors as IColorRamp);\n this.colorTexture = createTexture2D({\n data: new Uint8Array(imageData.data),\n width: imageData.width,\n height: imageData.height,\n wrapS: gl.CLAMP_TO_EDGE,\n wrapT: gl.CLAMP_TO_EDGE,\n min: gl.NEAREST,\n mag: gl.NEAREST,\n flipY: false,\n });\n };\n}\n"],"file":"linearline.js"}
|
|
1
|
+
{"version":3,"sources":["../../../src/line/models/linearline.ts"],"names":["AttributeType","gl","generateColorRamp","getMask","BaseModel","LinearDir","LineTriangulation","LinearLineModel","createTexture2D","rendererService","colorTexture","destroy","layer","getLayerConfig","rampColors","imageData","data","Uint8Array","width","height","wrapS","CLAMP_TO_EDGE","wrapT","min","NEAREST","mag","flipY","opacity","vertexHeightScale","raisingHeight","heightfixed","linearDir","VERTICAL","getDirty","bind","dataTextureTest","dataTextureNeedUpdate","judgeStyleAttributes","encodeData","getEncodedData","calDataFrame","cellLength","cellProperties","rowCount","dataTexture","length","format","LUMINANCE","type","FLOAT","u_dataTexture","u_cellTypeLayout","getCellTypeLayout","u_linearDir","u_opacity","u_texture","u_heightfixed","Number","u_vertexScale","u_raisingHeight","callbackModel","updateTexture","buildModels","mask","maskInside","depth","triangulation","buildLayerModel","moduleName","vertexShader","linear_line_vert","fragmentShader","linear_line_frag","enable","blend","getBlend","stencil","then","model","catch","err","console","warn","styleAttributeService","registerStyleAttribute","name","Attribute","descriptor","buffer","usage","STATIC_DRAW","size","update","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BC,sBAA3B,CAAkD;AAChDC,QAAAA,IAAI,EAAE,QAD0C;AAEhDrC,QAAAA,IAAI,EAAEhD,aAAa,CAACsF,SAF4B;AAGhDC,QAAAA,UAAU,EAAE;AACVF,UAAAA,IAAI,EAAE,UADI;AAEVG,UAAAA,MAAM,EAAE;AAENC,YAAAA,KAAK,EAAExF,EAAE,CAACyF,WAFJ;AAGN1E,YAAAA,IAAI,EAAE,EAHA;AAINgC,YAAAA,IAAI,EAAE/C,EAAE,CAACgD;AAJH,WAFE;AAQV0C,UAAAA,IAAI,EAAE,CARI;AAUVC,UAAAA,MAAM,EAAE,gBACNC,OADM,EAENC,UAFM,EAGNC,MAHM,EAINC,YAJM,EAKNC,MALM,EAMH;AACH,mBAAOA,MAAP;AACD;AAlBS;AAHoC,OAAlD;AAyBA,WAAKd,qBAAL,CAA2BC,sBAA3B,CAAkD;AAChDC,QAAAA,IAAI,EAAE,OAD0C;AAEhDrC,QAAAA,IAAI,EAAEhD,aAAa,CAACsF,SAF4B;AAGhDC,QAAAA,UAAU,EAAE;AACVF,UAAAA,IAAI,EAAE,SADI;AAEVG,UAAAA,MAAM,EAAE;AAENC,YAAAA,KAAK,EAAExF,EAAE,CAACyF,WAFJ;AAGN1E,YAAAA,IAAI,EAAE,EAHA;AAINgC,YAAAA,IAAI,EAAE/C,EAAE,CAACgD;AAJH,WAFE;AAQV0C,UAAAA,IAAI,EAAE,CARI;AASVC,UAAAA,MAAM,EAAE,gBACNC,OADM,EAENC,UAFM,EAGNC,MAHM,EAINC,YAJM,EAKH;AACH,mBAAO,CAACD,MAAM,CAAC,CAAD,CAAP,CAAP;AACD;AAhBS;AAHoC,OAAlD;AAsBD;;;;EA9N0C3F,S;;SAAxBG,e","sourcesContent":["import {\n AttributeType,\n gl,\n IEncodeFeature,\n IModel,\n IModelUniform,\n ITexture2D,\n} from '@antv/l7-core';\nimport { generateColorRamp, getMask, IColorRamp } from '@antv/l7-utils';\nimport { isNumber } from 'lodash';\nimport BaseModel from '../../core/BaseModel';\nimport { ILineLayerStyleOptions, LinearDir } from '../../core/interface';\nimport { LineTriangulation } from '../../core/triangulation';\nimport linear_line_frag from '../shaders/linearLine/line_linear_frag.glsl';\nimport linear_line_vert from '../shaders/linearLine/line_linear_vert.glsl';\n\nexport default class LinearLineModel extends BaseModel {\n protected colorTexture: ITexture2D;\n public getUninforms(): IModelUniform {\n const {\n opacity = 1,\n vertexHeightScale = 20.0,\n raisingHeight = 0,\n heightfixed = false,\n linearDir = LinearDir.VERTICAL,\n } = this.layer.getLayerConfig() as ILineLayerStyleOptions;\n\n if (this.rendererService.getDirty()) {\n this.colorTexture.bind();\n }\n\n if (this.dataTextureTest && this.dataTextureNeedUpdate({ opacity })) {\n this.judgeStyleAttributes({ opacity });\n const encodeData = this.layer.getEncodedData();\n const { data, width, height } = this.calDataFrame(\n this.cellLength,\n encodeData,\n this.cellProperties,\n );\n this.rowCount = height; // 当前数据纹理有多少行\n\n this.dataTexture =\n this.cellLength > 0 && data.length > 0\n ? this.createTexture2D({\n flipY: true,\n data,\n format: gl.LUMINANCE,\n type: gl.FLOAT,\n width,\n height,\n })\n : this.createTexture2D({\n flipY: true,\n data: [1],\n format: gl.LUMINANCE,\n type: gl.FLOAT,\n width: 1,\n height: 1,\n });\n }\n return {\n u_dataTexture: this.dataTexture, // 数据纹理 - 有数据映射的时候纹理中带数据,若没有任何数据映射时纹理是 [1]\n u_cellTypeLayout: this.getCellTypeLayout(),\n\n u_linearDir: linearDir === LinearDir.VERTICAL ? 1.0 : 0.0,\n u_opacity: isNumber(opacity) ? opacity : 1.0,\n // 纹理支持参数\n u_texture: this.colorTexture, // 贴图\n\n // 是否固定高度\n u_heightfixed: Number(heightfixed),\n\n // 顶点高度 scale\n u_vertexScale: vertexHeightScale,\n u_raisingHeight: Number(raisingHeight),\n };\n }\n\n public initModels(callbackModel: (models: IModel[]) => void) {\n this.updateTexture();\n this.buildModels(callbackModel);\n }\n\n public clearModels() {\n this.colorTexture?.destroy();\n this.dataTexture?.destroy();\n }\n\n public buildModels(callbackModel: (models: IModel[]) => void) {\n const {\n mask = false,\n maskInside = true,\n depth = false,\n } = this.layer.getLayerConfig() as ILineLayerStyleOptions;\n\n this.layer.triangulation = LineTriangulation;\n\n this.layer\n .buildLayerModel({\n moduleName: 'lineRampColors',\n vertexShader: linear_line_vert,\n fragmentShader: linear_line_frag,\n triangulation: LineTriangulation,\n depth: { enable: depth },\n blend: this.getBlend(),\n stencil: getMask(mask, maskInside),\n })\n .then((model) => {\n callbackModel([model]);\n })\n .catch((err) => {\n console.warn(err);\n callbackModel([]);\n });\n }\n\n protected registerBuiltinAttributes() {\n this.styleAttributeService.registerStyleAttribute({\n name: 'distanceAndIndex',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_DistanceAndIndex',\n buffer: {\n // give the WebGL driver a hint that this buffer may change\n usage: gl.STATIC_DRAW,\n data: [],\n type: gl.FLOAT,\n },\n size: 2,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n normal: number[],\n vertexIndex?: number,\n ) => {\n return vertexIndex === undefined\n ? [vertex[3], 10]\n : [vertex[3], vertexIndex];\n },\n },\n });\n this.styleAttributeService.registerStyleAttribute({\n name: 'total_distance',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_Total_Distance',\n buffer: {\n // give the WebGL driver a hint that this buffer may change\n usage: gl.STATIC_DRAW,\n data: [],\n type: gl.FLOAT,\n },\n size: 1,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n ) => {\n return [vertex[5]];\n },\n },\n });\n\n this.styleAttributeService.registerStyleAttribute({\n name: 'size',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_Size',\n buffer: {\n // give the WebGL driver a hint that this buffer may change\n usage: gl.DYNAMIC_DRAW,\n data: [],\n type: gl.FLOAT,\n },\n size: 2,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n ) => {\n const { size = 1 } = feature;\n return Array.isArray(size) ? [size[0], size[1]] : [size as number, 0];\n },\n },\n });\n\n // point layer size;\n this.styleAttributeService.registerStyleAttribute({\n name: 'normal',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_Normal',\n buffer: {\n // give the WebGL driver a hint that this buffer may change\n usage: gl.STATIC_DRAW,\n data: [],\n type: gl.FLOAT,\n },\n size: 3,\n // @ts-ignore\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n normal: number[],\n ) => {\n return normal;\n },\n },\n });\n\n this.styleAttributeService.registerStyleAttribute({\n name: 'miter',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_Miter',\n buffer: {\n // give the WebGL driver a hint that this buffer may change\n usage: gl.STATIC_DRAW,\n data: [],\n type: gl.FLOAT,\n },\n size: 1,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n ) => {\n return [vertex[4]];\n },\n },\n });\n }\n\n private updateTexture = () => {\n const { createTexture2D } = this.rendererService;\n if (this.colorTexture) {\n this.colorTexture.destroy();\n }\n const {\n rampColors,\n } = this.layer.getLayerConfig() as ILineLayerStyleOptions;\n const imageData = generateColorRamp(rampColors as IColorRamp);\n this.colorTexture = createTexture2D({\n data: new Uint8Array(imageData.data),\n width: imageData.width,\n height: imageData.height,\n wrapS: gl.CLAMP_TO_EDGE,\n wrapT: gl.CLAMP_TO_EDGE,\n min: gl.NEAREST,\n mag: gl.NEAREST,\n flipY: false,\n });\n };\n}\n"],"file":"linearline.js"}
|
|
@@ -2,13 +2,13 @@ import { IModel, IModelUniform } from '@antv/l7-core';
|
|
|
2
2
|
import BaseModel from '../../core/BaseModel';
|
|
3
3
|
export default class SimpleLineModel extends BaseModel {
|
|
4
4
|
getUninforms(): IModelUniform;
|
|
5
|
-
initModels(
|
|
5
|
+
initModels(callbackModel: (models: IModel[]) => void): void;
|
|
6
6
|
clearModels(): void;
|
|
7
7
|
getShaders(): {
|
|
8
8
|
frag: string;
|
|
9
9
|
vert: string;
|
|
10
10
|
type: string;
|
|
11
11
|
};
|
|
12
|
-
buildModels(
|
|
12
|
+
buildModels(callbackModel: (models: IModel[]) => void): void;
|
|
13
13
|
protected registerBuiltinAttributes(): void;
|
|
14
14
|
}
|
|
@@ -92,8 +92,8 @@ var SimpleLineModel = function (_BaseModel) {
|
|
|
92
92
|
}
|
|
93
93
|
}, {
|
|
94
94
|
key: "initModels",
|
|
95
|
-
value: function initModels() {
|
|
96
|
-
|
|
95
|
+
value: function initModels(callbackModel) {
|
|
96
|
+
this.buildModels(callbackModel);
|
|
97
97
|
}
|
|
98
98
|
}, {
|
|
99
99
|
key: "clearModels",
|
|
@@ -113,19 +113,19 @@ var SimpleLineModel = function (_BaseModel) {
|
|
|
113
113
|
return {
|
|
114
114
|
frag: simle_linear_frag,
|
|
115
115
|
vert: simple_line_vert,
|
|
116
|
-
type: '
|
|
116
|
+
type: 'lineSimpleLinear'
|
|
117
117
|
};
|
|
118
118
|
} else {
|
|
119
119
|
return {
|
|
120
120
|
frag: simple_line_frag,
|
|
121
121
|
vert: simple_line_vert,
|
|
122
|
-
type: '
|
|
122
|
+
type: 'lineSimpleNormal'
|
|
123
123
|
};
|
|
124
124
|
}
|
|
125
125
|
}
|
|
126
126
|
}, {
|
|
127
127
|
key: "buildModels",
|
|
128
|
-
value: function buildModels() {
|
|
128
|
+
value: function buildModels(callbackModel) {
|
|
129
129
|
var _ref3 = this.layer.getLayerConfig(),
|
|
130
130
|
_ref3$mask = _ref3.mask,
|
|
131
131
|
mask = _ref3$mask === void 0 ? false : _ref3$mask,
|
|
@@ -137,18 +137,23 @@ var SimpleLineModel = function (_BaseModel) {
|
|
|
137
137
|
vert = _this$getShaders.vert,
|
|
138
138
|
type = _this$getShaders.type;
|
|
139
139
|
|
|
140
|
-
|
|
140
|
+
this.layer.buildLayerModel({
|
|
141
141
|
moduleName: type,
|
|
142
142
|
vertexShader: vert,
|
|
143
143
|
fragmentShader: frag,
|
|
144
144
|
triangulation: SimpleLineTriangulation,
|
|
145
145
|
primitive: gl.LINES,
|
|
146
|
-
blend: this.getBlend(),
|
|
147
146
|
depth: {
|
|
148
147
|
enable: false
|
|
149
148
|
},
|
|
149
|
+
blend: this.getBlend(),
|
|
150
150
|
stencil: getMask(mask, maskInside)
|
|
151
|
-
})
|
|
151
|
+
}).then(function (model) {
|
|
152
|
+
callbackModel([model]);
|
|
153
|
+
}).catch(function (err) {
|
|
154
|
+
console.warn(err);
|
|
155
|
+
callbackModel([]);
|
|
156
|
+
});
|
|
152
157
|
}
|
|
153
158
|
}, {
|
|
154
159
|
key: "registerBuiltinAttributes",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/line/models/simpleLine.ts"],"names":["AttributeType","gl","getMask","rgb2arr","BaseModel","SimpleLineTriangulation","SimpleLineModel","layer","getLayerConfig","opacity","sourceColor","targetColor","vertexHeightScale","useLinearColor","sourceColorArr","targetColorArr","dataTextureTest","dataTextureNeedUpdate","judgeStyleAttributes","encodeData","getEncodedData","calDataFrame","cellLength","cellProperties","data","width","height","rowCount","dataTexture","length","createTexture2D","flipY","format","LUMINANCE","type","FLOAT","u_dataTexture","u_cellTypeLayout","getCellTypeLayout","u_opacity","u_linearColor","u_sourceColor","u_targetColor","u_vertexScale","buildModels","destroy","frag","simle_linear_frag","vert","simple_line_vert","simple_line_frag","mask","maskInside","getShaders","buildLayerModel","moduleName","vertexShader","fragmentShader","triangulation","primitive","LINES","blend","getBlend","depth","enable","stencil","styleAttributeService","registerStyleAttribute","name","Attribute","descriptor","buffer","usage","STATIC_DRAW","size","update","feature","featureIdx","vertex","attributeIdx","DYNAMIC_DRAW","Array","isArray"],"mappings":";;;;;;;;;;;AAAA,SACEA,aADF,EAEEC,EAFF,QAMO,eANP;AAOA,SAASC,OAAT,EAAkBC,OAAlB,QAAiC,gBAAjC;AAEA,OAAOC,SAAP,MAAsB,sBAAtB;AAEA,SAASC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C,MAHM,EAINC,YAJM,EAKH;AACH,gCAAqBH,OAArB,CAAQF,IAAR;AAAA,gBAAQA,IAAR,8BAAe,CAAf;AACA,mBAAOO,KAAK,CAACC,OAAN,CAAcR,IAAd,IAAsB,CAACA,IAAI,CAAC,CAAD,CAAL,EAAUA,IAAI,CAAC,CAAD,CAAd,CAAtB,GAA2C,CAACA,IAAD,EAAiB,CAAjB,CAAlD;AACD;AAjBS;AAHoC,OAAlD;AAuBD;;;;EAtL0CtE,S;;SAAxBE,e","sourcesContent":["import {\n AttributeType,\n gl,\n IEncodeFeature,\n IModel,\n IModelUniform,\n} from '@antv/l7-core';\nimport { getMask, rgb2arr } from '@antv/l7-utils';\nimport { isNumber } from 'lodash';\nimport BaseModel from '../../core/BaseModel';\nimport { ILineLayerStyleOptions } from '../../core/interface';\nimport { SimpleLineTriangulation } from '../../core/triangulation';\nimport simple_line_frag from '../shaders/simple/simpleline_frag.glsl';\n// linear simple line shader\nimport simle_linear_frag from '../shaders/simple/simpleline_linear_frag.glsl';\nimport simple_line_vert from '../shaders/simple/simpleline_vert.glsl';\nexport default class SimpleLineModel extends BaseModel {\n public getUninforms(): IModelUniform {\n const {\n opacity = 1,\n sourceColor,\n targetColor,\n vertexHeightScale = 20.0,\n } = this.layer.getLayerConfig() as ILineLayerStyleOptions;\n\n // 转化渐变色\n let useLinearColor = 0; // 默认不生效\n let sourceColorArr = [0, 0, 0, 0];\n let targetColorArr = [0, 0, 0, 0];\n if (sourceColor && targetColor) {\n sourceColorArr = rgb2arr(sourceColor);\n targetColorArr = rgb2arr(targetColor);\n useLinearColor = 1;\n }\n\n if (this.dataTextureTest && this.dataTextureNeedUpdate({ opacity })) {\n this.judgeStyleAttributes({ opacity });\n const encodeData = this.layer.getEncodedData();\n const { data, width, height } = this.calDataFrame(\n this.cellLength,\n encodeData,\n this.cellProperties,\n );\n this.rowCount = height; // 当前数据纹理有多少行\n\n this.dataTexture =\n this.cellLength > 0 && data.length > 0\n ? this.createTexture2D({\n flipY: true,\n data,\n format: gl.LUMINANCE,\n type: gl.FLOAT,\n width,\n height,\n })\n : this.createTexture2D({\n flipY: true,\n data: [1],\n format: gl.LUMINANCE,\n type: gl.FLOAT,\n width: 1,\n height: 1,\n });\n }\n\n return {\n u_dataTexture: this.dataTexture, // 数据纹理 - 有数据映射的时候纹理中带数据,若没有任何数据映射时纹理是 [1]\n u_cellTypeLayout: this.getCellTypeLayout(),\n u_opacity: isNumber(opacity) ? opacity : 1.0,\n\n // 渐变色支持参数\n u_linearColor: useLinearColor,\n u_sourceColor: sourceColorArr,\n u_targetColor: targetColorArr,\n\n // 顶点高度 scale\n u_vertexScale: vertexHeightScale,\n };\n }\n\n public initModels(): IModel[] {\n return this.buildModels();\n }\n\n public clearModels() {\n this.dataTexture?.destroy();\n }\n\n public getShaders(): { frag: string; vert: string; type: string } {\n const {\n sourceColor,\n targetColor,\n } = this.layer.getLayerConfig() as ILineLayerStyleOptions;\n if (sourceColor && targetColor) {\n // 分离 linear 功能\n return {\n frag: simle_linear_frag,\n vert: simple_line_vert,\n type: 'simple_linear',\n };\n } else {\n return {\n frag: simple_line_frag,\n vert: simple_line_vert,\n type: 'simple_normal',\n };\n }\n }\n\n public buildModels(): IModel[] {\n const {\n mask = false,\n maskInside = true,\n } = this.layer.getLayerConfig() as ILineLayerStyleOptions;\n\n const { frag, vert, type } = this.getShaders();\n return [\n this.layer.buildLayerModel({\n moduleName: type,\n vertexShader: vert,\n fragmentShader: frag,\n triangulation: SimpleLineTriangulation,\n primitive: gl.LINES, // gl.LINES gl.TRIANGLES\n blend: this.getBlend(),\n depth: { enable: false },\n stencil: getMask(mask, maskInside),\n }),\n ];\n }\n protected registerBuiltinAttributes() {\n this.styleAttributeService.registerStyleAttribute({\n name: 'distance',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_Distance',\n buffer: {\n // give the WebGL driver a hint that this buffer may change\n usage: gl.STATIC_DRAW,\n data: [],\n type: gl.FLOAT,\n },\n size: 1,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n ) => {\n return [vertex[3]];\n },\n },\n });\n this.styleAttributeService.registerStyleAttribute({\n name: 'total_distance',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_Total_Distance',\n buffer: {\n // give the WebGL driver a hint that this buffer may change\n usage: gl.STATIC_DRAW,\n data: [],\n type: gl.FLOAT,\n },\n size: 1,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n ) => {\n return [vertex[5]];\n },\n },\n });\n\n this.styleAttributeService.registerStyleAttribute({\n name: 'size',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_Size',\n buffer: {\n // give the WebGL driver a hint that this buffer may change\n usage: gl.DYNAMIC_DRAW,\n data: [],\n type: gl.FLOAT,\n },\n size: 2,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n ) => {\n const { size = 1 } = feature;\n return Array.isArray(size) ? [size[0], size[1]] : [size as number, 0];\n },\n },\n });\n }\n}\n"],"file":"simpleLine.js"}
|
|
1
|
+
{"version":3,"sources":["../../../src/line/models/simpleLine.ts"],"names":["AttributeType","gl","getMask","rgb2arr","BaseModel","SimpleLineTriangulation","SimpleLineModel","layer","getLayerConfig","opacity","sourceColor","targetColor","vertexHeightScale","useLinearColor","sourceColorArr","targetColorArr","dataTextureTest","dataTextureNeedUpdate","judgeStyleAttributes","encodeData","getEncodedData","calDataFrame","cellLength","cellProperties","data","width","height","rowCount","dataTexture","length","createTexture2D","flipY","format","LUMINANCE","type","FLOAT","u_dataTexture","u_cellTypeLayout","getCellTypeLayout","u_opacity","u_linearColor","u_sourceColor","u_targetColor","u_vertexScale","callbackModel","buildModels","destroy","frag","simle_linear_frag","vert","simple_line_vert","simple_line_frag","mask","maskInside","getShaders","buildLayerModel","moduleName","vertexShader","fragmentShader","triangulation","primitive","LINES","depth","enable","blend","getBlend","stencil","then","model","catch","err","console","warn","styleAttributeService","registerStyleAttribute","name","Attribute","descriptor","buffer","usage","STATIC_DRAW","size","update","feature","featureIdx","vertex","attributeIdx","DYNAMIC_DRAW","Array","isArray"],"mappings":";;;;;;;;;;;AAAA,SACEA,aADF,EAEEC,EAFF,QAMO,eANP;AAOA,SAASC,OAAT,EAAkBC,OAAlB,QAAiC,gBAAjC;AAEA,OAAOC,SAAP,MAAsB,sBAAtB;AAEA,SAASC,uBAAT,QAAwC,0BAAxC;;;;;IAKqBC,e;;;;;;;;;;;;;WACnB,wBAAqC;AACnC,iBAKI,KAAKC,KAAL,CAAWC,cAAX,EALJ;AAAA,8BACEC,OADF;AAAA,UACEA,OADF,6BACY,CADZ;AAAA,UAEEC,WAFF,QAEEA,WAFF;AAAA,UAGEC,WAHF,QAGEA,WAHF;AAAA,uCAIEC,iBAJF;AAAA,UAIEA,iBAJF,sCAIsB,IAJtB;;AAQA,UAAIC,cAAc,GAAG,CAArB;AACA,UAAIC,cAAc,GAAG,CAAC,CAAD,EAAI,CAAJ,EAAO,CAAP,EAAU,CAAV,CAArB;AACA,UAAIC,cAAc,GAAG,CAAC,CAAD,EAAI,CAAJ,EAAO,CAAP,EAAU,CAAV,CAArB;;AACA,UAAIL,WAAW,IAAIC,WAAnB,EAAgC;AAC9BG,QAAAA,cAAc,GAAGX,OAAO,CAACO,WAAD,CAAxB;AACAK,QAAAA,cAAc,GAAGZ,OAAO,CAACQ,WAAD,CAAxB;AACAE,QAAAA,cAAc,GAAG,CAAjB;AACD;;AAED,UAAI,KAAKG,eAAL,IAAwB,KAAKC,qBAAL,CAA2B;AAAER,QAAAA,OAAO,EAAPA;AAAF,OAA3B,CAA5B,EAAqE;AACnE,aAAKS,oBAAL,CAA0B;AAAET,UAAAA,OAAO,EAAPA;AAAF,SAA1B;AACA,YAAMU,UAAU,GAAG,KAAKZ,KAAL,CAAWa,cAAX,EAAnB;;AACA,iCAAgC,KAAKC,YAAL,CAC9B,KAAKC,UADyB,EAE9BH,UAF8B,EAG9B,KAAK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AAO,CAACD,MAAM,CAAC,CAAD,CAAP,CAAP;AACD;AAhBS;AAHoC,OAAlD;AAuBA,WAAKZ,qBAAL,CAA2BC,sBAA3B,CAAkD;AAChDC,QAAAA,IAAI,EAAE,MAD0C;AAEhDzC,QAAAA,IAAI,EAAElC,aAAa,CAAC4E,SAF4B;AAGhDC,QAAAA,UAAU,EAAE;AACVF,UAAAA,IAAI,EAAE,QADI;AAEVG,UAAAA,MAAM,EAAE;AAENC,YAAAA,KAAK,EAAE9E,EAAE,CAACsF,YAFJ;AAGN/D,YAAAA,IAAI,EAAE,EAHA;AAINU,YAAAA,IAAI,EAAEjC,EAAE,CAACkC;AAJH,WAFE;AAQV8C,UAAAA,IAAI,EAAE,CARI;AASVC,UAAAA,MAAM,EAAE,gBACNC,OADM,EAENC,UAFM,EAGNC,MAHM,EAINC,YAJM,EAKH;AACH,gCAAqBH,OAArB,CAAQF,IAAR;AAAA,gBAAQA,IAAR,8BAAe,CAAf;AACA,mBAAOO,KAAK,CAACC,OAAN,CAAcR,IAAd,IAAsB,CAACA,IAAI,CAAC,CAAD,CAAL,EAAUA,IAAI,CAAC,CAAD,CAAd,CAAtB,GAA2C,CAACA,IAAD,EAAiB,CAAjB,CAAlD;AACD;AAjBS;AAHoC,OAAlD;AAuBD;;;;EA7L0C7E,S;;SAAxBE,e","sourcesContent":["import {\n AttributeType,\n gl,\n IEncodeFeature,\n IModel,\n IModelUniform,\n} from '@antv/l7-core';\nimport { getMask, rgb2arr } from '@antv/l7-utils';\nimport { isNumber } from 'lodash';\nimport BaseModel from '../../core/BaseModel';\nimport { ILineLayerStyleOptions } from '../../core/interface';\nimport { SimpleLineTriangulation } from '../../core/triangulation';\nimport simple_line_frag from '../shaders/simple/simpleline_frag.glsl';\n// linear simple line shader\nimport simle_linear_frag from '../shaders/simple/simpleline_linear_frag.glsl';\nimport simple_line_vert from '../shaders/simple/simpleline_vert.glsl';\nexport default class SimpleLineModel extends BaseModel {\n public getUninforms(): IModelUniform {\n const {\n opacity = 1,\n sourceColor,\n targetColor,\n vertexHeightScale = 20.0,\n } = this.layer.getLayerConfig() as ILineLayerStyleOptions;\n\n // 转化渐变色\n let useLinearColor = 0; // 默认不生效\n let sourceColorArr = [0, 0, 0, 0];\n let targetColorArr = [0, 0, 0, 0];\n if (sourceColor && targetColor) {\n sourceColorArr = rgb2arr(sourceColor);\n targetColorArr = rgb2arr(targetColor);\n useLinearColor = 1;\n }\n\n if (this.dataTextureTest && this.dataTextureNeedUpdate({ opacity })) {\n this.judgeStyleAttributes({ opacity });\n const encodeData = this.layer.getEncodedData();\n const { data, width, height } = this.calDataFrame(\n this.cellLength,\n encodeData,\n this.cellProperties,\n );\n this.rowCount = height; // 当前数据纹理有多少行\n\n this.dataTexture =\n this.cellLength > 0 && data.length > 0\n ? this.createTexture2D({\n flipY: true,\n data,\n format: gl.LUMINANCE,\n type: gl.FLOAT,\n width,\n height,\n })\n : this.createTexture2D({\n flipY: true,\n data: [1],\n format: gl.LUMINANCE,\n type: gl.FLOAT,\n width: 1,\n height: 1,\n });\n }\n\n return {\n u_dataTexture: this.dataTexture, // 数据纹理 - 有数据映射的时候纹理中带数据,若没有任何数据映射时纹理是 [1]\n u_cellTypeLayout: this.getCellTypeLayout(),\n u_opacity: isNumber(opacity) ? opacity : 1.0,\n\n // 渐变色支持参数\n u_linearColor: useLinearColor,\n u_sourceColor: sourceColorArr,\n u_targetColor: targetColorArr,\n\n // 顶点高度 scale\n u_vertexScale: vertexHeightScale,\n };\n }\n\n public initModels(callbackModel: (models: IModel[]) => void) {\n this.buildModels(callbackModel);\n }\n\n public clearModels() {\n this.dataTexture?.destroy();\n }\n\n public getShaders(): { frag: string; vert: string; type: string } {\n const {\n sourceColor,\n targetColor,\n } = this.layer.getLayerConfig() as ILineLayerStyleOptions;\n if (sourceColor && targetColor) {\n // 分离 linear 功能\n return {\n frag: simle_linear_frag,\n vert: simple_line_vert,\n type: 'lineSimpleLinear',\n };\n } else {\n return {\n frag: simple_line_frag,\n vert: simple_line_vert,\n type: 'lineSimpleNormal',\n };\n }\n }\n\n public buildModels(callbackModel: (models: IModel[]) => void) {\n const {\n mask = false,\n maskInside = true,\n } = this.layer.getLayerConfig() as ILineLayerStyleOptions;\n\n const { frag, vert, type } = this.getShaders();\n\n this.layer\n .buildLayerModel({\n moduleName: type,\n vertexShader: vert,\n fragmentShader: frag,\n triangulation: SimpleLineTriangulation,\n primitive: gl.LINES,\n depth: { enable: false },\n blend: this.getBlend(),\n stencil: getMask(mask, maskInside),\n })\n .then((model) => {\n callbackModel([model]);\n })\n .catch((err) => {\n console.warn(err);\n callbackModel([]);\n });\n }\n protected registerBuiltinAttributes() {\n this.styleAttributeService.registerStyleAttribute({\n name: 'distance',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_Distance',\n buffer: {\n // give the WebGL driver a hint that this buffer may change\n usage: gl.STATIC_DRAW,\n data: [],\n type: gl.FLOAT,\n },\n size: 1,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n ) => {\n return [vertex[3]];\n },\n },\n });\n this.styleAttributeService.registerStyleAttribute({\n name: 'total_distance',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_Total_Distance',\n buffer: {\n // give the WebGL driver a hint that this buffer may change\n usage: gl.STATIC_DRAW,\n data: [],\n type: gl.FLOAT,\n },\n size: 1,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n ) => {\n return [vertex[5]];\n },\n },\n });\n\n this.styleAttributeService.registerStyleAttribute({\n name: 'size',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_Size',\n buffer: {\n // give the WebGL driver a hint that this buffer may change\n usage: gl.DYNAMIC_DRAW,\n data: [],\n type: gl.FLOAT,\n },\n size: 2,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n ) => {\n const { size = 1 } = feature;\n return Array.isArray(size) ? [size[0], size[1]] : [size as number, 0];\n },\n },\n });\n }\n}\n"],"file":"simpleLine.js"}
|
package/es/line/models/tile.d.ts
CHANGED
|
@@ -3,18 +3,9 @@ import BaseModel from '../../core/BaseModel';
|
|
|
3
3
|
export default class LineModel extends BaseModel {
|
|
4
4
|
protected texture: ITexture2D;
|
|
5
5
|
getUninforms(): IModelUniform;
|
|
6
|
-
initModels(
|
|
6
|
+
initModels(callbackModel: (models: IModel[]) => void): void;
|
|
7
7
|
clearModels(): void;
|
|
8
|
-
buildModels(
|
|
9
|
-
/**
|
|
10
|
-
* 根据参数获取不同的 shader 代码
|
|
11
|
-
* @returns
|
|
12
|
-
*/
|
|
13
|
-
getShaders(): {
|
|
14
|
-
frag: string;
|
|
15
|
-
vert: string;
|
|
16
|
-
type: string;
|
|
17
|
-
};
|
|
8
|
+
buildModels(callbackModel: (models: IModel[]) => void): Promise<void>;
|
|
18
9
|
protected registerBuiltinAttributes(): void;
|
|
19
10
|
private updateTexture;
|
|
20
11
|
}
|
package/es/line/models/tile.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
1
2
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
2
3
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
3
4
|
import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
|
|
@@ -5,6 +6,7 @@ import _inherits from "@babel/runtime/helpers/inherits";
|
|
|
5
6
|
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
6
7
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
7
8
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
9
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
8
10
|
|
|
9
11
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
10
12
|
|
|
@@ -150,10 +152,10 @@ var LineModel = function (_BaseModel) {
|
|
|
150
152
|
}
|
|
151
153
|
}, {
|
|
152
154
|
key: "initModels",
|
|
153
|
-
value: function initModels() {
|
|
155
|
+
value: function initModels(callbackModel) {
|
|
154
156
|
this.updateTexture();
|
|
155
157
|
this.iconService.on('imageUpdate', this.updateTexture);
|
|
156
|
-
|
|
158
|
+
this.buildModels(callbackModel);
|
|
157
159
|
}
|
|
158
160
|
}, {
|
|
159
161
|
key: "clearModels",
|
|
@@ -166,43 +168,47 @@ var LineModel = function (_BaseModel) {
|
|
|
166
168
|
}
|
|
167
169
|
}, {
|
|
168
170
|
key: "buildModels",
|
|
169
|
-
value: function
|
|
170
|
-
var
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
171
|
+
value: function () {
|
|
172
|
+
var _buildModels = _asyncToGenerator(_regeneratorRuntime.mark(function _callee(callbackModel) {
|
|
173
|
+
var _ref2, _ref2$mask, mask, _ref2$maskInside, maskInside, _ref2$depth, depth;
|
|
174
|
+
|
|
175
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
176
|
+
while (1) {
|
|
177
|
+
switch (_context.prev = _context.next) {
|
|
178
|
+
case 0:
|
|
179
|
+
_ref2 = this.layer.getLayerConfig(), _ref2$mask = _ref2.mask, mask = _ref2$mask === void 0 ? false : _ref2$mask, _ref2$maskInside = _ref2.maskInside, maskInside = _ref2$maskInside === void 0 ? true : _ref2$maskInside, _ref2$depth = _ref2.depth, depth = _ref2$depth === void 0 ? false : _ref2$depth;
|
|
180
|
+
this.layer.triangulation = LineTriangulation;
|
|
181
|
+
this.layer.buildLayerModel({
|
|
182
|
+
moduleName: 'lineTile',
|
|
183
|
+
vertexShader: line_tile_vert,
|
|
184
|
+
fragmentShader: line_tile_frag,
|
|
185
|
+
triangulation: LineTriangulation,
|
|
186
|
+
blend: this.getBlend(),
|
|
187
|
+
depth: {
|
|
188
|
+
enable: depth
|
|
189
|
+
},
|
|
190
|
+
stencil: getMask(mask, maskInside)
|
|
191
|
+
}).then(function (model) {
|
|
192
|
+
callbackModel([model]);
|
|
193
|
+
}).catch(function (err) {
|
|
194
|
+
console.warn(err);
|
|
195
|
+
callbackModel([]);
|
|
196
|
+
});
|
|
197
|
+
|
|
198
|
+
case 3:
|
|
199
|
+
case "end":
|
|
200
|
+
return _context.stop();
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
}, _callee, this);
|
|
204
|
+
}));
|
|
205
|
+
|
|
206
|
+
function buildModels(_x) {
|
|
207
|
+
return _buildModels.apply(this, arguments);
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
return buildModels;
|
|
211
|
+
}()
|
|
206
212
|
}, {
|
|
207
213
|
key: "registerBuiltinAttributes",
|
|
208
214
|
value: function registerBuiltinAttributes() {
|