@antv/l7-layers 2.9.17-alpha.0 → 2.9.17
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 +2 -12
- package/es/Geometry/index.js.map +1 -1
- package/es/Geometry/models/billboard.d.ts +3 -3
- package/es/Geometry/models/billboard.js +6 -11
- package/es/Geometry/models/billboard.js.map +1 -1
- package/es/Geometry/models/plane.d.ts +3 -3
- package/es/Geometry/models/plane.js +7 -12
- package/es/Geometry/models/plane.js.map +1 -1
- package/es/Geometry/models/sprite.d.ts +3 -3
- package/es/Geometry/models/sprite.js +6 -11
- package/es/Geometry/models/sprite.js.map +1 -1
- package/es/canvas/index.js +2 -12
- package/es/canvas/index.js.map +1 -1
- package/es/citybuliding/building.js +2 -12
- package/es/citybuliding/building.js.map +1 -1
- package/es/citybuliding/models/build.d.ts +1 -2
- package/es/citybuliding/models/build.js +3 -16
- package/es/citybuliding/models/build.js.map +1 -1
- package/es/core/BaseLayer.d.ts +1 -1
- package/es/core/BaseLayer.js +58 -97
- 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 -2
- package/es/core/interface.js.map +1 -1
- package/es/core/triangulation.d.ts +0 -1
- package/es/core/triangulation.js +11 -37
- package/es/core/triangulation.js.map +1 -1
- package/es/earth/index.js +2 -8
- package/es/earth/index.js.map +1 -1
- package/es/earth/models/atmosphere.d.ts +2 -2
- package/es/earth/models/atmosphere.js +6 -11
- package/es/earth/models/atmosphere.js.map +1 -1
- package/es/earth/models/base.d.ts +2 -2
- package/es/earth/models/base.js +6 -11
- package/es/earth/models/base.js.map +1 -1
- package/es/earth/models/bloomsphere.d.ts +2 -2
- package/es/earth/models/bloomsphere.js +6 -11
- package/es/earth/models/bloomsphere.js.map +1 -1
- package/es/heatmap/index.js +5 -17
- package/es/heatmap/index.js.map +1 -1
- package/es/heatmap/models/grid.d.ts +2 -2
- package/es/heatmap/models/grid.js +8 -12
- package/es/heatmap/models/grid.js.map +1 -1
- package/es/heatmap/models/grid3d.d.ts +2 -2
- package/es/heatmap/models/grid3d.js +6 -12
- package/es/heatmap/models/grid3d.js.map +1 -1
- package/es/heatmap/models/heatmap.d.ts +2 -2
- package/es/heatmap/models/heatmap.js +62 -112
- package/es/heatmap/models/heatmap.js.map +1 -1
- package/es/heatmap/models/hexagon.d.ts +2 -2
- package/es/heatmap/models/hexagon.js +6 -11
- package/es/heatmap/models/hexagon.js.map +1 -1
- package/es/image/index.d.ts +1 -1
- package/es/image/index.js +16 -14
- package/es/image/index.js.map +1 -1
- package/es/image/models/dataImage.d.ts +22 -0
- package/es/image/models/dataImage.js +230 -0
- package/es/image/models/dataImage.js.map +1 -0
- package/es/image/models/image.d.ts +4 -3
- package/es/image/models/image.js +14 -11
- package/es/image/models/image.js.map +1 -1
- package/es/image/models/index.d.ts +1 -1
- package/es/image/models/index.js +3 -1
- package/es/image/models/index.js.map +1 -1
- package/es/line/index.d.ts +2 -0
- package/es/line/index.js +5 -12
- package/es/line/index.js.map +1 -1
- package/es/line/models/arc.d.ts +2 -2
- package/es/line/models/arc.js +10 -15
- 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 +8 -13
- package/es/line/models/arc_3d.js.map +1 -1
- package/es/line/models/arcmini.d.ts +9 -0
- package/es/line/models/arcmini.js +145 -0
- package/es/line/models/arcmini.js.map +1 -0
- package/es/line/models/earthArc_3d.d.ts +2 -2
- package/es/line/models/earthArc_3d.js +9 -17
- 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 +8 -13
- 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 +29 -46
- package/es/line/models/half.js.map +1 -1
- package/es/line/models/index.d.ts +1 -1
- package/es/line/models/index.js +2 -0
- package/es/line/models/index.js.map +1 -1
- package/es/line/models/line.d.ts +2 -2
- package/es/line/models/line.js +16 -28
- package/es/line/models/line.js.map +1 -1
- package/es/line/models/linearline.d.ts +11 -2
- package/es/line/models/linearline.js +24 -14
- package/es/line/models/linearline.js.map +1 -1
- package/es/line/models/simpleLine.d.ts +2 -3
- package/es/line/models/simpleLine.js +18 -66
- package/es/line/models/simpleLine.js.map +1 -1
- package/es/line/models/tile.d.ts +11 -2
- package/es/line/models/tile.js +39 -45
- package/es/line/models/tile.js.map +1 -1
- package/es/line/models/wall.d.ts +2 -2
- package/es/line/models/wall.js +9 -13
- package/es/line/models/wall.js.map +1 -1
- package/es/mask/index.js +2 -12
- package/es/mask/index.js.map +1 -1
- package/es/mask/models/fill.d.ts +2 -2
- package/es/mask/models/fill.js +27 -53
- package/es/mask/models/fill.js.map +1 -1
- package/es/plugins/DataMappingPlugin.js +8 -29
- package/es/plugins/DataMappingPlugin.js.map +1 -1
- package/es/plugins/DataSourcePlugin.js +5 -14
- package/es/plugins/DataSourcePlugin.js.map +1 -1
- package/es/plugins/LayerModelPlugin.d.ts +0 -2
- package/es/plugins/LayerModelPlugin.js +7 -33
- package/es/plugins/LayerModelPlugin.js.map +1 -1
- package/es/plugins/PixelPickingPlugin.js +13 -16
- package/es/plugins/PixelPickingPlugin.js.map +1 -1
- package/es/point/index.d.ts +1 -1
- package/es/point/index.js +8 -15
- package/es/point/index.js.map +1 -1
- package/es/point/models/earthExtrude.d.ts +2 -2
- package/es/point/models/earthExtrude.js +14 -16
- package/es/point/models/earthExtrude.js.map +1 -1
- package/es/point/models/earthFill.d.ts +11 -2
- package/es/point/models/earthFill.js +22 -13
- package/es/point/models/earthFill.js.map +1 -1
- package/es/point/models/extrude.d.ts +2 -2
- package/es/point/models/extrude.js +27 -49
- package/es/point/models/extrude.js.map +1 -1
- package/es/point/models/fill.d.ts +2 -2
- package/es/point/models/fill.js +41 -59
- package/es/point/models/fill.js.map +1 -1
- package/es/point/models/fillmage.d.ts +7 -2
- package/es/point/models/fillmage.js +22 -13
- package/es/point/models/fillmage.js.map +1 -1
- package/es/point/models/icon-font.d.ts +11 -0
- package/es/point/models/icon-font.js +181 -0
- package/es/point/models/icon-font.js.map +1 -0
- package/es/point/models/image.d.ts +2 -2
- package/es/point/models/image.js +6 -11
- package/es/point/models/image.js.map +1 -1
- package/es/point/models/index.d.ts +1 -1
- package/es/point/models/index.js +2 -0
- package/es/point/models/index.js.map +1 -1
- package/es/point/models/normal.d.ts +2 -2
- package/es/point/models/normal.js +6 -11
- package/es/point/models/normal.js.map +1 -1
- package/es/point/models/radar.d.ts +11 -2
- package/es/point/models/radar.js +22 -13
- package/es/point/models/radar.js.map +1 -1
- package/es/point/models/simplePoint.d.ts +2 -2
- package/es/point/models/simplePoint.js +6 -11
- package/es/point/models/simplePoint.js.map +1 -1
- package/es/point/models/text.d.ts +2 -3
- package/es/point/models/text.js +75 -108
- package/es/point/models/text.js.map +1 -1
- package/es/point/models/tile.d.ts +11 -2
- package/es/point/models/tile.js +25 -22
- package/es/point/models/tile.js.map +1 -1
- package/es/polygon/index.js +2 -12
- package/es/polygon/index.js.map +1 -1
- package/es/polygon/models/extrude.d.ts +2 -2
- package/es/polygon/models/extrude.js +5 -10
- package/es/polygon/models/extrude.js.map +1 -1
- package/es/polygon/models/fill.d.ts +2 -2
- package/es/polygon/models/fill.js +13 -27
- package/es/polygon/models/fill.js.map +1 -1
- package/es/polygon/models/ocean.d.ts +2 -2
- package/es/polygon/models/ocean.js +6 -12
- package/es/polygon/models/ocean.js.map +1 -1
- package/es/polygon/models/tile.d.ts +3 -2
- package/es/polygon/models/tile.js +27 -17
- package/es/polygon/models/tile.js.map +1 -1
- package/es/polygon/models/water.d.ts +2 -2
- package/es/polygon/models/water.js +6 -12
- package/es/polygon/models/water.js.map +1 -1
- package/es/raster/image.d.ts +0 -0
- package/es/raster/image.js +2 -0
- package/es/raster/image.js.map +1 -0
- package/es/raster/index.js +2 -12
- package/es/raster/index.js.map +1 -1
- package/es/raster/models/raster.d.ts +3 -3
- package/es/raster/models/raster.js +7 -11
- package/es/raster/models/raster.js.map +1 -1
- package/es/raster/raster2d.d.ts +27 -0
- package/es/raster/raster2d.js +158 -0
- package/es/raster/raster2d.js.map +1 -0
- package/es/tile/manager/tileLayerManager.js +21 -4
- package/es/tile/manager/tileLayerManager.js.map +1 -1
- package/es/tile/manager/tilePickerManager.js +0 -1
- 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 +2 -12
- package/es/tile/tileFactory/rasterDataLayer.js.map +1 -1
- package/es/tile/tileFactory/vectorLayer.js +2 -12
- package/es/tile/tileFactory/vectorLayer.js.map +1 -1
- package/es/utils/extrude_polyline.d.ts +0 -15
- package/es/utils/extrude_polyline.js +6 -138
- package/es/utils/extrude_polyline.js.map +1 -1
- package/es/utils/geo.d.ts +12 -0
- package/es/utils/geo.js +53 -0
- package/es/utils/geo.js.map +1 -0
- package/es/utils/simpleLine.d.ts +23 -0
- package/es/utils/simpleLine.js +105 -0
- package/es/utils/simpleLine.js.map +1 -0
- package/es/wind/index.js +2 -12
- package/es/wind/index.js.map +1 -1
- package/es/wind/models/wind.d.ts +2 -2
- package/es/wind/models/wind.js +33 -36
- package/es/wind/models/wind.js.map +1 -1
- package/lib/Geometry/index.js +2 -12
- package/lib/Geometry/index.js.map +1 -1
- package/lib/Geometry/models/billboard.js +6 -11
- package/lib/Geometry/models/billboard.js.map +1 -1
- package/lib/Geometry/models/plane.js +7 -12
- package/lib/Geometry/models/plane.js.map +1 -1
- package/lib/Geometry/models/sprite.js +6 -11
- package/lib/Geometry/models/sprite.js.map +1 -1
- package/lib/canvas/index.js +2 -12
- package/lib/canvas/index.js.map +1 -1
- package/lib/citybuliding/building.js +2 -12
- package/lib/citybuliding/building.js.map +1 -1
- package/lib/citybuliding/models/build.js +3 -16
- package/lib/citybuliding/models/build.js.map +1 -1
- package/lib/core/BaseLayer.js +57 -96
- 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.map +1 -1
- package/lib/core/triangulation.js +16 -40
- package/lib/core/triangulation.js.map +1 -1
- package/lib/earth/index.js +2 -8
- package/lib/earth/index.js.map +1 -1
- package/lib/earth/models/atmosphere.js +6 -11
- package/lib/earth/models/atmosphere.js.map +1 -1
- package/lib/earth/models/base.js +6 -11
- package/lib/earth/models/base.js.map +1 -1
- package/lib/earth/models/bloomsphere.js +6 -11
- package/lib/earth/models/bloomsphere.js.map +1 -1
- package/lib/heatmap/index.js +5 -17
- package/lib/heatmap/index.js.map +1 -1
- package/lib/heatmap/models/grid.js +8 -12
- package/lib/heatmap/models/grid.js.map +1 -1
- package/lib/heatmap/models/grid3d.js +6 -12
- package/lib/heatmap/models/grid3d.js.map +1 -1
- package/lib/heatmap/models/heatmap.js +62 -113
- package/lib/heatmap/models/heatmap.js.map +1 -1
- package/lib/heatmap/models/hexagon.js +6 -11
- package/lib/heatmap/models/hexagon.js.map +1 -1
- package/lib/image/index.js +16 -14
- package/lib/image/index.js.map +1 -1
- package/lib/image/models/dataImage.js +245 -0
- package/lib/image/models/dataImage.js.map +1 -0
- package/lib/image/models/image.js +14 -11
- package/lib/image/models/image.js.map +1 -1
- package/lib/image/models/index.js +4 -1
- package/lib/image/models/index.js.map +1 -1
- package/lib/line/index.js +5 -12
- package/lib/line/index.js.map +1 -1
- package/lib/line/models/arc.js +10 -15
- package/lib/line/models/arc.js.map +1 -1
- package/lib/line/models/arc_3d.js +8 -13
- package/lib/line/models/arc_3d.js.map +1 -1
- package/lib/line/models/arcmini.js +161 -0
- package/lib/line/models/arcmini.js.map +1 -0
- package/lib/line/models/earthArc_3d.js +9 -17
- package/lib/line/models/earthArc_3d.js.map +1 -1
- package/lib/line/models/great_circle.js +8 -13
- package/lib/line/models/great_circle.js.map +1 -1
- package/lib/line/models/half.js +29 -48
- package/lib/line/models/half.js.map +1 -1
- package/lib/line/models/index.js +3 -0
- package/lib/line/models/index.js.map +1 -1
- package/lib/line/models/line.js +18 -29
- package/lib/line/models/line.js.map +1 -1
- package/lib/line/models/linearline.js +24 -14
- package/lib/line/models/linearline.js.map +1 -1
- package/lib/line/models/simpleLine.js +18 -66
- package/lib/line/models/simpleLine.js.map +1 -1
- package/lib/line/models/tile.js +39 -47
- package/lib/line/models/tile.js.map +1 -1
- package/lib/line/models/wall.js +9 -13
- package/lib/line/models/wall.js.map +1 -1
- package/lib/mask/index.js +2 -12
- package/lib/mask/index.js.map +1 -1
- package/lib/mask/models/fill.js +27 -55
- package/lib/mask/models/fill.js.map +1 -1
- package/lib/plugins/DataMappingPlugin.js +8 -29
- package/lib/plugins/DataMappingPlugin.js.map +1 -1
- package/lib/plugins/DataSourcePlugin.js +4 -13
- package/lib/plugins/DataSourcePlugin.js.map +1 -1
- package/lib/plugins/LayerModelPlugin.js +7 -33
- package/lib/plugins/LayerModelPlugin.js.map +1 -1
- package/lib/plugins/PixelPickingPlugin.js +13 -16
- package/lib/plugins/PixelPickingPlugin.js.map +1 -1
- package/lib/point/index.js +8 -15
- package/lib/point/index.js.map +1 -1
- package/lib/point/models/earthExtrude.js +15 -16
- package/lib/point/models/earthExtrude.js.map +1 -1
- package/lib/point/models/earthFill.js +22 -13
- package/lib/point/models/earthFill.js.map +1 -1
- package/lib/point/models/extrude.js +28 -51
- package/lib/point/models/extrude.js.map +1 -1
- package/lib/point/models/fill.js +42 -61
- package/lib/point/models/fill.js.map +1 -1
- package/lib/point/models/fillmage.js +22 -13
- package/lib/point/models/fillmage.js.map +1 -1
- package/lib/point/models/icon-font.js +196 -0
- package/lib/point/models/icon-font.js.map +1 -0
- package/lib/point/models/image.js +6 -11
- package/lib/point/models/image.js.map +1 -1
- package/lib/point/models/index.js +3 -0
- package/lib/point/models/index.js.map +1 -1
- package/lib/point/models/normal.js +6 -11
- package/lib/point/models/normal.js.map +1 -1
- package/lib/point/models/radar.js +22 -13
- package/lib/point/models/radar.js.map +1 -1
- package/lib/point/models/simplePoint.js +6 -11
- package/lib/point/models/simplePoint.js.map +1 -1
- package/lib/point/models/text.js +78 -110
- package/lib/point/models/text.js.map +1 -1
- package/lib/point/models/tile.js +25 -22
- package/lib/point/models/tile.js.map +1 -1
- package/lib/polygon/index.js +2 -12
- package/lib/polygon/index.js.map +1 -1
- package/lib/polygon/models/extrude.js +5 -10
- package/lib/polygon/models/extrude.js.map +1 -1
- package/lib/polygon/models/fill.js +11 -25
- package/lib/polygon/models/fill.js.map +1 -1
- package/lib/polygon/models/ocean.js +6 -12
- package/lib/polygon/models/ocean.js.map +1 -1
- package/lib/polygon/models/tile.js +27 -17
- package/lib/polygon/models/tile.js.map +1 -1
- package/lib/polygon/models/water.js +6 -12
- package/lib/polygon/models/water.js.map +1 -1
- package/lib/raster/image.js +2 -0
- package/lib/raster/image.js.map +1 -0
- package/lib/raster/index.js +2 -12
- package/lib/raster/index.js.map +1 -1
- package/lib/raster/models/raster.js +7 -11
- package/lib/raster/models/raster.js.map +1 -1
- package/lib/raster/raster2d.js +172 -0
- package/lib/raster/raster2d.js.map +1 -0
- package/lib/tile/manager/tileLayerManager.js +21 -4
- package/lib/tile/manager/tileLayerManager.js.map +1 -1
- package/lib/tile/manager/tilePickerManager.js +0 -1
- 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 +2 -12
- package/lib/tile/tileFactory/rasterDataLayer.js.map +1 -1
- package/lib/tile/tileFactory/vectorLayer.js +2 -12
- package/lib/tile/tileFactory/vectorLayer.js.map +1 -1
- package/lib/utils/extrude_polyline.js +6 -140
- package/lib/utils/extrude_polyline.js.map +1 -1
- package/lib/utils/geo.js +65 -0
- package/lib/utils/geo.js.map +1 -0
- package/lib/utils/simpleLine.js +117 -0
- package/lib/utils/simpleLine.js.map +1 -0
- package/lib/wind/index.js +2 -12
- package/lib/wind/index.js.map +1 -1
- package/lib/wind/models/wind.js +33 -36
- package/lib/wind/models/wind.js.map +1 -1
- package/package.json +8 -9
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/line/models/simpleLine.ts"],"names":["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","gl","LUMINANCE","type","FLOAT","u_dataTexture","u_cellTypeLayout","getCellTypeLayout","u_opacity","u_linearColor","u_sourceColor","u_targetColor","u_vertexScale","animateOption","u_aimate","animateOption2Array","u_time","getLayerAnimateTime","callbackModel","buildModels","destroy","frag","simle_linear_frag","vert","simple_line_vert","simple_line_frag","mask","maskInside","getShaders","buildLayerModel","moduleName","vertexShader","fragmentShader","triangulation","SimpleLineTriangulation","primitive","LINES","depth","enable","blend","getBlend","stencil","then","model","catch","err","console","warn","styleAttributeService","registerStyleAttribute","name","AttributeType","Attribute","descriptor","buffer","usage","STATIC_DRAW","size","update","feature","featureIdx","vertex","attributeIdx","DYNAMIC_DRAW","Array","isArray","normal","BaseModel"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;;AASA;;AAEA;;AAEA;;;;;;;;;;IAKqBA,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,UA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AAE,gBACNC,OADM,EAENC,UAFM,EAGNC,MAHM,EAINC,YAJM,EAKH;AACH,mBAAO,CAACD,MAAM,CAAC,CAAD,CAAP,CAAP;AACD;AAhBS;AAHoC,OAAlD;AAsBD;;;EArP0CM,mB","sourcesContent":["import {\n AttributeType,\n gl,\n IAnimateOption,\n IEncodeFeature,\n ILayerConfig,\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';\n// linear simple line shader\nimport simle_linear_frag from '../shaders/linear/simpleline_linear_frag.glsl';\nimport simple_line_frag from '../shaders/simpleline_frag.glsl';\nimport simple_line_vert from '../shaders/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 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.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 // 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"],"file":"simpleLine.js"}
|
|
1
|
+
{"version":3,"sources":["../../../src/line/models/simpleLine.ts"],"names":["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","gl","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","SimpleLineTriangulation","primitive","LINES","blend","getBlend","depth","enable","stencil","styleAttributeService","registerStyleAttribute","name","AttributeType","Attribute","descriptor","buffer","usage","STATIC_DRAW","size","update","feature","featureIdx","vertex","attributeIdx","DYNAMIC_DRAW","Array","isArray","BaseModel"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;;AAOA;;AAEA;;AAEA;;;;;;;;;;IAKqBA,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,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AI,EAAEF,WAAGG;AAJH,WAFE;AAQVyC,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;AAuBA,WAAKb,qBAAL,CAA2BC,sBAA3B,CAAkD;AAChDC,QAAAA,IAAI,EAAE,MAD0C;AAEhDnC,QAAAA,IAAI,EAAEoC,sBAAcC,SAF4B;AAGhDC,QAAAA,UAAU,EAAE;AACVH,UAAAA,IAAI,EAAE,QADI;AAEVI,UAAAA,MAAM,EAAE;AAENC,YAAAA,KAAK,EAAE1C,WAAGkD,YAFJ;AAGN3D,YAAAA,IAAI,EAAE,EAHA;AAINW,YAAAA,IAAI,EAAEF,WAAGG;AAJH,WAFE;AAQVyC,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;;;EAtL0CS,mB","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"}
|
package/lib/line/models/tile.js
CHANGED
|
@@ -7,10 +7,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
});
|
|
8
8
|
exports.default = void 0;
|
|
9
9
|
|
|
10
|
-
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
11
|
-
|
|
12
|
-
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
13
|
-
|
|
14
10
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
15
11
|
|
|
16
12
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
@@ -170,10 +166,10 @@ var LineModel = function (_BaseModel) {
|
|
|
170
166
|
}
|
|
171
167
|
}, {
|
|
172
168
|
key: "initModels",
|
|
173
|
-
value: function initModels(
|
|
169
|
+
value: function initModels() {
|
|
174
170
|
this.updateTexture();
|
|
175
171
|
this.iconService.on('imageUpdate', this.updateTexture);
|
|
176
|
-
this.buildModels(
|
|
172
|
+
return this.buildModels();
|
|
177
173
|
}
|
|
178
174
|
}, {
|
|
179
175
|
key: "clearModels",
|
|
@@ -186,47 +182,43 @@ var LineModel = function (_BaseModel) {
|
|
|
186
182
|
}
|
|
187
183
|
}, {
|
|
188
184
|
key: "buildModels",
|
|
189
|
-
value: function () {
|
|
190
|
-
var
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
return buildModels;
|
|
229
|
-
}()
|
|
185
|
+
value: function buildModels() {
|
|
186
|
+
var _ref2 = this.layer.getLayerConfig(),
|
|
187
|
+
_ref2$mask = _ref2.mask,
|
|
188
|
+
mask = _ref2$mask === void 0 ? false : _ref2$mask,
|
|
189
|
+
_ref2$maskInside = _ref2.maskInside,
|
|
190
|
+
maskInside = _ref2$maskInside === void 0 ? true : _ref2$maskInside,
|
|
191
|
+
_ref2$depth = _ref2.depth,
|
|
192
|
+
depth = _ref2$depth === void 0 ? false : _ref2$depth;
|
|
193
|
+
|
|
194
|
+
var _this$getShaders = this.getShaders(),
|
|
195
|
+
frag = _this$getShaders.frag,
|
|
196
|
+
vert = _this$getShaders.vert,
|
|
197
|
+
type = _this$getShaders.type;
|
|
198
|
+
|
|
199
|
+
this.layer.triangulation = _triangulation.LineTriangulation;
|
|
200
|
+
return [this.layer.buildLayerModel({
|
|
201
|
+
moduleName: type,
|
|
202
|
+
vertexShader: vert,
|
|
203
|
+
fragmentShader: frag,
|
|
204
|
+
triangulation: _triangulation.LineTriangulation,
|
|
205
|
+
primitive: _l7Core.gl.TRIANGLES,
|
|
206
|
+
blend: this.getBlend(),
|
|
207
|
+
depth: {
|
|
208
|
+
enable: depth
|
|
209
|
+
},
|
|
210
|
+
stencil: (0, _l7Utils.getMask)(mask, maskInside)
|
|
211
|
+
})];
|
|
212
|
+
}
|
|
213
|
+
}, {
|
|
214
|
+
key: "getShaders",
|
|
215
|
+
value: function getShaders() {
|
|
216
|
+
return {
|
|
217
|
+
frag: line_tile_frag,
|
|
218
|
+
vert: line_tile_vert,
|
|
219
|
+
type: 'line_tile'
|
|
220
|
+
};
|
|
221
|
+
}
|
|
230
222
|
}, {
|
|
231
223
|
key: "registerBuiltinAttributes",
|
|
232
224
|
value: function registerBuiltinAttributes() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/line/models/tile.ts"],"names":["LineModel","createTexture2D","rendererService","texture","update","data","iconService","getCanvas","layer","render","mag","gl","NEAREST","min","premultiplyAlpha","width","height","canvasHeight","getLayerConfig","opacity","textureBlend","lineTexture","iconStep","vertexHeightScale","borderWidth","borderColor","heightfixed","arrow","enable","arrowWidth","arrowHeight","tailWidth","coord","tileOrigin","getDirty","bind","dataTextureTest","dataTextureNeedUpdate","judgeStyleAttributes","encodeData","getEncodedData","calDataFrame","cellLength","cellProperties","rowCount","dataTexture","length","flipY","format","LUMINANCE","type","FLOAT","u_tileOrigin","u_coord","u_dataTexture","u_cellTypeLayout","getCellTypeLayout","u_opacity","Number","u_textureBlend","u_texture","u_line_texture","u_icon_step","u_textSize","u_borderWidth","u_borderColor","u_heightfixed","u_vertexScale","u_arrow","u_arrowHeight","u_arrowWidth","u_tailWidth","undefined","callbackModel","updateTexture","on","buildModels","destroy","off","mask","maskInside","depth","triangulation","LineTriangulation","buildLayerModel","moduleName","vertexShader","line_tile_vert","fragmentShader","line_tile_frag","blend","getBlend","stencil","then","model","catch","err","console","warn","styleAttributeService","registerStyleAttribute","name","AttributeType","Attribute","descriptor","buffer","usage","STATIC_DRAW","size","feature","featureIdx","vertex","attributeIdx","normal","vertexIndex","DYNAMIC_DRAW","Array","isArray","iconMap","getIconMap","x","y","BaseModel"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AAUA;;AACA;;AAEA;;;;;;;;;IAKqBA,S;;;;;;;;;;;;;;;;gGAsRK,YAAM;AAC5B,UAAQC,eAAR,GAA4B,MAAKC,eAAjC,CAAQD,eAAR;;AACA,UAAI,MAAKE,OAAT,EAAkB;AAChB,cAAKA,OAAL,CAAaC,MAAb,CAAoB;AAClBC,UAAAA,IAAI,EAAE,MAAKC,WAAL,CAAiBC,SAAjB;AADY,SAApB;;AAGA,cAAK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Model,\n IModelUniform,\n ITexture2D,\n} from '@antv/l7-core';\n\nimport { getMask, rgb2arr } from '@antv/l7-utils';\nimport BaseModel from '../../core/BaseModel';\nimport { ILineLayerStyleOptions } from '../../core/interface';\nimport { LineTriangulation } from '../../core/triangulation';\n\nimport line_tile_frag from '../shaders/tile/line_tile_frag.glsl';\nimport line_tile_vert from '../shaders/tile/line_tile_vert.glsl';\n\nexport default class LineModel extends BaseModel {\n protected texture: ITexture2D;\n public getUninforms(): IModelUniform {\n const {\n opacity = 1,\n textureBlend = 'normal',\n lineTexture = false,\n iconStep = 100,\n vertexHeightScale = 20.0,\n borderWidth = 0.0,\n borderColor = '#ccc',\n heightfixed = false,\n arrow = {\n enable: false,\n arrowWidth: 2,\n arrowHeight: 3,\n tailWidth: 1,\n },\n coord = 'lnglat',\n tileOrigin,\n } = this.layer.getLayerConfig() as ILineLayerStyleOptions;\n\n if (this.rendererService.getDirty()) {\n this.texture.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_tileOrigin: tileOrigin || [0, 0],\n u_coord: coord === 'lnglat' ? 1.0 : 0.0,\n u_dataTexture: this.dataTexture, // 数据纹理 - 有数据映射的时候纹理中带数据,若没有任何数据映射时纹理是 [1]\n u_cellTypeLayout: this.getCellTypeLayout(),\n u_opacity: Number(opacity),\n u_textureBlend: textureBlend === 'normal' ? 0.0 : 1.0,\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_heightfixed: Number(heightfixed),\n\n // 顶点高度 scale\n u_vertexScale: vertexHeightScale,\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\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 async 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: 'lineTile',\n vertexShader: line_tile_vert,\n fragmentShader: line_tile_frag,\n triangulation: LineTriangulation,\n blend: this.getBlend(),\n depth: { enable: depth },\n // depth: { enable: true },\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 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":"tile.js"}
|
|
1
|
+
{"version":3,"sources":["../../../src/line/models/tile.ts"],"names":["LineModel","createTexture2D","rendererService","texture","update","data","iconService","getCanvas","layer","render","mag","gl","NEAREST","min","premultiplyAlpha","width","height","canvasHeight","getLayerConfig","opacity","textureBlend","lineTexture","iconStep","vertexHeightScale","borderWidth","borderColor","heightfixed","arrow","enable","arrowWidth","arrowHeight","tailWidth","coord","tileOrigin","getDirty","bind","dataTextureTest","dataTextureNeedUpdate","judgeStyleAttributes","encodeData","getEncodedData","calDataFrame","cellLength","cellProperties","rowCount","dataTexture","length","flipY","format","LUMINANCE","type","FLOAT","u_tileOrigin","u_coord","u_dataTexture","u_cellTypeLayout","getCellTypeLayout","u_opacity","Number","u_textureBlend","u_texture","u_line_texture","u_icon_step","u_textSize","u_borderWidth","u_borderColor","u_heightfixed","u_vertexScale","u_arrow","u_arrowHeight","u_arrowWidth","u_tailWidth","undefined","updateTexture","on","buildModels","destroy","off","mask","maskInside","depth","getShaders","frag","vert","triangulation","LineTriangulation","buildLayerModel","moduleName","vertexShader","fragmentShader","primitive","TRIANGLES","blend","getBlend","stencil","line_tile_frag","line_tile_vert","styleAttributeService","registerStyleAttribute","name","AttributeType","Attribute","descriptor","buffer","usage","STATIC_DRAW","size","feature","featureIdx","vertex","attributeIdx","normal","vertexIndex","DYNAMIC_DRAW","Array","isArray","iconMap","getIconMap","x","y","BaseModel"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;;AAUA;;AACA;;AAEA;;;;;;;;;IAKqBA,S;;;;;;;;;;;;;;;;gGA4RK,YAAM;AAC5B,UAAQC,eAAR,GAA4B,MAAKC,eAAjC,CAAQD,eAAR;;AACA,UAAI,MAAKE,OAAT,EAAkB;AAChB,cAAKA,OAAL,CAAaC,MAAb,CAAoB;AAClBC,UAAAA,IAAI,EAAE,MAAKC,WAAL,CAAiBC,SAAjB;AADY,SAApB;;AAGA,cAAKC,KAAL,CAAWC,MAAX;;AACA;AACD;;AACD,YAAKN,OAAL,GAAeF,eAAe,CAAC;AAC7BI,QAAAA,IAAI,EAAE,MAAKC,WAAL,CAAiBC,SAAjB,EADuB;AAE7BG,QAAAA,GAAG,EAAEC,WAAGC,OAFqB;AAG7BC,QAAAA,GAAG,EAAEF,WAAGC,OAHqB;AAI7BE,QAAAA,gBAAgB,EAAE,KAJW;AAK7BC,QAAAA,KAAK,EAAE,IALsB;AAM7BC,QAAAA,MAAM,EAAE,MAAKV,WAAL,CAAiBW,YAAjB,IAAiC;AANZ,OAAD,CAA9B;AAQD,K;;;;;;WA3SD,wBAAqC;AACnC,iBAiBI,KAAKT,KAAL,CAAWU,cAAX,EAjBJ;AAAA,8BACEC,OADF;AAAA,UACEA,OADF,6BACY,CADZ;AAAA,mCAEEC,YAFF;AAAA,UAEEA,YAFF,kCAEiB,QAFjB;AAAA,kCAGEC,WAHF;AAAA,UAGEA,WAHF,iCAGgB,KAHhB;AAAA,+BAIEC,QAJF;AAAA,UAIEA,QAJF,8BAIa,GAJb;AAAA,uCAKEC,iBALF;AAAA,UAKEA,iBALF,sCAKsB,IALtB;AAAA,kCAMEC,WANF;AAAA,UAM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,EAENC,UAFM,EAGNC,MAHM,EAINC,YAJM,EAKH;AACH,gBAAMM,OAAO,GAAG,MAAI,CAAC9G,WAAL,CAAiB+G,UAAjB,EAAhB;;AACA,gBAAQlH,OAAR,GAAoBwG,OAApB,CAAQxG,OAAR;;AACA,wBAAiBiH,OAAO,CAACjH,OAAD,CAAP,IAA8B;AAAEmH,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;;;EA1RoCC,mB","sourcesContent":["import {\n AttributeType,\n gl,\n IEncodeFeature,\n ILayerConfig,\n IModel,\n IModelUniform,\n ITexture2D,\n} from '@antv/l7-core';\n\nimport { getMask, rgb2arr } from '@antv/l7-utils';\nimport BaseModel from '../../core/BaseModel';\nimport { ILineLayerStyleOptions } from '../../core/interface';\nimport { LineTriangulation } from '../../core/triangulation';\n\nimport line_tile_frag from '../shaders/tile/line_tile_frag.glsl';\nimport line_tile_vert from '../shaders/tile/line_tile_vert.glsl';\n\nexport default class LineModel extends BaseModel {\n protected texture: ITexture2D;\n public getUninforms(): IModelUniform {\n const {\n opacity = 1,\n textureBlend = 'normal',\n lineTexture = false,\n iconStep = 100,\n vertexHeightScale = 20.0,\n borderWidth = 0.0,\n borderColor = '#ccc',\n heightfixed = false,\n arrow = {\n enable: false,\n arrowWidth: 2,\n arrowHeight: 3,\n tailWidth: 1,\n },\n coord = 'lnglat',\n tileOrigin,\n } = this.layer.getLayerConfig() as ILineLayerStyleOptions;\n\n if (this.rendererService.getDirty()) {\n this.texture.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_tileOrigin: tileOrigin || [0, 0],\n u_coord: coord === 'lnglat' ? 1.0 : 0.0,\n u_dataTexture: this.dataTexture, // 数据纹理 - 有数据映射的时候纹理中带数据,若没有任何数据映射时纹理是 [1]\n u_cellTypeLayout: this.getCellTypeLayout(),\n u_opacity: Number(opacity),\n u_textureBlend: textureBlend === 'normal' ? 0.0 : 1.0,\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_heightfixed: Number(heightfixed),\n\n // 顶点高度 scale\n u_vertexScale: vertexHeightScale,\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\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: 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 return {\n frag: line_tile_frag,\n vert: line_tile_vert,\n type: 'line_tile',\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":"tile.js"}
|
package/lib/line/models/wall.js
CHANGED
|
@@ -172,10 +172,10 @@ var LineWallModel = function (_BaseModel) {
|
|
|
172
172
|
}
|
|
173
173
|
}, {
|
|
174
174
|
key: "initModels",
|
|
175
|
-
value: function initModels(
|
|
175
|
+
value: function initModels() {
|
|
176
176
|
this.updateTexture();
|
|
177
177
|
this.iconService.on('imageUpdate', this.updateTexture);
|
|
178
|
-
this.buildModels(
|
|
178
|
+
return this.buildModels();
|
|
179
179
|
}
|
|
180
180
|
}, {
|
|
181
181
|
key: "clearModels",
|
|
@@ -188,22 +188,18 @@ var LineWallModel = function (_BaseModel) {
|
|
|
188
188
|
}
|
|
189
189
|
}, {
|
|
190
190
|
key: "buildModels",
|
|
191
|
-
value: function buildModels(
|
|
192
|
-
this.layer.buildLayerModel({
|
|
193
|
-
moduleName: '
|
|
191
|
+
value: function buildModels() {
|
|
192
|
+
return [this.layer.buildLayerModel({
|
|
193
|
+
moduleName: 'linewall',
|
|
194
194
|
vertexShader: line_vert,
|
|
195
195
|
fragmentShader: line_frag,
|
|
196
196
|
triangulation: _triangulation.LineTriangulation,
|
|
197
|
+
primitive: _l7Core.gl.TRIANGLES,
|
|
198
|
+
blend: this.getBlend(),
|
|
197
199
|
depth: {
|
|
198
200
|
enable: false
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
}).then(function (model) {
|
|
202
|
-
callbackModel([model]);
|
|
203
|
-
}).catch(function (err) {
|
|
204
|
-
console.warn(err);
|
|
205
|
-
callbackModel([]);
|
|
206
|
-
});
|
|
201
|
+
}
|
|
202
|
+
})];
|
|
207
203
|
}
|
|
208
204
|
}, {
|
|
209
205
|
key: "registerBuiltinAttributes",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/line/models/wall.ts"],"names":["LineWallModel","createTexture2D","rendererService","texture","update","data","iconService","getCanvas","layer","render","mag","gl","NEAREST","min","premultiplyAlpha","width","height","canvasHeight","getLayerConfig","opacity","sourceColor","targetColor","textureBlend","heightfixed","lineTexture","iconStep","iconStepCount","getDirty","bind","useLinearColor","sourceColorArr","targetColorArr","dataTextureTest","dataTextureNeedUpdate","judgeStyleAttributes","encodeData","getEncodedData","calDataFrame","cellLength","cellProperties","rowCount","dataTexture","length","flipY","format","LUMINANCE","type","FLOAT","u_heightfixed","Number","u_dataTexture","u_cellTypeLayout","getCellTypeLayout","u_opacity","u_textureBlend","u_texture","u_line_texture","u_iconStepCount","u_icon_step","u_textSize","u_linearColor","u_sourceColor","u_targetColor","animateOption","u_aimate","animateOption2Array","u_time","getLayerAnimateTime","callbackModel","updateTexture","on","buildModels","destroy","off","buildLayerModel","moduleName","vertexShader","line_vert","fragmentShader","line_frag","triangulation","LineTriangulation","depth","enable","blend","getBlend","then","model","catch","err","console","warn","styleAttributeService","registerStyleAttribute","name","AttributeType","Attribute","descriptor","buffer","usage","STATIC_DRAW","size","feature","featureIdx","vertex","attributeIdx","DYNAMIC_DRAW","Array","isArray","normal","iconMap","getIconMap","x","y","BaseModel"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AAUA;;AAEA;;AAEA;;;;;;;;;IAIqBA,a;;;;;;;;;;;;;;;;gGAuQK,YAAM;AAC5B,UAAQC,eAAR,GAA4B,MAAKC,eAAjC,CAAQD,eAAR;;AACA,UAAI,MAAKE,OAAT,EAAkB;AAChB,cAAKA,OAAL,CAAaC,MAAb,CAAoB;AAClBC,UAAAA,IAAI,EAAE,MAAKC,WAAL,CAAiBC,SAAjB;AADY,SAApB;;AAGA,cAAKC,KAAL,CAAWC,MAAX;;AACA;AACD;;AACD,YAAKN,OAAL,GAAeF,eAAe,CAAC;AAC7BI,QAAAA,IAAI,EAAE,MAAKC,WAAL,CAAiBC,SAAjB,EADuB;AAE7BG,QAAAA,GAAG,EAAEC,WAAGC,OAFqB;AAG7BC,QAAAA,GAAG,EAAEF,WAAGC,OAHqB;AAI7BE,QAAAA,gBAAgB,EAAE,KAJW;AAK7BC,QAAAA,KAAK,EAAE,IALsB;AAM7BC,QAAAA,MAAM,EAAE,MAAKV,WAAL,CAAiBW,YAAjB,IAAiC;AANZ,OAAD,CAA9B;AAQD,K;;;;;;WAtRD,wBAAqC;AACnC,iBASI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C,CAAX,SAAWA,CAAX;;AACA,mBAAO,CAACD,CAAD,EAAIC,CAAJ,CAAP;AACD;AAnBS;AAHoC,OAAlD;AAyBD;;;EAtQwCC,mB","sourcesContent":["import {\n AttributeType,\n gl,\n IAnimateOption,\n IEncodeFeature,\n ILayerConfig,\n IModel,\n IModelUniform,\n ITexture2D,\n} from '@antv/l7-core';\nimport { rgb2arr } from '@antv/l7-utils';\nimport { isNumber } from 'lodash';\nimport BaseModel from '../../core/BaseModel';\nimport { ILineLayerStyleOptions } from '../../core/interface';\nimport { LineTriangulation } from '../../core/triangulation';\nimport line_frag from '../shaders/wall_frag.glsl';\nimport line_vert from '../shaders/wall_vert.glsl';\n\nexport default class LineWallModel extends BaseModel {\n protected texture: ITexture2D;\n public getUninforms(): IModelUniform {\n const {\n opacity = 1,\n sourceColor,\n targetColor,\n textureBlend = 'normal',\n heightfixed = false,\n lineTexture = false,\n iconStep = 100,\n iconStepCount = 1,\n } = this.layer.getLayerConfig() as ILineLayerStyleOptions;\n\n if (this.rendererService.getDirty()) {\n this.texture.bind();\n }\n\n // 转化渐变色\n let useLinearColor = 0; // 默认不生效\n let sourceColorArr = [0, 0, 0, 0];\n let targetColorArr = [0, 0, 0, 0];\n if (sourceColor && targetColor) {\n sourceColorArr = rgb2arr(sourceColor);\n targetColorArr = rgb2arr(targetColor);\n useLinearColor = 1;\n }\n\n if (this.dataTextureTest && this.dataTextureNeedUpdate({ opacity })) {\n this.judgeStyleAttributes({ opacity });\n const encodeData = this.layer.getEncodedData();\n const { data, width, height } = this.calDataFrame(\n this.cellLength,\n encodeData,\n this.cellProperties,\n );\n this.rowCount = height; // 当前数据纹理有多少行\n\n this.dataTexture =\n this.cellLength > 0 && data.length > 0\n ? this.createTexture2D({\n flipY: true,\n data,\n format: gl.LUMINANCE,\n type: gl.FLOAT,\n width,\n height,\n })\n : this.createTexture2D({\n flipY: true,\n data: [1],\n format: gl.LUMINANCE,\n type: gl.FLOAT,\n width: 1,\n height: 1,\n });\n }\n\n return {\n u_heightfixed: Number(heightfixed),\n u_dataTexture: this.dataTexture, // 数据纹理 - 有数据映射的时候纹理中带数据,若没有任何数据映射时纹理是 [1]\n u_cellTypeLayout: this.getCellTypeLayout(),\n\n u_opacity: isNumber(opacity) ? opacity : 1.0,\n u_textureBlend: textureBlend === 'normal' ? 0.0 : 1.0,\n\n // 纹理支持参数\n u_texture: this.texture, // 贴图\n u_line_texture: lineTexture ? 1.0 : 0.0, // 传入线的标识\n u_iconStepCount: iconStepCount,\n u_icon_step: iconStep,\n u_textSize: [1024, this.iconService.canvasHeight || 128],\n\n // 渐变色支持参数\n u_linearColor: useLinearColor,\n u_sourceColor: sourceColorArr,\n u_targetColor: targetColorArr,\n };\n }\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 this.layer\n .buildLayerModel({\n moduleName: 'lineWall',\n vertexShader: line_vert,\n fragmentShader: line_frag,\n triangulation: LineTriangulation,\n depth: { enable: false },\n blend: this.getBlend(),\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 // point layer size;\n this.styleAttributeService.registerStyleAttribute({\n name: 'normal',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_Normal',\n buffer: {\n // give the WebGL driver a hint that this buffer may change\n usage: gl.STATIC_DRAW,\n data: [],\n type: gl.FLOAT,\n },\n size: 3,\n // @ts-ignore\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n normal: number[],\n ) => {\n return normal;\n },\n },\n });\n\n this.styleAttributeService.registerStyleAttribute({\n name: 'miter',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_Miter',\n buffer: {\n // give the WebGL driver a hint that this buffer may change\n usage: gl.STATIC_DRAW,\n data: [],\n type: gl.FLOAT,\n },\n size: 1,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n ) => {\n return [vertex[4]];\n },\n },\n });\n\n this.styleAttributeService.registerStyleAttribute({\n name: 'uv',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_iconMapUV',\n buffer: {\n // give the WebGL driver a hint that this buffer may change\n usage: gl.DYNAMIC_DRAW,\n data: [],\n type: gl.FLOAT,\n },\n size: 2,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n ) => {\n const iconMap = this.iconService.getIconMap();\n const { texture } = feature;\n const { x, y } = iconMap[texture as string] || { x: 0, y: 0 };\n return [x, y];\n },\n },\n });\n }\n 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":"wall.js"}
|
|
1
|
+
{"version":3,"sources":["../../../src/line/models/wall.ts"],"names":["LineWallModel","createTexture2D","rendererService","texture","update","data","iconService","getCanvas","layer","render","mag","gl","NEAREST","min","premultiplyAlpha","width","height","canvasHeight","getLayerConfig","opacity","sourceColor","targetColor","textureBlend","heightfixed","lineTexture","iconStep","iconStepCount","getDirty","bind","useLinearColor","sourceColorArr","targetColorArr","dataTextureTest","dataTextureNeedUpdate","judgeStyleAttributes","encodeData","getEncodedData","calDataFrame","cellLength","cellProperties","rowCount","dataTexture","length","flipY","format","LUMINANCE","type","FLOAT","u_heightfixed","Number","u_dataTexture","u_cellTypeLayout","getCellTypeLayout","u_opacity","u_textureBlend","u_texture","u_line_texture","u_iconStepCount","u_icon_step","u_textSize","u_linearColor","u_sourceColor","u_targetColor","animateOption","u_aimate","animateOption2Array","u_time","getLayerAnimateTime","updateTexture","on","buildModels","destroy","off","buildLayerModel","moduleName","vertexShader","line_vert","fragmentShader","line_frag","triangulation","LineTriangulation","primitive","TRIANGLES","blend","getBlend","depth","enable","styleAttributeService","registerStyleAttribute","name","AttributeType","Attribute","descriptor","buffer","usage","STATIC_DRAW","size","feature","featureIdx","vertex","attributeIdx","DYNAMIC_DRAW","Array","isArray","normal","iconMap","getIconMap","x","y","BaseModel"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AAUA;;AAEA;;AAEA;;;;;;;;;IAIqBA,a;;;;;;;;;;;;;;;;gGAkQK,YAAM;AAC5B,UAAQC,eAAR,GAA4B,MAAKC,eAAjC,CAAQD,eAAR;;AACA,UAAI,MAAKE,OAAT,EAAkB;AAChB,cAAKA,OAAL,CAAaC,MAAb,CAAoB;AAClBC,UAAAA,IAAI,EAAE,MAAKC,WAAL,CAAiBC,SAAjB;AADY,SAApB;;AAGA,cAAKC,KAAL,CAAWC,MAAX;;AACA;AACD;;AACD,YAAKN,OAAL,GAAeF,eAAe,CAAC;AAC7BI,QAAAA,IAAI,EAAE,MAAKC,WAAL,CAAiBC,SAAjB,EADuB;AAE7BG,QAAAA,GAAG,EAAEC,WAAGC,OAFqB;AAG7BC,QAAAA,GAAG,EAAEF,WAAGC,OAHqB;AAI7BE,QAAAA,gBAAgB,EAAE,KAJW;AAK7BC,QAAAA,KAAK,EAAE,IALsB;AAM7BC,QAAAA,MAAM,EAAE,MAAKV,WAAL,CAAiBW,YAAjB,IAAiC;AANZ,OAAD,CAA9B;AAQD,K;;;;;;WAjRD,wBAAqC;AACnC,iBASI,KAAKT,KAAL,CAAWU,cAAX,EATJ;AAAA,8BACEC,OADF;AAAA,UACEA,OADF,6BACY,CADZ;AAAA,UAEEC,WAFF,QAEEA,WAFF;AAAA,UAGEC,WAHF,QAGEA,WAHF;AAAA,mCAIEC,YAJF;AAAA,UAIEA,YAJF,kCAIiB,QAJjB;AAAA,kCAKEC,WALF;AAAA,UAKEA,WALF,iCAKgB,KALhB;AAAA,kCAMEC,WANF;AAAA,UAMEA,WANF,iCAMgB,KANhB;AAAA,+BAOEC,QAPF;AAAA,UAOEA,QAPF,8BAOa,GAPb;AAAA,oCAQEC,aARF;AAAA,UAQEA,aARF,mCAQkB,CARlB;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AE4C,sBAAcC,SAF4B;AAGhDC,QAAAA,UAAU,EAAE;AACVH,UAAAA,IAAI,EAAE,aADI;AAEVI,UAAAA,MAAM,EAAE;AAENC,YAAAA,KAAK,EAAEnF,WAAG0F,YAFJ;AAGNhG,YAAAA,IAAI,EAAE,EAHA;AAINyC,YAAAA,IAAI,EAAEnC,WAAGoC;AAJH,WAFE;AAQViD,UAAAA,IAAI,EAAE,CARI;AASV5F,UAAAA,MAAM,EAAE,gBACN6F,OADM,EAENC,UAFM,EAGNC,MAHM,EAINC,YAJM,EAKH;AACH,gBAAMK,OAAO,GAAG,MAAI,CAACnG,WAAL,CAAiBoG,UAAjB,EAAhB;;AACA,gBAAQvG,OAAR,GAAoB8F,OAApB,CAAQ9F,OAAR;;AACA,wBAAiBsG,OAAO,CAACtG,OAAD,CAAP,IAA8B;AAAEwG,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;;;EAjQwCC,mB","sourcesContent":["import {\n AttributeType,\n gl,\n IAnimateOption,\n IEncodeFeature,\n ILayerConfig,\n IModel,\n IModelUniform,\n ITexture2D,\n} from '@antv/l7-core';\nimport { rgb2arr } from '@antv/l7-utils';\nimport { isNumber } from 'lodash';\nimport BaseModel from '../../core/BaseModel';\nimport { ILineLayerStyleOptions } from '../../core/interface';\nimport { LineTriangulation } from '../../core/triangulation';\nimport line_frag from '../shaders/wall_frag.glsl';\nimport line_vert from '../shaders/wall_vert.glsl';\n\nexport default class LineWallModel extends BaseModel {\n protected texture: ITexture2D;\n public getUninforms(): IModelUniform {\n const {\n opacity = 1,\n sourceColor,\n targetColor,\n textureBlend = 'normal',\n heightfixed = false,\n lineTexture = false,\n iconStep = 100,\n iconStepCount = 1,\n } = this.layer.getLayerConfig() as ILineLayerStyleOptions;\n\n if (this.rendererService.getDirty()) {\n this.texture.bind();\n }\n\n // 转化渐变色\n let useLinearColor = 0; // 默认不生效\n let sourceColorArr = [0, 0, 0, 0];\n let targetColorArr = [0, 0, 0, 0];\n if (sourceColor && targetColor) {\n sourceColorArr = rgb2arr(sourceColor);\n targetColorArr = rgb2arr(targetColor);\n useLinearColor = 1;\n }\n\n if (this.dataTextureTest && this.dataTextureNeedUpdate({ opacity })) {\n this.judgeStyleAttributes({ opacity });\n const encodeData = this.layer.getEncodedData();\n const { data, width, height } = this.calDataFrame(\n this.cellLength,\n encodeData,\n this.cellProperties,\n );\n this.rowCount = height; // 当前数据纹理有多少行\n\n this.dataTexture =\n this.cellLength > 0 && data.length > 0\n ? this.createTexture2D({\n flipY: true,\n data,\n format: gl.LUMINANCE,\n type: gl.FLOAT,\n width,\n height,\n })\n : this.createTexture2D({\n flipY: true,\n data: [1],\n format: gl.LUMINANCE,\n type: gl.FLOAT,\n width: 1,\n height: 1,\n });\n }\n\n return {\n u_heightfixed: Number(heightfixed),\n u_dataTexture: this.dataTexture, // 数据纹理 - 有数据映射的时候纹理中带数据,若没有任何数据映射时纹理是 [1]\n u_cellTypeLayout: this.getCellTypeLayout(),\n\n u_opacity: isNumber(opacity) ? opacity : 1.0,\n u_textureBlend: textureBlend === 'normal' ? 0.0 : 1.0,\n\n // 纹理支持参数\n u_texture: this.texture, // 贴图\n u_line_texture: lineTexture ? 1.0 : 0.0, // 传入线的标识\n u_iconStepCount: iconStepCount,\n u_icon_step: iconStep,\n u_textSize: [1024, this.iconService.canvasHeight || 128],\n\n // 渐变色支持参数\n u_linearColor: useLinearColor,\n u_sourceColor: sourceColorArr,\n u_targetColor: targetColorArr,\n };\n }\n public getAnimateUniforms(): IModelUniform {\n const { animateOption } = this.layer.getLayerConfig() as ILayerConfig;\n return {\n u_aimate: this.animateOption2Array(animateOption as IAnimateOption),\n u_time: this.layer.getLayerAnimateTime(),\n };\n }\n\n public initModels(): IModel[] {\n this.updateTexture();\n this.iconService.on('imageUpdate', this.updateTexture);\n\n return this.buildModels();\n }\n\n public clearModels() {\n this.texture?.destroy();\n this.dataTexture?.destroy();\n this.iconService.off('imageUpdate', this.updateTexture);\n }\n\n public buildModels(): IModel[] {\n return [\n this.layer.buildLayerModel({\n moduleName: 'linewall',\n vertexShader: line_vert,\n fragmentShader: line_frag,\n triangulation: LineTriangulation,\n primitive: gl.TRIANGLES,\n blend: this.getBlend(),\n depth: { enable: false },\n }),\n ];\n }\n protected registerBuiltinAttributes() {\n this.styleAttributeService.registerStyleAttribute({\n name: 'distance',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_Distance',\n buffer: {\n // give the WebGL driver a hint that this buffer may change\n usage: gl.STATIC_DRAW,\n data: [],\n type: gl.FLOAT,\n },\n size: 1,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n ) => {\n return [vertex[3]];\n },\n },\n });\n this.styleAttributeService.registerStyleAttribute({\n name: 'total_distance',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_Total_Distance',\n buffer: {\n // give the WebGL driver a hint that this buffer may change\n usage: gl.STATIC_DRAW,\n data: [],\n type: gl.FLOAT,\n },\n size: 1,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n ) => {\n return [vertex[5]];\n },\n },\n });\n\n this.styleAttributeService.registerStyleAttribute({\n name: 'size',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_Size',\n buffer: {\n // give the WebGL driver a hint that this buffer may change\n usage: gl.DYNAMIC_DRAW,\n data: [],\n type: gl.FLOAT,\n },\n size: 2,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n ) => {\n const { size = 1 } = feature;\n return Array.isArray(size) ? [size[0], size[1]] : [size as number, 0];\n },\n },\n });\n\n // point layer size;\n this.styleAttributeService.registerStyleAttribute({\n name: 'normal',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_Normal',\n buffer: {\n // give the WebGL driver a hint that this buffer may change\n usage: gl.STATIC_DRAW,\n data: [],\n type: gl.FLOAT,\n },\n size: 3,\n // @ts-ignore\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n normal: number[],\n ) => {\n return normal;\n },\n },\n });\n\n this.styleAttributeService.registerStyleAttribute({\n name: 'miter',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_Miter',\n buffer: {\n // give the WebGL driver a hint that this buffer may change\n usage: gl.STATIC_DRAW,\n data: [],\n type: gl.FLOAT,\n },\n size: 1,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n ) => {\n return [vertex[4]];\n },\n },\n });\n\n this.styleAttributeService.registerStyleAttribute({\n name: 'uv',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_iconMapUV',\n buffer: {\n // give the WebGL driver a hint that this buffer may change\n usage: gl.DYNAMIC_DRAW,\n data: [],\n type: gl.FLOAT,\n },\n size: 2,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n ) => {\n const iconMap = this.iconService.getIconMap();\n const { texture } = feature;\n const { x, y } = iconMap[texture as string] || { x: 0, y: 0 };\n return [x, y];\n },\n },\n });\n }\n 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":"wall.js"}
|
package/lib/mask/index.js
CHANGED
|
@@ -51,24 +51,14 @@ var MaskLayer = function (_BaseLayer) {
|
|
|
51
51
|
(0, _createClass2.default)(MaskLayer, [{
|
|
52
52
|
key: "buildModels",
|
|
53
53
|
value: function buildModels() {
|
|
54
|
-
var _this2 = this;
|
|
55
|
-
|
|
56
54
|
var shape = this.getModelType();
|
|
57
55
|
this.layerModel = new _models.default[shape](this);
|
|
58
|
-
this.layerModel.initModels(
|
|
59
|
-
_this2.models = models;
|
|
60
|
-
|
|
61
|
-
_this2.renderLayers();
|
|
62
|
-
});
|
|
56
|
+
this.models = this.layerModel.initModels();
|
|
63
57
|
}
|
|
64
58
|
}, {
|
|
65
59
|
key: "rebuildModels",
|
|
66
60
|
value: function rebuildModels() {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
this.layerModel.buildModels(function (models) {
|
|
70
|
-
return _this3.models = models;
|
|
71
|
-
});
|
|
61
|
+
this.models = this.layerModel.buildModels();
|
|
72
62
|
}
|
|
73
63
|
}, {
|
|
74
64
|
key: "getConfigSchema",
|
package/lib/mask/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/mask/index.ts"],"names":["MaskLayer","shape","getModelType","layerModel","MaskModels","
|
|
1
|
+
{"version":3,"sources":["../../src/mask/index.ts"],"names":["MaskLayer","shape","getModelType","layerModel","MaskModels","models","initModels","buildModels","properties","opacity","type","minimum","maximum","BaseLayer"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;;AAEA;;;;;;IAEqBA,S;;;;;;;;;;;;;;;uFACG,W;;;;;;WACtB,uBAAqB;AACnB,UAAMC,KAAK,GAAG,KAAKC,YAAL,EAAd;AACA,WAAKC,UAAL,GAAkB,IAAIC,gBAAWH,KAAX,CAAJ,CAAsB,IAAtB,CAAlB;AACA,WAAKI,MAAL,GAAc,KAAKF,UAAL,CAAgBG,UAAhB,EAAd;AACD;;;WACD,yBAAuB;AACrB,WAAKD,MAAL,GAAc,KAAKF,UAAL,CAAgBI,WAAhB,EAAd;AACD;;;WACD,2BAA4B;AAC1B,aAAO;AACLC,QAAAA,UAAU,EAAE;AACVC,UAAAA,OAAO,EAAE;AACPC,YAAAA,IAAI,EAAE,QADC;AAEPC,YAAAA,OAAO,EAAE,CAFF;AAGPC,YAAAA,OAAO,EAAE;AAHF;AADC;AADP,OAAP;AASD;;;WAED,wBAAwC;AACtC,aAAO,MAAP;AACD;;;EAxBoCC,mB","sourcesContent":["import BaseLayer from '../core/BaseLayer';\nimport { IMaskLayerStyleOptions } from '../core/interface';\nimport MaskModels, { MaskModelType } from './models';\n\nexport default class MaskLayer extends BaseLayer<IMaskLayerStyleOptions> {\n public type: string = 'MaskLayer';\n public buildModels() {\n const shape = this.getModelType();\n this.layerModel = new MaskModels[shape](this);\n this.models = this.layerModel.initModels();\n }\n public rebuildModels() {\n this.models = this.layerModel.buildModels();\n }\n protected getConfigSchema() {\n return {\n properties: {\n opacity: {\n type: 'number',\n minimum: 0,\n maximum: 1,\n },\n },\n };\n }\n\n protected getModelType(): MaskModelType {\n return 'fill';\n }\n}\n"],"file":"index.js"}
|
package/lib/mask/models/fill.js
CHANGED
|
@@ -7,10 +7,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
});
|
|
8
8
|
exports.default = void 0;
|
|
9
9
|
|
|
10
|
-
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
11
|
-
|
|
12
|
-
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
13
|
-
|
|
14
10
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
15
11
|
|
|
16
12
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
@@ -59,61 +55,37 @@ var MaskModel = function (_BaseModel) {
|
|
|
59
55
|
}
|
|
60
56
|
}, {
|
|
61
57
|
key: "initModels",
|
|
62
|
-
value: function initModels(
|
|
63
|
-
this.buildModels(
|
|
58
|
+
value: function initModels() {
|
|
59
|
+
return this.buildModels();
|
|
64
60
|
}
|
|
65
61
|
}, {
|
|
66
62
|
key: "buildModels",
|
|
67
|
-
value: function () {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
},
|
|
90
|
-
opFront: {
|
|
91
|
-
fail: _l7Core.gl.REPLACE,
|
|
92
|
-
zfail: _l7Core.gl.REPLACE,
|
|
93
|
-
zpass: _l7Core.gl.REPLACE
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
}).then(function (model) {
|
|
97
|
-
callbackModel([model]);
|
|
98
|
-
}).catch(function (err) {
|
|
99
|
-
console.warn(err);
|
|
100
|
-
callbackModel([]);
|
|
101
|
-
});
|
|
102
|
-
|
|
103
|
-
case 1:
|
|
104
|
-
case "end":
|
|
105
|
-
return _context.stop();
|
|
106
|
-
}
|
|
63
|
+
value: function buildModels() {
|
|
64
|
+
return [this.layer.buildLayerModel({
|
|
65
|
+
moduleName: 'mask',
|
|
66
|
+
vertexShader: mask_vert,
|
|
67
|
+
fragmentShader: mask_frag,
|
|
68
|
+
triangulation: _triangulation.polygonTriangulation,
|
|
69
|
+
blend: this.getBlend(),
|
|
70
|
+
depth: {
|
|
71
|
+
enable: false
|
|
72
|
+
},
|
|
73
|
+
stencil: {
|
|
74
|
+
enable: true,
|
|
75
|
+
mask: 0xff,
|
|
76
|
+
func: {
|
|
77
|
+
cmp: _l7Core.gl.ALWAYS,
|
|
78
|
+
ref: 1,
|
|
79
|
+
mask: 0xff
|
|
80
|
+
},
|
|
81
|
+
opFront: {
|
|
82
|
+
fail: _l7Core.gl.REPLACE,
|
|
83
|
+
zfail: _l7Core.gl.REPLACE,
|
|
84
|
+
zpass: _l7Core.gl.REPLACE
|
|
107
85
|
}
|
|
108
|
-
}
|
|
109
|
-
})
|
|
110
|
-
|
|
111
|
-
function buildModels(_x) {
|
|
112
|
-
return _buildModels.apply(this, arguments);
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
return buildModels;
|
|
116
|
-
}()
|
|
86
|
+
}
|
|
87
|
+
})];
|
|
88
|
+
}
|
|
117
89
|
}, {
|
|
118
90
|
key: "clearModels",
|
|
119
91
|
value: function clearModels() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/mask/models/fill.ts"],"names":["MaskModel","layer","getLayerConfig","opacity","u_opacity","
|
|
1
|
+
{"version":3,"sources":["../../../src/mask/models/fill.ts"],"names":["MaskModel","layer","getLayerConfig","opacity","u_opacity","buildModels","buildLayerModel","moduleName","vertexShader","mask_vert","fragmentShader","mask_frag","triangulation","polygonTriangulation","blend","getBlend","depth","enable","stencil","mask","func","cmp","gl","ALWAYS","ref","opFront","fail","REPLACE","zfail","zpass","dataTexture","destroy","layerService","clear","BaseModel"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;;AAEA;;AAEA;;;;;;;;;IAIqBA,S;;;;;;;;;;;;WACnB,wBAAsB;AACpB,iBAEI,KAAKC,KAAL,CAAWC,cAAX,EAFJ;AAAA,8BACEC,OADF;AAAA,UACEA,OADF,6BACY,CADZ;;AAGA,aAAO;AACLC,QAAAA,SAAS,EAAE,wBAASD,OAAT,IAAoBA,OAApB,GAA8B;AADpC,OAAP;AAGD;;;WAED,sBAA8B;AAC5B,aAAO,KAAKE,WAAL,EAAP;AACD;;;WAED,uBAA+B;AAC7B,aAAO,CACL,KAAKJ,KAAL,CAAWK,eAAX,CAA2B;AACzBC,QAAAA,UAAU,EAAE,MADa;AAEzBC,QAAAA,YAAY,EAAEC,SAFW;AAGzBC,QAAAA,cAAc,EAAEC,SAHS;AAIzBC,QAAAA,aAAa,EAAEC,mCAJU;AAKzBC,QAAAA,KAAK,EAAE,KAAKC,QAAL,EALkB;AAMzBC,QAAAA,KAAK,EAAE;AAAEC,UAAAA,MAAM,EAAE;AAAV,SANkB;AAQzBC,QAAAA,OAAO,EAAE;AACPD,UAAAA,MAAM,EAAE,IADD;AAEPE,UAAAA,IAAI,EAAE,IAFC;AAGPC,UAAAA,IAAI,EAAE;AACJC,YAAAA,GAAG,EAAEC,WAAGC,MADJ;AAEJC,YAAAA,GAAG,EAAE,CAFD;AAGJL,YAAAA,IAAI,EAAE;AAHF,WAHC;AAQPM,UAAAA,OAAO,EAAE;AACPC,YAAAA,IAAI,EAAEJ,WAAGK,OADF;AAEPC,YAAAA,KAAK,EAAEN,WAAGK,OAFH;AAGPE,YAAAA,KAAK,EAAEP,WAAGK;AAHH;AARF;AARgB,OAA3B,CADK,CAAP;AAyBD;;;WAED,uBAAqB;AAAA;;AACnB,gCAAKG,WAAL,wEAAkBC,OAAlB;AACA,WAAKC,YAAL,CAAkBC,KAAlB;AACD;;;WAED,qCAAsC;AACpC,aAAO,EAAP;AACD;;;EAjDoCC,mB","sourcesContent":["import { gl, IModel } from '@antv/l7-core';\nimport { isNumber } from 'lodash';\nimport BaseModel from '../../core/BaseModel';\nimport { IMaskLayerStyleOptions } from '../../core/interface';\nimport { polygonTriangulation } from '../../core/triangulation';\nimport mask_frag from '../shaders/mask_frag.glsl';\nimport mask_vert from '../shaders/mask_vert.glsl';\n\nexport default class MaskModel extends BaseModel {\n public getUninforms() {\n const {\n opacity = 0,\n } = this.layer.getLayerConfig() as IMaskLayerStyleOptions;\n return {\n u_opacity: isNumber(opacity) ? opacity : 0.0,\n };\n }\n\n public initModels(): IModel[] {\n return this.buildModels();\n }\n\n public buildModels(): IModel[] {\n return [\n this.layer.buildLayerModel({\n moduleName: 'mask',\n vertexShader: mask_vert,\n fragmentShader: mask_frag,\n triangulation: polygonTriangulation,\n blend: this.getBlend(),\n depth: { enable: false },\n\n stencil: {\n enable: true,\n mask: 0xff,\n func: {\n cmp: gl.ALWAYS,\n ref: 1,\n mask: 0xff,\n },\n opFront: {\n fail: gl.REPLACE,\n zfail: gl.REPLACE,\n zpass: gl.REPLACE,\n },\n },\n }),\n ];\n }\n\n public clearModels() {\n this.dataTexture?.destroy();\n this.layerService.clear();\n }\n\n protected registerBuiltinAttributes() {\n return '';\n }\n}\n"],"file":"fill.js"}
|