@antv/l7-layers 2.9.19 → 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.d.ts +11 -1
- package/es/core/interface.js +15 -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.d.ts +1 -0
- package/es/core/triangulation.js +123 -24
- 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 +57 -17
- package/es/line/models/linearline.js +32 -14
- 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.d.ts +15 -0
- package/es/utils/extrude_polyline.js +225 -51
- 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 +52 -20
- 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 +208 -295
- 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 -386
- package/lib/line/models/linearline.js +203 -258
- 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 +405 -428
- 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/point/models/fill.js
CHANGED
|
@@ -7,7 +7,6 @@ import _inherits from "@babel/runtime/helpers/inherits";
|
|
|
7
7
|
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
8
8
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
9
9
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
10
|
-
import _isNumber from "lodash/isNumber";
|
|
11
10
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
12
11
|
|
|
13
12
|
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); }; }
|
|
@@ -16,13 +15,22 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
|
|
|
16
15
|
|
|
17
16
|
import { AttributeType, gl } from '@antv/l7-core';
|
|
18
17
|
import { $window, getMask, PointFillTriangulation } from '@antv/l7-utils';
|
|
19
|
-
import
|
|
20
|
-
|
|
18
|
+
import { isNumber } from 'lodash';
|
|
19
|
+
import BaseModel from "../../core/BaseModel";
|
|
20
|
+
|
|
21
|
+
/* babel-plugin-inline-import '../shaders/animate/wave_frag.glsl' */
|
|
22
|
+
// import { PointFillTriangulation } from '../../core/triangulation';
|
|
23
|
+
// animate pointLayer shader - support animate
|
|
24
|
+
var waveFillFrag = "\nuniform float u_additive;\n\nvarying mat4 styleMappingMat; // \u4F20\u9012\u4ECE\u7247\u5143\u4E2D\u4F20\u9012\u7684\u6620\u5C04\u6570\u636E\n\nvarying vec4 v_data;\nvarying vec4 v_color;\nvarying float v_radius;\nuniform float u_time;\nuniform vec4 u_aimate: [ 0, 2., 1.0, 0.2 ];\n\n#pragma include \"sdf_2d\"\n#pragma include \"picking\"\n\nvoid main() {\n\n vec4 textrueStroke = vec4(\n styleMappingMat[1][0],\n styleMappingMat[1][1],\n styleMappingMat[1][2],\n styleMappingMat[1][3]\n );\n\n float opacity = styleMappingMat[0][0];\n\n lowp float antialiasblur = v_data.z;\n float r = v_radius / (v_radius);\n\n float outer_df;\n float inner_df;\n // 'circle', 'triangle', 'square', 'pentagon', 'hexagon', 'octogon', 'hexagram', 'rhombus', 'vesica'\n \n outer_df = sdCircle(v_data.xy, 1.0);\n inner_df = sdCircle(v_data.xy, r);\n\n\n float opacity_t = smoothstep(0.0, antialiasblur, outer_df);\n\n float color_t = smoothstep(\n antialiasblur,\n 0.0,\n inner_df\n );\n float PI = 3.14159;\n float N_RINGS = 3.0;\n float FREQ = 1.0;\n\n gl_FragColor = vec4(v_color.rgb, v_color.a * opacity);\n\n float d = length(v_data.xy);\n if(d > 0.5) {\n discard;\n }\n float intensity = clamp(cos(d * PI), 0.0, 1.0) * clamp(cos(2.0 * PI * (d * 2.0 * u_aimate.z - u_aimate.y * u_time)), 0.0, 1.0);\n \n // TODO: \u6839\u636E\u53E0\u52A0\u6A21\u5F0F\u9009\u62E9\u6548\u679C\n if(u_additive > 0.0) {\n gl_FragColor *= intensity;\n // TODO: \u4F18\u5316\u6C34\u6CE2\u70B9 blend additive \u6A21\u5F0F\u4E0B\u6709\u7684\u62FE\u53D6\u6548\u679C \n gl_FragColor = filterColorAlpha(gl_FragColor, gl_FragColor.a);\n } else {\n gl_FragColor = vec4(gl_FragColor.xyz, gl_FragColor.a * intensity);\n gl_FragColor = filterColor(gl_FragColor);\n }\n}\n"; // static pointLayer shader - not support animate
|
|
25
|
+
|
|
26
|
+
/* babel-plugin-inline-import '../shaders/fill_frag.glsl' */
|
|
21
27
|
var pointFillFrag = "uniform float u_additive;\n\nvarying mat4 styleMappingMat; // \u4F20\u9012\u4ECE\u7247\u5143\u4E2D\u4F20\u9012\u7684\u6620\u5C04\u6570\u636E\n\nvarying vec4 v_data;\nvarying vec4 v_color;\nvarying float v_radius;\n\n#pragma include \"sdf_2d\"\n#pragma include \"picking\"\n\n\nvoid main() {\n int shape = int(floor(v_data.w + 0.5));\n\n vec4 textrueStroke = vec4(\n styleMappingMat[1][0],\n styleMappingMat[1][1],\n styleMappingMat[1][2],\n styleMappingMat[1][3]\n );\n\n float opacity = styleMappingMat[0][0];\n float stroke_opacity = styleMappingMat[0][1];\n float strokeWidth = styleMappingMat[0][2];\n vec4 strokeColor = textrueStroke == vec4(0) ? v_color : textrueStroke;\n\n lowp float antialiasblur = v_data.z;\n float r = v_radius / (v_radius + strokeWidth);\n\n float outer_df;\n float inner_df;\n // 'circle', 'triangle', 'square', 'pentagon', 'hexagon', 'octogon', 'hexagram', 'rhombus', 'vesica'\n if (shape == 0) {\n outer_df = sdCircle(v_data.xy, 1.0);\n inner_df = sdCircle(v_data.xy, r);\n } else if (shape == 1) {\n outer_df = sdEquilateralTriangle(1.1 * v_data.xy);\n inner_df = sdEquilateralTriangle(1.1 / r * v_data.xy);\n } else if (shape == 2) {\n outer_df = sdBox(v_data.xy, vec2(1.));\n inner_df = sdBox(v_data.xy, vec2(r));\n } else if (shape == 3) {\n outer_df = sdPentagon(v_data.xy, 0.8);\n inner_df = sdPentagon(v_data.xy, r * 0.8);\n } else if (shape == 4) {\n outer_df = sdHexagon(v_data.xy, 0.8);\n inner_df = sdHexagon(v_data.xy, r * 0.8);\n } else if (shape == 5) {\n outer_df = sdOctogon(v_data.xy, 1.0);\n inner_df = sdOctogon(v_data.xy, r);\n } else if (shape == 6) {\n outer_df = sdHexagram(v_data.xy, 0.52);\n inner_df = sdHexagram(v_data.xy, r * 0.52);\n } else if (shape == 7) {\n outer_df = sdRhombus(v_data.xy, vec2(1.0));\n inner_df = sdRhombus(v_data.xy, vec2(r));\n } else if (shape == 8) {\n outer_df = sdVesica(v_data.xy, 1.1, 0.8);\n inner_df = sdVesica(v_data.xy, r * 1.1, r * 0.8);\n }\n\n float opacity_t = smoothstep(0.0, antialiasblur, outer_df);\n\n float color_t = strokeWidth < 0.01 ? 0.0 : smoothstep(\n antialiasblur,\n 0.0,\n inner_df\n );\n\n if(strokeWidth < 0.01) {\n gl_FragColor = vec4(v_color.rgb, v_color.a * opacity);\n } else {\n gl_FragColor = mix(vec4(v_color.rgb, v_color.a * opacity), strokeColor * stroke_opacity, color_t);\n }\n\n if(u_additive > 0.0) {\n gl_FragColor *= opacity_t;\n gl_FragColor = filterColorAlpha(gl_FragColor, gl_FragColor.a);\n } else {\n gl_FragColor.a *= opacity_t;\n gl_FragColor = filterColor(gl_FragColor);\n }\n}\n";
|
|
28
|
+
|
|
29
|
+
/* babel-plugin-inline-import '../shaders/fill_vert.glsl' */
|
|
22
30
|
var pointFillVert = "attribute vec4 a_Color;\nattribute vec3 a_Position;\nattribute vec3 a_Extrude;\nattribute float a_Size;\nattribute float a_Shape;\n\nvarying mat4 styleMappingMat; // \u7528\u4E8E\u5C06\u5728\u9876\u70B9\u7740\u8272\u5668\u4E2D\u8BA1\u7B97\u597D\u7684\u6837\u5F0F\u503C\u4F20\u9012\u7ED9\u7247\u5143\n\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\nuniform float u_meter2coord;\nuniform float u_meteryScale;\nuniform float u_isMeter;\n\nvarying vec4 v_data;\nvarying vec4 v_color;\nvarying float v_radius;\n\nuniform float u_opacity : 1;\nuniform float u_stroke_opacity : 1;\nuniform float u_stroke_width : 2;\nuniform vec4 u_stroke_color : [0.0, 0.0, 0.0, 0.0];\nuniform vec2 u_offsets;\n\nuniform float u_blur : 0.0;\nuniform float u_raisingHeight: 0.0;\n\n#pragma include \"styleMapping\"\n#pragma include \"styleMappingCalOpacity\"\n#pragma include \"styleMappingCalStrokeOpacity\"\n#pragma include \"styleMappingCalStrokeWidth\"\n\n#pragma include \"projection\"\n#pragma include \"picking\"\n\n\nvoid main() {\n vec3 extrude = a_Extrude;\n float shape_type = a_Shape;\n /*\n * setPickingSize \u8BBE\u7F6E\u62FE\u53D6\u5927\u5C0F\n * u_meter2coord \u5728\u7B49\u9762\u79EF\u5927\u5C0F\u7684\u65F6\u5019\u8BBE\u7F6E\u5355\u4F4D\n */\n float newSize = setPickingSize(a_Size) * u_meter2coord;\n // float newSize = setPickingSize(a_Size) * 0.00001038445708445579;\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\n );\n\n float rowCount = u_cellTypeLayout[0][0]; // \u5F53\u524D\u7684\u6570\u636E\u7EB9\u7406\u6709\u51E0\u884C\n float columnCount = u_cellTypeLayout[0][1]; // \u5F53\u770B\u5230\u6570\u636E\u7EB9\u7406\u6709\u51E0\u5217\n float columnWidth = 1.0/columnCount; // \u5217\u5BBD\n float rowHeight = 1.0/rowCount; // \u884C\u9AD8\n float cellCount = calCellCount(); // opacity - strokeOpacity - strokeWidth - stroke - offsets\n float id = a_vertexId; // \u7B2Cn\u4E2A\u9876\u70B9\n float cellCurrentRow = floor(id * cellCount / columnCount) + 1.0; // \u8D77\u59CB\u70B9\u5728\u7B2C\u51E0\u884C\n float cellCurrentColumn = mod(id * cellCount, columnCount) + 1.0; // \u8D77\u59CB\u70B9\u5728\u7B2C\u51E0\u5217\n \n // cell \u56FA\u5B9A\u987A\u5E8F opacity -> strokeOpacity -> strokeWidth -> stroke ... \n // \u6309\u987A\u5E8F\u4ECE cell \u4E2D\u53D6\u503C\u3001\u82E5\u6CA1\u6709\u5219\u81EA\u52A8\u5F80\u4E0B\u53D6\u503C\n float textureOffset = 0.0; // \u5728 cell \u4E2D\u53D6\u503C\u7684\u504F\u79FB\u91CF\n\n vec2 opacityAndOffset = calOpacityAndOffset(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset, columnWidth, rowHeight);\n styleMappingMat[0][0] = opacityAndOffset.r;\n textureOffset = opacityAndOffset.g;\n\n vec2 strokeOpacityAndOffset = calStrokeOpacityAndOffset(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset, columnWidth, rowHeight);\n styleMappingMat[0][1] = strokeOpacityAndOffset.r;\n textureOffset = strokeOpacityAndOffset.g;\n\n vec2 strokeWidthAndOffset = calStrokeWidthAndOffset(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset, columnWidth, rowHeight);\n styleMappingMat[0][2] = strokeWidthAndOffset.r;\n textureOffset = strokeWidthAndOffset.g;\n\n vec4 textrueStroke = vec4(-1.0, -1.0, -1.0, -1.0);\n if(hasStroke()) {\n vec2 valueRPos = nextPos(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset);\n styleMappingMat[1][0] = pos2value(valueRPos, columnWidth, rowHeight); // R\n textureOffset += 1.0;\n\n vec2 valueGPos = nextPos(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset);\n styleMappingMat[1][1] = pos2value(valueGPos, columnWidth, rowHeight); // G\n textureOffset += 1.0;\n\n vec2 valueBPos = nextPos(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset);\n styleMappingMat[1][2] = pos2value(valueBPos, columnWidth, rowHeight); // B\n textureOffset += 1.0;\n\n vec2 valueAPos = nextPos(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset);\n styleMappingMat[1][3] = pos2value(valueAPos, columnWidth, rowHeight); // A\n textureOffset += 1.0;\n } else {\n if(u_stroke_color == vec4(0.0)) {\n styleMappingMat[1][0] = v_color.r;\n styleMappingMat[1][1] = v_color.g;\n styleMappingMat[1][2] = v_color.b;\n styleMappingMat[1][3] = v_color.a;\n } else {\n styleMappingMat[1][0] = u_stroke_color.r;\n styleMappingMat[1][1] = u_stroke_color.g;\n styleMappingMat[1][2] = u_stroke_color.b;\n styleMappingMat[1][3] = u_stroke_color.a;\n }\n }\n\n vec2 textrueOffsets = vec2(0.0, 0.0);\n if(hasOffsets()) {\n vec2 valueXPos = nextPos(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset);\n textrueOffsets.r = pos2value(valueXPos, columnWidth, rowHeight); // x\n textureOffset += 1.0;\n\n vec2 valueYPos = nextPos(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset);\n textrueOffsets.g = pos2value(valueYPos, columnWidth, rowHeight); // x\n textureOffset += 1.0;\n } else {\n textrueOffsets = u_offsets;\n }\n\n // cal style mapping\n\n // unpack color(vec2)\n v_color = a_Color;\n\n // radius(16-bit)\n v_radius = newSize;\n\n // TODO: billboard\n // anti-alias\n // float antialiased_blur = -max(u_blur, antialiasblur);\n float antialiasblur = -max(2.0 / u_DevicePixelRatio / newSize, u_blur);\n\n vec2 offset = (extrude.xy * (newSize + u_stroke_width) + textrueOffsets);\n vec3 aPosition = a_Position;\n if(u_isMeter < 1.0) {\n // \u4E0D\u4EE5\u7C73\u4E3A\u5B9E\u9645\u5355\u4F4D\n offset = project_pixel(offset);\n } else {\n // \u4EE5\u7C73\u4E3A\u5B9E\u9645\u5355\u4F4D\n if(newSize * pow(2.0, u_Zoom) < 48.0) {\n antialiasblur = max(antialiasblur, -0.05);\n } else if(newSize * pow(2.0, u_Zoom) < 128.0) {\n antialiasblur = max(antialiasblur, -0.6/pow(u_Zoom, 2.0));\n } else {\n antialiasblur = max(antialiasblur, -0.8/pow(u_Zoom, 2.0));\n }\n \n if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {\n aPosition.x += offset.x / u_meteryScale;\n aPosition.y += offset.y;\n offset = vec2(0.0);\n }\n }\n\n // TODP: /abs(extrude.x) \u662F\u4E3A\u4E86\u517C\u5BB9\u5730\u7403\u6A21\u5F0F\n v_data = vec4(extrude.x/abs(extrude.x), extrude.y/abs(extrude.y), antialiasblur,shape_type);\n\n\n // vec4 project_pos = project_position(vec4(a_Position.xy, 0.0, 1.0));\n vec4 project_pos = project_position(vec4(aPosition.xy, 0.0, 1.0));\n // gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, project_pixel(setPickingOrder(0.0)), 1.0));\n\n float raiseHeight = u_raisingHeight;\n if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {\n float mapboxZoomScale = 4.0/pow(2.0, 21.0 - u_Zoom);\n raiseHeight = u_raisingHeight * mapboxZoomScale;\n }\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n gl_Position = u_Mvp * vec4(project_pos.xy + offset, raiseHeight, 1.0);\n } else {\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, u_raisingHeight, 1.0));\n }\n \n // gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, 0.0, 1.0));\n\n setPickingColor(a_PickingColor);\n}\n";
|
|
23
31
|
import { Version } from '@antv/l7-maps';
|
|
24
32
|
|
|
25
|
-
var FillModel = function (_BaseModel) {
|
|
33
|
+
var FillModel = /*#__PURE__*/function (_BaseModel) {
|
|
26
34
|
_inherits(FillModel, _BaseModel);
|
|
27
35
|
|
|
28
36
|
var _super = _createSuper(FillModel);
|
|
@@ -80,6 +88,7 @@ var FillModel = function (_BaseModel) {
|
|
|
80
88
|
stroke: stroke,
|
|
81
89
|
offsets: offsets
|
|
82
90
|
})) {
|
|
91
|
+
// 判断当前的样式中哪些是需要进行数据映射的,哪些是常量,同时计算用于构建数据纹理的一些中间变量
|
|
83
92
|
this.judgeStyleAttributes({
|
|
84
93
|
opacity: opacity,
|
|
85
94
|
strokeOpacity: strokeOpacity,
|
|
@@ -94,7 +103,8 @@ var FillModel = function (_BaseModel) {
|
|
|
94
103
|
width = _this$calDataFrame.width,
|
|
95
104
|
height = _this$calDataFrame.height;
|
|
96
105
|
|
|
97
|
-
this.rowCount = height;
|
|
106
|
+
this.rowCount = height; // 当前数据纹理有多少行
|
|
107
|
+
|
|
98
108
|
this.dataTexture = this.cellLength > 0 && data.length > 0 ? this.createTexture2D({
|
|
99
109
|
flipY: true,
|
|
100
110
|
data: data,
|
|
@@ -120,10 +130,11 @@ var FillModel = function (_BaseModel) {
|
|
|
120
130
|
u_blur: blur,
|
|
121
131
|
u_additive: blend === 'additive' ? 1.0 : 0.0,
|
|
122
132
|
u_dataTexture: this.dataTexture,
|
|
133
|
+
// 数据纹理 - 有数据映射的时候纹理中带数据,若没有任何数据映射时纹理是 [1]
|
|
123
134
|
u_cellTypeLayout: this.getCellTypeLayout(),
|
|
124
|
-
u_opacity:
|
|
125
|
-
u_stroke_opacity:
|
|
126
|
-
u_stroke_width:
|
|
135
|
+
u_opacity: isNumber(opacity) ? opacity : 1.0,
|
|
136
|
+
u_stroke_opacity: isNumber(strokeOpacity) ? strokeOpacity : 1.0,
|
|
137
|
+
u_stroke_width: isNumber(strokeWidth) ? strokeWidth : 1.0,
|
|
127
138
|
u_stroke_color: this.getStrokeColor(stroke),
|
|
128
139
|
u_offsets: this.isOffsetStatic(offsets) ? offsets : [0, 0]
|
|
129
140
|
};
|
|
@@ -153,6 +164,11 @@ var FillModel = function (_BaseModel) {
|
|
|
153
164
|
this.updateUnit('l7size');
|
|
154
165
|
this.buildModels(callbackModel);
|
|
155
166
|
}
|
|
167
|
+
/**
|
|
168
|
+
* 计算等面积点图层(unit meter)笛卡尔坐标标度与世界坐标标度的比例
|
|
169
|
+
* @returns
|
|
170
|
+
*/
|
|
171
|
+
|
|
156
172
|
}, {
|
|
157
173
|
key: "calMeter2Coord",
|
|
158
174
|
value: function calMeter2Coord() {
|
|
@@ -167,6 +183,8 @@ var FillModel = function (_BaseModel) {
|
|
|
167
183
|
var mapboxContext = $window === null || $window === void 0 ? void 0 : $window.mapboxgl;
|
|
168
184
|
|
|
169
185
|
if (version === Version.MAPBOX && mapboxContext !== null && mapboxContext !== void 0 && mapboxContext.MercatorCoordinate) {
|
|
186
|
+
// 参考:
|
|
187
|
+
// https://docs.mapbox.com/mapbox-gl-js/api/geography/#mercatorcoordinate#meterinmercatorcoordinateunits
|
|
170
188
|
var coord = mapboxContext.MercatorCoordinate.fromLngLat({
|
|
171
189
|
lng: center[0],
|
|
172
190
|
lat: center[1]
|
|
@@ -186,13 +204,14 @@ var FillModel = function (_BaseModel) {
|
|
|
186
204
|
this.meter2coord = (m1 + m2) / 2;
|
|
187
205
|
|
|
188
206
|
if (!Boolean(this.meter2coord)) {
|
|
207
|
+
// Tip: 兼容单个数据导致的 m1、m2 为 NaN
|
|
189
208
|
this.meter2coord = 7.70681090738883;
|
|
190
209
|
}
|
|
191
210
|
}
|
|
192
211
|
}, {
|
|
193
212
|
key: "buildModels",
|
|
194
213
|
value: function () {
|
|
195
|
-
var _buildModels = _asyncToGenerator(_regeneratorRuntime.mark(function _callee(callbackModel) {
|
|
214
|
+
var _buildModels = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(callbackModel) {
|
|
196
215
|
var _ref3, _ref3$mask, mask, _ref3$maskInside, maskInside, _ref3$animateOption, animateOption, _ref3$workerEnabled, workerEnabled, enablePicking, shape2d, _this$getShaders, frag, vert, type;
|
|
197
216
|
|
|
198
217
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
@@ -241,6 +260,11 @@ var FillModel = function (_BaseModel) {
|
|
|
241
260
|
|
|
242
261
|
return buildModels;
|
|
243
262
|
}()
|
|
263
|
+
/**
|
|
264
|
+
* 根据 animateOption 的值返回对应的 shader 代码
|
|
265
|
+
* @returns
|
|
266
|
+
*/
|
|
267
|
+
|
|
244
268
|
}, {
|
|
245
269
|
key: "getShaders",
|
|
246
270
|
value: function getShaders(animateOption) {
|
|
@@ -274,7 +298,8 @@ var FillModel = function (_BaseModel) {
|
|
|
274
298
|
var _this$dataTexture;
|
|
275
299
|
|
|
276
300
|
(_this$dataTexture = this.dataTexture) === null || _this$dataTexture === void 0 ? void 0 : _this$dataTexture.destroy();
|
|
277
|
-
}
|
|
301
|
+
} // overwrite baseModel func
|
|
302
|
+
|
|
278
303
|
}, {
|
|
279
304
|
key: "animateOption2Array",
|
|
280
305
|
value: function animateOption2Array(option) {
|
|
@@ -290,6 +315,7 @@ var FillModel = function (_BaseModel) {
|
|
|
290
315
|
descriptor: {
|
|
291
316
|
name: 'a_Extrude',
|
|
292
317
|
buffer: {
|
|
318
|
+
// give the WebGL driver a hint that this buffer may change
|
|
293
319
|
usage: gl.DYNAMIC_DRAW,
|
|
294
320
|
data: [],
|
|
295
321
|
type: gl.FLOAT
|
|
@@ -301,13 +327,15 @@ var FillModel = function (_BaseModel) {
|
|
|
301
327
|
return [extrude[extrudeIndex], extrude[extrudeIndex + 1], extrude[extrudeIndex + 2]];
|
|
302
328
|
}
|
|
303
329
|
}
|
|
304
|
-
});
|
|
330
|
+
}); // point layer size;
|
|
331
|
+
|
|
305
332
|
this.styleAttributeService.registerStyleAttribute({
|
|
306
333
|
name: 'size',
|
|
307
334
|
type: AttributeType.Attribute,
|
|
308
335
|
descriptor: {
|
|
309
336
|
name: 'a_Size',
|
|
310
337
|
buffer: {
|
|
338
|
+
// give the WebGL driver a hint that this buffer may change
|
|
311
339
|
usage: gl.DYNAMIC_DRAW,
|
|
312
340
|
data: [],
|
|
313
341
|
type: gl.FLOAT
|
|
@@ -319,13 +347,15 @@ var FillModel = function (_BaseModel) {
|
|
|
319
347
|
return Array.isArray(size) ? [size[0]] : [size];
|
|
320
348
|
}
|
|
321
349
|
}
|
|
322
|
-
});
|
|
350
|
+
}); // point layer size;
|
|
351
|
+
|
|
323
352
|
this.styleAttributeService.registerStyleAttribute({
|
|
324
353
|
name: 'shape',
|
|
325
354
|
type: AttributeType.Attribute,
|
|
326
355
|
descriptor: {
|
|
327
356
|
name: 'a_Shape',
|
|
328
357
|
buffer: {
|
|
358
|
+
// give the WebGL driver a hint that this buffer may change
|
|
329
359
|
usage: gl.DYNAMIC_DRAW,
|
|
330
360
|
data: [],
|
|
331
361
|
type: gl.FLOAT
|
|
@@ -340,15 +370,21 @@ var FillModel = function (_BaseModel) {
|
|
|
340
370
|
}
|
|
341
371
|
});
|
|
342
372
|
}
|
|
373
|
+
/**
|
|
374
|
+
* 判断是否更新点图层的计量单位
|
|
375
|
+
* @param unit
|
|
376
|
+
*/
|
|
377
|
+
|
|
343
378
|
}, {
|
|
344
379
|
key: "updateUnit",
|
|
345
380
|
value: function updateUnit(unit) {
|
|
346
381
|
var version = this.mapService.version;
|
|
347
382
|
|
|
348
383
|
if (this.unit !== unit) {
|
|
384
|
+
// l7size => meter
|
|
349
385
|
if (this.unit !== 'meter' && unit === 'meter' && version !== Version.L7MAP && version !== Version.GLOBEL) {
|
|
350
386
|
this.isMeter = true;
|
|
351
|
-
this.calMeter2Coord();
|
|
387
|
+
this.calMeter2Coord(); // meter => l7size
|
|
352
388
|
} else if (this.unit === 'meter' && unit !== 'meter') {
|
|
353
389
|
this.isMeter = false;
|
|
354
390
|
this.meter2coord = 1;
|
|
@@ -362,5 +398,4 @@ var FillModel = function (_BaseModel) {
|
|
|
362
398
|
return FillModel;
|
|
363
399
|
}(BaseModel);
|
|
364
400
|
|
|
365
|
-
export { FillModel as default };
|
|
366
|
-
//# sourceMappingURL=fill.js.map
|
|
401
|
+
export { FillModel as default };
|
|
@@ -6,7 +6,6 @@ import _inherits from "@babel/runtime/helpers/inherits";
|
|
|
6
6
|
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
7
7
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
8
8
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
9
|
-
import _isNumber from "lodash/isNumber";
|
|
10
9
|
|
|
11
10
|
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); }; }
|
|
12
11
|
|
|
@@ -15,12 +14,17 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
|
|
|
15
14
|
import { AttributeType, gl } from '@antv/l7-core';
|
|
16
15
|
import { Version } from '@antv/l7-maps';
|
|
17
16
|
import { getCullFace, getMask } from '@antv/l7-utils';
|
|
18
|
-
import
|
|
19
|
-
import
|
|
17
|
+
import { isNumber } from 'lodash';
|
|
18
|
+
import BaseModel from "../../core/BaseModel";
|
|
19
|
+
import { PointFillTriangulation } from "../../core/triangulation"; // static pointLayer shader - not support animate
|
|
20
|
+
|
|
21
|
+
/* babel-plugin-inline-import '../shaders/image/fillImage_frag.glsl' */
|
|
20
22
|
var pointFillFrag = "uniform sampler2D u_texture;\nuniform vec2 u_textSize;\n\nvarying mat4 styleMappingMat; // \u4F20\u9012\u4ECE\u7247\u5143\u4E2D\u4F20\u9012\u7684\u6620\u5C04\u6570\u636E\n\n#pragma include \"sdf_2d\"\n#pragma include \"picking\"\nvarying vec2 v_uv; // \u672C\u8EAB\u7684 uv \u5750\u6807\nvarying vec2 v_Iconuv;\n\nvoid main() {\n\n float opacity = styleMappingMat[0][0];\n\n vec2 pos = v_Iconuv / u_textSize + v_uv / u_textSize * 64.;\n gl_FragColor = texture2D(u_texture, pos);\n gl_FragColor.a *= opacity;\n\n gl_FragColor = filterColor(gl_FragColor);\n}\n";
|
|
23
|
+
|
|
24
|
+
/* babel-plugin-inline-import '../shaders/image/fillImage_vert.glsl' */
|
|
21
25
|
var pointFillVert = "attribute vec4 a_Color;\nattribute vec3 a_Position;\nattribute vec3 a_Extrude;\nattribute float a_Size;\nattribute vec2 a_Uv;\nattribute float a_Rotate;\n\nvarying mat4 styleMappingMat; // \u7528\u4E8E\u5C06\u5728\u9876\u70B9\u7740\u8272\u5668\u4E2D\u8BA1\u7B97\u597D\u7684\u6837\u5F0F\u503C\u4F20\u9012\u7ED9\u7247\u5143\n\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\nuniform mat2 u_RotateMatrix;\nuniform float u_isMeter;\n\nvarying vec2 v_uv; // \u672C\u8EAB\u7684 uv \u5750\u6807\nvarying vec2 v_Iconuv; // icon \u8D34\u56FE\u7684 uv \u5750\u6807\n\nuniform float u_opacity : 1;\nuniform vec2 u_offsets;\n\n#pragma include \"styleMapping\"\n#pragma include \"styleMappingCalOpacity\"\n\n#pragma include \"projection\"\n#pragma include \"picking\"\n\nvoid main() {\n vec3 extrude = a_Extrude;\n\n v_uv = (a_Extrude.xy + 1.0)/2.0;\n v_uv.y = 1.0 - v_uv.y;\n v_Iconuv = a_Uv;\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 - empty - empty - empty\n 0.0, 0.0, 0.0, 0.0, // empty - empty - empty - empty\n 0.0, 0.0, 0.0, 0.0, // offsets[0] - offsets[1]\n 0.0, 0.0, 0.0, 0.0\n );\n\n float rowCount = u_cellTypeLayout[0][0]; // \u5F53\u524D\u7684\u6570\u636E\u7EB9\u7406\u6709\u51E0\u884C\n float columnCount = u_cellTypeLayout[0][1]; // \u5F53\u770B\u5230\u6570\u636E\u7EB9\u7406\u6709\u51E0\u5217\n float columnWidth = 1.0/columnCount; // \u5217\u5BBD\n float rowHeight = 1.0/rowCount; // \u884C\u9AD8\n float cellCount = calCellCount(); // opacity - strokeOpacity - strokeWidth - stroke - offsets\n float id = a_vertexId; // \u7B2Cn\u4E2A\u9876\u70B9\n float cellCurrentRow = floor(id * cellCount / columnCount) + 1.0; // \u8D77\u59CB\u70B9\u5728\u7B2C\u51E0\u884C\n float cellCurrentColumn = mod(id * cellCount, columnCount) + 1.0; // \u8D77\u59CB\u70B9\u5728\u7B2C\u51E0\u5217\n \n // cell \u56FA\u5B9A\u987A\u5E8F opacity -> strokeOpacity -> strokeWidth -> stroke ... \n // \u6309\u987A\u5E8F\u4ECE cell \u4E2D\u53D6\u503C\u3001\u82E5\u6CA1\u6709\u5219\u81EA\u52A8\u5F80\u4E0B\u53D6\u503C\n float textureOffset = 0.0; // \u5728 cell \u4E2D\u53D6\u503C\u7684\u504F\u79FB\u91CF\n\n vec2 opacityAndOffset = calOpacityAndOffset(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset, columnWidth, rowHeight);\n styleMappingMat[0][0] = opacityAndOffset.r;\n textureOffset = opacityAndOffset.g;\n\n vec2 textrueOffsets = vec2(0.0, 0.0);\n if(hasOffsets()) {\n vec2 valueXPos = nextPos(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset);\n textrueOffsets.r = pos2value(valueXPos, columnWidth, rowHeight); // x\n textureOffset += 1.0;\n\n vec2 valueYPos = nextPos(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset);\n textrueOffsets.g = pos2value(valueYPos, columnWidth, rowHeight); // x\n textureOffset += 1.0;\n } else {\n textrueOffsets = u_offsets;\n }\n\n // cal style mapping\n\n highp float angle_sin = sin(a_Rotate);\n highp float angle_cos = cos(a_Rotate);\n mat2 rotation_matrix = mat2(angle_cos, -1.0 * angle_sin, angle_sin, angle_cos);\n\n // vec2 offset = (u_RotateMatrix * extrude.xy * (a_Size) + textrueOffsets);\n vec2 offset = (rotation_matrix * u_RotateMatrix * extrude.xy * (a_Size) + textrueOffsets);\n vec3 aPosition = a_Position;\n if(u_isMeter < 1.0) {\n // \u4E0D\u4EE5\u7C73\u4E3A\u5B9E\u9645\u5355\u4F4D\n offset = project_pixel(offset);\n } else {\n // \u4EE5\u7C73\u4E3A\u5B9E\u9645\u5355\u4F4D\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {\n aPosition.xy += offset;\n offset.x = 0.0;\n offset.y = 0.0;\n }\n }\n\n\n // vec4 project_pos = project_position(vec4(a_Position.xy, 0.0, 1.0));\n vec4 project_pos = project_position(vec4(aPosition.xy, 0.0, 1.0));\n // gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, project_pixel(setPickingOrder(0.0)), 1.0));\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n gl_Position = u_Mvp * vec4(project_pos.xy + offset, 0.0, 1.0);\n } else {\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, project_pixel(setPickingOrder(0.0)), 1.0));\n }\n \n // gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, 0.0, 1.0));\n\n setPickingColor(a_PickingColor);\n}\n";
|
|
22
26
|
|
|
23
|
-
var FillImageModel = function (_BaseModel) {
|
|
27
|
+
var FillImageModel = /*#__PURE__*/function (_BaseModel) {
|
|
24
28
|
_inherits(FillImageModel, _BaseModel);
|
|
25
29
|
|
|
26
30
|
var _super = _createSuper(FillImageModel);
|
|
@@ -38,8 +42,6 @@ var FillImageModel = function (_BaseModel) {
|
|
|
38
42
|
|
|
39
43
|
_defineProperty(_assertThisInitialized(_this), "meter2coord", 1);
|
|
40
44
|
|
|
41
|
-
_defineProperty(_assertThisInitialized(_this), "texture", void 0);
|
|
42
|
-
|
|
43
45
|
_defineProperty(_assertThisInitialized(_this), "isMeter", false);
|
|
44
46
|
|
|
45
47
|
_defineProperty(_assertThisInitialized(_this), "radian", 0);
|
|
@@ -53,7 +55,9 @@ var FillImageModel = function (_BaseModel) {
|
|
|
53
55
|
mag: 'linear',
|
|
54
56
|
min: 'linear mipmap nearest',
|
|
55
57
|
mipmap: true
|
|
56
|
-
});
|
|
58
|
+
}); // this.layer.render();
|
|
59
|
+
// TODO: 更新完纹理后在更新的图层的时候需要更新所有的图层
|
|
60
|
+
|
|
57
61
|
|
|
58
62
|
_this.layer.renderLayers();
|
|
59
63
|
|
|
@@ -76,7 +80,8 @@ var FillImageModel = function (_BaseModel) {
|
|
|
76
80
|
|
|
77
81
|
_createClass(FillImageModel, [{
|
|
78
82
|
key: "getUninforms",
|
|
79
|
-
value:
|
|
83
|
+
value: // 旋转的弧度
|
|
84
|
+
function getUninforms() {
|
|
80
85
|
var _ref = this.layer.getLayerConfig(),
|
|
81
86
|
_ref$opacity = _ref.opacity,
|
|
82
87
|
opacity = _ref$opacity === void 0 ? 1 : _ref$opacity,
|
|
@@ -87,12 +92,21 @@ var FillImageModel = function (_BaseModel) {
|
|
|
87
92
|
if (this.rendererService.getDirty()) {
|
|
88
93
|
this.texture.bind();
|
|
89
94
|
}
|
|
95
|
+
/**
|
|
96
|
+
* rotateFlag
|
|
97
|
+
* L7MAP 1
|
|
98
|
+
* MAPBOX 1
|
|
99
|
+
* GAODE2.x -1
|
|
100
|
+
* GAODE1.x -1
|
|
101
|
+
*/
|
|
102
|
+
|
|
90
103
|
|
|
91
104
|
var rotateFlag = 1;
|
|
92
105
|
|
|
93
106
|
if (this.mapService.version === 'GAODE2.x' || this.mapService.version === 'GAODE1.x') {
|
|
94
107
|
rotateFlag = -1;
|
|
95
|
-
}
|
|
108
|
+
} // 控制图标的旋转角度(绕 Z 轴旋转)
|
|
109
|
+
|
|
96
110
|
|
|
97
111
|
this.radian = rotation !== undefined ? rotateFlag * Math.PI * rotation / 180 : rotateFlag * Math.PI * (this.mapService.getRotation() % 360) / 180;
|
|
98
112
|
|
|
@@ -100,6 +114,7 @@ var FillImageModel = function (_BaseModel) {
|
|
|
100
114
|
opacity: opacity,
|
|
101
115
|
offsets: offsets
|
|
102
116
|
})) {
|
|
117
|
+
// 判断当前的样式中哪些是需要进行数据映射的,哪些是常量,同时计算用于构建数据纹理的一些中间变量
|
|
103
118
|
this.judgeStyleAttributes({
|
|
104
119
|
opacity: opacity,
|
|
105
120
|
offsets: offsets
|
|
@@ -111,7 +126,8 @@ var FillImageModel = function (_BaseModel) {
|
|
|
111
126
|
width = _this$calDataFrame.width,
|
|
112
127
|
height = _this$calDataFrame.height;
|
|
113
128
|
|
|
114
|
-
this.rowCount = height;
|
|
129
|
+
this.rowCount = height; // 当前数据纹理有多少行
|
|
130
|
+
|
|
115
131
|
this.dataTexture = this.cellLength > 0 && data.length > 0 ? this.createTexture2D({
|
|
116
132
|
flipY: true,
|
|
117
133
|
data: data,
|
|
@@ -133,10 +149,11 @@ var FillImageModel = function (_BaseModel) {
|
|
|
133
149
|
u_isMeter: Number(this.isMeter),
|
|
134
150
|
u_RotateMatrix: new Float32Array([Math.cos(this.radian), Math.sin(this.radian), -Math.sin(this.radian), Math.cos(this.radian)]),
|
|
135
151
|
u_dataTexture: this.dataTexture,
|
|
152
|
+
// 数据纹理 - 有数据映射的时候纹理中带数据,若没有任何数据映射时纹理是 [1]
|
|
136
153
|
u_cellTypeLayout: this.getCellTypeLayout(),
|
|
137
154
|
u_texture: this.texture,
|
|
138
155
|
u_textSize: [1024, this.iconService.canvasHeight || 128],
|
|
139
|
-
u_opacity:
|
|
156
|
+
u_opacity: isNumber(opacity) ? opacity : 1.0,
|
|
140
157
|
u_offsets: this.isOffsetStatic(offsets) ? offsets : [0, 0]
|
|
141
158
|
};
|
|
142
159
|
}
|
|
@@ -164,6 +181,11 @@ var FillImageModel = function (_BaseModel) {
|
|
|
164
181
|
|
|
165
182
|
this.buildModels(callbackModel);
|
|
166
183
|
}
|
|
184
|
+
/**
|
|
185
|
+
* 计算等面积点图层(unit meter)笛卡尔坐标标度与世界坐标标度的比例
|
|
186
|
+
* @returns
|
|
187
|
+
*/
|
|
188
|
+
|
|
167
189
|
}, {
|
|
168
190
|
key: "calMeter2Coord",
|
|
169
191
|
value: function calMeter2Coord() {
|
|
@@ -187,13 +209,16 @@ var FillImageModel = function (_BaseModel) {
|
|
|
187
209
|
var westLnglat = westCoord.toLngLat();
|
|
188
210
|
this.meter2coord = center[0] - westLnglat.lng;
|
|
189
211
|
return;
|
|
190
|
-
}
|
|
212
|
+
} // @ts-ignore
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
var m1 = this.mapService.meterToCoord(center, [minLng, minLat]); // @ts-ignore
|
|
191
216
|
|
|
192
|
-
var m1 = this.mapService.meterToCoord(center, [minLng, minLat]);
|
|
193
217
|
var m2 = this.mapService.meterToCoord(center, [maxLng === minLng ? maxLng + 0.1 : maxLng, maxLat === minLat ? minLat + 0.1 : maxLat]);
|
|
194
218
|
this.meter2coord = (m1 + m2) / 2;
|
|
195
219
|
|
|
196
220
|
if (!Boolean(this.meter2coord)) {
|
|
221
|
+
// Tip: 兼容单个数据导致的 m1、m2 为 NaN
|
|
197
222
|
this.meter2coord = 7.70681090738883;
|
|
198
223
|
}
|
|
199
224
|
}
|
|
@@ -235,7 +260,8 @@ var FillImageModel = function (_BaseModel) {
|
|
|
235
260
|
this.iconService.off('imageUpdate', this.updateTexture);
|
|
236
261
|
(_this$texture = this.texture) === null || _this$texture === void 0 ? void 0 : _this$texture.destroy();
|
|
237
262
|
(_this$dataTexture = this.dataTexture) === null || _this$dataTexture === void 0 ? void 0 : _this$dataTexture.destroy();
|
|
238
|
-
}
|
|
263
|
+
} // overwrite baseModel func
|
|
264
|
+
|
|
239
265
|
}, {
|
|
240
266
|
key: "registerBuiltinAttributes",
|
|
241
267
|
value: function registerBuiltinAttributes() {
|
|
@@ -265,6 +291,7 @@ var FillImageModel = function (_BaseModel) {
|
|
|
265
291
|
descriptor: {
|
|
266
292
|
name: 'a_Uv',
|
|
267
293
|
buffer: {
|
|
294
|
+
// give the WebGL driver a hint that this buffer may change
|
|
268
295
|
usage: gl.DYNAMIC_DRAW,
|
|
269
296
|
data: [],
|
|
270
297
|
type: gl.FLOAT
|
|
@@ -292,6 +319,7 @@ var FillImageModel = function (_BaseModel) {
|
|
|
292
319
|
descriptor: {
|
|
293
320
|
name: 'a_Extrude',
|
|
294
321
|
buffer: {
|
|
322
|
+
// give the WebGL driver a hint that this buffer may change
|
|
295
323
|
usage: gl.DYNAMIC_DRAW,
|
|
296
324
|
data: [],
|
|
297
325
|
type: gl.FLOAT
|
|
@@ -303,13 +331,15 @@ var FillImageModel = function (_BaseModel) {
|
|
|
303
331
|
return [extrude[extrudeIndex], extrude[extrudeIndex + 1], extrude[extrudeIndex + 2]];
|
|
304
332
|
}
|
|
305
333
|
}
|
|
306
|
-
});
|
|
334
|
+
}); // point layer size;
|
|
335
|
+
|
|
307
336
|
this.styleAttributeService.registerStyleAttribute({
|
|
308
337
|
name: 'size',
|
|
309
338
|
type: AttributeType.Attribute,
|
|
310
339
|
descriptor: {
|
|
311
340
|
name: 'a_Size',
|
|
312
341
|
buffer: {
|
|
342
|
+
// give the WebGL driver a hint that this buffer may change
|
|
313
343
|
usage: gl.DYNAMIC_DRAW,
|
|
314
344
|
data: [],
|
|
315
345
|
type: gl.FLOAT
|
|
@@ -328,5 +358,4 @@ var FillImageModel = function (_BaseModel) {
|
|
|
328
358
|
return FillImageModel;
|
|
329
359
|
}(BaseModel);
|
|
330
360
|
|
|
331
|
-
export { FillImageModel as default };
|
|
332
|
-
//# sourceMappingURL=fillmage.js.map
|
|
361
|
+
export { FillImageModel as default };
|
package/es/point/models/image.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,12 +12,17 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
|
|
|
13
12
|
|
|
14
13
|
import { AttributeType, gl } from '@antv/l7-core';
|
|
15
14
|
import { getMask } from '@antv/l7-utils';
|
|
16
|
-
import
|
|
17
|
-
import
|
|
15
|
+
import { isNumber } from 'lodash';
|
|
16
|
+
import BaseModel from "../../core/BaseModel";
|
|
17
|
+
import { PointImageTriangulation } from "../../core/triangulation";
|
|
18
|
+
|
|
19
|
+
/* babel-plugin-inline-import '../shaders/image_frag.glsl' */
|
|
18
20
|
var pointImageFrag = "\nuniform sampler2D u_texture;\nvarying vec4 v_color;\nvarying vec2 v_uv;\nuniform vec2 u_textSize;\nuniform float u_opacity : 1;\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 size = styleMappingMat[1][0];\n vec2 pos = v_uv / u_textSize + gl_PointCoord / u_textSize * 64.;\n vec4 textureColor;\n\n // Y = 0.299R + 0.587G + 0.114B // \u4EAE\u5EA6\u63D0\u53D6\n \n textureColor = texture2D(u_texture, pos);\n\n // Tip: \u53BB\u9664\u8FB9\u7F18\u90E8\u5206 mipmap \u5BFC\u81F4\u7684\u6DF7\u5408\u53D8\u6697\n float fragmengTocenter = distance(vec2(0.5), gl_PointCoord);\n if(fragmengTocenter >= 0.5) {\n float luma = 0.299 * textureColor.r + 0.587 * textureColor.g + 0.114 * textureColor.b;\n textureColor.a *= luma;\n }\n \n \n\n if(all(lessThan(v_color, vec4(1.0+0.00001))) && all(greaterThan(v_color, vec4(1.0-0.00001))) || v_color==vec4(1.0)){\n gl_FragColor= textureColor;\n }else {\n gl_FragColor= step(0.01, textureColor.z) * v_color;\n }\n\n gl_FragColor.a = gl_FragColor.a * opacity;\n gl_FragColor = filterColor(gl_FragColor);\n}\n";
|
|
21
|
+
|
|
22
|
+
/* babel-plugin-inline-import '../shaders/image_vert.glsl' */
|
|
19
23
|
var pointImageVert = "precision highp float;\nattribute vec3 a_Position;\nattribute vec4 a_Color;\nattribute vec2 a_Uv;\nattribute float a_Size;\nvarying vec4 v_color;\nvarying vec2 v_uv;\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\nuniform vec2 u_offsets;\n\nuniform float u_opacity : 1;\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\n#pragma include \"projection\"\n#pragma include \"picking\"\n\nvoid main() {\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n styleMappingMat = mat4(\n 0.0, 0.0, 0.0, 0.0, // opacity - strokeOpacity - strokeWidth - empty\n 0.0, 0.0, 0.0, 0.0, // strokeR - strokeG - strokeB - strokeA\n 0.0, 0.0, 0.0, 0.0, // offsets[0] - offsets[1]\n 0.0, 0.0, 0.0, 0.0\n );\n\n float rowCount = u_cellTypeLayout[0][0]; // \u5F53\u524D\u7684\u6570\u636E\u7EB9\u7406\u6709\u51E0\u884C\n float columnCount = u_cellTypeLayout[0][1]; // \u5F53\u770B\u5230\u6570\u636E\u7EB9\u7406\u6709\u51E0\u5217\n float columnWidth = 1.0/columnCount; // \u5217\u5BBD\n float rowHeight = 1.0/rowCount; // \u884C\u9AD8\n float cellCount = calCellCount(); // opacity - strokeOpacity - strokeWidth - stroke - offsets\n float id = a_vertexId; // \u7B2Cn\u4E2A\u9876\u70B9\n float cellCurrentRow = floor(id * cellCount / columnCount) + 1.0; // \u8D77\u59CB\u70B9\u5728\u7B2C\u51E0\u884C\n float cellCurrentColumn = mod(id * cellCount, columnCount) + 1.0; // \u8D77\u59CB\u70B9\u5728\u7B2C\u51E0\u5217\n \n // cell \u56FA\u5B9A\u987A\u5E8F opacity -> strokeOpacity -> strokeWidth -> stroke ... \n // \u6309\u987A\u5E8F\u4ECE cell \u4E2D\u53D6\u503C\u3001\u82E5\u6CA1\u6709\u5219\u81EA\u52A8\u5F80\u4E0B\u53D6\u503C\n float textureOffset = 0.0; // \u5728 cell \u4E2D\u53D6\u503C\u7684\u504F\u79FB\u91CF\n\n vec2 opacityAndOffset = calOpacityAndOffset(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset, columnWidth, rowHeight);\n styleMappingMat[0][0] = opacityAndOffset.r;\n textureOffset = opacityAndOffset.g;\n\n styleMappingMat[1][0] = a_Size;\n\n vec2 textrueOffsets = vec2(0.0, 0.0);\n if(hasOffsets()) {\n vec2 valueXPos = nextPos(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset);\n textrueOffsets.r = pos2value(valueXPos, columnWidth, rowHeight); // x\n textureOffset += 1.0;\n\n vec2 valueYPos = nextPos(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset);\n textrueOffsets.g = pos2value(valueYPos, columnWidth, rowHeight); // x\n textureOffset += 1.0;\n } else {\n textrueOffsets = u_offsets;\n }\n\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n v_color = a_Color;\n v_uv = a_Uv;\n vec4 project_pos = project_position(vec4(a_Position, 1.0));\n \n // vec2 offset = project_pixel(u_offsets);\n vec2 offset = project_pixel(textrueOffsets);\n\n // gl_Position = project_common_position_to_clipspace(vec4(vec2(project_pos.xy + offset),project_pos.z, 1.0));\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n gl_Position = u_Mvp * vec4(vec2(project_pos.xy + offset),project_pos.z, 1.0);\n } else {\n gl_Position = project_common_position_to_clipspace(vec4(vec2(project_pos.xy + offset),project_pos.z, 1.0));\n }\n gl_PointSize = a_Size * 2.0 * u_DevicePixelRatio;\n\n setPickingColor(a_PickingColor);\n}\n";
|
|
20
24
|
|
|
21
|
-
var ImageModel = function (_BaseModel) {
|
|
25
|
+
var ImageModel = /*#__PURE__*/function (_BaseModel) {
|
|
22
26
|
_inherits(ImageModel, _BaseModel);
|
|
23
27
|
|
|
24
28
|
var _super = _createSuper(ImageModel);
|
|
@@ -34,8 +38,6 @@ var ImageModel = function (_BaseModel) {
|
|
|
34
38
|
|
|
35
39
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
36
40
|
|
|
37
|
-
_defineProperty(_assertThisInitialized(_this), "texture", void 0);
|
|
38
|
-
|
|
39
41
|
_defineProperty(_assertThisInitialized(_this), "updateTexture", function () {
|
|
40
42
|
var createTexture2D = _this.rendererService.createTexture2D;
|
|
41
43
|
|
|
@@ -45,7 +47,8 @@ var ImageModel = function (_BaseModel) {
|
|
|
45
47
|
mag: 'linear',
|
|
46
48
|
min: 'linear mipmap nearest',
|
|
47
49
|
mipmap: true
|
|
48
|
-
});
|
|
50
|
+
}); // TODO: 更新完纹理后在更新的图层的时候需要更新所有的图层
|
|
51
|
+
|
|
49
52
|
|
|
50
53
|
_this.layer.renderLayers();
|
|
51
54
|
|
|
@@ -94,7 +97,8 @@ var ImageModel = function (_BaseModel) {
|
|
|
94
97
|
width = _this$calDataFrame.width,
|
|
95
98
|
height = _this$calDataFrame.height;
|
|
96
99
|
|
|
97
|
-
this.rowCount = height;
|
|
100
|
+
this.rowCount = height; // 当前数据纹理有多少行
|
|
101
|
+
|
|
98
102
|
this.dataTexture = this.cellLength > 0 && data.length > 0 ? this.createTexture2D({
|
|
99
103
|
flipY: true,
|
|
100
104
|
data: data,
|
|
@@ -114,10 +118,11 @@ var ImageModel = function (_BaseModel) {
|
|
|
114
118
|
|
|
115
119
|
return {
|
|
116
120
|
u_dataTexture: this.dataTexture,
|
|
121
|
+
// 数据纹理 - 有数据映射的时候纹理中带数据,若没有任何数据映射时纹理是 [1]
|
|
117
122
|
u_cellTypeLayout: this.getCellTypeLayout(),
|
|
118
123
|
u_texture: this.texture,
|
|
119
124
|
u_textSize: [1024, this.iconService.canvasHeight || 128],
|
|
120
|
-
u_opacity:
|
|
125
|
+
u_opacity: isNumber(opacity) ? opacity : 1.0,
|
|
121
126
|
u_offsets: this.isOffsetStatic(offsets) ? offsets : [0, 0]
|
|
122
127
|
};
|
|
123
128
|
}
|
|
@@ -170,12 +175,14 @@ var ImageModel = function (_BaseModel) {
|
|
|
170
175
|
value: function registerBuiltinAttributes() {
|
|
171
176
|
var _this2 = this;
|
|
172
177
|
|
|
178
|
+
// point layer size;
|
|
173
179
|
this.styleAttributeService.registerStyleAttribute({
|
|
174
180
|
name: 'size',
|
|
175
181
|
type: AttributeType.Attribute,
|
|
176
182
|
descriptor: {
|
|
177
183
|
name: 'a_Size',
|
|
178
184
|
buffer: {
|
|
185
|
+
// give the WebGL driver a hint that this buffer may change
|
|
179
186
|
usage: gl.DYNAMIC_DRAW,
|
|
180
187
|
data: [],
|
|
181
188
|
type: gl.FLOAT
|
|
@@ -187,13 +194,15 @@ var ImageModel = function (_BaseModel) {
|
|
|
187
194
|
return Array.isArray(size) ? [size[0]] : [size];
|
|
188
195
|
}
|
|
189
196
|
}
|
|
190
|
-
});
|
|
197
|
+
}); // point layer size;
|
|
198
|
+
|
|
191
199
|
this.styleAttributeService.registerStyleAttribute({
|
|
192
200
|
name: 'uv',
|
|
193
201
|
type: AttributeType.Attribute,
|
|
194
202
|
descriptor: {
|
|
195
203
|
name: 'a_Uv',
|
|
196
204
|
buffer: {
|
|
205
|
+
// give the WebGL driver a hint that this buffer may change
|
|
197
206
|
usage: gl.DYNAMIC_DRAW,
|
|
198
207
|
data: [],
|
|
199
208
|
type: gl.FLOAT
|
|
@@ -221,5 +230,4 @@ var ImageModel = function (_BaseModel) {
|
|
|
221
230
|
return ImageModel;
|
|
222
231
|
}(BaseModel);
|
|
223
232
|
|
|
224
|
-
export { ImageModel as default };
|
|
225
|
-
//# sourceMappingURL=image.js.map
|
|
233
|
+
export { ImageModel as default };
|
package/es/point/models/index.js
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
import PointTileModel from
|
|
2
|
-
import EarthExtrudeModel from
|
|
3
|
-
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
1
|
+
import PointTileModel from "../../tile/models/tileModel";
|
|
2
|
+
import EarthExtrudeModel from "./earthExtrude"; // earth
|
|
3
|
+
|
|
4
|
+
import EarthFillModel from "./earthFill";
|
|
5
|
+
import ExtrudeModel from "./extrude";
|
|
6
|
+
import FillModel from "./fill";
|
|
7
|
+
import FillImageModel from "./fillmage";
|
|
8
|
+
import IMageModel from "./image";
|
|
9
|
+
import NormalModel from "./normal";
|
|
10
|
+
import Radar from "./radar";
|
|
11
|
+
import SimplePopint from "./simplePoint";
|
|
12
|
+
import TextModel from "./text";
|
|
13
|
+
import TileFillModel from "./tile";
|
|
13
14
|
var PointModels = {
|
|
14
15
|
fillImage: FillImageModel,
|
|
15
16
|
fill: FillModel,
|
|
@@ -24,5 +25,4 @@ var PointModels = {
|
|
|
24
25
|
earthFill: EarthFillModel,
|
|
25
26
|
earthExtrude: EarthExtrudeModel
|
|
26
27
|
};
|
|
27
|
-
export default PointModels;
|
|
28
|
-
//# sourceMappingURL=index.js.map
|
|
28
|
+
export default PointModels;
|