@antv/l7-layers 2.9.21 → 2.9.22-alpha.0
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 +4 -5
- package/es/Geometry/models/billboard.js +23 -9
- package/es/Geometry/models/index.js +4 -5
- package/es/Geometry/models/plane.js +25 -13
- package/es/Geometry/models/sprite.js +11 -21
- package/es/Geometry/shaders/billboard_frag.glsl +13 -0
- package/es/Geometry/shaders/billboard_vert.glsl +50 -0
- package/es/Geometry/shaders/plane_frag.glsl +22 -0
- package/es/Geometry/shaders/plane_vert.glsl +53 -0
- package/es/Geometry/shaders/sprite_frag.glsl +21 -0
- package/es/Geometry/shaders/sprite_vert.glsl +28 -0
- package/es/canvas/index.js +4 -5
- package/es/canvas/models/canvas.js +6 -12
- package/es/canvas/models/index.js +2 -3
- package/es/citybuliding/building.js +4 -5
- package/es/citybuliding/models/build.js +19 -22
- package/es/citybuliding/shaders/build_frag.glsl +117 -0
- package/es/citybuliding/shaders/build_vert.glsl +54 -0
- package/es/core/BaseLayer.js +205 -157
- package/es/core/BaseModel.js +135 -76
- package/es/core/interface.js +1 -2
- package/es/core/schema.js +4 -2
- package/es/core/shape/Path.js +8 -3
- package/es/core/shape/extrude.js +9 -4
- package/es/core/triangulation.js +89 -17
- package/es/earth/index.js +11 -7
- package/es/earth/models/atmosphere.js +15 -7
- package/es/earth/models/base.js +19 -7
- package/es/earth/models/bloomsphere.js +15 -7
- package/es/earth/shaders/atmosphere_frag.glsl +17 -0
- package/es/earth/shaders/atmosphere_vert.glsl +26 -0
- package/es/earth/shaders/base_frag.glsl +13 -0
- package/es/earth/shaders/base_vert.glsl +52 -0
- package/es/earth/shaders/bloomsphere_frag.glsl +15 -0
- package/es/earth/shaders/bloomsphere_vert.glsl +20 -0
- package/es/earth/utils.js +28 -5
- package/es/heatmap/index.js +8 -7
- package/es/heatmap/models/grid.js +11 -5
- package/es/heatmap/models/grid3d.js +18 -7
- package/es/heatmap/models/heatmap.js +45 -44
- package/es/heatmap/models/hexagon.js +14 -6
- package/es/heatmap/models/index.js +5 -6
- package/es/heatmap/shaders/grid_vert.glsl +42 -0
- package/es/heatmap/shaders/heatmap_3d_frag.glsl +14 -0
- package/es/heatmap/shaders/heatmap_3d_vert.glsl +46 -0
- package/es/heatmap/shaders/heatmap_frag.glsl +47 -0
- package/es/heatmap/shaders/heatmap_framebuffer_frag.glsl +10 -0
- package/es/heatmap/shaders/heatmap_framebuffer_vert.glsl +35 -0
- package/es/heatmap/shaders/heatmap_vert.glsl +10 -0
- package/es/heatmap/shaders/hexagon_3d_frag.glsl +0 -0
- package/es/heatmap/shaders/hexagon_3d_vert.glsl +64 -0
- package/es/heatmap/shaders/hexagon_frag.glsl +12 -0
- package/es/heatmap/shaders/hexagon_vert.glsl +41 -0
- package/es/heatmap/triangulation.js +2 -2
- package/es/image/index.js +4 -5
- package/es/image/models/dataImage.js +21 -31
- package/es/image/models/image.js +19 -25
- package/es/image/models/index.js +3 -4
- package/es/image/shaders/dataImage_frag.glsl +38 -0
- package/es/image/shaders/image_frag.glsl +9 -0
- package/es/image/shaders/image_vert.glsl +17 -0
- package/es/index.d.ts +2 -2
- package/es/index.js +92 -30
- package/es/line/index.js +4 -5
- package/es/line/models/arc.js +38 -15
- package/es/line/models/arc_3d.js +33 -14
- package/es/line/models/earthArc_3d.js +33 -14
- package/es/line/models/great_circle.js +25 -13
- package/es/line/models/half.js +33 -12
- package/es/line/models/index.js +12 -13
- package/es/line/models/line.js +48 -15
- package/es/line/models/linearline.js +26 -12
- package/es/line/models/simpleLine.js +26 -11
- package/es/line/models/tile.js +28 -10
- package/es/line/models/wall.js +30 -13
- package/es/line/shaders/arc_chunks.vert.glsl +21 -0
- package/es/line/shaders/dash/arc_dash_frag.glsl +28 -0
- package/es/line/shaders/dash/arc_dash_vert.glsl +148 -0
- package/es/line/shaders/dash/line_dash_frag.glsl +31 -0
- package/es/line/shaders/dash/line_dash_vert.glsl +93 -0
- package/es/line/shaders/half/line_half_frag.glsl +53 -0
- package/es/line/shaders/half/line_half_vert.glsl +169 -0
- package/es/line/shaders/line_arc2d_vert.glsl +114 -0
- package/es/line/shaders/line_arc_3d_frag.glsl +103 -0
- package/es/line/shaders/line_arc_3d_vert.glsl +207 -0
- package/es/line/shaders/line_arc_frag.glsl +89 -0
- package/es/line/shaders/line_arc_great_circle_frag.glsl +101 -0
- package/es/line/shaders/line_arc_great_circle_vert.glsl +215 -0
- package/es/line/shaders/line_arc_vert.glsl +174 -0
- package/es/line/shaders/line_bezier_vert.glsl +85 -0
- package/es/line/shaders/line_frag.glsl +100 -0
- package/es/line/shaders/line_vert.glsl +192 -0
- package/es/line/shaders/linear/arc3d_linear_frag.glsl +47 -0
- package/es/line/shaders/linear/arc3d_linear_vert.glsl +207 -0
- package/es/line/shaders/linear/arc_linear_frag.glsl +38 -0
- package/es/line/shaders/linear/arc_linear_vert.glsl +138 -0
- package/es/line/shaders/linear/line_linear_frag.glsl +27 -0
- package/es/line/shaders/linearLine/line_linear_frag.glsl +20 -0
- package/es/line/shaders/linearLine/line_linear_vert.glsl +112 -0
- package/es/line/shaders/simple/simpleline_frag.glsl +10 -0
- package/es/line/shaders/simple/simpleline_linear_frag.glsl +11 -0
- package/es/line/shaders/simple/simpleline_vert.glsl +78 -0
- package/es/line/shaders/tile/line_tile_frag.glsl +79 -0
- package/es/line/shaders/tile/line_tile_vert.glsl +210 -0
- package/es/line/shaders/wall_frag.glsl +93 -0
- package/es/line/shaders/wall_vert.glsl +111 -0
- package/es/mask/index.js +4 -5
- package/es/mask/models/fill.js +11 -8
- package/es/mask/models/index.js +2 -3
- package/es/mask/shaders/mask_frag.glsl +7 -0
- package/es/mask/shaders/mask_vert.glsl +22 -0
- package/es/plugins/DataMappingPlugin.js +71 -34
- package/es/plugins/DataSourcePlugin.js +12 -10
- package/es/plugins/FeatureScalePlugin.js +44 -24
- package/es/plugins/LayerAnimateStylePlugin.js +6 -7
- package/es/plugins/LayerModelPlugin.js +16 -7
- package/es/plugins/LayerStylePlugin.js +7 -3
- package/es/plugins/LightingPlugin.js +21 -13
- package/es/plugins/MultiPassRendererPlugin.js +21 -8
- package/es/plugins/PixelPickingPlugin.js +33 -11
- package/es/plugins/RegisterStyleAttributePlugin.js +10 -3
- package/es/plugins/ShaderUniformPlugin.js +24 -10
- package/es/plugins/UpdateModelPlugin.js +7 -3
- package/es/plugins/UpdateStyleAttributePlugin.js +20 -7
- package/es/point/index.js +12 -6
- package/es/point/models/earthExtrude.js +30 -12
- package/es/point/models/earthFill.js +25 -13
- package/es/point/models/extrude.js +30 -12
- package/es/point/models/fill.js +50 -15
- package/es/point/models/fillmage.js +46 -17
- package/es/point/models/image.js +20 -12
- package/es/point/models/index.js +14 -14
- package/es/point/models/normal.js +15 -7
- package/es/point/models/radar.js +33 -13
- package/es/point/models/simplePoint.js +17 -9
- package/es/point/models/text.js +77 -30
- package/es/point/models/tile.js +33 -12
- package/es/point/shaders/animate/wave_frag.glsl +65 -0
- package/es/point/shaders/earth/extrude_frag.glsl +44 -0
- package/es/point/shaders/earth/extrude_vert.glsl +140 -0
- package/es/point/shaders/earth/fill_frag.glsl +86 -0
- package/es/point/shaders/earth/fill_vert.glsl +126 -0
- package/es/point/shaders/extrude/extrude_frag.glsl +44 -0
- package/es/point/shaders/extrude/extrude_vert.glsl +121 -0
- package/es/point/shaders/fill_frag.glsl +84 -0
- package/es/point/shaders/fill_vert.glsl +182 -0
- package/es/point/shaders/image/fillImage_frag.glsl +20 -0
- package/es/point/shaders/image/fillImage_vert.glsl +108 -0
- package/es/point/shaders/image_frag.glsl +39 -0
- package/es/point/shaders/image_vert.glsl +81 -0
- package/es/point/shaders/normal_frag.glsl +15 -0
- package/es/point/shaders/normal_vert.glsl +79 -0
- package/es/point/shaders/radar/radar_frag.glsl +64 -0
- package/es/point/shaders/radar/radar_vert.glsl +120 -0
- package/es/point/shaders/simplePoint_frag.glsl +53 -0
- package/es/point/shaders/simplePoint_vert.glsl +79 -0
- package/es/point/shaders/text_frag.glsl +48 -0
- package/es/point/shaders/text_vert.glsl +131 -0
- package/es/point/shaders/tile/fill_tile_frag.glsl +83 -0
- package/es/point/shaders/tile/fill_tile_vert.glsl +181 -0
- package/es/point/shape/extrude.js +8 -3
- package/es/polygon/index.js +6 -5
- package/es/polygon/models/extrude.js +40 -31
- package/es/polygon/models/fill.js +19 -8
- package/es/polygon/models/index.js +14 -14
- package/es/polygon/models/ocean.js +25 -33
- package/es/polygon/models/tile.js +13 -7
- package/es/polygon/models/water.js +21 -25
- package/es/polygon/shaders/extrude/polygon_extrude_frag.glsl +44 -0
- package/es/polygon/shaders/extrude/polygon_extrude_picklight_frag.glsl +44 -0
- package/es/polygon/shaders/extrude/polygon_extrude_picklight_vert.glsl +85 -0
- package/es/polygon/shaders/extrude/polygon_extrude_vert.glsl +90 -0
- package/es/polygon/shaders/extrude/polygon_extrudetex_frag.glsl +48 -0
- package/es/polygon/shaders/extrude/polygon_extrudetex_vert.glsl +93 -0
- package/es/polygon/shaders/polygon_frag.glsl +12 -0
- package/es/polygon/shaders/polygon_linear_frag.glsl +22 -0
- package/es/polygon/shaders/polygon_linear_vert.glsl +74 -0
- package/es/polygon/shaders/polygon_vert.glsl +66 -0
- package/es/polygon/shaders/tile/polygon_tile_frag.glsl +12 -0
- package/es/polygon/shaders/tile/polygon_tile_vert.glsl +82 -0
- package/es/polygon/shaders/water/polygon_ocean_frag.glsl +248 -0
- package/es/polygon/shaders/water/polygon_ocean_vert.glsl +52 -0
- package/es/polygon/shaders/water/polygon_water_frag.glsl +73 -0
- package/es/polygon/shaders/water/polygon_water_vert.glsl +55 -0
- package/es/raster/buffers/triangulation.js +2 -2
- package/es/raster/index.js +7 -6
- package/es/raster/models/index.js +3 -4
- package/es/raster/models/raster.js +15 -25
- package/es/raster/raster.js +9 -13
- package/es/raster/shaders/raster_2d_frag.glsl +28 -0
- package/es/raster/shaders/raster_2d_vert.glsl +18 -0
- package/es/raster/shaders/raster_frag.glsl +9 -0
- package/es/raster/shaders/raster_vert.glsl +44 -0
- package/es/tile/interface.js +1 -2
- package/es/tile/manager/tileConfigManager.js +6 -8
- package/es/tile/manager/tileLayerManager.js +19 -30
- package/es/tile/manager/tilePickerManager.js +14 -14
- package/es/tile/models/tileModel.js +6 -6
- package/es/tile/tileFactory/base.js +26 -32
- package/es/tile/tileFactory/index.js +6 -7
- package/es/tile/tileFactory/line.js +3 -9
- package/es/tile/tileFactory/point.js +3 -9
- package/es/tile/tileFactory/polygon.js +3 -9
- package/es/tile/tileFactory/raster.js +4 -10
- package/es/tile/tileFactory/rasterData.js +5 -11
- package/es/tile/tileFactory/rasterDataLayer.js +4 -5
- package/es/tile/tileFactory/vectorLayer.js +8 -9
- package/es/tile/tileLayer/baseTileLayer.js +67 -39
- package/es/tile/tmsTileLayer.js +5 -4
- package/es/tile/utils.js +5 -3
- package/es/utils/blend.js +1 -2
- package/es/utils/collision-index.js +36 -21
- package/es/utils/dataMappingStyle.js +71 -15
- package/es/utils/extrude_polyline.js +90 -48
- package/es/utils/grid-index.js +7 -21
- package/es/utils/layerData.js +41 -17
- package/es/utils/multiPassRender.js +21 -5
- package/es/utils/polylineNormal.js +40 -20
- package/es/utils/simpleLine.js +4 -6
- package/es/utils/symbol-layout.js +49 -10
- package/es/utils/updateShape.js +6 -3
- package/es/wind/index.js +5 -6
- package/es/wind/models/index.js +2 -3
- package/es/wind/models/utils.js +50 -26
- package/es/wind/models/wind.js +15 -18
- package/es/wind/models/windRender.js +89 -78
- package/es/wind/models/windShader.d.ts +6 -6
- package/es/wind/models/windShader.js +12 -7
- package/es/wind/shaders/wind_frag.glsl +9 -0
- package/es/wind/shaders/wind_vert.glsl +17 -0
- package/lib/Geometry/index.js +77 -115
- package/lib/Geometry/models/billboard.js +181 -218
- package/lib/Geometry/models/index.js +34 -19
- package/lib/Geometry/models/plane.js +278 -394
- package/lib/Geometry/models/sprite.js +189 -294
- package/lib/Geometry/shaders/billboard_frag.glsl +13 -0
- package/lib/Geometry/shaders/billboard_vert.glsl +50 -0
- package/lib/Geometry/shaders/plane_frag.glsl +22 -0
- package/lib/Geometry/shaders/plane_vert.glsl +53 -0
- package/lib/Geometry/shaders/sprite_frag.glsl +21 -0
- package/lib/Geometry/shaders/sprite_vert.glsl +28 -0
- package/lib/canvas/index.js +66 -102
- package/lib/canvas/models/canvas.js +140 -210
- package/lib/canvas/models/index.js +30 -13
- package/lib/citybuliding/building.js +63 -99
- package/lib/citybuliding/models/build.js +146 -196
- package/lib/citybuliding/shaders/build_frag.glsl +117 -0
- package/lib/citybuliding/shaders/build_vert.glsl +54 -0
- package/lib/core/BaseLayer.js +807 -1245
- package/lib/core/BaseModel.js +275 -375
- package/lib/core/interface.js +53 -37
- package/lib/core/schema.js +39 -18
- package/lib/core/shape/Path.js +78 -60
- package/lib/core/shape/extrude.js +90 -127
- package/lib/core/triangulation.js +191 -304
- package/lib/earth/index.js +62 -96
- package/lib/earth/models/atmosphere.js +112 -139
- package/lib/earth/models/base.js +150 -198
- package/lib/earth/models/bloomsphere.js +112 -139
- package/lib/earth/shaders/atmosphere_frag.glsl +17 -0
- package/lib/earth/shaders/atmosphere_vert.glsl +26 -0
- package/lib/earth/shaders/base_frag.glsl +13 -0
- package/lib/earth/shaders/base_vert.glsl +52 -0
- package/lib/earth/shaders/bloomsphere_frag.glsl +15 -0
- package/lib/earth/shaders/bloomsphere_vert.glsl +20 -0
- package/lib/earth/utils.js +89 -85
- package/lib/heatmap/index.js +92 -148
- package/lib/heatmap/models/grid.js +91 -113
- package/lib/heatmap/models/grid3d.js +123 -145
- package/lib/heatmap/models/heatmap.js +338 -470
- package/lib/heatmap/models/hexagon.js +92 -114
- package/lib/heatmap/models/index.js +37 -23
- package/lib/heatmap/shaders/grid_vert.glsl +42 -0
- package/lib/heatmap/shaders/heatmap_3d_frag.glsl +14 -0
- package/lib/heatmap/shaders/heatmap_3d_vert.glsl +46 -0
- package/lib/heatmap/shaders/heatmap_frag.glsl +47 -0
- package/lib/heatmap/shaders/heatmap_framebuffer_frag.glsl +10 -0
- package/lib/heatmap/shaders/heatmap_framebuffer_vert.glsl +35 -0
- package/lib/heatmap/shaders/heatmap_vert.glsl +10 -0
- package/lib/heatmap/shaders/hexagon_3d_frag.glsl +0 -0
- package/lib/heatmap/shaders/hexagon_3d_vert.glsl +64 -0
- package/lib/heatmap/shaders/hexagon_frag.glsl +12 -0
- package/lib/heatmap/shaders/hexagon_vert.glsl +41 -0
- package/lib/heatmap/triangulation.js +46 -30
- package/lib/image/index.js +74 -112
- package/lib/image/models/dataImage.js +173 -241
- package/lib/image/models/image.js +123 -177
- package/lib/image/models/index.js +32 -16
- package/lib/image/shaders/dataImage_frag.glsl +38 -0
- package/lib/image/shaders/image_frag.glsl +9 -0
- package/lib/image/shaders/image_vert.glsl +17 -0
- package/lib/index.js +96 -193
- package/lib/line/index.js +83 -128
- package/lib/line/models/arc.js +237 -328
- package/lib/line/models/arc_3d.js +228 -314
- package/lib/line/models/earthArc_3d.js +228 -316
- package/lib/line/models/great_circle.js +200 -279
- package/lib/line/models/half.js +201 -266
- package/lib/line/models/index.js +50 -43
- package/lib/line/models/line.js +299 -394
- package/lib/line/models/linearline.js +203 -263
- package/lib/line/models/simpleLine.js +175 -225
- package/lib/line/models/tile.js +237 -330
- package/lib/line/models/wall.js +235 -310
- package/lib/line/shaders/arc_chunks.vert.glsl +21 -0
- package/lib/line/shaders/dash/arc_dash_frag.glsl +28 -0
- package/lib/line/shaders/dash/arc_dash_vert.glsl +148 -0
- package/lib/line/shaders/dash/line_dash_frag.glsl +31 -0
- package/lib/line/shaders/dash/line_dash_vert.glsl +93 -0
- package/lib/line/shaders/half/line_half_frag.glsl +53 -0
- package/lib/line/shaders/half/line_half_vert.glsl +169 -0
- package/lib/line/shaders/line_arc2d_vert.glsl +114 -0
- package/lib/line/shaders/line_arc_3d_frag.glsl +103 -0
- package/lib/line/shaders/line_arc_3d_vert.glsl +207 -0
- package/lib/line/shaders/line_arc_frag.glsl +89 -0
- package/lib/line/shaders/line_arc_great_circle_frag.glsl +101 -0
- package/lib/line/shaders/line_arc_great_circle_vert.glsl +215 -0
- package/lib/line/shaders/line_arc_vert.glsl +174 -0
- package/lib/line/shaders/line_bezier_vert.glsl +85 -0
- package/lib/line/shaders/line_frag.glsl +100 -0
- package/lib/line/shaders/line_vert.glsl +192 -0
- package/lib/line/shaders/linear/arc3d_linear_frag.glsl +47 -0
- package/lib/line/shaders/linear/arc3d_linear_vert.glsl +207 -0
- package/lib/line/shaders/linear/arc_linear_frag.glsl +38 -0
- package/lib/line/shaders/linear/arc_linear_vert.glsl +138 -0
- package/lib/line/shaders/linear/line_linear_frag.glsl +27 -0
- package/lib/line/shaders/linearLine/line_linear_frag.glsl +20 -0
- package/lib/line/shaders/linearLine/line_linear_vert.glsl +112 -0
- package/lib/line/shaders/simple/simpleline_frag.glsl +10 -0
- package/lib/line/shaders/simple/simpleline_linear_frag.glsl +11 -0
- package/lib/line/shaders/simple/simpleline_vert.glsl +78 -0
- package/lib/line/shaders/tile/line_tile_frag.glsl +79 -0
- package/lib/line/shaders/tile/line_tile_vert.glsl +210 -0
- package/lib/line/shaders/wall_frag.glsl +93 -0
- package/lib/line/shaders/wall_vert.glsl +111 -0
- package/lib/mask/index.js +59 -93
- package/lib/mask/models/fill.js +82 -132
- package/lib/mask/models/index.js +30 -13
- package/lib/mask/shaders/mask_frag.glsl +7 -0
- package/lib/mask/shaders/mask_vert.glsl +22 -0
- package/lib/plugins/DataMappingPlugin.js +222 -304
- package/lib/plugins/DataSourcePlugin.js +87 -100
- package/lib/plugins/FeatureScalePlugin.js +239 -310
- package/lib/plugins/LayerAnimateStylePlugin.js +55 -61
- package/lib/plugins/LayerModelPlugin.js +72 -70
- package/lib/plugins/LayerStylePlugin.js +51 -44
- package/lib/plugins/LightingPlugin.js +68 -72
- package/lib/plugins/MultiPassRendererPlugin.js +65 -77
- package/lib/plugins/PixelPickingPlugin.js +109 -128
- package/lib/plugins/RegisterStyleAttributePlugin.js +110 -103
- package/lib/plugins/ShaderUniformPlugin.js +98 -103
- package/lib/plugins/UpdateModelPlugin.js +47 -36
- package/lib/plugins/UpdateStyleAttributePlugin.js +75 -80
- package/lib/point/index.js +147 -216
- package/lib/point/models/earthExtrude.js +201 -262
- package/lib/point/models/earthFill.js +202 -276
- package/lib/point/models/extrude.js +203 -282
- package/lib/point/models/fill.js +273 -369
- package/lib/point/models/fillmage.js +250 -327
- package/lib/point/models/image.js +163 -226
- package/lib/point/models/index.js +52 -46
- package/lib/point/models/normal.js +134 -176
- package/lib/point/models/radar.js +212 -286
- package/lib/point/models/simplePoint.js +142 -187
- package/lib/point/models/text.js +385 -559
- package/lib/point/models/tile.js +223 -294
- package/lib/point/shaders/animate/wave_frag.glsl +65 -0
- package/lib/point/shaders/earth/extrude_frag.glsl +44 -0
- package/lib/point/shaders/earth/extrude_vert.glsl +140 -0
- package/lib/point/shaders/earth/fill_frag.glsl +86 -0
- package/lib/point/shaders/earth/fill_vert.glsl +126 -0
- package/lib/point/shaders/extrude/extrude_frag.glsl +44 -0
- package/lib/point/shaders/extrude/extrude_vert.glsl +121 -0
- package/lib/point/shaders/fill_frag.glsl +84 -0
- package/lib/point/shaders/fill_vert.glsl +182 -0
- package/lib/point/shaders/image/fillImage_frag.glsl +20 -0
- package/lib/point/shaders/image/fillImage_vert.glsl +108 -0
- package/lib/point/shaders/image_frag.glsl +39 -0
- package/lib/point/shaders/image_vert.glsl +81 -0
- package/lib/point/shaders/normal_frag.glsl +15 -0
- package/lib/point/shaders/normal_vert.glsl +79 -0
- package/lib/point/shaders/radar/radar_frag.glsl +64 -0
- package/lib/point/shaders/radar/radar_vert.glsl +120 -0
- package/lib/point/shaders/simplePoint_frag.glsl +53 -0
- package/lib/point/shaders/simplePoint_vert.glsl +79 -0
- package/lib/point/shaders/text_frag.glsl +48 -0
- package/lib/point/shaders/text_vert.glsl +131 -0
- package/lib/point/shaders/tile/fill_tile_frag.glsl +83 -0
- package/lib/point/shaders/tile/fill_tile_vert.glsl +181 -0
- package/lib/point/shape/extrude.js +51 -51
- package/lib/polygon/index.js +100 -149
- package/lib/polygon/models/extrude.js +222 -303
- package/lib/polygon/models/fill.js +153 -205
- package/lib/polygon/models/index.js +52 -46
- package/lib/polygon/models/ocean.js +172 -251
- package/lib/polygon/models/tile.js +100 -139
- package/lib/polygon/models/water.js +152 -227
- package/lib/polygon/shaders/extrude/polygon_extrude_frag.glsl +44 -0
- package/lib/polygon/shaders/extrude/polygon_extrude_picklight_frag.glsl +44 -0
- package/lib/polygon/shaders/extrude/polygon_extrude_picklight_vert.glsl +85 -0
- package/lib/polygon/shaders/extrude/polygon_extrude_vert.glsl +90 -0
- package/lib/polygon/shaders/extrude/polygon_extrudetex_frag.glsl +48 -0
- package/lib/polygon/shaders/extrude/polygon_extrudetex_vert.glsl +93 -0
- package/lib/polygon/shaders/polygon_frag.glsl +12 -0
- package/lib/polygon/shaders/polygon_linear_frag.glsl +22 -0
- package/lib/polygon/shaders/polygon_linear_vert.glsl +74 -0
- package/lib/polygon/shaders/polygon_vert.glsl +66 -0
- package/lib/polygon/shaders/tile/polygon_tile_frag.glsl +12 -0
- package/lib/polygon/shaders/tile/polygon_tile_vert.glsl +82 -0
- package/lib/polygon/shaders/water/polygon_ocean_frag.glsl +248 -0
- package/lib/polygon/shaders/water/polygon_ocean_vert.glsl +52 -0
- package/lib/polygon/shaders/water/polygon_water_frag.glsl +73 -0
- package/lib/polygon/shaders/water/polygon_water_vert.glsl +55 -0
- package/lib/raster/buffers/triangulation.js +39 -26
- package/lib/raster/index.js +73 -111
- package/lib/raster/models/index.js +33 -17
- package/lib/raster/models/raster.js +134 -187
- package/lib/raster/raster.js +132 -189
- package/lib/raster/shaders/raster_2d_frag.glsl +28 -0
- package/lib/raster/shaders/raster_2d_vert.glsl +18 -0
- package/lib/raster/shaders/raster_frag.glsl +9 -0
- package/lib/raster/shaders/raster_vert.glsl +44 -0
- package/lib/tile/interface.js +17 -2
- package/lib/tile/manager/tileConfigManager.js +86 -126
- package/lib/tile/manager/tileLayerManager.js +227 -312
- package/lib/tile/manager/tilePickerManager.js +123 -187
- package/lib/tile/models/tileModel.js +51 -70
- package/lib/tile/tileFactory/base.js +292 -403
- package/lib/tile/tileFactory/index.js +48 -51
- package/lib/tile/tileFactory/line.js +50 -71
- package/lib/tile/tileFactory/point.js +50 -71
- package/lib/tile/tileFactory/polygon.js +50 -71
- package/lib/tile/tileFactory/raster.js +54 -72
- package/lib/tile/tileFactory/rasterData.js +76 -94
- package/lib/tile/tileFactory/rasterDataLayer.js +62 -98
- package/lib/tile/tileFactory/vectorLayer.js +95 -148
- package/lib/tile/tileLayer/baseTileLayer.js +220 -380
- package/lib/tile/tmsTileLayer.js +67 -109
- package/lib/tile/utils.js +86 -101
- package/lib/utils/blend.js +79 -60
- package/lib/utils/collision-index.js +63 -83
- package/lib/utils/dataMappingStyle.js +59 -56
- package/lib/utils/extrude_polyline.js +397 -554
- package/lib/utils/grid-index.js +111 -168
- package/lib/utils/layerData.js +88 -95
- package/lib/utils/multiPassRender.js +38 -31
- package/lib/utils/polylineNormal.js +86 -118
- package/lib/utils/simpleLine.js +85 -101
- package/lib/utils/symbol-layout.js +109 -173
- package/lib/utils/updateShape.js +40 -11
- package/lib/wind/index.js +71 -110
- package/lib/wind/models/index.js +30 -13
- package/lib/wind/models/utils.js +89 -104
- package/lib/wind/models/wind.js +224 -332
- package/lib/wind/models/windRender.js +215 -293
- package/lib/wind/models/windShader.js +181 -17
- package/lib/wind/shaders/wind_frag.glsl +9 -0
- package/lib/wind/shaders/wind_vert.glsl +17 -0
- package/package.json +11 -9
- package/es/Geometry/index.js.map +0 -1
- package/es/Geometry/models/billboard.js.map +0 -1
- package/es/Geometry/models/index.js.map +0 -1
- package/es/Geometry/models/plane.js.map +0 -1
- package/es/Geometry/models/sprite.js.map +0 -1
- package/es/canvas/index.js.map +0 -1
- package/es/canvas/models/canvas.js.map +0 -1
- package/es/canvas/models/index.js.map +0 -1
- package/es/citybuliding/building.js.map +0 -1
- package/es/citybuliding/models/build.js.map +0 -1
- package/es/core/BaseLayer.js.map +0 -1
- package/es/core/BaseModel.js.map +0 -1
- package/es/core/interface.js.map +0 -1
- package/es/core/schema.js.map +0 -1
- package/es/core/shape/Path.js.map +0 -1
- package/es/core/shape/extrude.js.map +0 -1
- package/es/core/triangulation.js.map +0 -1
- package/es/earth/index.js.map +0 -1
- package/es/earth/models/atmosphere.js.map +0 -1
- package/es/earth/models/base.js.map +0 -1
- package/es/earth/models/bloomsphere.js.map +0 -1
- package/es/earth/utils.js.map +0 -1
- package/es/glsl.d.js +0 -2
- package/es/glsl.d.js.map +0 -1
- package/es/heatmap/index.js.map +0 -1
- package/es/heatmap/models/grid.js.map +0 -1
- package/es/heatmap/models/grid3d.js.map +0 -1
- package/es/heatmap/models/heatmap.js.map +0 -1
- package/es/heatmap/models/hexagon.js.map +0 -1
- package/es/heatmap/models/index.js.map +0 -1
- package/es/heatmap/triangulation.js.map +0 -1
- package/es/image/index.js.map +0 -1
- package/es/image/models/dataImage.js.map +0 -1
- package/es/image/models/image.js.map +0 -1
- package/es/image/models/index.js.map +0 -1
- package/es/index.js.map +0 -1
- package/es/line/index.js.map +0 -1
- package/es/line/models/arc.js.map +0 -1
- package/es/line/models/arc_3d.js.map +0 -1
- package/es/line/models/earthArc_3d.js.map +0 -1
- package/es/line/models/great_circle.js.map +0 -1
- package/es/line/models/half.js.map +0 -1
- package/es/line/models/index.js.map +0 -1
- package/es/line/models/line.js.map +0 -1
- package/es/line/models/linearline.js.map +0 -1
- package/es/line/models/simpleLine.js.map +0 -1
- package/es/line/models/tile.js.map +0 -1
- package/es/line/models/wall.js.map +0 -1
- package/es/mask/index.js.map +0 -1
- package/es/mask/models/fill.js.map +0 -1
- package/es/mask/models/index.js.map +0 -1
- package/es/plugins/DataMappingPlugin.js.map +0 -1
- package/es/plugins/DataSourcePlugin.js.map +0 -1
- package/es/plugins/FeatureScalePlugin.js.map +0 -1
- package/es/plugins/LayerAnimateStylePlugin.js.map +0 -1
- package/es/plugins/LayerModelPlugin.js.map +0 -1
- package/es/plugins/LayerStylePlugin.js.map +0 -1
- package/es/plugins/LightingPlugin.js.map +0 -1
- package/es/plugins/MultiPassRendererPlugin.js.map +0 -1
- package/es/plugins/PixelPickingPlugin.js.map +0 -1
- package/es/plugins/RegisterStyleAttributePlugin.js.map +0 -1
- package/es/plugins/ShaderUniformPlugin.js.map +0 -1
- package/es/plugins/UpdateModelPlugin.js.map +0 -1
- package/es/plugins/UpdateStyleAttributePlugin.js.map +0 -1
- package/es/point/index.js.map +0 -1
- package/es/point/models/earthExtrude.js.map +0 -1
- package/es/point/models/earthFill.js.map +0 -1
- package/es/point/models/extrude.js.map +0 -1
- package/es/point/models/fill.js.map +0 -1
- package/es/point/models/fillmage.js.map +0 -1
- package/es/point/models/image.js.map +0 -1
- package/es/point/models/index.js.map +0 -1
- package/es/point/models/normal.js.map +0 -1
- package/es/point/models/radar.js.map +0 -1
- package/es/point/models/simplePoint.js.map +0 -1
- package/es/point/models/text.js.map +0 -1
- package/es/point/models/tile.js.map +0 -1
- package/es/point/shape/extrude.js.map +0 -1
- package/es/polygon/index.js.map +0 -1
- package/es/polygon/models/extrude.js.map +0 -1
- package/es/polygon/models/fill.js.map +0 -1
- package/es/polygon/models/index.js.map +0 -1
- package/es/polygon/models/ocean.js.map +0 -1
- package/es/polygon/models/tile.js.map +0 -1
- package/es/polygon/models/water.js.map +0 -1
- package/es/raster/buffers/triangulation.js.map +0 -1
- package/es/raster/index.js.map +0 -1
- package/es/raster/models/index.js.map +0 -1
- package/es/raster/models/raster.js.map +0 -1
- package/es/raster/raster.js.map +0 -1
- package/es/tile/interface.js.map +0 -1
- package/es/tile/manager/tileConfigManager.js.map +0 -1
- package/es/tile/manager/tileLayerManager.js.map +0 -1
- package/es/tile/manager/tilePickerManager.js.map +0 -1
- package/es/tile/models/tileModel.js.map +0 -1
- package/es/tile/tileFactory/base.js.map +0 -1
- package/es/tile/tileFactory/index.js.map +0 -1
- package/es/tile/tileFactory/line.js.map +0 -1
- package/es/tile/tileFactory/point.js.map +0 -1
- package/es/tile/tileFactory/polygon.js.map +0 -1
- package/es/tile/tileFactory/raster.js.map +0 -1
- package/es/tile/tileFactory/rasterData.js.map +0 -1
- package/es/tile/tileFactory/rasterDataLayer.js.map +0 -1
- package/es/tile/tileFactory/vectorLayer.js.map +0 -1
- package/es/tile/tileLayer/baseTileLayer.js.map +0 -1
- package/es/tile/tmsTileLayer.js.map +0 -1
- package/es/tile/utils.js.map +0 -1
- package/es/utils/blend.js.map +0 -1
- package/es/utils/collision-index.js.map +0 -1
- package/es/utils/dataMappingStyle.js.map +0 -1
- package/es/utils/extrude_polyline.js.map +0 -1
- package/es/utils/grid-index.js.map +0 -1
- package/es/utils/layerData.js.map +0 -1
- package/es/utils/multiPassRender.js.map +0 -1
- package/es/utils/polylineNormal.js.map +0 -1
- package/es/utils/simpleLine.js.map +0 -1
- package/es/utils/symbol-layout.js.map +0 -1
- package/es/utils/updateShape.js.map +0 -1
- package/es/wind/index.js.map +0 -1
- package/es/wind/models/index.js.map +0 -1
- package/es/wind/models/utils.js.map +0 -1
- package/es/wind/models/wind.js.map +0 -1
- package/es/wind/models/windRender.js.map +0 -1
- package/es/wind/models/windShader.js.map +0 -1
- package/lib/Geometry/index.js.map +0 -1
- package/lib/Geometry/models/billboard.js.map +0 -1
- package/lib/Geometry/models/index.js.map +0 -1
- package/lib/Geometry/models/plane.js.map +0 -1
- package/lib/Geometry/models/sprite.js.map +0 -1
- package/lib/canvas/index.js.map +0 -1
- package/lib/canvas/models/canvas.js.map +0 -1
- package/lib/canvas/models/index.js.map +0 -1
- package/lib/citybuliding/building.js.map +0 -1
- package/lib/citybuliding/models/build.js.map +0 -1
- package/lib/core/BaseLayer.js.map +0 -1
- package/lib/core/BaseModel.js.map +0 -1
- package/lib/core/interface.js.map +0 -1
- package/lib/core/schema.js.map +0 -1
- package/lib/core/shape/Path.js.map +0 -1
- package/lib/core/shape/extrude.js.map +0 -1
- package/lib/core/triangulation.js.map +0 -1
- package/lib/earth/index.js.map +0 -1
- package/lib/earth/models/atmosphere.js.map +0 -1
- package/lib/earth/models/base.js.map +0 -1
- package/lib/earth/models/bloomsphere.js.map +0 -1
- package/lib/earth/utils.js.map +0 -1
- package/lib/glsl.d.js +0 -2
- package/lib/glsl.d.js.map +0 -1
- package/lib/heatmap/index.js.map +0 -1
- package/lib/heatmap/models/grid.js.map +0 -1
- package/lib/heatmap/models/grid3d.js.map +0 -1
- package/lib/heatmap/models/heatmap.js.map +0 -1
- package/lib/heatmap/models/hexagon.js.map +0 -1
- package/lib/heatmap/models/index.js.map +0 -1
- package/lib/heatmap/triangulation.js.map +0 -1
- package/lib/image/index.js.map +0 -1
- package/lib/image/models/dataImage.js.map +0 -1
- package/lib/image/models/image.js.map +0 -1
- package/lib/image/models/index.js.map +0 -1
- package/lib/index.js.map +0 -1
- package/lib/line/index.js.map +0 -1
- package/lib/line/models/arc.js.map +0 -1
- package/lib/line/models/arc_3d.js.map +0 -1
- package/lib/line/models/earthArc_3d.js.map +0 -1
- package/lib/line/models/great_circle.js.map +0 -1
- package/lib/line/models/half.js.map +0 -1
- package/lib/line/models/index.js.map +0 -1
- package/lib/line/models/line.js.map +0 -1
- package/lib/line/models/linearline.js.map +0 -1
- package/lib/line/models/simpleLine.js.map +0 -1
- package/lib/line/models/tile.js.map +0 -1
- package/lib/line/models/wall.js.map +0 -1
- package/lib/mask/index.js.map +0 -1
- package/lib/mask/models/fill.js.map +0 -1
- package/lib/mask/models/index.js.map +0 -1
- package/lib/plugins/DataMappingPlugin.js.map +0 -1
- package/lib/plugins/DataSourcePlugin.js.map +0 -1
- package/lib/plugins/FeatureScalePlugin.js.map +0 -1
- package/lib/plugins/LayerAnimateStylePlugin.js.map +0 -1
- package/lib/plugins/LayerModelPlugin.js.map +0 -1
- package/lib/plugins/LayerStylePlugin.js.map +0 -1
- package/lib/plugins/LightingPlugin.js.map +0 -1
- package/lib/plugins/MultiPassRendererPlugin.js.map +0 -1
- package/lib/plugins/PixelPickingPlugin.js.map +0 -1
- package/lib/plugins/RegisterStyleAttributePlugin.js.map +0 -1
- package/lib/plugins/ShaderUniformPlugin.js.map +0 -1
- package/lib/plugins/UpdateModelPlugin.js.map +0 -1
- package/lib/plugins/UpdateStyleAttributePlugin.js.map +0 -1
- package/lib/point/index.js.map +0 -1
- package/lib/point/models/earthExtrude.js.map +0 -1
- package/lib/point/models/earthFill.js.map +0 -1
- package/lib/point/models/extrude.js.map +0 -1
- package/lib/point/models/fill.js.map +0 -1
- package/lib/point/models/fillmage.js.map +0 -1
- package/lib/point/models/image.js.map +0 -1
- package/lib/point/models/index.js.map +0 -1
- package/lib/point/models/normal.js.map +0 -1
- package/lib/point/models/radar.js.map +0 -1
- package/lib/point/models/simplePoint.js.map +0 -1
- package/lib/point/models/text.js.map +0 -1
- package/lib/point/models/tile.js.map +0 -1
- package/lib/point/shape/extrude.js.map +0 -1
- package/lib/polygon/index.js.map +0 -1
- package/lib/polygon/models/extrude.js.map +0 -1
- package/lib/polygon/models/fill.js.map +0 -1
- package/lib/polygon/models/index.js.map +0 -1
- package/lib/polygon/models/ocean.js.map +0 -1
- package/lib/polygon/models/tile.js.map +0 -1
- package/lib/polygon/models/water.js.map +0 -1
- package/lib/raster/buffers/triangulation.js.map +0 -1
- package/lib/raster/index.js.map +0 -1
- package/lib/raster/models/index.js.map +0 -1
- package/lib/raster/models/raster.js.map +0 -1
- package/lib/raster/raster.js.map +0 -1
- package/lib/tile/interface.js.map +0 -1
- package/lib/tile/manager/tileConfigManager.js.map +0 -1
- package/lib/tile/manager/tileLayerManager.js.map +0 -1
- package/lib/tile/manager/tilePickerManager.js.map +0 -1
- package/lib/tile/models/tileModel.js.map +0 -1
- package/lib/tile/tileFactory/base.js.map +0 -1
- package/lib/tile/tileFactory/index.js.map +0 -1
- package/lib/tile/tileFactory/line.js.map +0 -1
- package/lib/tile/tileFactory/point.js.map +0 -1
- package/lib/tile/tileFactory/polygon.js.map +0 -1
- package/lib/tile/tileFactory/raster.js.map +0 -1
- package/lib/tile/tileFactory/rasterData.js.map +0 -1
- package/lib/tile/tileFactory/rasterDataLayer.js.map +0 -1
- package/lib/tile/tileFactory/vectorLayer.js.map +0 -1
- package/lib/tile/tileLayer/baseTileLayer.js.map +0 -1
- package/lib/tile/tmsTileLayer.js.map +0 -1
- package/lib/tile/utils.js.map +0 -1
- package/lib/utils/blend.js.map +0 -1
- package/lib/utils/collision-index.js.map +0 -1
- package/lib/utils/dataMappingStyle.js.map +0 -1
- package/lib/utils/extrude_polyline.js.map +0 -1
- package/lib/utils/grid-index.js.map +0 -1
- package/lib/utils/layerData.js.map +0 -1
- package/lib/utils/multiPassRender.js.map +0 -1
- package/lib/utils/polylineNormal.js.map +0 -1
- package/lib/utils/simpleLine.js.map +0 -1
- package/lib/utils/symbol-layout.js.map +0 -1
- package/lib/utils/updateShape.js.map +0 -1
- package/lib/wind/index.js.map +0 -1
- package/lib/wind/models/index.js.map +0 -1
- package/lib/wind/models/utils.js.map +0 -1
- package/lib/wind/models/wind.js.map +0 -1
- package/lib/wind/models/windRender.js.map +0 -1
- package/lib/wind/models/windShader.js.map +0 -1
package/es/line/models/line.js
CHANGED
|
@@ -5,7 +5,6 @@ import _inherits from "@babel/runtime/helpers/inherits";
|
|
|
5
5
|
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
6
6
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
7
7
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
8
|
-
import _isNumber from "lodash/isNumber";
|
|
9
8
|
|
|
10
9
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
11
10
|
|
|
@@ -13,19 +12,31 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
|
|
|
13
12
|
|
|
14
13
|
import { AttributeType, gl } from '@antv/l7-core';
|
|
15
14
|
import { getMask, LineTriangulation, rgb2arr } from '@antv/l7-utils';
|
|
16
|
-
import
|
|
17
|
-
import
|
|
15
|
+
import { isNumber } from 'lodash';
|
|
16
|
+
import BaseModel from "../../core/BaseModel";
|
|
17
|
+
import { LinearDir, TextureBlend } from "../../core/interface"; // import { LineTriangulation } from '../../core/triangulation';
|
|
18
|
+
// dash line shader
|
|
19
|
+
|
|
20
|
+
/* babel-plugin-inline-import '../shaders/dash/line_dash_frag.glsl' */
|
|
18
21
|
var line_dash_frag = "#define LineTypeSolid 0.0\nuniform float u_opacity : 1.0;\n\nvarying vec4 v_color;\n\n// dash\nvarying vec4 v_dash_array;\n\n#pragma include \"picking\"\n\nuniform float u_time;\nuniform vec4 u_aimate: [ 0, 2., 1.0, 0.2 ]; // \u63A7\u5236\u8FD0\u52A8\n\nvarying mat4 styleMappingMat;\n// [animate, duration, interval, trailLength],\nvoid main() {\n float opacity = styleMappingMat[0][0];\n float d_distance_ratio = styleMappingMat[3].r; // \u5F53\u524D\u70B9\u4F4D\u8DDD\u79BB\u5360\u7EBF\u603B\u957F\u7684\u6BD4\u4F8B\n gl_FragColor = v_color;\n gl_FragColor.a *= opacity; // \u5168\u5C40\u900F\u660E\u5EA6\n \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 // \u5B9E\u7EBF\u90E8\u5206\n } else {\n // \u865A\u7EBF\u90E8\u5206\n discard;\n };\n\n gl_FragColor = filterColor(gl_FragColor);\n}\n";
|
|
19
|
-
|
|
22
|
+
|
|
23
|
+
/* babel-plugin-inline-import '../shaders/dash/line_dash_vert.glsl' */
|
|
24
|
+
var line_dash_vert = "#define LineTypeSolid 0.0\n#define LineTypeDash 1.0\n#define Animate 0.0\n\nattribute float a_Miter;\nattribute vec4 a_Color;\nattribute vec2 a_Size;\nattribute vec3 a_Normal;\nattribute vec3 a_Position;\n\nattribute vec2 a_iconMapUV;\n\n// dash line\nattribute float a_Total_Distance;\nattribute vec2 a_DistanceAndIndex;\n\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\nuniform vec4 u_dash_array: [10.0, 5., 0, 0];\n\nuniform float u_vertexScale: 1.0;\n\n#pragma include \"projection\"\n#pragma include \"picking\"\n\nvarying vec4 v_color;\nvarying vec4 v_dash_array;\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\nvoid main() {\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n styleMappingMat = mat4(\n 0.0, 0.0, 0.0, 0.0, // opacity - strokeOpacity - strokeWidth - empty\n 0.0, 0.0, 0.0, 0.0, // strokeR - strokeG - strokeB - strokeA\n 0.0, 0.0, 0.0, 0.0, // offsets[0] - offsets[1]\n 0.0, 0.0, 0.0, 0.0 // distance_ratio/distance/pixelLen/texV\n );\n\n float rowCount = u_cellTypeLayout[0][0]; // \u5F53\u524D\u7684\u6570\u636E\u7EB9\u7406\u6709\u51E0\u884C\n float columnCount = u_cellTypeLayout[0][1]; // \u5F53\u770B\u5230\u6570\u636E\u7EB9\u7406\u6709\u51E0\u5217\n float columnWidth = 1.0/columnCount; // \u5217\u5BBD\n float rowHeight = 1.0/rowCount; // \u884C\u9AD8\n float cellCount = calCellCount(); // opacity - strokeOpacity - strokeWidth - stroke - offsets\n float id = a_vertexId; // \u7B2Cn\u4E2A\u9876\u70B9\n float cellCurrentRow = floor(id * cellCount / columnCount) + 1.0; // \u8D77\u59CB\u70B9\u5728\u7B2C\u51E0\u884C\n float cellCurrentColumn = mod(id * cellCount, columnCount) + 1.0; // \u8D77\u59CB\u70B9\u5728\u7B2C\u51E0\u5217\n \n // cell \u56FA\u5B9A\u987A\u5E8F opacity -> strokeOpacity -> strokeWidth -> stroke ... \n // \u6309\u987A\u5E8F\u4ECE cell \u4E2D\u53D6\u503C\u3001\u82E5\u6CA1\u6709\u5219\u81EA\u52A8\u5F80\u4E0B\u53D6\u503C\n float textureOffset = 0.0; // \u5728 cell \u4E2D\u53D6\u503C\u7684\u504F\u79FB\u91CF\n\n vec2 opacityAndOffset = calOpacityAndOffset(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset, columnWidth, rowHeight);\n styleMappingMat[0][0] = opacityAndOffset.r;\n textureOffset = opacityAndOffset.g;\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n\n v_dash_array = pow(2.0, 20.0 - u_Zoom) * u_dash_array / a_Total_Distance;\n v_color = a_Color;\n\n vec3 size = a_Miter * setPickingSize(a_Size.x) * reverse_offset_normal(a_Normal);\n vec2 offset = project_pixel(size.xy);\n\n // \u8BBE\u7F6E\u6570\u636E\u96C6\u7684\u53C2\u6570\n styleMappingMat[3][0] = a_DistanceAndIndex.x / a_Total_Distance; // \u5F53\u524D\u70B9\u4F4D\u8DDD\u79BB\u5360\u7EBF\u603B\u957F\u7684\u6BD4\u4F8B\n styleMappingMat[3][1] = a_DistanceAndIndex.x; // \u5F53\u524D\u9876\u70B9\u7684\u8DDD\u79BB\n\n vec4 project_pos = project_position(vec4(a_Position.xy, 0, 1.0));\n\n // gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, a_Size.y, 1.0));\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n gl_Position = u_Mvp * (vec4(project_pos.xy + offset, project_pixel(a_Size.y), 1.0));\n } else {\n float lineHeight = a_Size.y;\n \n // #define COORDINATE_SYSTEM_P20 5.0\n // #define COORDINATE_SYSTEM_P20_OFFSET 6.0\n // amap1.x\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20 || u_CoordinateSystem == COORDINATE_SYSTEM_P20_OFFSET) {\n // \u4FDD\u6301\u9AD8\u5EA6\u76F8\u5BF9\u4E0D\u53D8\n lineHeight *= pow(2.0, 20.0 - u_Zoom);\n }\n\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, lineHeight, 1.0));\n }\n\n setPickingColor(a_PickingColor);\n}\n"; // basic line shader
|
|
25
|
+
|
|
26
|
+
/* babel-plugin-inline-import '../shaders/line_frag.glsl' */
|
|
20
27
|
var line_frag = "#define Animate 0.0\n#define LineTexture 1.0\nuniform float u_opacity : 1.0;\nuniform float u_textureBlend;\n\nuniform float u_borderWidth: 0.0;\n\nuniform vec3 u_blur;\nuniform vec4 u_borderColor;\nvarying vec4 v_color;\n\n// line texture\nuniform float u_line_texture;\nuniform sampler2D u_texture;\nuniform vec2 u_textSize;\n\nvarying vec2 v_iconMapUV;\n\n#pragma include \"picking\"\n\nuniform float u_time;\nuniform vec4 u_aimate: [ 0, 2., 1.0, 0.2 ]; // \u63A7\u5236\u8FD0\u52A8\n\nvarying mat4 styleMappingMat;\n// [animate, duration, interval, trailLength],\nvoid main() {\n float opacity = styleMappingMat[0][0];\n float animateSpeed = 0.0; // \u8FD0\u52A8\u901F\u5EA6\n float d_distance_ratio = styleMappingMat[3].r; // \u5F53\u524D\u70B9\u4F4D\u8DDD\u79BB\u5360\u7EBF\u603B\u957F\u7684\u6BD4\u4F8B\n gl_FragColor = v_color;\n // anti-alias\n // float blur = 1.0 - smoothstep(u_blur, 1., length(v_normal.xy));\n gl_FragColor.a *= opacity; // \u5168\u5C40\u900F\u660E\u5EA6\n if(u_aimate.x == Animate) {\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) + animateSpeed);\n alpha = (alpha + u_aimate.w -1.0) / u_aimate.w;\n alpha = smoothstep(0., 1., alpha);\n gl_FragColor.a *= alpha;\n }\n\n if(u_line_texture == LineTexture) { // while load texture\n float aDistance = styleMappingMat[3].g; // \u5F53\u524D\u9876\u70B9\u7684\u8DDD\u79BB\n float d_texPixelLen = styleMappingMat[3].b; // \u8D34\u56FE\u7684\u50CF\u7D20\u957F\u5EA6\uFF0C\u6839\u636E\u5730\u56FE\u5C42\u7EA7\u7F29\u653E\n float u = fract(mod(aDistance, d_texPixelLen)/d_texPixelLen - animateSpeed);\n float v = styleMappingMat[3].a; // \u7EBF\u56FE\u5C42\u8D34\u56FE\u90E8\u5206\u7684 v \u5750\u6807\u503C\n\n // v = max(smoothstep(0.95, 1.0, v), v);\n vec2 uv= v_iconMapUV / u_textSize + vec2(u, v) / u_textSize * 64.;\n \n // gl_FragColor = filterColor(gl_FragColor + texture2D(u_texture, vec2(u, v)));\n // gl_FragColor = filterColor(gl_FragColor + texture2D(u_texture, uv));\n vec4 pattern = texture2D(u_texture, uv);\n\n if(u_textureBlend == 0.0) { // normal\n pattern.a = 0.0;\n 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 = pattern;\n }\n } \n\n float v = styleMappingMat[3].a;\n float borderWidth = min(0.5, u_borderWidth);\n // \u7ED8\u5236 border\n if(borderWidth > 0.01) {\n float borderOuterWidth = borderWidth/2.0;\n\n if(v >= 1.0 - borderWidth || v <= borderWidth) {\n if(v > borderWidth) {\n float linear = smoothstep(0.0, 1.0, (v - (1.0 - borderWidth))/borderWidth);\n gl_FragColor.rgb = mix(gl_FragColor.rgb, u_borderColor.rgb, linear);\n } else if(v <= borderWidth) {\n float linear = smoothstep(0.0, 1.0, v/borderWidth);\n gl_FragColor.rgb = mix(u_borderColor.rgb, gl_FragColor.rgb, linear);\n }\n }\n\n if(v < borderOuterWidth) {\n gl_FragColor.a = mix(0.0, gl_FragColor.a, v/borderOuterWidth);\n } else if(v > 1.0 - borderOuterWidth) {\n gl_FragColor.a = mix(gl_FragColor.a, 0.0, (v - (1.0 - borderOuterWidth))/borderOuterWidth);\n }\n }\n\n // blur\n float blurV = styleMappingMat[3][3];\n if(blurV < 0.5) {\n gl_FragColor.a *= mix(u_blur.r, u_blur.g, blurV/0.5);\n } else {\n gl_FragColor.a *= mix(u_blur.g, u_blur.b, (blurV - 0.5)/0.5);\n }\n \n\n gl_FragColor = filterColor(gl_FragColor);\n}\n";
|
|
21
|
-
|
|
28
|
+
|
|
29
|
+
/* babel-plugin-inline-import '../shaders/line_vert.glsl' */
|
|
30
|
+
var line_vert = "\n#define Animate 0.0\n\nattribute float a_Miter;\nattribute vec4 a_Color;\nattribute vec2 a_Size;\nattribute vec3 a_Normal;\nattribute vec3 a_Position;\n\nattribute vec2 a_iconMapUV;\n\n// dash line\nattribute float a_Total_Distance;\nattribute vec2 a_DistanceAndIndex;\n\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\nuniform vec4 u_aimate: [ 0, 2., 1.0, 0.2 ];\nuniform float u_icon_step: 100;\n\nuniform float u_heightfixed: 0.0;\nuniform float u_vertexScale: 1.0;\nuniform float u_raisingHeight: 0.0;\n\n#pragma include \"projection\"\n#pragma include \"picking\"\n\nvarying vec4 v_color;\n\n// texV \u7EBF\u56FE\u5C42 - \u8D34\u56FE\u90E8\u5206\u7684 v \u5750\u6807\uFF08\u7EBF\u7684\u5BBD\u5EA6\u65B9\u5411\uFF09\nvarying vec2 v_iconMapUV;\n\n\nuniform float u_linearColor: 0;\nuniform float u_arrow: 0.0;\nuniform float u_arrowHeight: 3.0;\nuniform float u_arrowWidth: 2.0;\nuniform float u_tailWidth: 1.0;\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\nvec2 calculateArrow(vec2 offset) {\n /*\n * \u5728\u652F\u6301\u7BAD\u5934\u7684\u65F6\u5019\uFF0C\u7B2C\u4E8C\u3001\u7B2C\u4E09\u7EC4\u9876\u70B9\u662F\u989D\u5916\u63D2\u5165\u7528\u4E8E\u6784\u5EFA\u9876\u70B9\u7684\n */\n float arrowFlag = -1.0;\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) {\n // \u9AD8\u5FB7 2.0 \u7684\u65CB\u8F6C\u89D2\u5EA6\u4E0D\u540C\n arrowFlag = 1.0;\n }\n float pi = arrowFlag * 3.1415926/2.;\n if(a_Miter < 0.) {\n // \u6839\u636E\u7EBF\u7684\u4E24\u4FA7\u504F\u79FB\u4E0D\u540C\u3001\u65CB\u8F6C\u7684\u65B9\u5411\u76F8\u53CD\n pi = -pi;\n }\n highp float angle_sin = sin(pi);\n highp float angle_cos = cos(pi);\n // \u8BA1\u7B97\u5782\u76F4\u4E0E\u7EBF\u65B9\u5411\u7684\u65CB\u8F6C\u77E9\u9635\n mat2 rotation_matrix = mat2(angle_cos, -1.0 * angle_sin, angle_sin, angle_cos);\n float arrowWidth = u_arrowWidth;\n float arrowHeight = u_arrowHeight;\n\n vec2 arrowOffset = vec2(0.0);\n /*\n * a_DistanceAndIndex.y \u7528\u4E8E\u6807\u8BB0\u5F53\u524D\u9876\u70B9\u5C5E\u4E8E\u54EA\u4E00\u7EC4\uFF08\u4E24\u4E2A\u9876\u70B9\u4E00\u7EC4\uFF0C\u6784\u6210\u7EBF\u7684\u5176\u5B9E\u662F\u77E9\u5F62\uFF0C\u6700\u7B80\u9700\u8981\u56DB\u4E2A\u9876\u70B9\u3001\u4E24\u7EC4\u9876\u70B9\u6784\u6210\uFF09\n */\n if(a_DistanceAndIndex.y == 0.0) {\n // \u7BAD\u5934\u5C16\u90E8\n offset = vec2(0.0);\n } else if(a_DistanceAndIndex.y == 1.0) {\n // \u7BAD\u5934\u4E24\u4FA7\n arrowOffset = rotation_matrix*(offset * arrowHeight);\n offset += arrowOffset; // \u6CBF\u7EBF\u504F\u79FB\n offset = offset * arrowWidth; // \u5782\u76F4\u7EBF\u5411\u5916\u504F\u79FB\uFF08\u662F\u6784\u5EFA\u7BAD\u5934\u4E24\u4FA7\u7684\u9876\u70B9\uFF09\n } else if(a_DistanceAndIndex.y == 2.0 || a_DistanceAndIndex.y == 3.0 || a_DistanceAndIndex.y == 4.0) {\n // \u504F\u79FB\u5176\u4F59\u7684\u70B9\u4F4D\uFF08\u5C06\u957F\u5EA6\u8BA9\u4F4D\u7ED9\u7BAD\u5934\uFF09\n arrowOffset = rotation_matrix*(offset * arrowHeight) * arrowWidth;\n offset += arrowOffset;// \u6CBF\u7EBF\u504F\u79FB\n }\n\n return offset;\n}\n\nvoid main() {\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n styleMappingMat = mat4(\n 0.0, 0.0, 0.0, 0.0, // opacity - strokeOpacity - strokeWidth - empty\n 0.0, 0.0, 0.0, 0.0, // strokeR - strokeG - strokeB - strokeA\n 0.0, 0.0, 0.0, 0.0, // offsets[0] - offsets[1]\n 0.0, 0.0, 0.0, 0.0 // distance_ratio/distance/pixelLen/texV\n );\n\n float rowCount = u_cellTypeLayout[0][0]; // \u5F53\u524D\u7684\u6570\u636E\u7EB9\u7406\u6709\u51E0\u884C\n float columnCount = u_cellTypeLayout[0][1]; // \u5F53\u770B\u5230\u6570\u636E\u7EB9\u7406\u6709\u51E0\u5217\n float columnWidth = 1.0/columnCount; // \u5217\u5BBD\n float rowHeight = 1.0/rowCount; // \u884C\u9AD8\n float cellCount = calCellCount(); // opacity - strokeOpacity - strokeWidth - stroke - offsets\n float id = a_vertexId; // \u7B2Cn\u4E2A\u9876\u70B9\n float cellCurrentRow = floor(id * cellCount / columnCount) + 1.0; // \u8D77\u59CB\u70B9\u5728\u7B2C\u51E0\u884C\n float cellCurrentColumn = mod(id * cellCount, columnCount) + 1.0; // \u8D77\u59CB\u70B9\u5728\u7B2C\u51E0\u5217\n \n // cell \u56FA\u5B9A\u987A\u5E8F opacity -> strokeOpacity -> strokeWidth -> stroke ... \n // \u6309\u987A\u5E8F\u4ECE cell \u4E2D\u53D6\u503C\u3001\u82E5\u6CA1\u6709\u5219\u81EA\u52A8\u5F80\u4E0B\u53D6\u503C\n float textureOffset = 0.0; // \u5728 cell \u4E2D\u53D6\u503C\u7684\u504F\u79FB\u91CF\n\n vec2 opacityAndOffset = calOpacityAndOffset(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset, columnWidth, rowHeight);\n styleMappingMat[0][0] = opacityAndOffset.r;\n textureOffset = opacityAndOffset.g;\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n\n float d_texPixelLen; // \u8D34\u56FE\u7684\u50CF\u7D20\u957F\u5EA6\uFF0C\u6839\u636E\u5730\u56FE\u5C42\u7EA7\u7F29\u653E\n\n v_iconMapUV = a_iconMapUV;\n d_texPixelLen = project_float_pixel(u_icon_step);\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) {\n d_texPixelLen *= 10.0;\n }\n\n v_color = a_Color;\n\n vec3 size = a_Miter * setPickingSize(a_Size.x) * reverse_offset_normal(a_Normal);\n \n vec2 offset = project_pixel(size.xy);\n\n float lineDistance = a_DistanceAndIndex.x;\n float currentLinePointRatio = lineDistance / a_Total_Distance;\n \n if(u_arrow > 0.0) {\n // \u8BA1\u7B97\u7BAD\u5934\n offset = calculateArrow(offset);\n\n if(a_DistanceAndIndex.y > 4.0) {\n offset *= mix(1.0, u_tailWidth, currentLinePointRatio);\n }\n }\n\n float lineOffsetWidth = length(offset + offset * sign(a_Miter)); // \u7EBF\u6A2A\u5411\u504F\u79FB\u7684\u8DDD\u79BB\uFF08\u5411\u4E24\u4FA7\u504F\u79FB\u7684\u548C\uFF09\n float linePixelSize = project_pixel(a_Size.x) * 2.0; // \u5B9A\u70B9\u4F4D\u7F6E\u504F\u79FB\uFF0C\u6309\u5730\u56FE\u7B49\u7EA7\u7F29\u653E\u540E\u7684\u8DDD\u79BB \u5355\u4FA7 * 2\n float texV = lineOffsetWidth/linePixelSize; // \u7EBF\u56FE\u5C42\u8D34\u56FE\u90E8\u5206\u7684 v \u5750\u6807\u503C\n\n // \u8BBE\u7F6E\u6570\u636E\u96C6\u7684\u53C2\u6570\n styleMappingMat[3][0] = currentLinePointRatio; // \u5F53\u524D\u70B9\u4F4D\u8DDD\u79BB\u5360\u7EBF\u603B\u957F\u7684\u6BD4\u4F8B\n styleMappingMat[3][1] = lineDistance; // \u5F53\u524D\u9876\u70B9\u7684\u8DDD\u79BB\n styleMappingMat[3][2] = d_texPixelLen; // \u8D34\u56FE\u7684\u50CF\u7D20\u957F\u5EA6\uFF0C\u6839\u636E\u5730\u56FE\u5C42\u7EA7\u7F29\u653E\n styleMappingMat[3][3] = texV; // \u7EBF\u56FE\u5C42\u8D34\u56FE\u90E8\u5206\u7684 v \u5750\u6807\u503C\n\n vec4 project_pos = project_position(vec4(a_Position.xy, 0, 1.0));\n\n // gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, a_Size.y, 1.0));\n\n float h = float(a_Position.z) * u_vertexScale; // \u7EBF\u9876\u70B9\u7684\u9AD8\u5EA6 - \u517C\u5BB9\u4E0D\u5B58\u5728\u7B2C\u4E09\u4E2A\u6570\u503C\u7684\u60C5\u51B5 vertex height\n float lineHeight = a_Size.y; // size \u7B2C\u4E8C\u4E2A\u53C2\u6570\u4EE3\u8868\u7684\u9AD8\u5EA6 [linewidth, lineheight]\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n lineHeight *= 0.2; // \u4FDD\u6301\u548C amap/mapbox \u4E00\u81F4\u7684\u6548\u679C\n h *= 0.2;\n if(u_heightfixed < 1.0) {\n lineHeight = project_pixel(a_Size.y);\n }\n gl_Position = u_Mvp * (vec4(project_pos.xy + offset, lineHeight + h + u_raisingHeight, 1.0));\n } else {\n // mapbox - amap\n \n // \u517C\u5BB9 mapbox \u5728\u7EBF\u9AD8\u5EA6\u4E0A\u7684\u6548\u679C\u8868\u73B0\u57FA\u672C\u4E00\u81F4\n if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {\n // mapbox\n // \u4FDD\u6301\u9AD8\u5EA6\u76F8\u5BF9\u4E0D\u53D8\n float mapboxZoomScale = 4.0/pow(2.0, 21.0 - u_Zoom);\n h *= mapboxZoomScale;\n h += u_raisingHeight * mapboxZoomScale;\n if(u_heightfixed > 0.0) {\n lineHeight *= mapboxZoomScale;\n }\n \n } else {\n // amap\n h += u_raisingHeight;\n // lineHeight \u9876\u70B9\u504F\u79FB\u9AD8\u5EA6\n if(u_heightfixed < 1.0) {\n lineHeight *= pow(2.0, 20.0 - u_Zoom);\n }\n }\n\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, lineHeight + h, 1.0));\n }\n\n setPickingColor(a_PickingColor);\n}\n"; // other function shaders
|
|
31
|
+
|
|
32
|
+
/* babel-plugin-inline-import '../shaders/linear/line_linear_frag.glsl' */
|
|
22
33
|
var linear_line_frag = "varying vec4 v_color;\nuniform float u_linearDir: 1.0;\nuniform float u_linearColor: 0;\nuniform vec4 u_sourceColor;\nuniform vec4 u_targetColor;\n\n#pragma include \"picking\"\n\n\nvarying mat4 styleMappingMat;\n\nvoid main() {\n float opacity = styleMappingMat[0][0];\n float linearRadio = styleMappingMat[3][0]; // \u5F53\u524D\u70B9\u4F4D\u8DDD\u79BB\u5360\u7EBF\u603B\u957F\u7684\u6BD4\u4F8B\n if(u_linearDir < 1.0) {\n linearRadio = styleMappingMat[3][3];\n }\n\n if(u_linearColor == 1.0) { // \u4F7F\u7528\u6E10\u53D8\u989C\u8272\n gl_FragColor = mix(u_sourceColor, u_targetColor, linearRadio);\n } else { // \u4F7F\u7528 color \u65B9\u6CD5\u4F20\u5165\u7684\u989C\u8272\n gl_FragColor = v_color;\n }\n\n gl_FragColor.a *= opacity; // \u5168\u5C40\u900F\u660E\u5EA6\n gl_FragColor = filterColor(gl_FragColor);\n}\n";
|
|
23
34
|
var lineStyleObj = {
|
|
24
35
|
solid: 0.0,
|
|
25
36
|
dash: 1.0
|
|
26
37
|
};
|
|
27
38
|
|
|
28
|
-
var LineModel = function (_BaseModel) {
|
|
39
|
+
var LineModel = /*#__PURE__*/function (_BaseModel) {
|
|
29
40
|
_inherits(LineModel, _BaseModel);
|
|
30
41
|
|
|
31
42
|
var _super = _createSuper(LineModel);
|
|
@@ -41,8 +52,6 @@ var LineModel = function (_BaseModel) {
|
|
|
41
52
|
|
|
42
53
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
43
54
|
|
|
44
|
-
_defineProperty(_assertThisInitialized(_this), "texture", void 0);
|
|
45
|
-
|
|
46
55
|
_defineProperty(_assertThisInitialized(_this), "updateTexture", function () {
|
|
47
56
|
var createTexture2D = _this.rendererService.createTexture2D;
|
|
48
57
|
|
|
@@ -115,9 +124,11 @@ var LineModel = function (_BaseModel) {
|
|
|
115
124
|
|
|
116
125
|
if (this.rendererService.getDirty()) {
|
|
117
126
|
this.texture.bind();
|
|
118
|
-
}
|
|
127
|
+
} // 转化渐变色
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
var useLinearColor = 0; // 默认不生效
|
|
119
131
|
|
|
120
|
-
var useLinearColor = 0;
|
|
121
132
|
var sourceColorArr = [0, 0, 0, 0];
|
|
122
133
|
var targetColorArr = [0, 0, 0, 0];
|
|
123
134
|
|
|
@@ -140,7 +151,8 @@ var LineModel = function (_BaseModel) {
|
|
|
140
151
|
width = _this$calDataFrame.width,
|
|
141
152
|
height = _this$calDataFrame.height;
|
|
142
153
|
|
|
143
|
-
this.rowCount = height;
|
|
154
|
+
this.rowCount = height; // 当前数据纹理有多少行
|
|
155
|
+
|
|
144
156
|
this.dataTexture = this.cellLength > 0 && data.length > 0 ? this.createTexture2D({
|
|
145
157
|
flipY: true,
|
|
146
158
|
data: data,
|
|
@@ -160,25 +172,34 @@ var LineModel = function (_BaseModel) {
|
|
|
160
172
|
|
|
161
173
|
return {
|
|
162
174
|
u_dataTexture: this.dataTexture,
|
|
175
|
+
// 数据纹理 - 有数据映射的时候纹理中带数据,若没有任何数据映射时纹理是 [1]
|
|
163
176
|
u_cellTypeLayout: this.getCellTypeLayout(),
|
|
164
|
-
u_opacity:
|
|
177
|
+
u_opacity: isNumber(opacity) ? opacity : 1.0,
|
|
165
178
|
u_textureBlend: textureBlend === TextureBlend.NORMAL ? 0.0 : 1.0,
|
|
166
179
|
u_line_type: lineStyleObj[lineType],
|
|
167
180
|
u_dash_array: dashArray,
|
|
168
181
|
u_blur: blur,
|
|
182
|
+
// 纹理支持参数
|
|
169
183
|
u_texture: this.texture,
|
|
184
|
+
// 贴图
|
|
170
185
|
u_line_texture: lineTexture ? 1.0 : 0.0,
|
|
186
|
+
// 传入线的标识
|
|
171
187
|
u_icon_step: iconStep,
|
|
172
188
|
u_textSize: [1024, this.iconService.canvasHeight || 128],
|
|
189
|
+
// line border 参数
|
|
173
190
|
u_borderWidth: borderWidth,
|
|
174
191
|
u_borderColor: rgb2arr(borderColor),
|
|
192
|
+
// 渐变色支持参数
|
|
175
193
|
u_linearDir: linearDir === LinearDir.VERTICAL ? 1.0 : 0.0,
|
|
176
194
|
u_linearColor: useLinearColor,
|
|
177
195
|
u_sourceColor: sourceColorArr,
|
|
178
196
|
u_targetColor: targetColorArr,
|
|
197
|
+
// 是否固定高度
|
|
179
198
|
u_heightfixed: Number(heightfixed),
|
|
199
|
+
// 顶点高度 scale
|
|
180
200
|
u_vertexScale: vertexHeightScale,
|
|
181
201
|
u_raisingHeight: Number(raisingHeight),
|
|
202
|
+
// arrow
|
|
182
203
|
u_arrow: Number(arrow.enable),
|
|
183
204
|
u_arrowHeight: arrow.arrowHeight || 3,
|
|
184
205
|
u_arrowWidth: arrow.arrowWidth || 2,
|
|
@@ -255,6 +276,11 @@ var LineModel = function (_BaseModel) {
|
|
|
255
276
|
callbackModel([]);
|
|
256
277
|
});
|
|
257
278
|
}
|
|
279
|
+
/**
|
|
280
|
+
* 根据参数获取不同的 shader 代码
|
|
281
|
+
* @returns
|
|
282
|
+
*/
|
|
283
|
+
|
|
258
284
|
}, {
|
|
259
285
|
key: "getShaders",
|
|
260
286
|
value: function getShaders() {
|
|
@@ -272,6 +298,7 @@ var LineModel = function (_BaseModel) {
|
|
|
272
298
|
}
|
|
273
299
|
|
|
274
300
|
if (sourceColor && targetColor) {
|
|
301
|
+
// 分离 linear 功能
|
|
275
302
|
return {
|
|
276
303
|
frag: linear_line_frag,
|
|
277
304
|
vert: line_vert,
|
|
@@ -296,6 +323,7 @@ var LineModel = function (_BaseModel) {
|
|
|
296
323
|
descriptor: {
|
|
297
324
|
name: 'a_DistanceAndIndex',
|
|
298
325
|
buffer: {
|
|
326
|
+
// give the WebGL driver a hint that this buffer may change
|
|
299
327
|
usage: gl.STATIC_DRAW,
|
|
300
328
|
data: [],
|
|
301
329
|
type: gl.FLOAT
|
|
@@ -312,6 +340,7 @@ var LineModel = function (_BaseModel) {
|
|
|
312
340
|
descriptor: {
|
|
313
341
|
name: 'a_Total_Distance',
|
|
314
342
|
buffer: {
|
|
343
|
+
// give the WebGL driver a hint that this buffer may change
|
|
315
344
|
usage: gl.STATIC_DRAW,
|
|
316
345
|
data: [],
|
|
317
346
|
type: gl.FLOAT
|
|
@@ -328,6 +357,7 @@ var LineModel = function (_BaseModel) {
|
|
|
328
357
|
descriptor: {
|
|
329
358
|
name: 'a_Size',
|
|
330
359
|
buffer: {
|
|
360
|
+
// give the WebGL driver a hint that this buffer may change
|
|
331
361
|
usage: gl.DYNAMIC_DRAW,
|
|
332
362
|
data: [],
|
|
333
363
|
type: gl.FLOAT
|
|
@@ -339,13 +369,15 @@ var LineModel = function (_BaseModel) {
|
|
|
339
369
|
return Array.isArray(size) ? [size[0], size[1]] : [size, 0];
|
|
340
370
|
}
|
|
341
371
|
}
|
|
342
|
-
});
|
|
372
|
+
}); // point layer size;
|
|
373
|
+
|
|
343
374
|
this.styleAttributeService.registerStyleAttribute({
|
|
344
375
|
name: 'normal',
|
|
345
376
|
type: AttributeType.Attribute,
|
|
346
377
|
descriptor: {
|
|
347
378
|
name: 'a_Normal',
|
|
348
379
|
buffer: {
|
|
380
|
+
// give the WebGL driver a hint that this buffer may change
|
|
349
381
|
usage: gl.STATIC_DRAW,
|
|
350
382
|
data: [],
|
|
351
383
|
type: gl.FLOAT
|
|
@@ -362,6 +394,7 @@ var LineModel = function (_BaseModel) {
|
|
|
362
394
|
descriptor: {
|
|
363
395
|
name: 'a_Miter',
|
|
364
396
|
buffer: {
|
|
397
|
+
// give the WebGL driver a hint that this buffer may change
|
|
365
398
|
usage: gl.STATIC_DRAW,
|
|
366
399
|
data: [],
|
|
367
400
|
type: gl.FLOAT
|
|
@@ -378,6 +411,7 @@ var LineModel = function (_BaseModel) {
|
|
|
378
411
|
descriptor: {
|
|
379
412
|
name: 'a_iconMapUV',
|
|
380
413
|
buffer: {
|
|
414
|
+
// give the WebGL driver a hint that this buffer may change
|
|
381
415
|
usage: gl.DYNAMIC_DRAW,
|
|
382
416
|
data: [],
|
|
383
417
|
type: gl.FLOAT
|
|
@@ -405,5 +439,4 @@ var LineModel = function (_BaseModel) {
|
|
|
405
439
|
return LineModel;
|
|
406
440
|
}(BaseModel);
|
|
407
441
|
|
|
408
|
-
export { LineModel as default };
|
|
409
|
-
//# sourceMappingURL=line.js.map
|
|
442
|
+
export { LineModel as default };
|
|
@@ -5,7 +5,6 @@ import _inherits from "@babel/runtime/helpers/inherits";
|
|
|
5
5
|
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
6
6
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
7
7
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
8
|
-
import _isNumber from "lodash/isNumber";
|
|
9
8
|
|
|
10
9
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
11
10
|
|
|
@@ -13,13 +12,18 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
|
|
|
13
12
|
|
|
14
13
|
import { AttributeType, gl } from '@antv/l7-core';
|
|
15
14
|
import { generateColorRamp, getMask } from '@antv/l7-utils';
|
|
16
|
-
import
|
|
17
|
-
import
|
|
18
|
-
import {
|
|
15
|
+
import { isNumber } from 'lodash';
|
|
16
|
+
import BaseModel from "../../core/BaseModel";
|
|
17
|
+
import { LinearDir } from "../../core/interface";
|
|
18
|
+
import { LineTriangulation } from "../../core/triangulation";
|
|
19
|
+
|
|
20
|
+
/* babel-plugin-inline-import '../shaders/linearLine/line_linear_frag.glsl' */
|
|
19
21
|
var linear_line_frag = "uniform float u_opacity : 1.0;\nuniform sampler2D u_texture;\nuniform float u_linearDir: 1.0;\n\n#pragma include \"picking\"\n\nvarying mat4 styleMappingMat;\n\nvoid main() {\n float opacity = styleMappingMat[0][0];\n float linearRadio = styleMappingMat[3].r; // \u5F53\u524D\u70B9\u4F4D\u8DDD\u79BB\u5360\u7EBF\u603B\u957F\u7684\u6BD4\u4F8B\n if(u_linearDir < 1.0) {\n linearRadio = styleMappingMat[3][3];\n }\n\n gl_FragColor = texture2D(u_texture, vec2(linearRadio, 0.5));\n\n gl_FragColor.a *= opacity; // \u5168\u5C40\u900F\u660E\u5EA6\n gl_FragColor = filterColor(gl_FragColor);\n}\n";
|
|
22
|
+
|
|
23
|
+
/* babel-plugin-inline-import '../shaders/linearLine/line_linear_vert.glsl' */
|
|
20
24
|
var linear_line_vert = "\nattribute float a_Miter;\nattribute vec2 a_Size;\nattribute vec3 a_Normal;\nattribute vec3 a_Position;\n\n// dash line\nattribute float a_Total_Distance;\nattribute vec2 a_DistanceAndIndex;\n\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\n\nuniform float u_heightfixed: 0.0;\nuniform float u_vertexScale: 1.0;\nuniform float u_raisingHeight: 0.0;\n\nuniform float u_opacity: 1.0;\n\n#pragma include \"projection\"\n#pragma include \"picking\"\n\nvarying mat4 styleMappingMat; // \u7528\u4E8E\u5C06\u5728\u9876\u70B9\u7740\u8272\u5668\u4E2D\u8BA1\u7B97\u597D\u7684\u6837\u5F0F\u503C\u4F20\u9012\u7ED9\u7247\u5143\n\n#pragma include \"styleMapping\"\n#pragma include \"styleMappingCalOpacity\"\n\nvoid main() {\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n styleMappingMat = mat4(\n 0.0, 0.0, 0.0, 0.0, // opacity - strokeOpacity - strokeWidth - empty\n 0.0, 0.0, 0.0, 0.0, // strokeR - strokeG - strokeB - strokeA\n 0.0, 0.0, 0.0, 0.0, // offsets[0] - offsets[1]\n 0.0, 0.0, 0.0, 0.0 // distance_ratio/distance/pixelLen/texV\n );\n\n float rowCount = u_cellTypeLayout[0][0]; // \u5F53\u524D\u7684\u6570\u636E\u7EB9\u7406\u6709\u51E0\u884C\n float columnCount = u_cellTypeLayout[0][1]; // \u5F53\u770B\u5230\u6570\u636E\u7EB9\u7406\u6709\u51E0\u5217\n float columnWidth = 1.0/columnCount; // \u5217\u5BBD\n float rowHeight = 1.0/rowCount; // \u884C\u9AD8\n float cellCount = calCellCount(); // opacity - strokeOpacity - strokeWidth - stroke - offsets\n float id = a_vertexId; // \u7B2Cn\u4E2A\u9876\u70B9\n float cellCurrentRow = floor(id * cellCount / columnCount) + 1.0; // \u8D77\u59CB\u70B9\u5728\u7B2C\u51E0\u884C\n float cellCurrentColumn = mod(id * cellCount, columnCount) + 1.0; // \u8D77\u59CB\u70B9\u5728\u7B2C\u51E0\u5217\n \n // cell \u56FA\u5B9A\u987A\u5E8F opacity -> strokeOpacity -> strokeWidth -> stroke ... \n // \u6309\u987A\u5E8F\u4ECE cell \u4E2D\u53D6\u503C\u3001\u82E5\u6CA1\u6709\u5219\u81EA\u52A8\u5F80\u4E0B\u53D6\u503C\n float textureOffset = 0.0; // \u5728 cell \u4E2D\u53D6\u503C\u7684\u504F\u79FB\u91CF\n\n vec2 opacityAndOffset = calOpacityAndOffset(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset, columnWidth, rowHeight);\n styleMappingMat[0][0] = opacityAndOffset.r;\n textureOffset = opacityAndOffset.g;\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n\n vec3 size = a_Miter * setPickingSize(a_Size.x) * reverse_offset_normal(a_Normal);\n \n vec2 offset = project_pixel(size.xy);\n\n float lineDistance = a_DistanceAndIndex.x;\n float currentLinePointRatio = lineDistance / a_Total_Distance;\n \n\n float lineOffsetWidth = length(offset + offset * sign(a_Miter)); // \u7EBF\u6A2A\u5411\u504F\u79FB\u7684\u8DDD\u79BB\uFF08\u5411\u4E24\u4FA7\u504F\u79FB\u7684\u548C\uFF09\n float linePixelSize = project_pixel(a_Size.x) * 2.0; // \u5B9A\u70B9\u4F4D\u7F6E\u504F\u79FB\uFF0C\u6309\u5730\u56FE\u7B49\u7EA7\u7F29\u653E\u540E\u7684\u8DDD\u79BB \u5355\u4FA7 * 2\n float texV = lineOffsetWidth/linePixelSize; // \u7EBF\u56FE\u5C42\u8D34\u56FE\u90E8\u5206\u7684 v \u5750\u6807\u503C\n\n // \u8BBE\u7F6E\u6570\u636E\u96C6\u7684\u53C2\u6570\n styleMappingMat[3][0] = currentLinePointRatio; // \u5F53\u524D\u70B9\u4F4D\u8DDD\u79BB\u5360\u7EBF\u603B\u957F\u7684\u6BD4\u4F8B\n styleMappingMat[3][3] = texV; // \u7EBF\u56FE\u5C42\u8D34\u56FE\u90E8\u5206\u7684 v \u5750\u6807\u503C\n\n vec4 project_pos = project_position(vec4(a_Position.xy, 0, 1.0));\n\n // gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, a_Size.y, 1.0));\n\n float h = float(a_Position.z) * u_vertexScale; // \u7EBF\u9876\u70B9\u7684\u9AD8\u5EA6 - \u517C\u5BB9\u4E0D\u5B58\u5728\u7B2C\u4E09\u4E2A\u6570\u503C\u7684\u60C5\u51B5 vertex height\n float lineHeight = a_Size.y; // size \u7B2C\u4E8C\u4E2A\u53C2\u6570\u4EE3\u8868\u7684\u9AD8\u5EA6 [linewidth, lineheight]\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n lineHeight *= 0.2; // \u4FDD\u6301\u548C amap/mapbox \u4E00\u81F4\u7684\u6548\u679C\n h *= 0.2;\n if(u_heightfixed < 1.0) {\n lineHeight = project_pixel(a_Size.y);\n }\n gl_Position = u_Mvp * (vec4(project_pos.xy + offset, lineHeight + h + u_raisingHeight, 1.0));\n } else {\n // mapbox - amap\n \n // \u517C\u5BB9 mapbox \u5728\u7EBF\u9AD8\u5EA6\u4E0A\u7684\u6548\u679C\u8868\u73B0\u57FA\u672C\u4E00\u81F4\n if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {\n // mapbox\n // \u4FDD\u6301\u9AD8\u5EA6\u76F8\u5BF9\u4E0D\u53D8\n float mapboxZoomScale = 4.0/pow(2.0, 21.0 - u_Zoom);\n h *= mapboxZoomScale;\n h += u_raisingHeight * mapboxZoomScale;\n if(u_heightfixed > 0.0) {\n lineHeight *= mapboxZoomScale;\n }\n \n } else {\n // amap\n h += u_raisingHeight;\n // lineHeight \u9876\u70B9\u504F\u79FB\u9AD8\u5EA6\n if(u_heightfixed < 1.0) {\n lineHeight *= pow(2.0, 20.0 - u_Zoom);\n }\n }\n\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, lineHeight + h, 1.0));\n }\n\n setPickingColor(a_PickingColor);\n}\n";
|
|
21
25
|
|
|
22
|
-
var LinearLineModel = function (_BaseModel) {
|
|
26
|
+
var LinearLineModel = /*#__PURE__*/function (_BaseModel) {
|
|
23
27
|
_inherits(LinearLineModel, _BaseModel);
|
|
24
28
|
|
|
25
29
|
var _super = _createSuper(LinearLineModel);
|
|
@@ -35,8 +39,6 @@ var LinearLineModel = function (_BaseModel) {
|
|
|
35
39
|
|
|
36
40
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
37
41
|
|
|
38
|
-
_defineProperty(_assertThisInitialized(_this), "colorTexture", void 0);
|
|
39
|
-
|
|
40
42
|
_defineProperty(_assertThisInitialized(_this), "updateTexture", function () {
|
|
41
43
|
var createTexture2D = _this.rendererService.createTexture2D;
|
|
42
44
|
|
|
@@ -95,7 +97,8 @@ var LinearLineModel = function (_BaseModel) {
|
|
|
95
97
|
width = _this$calDataFrame.width,
|
|
96
98
|
height = _this$calDataFrame.height;
|
|
97
99
|
|
|
98
|
-
this.rowCount = height;
|
|
100
|
+
this.rowCount = height; // 当前数据纹理有多少行
|
|
101
|
+
|
|
99
102
|
this.dataTexture = this.cellLength > 0 && data.length > 0 ? this.createTexture2D({
|
|
100
103
|
flipY: true,
|
|
101
104
|
data: data,
|
|
@@ -115,11 +118,16 @@ var LinearLineModel = function (_BaseModel) {
|
|
|
115
118
|
|
|
116
119
|
return {
|
|
117
120
|
u_dataTexture: this.dataTexture,
|
|
121
|
+
// 数据纹理 - 有数据映射的时候纹理中带数据,若没有任何数据映射时纹理是 [1]
|
|
118
122
|
u_cellTypeLayout: this.getCellTypeLayout(),
|
|
119
123
|
u_linearDir: linearDir === LinearDir.VERTICAL ? 1.0 : 0.0,
|
|
120
|
-
u_opacity:
|
|
124
|
+
u_opacity: isNumber(opacity) ? opacity : 1.0,
|
|
125
|
+
// 纹理支持参数
|
|
121
126
|
u_texture: this.colorTexture,
|
|
127
|
+
// 贴图
|
|
128
|
+
// 是否固定高度
|
|
122
129
|
u_heightfixed: Number(heightfixed),
|
|
130
|
+
// 顶点高度 scale
|
|
123
131
|
u_vertexScale: vertexHeightScale,
|
|
124
132
|
u_raisingHeight: Number(raisingHeight)
|
|
125
133
|
};
|
|
@@ -176,6 +184,7 @@ var LinearLineModel = function (_BaseModel) {
|
|
|
176
184
|
descriptor: {
|
|
177
185
|
name: 'a_DistanceAndIndex',
|
|
178
186
|
buffer: {
|
|
187
|
+
// give the WebGL driver a hint that this buffer may change
|
|
179
188
|
usage: gl.STATIC_DRAW,
|
|
180
189
|
data: [],
|
|
181
190
|
type: gl.FLOAT
|
|
@@ -192,6 +201,7 @@ var LinearLineModel = function (_BaseModel) {
|
|
|
192
201
|
descriptor: {
|
|
193
202
|
name: 'a_Total_Distance',
|
|
194
203
|
buffer: {
|
|
204
|
+
// give the WebGL driver a hint that this buffer may change
|
|
195
205
|
usage: gl.STATIC_DRAW,
|
|
196
206
|
data: [],
|
|
197
207
|
type: gl.FLOAT
|
|
@@ -208,6 +218,7 @@ var LinearLineModel = function (_BaseModel) {
|
|
|
208
218
|
descriptor: {
|
|
209
219
|
name: 'a_Size',
|
|
210
220
|
buffer: {
|
|
221
|
+
// give the WebGL driver a hint that this buffer may change
|
|
211
222
|
usage: gl.DYNAMIC_DRAW,
|
|
212
223
|
data: [],
|
|
213
224
|
type: gl.FLOAT
|
|
@@ -219,18 +230,21 @@ var LinearLineModel = function (_BaseModel) {
|
|
|
219
230
|
return Array.isArray(size) ? [size[0], size[1]] : [size, 0];
|
|
220
231
|
}
|
|
221
232
|
}
|
|
222
|
-
});
|
|
233
|
+
}); // point layer size;
|
|
234
|
+
|
|
223
235
|
this.styleAttributeService.registerStyleAttribute({
|
|
224
236
|
name: 'normal',
|
|
225
237
|
type: AttributeType.Attribute,
|
|
226
238
|
descriptor: {
|
|
227
239
|
name: 'a_Normal',
|
|
228
240
|
buffer: {
|
|
241
|
+
// give the WebGL driver a hint that this buffer may change
|
|
229
242
|
usage: gl.STATIC_DRAW,
|
|
230
243
|
data: [],
|
|
231
244
|
type: gl.FLOAT
|
|
232
245
|
},
|
|
233
246
|
size: 3,
|
|
247
|
+
// @ts-ignore
|
|
234
248
|
update: function update(feature, featureIdx, vertex, attributeIdx, normal) {
|
|
235
249
|
return normal;
|
|
236
250
|
}
|
|
@@ -242,6 +256,7 @@ var LinearLineModel = function (_BaseModel) {
|
|
|
242
256
|
descriptor: {
|
|
243
257
|
name: 'a_Miter',
|
|
244
258
|
buffer: {
|
|
259
|
+
// give the WebGL driver a hint that this buffer may change
|
|
245
260
|
usage: gl.STATIC_DRAW,
|
|
246
261
|
data: [],
|
|
247
262
|
type: gl.FLOAT
|
|
@@ -258,5 +273,4 @@ var LinearLineModel = function (_BaseModel) {
|
|
|
258
273
|
return LinearLineModel;
|
|
259
274
|
}(BaseModel);
|
|
260
275
|
|
|
261
|
-
export { LinearLineModel as default };
|
|
262
|
-
//# sourceMappingURL=linearline.js.map
|
|
276
|
+
export { LinearLineModel as default };
|
|
@@ -3,7 +3,6 @@ import _createClass from "@babel/runtime/helpers/createClass";
|
|
|
3
3
|
import _inherits from "@babel/runtime/helpers/inherits";
|
|
4
4
|
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
5
5
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
6
|
-
import _isNumber from "lodash/isNumber";
|
|
7
6
|
|
|
8
7
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
9
8
|
|
|
@@ -11,13 +10,20 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
|
|
|
11
10
|
|
|
12
11
|
import { AttributeType, gl } from '@antv/l7-core';
|
|
13
12
|
import { getMask, rgb2arr } from '@antv/l7-utils';
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
|
|
13
|
+
import { isNumber } from 'lodash';
|
|
14
|
+
import BaseModel from "../../core/BaseModel";
|
|
15
|
+
import { SimpleLineTriangulation } from "../../core/triangulation";
|
|
16
|
+
|
|
17
|
+
/* babel-plugin-inline-import '../shaders/simple/simpleline_frag.glsl' */
|
|
18
|
+
var simple_line_frag = "\nvarying vec4 v_color;\nvarying mat4 styleMappingMat;\nvoid main() {\n float opacity = styleMappingMat[0][0];\n float d_distance_ratio = styleMappingMat[3].r; // \u5F53\u524D\u70B9\u4F4D\u8DDD\u79BB\u5360\u7EBF\u603B\u957F\u7684\u6BD4\u4F8B\n\n gl_FragColor = v_color;\n gl_FragColor.a *= opacity; // \u5168\u5C40\u900F\u660E\u5EA6\n}\n"; // linear simple line shader
|
|
19
|
+
|
|
20
|
+
/* babel-plugin-inline-import '../shaders/simple/simpleline_linear_frag.glsl' */
|
|
17
21
|
var simle_linear_frag = "uniform vec4 u_sourceColor;\nuniform vec4 u_targetColor;\n\nvarying mat4 styleMappingMat;\nvoid main() {\n float opacity = styleMappingMat[0][0];\n\n // styleMappingMat[3][0] \u5F53\u524D\u70B9\u4F4D\u8DDD\u79BB\u5360\u7EBF\u603B\u957F\u7684\u6BD4\u4F8B\n gl_FragColor = mix(u_sourceColor, u_targetColor, styleMappingMat[3][0]);\n gl_FragColor.a *= opacity; // \u5168\u5C40\u900F\u660E\u5EA6\n}\n";
|
|
22
|
+
|
|
23
|
+
/* babel-plugin-inline-import '../shaders/simple/simpleline_vert.glsl' */
|
|
18
24
|
var simple_line_vert = "attribute vec4 a_Color;\nattribute vec2 a_Size;\nattribute vec3 a_Position;\n\nattribute float a_Total_Distance;\nattribute float a_Distance;\n\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\n\nuniform float u_opacity: 1.0;\nuniform float u_vertexScale: 1.0;\n\n#pragma include \"projection\"\n\nvarying vec4 v_color;\n\nvarying mat4 styleMappingMat; // \u7528\u4E8E\u5C06\u5728\u9876\u70B9\u7740\u8272\u5668\u4E2D\u8BA1\u7B97\u597D\u7684\u6837\u5F0F\u503C\u4F20\u9012\u7ED9\u7247\u5143\n\n#pragma include \"styleMapping\"\n#pragma include \"styleMappingCalOpacity\"\n\nvoid main() {\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n styleMappingMat = mat4(\n 0.0, 0.0, 0.0, 0.0, // opacity - strokeOpacity - strokeWidth - empty\n 0.0, 0.0, 0.0, 0.0, // strokeR - strokeG - strokeB - strokeA\n 0.0, 0.0, 0.0, 0.0, // offsets[0] - offsets[1]\n 0.0, 0.0, 0.0, 0.0 // distance_ratio/distance/pixelLen/texV\n );\n\n float rowCount = u_cellTypeLayout[0][0]; // \u5F53\u524D\u7684\u6570\u636E\u7EB9\u7406\u6709\u51E0\u884C\n float columnCount = u_cellTypeLayout[0][1]; // \u5F53\u770B\u5230\u6570\u636E\u7EB9\u7406\u6709\u51E0\u5217\n float columnWidth = 1.0/columnCount; // \u5217\u5BBD\n float rowHeight = 1.0/rowCount; // \u884C\u9AD8\n float cellCount = calCellCount(); // opacity - strokeOpacity - strokeWidth - stroke - offsets\n float id = a_vertexId; // \u7B2Cn\u4E2A\u9876\u70B9\n float cellCurrentRow = floor(id * cellCount / columnCount) + 1.0; // \u8D77\u59CB\u70B9\u5728\u7B2C\u51E0\u884C\n float cellCurrentColumn = mod(id * cellCount, columnCount) + 1.0; // \u8D77\u59CB\u70B9\u5728\u7B2C\u51E0\u5217\n \n // cell \u56FA\u5B9A\u987A\u5E8F opacity -> strokeOpacity -> strokeWidth -> stroke ... \n // \u6309\u987A\u5E8F\u4ECE cell \u4E2D\u53D6\u503C\u3001\u82E5\u6CA1\u6709\u5219\u81EA\u52A8\u5F80\u4E0B\u53D6\u503C\n float textureOffset = 0.0; // \u5728 cell \u4E2D\u53D6\u503C\u7684\u504F\u79FB\u91CF\n\n vec2 opacityAndOffset = calOpacityAndOffset(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset, columnWidth, rowHeight);\n styleMappingMat[0][0] = opacityAndOffset.r;\n textureOffset = opacityAndOffset.g;\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n\n \n v_color = a_Color; \n styleMappingMat[3][0] = a_Distance / a_Total_Distance;\n\n vec4 project_pos = project_position(vec4(a_Position.xy, 0, 1.0));\n\n float h = float(a_Position.z) * u_vertexScale; // \u7EBF\u9876\u70B9\u7684\u9AD8\u5EA6 - \u517C\u5BB9\u4E0D\u5B58\u5728\u7B2C\u4E09\u4E2A\u6570\u503C\u7684\u60C5\u51B5\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n gl_Position = u_Mvp * (vec4(project_pos.xy, project_pixel(a_Size.y) + h * 0.2, 1.0));\n } else {\n float lineHeight = a_Size.y;\n // \u517C\u5BB9 mapbox \u5728\u7EBF\u9AD8\u5EA6\u4E0A\u7684\u6548\u679C\u8868\u73B0\u57FA\u672C\u4E00\u81F4\n if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {\n // \u4FDD\u6301\u9AD8\u5EA6\u76F8\u5BF9\u4E0D\u53D8\n h *= 2.0/pow(2.0, 20.0 - u_Zoom);\n }\n\n // #define COORDINATE_SYSTEM_P20 5.0\n // #define COORDINATE_SYSTEM_P20_OFFSET 6.0\n // amap1.x\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20 || u_CoordinateSystem == COORDINATE_SYSTEM_P20_OFFSET) {\n // \u4FDD\u6301\u9AD8\u5EA6\u76F8\u5BF9\u4E0D\u53D8\n lineHeight *= pow(2.0, 20.0 - u_Zoom);\n }\n\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy, lineHeight + h, 1.0));\n }\n}\n";
|
|
19
25
|
|
|
20
|
-
var SimpleLineModel = function (_BaseModel) {
|
|
26
|
+
var SimpleLineModel = /*#__PURE__*/function (_BaseModel) {
|
|
21
27
|
_inherits(SimpleLineModel, _BaseModel);
|
|
22
28
|
|
|
23
29
|
var _super = _createSuper(SimpleLineModel);
|
|
@@ -37,9 +43,11 @@ var SimpleLineModel = function (_BaseModel) {
|
|
|
37
43
|
sourceColor = _ref.sourceColor,
|
|
38
44
|
targetColor = _ref.targetColor,
|
|
39
45
|
_ref$vertexHeightScal = _ref.vertexHeightScale,
|
|
40
|
-
vertexHeightScale = _ref$vertexHeightScal === void 0 ? 20.0 : _ref$vertexHeightScal;
|
|
46
|
+
vertexHeightScale = _ref$vertexHeightScal === void 0 ? 20.0 : _ref$vertexHeightScal; // 转化渐变色
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
var useLinearColor = 0; // 默认不生效
|
|
41
50
|
|
|
42
|
-
var useLinearColor = 0;
|
|
43
51
|
var sourceColorArr = [0, 0, 0, 0];
|
|
44
52
|
var targetColorArr = [0, 0, 0, 0];
|
|
45
53
|
|
|
@@ -62,7 +70,8 @@ var SimpleLineModel = function (_BaseModel) {
|
|
|
62
70
|
width = _this$calDataFrame.width,
|
|
63
71
|
height = _this$calDataFrame.height;
|
|
64
72
|
|
|
65
|
-
this.rowCount = height;
|
|
73
|
+
this.rowCount = height; // 当前数据纹理有多少行
|
|
74
|
+
|
|
66
75
|
this.dataTexture = this.cellLength > 0 && data.length > 0 ? this.createTexture2D({
|
|
67
76
|
flipY: true,
|
|
68
77
|
data: data,
|
|
@@ -82,11 +91,14 @@ var SimpleLineModel = function (_BaseModel) {
|
|
|
82
91
|
|
|
83
92
|
return {
|
|
84
93
|
u_dataTexture: this.dataTexture,
|
|
94
|
+
// 数据纹理 - 有数据映射的时候纹理中带数据,若没有任何数据映射时纹理是 [1]
|
|
85
95
|
u_cellTypeLayout: this.getCellTypeLayout(),
|
|
86
|
-
u_opacity:
|
|
96
|
+
u_opacity: isNumber(opacity) ? opacity : 1.0,
|
|
97
|
+
// 渐变色支持参数
|
|
87
98
|
u_linearColor: useLinearColor,
|
|
88
99
|
u_sourceColor: sourceColorArr,
|
|
89
100
|
u_targetColor: targetColorArr,
|
|
101
|
+
// 顶点高度 scale
|
|
90
102
|
u_vertexScale: vertexHeightScale
|
|
91
103
|
};
|
|
92
104
|
}
|
|
@@ -110,6 +122,7 @@ var SimpleLineModel = function (_BaseModel) {
|
|
|
110
122
|
targetColor = _ref2.targetColor;
|
|
111
123
|
|
|
112
124
|
if (sourceColor && targetColor) {
|
|
125
|
+
// 分离 linear 功能
|
|
113
126
|
return {
|
|
114
127
|
frag: simle_linear_frag,
|
|
115
128
|
vert: simple_line_vert,
|
|
@@ -164,6 +177,7 @@ var SimpleLineModel = function (_BaseModel) {
|
|
|
164
177
|
descriptor: {
|
|
165
178
|
name: 'a_Distance',
|
|
166
179
|
buffer: {
|
|
180
|
+
// give the WebGL driver a hint that this buffer may change
|
|
167
181
|
usage: gl.STATIC_DRAW,
|
|
168
182
|
data: [],
|
|
169
183
|
type: gl.FLOAT
|
|
@@ -180,6 +194,7 @@ var SimpleLineModel = function (_BaseModel) {
|
|
|
180
194
|
descriptor: {
|
|
181
195
|
name: 'a_Total_Distance',
|
|
182
196
|
buffer: {
|
|
197
|
+
// give the WebGL driver a hint that this buffer may change
|
|
183
198
|
usage: gl.STATIC_DRAW,
|
|
184
199
|
data: [],
|
|
185
200
|
type: gl.FLOAT
|
|
@@ -196,6 +211,7 @@ var SimpleLineModel = function (_BaseModel) {
|
|
|
196
211
|
descriptor: {
|
|
197
212
|
name: 'a_Size',
|
|
198
213
|
buffer: {
|
|
214
|
+
// give the WebGL driver a hint that this buffer may change
|
|
199
215
|
usage: gl.DYNAMIC_DRAW,
|
|
200
216
|
data: [],
|
|
201
217
|
type: gl.FLOAT
|
|
@@ -214,5 +230,4 @@ var SimpleLineModel = function (_BaseModel) {
|
|
|
214
230
|
return SimpleLineModel;
|
|
215
231
|
}(BaseModel);
|
|
216
232
|
|
|
217
|
-
export { SimpleLineModel as default };
|
|
218
|
-
//# sourceMappingURL=simpleLine.js.map
|
|
233
|
+
export { SimpleLineModel as default };
|