@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
package/lib/line/models/arc.js
CHANGED
|
@@ -36,7 +36,7 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
|
|
|
36
36
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
37
37
|
|
|
38
38
|
var arc_dash_frag = "\nuniform float u_opacity;\n\nvarying vec4 v_dash_array;\nvarying vec4 v_color;\n\nuniform float segmentNumber;\n\nvarying mat4 styleMappingMat; // \u4F20\u9012\u4ECE\u7247\u5143\u4E2D\u4F20\u9012\u7684\u6620\u5C04\u6570\u636E\n\n#pragma include \"picking\"\n\nvoid main() {\n float opacity = styleMappingMat[0][0];\n float d_distance_ratio = styleMappingMat[3].b; // \u5F53\u524D\u9876\u70B9\u5728\u5F27\u7EBF\u4E2D\u6240\u5904\u7684\u5206\u6BB5\u6BD4\u4F8B\n\n gl_FragColor = v_color;\n gl_FragColor.a *= opacity;\n\n float flag = 0.;\n float dashLength = mod(d_distance_ratio, v_dash_array.x + v_dash_array.y + v_dash_array.z + v_dash_array.w);\n if(dashLength < v_dash_array.x || (dashLength > (v_dash_array.x + v_dash_array.y) && dashLength < v_dash_array.x + v_dash_array.y + v_dash_array.z)) {\n flag = 1.;\n }\n gl_FragColor.a *=flag;\n \n gl_FragColor = filterColor(gl_FragColor);\n}";
|
|
39
|
-
var arc_dash_vert = "\nattribute vec4 a_Color;\nattribute vec3 a_Position;\nattribute vec4 a_Instance;\nattribute float a_Size;\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\nuniform float segmentNumber;\nvarying vec4 v_color;\n\n\nuniform vec4 u_dash_array: [10.0, 5., 0, 0];\nuniform float u_lineDir: 1.0;\nvarying vec4 v_dash_array;\n\nuniform float u_thetaOffset: 0.314;\n\nuniform float u_opacity: 1.0;\nvarying mat4 styleMappingMat; // \u7528\u4E8E\u5C06\u5728\u9876\u70B9\u7740\u8272\u5668\u4E2D\u8BA1\u7B97\u597D\u7684\u6837\u5F0F\u503C\u4F20\u9012\u7ED9\u7247\u5143\n\n#pragma include \"styleMapping\"\n#pragma include \"styleMappingCalOpacity\"\n#pragma include \"styleMappingCalThetaOffset\"\n\n#pragma include \"projection\"\n#pragma include \"project\"\n#pragma include \"picking\"\n\nfloat bezier3(vec3 arr, float t) {\n float ut = 1. - t;\n return (arr.x * ut + arr.y * t) * ut + (arr.y * ut + arr.z * t) * t;\n}\nvec2 midPoint(vec2 source, vec2 target, float arcThetaOffset) {\n vec2 center = target - source;\n float r = length(center);\n float theta = atan(center.y, center.x);\n float thetaOffset = arcThetaOffset;\n float r2 = r / 2.0 / cos(thetaOffset);\n float theta2 = theta + thetaOffset;\n vec2 mid = vec2(r2*cos(theta2) + source.x, r2*sin(theta2) + source.y);\n if(u_lineDir == 1.0) { // \u6B63\u5411\n return mid;\n } else { // \u9006\u5411\n // (mid + vmin)/2 = (s + t)/2\n vec2 vmid = source + target - mid;\n return vmid;\n }\n // return mid;\n}\nfloat getSegmentRatio(float index) {\n
|
|
39
|
+
var arc_dash_vert = "\nattribute vec4 a_Color;\nattribute vec3 a_Position;\nattribute vec4 a_Instance;\nattribute float a_Size;\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\nuniform float segmentNumber;\nvarying vec4 v_color;\n\n\nuniform vec4 u_dash_array: [10.0, 5., 0, 0];\nuniform float u_lineDir: 1.0;\nvarying vec4 v_dash_array;\n\nuniform float u_thetaOffset: 0.314;\n\nuniform float u_opacity: 1.0;\nvarying mat4 styleMappingMat; // \u7528\u4E8E\u5C06\u5728\u9876\u70B9\u7740\u8272\u5668\u4E2D\u8BA1\u7B97\u597D\u7684\u6837\u5F0F\u503C\u4F20\u9012\u7ED9\u7247\u5143\n\n#pragma include \"styleMapping\"\n#pragma include \"styleMappingCalOpacity\"\n#pragma include \"styleMappingCalThetaOffset\"\n\n#pragma include \"projection\"\n#pragma include \"project\"\n#pragma include \"picking\"\n\nfloat bezier3(vec3 arr, float t) {\n float ut = 1. - t;\n return (arr.x * ut + arr.y * t) * ut + (arr.y * ut + arr.z * t) * t;\n}\nvec2 midPoint(vec2 source, vec2 target, float arcThetaOffset) {\n vec2 center = target - source;\n float r = length(center);\n float theta = atan(center.y, center.x);\n float thetaOffset = arcThetaOffset;\n float r2 = r / 2.0 / cos(thetaOffset);\n float theta2 = theta + thetaOffset;\n vec2 mid = vec2(r2*cos(theta2) + source.x, r2*sin(theta2) + source.y);\n if(u_lineDir == 1.0) { // \u6B63\u5411\n return mid;\n } else { // \u9006\u5411\n // (mid + vmin)/2 = (s + t)/2\n vec2 vmid = source + target - mid;\n return vmid;\n }\n // return mid;\n}\nfloat getSegmentRatio(float index) {\n return index / (segmentNumber - 1.);\n}\nvec2 interpolate (vec2 source, vec2 target, float t, float arcThetaOffset) {\n // if the angularDist is PI, linear interpolation is applied. otherwise, use spherical interpolation\n vec2 mid = midPoint(source, target, arcThetaOffset);\n vec3 x = vec3(source.x, mid.x, target.x);\n vec3 y = vec3(source.y, mid.y, target.y);\n return vec2(bezier3(x ,t), bezier3(y,t));\n}\nvec2 getExtrusionOffset(vec2 line_clipspace, float offset_direction) {\n // normalized direction of the line\n vec2 dir_screenspace = normalize(line_clipspace);\n // rotate by 90 degrees\n dir_screenspace = vec2(-dir_screenspace.y, dir_screenspace.x);\n vec2 offset = dir_screenspace * offset_direction * setPickingSize(a_Size) / 2.0;\n return offset;\n}\nvec2 getNormal(vec2 line_clipspace, float offset_direction) {\n // normalized direction of the line\n vec2 dir_screenspace = normalize(line_clipspace);\n // rotate by 90 degrees\n dir_screenspace = vec2(-dir_screenspace.y, dir_screenspace.x);\n return reverse_offset_normal(vec3(dir_screenspace,1.0)).xy * sign(offset_direction);\n}\n\nvoid main() {\n v_color = a_Color;\n\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 // dataset \u6570\u636E\u96C6\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 -> thetaOffset... \n // \u6309\u987A\u5E8F\u4ECE cell \u4E2D\u53D6\u503C\u3001\u82E5\u6CA1\u6709\u5219\u81EA\u52A8\u5F80\u4E0B\u53D6\u503C\n float textureOffset = 0.0; // \u5728 cell \u4E2D\u53D6\u503C\u7684\u504F\u79FB\u91CF\n\n vec2 opacityAndOffset = calOpacityAndOffset(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset, columnWidth, rowHeight);\n styleMappingMat[0][0] = opacityAndOffset.r;\n textureOffset = opacityAndOffset.g;\n\n vec2 thetaOffsetAndOffset = calThetaOffsetAndOffset(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset, columnWidth, rowHeight);\n styleMappingMat[0][1] = thetaOffsetAndOffset.r;\n textureOffset = thetaOffsetAndOffset.g;\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n\n \n vec2 source = a_Instance.rg; // \u8D77\u59CB\u70B9\n vec2 target = a_Instance.ba; // \u7EC8\u70B9\n float segmentIndex = a_Position.x;\n float segmentRatio = getSegmentRatio(segmentIndex);\n\n float indexDir = mix(-1.0, 1.0, step(segmentIndex, 0.0));\n float nextSegmentRatio = getSegmentRatio(segmentIndex + indexDir);\n\n vec2 s = source;\n vec2 t = target;\n \n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n s = unProjCustomCoord(source);\n t = unProjCustomCoord(target);\n }\n float total_Distance = pixelDistance(s, t) / 2.0 * PI;\n v_dash_array = pow(2.0, 20.0 - u_Zoom) * u_dash_array / total_Distance;\n\n styleMappingMat[3].b = segmentIndex / segmentNumber;\n\n // styleMappingMat[0][1] - arcThetaOffset\n vec4 curr = project_position(vec4(interpolate(source, target, segmentRatio, styleMappingMat[0][1]), 0.0, 1.0));\n vec4 next = project_position(vec4(interpolate(source, target, nextSegmentRatio, styleMappingMat[0][1]), 0.0, 1.0));\n // v_normal = getNormal((next.xy - curr.xy) * indexDir, a_Position.y);\n //unProjCustomCoord\n \n vec2 offset = project_pixel(getExtrusionOffset((next.xy - curr.xy) * indexDir, a_Position.y));\n \n\n // gl_Position = project_common_position_to_clipspace(vec4(curr.xy + offset, 0, 1.0));\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n // gl_Position = u_Mvp * (vec4(curr.xy + offset, 0, 1.0));\n gl_Position = u_Mvp * (vec4(curr.xy + offset, 0, 1.0));\n } else {\n gl_Position = project_common_position_to_clipspace(vec4(curr.xy + offset, 0, 1.0));\n }\n gl_PointSize = 5.0;\n setPickingColor(a_PickingColor);\n}\n";
|
|
40
40
|
var arc_line_frag = "\n#define Animate 0.0\n#define LineTexture 1.0\n\nuniform float u_opacity;\nuniform float u_textureBlend;\nuniform float u_blur : 0.9;\nuniform float u_line_type: 0.0;\n// varying vec2 v_normal;\nvarying vec4 v_dash_array;\nvarying vec4 v_color;\n\nuniform float u_time;\nuniform vec4 u_aimate: [ 0, 2., 1.0, 0.2 ];\n\nuniform float u_line_texture;\nuniform sampler2D u_texture;\nuniform vec2 u_textSize;\n\nuniform float segmentNumber;\nvarying vec2 v_iconMapUV;\n\nvarying mat4 styleMappingMat; // \u4F20\u9012\u4ECE\u7247\u5143\u4E2D\u4F20\u9012\u7684\u6620\u5C04\u6570\u636E\n\n#pragma include \"picking\"\n\nvoid main() {\n float opacity = styleMappingMat[0][0];\n float animateSpeed = 0.0; // \u8FD0\u52A8\u901F\u5EA6\n float d_segmentIndex = styleMappingMat[3].r; // \u5F53\u524D\u9876\u70B9\u5728\u5F27\u7EBF\u4E2D\u6240\u5904\u7684\u5206\u6BB5\u4F4D\u7F6E\n float d_distance_ratio = styleMappingMat[3].b; // \u5F53\u524D\u9876\u70B9\u5728\u5F27\u7EBF\u4E2D\u6240\u5904\u7684\u5206\u6BB5\u6BD4\u4F8B\n\n gl_FragColor = v_color;\n \n gl_FragColor.a *= opacity;\n\n if(u_aimate.x == Animate && u_line_texture != LineTexture) {\n animateSpeed = u_time / u_aimate.y;\n float alpha =1.0 - fract( mod(1.0- d_distance_ratio, u_aimate.z)* (1.0/ u_aimate.z) + u_time / u_aimate.y);\n alpha = (alpha + u_aimate.w -1.0) / u_aimate.w;\n // alpha = smoothstep(0., 1., alpha);\n alpha = clamp(alpha, 0.0, 1.0);\n gl_FragColor.a *= alpha;\n }\n\n // \u5F53\u5B58\u5728\u8D34\u56FE\u65F6\u5728\u5E95\u8272\u4E0A\u8D34\u4E0A\u8D34\u56FE\n if(u_line_texture == LineTexture) { // while load texture\n float arcRadio = smoothstep( 0.0, 1.0, (d_segmentIndex / segmentNumber));\n // float arcRadio = smoothstep( 0.0, 1.0, d_distance_ratio);\n\n float count = styleMappingMat[3].g; // \u8D34\u56FE\u5728\u5F27\u7EBF\u4E0A\u91CD\u590D\u7684\u6570\u91CF\n\n float time = 0.0;\n if(u_aimate.x == Animate) {\n time = u_time / u_aimate.y;\n }\n float redioCount = arcRadio * count;\n\n float u = fract(redioCount - time);\n float v = styleMappingMat[3].a; // \u6A2A\u5411 v\n vec2 uv= v_iconMapUV / u_textSize + vec2(u, v) / u_textSize * 64.;\n\n vec4 pattern = texture2D(u_texture, uv);\n\n if(u_aimate.x == Animate) {\n float currentPlane = floor(redioCount - time);\n float textureStep = floor(count * u_aimate.z);\n float a = mod(currentPlane, textureStep);\n if(a < textureStep - 1.0) {\n pattern = vec4(0.0);\n }\n }\n\n if(u_textureBlend == 0.0) { // normal\n pattern.a = 0.0;\n gl_FragColor = filterColor(gl_FragColor + pattern);\n } else { // replace\n pattern.a *= opacity;\n if(gl_FragColor.a <= 0.0) {\n pattern.a = 0.0;\n }\n gl_FragColor = filterColor(pattern);\n }\n \n } else {\n gl_FragColor = filterColor(gl_FragColor);\n }\n // gl_FragColor = filterColor(gl_FragColor);\n}";
|
|
41
41
|
var arc_line_vert = "#define Animate 0.0\n#define LineTexture 1.0\n\nattribute vec4 a_Color;\nattribute vec3 a_Position;\nattribute vec4 a_Instance;\nattribute float a_Size;\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\nuniform float segmentNumber;\nuniform vec4 u_aimate: [ 0, 2., 1.0, 0.2 ];\nvarying vec4 v_color;\n\nuniform float u_lineDir: 1.0;\n\nuniform float u_thetaOffset: 0.314;\nuniform float u_icon_step: 100;\nuniform float u_line_texture: 0.0;\nattribute vec2 a_iconMapUV;\nvarying vec2 v_iconMapUV;\n\nuniform float u_opacity: 1.0;\nvarying mat4 styleMappingMat; // \u7528\u4E8E\u5C06\u5728\u9876\u70B9\u7740\u8272\u5668\u4E2D\u8BA1\u7B97\u597D\u7684\u6837\u5F0F\u503C\u4F20\u9012\u7ED9\u7247\u5143\n\n#pragma include \"styleMapping\"\n#pragma include \"styleMappingCalOpacity\"\n#pragma include \"styleMappingCalThetaOffset\"\n\n#pragma include \"projection\"\n#pragma include \"project\"\n#pragma include \"picking\"\n\nfloat bezier3(vec3 arr, float t) {\n float ut = 1. - t;\n return (arr.x * ut + arr.y * t) * ut + (arr.y * ut + arr.z * t) * t;\n}\nvec2 midPoint(vec2 source, vec2 target, float arcThetaOffset) {\n vec2 center = target - source;\n float r = length(center);\n float theta = atan(center.y, center.x);\n float thetaOffset = arcThetaOffset;\n float r2 = r / 2.0 / cos(thetaOffset);\n float theta2 = theta + thetaOffset;\n vec2 mid = vec2(r2*cos(theta2) + source.x, r2*sin(theta2) + source.y);\n if(u_lineDir == 1.0) { // \u6B63\u5411\n return mid;\n } else { // \u9006\u5411\n // (mid + vmin)/2 = (s + t)/2\n vec2 vmid = source + target - mid;\n return vmid;\n }\n // return mid;\n}\nfloat getSegmentRatio(float index) {\n return smoothstep(0.0, 1.0, index / (segmentNumber - 1.));\n}\nvec2 interpolate (vec2 source, vec2 target, float t, float arcThetaOffset) {\n // if the angularDist is PI, linear interpolation is applied. otherwise, use spherical interpolation\n vec2 mid = midPoint(source, target, arcThetaOffset);\n vec3 x = vec3(source.x, mid.x, target.x);\n vec3 y = vec3(source.y, mid.y, target.y);\n return vec2(bezier3(x ,t), bezier3(y,t));\n}\nvec2 getExtrusionOffset(vec2 line_clipspace, float offset_direction) {\n // normalized direction of the line\n vec2 dir_screenspace = normalize(line_clipspace);\n // rotate by 90 degrees\n dir_screenspace = vec2(-dir_screenspace.y, dir_screenspace.x);\n vec2 offset = dir_screenspace * offset_direction * setPickingSize(a_Size) / 2.0;\n return offset;\n}\nvec2 getNormal(vec2 line_clipspace, float offset_direction) {\n // normalized direction of the line\n vec2 dir_screenspace = normalize(line_clipspace);\n // rotate by 90 degrees\n dir_screenspace = vec2(-dir_screenspace.y, dir_screenspace.x);\n return reverse_offset_normal(vec3(dir_screenspace,1.0)).xy * sign(offset_direction);\n}\n\nvoid main() {\n v_color = a_Color;\n\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 // dataset \u6570\u636E\u96C6\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 -> thetaOffset... \n // \u6309\u987A\u5E8F\u4ECE cell \u4E2D\u53D6\u503C\u3001\u82E5\u6CA1\u6709\u5219\u81EA\u52A8\u5F80\u4E0B\u53D6\u503C\n float textureOffset = 0.0; // \u5728 cell \u4E2D\u53D6\u503C\u7684\u504F\u79FB\u91CF\n\n vec2 opacityAndOffset = calOpacityAndOffset(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset, columnWidth, rowHeight);\n styleMappingMat[0][0] = opacityAndOffset.r;\n textureOffset = opacityAndOffset.g;\n\n vec2 thetaOffsetAndOffset = calThetaOffsetAndOffset(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset, columnWidth, rowHeight);\n styleMappingMat[0][1] = thetaOffsetAndOffset.r;\n textureOffset = thetaOffsetAndOffset.g;\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n\n \n vec2 source = a_Instance.rg; // \u8D77\u59CB\u70B9\n vec2 target = a_Instance.ba; // \u7EC8\u70B9\n float segmentIndex = a_Position.x;\n float segmentRatio = getSegmentRatio(segmentIndex);\n\n float indexDir = mix(-1.0, 1.0, step(segmentIndex, 0.0));\n float nextSegmentRatio = getSegmentRatio(segmentIndex + indexDir);\n float d_distance_ratio;\n \n if(u_aimate.x == Animate) {\n d_distance_ratio = segmentIndex / segmentNumber;\n if(u_lineDir != 1.0) {\n d_distance_ratio = 1.0 - d_distance_ratio;\n }\n }\n\n styleMappingMat[3].b = d_distance_ratio;\n\n // styleMappingMat[0][1] - arcThetaOffset\n vec4 curr = project_position(vec4(interpolate(source, target, segmentRatio, styleMappingMat[0][1]), 0.0, 1.0));\n vec4 next = project_position(vec4(interpolate(source, target, nextSegmentRatio, styleMappingMat[0][1]), 0.0, 1.0));\n // v_normal = getNormal((next.xy - curr.xy) * indexDir, a_Position.y);\n //unProjCustomCoord\n \n vec2 offset = project_pixel(getExtrusionOffset((next.xy - curr.xy) * indexDir, a_Position.y));\n\n\n float d_segmentIndex = a_Position.x + 1.0; // \u5F53\u524D\u9876\u70B9\u5728\u5F27\u7EBF\u4E2D\u6240\u5904\u7684\u5206\u6BB5\u4F4D\u7F6E\n styleMappingMat[3].r = d_segmentIndex;\n\n if(LineTexture == u_line_texture) { // \u5F00\u542F\u8D34\u56FE\u6A21\u5F0F\n\n float arcDistrance = length(source - target); // \u8D77\u59CB\u70B9\u548C\u7EC8\u70B9\u7684\u8DDD\u79BB\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20) { // amap\n arcDistrance *= 1000000.0;\n }\n if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) { // mapbox\n // arcDistrance *= 8.0;\n arcDistrance = project_pixel_allmap(arcDistrance);\n }\n v_iconMapUV = a_iconMapUV;\n\n float pixelLen = project_pixel_texture(u_icon_step); // \u8D34\u56FE\u6CBF\u5F27\u7EBF\u65B9\u5411\u7684\u957F\u5EA6 - \u968F\u5730\u56FE\u7F29\u653E\u6539\u53D8\n float texCount = floor(arcDistrance/pixelLen); // \u8D34\u56FE\u5728\u5F27\u7EBF\u4E0A\u91CD\u590D\u7684\u6570\u91CF\n styleMappingMat[3].g = texCount;\n\n float lineOffsetWidth = length(offset + offset * sign(a_Position.y)); // \u7EBF\u6A2A\u5411\u504F\u79FB\u7684\u8DDD\u79BB\n float linePixelSize = project_pixel(a_Size); // \u5B9A\u70B9\u4F4D\u7F6E\u504F\u79FB\n styleMappingMat[3].a = lineOffsetWidth/linePixelSize; // \u7EBF\u56FE\u5C42\u8D34\u56FE\u90E8\u5206\u7684 v \u5750\u6807\u503C\n }\n \n\n // gl_Position = project_common_position_to_clipspace(vec4(curr.xy + offset, 0, 1.0));\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n // gl_Position = u_Mvp * (vec4(curr.xy + offset, 0, 1.0));\n gl_Position = u_Mvp * (vec4(curr.xy + offset, 0, 1.0));\n } else {\n gl_Position = project_common_position_to_clipspace(vec4(curr.xy + offset, 0, 1.0));\n }\n setPickingColor(a_PickingColor);\n}\n";
|
|
42
42
|
var arc_linear_frag = "#define Animate 0.0\n#define LineTexture 1.0\n\nuniform float u_opacity;\nuniform float u_textureBlend;\nuniform float u_blur : 0.9;\nuniform float u_line_type: 0.0;\n// varying vec2 v_normal;\nvarying vec4 v_dash_array;\nvarying vec4 v_color;\n\nuniform float u_time;\nuniform vec4 u_aimate: [ 0, 2., 1.0, 0.2 ];\n\nuniform float u_line_texture;\nuniform sampler2D u_texture;\nuniform vec2 u_textSize;\n\nuniform float segmentNumber;\nvarying vec2 v_iconMapUV;\n\nvarying mat4 styleMappingMat; // \u4F20\u9012\u4ECE\u7247\u5143\u4E2D\u4F20\u9012\u7684\u6620\u5C04\u6570\u636E\n\nuniform float u_linearColor: 0;\nuniform vec4 u_sourceColor;\nuniform vec4 u_targetColor;\n\n#pragma include \"picking\"\n\nvoid main() {\n float opacity = styleMappingMat[0][0];\n float d_segmentIndex = styleMappingMat[3].r; // \u5F53\u524D\u9876\u70B9\u5728\u5F27\u7EBF\u4E2D\u6240\u5904\u7684\u5206\u6BB5\u4F4D\u7F6E\n\n // \u8BBE\u7F6E\u5F27\u7EBF\u7684\u5E95\u8272\n gl_FragColor = mix(u_sourceColor, u_targetColor, d_segmentIndex/segmentNumber);\n gl_FragColor.a *= opacity;\n gl_FragColor = filterColor(gl_FragColor);\n}";
|
|
@@ -196,10 +196,10 @@ var ArcModel = function (_BaseModel) {
|
|
|
196
196
|
}
|
|
197
197
|
}, {
|
|
198
198
|
key: "initModels",
|
|
199
|
-
value: function initModels(
|
|
199
|
+
value: function initModels() {
|
|
200
200
|
this.updateTexture();
|
|
201
201
|
this.iconService.on('imageUpdate', this.updateTexture);
|
|
202
|
-
this.buildModels(
|
|
202
|
+
return this.buildModels();
|
|
203
203
|
}
|
|
204
204
|
}, {
|
|
205
205
|
key: "clearModels",
|
|
@@ -222,7 +222,7 @@ var ArcModel = function (_BaseModel) {
|
|
|
222
222
|
return {
|
|
223
223
|
frag: arc_dash_frag,
|
|
224
224
|
vert: arc_dash_vert,
|
|
225
|
-
type: '
|
|
225
|
+
type: 'dash'
|
|
226
226
|
};
|
|
227
227
|
}
|
|
228
228
|
|
|
@@ -230,19 +230,19 @@ var ArcModel = function (_BaseModel) {
|
|
|
230
230
|
return {
|
|
231
231
|
frag: arc_linear_frag,
|
|
232
232
|
vert: arc_linear_vert,
|
|
233
|
-
type: '
|
|
233
|
+
type: 'linear'
|
|
234
234
|
};
|
|
235
235
|
} else {
|
|
236
236
|
return {
|
|
237
237
|
frag: arc_line_frag,
|
|
238
238
|
vert: arc_line_vert,
|
|
239
|
-
type: ''
|
|
239
|
+
type: 'normal'
|
|
240
240
|
};
|
|
241
241
|
}
|
|
242
242
|
}
|
|
243
243
|
}, {
|
|
244
244
|
key: "buildModels",
|
|
245
|
-
value: function buildModels(
|
|
245
|
+
value: function buildModels() {
|
|
246
246
|
var _ref4 = this.layer.getLayerConfig(),
|
|
247
247
|
_ref4$segmentNumber = _ref4.segmentNumber,
|
|
248
248
|
segmentNumber = _ref4$segmentNumber === void 0 ? 30 : _ref4$segmentNumber,
|
|
@@ -256,8 +256,8 @@ var ArcModel = function (_BaseModel) {
|
|
|
256
256
|
vert = _this$getShaders.vert,
|
|
257
257
|
type = _this$getShaders.type;
|
|
258
258
|
|
|
259
|
-
this.layer.buildLayerModel({
|
|
260
|
-
moduleName: '
|
|
259
|
+
return [this.layer.buildLayerModel({
|
|
260
|
+
moduleName: 'arc2dline' + type,
|
|
261
261
|
vertexShader: vert,
|
|
262
262
|
fragmentShader: frag,
|
|
263
263
|
triangulation: _triangulation.LineArcTriangulation,
|
|
@@ -267,12 +267,7 @@ var ArcModel = function (_BaseModel) {
|
|
|
267
267
|
blend: this.getBlend(),
|
|
268
268
|
segmentNumber: segmentNumber,
|
|
269
269
|
stencil: (0, _l7Utils.getMask)(mask, maskInside)
|
|
270
|
-
})
|
|
271
|
-
callbackModel([model]);
|
|
272
|
-
}).catch(function (err) {
|
|
273
|
-
console.warn(err);
|
|
274
|
-
callbackModel([]);
|
|
275
|
-
});
|
|
270
|
+
})];
|
|
276
271
|
}
|
|
277
272
|
}, {
|
|
278
273
|
key: "registerBuiltinAttributes",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/line/models/arc.ts"],"names":["lineStyleObj","solid","dash","ArcModel","createTexture2D","rendererService","texture","update","data","iconService","getCanvas","layer","render","mag","gl","NEAREST","min","premultiplyAlpha","width","height","canvasHeight","getLayerConfig","opacity","sourceColor","targetColor","textureBlend","lineType","dashArray","forward","lineTexture","iconStep","segmentNumber","thetaOffset","dataTextureTest","dataTextureNeedUpdate","judgeStyleAttributes","encodeData","getEncodedData","calDataFrame","cellLength","cellProperties","rowCount","dataTexture","length","flipY","format","LUMINANCE","type","FLOAT","push","useLinearColor","sourceColorArr","targetColorArr","getDirty","bind","u_dataTexture","u_cellTypeLayout","getCellTypeLayout","u_thetaOffset","u_opacity","u_textureBlend","u_line_type","u_dash_array","u_blur","u_lineDir","u_texture","u_line_texture","u_icon_step","u_textSize","u_linearColor","u_sourceColor","u_targetColor","animateOption","u_aimate","animateOption2Array","u_time","getLayerAnimateTime","callbackModel","updateTexture","on","buildModels","destroy","off","frag","arc_dash_frag","vert","arc_dash_vert","arc_linear_frag","arc_linear_vert","arc_line_frag","arc_line_vert","mask","maskInside","getShaders","buildLayerModel","moduleName","vertexShader","fragmentShader","triangulation","LineArcTriangulation","depth","enable","blend","getBlend","stencil","then","model","catch","err","console","warn","styleAttributeService","registerStyleAttribute","name","AttributeType","Attribute","descriptor","buffer","usage","DYNAMIC_DRAW","size","feature","featureIdx","vertex","attributeIdx","Array","isArray","STATIC_DRAW","iconMap","getIconMap","x","y","BaseModel"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AAUA;;AAEA;;AAEA;;;;;;;;;;;;AAUA,IAAMA,YAAuC,GAAG;AAC9CC,EAAAA,KAAK,EAAE,GADuC;AAE9CC,EAAAA,IAAI,EAAE;AAFwC,CAAhD;;IAIqBC,Q;;;;;;;;;;;;;;;;gGAwPK,YAAM;AAC5B,UAAQC,eAAR,GAA4B,MAAKC,eAAjC,CAAQD,eAAR;;AACA,UAAI,MAAKE,OAAT,EAAkB;AAChB,cAAKA,OAAL,CAAaC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EhDlE,QAAAA,IAAI,EAAEmE,sBAAcC,SAF4B;AAGhDC,QAAAA,UAAU,EAAE;AACVH,UAAAA,IAAI,EAAE,aADI;AAEVI,UAAAA,MAAM,EAAE;AAENC,YAAAA,KAAK,EAAExG,WAAGyG,YAFJ;AAGN/G,YAAAA,IAAI,EAAE,EAHA;AAINuC,YAAAA,IAAI,EAAEjC,WAAGkC;AAJH,WAFE;AAQVwE,UAAAA,IAAI,EAAE,CARI;AASVjH,UAAAA,MAAM,EAAE,gBACNkH,OADM,EAENC,UAFM,EAGNC,MAHM,EAINC,YAJM,EAKH;AACH,gBAAMI,OAAO,GAAG,MAAI,CAACvH,WAAL,CAAiBwH,UAAjB,EAAhB;;AACA,gBAAQ3H,OAAR,GAAoBmH,OAApB,CAAQnH,OAAR;;AACA,wBAAiB0H,OAAO,CAAC1H,OAAD,CAAP,IAA8B;AAAE4H,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;;;EAtPmCC,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 { getMask, rgb2arr } from '@antv/l7-utils';\nimport { isNumber } from 'lodash';\nimport BaseModel from '../../core/BaseModel';\nimport { ILineLayerStyleOptions } from '../../core/interface';\nimport { LineArcTriangulation } from '../../core/triangulation';\n// arc dash line\nimport arc_dash_frag from '../shaders/dash/arc_dash_frag.glsl';\nimport arc_dash_vert from '../shaders/dash/arc_dash_vert.glsl';\n// arc normal line\nimport arc_line_frag from '../shaders/line_arc_frag.glsl';\nimport arc_line_vert from '../shaders/line_arc_vert.glsl';\n// arc linear line\nimport arc_linear_frag from '../shaders/linear/arc_linear_frag.glsl';\nimport arc_linear_vert from '../shaders/linear/arc_linear_vert.glsl';\nconst lineStyleObj: { [key: string]: number } = {\n solid: 0.0,\n dash: 1.0,\n};\nexport default class ArcModel 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],\n forward = true,\n lineTexture = false,\n iconStep = 100,\n segmentNumber = 30,\n thetaOffset = 0.314,\n } = this.layer.getLayerConfig() as ILineLayerStyleOptions;\n\n if (\n this.dataTextureTest &&\n this.dataTextureNeedUpdate({ opacity, thetaOffset })\n ) {\n this.judgeStyleAttributes({ opacity, thetaOffset });\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 if (dashArray.length === 2) {\n dashArray.push(0, 0);\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.rendererService.getDirty()) {\n this.texture.bind();\n }\n\n return {\n u_dataTexture: this.dataTexture, // 数据纹理 - 有数据映射的时候纹理中带数据,若没有任何数据映射时纹理是 [1]\n u_cellTypeLayout: this.getCellTypeLayout(),\n\n u_thetaOffset: isNumber(thetaOffset) ? thetaOffset : 0.0,\n u_opacity: isNumber(opacity) ? opacity : 1.0,\n u_textureBlend: textureBlend === 'normal' ? 0.0 : 1.0,\n segmentNumber,\n u_line_type: lineStyleObj[lineType || 'solid'],\n u_dash_array: dashArray,\n u_blur: 0.9,\n u_lineDir: forward ? 1 : -1,\n\n // 纹理支持参数\n u_texture: this.texture, // 贴图\n u_line_texture: lineTexture ? 1.0 : 0.0, // 传入线的标识\n u_icon_step: iconStep,\n u_textSize: [1024, this.iconService.canvasHeight || 128],\n\n // 渐变色支持参数\n u_linearColor: useLinearColor,\n u_sourceColor: sourceColorArr,\n u_targetColor: targetColorArr,\n };\n }\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 getShaders(): { frag: string; vert: string; type: string } {\n const {\n sourceColor,\n targetColor,\n lineType,\n } = this.layer.getLayerConfig() as ILineLayerStyleOptions;\n if (lineType === 'dash') {\n return {\n frag: arc_dash_frag,\n vert: arc_dash_vert,\n type: 'Dash',\n };\n }\n\n if (sourceColor && targetColor) {\n // 分离 linear 功能\n return {\n frag: arc_linear_frag,\n vert: arc_linear_vert,\n type: 'Linear',\n };\n } else {\n return {\n frag: arc_line_frag,\n vert: arc_line_vert,\n type: '',\n };\n }\n }\n\n public buildModels(callbackModel: (models: IModel[]) => void) {\n const {\n segmentNumber = 30,\n mask = false,\n maskInside = true,\n } = this.layer.getLayerConfig() as ILineLayerStyleOptions;\n const { frag, vert, type } = this.getShaders();\n\n this.layer\n .buildLayerModel({\n moduleName: 'lineArc2d' + type,\n vertexShader: vert,\n fragmentShader: frag,\n triangulation: LineArcTriangulation,\n depth: { enable: false },\n blend: this.getBlend(),\n segmentNumber,\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 // point layer size;\n this.styleAttributeService.registerStyleAttribute({\n name: 'size',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_Size',\n buffer: {\n // give the WebGL driver a hint that this buffer may change\n usage: gl.DYNAMIC_DRAW,\n data: [],\n type: gl.FLOAT,\n },\n size: 1,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n ) => {\n const { size = 1 } = feature;\n return Array.isArray(size) ? [size[0]] : [size as number];\n },\n },\n });\n\n this.styleAttributeService.registerStyleAttribute({\n name: 'instance', // 弧线起始点信息\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_Instance',\n buffer: {\n usage: gl.STATIC_DRAW,\n data: [],\n type: gl.FLOAT,\n },\n size: 4,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n ) => {\n return [vertex[3], vertex[4], vertex[5], vertex[6]];\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":"arc.js"}
|
|
1
|
+
{"version":3,"sources":["../../../src/line/models/arc.ts"],"names":["lineStyleObj","solid","dash","ArcModel","createTexture2D","rendererService","texture","update","data","iconService","getCanvas","layer","render","mag","gl","NEAREST","min","premultiplyAlpha","width","height","canvasHeight","getLayerConfig","opacity","sourceColor","targetColor","textureBlend","lineType","dashArray","forward","lineTexture","iconStep","segmentNumber","thetaOffset","dataTextureTest","dataTextureNeedUpdate","judgeStyleAttributes","encodeData","getEncodedData","calDataFrame","cellLength","cellProperties","rowCount","dataTexture","length","flipY","format","LUMINANCE","type","FLOAT","push","useLinearColor","sourceColorArr","targetColorArr","getDirty","bind","u_dataTexture","u_cellTypeLayout","getCellTypeLayout","u_thetaOffset","u_opacity","u_textureBlend","u_line_type","u_dash_array","u_blur","u_lineDir","u_texture","u_line_texture","u_icon_step","u_textSize","u_linearColor","u_sourceColor","u_targetColor","animateOption","u_aimate","animateOption2Array","u_time","getLayerAnimateTime","updateTexture","on","buildModels","destroy","off","frag","arc_dash_frag","vert","arc_dash_vert","arc_linear_frag","arc_linear_vert","arc_line_frag","arc_line_vert","mask","maskInside","getShaders","buildLayerModel","moduleName","vertexShader","fragmentShader","triangulation","LineArcTriangulation","depth","enable","blend","getBlend","stencil","styleAttributeService","registerStyleAttribute","name","AttributeType","Attribute","descriptor","buffer","usage","DYNAMIC_DRAW","size","feature","featureIdx","vertex","attributeIdx","Array","isArray","STATIC_DRAW","iconMap","getIconMap","x","y","BaseModel"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AAUA;;AAEA;;AAEA;;;;;;;;;;;;AAUA,IAAMA,YAAuC,GAAG;AAC9CC,EAAAA,KAAK,EAAE,GADuC;AAE9CC,EAAAA,IAAI,EAAE;AAFwC,CAAhD;;IAIqBC,Q;;;;;;;;;;;;;;;;gGAmPK,YAAM;AAC5B,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AE;AAENC,YAAAA,KAAK,EAAEjG,WAAGkG,YAFJ;AAGNxG,YAAAA,IAAI,EAAE,EAHA;AAINuC,YAAAA,IAAI,EAAEjC,WAAGkC;AAJH,WAFE;AAQViE,UAAAA,IAAI,EAAE,CARI;AASV1G,UAAAA,MAAM,EAAE,gBACN2G,OADM,EAENC,UAFM,EAGNC,MAHM,EAINC,YAJM,EAKH;AACH,gBAAMI,OAAO,GAAG,MAAI,CAAChH,WAAL,CAAiBiH,UAAjB,EAAhB;;AACA,gBAAQpH,OAAR,GAAoB4G,OAApB,CAAQ5G,OAAR;;AACA,wBAAiBmH,OAAO,CAACnH,OAAD,CAAP,IAA8B;AAAEqH,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;;;EAjPmCC,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 { getMask, rgb2arr } from '@antv/l7-utils';\nimport { isNumber } from 'lodash';\nimport BaseModel from '../../core/BaseModel';\nimport { ILineLayerStyleOptions } from '../../core/interface';\nimport { LineArcTriangulation } from '../../core/triangulation';\n// arc dash line\nimport arc_dash_frag from '../shaders/dash/arc_dash_frag.glsl';\nimport arc_dash_vert from '../shaders/dash/arc_dash_vert.glsl';\n// arc normal line\nimport arc_line_frag from '../shaders/line_arc_frag.glsl';\nimport arc_line_vert from '../shaders/line_arc_vert.glsl';\n// arc linear line\nimport arc_linear_frag from '../shaders/linear/arc_linear_frag.glsl';\nimport arc_linear_vert from '../shaders/linear/arc_linear_vert.glsl';\nconst lineStyleObj: { [key: string]: number } = {\n solid: 0.0,\n dash: 1.0,\n};\nexport default class ArcModel 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],\n forward = true,\n lineTexture = false,\n iconStep = 100,\n segmentNumber = 30,\n thetaOffset = 0.314,\n } = this.layer.getLayerConfig() as ILineLayerStyleOptions;\n\n if (\n this.dataTextureTest &&\n this.dataTextureNeedUpdate({ opacity, thetaOffset })\n ) {\n this.judgeStyleAttributes({ opacity, thetaOffset });\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 if (dashArray.length === 2) {\n dashArray.push(0, 0);\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.rendererService.getDirty()) {\n this.texture.bind();\n }\n\n return {\n u_dataTexture: this.dataTexture, // 数据纹理 - 有数据映射的时候纹理中带数据,若没有任何数据映射时纹理是 [1]\n u_cellTypeLayout: this.getCellTypeLayout(),\n\n u_thetaOffset: isNumber(thetaOffset) ? thetaOffset : 0.0,\n // u_thetaOffset: 0.0,\n u_opacity: isNumber(opacity) ? opacity : 1.0,\n u_textureBlend: textureBlend === 'normal' ? 0.0 : 1.0,\n segmentNumber,\n u_line_type: lineStyleObj[lineType || 'solid'],\n u_dash_array: dashArray,\n u_blur: 0.9,\n u_lineDir: forward ? 1 : -1,\n\n // 纹理支持参数\n u_texture: this.texture, // 贴图\n u_line_texture: lineTexture ? 1.0 : 0.0, // 传入线的标识\n u_icon_step: iconStep,\n u_textSize: [1024, this.iconService.canvasHeight || 128],\n\n // 渐变色支持参数\n u_linearColor: useLinearColor,\n u_sourceColor: sourceColorArr,\n u_targetColor: targetColorArr,\n };\n }\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 getShaders(): { frag: string; vert: string; type: string } {\n const {\n sourceColor,\n targetColor,\n lineType,\n } = this.layer.getLayerConfig() as ILineLayerStyleOptions;\n if (lineType === 'dash') {\n return {\n frag: arc_dash_frag,\n vert: arc_dash_vert,\n type: 'dash',\n };\n }\n\n if (sourceColor && targetColor) {\n // 分离 linear 功能\n return {\n frag: arc_linear_frag,\n vert: arc_linear_vert,\n type: 'linear',\n };\n } else {\n return {\n frag: arc_line_frag,\n vert: arc_line_vert,\n type: 'normal',\n };\n }\n }\n\n public buildModels(): IModel[] {\n const {\n segmentNumber = 30,\n mask = false,\n maskInside = true,\n } = this.layer.getLayerConfig() as ILineLayerStyleOptions;\n const { frag, vert, type } = this.getShaders();\n return [\n this.layer.buildLayerModel({\n // primitive: gl.POINTS,\n moduleName: 'arc2dline' + type,\n vertexShader: vert,\n fragmentShader: frag,\n triangulation: LineArcTriangulation,\n depth: { enable: false },\n blend: this.getBlend(),\n segmentNumber,\n stencil: getMask(mask, maskInside),\n }),\n ];\n }\n\n protected registerBuiltinAttributes() {\n // point layer size;\n this.styleAttributeService.registerStyleAttribute({\n name: 'size',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_Size',\n buffer: {\n // give the WebGL driver a hint that this buffer may change\n usage: gl.DYNAMIC_DRAW,\n data: [],\n type: gl.FLOAT,\n },\n size: 1,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n ) => {\n const { size = 1 } = feature;\n return Array.isArray(size) ? [size[0]] : [size as number];\n },\n },\n });\n\n this.styleAttributeService.registerStyleAttribute({\n name: 'instance', // 弧线起始点信息\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_Instance',\n buffer: {\n usage: gl.STATIC_DRAW,\n data: [],\n type: gl.FLOAT,\n },\n size: 4,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n ) => {\n return [vertex[3], vertex[4], vertex[5], vertex[6]];\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":"arc.js"}
|
|
@@ -192,10 +192,10 @@ var Arc3DModel = function (_BaseModel) {
|
|
|
192
192
|
}
|
|
193
193
|
}, {
|
|
194
194
|
key: "initModels",
|
|
195
|
-
value: function initModels(
|
|
195
|
+
value: function initModels() {
|
|
196
196
|
this.updateTexture();
|
|
197
197
|
this.iconService.on('imageUpdate', this.updateTexture);
|
|
198
|
-
this.buildModels(
|
|
198
|
+
return this.buildModels();
|
|
199
199
|
}
|
|
200
200
|
}, {
|
|
201
201
|
key: "clearModels",
|
|
@@ -217,19 +217,19 @@ var Arc3DModel = function (_BaseModel) {
|
|
|
217
217
|
return {
|
|
218
218
|
frag: arc3d_linear_frag,
|
|
219
219
|
vert: arc3d_linear_vert,
|
|
220
|
-
type: '
|
|
220
|
+
type: 'linear'
|
|
221
221
|
};
|
|
222
222
|
} else {
|
|
223
223
|
return {
|
|
224
224
|
frag: arc3d_line_frag,
|
|
225
225
|
vert: arc3d_line_vert,
|
|
226
|
-
type: ''
|
|
226
|
+
type: 'normal'
|
|
227
227
|
};
|
|
228
228
|
}
|
|
229
229
|
}
|
|
230
230
|
}, {
|
|
231
231
|
key: "buildModels",
|
|
232
|
-
value: function buildModels(
|
|
232
|
+
value: function buildModels() {
|
|
233
233
|
var _ref4 = this.layer.getLayerConfig(),
|
|
234
234
|
_ref4$segmentNumber = _ref4.segmentNumber,
|
|
235
235
|
segmentNumber = _ref4$segmentNumber === void 0 ? 30 : _ref4$segmentNumber,
|
|
@@ -243,20 +243,15 @@ var Arc3DModel = function (_BaseModel) {
|
|
|
243
243
|
vert = _this$getShaders.vert,
|
|
244
244
|
type = _this$getShaders.type;
|
|
245
245
|
|
|
246
|
-
this.layer.buildLayerModel({
|
|
247
|
-
moduleName: '
|
|
246
|
+
return [this.layer.buildLayerModel({
|
|
247
|
+
moduleName: 'arc3Dline' + type,
|
|
248
248
|
vertexShader: vert,
|
|
249
249
|
fragmentShader: frag,
|
|
250
250
|
triangulation: _triangulation.LineArcTriangulation,
|
|
251
251
|
blend: this.getBlend(),
|
|
252
252
|
segmentNumber: segmentNumber,
|
|
253
253
|
stencil: (0, _l7Utils.getMask)(mask, maskInside)
|
|
254
|
-
})
|
|
255
|
-
callbackModel([model]);
|
|
256
|
-
}).catch(function (err) {
|
|
257
|
-
console.warn(err);
|
|
258
|
-
callbackModel([]);
|
|
259
|
-
});
|
|
254
|
+
})];
|
|
260
255
|
}
|
|
261
256
|
}, {
|
|
262
257
|
key: "registerBuiltinAttributes",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/line/models/arc_3d.ts"],"names":["lineStyleObj","solid","dash","Arc3DModel","createTexture2D","rendererService","texture","update","data","iconService","getCanvas","layer","render","mag","gl","NEAREST","min","premultiplyAlpha","width","height","canvasHeight","getLayerConfig","opacity","sourceColor","targetColor","textureBlend","lineType","dashArray","lineTexture","iconStep","segmentNumber","globalArcHeight","length","push","useLinearColor","sourceColorArr","targetColorArr","getDirty","bind","dataTextureTest","dataTextureNeedUpdate","judgeStyleAttributes","encodeData","getEncodedData","calDataFrame","cellLength","cellProperties","rowCount","dataTexture","flipY","format","LUMINANCE","type","FLOAT","u_globel","mapService","version","u_globel_radius","EARTH_RADIUS","u_global_height","u_dataTexture","u_cellTypeLayout","getCellTypeLayout","u_opacity","u_textureBlend","u_line_type","u_dash_array","u_texture","u_line_texture","u_icon_step","u_textSize","u_linearColor","u_sourceColor","u_targetColor","animateOption","u_aimate","animateOption2Array","u_time","getLayerAnimateTime","callbackModel","updateTexture","on","buildModels","destroy","off","frag","arc3d_linear_frag","vert","arc3d_linear_vert","arc3d_line_frag","arc3d_line_vert","mask","maskInside","getShaders","buildLayerModel","moduleName","vertexShader","fragmentShader","triangulation","LineArcTriangulation","blend","getBlend","stencil","then","model","catch","err","console","warn","styleAttributeService","registerStyleAttribute","name","AttributeType","Attribute","descriptor","buffer","usage","DYNAMIC_DRAW","size","feature","featureIdx","vertex","attributeIdx","Array","isArray","STATIC_DRAW","iconMap","getIconMap","x","y","BaseModel"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AAUA;;AAEA;;AAEA;;AACA;;;;;;;;;;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,EAAE;AAENC,YAAAA,KAAK,EAAEtG,WAAGuG,YAFJ;AAGN7G,YAAAA,IAAI,EAAE,EAHA;AAIN4C,YAAAA,IAAI,EAAEtC,WAAGuC;AAJH,WAFE;AAQViE,UAAAA,IAAI,EAAE,CARI;AASV/G,UAAAA,MAAM,EAAE,gBACNgH,OADM,EAENC,UAFM,EAGNC,MAHM,EAINC,YAJM,EAKH;AACH,gBAAMI,OAAO,GAAG,MAAI,CAACrH,WAAL,CAAiBsH,UAAjB,EAAhB;;AACA,gBAAQzH,OAAR,GAAoBiH,OAApB,CAAQjH,OAAR;;AACA,wBAAiBwH,OAAO,CAACxH,OAAD,CAAP,IAA8B;AAAE0H,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;;;EAxOqCC,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 { getMask, rgb2arr } from '@antv/l7-utils';\nimport { isNumber } from 'lodash';\nimport BaseModel from '../../core/BaseModel';\nimport { ILineLayerStyleOptions } from '../../core/interface';\nimport { LineArcTriangulation } from '../../core/triangulation';\nimport { EARTH_RADIUS } from '../../earth/utils';\n// arc3d line layer\nimport arc3d_line_frag from '../shaders/line_arc_3d_frag.glsl';\nimport arc3d_line_vert from '../shaders/line_arc_3d_vert.glsl';\n// arc3d linear layer\nimport arc3d_linear_frag from '../shaders/linear/arc3d_linear_frag.glsl';\nimport arc3d_linear_vert from '../shaders/linear/arc3d_linear_vert.glsl';\n\nconst lineStyleObj: { [key: string]: number } = {\n solid: 0.0,\n dash: 1.0,\n};\nexport default class Arc3DModel 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],\n lineTexture = false,\n iconStep = 100,\n segmentNumber = 30,\n globalArcHeight = 10,\n } = this.layer.getLayerConfig() as ILineLayerStyleOptions;\n\n if (dashArray.length === 2) {\n dashArray.push(0, 0);\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.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\n return {\n u_globel: this.mapService.version === 'GLOBEL' ? 1 : 0,\n u_globel_radius: EARTH_RADIUS, // 地球半径\n u_global_height: globalArcHeight,\n\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 segmentNumber,\n u_line_type: lineStyleObj[lineType as string] || 0.0,\n u_dash_array: dashArray,\n\n // 纹理支持参数\n u_texture: this.texture, // 贴图\n u_line_texture: lineTexture ? 1.0 : 0.0, // 传入线的标识\n u_icon_step: iconStep,\n u_textSize: [1024, this.iconService.canvasHeight || 128],\n\n // 渐变色支持参数\n u_linearColor: useLinearColor,\n u_sourceColor: sourceColorArr,\n u_targetColor: targetColorArr,\n };\n }\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 getShaders(): { frag: string; vert: string; type: string } {\n const {\n sourceColor,\n targetColor,\n } = this.layer.getLayerConfig() as ILineLayerStyleOptions;\n\n if (sourceColor && targetColor) {\n // 分离 linear 功能\n return {\n frag: arc3d_linear_frag,\n vert: arc3d_linear_vert,\n type: 'Linear',\n };\n } else {\n return {\n frag: arc3d_line_frag,\n vert: arc3d_line_vert,\n type: '',\n };\n }\n }\n\n public buildModels(callbackModel: (models: IModel[]) => void) {\n const {\n segmentNumber = 30,\n mask = false,\n maskInside = true,\n } = this.layer.getLayerConfig() as ILineLayerStyleOptions;\n const { frag, vert, type } = this.getShaders();\n\n this.layer\n .buildLayerModel({\n moduleName: 'lineArc3d' + type,\n vertexShader: vert,\n fragmentShader: frag,\n triangulation: LineArcTriangulation,\n blend: this.getBlend(),\n segmentNumber,\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 // point layer size;\n this.styleAttributeService.registerStyleAttribute({\n name: 'size',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_Size',\n buffer: {\n // give the WebGL driver a hint that this buffer may change\n usage: gl.DYNAMIC_DRAW,\n data: [],\n type: gl.FLOAT,\n },\n size: 1,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n ) => {\n const { size = 1 } = feature;\n return Array.isArray(size) ? [size[0]] : [size as number];\n },\n },\n });\n\n this.styleAttributeService.registerStyleAttribute({\n name: 'instance', // 弧线起始点信息\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_Instance',\n buffer: {\n usage: gl.STATIC_DRAW,\n data: [],\n type: gl.FLOAT,\n },\n size: 4,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n ) => {\n return [vertex[3], vertex[4], vertex[5], vertex[6]];\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":"arc_3d.js"}
|
|
1
|
+
{"version":3,"sources":["../../../src/line/models/arc_3d.ts"],"names":["lineStyleObj","solid","dash","Arc3DModel","createTexture2D","rendererService","texture","update","data","iconService","getCanvas","layer","render","mag","gl","NEAREST","min","premultiplyAlpha","width","height","canvasHeight","getLayerConfig","opacity","sourceColor","targetColor","textureBlend","lineType","dashArray","lineTexture","iconStep","segmentNumber","globalArcHeight","length","push","useLinearColor","sourceColorArr","targetColorArr","getDirty","bind","dataTextureTest","dataTextureNeedUpdate","judgeStyleAttributes","encodeData","getEncodedData","calDataFrame","cellLength","cellProperties","rowCount","dataTexture","flipY","format","LUMINANCE","type","FLOAT","u_globel","mapService","version","u_globel_radius","EARTH_RADIUS","u_global_height","u_dataTexture","u_cellTypeLayout","getCellTypeLayout","u_opacity","u_textureBlend","u_line_type","u_dash_array","u_texture","u_line_texture","u_icon_step","u_textSize","u_linearColor","u_sourceColor","u_targetColor","animateOption","u_aimate","animateOption2Array","u_time","getLayerAnimateTime","updateTexture","on","buildModels","destroy","off","frag","arc3d_linear_frag","vert","arc3d_linear_vert","arc3d_line_frag","arc3d_line_vert","mask","maskInside","getShaders","buildLayerModel","moduleName","vertexShader","fragmentShader","triangulation","LineArcTriangulation","blend","getBlend","stencil","styleAttributeService","registerStyleAttribute","name","AttributeType","Attribute","descriptor","buffer","usage","DYNAMIC_DRAW","size","feature","featureIdx","vertex","attributeIdx","Array","isArray","STATIC_DRAW","iconMap","getIconMap","x","y","BaseModel"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AAUA;;AAEA;;AAEA;;AACA;;;;;;;;;;AAQA,IAAMA,YAAuC,GAAG;AAC9CC,EAAAA,KAAK,EAAE,GADuC;AAE9CC,EAAAA,IAAI,EAAE;AAFwC,CAAhD;;IAIqBC,U;;;;;;;;;;;;;;;;gGAoOK,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,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EAlOqCC,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 { getMask, rgb2arr } from '@antv/l7-utils';\nimport { isNumber } from 'lodash';\nimport BaseModel from '../../core/BaseModel';\nimport { ILineLayerStyleOptions } from '../../core/interface';\nimport { LineArcTriangulation } from '../../core/triangulation';\nimport { EARTH_RADIUS } from '../../earth/utils';\n// arc3d line layer\nimport arc3d_line_frag from '../shaders/line_arc_3d_frag.glsl';\nimport arc3d_line_vert from '../shaders/line_arc_3d_vert.glsl';\n// arc3d linear layer\nimport arc3d_linear_frag from '../shaders/linear/arc3d_linear_frag.glsl';\nimport arc3d_linear_vert from '../shaders/linear/arc3d_linear_vert.glsl';\n\nconst lineStyleObj: { [key: string]: number } = {\n solid: 0.0,\n dash: 1.0,\n};\nexport default class Arc3DModel 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],\n lineTexture = false,\n iconStep = 100,\n segmentNumber = 30,\n globalArcHeight = 10,\n } = this.layer.getLayerConfig() as ILineLayerStyleOptions;\n\n if (dashArray.length === 2) {\n dashArray.push(0, 0);\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.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\n return {\n u_globel: this.mapService.version === 'GLOBEL' ? 1 : 0,\n u_globel_radius: EARTH_RADIUS, // 地球半径\n u_global_height: globalArcHeight,\n\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 segmentNumber,\n u_line_type: lineStyleObj[lineType as string] || 0.0,\n u_dash_array: dashArray,\n\n // 纹理支持参数\n u_texture: this.texture, // 贴图\n u_line_texture: lineTexture ? 1.0 : 0.0, // 传入线的标识\n u_icon_step: iconStep,\n u_textSize: [1024, this.iconService.canvasHeight || 128],\n\n // 渐变色支持参数\n u_linearColor: useLinearColor,\n u_sourceColor: sourceColorArr,\n u_targetColor: targetColorArr,\n };\n }\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 getShaders(): { frag: string; vert: string; type: string } {\n const {\n sourceColor,\n targetColor,\n } = this.layer.getLayerConfig() as ILineLayerStyleOptions;\n\n if (sourceColor && targetColor) {\n // 分离 linear 功能\n return {\n frag: arc3d_linear_frag,\n vert: arc3d_linear_vert,\n type: 'linear',\n };\n } else {\n return {\n frag: arc3d_line_frag,\n vert: arc3d_line_vert,\n type: 'normal',\n };\n }\n }\n\n public buildModels(): IModel[] {\n const {\n segmentNumber = 30,\n mask = false,\n maskInside = true,\n } = this.layer.getLayerConfig() as ILineLayerStyleOptions;\n const { frag, vert, type } = this.getShaders();\n return [\n this.layer.buildLayerModel({\n moduleName: 'arc3Dline' + type,\n vertexShader: vert,\n fragmentShader: frag,\n triangulation: LineArcTriangulation,\n blend: this.getBlend(),\n segmentNumber,\n // primitive: gl.POINTS,\n stencil: getMask(mask, maskInside),\n }),\n ];\n }\n protected registerBuiltinAttributes() {\n // point layer size;\n this.styleAttributeService.registerStyleAttribute({\n name: 'size',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_Size',\n buffer: {\n // give the WebGL driver a hint that this buffer may change\n usage: gl.DYNAMIC_DRAW,\n data: [],\n type: gl.FLOAT,\n },\n size: 1,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n ) => {\n const { size = 1 } = feature;\n return Array.isArray(size) ? [size[0]] : [size as number];\n },\n },\n });\n\n this.styleAttributeService.registerStyleAttribute({\n name: 'instance', // 弧线起始点信息\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_Instance',\n buffer: {\n usage: gl.STATIC_DRAW,\n data: [],\n type: gl.FLOAT,\n },\n size: 4,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n ) => {\n return [vertex[3], vertex[4], vertex[5], vertex[6]];\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":"arc_3d.js"}
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = void 0;
|
|
9
|
+
|
|
10
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
11
|
+
|
|
12
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
13
|
+
|
|
14
|
+
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
15
|
+
|
|
16
|
+
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
17
|
+
|
|
18
|
+
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
19
|
+
|
|
20
|
+
var _isNumber2 = _interopRequireDefault(require("lodash/isNumber"));
|
|
21
|
+
|
|
22
|
+
var _l7Core = require("@antv/l7-core");
|
|
23
|
+
|
|
24
|
+
var _l7Utils = require("@antv/l7-utils");
|
|
25
|
+
|
|
26
|
+
var _BaseModel2 = _interopRequireDefault(require("../../core/BaseModel"));
|
|
27
|
+
|
|
28
|
+
var _triangulation = require("../../core/triangulation");
|
|
29
|
+
|
|
30
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
31
|
+
|
|
32
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
33
|
+
|
|
34
|
+
var line_arcmini_frag = "#define Animate 0.0\n\nuniform float u_opacity;\nuniform float u_blur : 0.9;\n// varying vec2 v_normal;\nvarying vec4 v_color;\n\nuniform float u_time;\nuniform vec4 u_aimate: [ 0, 2., 1.0, 0.2 ];\n\nuniform float segmentNumber;\nvarying float v_distance_ratio;\n\nuniform float u_linearColor: 0;\nuniform vec4 u_sourceColor;\nuniform vec4 u_targetColor;\n\n#pragma include \"picking\"\n\nvoid main() {\n\n // \u8BBE\u7F6E\u5F27\u7EBF\u7684\u5E95\u8272\n if(u_linearColor == 1.0) { // \u4F7F\u7528\u6E10\u53D8\u989C\u8272\n gl_FragColor = mix(u_sourceColor, u_targetColor, v_distance_ratio);\n } else { // \u4F7F\u7528 color \u65B9\u6CD5\u4F20\u5165\u7684\u989C\u8272\n gl_FragColor = v_color;\n }\n \n \n gl_FragColor.a *= u_opacity;\n\n if(u_aimate.x == Animate) {\n float animateSpeed = u_time / u_aimate.y; // \u8FD0\u52A8\u901F\u5EA6\n float alpha =1.0 - fract( mod(1.0- v_distance_ratio, u_aimate.z)* (1.0/ u_aimate.z) + u_time / u_aimate.y);\n alpha = (alpha + u_aimate.w -1.0) / u_aimate.w;\n // alpha = smoothstep(0., 1., alpha);\n alpha = clamp(alpha, 0.0, 1.0);\n gl_FragColor.a *= alpha;\n }\n}";
|
|
35
|
+
var line_arcmini_vert = "#define Animate 0.0\n\nattribute vec4 a_Color;\nattribute vec3 a_Position;\nattribute vec4 a_Instance;\nattribute float a_Size;\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\nuniform float segmentNumber;\nuniform vec4 u_aimate: [ 0, 2., 1.0, 0.2 ];\nvarying vec4 v_color;\n\nuniform float u_lineDir: 1.0;\n\n// \u504F\u79FB\u91CF\nuniform float u_thetaOffset: 0.314;\n\nuniform float u_opacity: 1.0;\nvarying float v_distance_ratio;\n\n#pragma include \"projection\"\n#pragma include \"project\"\n#pragma include \"picking\"\n\nfloat bezier3(vec3 arr, float t) {\n float ut = 1. - t;\n return (arr.x * ut + arr.y * t) * ut + (arr.y * ut + arr.z * t) * t;\n}\nvec2 midPoint(vec2 source, vec2 target) {\n vec2 center = target - source;\n float r = length(center);\n float theta = atan(center.y, center.x);\n float thetaOffset = u_thetaOffset;\n float r2 = r / 2.0 / cos(thetaOffset);\n float theta2 = theta + thetaOffset;\n vec2 mid = vec2(r2*cos(theta2) + source.x, r2*sin(theta2) + source.y);\n if(u_lineDir == 1.0) { // \u6B63\u5411\n return mid;\n } else { // \u9006\u5411\n // (mid + vmin)/2 = (s + t)/2\n vec2 vmid = source + target - mid;\n return vmid;\n }\n // return mid;\n}\nfloat getSegmentRatio(float index) {\n return smoothstep(0.0, 1.0, index / (segmentNumber - 1.));\n}\nvec2 interpolate (vec2 source, vec2 target, float t) {\n // if the angularDist is PI, linear interpolation is applied. otherwise, use spherical interpolation\n vec2 mid = midPoint(source, target);\n vec3 x = vec3(source.x, mid.x, target.x);\n vec3 y = vec3(source.y, mid.y, target.y);\n return vec2(bezier3(x ,t), bezier3(y,t));\n}\nvec2 getExtrusionOffset(vec2 line_clipspace, float offset_direction) {\n // normalized direction of the line\n vec2 dir_screenspace = normalize(line_clipspace);\n // rotate by 90 degrees\n dir_screenspace = vec2(-dir_screenspace.y, dir_screenspace.x);\n vec2 offset = dir_screenspace * offset_direction * setPickingSize(a_Size) / 2.0;\n return offset;\n}\nvec2 getNormal(vec2 line_clipspace, float offset_direction) {\n // normalized direction of the line\n vec2 dir_screenspace = normalize(line_clipspace);\n // rotate by 90 degrees\n dir_screenspace = vec2(-dir_screenspace.y, dir_screenspace.x);\n return reverse_offset_normal(vec3(dir_screenspace,1.0)).xy * sign(offset_direction);\n}\n\nvoid main() {\n v_color = a_Color;\n \n vec2 source = a_Instance.rg; // \u8D77\u59CB\u70B9\n vec2 target = a_Instance.ba; // \u7EC8\u70B9\n float segmentIndex = a_Position.x;\n float segmentRatio = getSegmentRatio(segmentIndex);\n\n float indexDir = mix(-1.0, 1.0, step(segmentIndex, 0.0));\n float nextSegmentRatio = getSegmentRatio(segmentIndex + indexDir);\n\n v_distance_ratio = segmentIndex / segmentNumber;\n \n if(u_aimate.x == Animate && u_lineDir != 1.0) {\n v_distance_ratio = 1.0 - v_distance_ratio;\n }\n\n vec4 curr = project_position(vec4(interpolate(source, target, segmentRatio), 0.0, 1.0));\n vec4 next = project_position(vec4(interpolate(source, target, nextSegmentRatio), 0.0, 1.0));\n // v_normal = getNormal((next.xy - curr.xy) * indexDir, a_Position.y);\n //unProjCustomCoord\n \n vec2 offset = project_pixel(getExtrusionOffset((next.xy - curr.xy) * indexDir, a_Position.y));\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n gl_Position = u_Mvp * (vec4(curr.xy + offset, 0, 1.0));\n } else {\n gl_Position = project_common_position_to_clipspace(vec4(curr.xy + offset, 0, 1.0));\n }\n}\n";
|
|
36
|
+
|
|
37
|
+
var ArcMiniModel = function (_BaseModel) {
|
|
38
|
+
(0, _inherits2.default)(ArcMiniModel, _BaseModel);
|
|
39
|
+
|
|
40
|
+
var _super = _createSuper(ArcMiniModel);
|
|
41
|
+
|
|
42
|
+
function ArcMiniModel() {
|
|
43
|
+
(0, _classCallCheck2.default)(this, ArcMiniModel);
|
|
44
|
+
return _super.apply(this, arguments);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
(0, _createClass2.default)(ArcMiniModel, [{
|
|
48
|
+
key: "getUninforms",
|
|
49
|
+
value: function getUninforms() {
|
|
50
|
+
var _ref = this.layer.getLayerConfig(),
|
|
51
|
+
_ref$opacity = _ref.opacity,
|
|
52
|
+
opacity = _ref$opacity === void 0 ? 1 : _ref$opacity,
|
|
53
|
+
sourceColor = _ref.sourceColor,
|
|
54
|
+
targetColor = _ref.targetColor,
|
|
55
|
+
_ref$forward = _ref.forward,
|
|
56
|
+
forward = _ref$forward === void 0 ? true : _ref$forward,
|
|
57
|
+
_ref$segmentNumber = _ref.segmentNumber,
|
|
58
|
+
segmentNumber = _ref$segmentNumber === void 0 ? 30 : _ref$segmentNumber,
|
|
59
|
+
_ref$thetaOffset = _ref.thetaOffset,
|
|
60
|
+
thetaOffset = _ref$thetaOffset === void 0 ? 0.314 : _ref$thetaOffset;
|
|
61
|
+
|
|
62
|
+
var useLinearColor = 0;
|
|
63
|
+
var sourceColorArr = [0, 0, 0, 0];
|
|
64
|
+
var targetColorArr = [0, 0, 0, 0];
|
|
65
|
+
|
|
66
|
+
if (sourceColor && targetColor) {
|
|
67
|
+
sourceColorArr = (0, _l7Utils.rgb2arr)(sourceColor);
|
|
68
|
+
targetColorArr = (0, _l7Utils.rgb2arr)(targetColor);
|
|
69
|
+
useLinearColor = 1;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
return {
|
|
73
|
+
u_thetaOffset: thetaOffset,
|
|
74
|
+
u_opacity: (0, _isNumber2.default)(opacity) ? opacity : 1.0,
|
|
75
|
+
segmentNumber: segmentNumber,
|
|
76
|
+
u_blur: 0.9,
|
|
77
|
+
u_lineDir: forward ? 1 : -1,
|
|
78
|
+
u_linearColor: useLinearColor,
|
|
79
|
+
u_sourceColor: sourceColorArr,
|
|
80
|
+
u_targetColor: targetColorArr
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
}, {
|
|
84
|
+
key: "getAnimateUniforms",
|
|
85
|
+
value: function getAnimateUniforms() {
|
|
86
|
+
var _ref2 = this.layer.getLayerConfig(),
|
|
87
|
+
animateOption = _ref2.animateOption;
|
|
88
|
+
|
|
89
|
+
return {
|
|
90
|
+
u_aimate: this.animateOption2Array(animateOption),
|
|
91
|
+
u_time: this.layer.getLayerAnimateTime()
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
}, {
|
|
95
|
+
key: "initModels",
|
|
96
|
+
value: function initModels() {
|
|
97
|
+
return this.buildModels();
|
|
98
|
+
}
|
|
99
|
+
}, {
|
|
100
|
+
key: "buildModels",
|
|
101
|
+
value: function buildModels() {
|
|
102
|
+
var _ref3 = this.layer.getLayerConfig(),
|
|
103
|
+
_ref3$segmentNumber = _ref3.segmentNumber,
|
|
104
|
+
segmentNumber = _ref3$segmentNumber === void 0 ? 30 : _ref3$segmentNumber;
|
|
105
|
+
|
|
106
|
+
return [this.layer.buildLayerModel({
|
|
107
|
+
moduleName: 'arc2dminiline',
|
|
108
|
+
vertexShader: line_arcmini_vert,
|
|
109
|
+
fragmentShader: line_arcmini_frag,
|
|
110
|
+
triangulation: _triangulation.LineArcTriangulation,
|
|
111
|
+
depth: {
|
|
112
|
+
enable: false
|
|
113
|
+
},
|
|
114
|
+
blend: this.getBlend(),
|
|
115
|
+
segmentNumber: segmentNumber
|
|
116
|
+
})];
|
|
117
|
+
}
|
|
118
|
+
}, {
|
|
119
|
+
key: "registerBuiltinAttributes",
|
|
120
|
+
value: function registerBuiltinAttributes() {
|
|
121
|
+
this.styleAttributeService.registerStyleAttribute({
|
|
122
|
+
name: 'size',
|
|
123
|
+
type: _l7Core.AttributeType.Attribute,
|
|
124
|
+
descriptor: {
|
|
125
|
+
name: 'a_Size',
|
|
126
|
+
buffer: {
|
|
127
|
+
usage: _l7Core.gl.DYNAMIC_DRAW,
|
|
128
|
+
data: [],
|
|
129
|
+
type: _l7Core.gl.FLOAT
|
|
130
|
+
},
|
|
131
|
+
size: 1,
|
|
132
|
+
update: function update(feature, featureIdx, vertex, attributeIdx) {
|
|
133
|
+
var _feature$size = feature.size,
|
|
134
|
+
size = _feature$size === void 0 ? 1 : _feature$size;
|
|
135
|
+
return Array.isArray(size) ? [size[0]] : [size];
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
});
|
|
139
|
+
this.styleAttributeService.registerStyleAttribute({
|
|
140
|
+
name: 'instance',
|
|
141
|
+
type: _l7Core.AttributeType.Attribute,
|
|
142
|
+
descriptor: {
|
|
143
|
+
name: 'a_Instance',
|
|
144
|
+
buffer: {
|
|
145
|
+
usage: _l7Core.gl.STATIC_DRAW,
|
|
146
|
+
data: [],
|
|
147
|
+
type: _l7Core.gl.FLOAT
|
|
148
|
+
},
|
|
149
|
+
size: 4,
|
|
150
|
+
update: function update(feature, featureIdx, vertex, attributeIdx) {
|
|
151
|
+
return [vertex[3], vertex[4], vertex[5], vertex[6]];
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
}]);
|
|
157
|
+
return ArcMiniModel;
|
|
158
|
+
}(_BaseModel2.default);
|
|
159
|
+
|
|
160
|
+
exports.default = ArcMiniModel;
|
|
161
|
+
//# sourceMappingURL=arcmini.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/line/models/arcmini.ts"],"names":["ArcMiniModel","layer","getLayerConfig","opacity","sourceColor","targetColor","forward","segmentNumber","thetaOffset","useLinearColor","sourceColorArr","targetColorArr","u_thetaOffset","u_opacity","u_blur","u_lineDir","u_linearColor","u_sourceColor","u_targetColor","animateOption","u_aimate","animateOption2Array","u_time","getLayerAnimateTime","buildModels","buildLayerModel","moduleName","vertexShader","line_arcmini_vert","fragmentShader","line_arcmini_frag","triangulation","LineArcTriangulation","depth","enable","blend","getBlend","styleAttributeService","registerStyleAttribute","name","type","AttributeType","Attribute","descriptor","buffer","usage","gl","DYNAMIC_DRAW","data","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AAQF,IAAR;AAAA,gBAAQA,IAAR,8BAAe,CAAf;AACA,mBAAOM,KAAK,CAACC,OAAN,CAAcP,IAAd,IAAsB,CAACA,IAAI,CAAC,CAAD,CAAL,CAAtB,GAAkC,CAACA,IAAD,CAAzC;AACD;AAjBS;AAHoC,OAAlD;AAwBA,WAAKb,qBAAL,CAA2BC,sBAA3B,CAAkD;AAChDC,QAAAA,IAAI,EAAE,UAD0C;AAEhDC,QAAAA,IAAI,EAAEC,sBAAcC,SAF4B;AAGhDC,QAAAA,UAAU,EAAE;AACVJ,UAAAA,IAAI,EAAE,YADI;AAEVK,UAAAA,MAAM,EAAE;AACNC,YAAAA,KAAK,EAAEC,WAAGY,WADJ;AAENV,YAAAA,IAAI,EAAE,EAFA;AAGNR,YAAAA,IAAI,EAAEM,WAAGG;AAHH,WAFE;AAOVC,UAAAA,IAAI,EAAE,CAPI;AAQVC,UAAAA,MAAM,EAAE,gBACNC,OADM,EAENC,UAFM,EAGNC,MAHM,EAINC,YAJM,EAKH;AACH,mBAAO,CAACD,MAAM,CAAC,CAAD,CAAP,EAAYA,MAAM,CAAC,CAAD,CAAlB,EAAuBA,MAAM,CAAC,CAAD,CAA7B,EAAkCA,MAAM,CAAC,CAAD,CAAxC,CAAP;AACD;AAfS;AAHoC,OAAlD;AAqBD;;;EAlHuCK,mB","sourcesContent":["import {\n AttributeType,\n gl,\n IAnimateOption,\n IEncodeFeature,\n ILayerConfig,\n IModel,\n IModelUniform,\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 { LineArcTriangulation } from '../../core/triangulation';\nimport line_arcmini_frag from '../shaders/line_arcmini_frag.glsl';\nimport line_arcmini_vert from '../shaders/line_arcmini_vert.glsl';\n\nexport default class ArcMiniModel extends BaseModel {\n public getUninforms(): IModelUniform {\n const {\n opacity = 1,\n sourceColor,\n targetColor,\n forward = true,\n segmentNumber = 30,\n thetaOffset = 0.314,\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 return {\n u_thetaOffset: thetaOffset,\n\n u_opacity: isNumber(opacity) ? opacity : 1.0,\n\n segmentNumber,\n u_blur: 0.9,\n u_lineDir: forward ? 1 : -1,\n\n // 渐变色支持参数\n u_linearColor: useLinearColor,\n u_sourceColor: sourceColorArr,\n u_targetColor: targetColorArr,\n };\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 return this.buildModels();\n }\n\n public buildModels(): IModel[] {\n const {\n segmentNumber = 30,\n } = this.layer.getLayerConfig() as ILineLayerStyleOptions;\n\n return [\n this.layer.buildLayerModel({\n moduleName: 'arc2dminiline',\n vertexShader: line_arcmini_vert,\n fragmentShader: line_arcmini_frag,\n triangulation: LineArcTriangulation,\n depth: { enable: false },\n blend: this.getBlend(),\n segmentNumber,\n }),\n ];\n }\n\n protected registerBuiltinAttributes() {\n // point layer size;\n this.styleAttributeService.registerStyleAttribute({\n name: 'size',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_Size',\n buffer: {\n // give the WebGL driver a hint that this buffer may change\n usage: gl.DYNAMIC_DRAW,\n data: [],\n type: gl.FLOAT,\n },\n size: 1,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n ) => {\n const { size = 1 } = feature;\n return Array.isArray(size) ? [size[0]] : [size as number];\n },\n },\n });\n\n this.styleAttributeService.registerStyleAttribute({\n name: 'instance', // 弧线起始点信息\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_Instance',\n buffer: {\n usage: gl.STATIC_DRAW,\n data: [],\n type: gl.FLOAT,\n },\n size: 4,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n ) => {\n return [vertex[3], vertex[4], vertex[5], vertex[6]];\n },\n },\n });\n }\n}\n"],"file":"arcmini.js"}
|
|
@@ -160,7 +160,7 @@ var Arc3DModel = function (_BaseModel) {
|
|
|
160
160
|
}
|
|
161
161
|
|
|
162
162
|
return {
|
|
163
|
-
u_globel: 1,
|
|
163
|
+
u_globel: this.mapService.version === 'GLOBEL' ? 1 : 0,
|
|
164
164
|
u_globel_radius: _utils.EARTH_RADIUS,
|
|
165
165
|
u_global_height: globalArcHeight,
|
|
166
166
|
u_dataTexture: this.dataTexture,
|
|
@@ -192,10 +192,10 @@ var Arc3DModel = function (_BaseModel) {
|
|
|
192
192
|
}
|
|
193
193
|
}, {
|
|
194
194
|
key: "initModels",
|
|
195
|
-
value: function initModels(
|
|
195
|
+
value: function initModels() {
|
|
196
196
|
this.updateTexture();
|
|
197
197
|
this.iconService.on('imageUpdate', this.updateTexture);
|
|
198
|
-
this.buildModels(
|
|
198
|
+
return this.buildModels();
|
|
199
199
|
}
|
|
200
200
|
}, {
|
|
201
201
|
key: "clearModels",
|
|
@@ -217,19 +217,19 @@ var Arc3DModel = function (_BaseModel) {
|
|
|
217
217
|
return {
|
|
218
218
|
frag: arc3d_linear_frag,
|
|
219
219
|
vert: arc3d_linear_vert,
|
|
220
|
-
type: '
|
|
220
|
+
type: 'linear'
|
|
221
221
|
};
|
|
222
222
|
} else {
|
|
223
223
|
return {
|
|
224
224
|
frag: arc3d_line_frag,
|
|
225
225
|
vert: arc3d_line_vert,
|
|
226
|
-
type: ''
|
|
226
|
+
type: 'normal'
|
|
227
227
|
};
|
|
228
228
|
}
|
|
229
229
|
}
|
|
230
230
|
}, {
|
|
231
231
|
key: "buildModels",
|
|
232
|
-
value: function buildModels(
|
|
232
|
+
value: function buildModels() {
|
|
233
233
|
var _ref4 = this.layer.getLayerConfig(),
|
|
234
234
|
_ref4$segmentNumber = _ref4.segmentNumber,
|
|
235
235
|
segmentNumber = _ref4$segmentNumber === void 0 ? 30 : _ref4$segmentNumber,
|
|
@@ -243,23 +243,15 @@ var Arc3DModel = function (_BaseModel) {
|
|
|
243
243
|
vert = _this$getShaders.vert,
|
|
244
244
|
type = _this$getShaders.type;
|
|
245
245
|
|
|
246
|
-
this.layer.buildLayerModel({
|
|
247
|
-
moduleName: '
|
|
246
|
+
return [this.layer.buildLayerModel({
|
|
247
|
+
moduleName: 'arc3Dline' + type,
|
|
248
248
|
vertexShader: vert,
|
|
249
249
|
fragmentShader: frag,
|
|
250
250
|
triangulation: _triangulation.LineArcTriangulation,
|
|
251
|
-
depth: {
|
|
252
|
-
enable: true
|
|
253
|
-
},
|
|
254
251
|
blend: this.getBlend(),
|
|
255
252
|
segmentNumber: segmentNumber,
|
|
256
253
|
stencil: (0, _l7Utils.getMask)(mask, maskInside)
|
|
257
|
-
})
|
|
258
|
-
callbackModel([model]);
|
|
259
|
-
}).catch(function (err) {
|
|
260
|
-
console.warn(err);
|
|
261
|
-
callbackModel([]);
|
|
262
|
-
});
|
|
254
|
+
})];
|
|
263
255
|
}
|
|
264
256
|
}, {
|
|
265
257
|
key: "registerBuiltinAttributes",
|