@antv/l7-layers 2.16.1 → 2.16.2
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 +9 -31
- package/es/Geometry/models/billboard.js +51 -89
- package/es/Geometry/models/plane.js +81 -143
- package/es/Geometry/models/sprite.js +60 -118
- package/es/canvas/index.js +10 -33
- package/es/canvas/models/canvas.js +41 -97
- package/es/citybuliding/building.js +8 -27
- package/es/citybuliding/models/build.js +57 -82
- package/es/core/BaseLayer.d.ts +3 -0
- package/es/core/BaseLayer.js +360 -528
- package/es/core/BaseModel.d.ts +9 -71
- package/es/core/BaseModel.js +118 -429
- package/es/core/CommonStyleAttribute.d.ts +2 -0
- package/es/core/CommonStyleAttribute.js +66 -0
- package/es/core/LayerPickService.js +21 -32
- package/es/core/TextureService.js +0 -13
- package/es/core/interface.d.ts +13 -3
- package/es/core/interface.js +17 -24
- package/es/core/shape/Path.js +13 -20
- package/es/core/shape/extrude.js +27 -36
- package/es/core/triangulation.d.ts +12 -0
- package/es/core/triangulation.js +124 -114
- package/es/earth/index.js +9 -33
- package/es/earth/models/atmosphere.js +30 -54
- package/es/earth/models/base.js +47 -85
- package/es/earth/models/bloomsphere.js +30 -54
- package/es/earth/utils.js +9 -13
- package/es/heatmap/index.js +10 -40
- package/es/heatmap/models/grid.js +29 -53
- package/es/heatmap/models/grid3d.js +29 -53
- package/es/heatmap/models/heatmap.d.ts +1 -0
- package/es/heatmap/models/heatmap.js +99 -150
- package/es/heatmap/models/hexagon.js +29 -53
- package/es/heatmap/shaders/grid_vert.glsl +2 -2
- package/es/heatmap/shaders/hexagon_3d_vert.glsl +2 -2
- package/es/heatmap/shaders/hexagon_vert.glsl +2 -2
- package/es/heatmap/triangulation.js +0 -4
- package/es/image/index.js +9 -28
- package/es/image/models/image.js +66 -100
- package/es/index.js +9 -17
- package/es/line/index.d.ts +1 -0
- package/es/line/index.js +12 -36
- package/es/line/models/arc.js +72 -160
- package/es/line/models/arc_3d.js +67 -148
- package/es/line/models/earthArc_3d.js +66 -148
- package/es/line/models/{half.d.ts → flow.d.ts} +1 -11
- package/es/line/models/flow.js +167 -0
- package/es/line/models/great_circle.js +57 -135
- package/es/line/models/index.d.ts +1 -1
- package/es/line/models/index.js +3 -3
- package/es/line/models/line.js +98 -186
- package/es/line/models/linearline.js +46 -115
- package/es/line/models/simpleLine.d.ts +0 -1
- package/es/line/models/simpleLine.js +42 -114
- package/es/line/models/wall.js +52 -92
- package/es/line/shaders/dash/arc_dash_frag.glsl +3 -6
- package/es/line/shaders/dash/arc_dash_vert.glsl +6 -46
- package/es/line/shaders/dash/line_dash_frag.glsl +4 -7
- package/es/line/shaders/dash/line_dash_vert.glsl +3 -33
- package/es/line/shaders/flow/flow_line_frag.glsl +13 -0
- package/es/line/shaders/flow/flow_line_vert.glsl +83 -0
- package/es/line/shaders/line_arc_3d_frag.glsl +6 -6
- package/es/line/shaders/line_arc_3d_vert.glsl +4 -34
- package/es/line/shaders/line_arc_frag.glsl +7 -11
- package/es/line/shaders/line_arc_great_circle_frag.glsl +5 -6
- package/es/line/shaders/line_arc_great_circle_vert.glsl +4 -32
- package/es/line/shaders/line_arc_vert.glsl +9 -45
- package/es/line/shaders/line_frag.glsl +15 -17
- package/es/line/shaders/line_vert.glsl +3 -34
- package/es/line/shaders/linear/arc3d_linear_frag.glsl +5 -19
- package/es/line/shaders/linear/arc3d_linear_vert.glsl +9 -48
- package/es/line/shaders/linear/arc_linear_frag.glsl +2 -30
- package/es/line/shaders/linear/arc_linear_vert.glsl +9 -45
- package/es/line/shaders/linear/line_linear_frag.glsl +5 -6
- package/es/line/shaders/linearLine/line_linear_frag.glsl +2 -14
- package/es/line/shaders/linearLine/line_linear_vert.glsl +14 -32
- package/es/line/shaders/simple/simpleline_frag.glsl +1 -5
- package/es/line/shaders/simple/simpleline_linear_frag.glsl +2 -6
- package/es/line/shaders/simple/simpleline_vert.glsl +7 -33
- package/es/mask/index.js +9 -28
- package/es/mask/models/fill.js +29 -54
- package/es/plugins/DataMappingPlugin.js +90 -141
- package/es/plugins/DataSourcePlugin.js +45 -68
- package/es/plugins/FeatureScalePlugin.js +67 -122
- package/es/plugins/LayerAnimateStylePlugin.js +0 -5
- package/es/plugins/LayerMaskPlugin.js +3 -11
- package/es/plugins/LayerModelPlugin.js +79 -104
- package/es/plugins/LayerStylePlugin.js +3 -9
- package/es/plugins/LightingPlugin.js +12 -18
- package/es/plugins/MultiPassRendererPlugin.js +11 -16
- package/es/plugins/PixelPickingPlugin.js +12 -21
- package/es/plugins/RegisterStyleAttributePlugin.js +5 -12
- package/es/plugins/ShaderUniformPlugin.js +15 -29
- package/es/plugins/UpdateModelPlugin.js +0 -5
- package/es/plugins/UpdateStyleAttributePlugin.js +5 -11
- package/es/point/index.d.ts +1 -0
- package/es/point/index.js +27 -77
- package/es/point/models/earthExtrude.d.ts +0 -3
- package/es/point/models/earthExtrude.js +60 -139
- package/es/point/models/earthFill.d.ts +0 -1
- package/es/point/models/earthFill.js +59 -140
- package/es/point/models/extrude.d.ts +0 -3
- package/es/point/models/extrude.js +60 -140
- package/es/point/models/fill.d.ts +0 -1
- package/es/point/models/fill.js +67 -158
- package/es/point/models/fillmage.js +66 -147
- package/es/point/models/image.js +52 -126
- package/es/point/models/index.js +2 -2
- package/es/point/models/normal.js +32 -56
- package/es/point/models/radar.d.ts +0 -1
- package/es/point/models/radar.js +42 -75
- package/es/point/models/simplePoint.d.ts +0 -1
- package/es/point/models/simplePoint.js +46 -115
- package/es/point/models/text.js +211 -344
- package/es/point/shaders/animate/wave_frag.glsl +1 -11
- package/es/point/shaders/earth/extrude_frag.glsl +5 -17
- package/es/point/shaders/earth/extrude_vert.glsl +14 -29
- package/es/point/shaders/earth/fill_frag.glsl +5 -14
- package/es/point/shaders/earth/fill_vert.glsl +1 -75
- package/es/point/shaders/extrude/extrude_frag.glsl +3 -29
- package/es/point/shaders/extrude/extrude_vert.glsl +27 -35
- package/es/point/shaders/fill_frag.glsl +9 -20
- package/es/point/shaders/fill_vert.glsl +16 -101
- package/es/point/shaders/image/fillImage_frag.glsl +2 -5
- package/es/point/shaders/image/fillImage_vert.glsl +4 -47
- package/es/point/shaders/image_frag.glsl +1 -5
- package/es/point/shaders/image_vert.glsl +1 -44
- package/es/point/shaders/normal_frag.glsl +0 -2
- package/es/point/shaders/normal_vert.glsl +2 -1
- package/es/point/shaders/radar/radar_vert.glsl +2 -2
- package/es/point/shaders/simplePoint_frag.glsl +0 -7
- package/es/point/shaders/simplePoint_vert.glsl +3 -45
- package/es/point/shaders/text_frag.glsl +6 -19
- package/es/point/shaders/text_vert.glsl +5 -66
- package/es/point/shape/extrude.js +4 -13
- package/es/polygon/index.d.ts +1 -0
- package/es/polygon/index.js +12 -40
- package/es/polygon/models/extrude.d.ts +0 -3
- package/es/polygon/models/extrude.js +122 -162
- package/es/polygon/models/fill.d.ts +0 -4
- package/es/polygon/models/fill.js +57 -130
- package/es/polygon/models/index.js +3 -2
- package/es/polygon/models/ocean.js +42 -76
- package/es/polygon/models/water.js +37 -71
- package/es/polygon/shaders/extrude/polygon_extrude_frag.glsl +2 -23
- package/es/polygon/shaders/extrude/polygon_extrude_picklight_frag.glsl +7 -5
- package/es/polygon/shaders/extrude/polygon_extrude_picklight_vert.glsl +7 -32
- package/es/polygon/shaders/extrude/polygon_extrude_vert.glsl +33 -38
- package/es/polygon/shaders/extrude/polygon_extrudetex_frag.glsl +12 -9
- package/es/polygon/shaders/extrude/polygon_extrudetex_vert.glsl +16 -44
- package/es/polygon/shaders/polygon_frag.glsl +0 -5
- package/es/polygon/shaders/polygon_linear_frag.glsl +0 -8
- package/es/polygon/shaders/polygon_linear_vert.glsl +0 -32
- package/es/polygon/shaders/polygon_vert.glsl +1 -27
- package/es/raster/buffers/triangulation.js +2 -4
- package/es/raster/index.js +9 -32
- package/es/raster/models/raster.js +80 -116
- package/es/raster/models/rasterRgb.js +84 -127
- package/es/raster/models/rasterTerrainRgb.js +56 -84
- package/es/tile/interaction/getRasterData.js +14 -20
- package/es/tile/interaction/utils.js +7 -9
- package/es/tile/manager/base.js +63 -96
- package/es/tile/service/TileLayerService.js +33 -55
- package/es/tile/service/TilePickService.js +26 -40
- package/es/tile/service/TileSourceService.js +3 -7
- package/es/tile/tileFactory/DebugTile.js +29 -46
- package/es/tile/tileFactory/ImageTile.js +20 -38
- package/es/tile/tileFactory/MaskTile.js +22 -43
- package/es/tile/tileFactory/RasterRGBTile.js +22 -42
- package/es/tile/tileFactory/RasterTerrainRGBTile.js +20 -38
- package/es/tile/tileFactory/RasterTile.js +30 -53
- package/es/tile/tileFactory/Tile.js +63 -97
- package/es/tile/tileFactory/VectorTile.js +41 -68
- package/es/tile/tileFactory/index.js +0 -11
- package/es/tile/tileFactory/layers/TileDebugLayer.js +6 -27
- package/es/tile/tileFactory/util.js +0 -3
- package/es/tile/tileLayer/BaseLayer.js +105 -146
- package/es/tile/utils.js +1 -1
- package/es/utils/blend.js +0 -2
- package/es/utils/collision-index.js +9 -16
- package/es/utils/extrude_polyline.js +101 -149
- package/es/utils/grid-index.js +2 -27
- package/es/utils/identityScale.js +0 -8
- package/es/utils/layerData.js +32 -46
- package/es/utils/multiPassRender.js +11 -13
- package/es/utils/polylineNormal.js +31 -37
- package/es/utils/simpleLine.js +2 -16
- package/es/utils/stencil.js +2 -3
- package/es/utils/symbol-layout.js +27 -53
- package/es/wind/index.js +9 -29
- package/es/wind/models/utils.js +26 -51
- package/es/wind/models/wind.js +101 -147
- package/es/wind/models/windRender.js +53 -66
- package/lib/Geometry/index.js +9 -38
- package/lib/Geometry/models/billboard.js +51 -97
- package/lib/Geometry/models/index.js +0 -5
- package/lib/Geometry/models/plane.js +79 -151
- package/lib/Geometry/models/sprite.js +60 -127
- package/lib/canvas/index.js +10 -40
- package/lib/canvas/models/canvas.js +41 -101
- package/lib/canvas/models/index.js +0 -3
- package/lib/citybuliding/building.js +8 -35
- package/lib/citybuliding/models/build.js +57 -92
- package/lib/core/BaseLayer.js +358 -520
- package/lib/core/BaseModel.js +117 -441
- package/lib/core/CommonStyleAttribute.js +72 -0
- package/lib/core/LayerPickService.js +21 -37
- package/lib/core/TextureService.js +0 -16
- package/lib/core/interface.js +21 -31
- package/lib/core/schema.js +0 -1
- package/lib/core/shape/Path.js +14 -31
- package/lib/core/shape/extrude.js +27 -59
- package/lib/core/triangulation.js +125 -153
- package/lib/earth/index.js +9 -43
- package/lib/earth/models/atmosphere.js +30 -63
- package/lib/earth/models/base.js +47 -90
- package/lib/earth/models/bloomsphere.js +30 -63
- package/lib/earth/utils.js +7 -31
- package/lib/heatmap/index.js +10 -48
- package/lib/heatmap/models/grid.js +29 -61
- package/lib/heatmap/models/grid3d.js +29 -61
- package/lib/heatmap/models/heatmap.js +99 -166
- package/lib/heatmap/models/hexagon.js +29 -61
- package/lib/heatmap/models/index.js +0 -6
- package/lib/heatmap/shaders/grid_vert.glsl +2 -2
- package/lib/heatmap/shaders/hexagon_3d_vert.glsl +2 -2
- package/lib/heatmap/shaders/hexagon_vert.glsl +2 -2
- package/lib/heatmap/triangulation.js +0 -5
- package/lib/image/index.js +9 -36
- package/lib/image/models/image.js +66 -109
- package/lib/image/models/index.js +0 -3
- package/lib/index.js +7 -61
- package/lib/line/index.js +12 -42
- package/lib/line/models/arc.js +70 -170
- package/lib/line/models/arc_3d.js +65 -159
- package/lib/line/models/earthArc_3d.js +64 -159
- package/lib/line/models/flow.js +174 -0
- package/lib/line/models/great_circle.js +57 -146
- package/lib/line/models/index.js +3 -14
- package/lib/line/models/line.js +96 -194
- package/lib/line/models/linearline.js +46 -127
- package/lib/line/models/simpleLine.js +42 -124
- package/lib/line/models/wall.js +52 -103
- package/lib/line/shaders/dash/arc_dash_frag.glsl +3 -6
- package/lib/line/shaders/dash/arc_dash_vert.glsl +6 -46
- package/lib/line/shaders/dash/line_dash_frag.glsl +4 -7
- package/lib/line/shaders/dash/line_dash_vert.glsl +3 -33
- package/lib/line/shaders/flow/flow_line_frag.glsl +13 -0
- package/lib/line/shaders/flow/flow_line_vert.glsl +83 -0
- package/lib/line/shaders/line_arc_3d_frag.glsl +6 -6
- package/lib/line/shaders/line_arc_3d_vert.glsl +4 -34
- package/lib/line/shaders/line_arc_frag.glsl +7 -11
- package/lib/line/shaders/line_arc_great_circle_frag.glsl +5 -6
- package/lib/line/shaders/line_arc_great_circle_vert.glsl +4 -32
- package/lib/line/shaders/line_arc_vert.glsl +9 -45
- package/lib/line/shaders/line_frag.glsl +15 -17
- package/lib/line/shaders/line_vert.glsl +3 -34
- package/lib/line/shaders/linear/arc3d_linear_frag.glsl +5 -19
- package/lib/line/shaders/linear/arc3d_linear_vert.glsl +9 -48
- package/lib/line/shaders/linear/arc_linear_frag.glsl +2 -30
- package/lib/line/shaders/linear/arc_linear_vert.glsl +9 -45
- package/lib/line/shaders/linear/line_linear_frag.glsl +5 -6
- package/lib/line/shaders/linearLine/line_linear_frag.glsl +2 -14
- package/lib/line/shaders/linearLine/line_linear_vert.glsl +14 -32
- package/lib/line/shaders/simple/simpleline_frag.glsl +1 -5
- package/lib/line/shaders/simple/simpleline_linear_frag.glsl +2 -6
- package/lib/line/shaders/simple/simpleline_vert.glsl +7 -33
- package/lib/mask/index.js +9 -36
- package/lib/mask/models/fill.js +29 -63
- package/lib/mask/models/index.js +0 -3
- package/lib/plugins/DataMappingPlugin.js +90 -152
- package/lib/plugins/DataSourcePlugin.js +45 -76
- package/lib/plugins/FeatureScalePlugin.js +67 -138
- package/lib/plugins/LayerAnimateStylePlugin.js +0 -10
- package/lib/plugins/LayerMaskPlugin.js +4 -17
- package/lib/plugins/LayerModelPlugin.js +80 -113
- package/lib/plugins/LayerStylePlugin.js +4 -14
- package/lib/plugins/LightingPlugin.js +12 -25
- package/lib/plugins/MultiPassRendererPlugin.js +11 -22
- package/lib/plugins/PixelPickingPlugin.js +12 -27
- package/lib/plugins/RegisterStyleAttributePlugin.js +5 -19
- package/lib/plugins/ShaderUniformPlugin.js +15 -36
- package/lib/plugins/UpdateModelPlugin.js +1 -10
- package/lib/plugins/UpdateStyleAttributePlugin.js +5 -16
- package/lib/point/index.js +27 -83
- package/lib/point/models/earthExtrude.js +60 -150
- package/lib/point/models/earthFill.js +59 -170
- package/lib/point/models/extrude.js +60 -150
- package/lib/point/models/fill.js +65 -167
- package/lib/point/models/fillmage.js +64 -155
- package/lib/point/models/image.js +52 -136
- package/lib/point/models/index.js +1 -12
- package/lib/point/models/normal.js +32 -66
- package/lib/point/models/radar.js +42 -85
- package/lib/point/models/simplePoint.js +46 -125
- package/lib/point/models/text.js +209 -350
- package/lib/point/shaders/animate/wave_frag.glsl +1 -11
- package/lib/point/shaders/earth/extrude_frag.glsl +5 -17
- package/lib/point/shaders/earth/extrude_vert.glsl +14 -29
- package/lib/point/shaders/earth/fill_frag.glsl +5 -14
- package/lib/point/shaders/earth/fill_vert.glsl +1 -75
- package/lib/point/shaders/extrude/extrude_frag.glsl +3 -29
- package/lib/point/shaders/extrude/extrude_vert.glsl +27 -35
- package/lib/point/shaders/fill_frag.glsl +9 -20
- package/lib/point/shaders/fill_vert.glsl +16 -101
- package/lib/point/shaders/image/fillImage_frag.glsl +2 -5
- package/lib/point/shaders/image/fillImage_vert.glsl +4 -47
- package/lib/point/shaders/image_frag.glsl +1 -5
- package/lib/point/shaders/image_vert.glsl +1 -44
- package/lib/point/shaders/normal_frag.glsl +0 -2
- package/lib/point/shaders/normal_vert.glsl +2 -1
- package/lib/point/shaders/radar/radar_vert.glsl +2 -2
- package/lib/point/shaders/simplePoint_frag.glsl +0 -7
- package/lib/point/shaders/simplePoint_vert.glsl +3 -45
- package/lib/point/shaders/text_frag.glsl +6 -19
- package/lib/point/shaders/text_vert.glsl +5 -66
- package/lib/point/shape/extrude.js +4 -20
- package/lib/polygon/index.js +12 -48
- package/lib/polygon/models/extrude.js +122 -173
- package/lib/polygon/models/fill.js +57 -140
- package/lib/polygon/models/index.js +2 -14
- package/lib/polygon/models/ocean.js +42 -88
- package/lib/polygon/models/water.js +37 -82
- package/lib/polygon/shaders/extrude/polygon_extrude_frag.glsl +2 -23
- package/lib/polygon/shaders/extrude/polygon_extrude_picklight_frag.glsl +7 -5
- package/lib/polygon/shaders/extrude/polygon_extrude_picklight_vert.glsl +7 -32
- package/lib/polygon/shaders/extrude/polygon_extrude_vert.glsl +33 -38
- package/lib/polygon/shaders/extrude/polygon_extrudetex_frag.glsl +12 -9
- package/lib/polygon/shaders/extrude/polygon_extrudetex_vert.glsl +16 -44
- package/lib/polygon/shaders/polygon_frag.glsl +0 -5
- package/lib/polygon/shaders/polygon_linear_frag.glsl +0 -8
- package/lib/polygon/shaders/polygon_linear_vert.glsl +0 -32
- package/lib/polygon/shaders/polygon_vert.glsl +1 -27
- package/lib/raster/buffers/triangulation.js +3 -7
- package/lib/raster/index.js +9 -40
- package/lib/raster/models/index.js +0 -5
- package/lib/raster/models/raster.js +80 -125
- package/lib/raster/models/rasterRgb.js +84 -139
- package/lib/raster/models/rasterTerrainRgb.js +56 -93
- package/lib/tile/interaction/getRasterData.js +14 -25
- package/lib/tile/interaction/utils.js +7 -19
- package/lib/tile/manager/base.js +63 -104
- package/lib/tile/service/TileLayerService.js +33 -60
- package/lib/tile/service/TilePickService.js +26 -48
- package/lib/tile/service/TileSourceService.js +2 -16
- package/lib/tile/style/utils.js +0 -3
- package/lib/tile/tileFactory/DebugTile.js +29 -54
- package/lib/tile/tileFactory/ImageTile.js +20 -46
- package/lib/tile/tileFactory/MaskTile.js +22 -51
- package/lib/tile/tileFactory/RasterRGBTile.js +22 -50
- package/lib/tile/tileFactory/RasterTerrainRGBTile.js +20 -46
- package/lib/tile/tileFactory/RasterTile.js +30 -63
- package/lib/tile/tileFactory/Tile.js +63 -102
- package/lib/tile/tileFactory/VectorTile.js +41 -76
- package/lib/tile/tileFactory/index.js +0 -25
- package/lib/tile/tileFactory/layers/TileDebugLayer.js +6 -32
- package/lib/tile/tileFactory/util.js +0 -9
- package/lib/tile/tileLayer/BaseLayer.js +105 -153
- package/lib/tile/utils.js +1 -5
- package/lib/utils/blend.js +0 -5
- package/lib/utils/collision-index.js +9 -25
- package/lib/utils/extrude_polyline.js +101 -181
- package/lib/utils/grid-index.js +2 -28
- package/lib/utils/identityScale.js +0 -9
- package/lib/utils/layerData.js +32 -51
- package/lib/utils/multiPassRender.js +11 -16
- package/lib/utils/polylineNormal.js +31 -66
- package/lib/utils/simpleLine.js +2 -21
- package/lib/utils/stencil.js +0 -4
- package/lib/utils/symbol-layout.js +27 -55
- package/lib/wind/index.js +9 -37
- package/lib/wind/models/index.js +0 -3
- package/lib/wind/models/utils.js +26 -62
- package/lib/wind/models/wind.js +101 -157
- package/lib/wind/models/windRender.js +53 -71
- package/lib/wind/models/windShader.js +0 -1
- package/package.json +7 -7
- package/es/line/models/half.js +0 -298
- package/es/line/shaders/half/line_half_frag.glsl +0 -53
- package/es/line/shaders/half/line_half_vert.glsl +0 -169
- package/es/utils/dataMappingStyle.d.ts +0 -31
- package/es/utils/dataMappingStyle.js +0 -147
- package/lib/line/models/half.js +0 -315
- package/lib/line/shaders/half/line_half_frag.glsl +0 -53
- package/lib/line/shaders/half/line_half_vert.glsl +0 -169
- package/lib/utils/dataMappingStyle.js +0 -151
package/es/core/BaseLayer.js
CHANGED
|
@@ -12,31 +12,22 @@ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
|
12
12
|
import _applyDecoratedDescriptor from "@babel/runtime/helpers/esm/applyDecoratedDescriptor";
|
|
13
13
|
import _initializerWarningHelper from "@babel/runtime/helpers/esm/initializerWarningHelper";
|
|
14
14
|
var _excluded = ["passes"],
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
_excluded2 = ["moduleName", "vertexShader", "fragmentShader", "inject", "triangulation", "segmentNumber"];
|
|
17
16
|
var _dec, _class, _descriptor;
|
|
18
|
-
|
|
19
17
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
20
|
-
|
|
21
18
|
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
22
|
-
|
|
23
19
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
24
|
-
|
|
25
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
26
|
-
|
|
20
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
27
21
|
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); }; }
|
|
28
|
-
|
|
29
22
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
30
|
-
|
|
31
23
|
// @ts-ignore
|
|
32
24
|
import { AsyncSeriesBailHook, AsyncWaterfallHook, SyncBailHook, SyncHook } from '@antv/async-hook';
|
|
33
25
|
import { BlendType, IDebugLog, ILayerStage, lazyInject, TYPES } from '@antv/l7-core';
|
|
34
26
|
import Source from '@antv/l7-source';
|
|
35
|
-
import { encodePickingColor
|
|
27
|
+
import { encodePickingColor } from '@antv/l7-utils';
|
|
36
28
|
import { EventEmitter } from 'eventemitter3';
|
|
37
|
-
import { isEqual, isFunction, isObject, isUndefined } from 'lodash';
|
|
29
|
+
import { isEqual, isFunction, isObject, isPlainObject, isUndefined } from 'lodash';
|
|
38
30
|
import { BlendTypes } from "../utils/blend";
|
|
39
|
-
import { styleDataMapping } from "../utils/dataMappingStyle";
|
|
40
31
|
import { calculateData } from "../utils/layerData";
|
|
41
32
|
import { createMultiPassRenderer, normalizePasses } from "../utils/multiPassRender";
|
|
42
33
|
import LayerPickService from "./LayerPickService";
|
|
@@ -44,52 +35,38 @@ import TextureService from "./TextureService";
|
|
|
44
35
|
/**
|
|
45
36
|
* 分配 layer id
|
|
46
37
|
*/
|
|
47
|
-
|
|
48
38
|
var layerIdCounter = 0;
|
|
49
39
|
var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__PURE__*/function (_ref) {
|
|
50
40
|
_inherits(BaseLayer, _ref);
|
|
51
|
-
|
|
52
41
|
var _super = _createSuper(BaseLayer);
|
|
53
|
-
|
|
54
42
|
// 生命周期钩子
|
|
43
|
+
|
|
55
44
|
// 待渲染 model 列表
|
|
45
|
+
|
|
56
46
|
// 用于保存子图层对象
|
|
57
47
|
|
|
58
48
|
/**
|
|
59
49
|
* 待更新样式属性,在初始化阶段完成注册
|
|
60
50
|
*/
|
|
51
|
+
|
|
61
52
|
// private pickingPassRender: IPass<'pixelPicking'>;
|
|
53
|
+
|
|
62
54
|
function BaseLayer() {
|
|
63
55
|
var _this;
|
|
64
|
-
|
|
65
56
|
var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
66
|
-
|
|
67
57
|
_classCallCheck(this, BaseLayer);
|
|
68
|
-
|
|
69
58
|
_this = _super.call(this);
|
|
70
|
-
|
|
71
59
|
_defineProperty(_assertThisInitialized(_this), "id", "".concat(layerIdCounter++));
|
|
72
|
-
|
|
73
60
|
_defineProperty(_assertThisInitialized(_this), "name", "".concat(layerIdCounter));
|
|
74
|
-
|
|
75
61
|
_defineProperty(_assertThisInitialized(_this), "visible", true);
|
|
76
|
-
|
|
77
62
|
_defineProperty(_assertThisInitialized(_this), "zIndex", 0);
|
|
78
|
-
|
|
79
63
|
_defineProperty(_assertThisInitialized(_this), "inited", false);
|
|
80
|
-
|
|
81
64
|
_defineProperty(_assertThisInitialized(_this), "layerModelNeedUpdate", false);
|
|
82
|
-
|
|
83
65
|
_defineProperty(_assertThisInitialized(_this), "pickedFeatureID", null);
|
|
84
|
-
|
|
85
66
|
_defineProperty(_assertThisInitialized(_this), "selectedFeatureID", null);
|
|
86
|
-
|
|
87
67
|
_defineProperty(_assertThisInitialized(_this), "styleNeedUpdate", false);
|
|
88
|
-
|
|
89
68
|
_defineProperty(_assertThisInitialized(_this), "forceRender", false);
|
|
90
|
-
|
|
91
69
|
_defineProperty(_assertThisInitialized(_this), "clusterZoom", 0);
|
|
92
|
-
|
|
93
70
|
_defineProperty(_assertThisInitialized(_this), "defaultSourceConfig", {
|
|
94
71
|
data: [],
|
|
95
72
|
options: {
|
|
@@ -98,7 +75,6 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
98
75
|
}
|
|
99
76
|
}
|
|
100
77
|
});
|
|
101
|
-
|
|
102
78
|
_defineProperty(_assertThisInitialized(_this), "dataState", {
|
|
103
79
|
dataSourceNeedUpdate: false,
|
|
104
80
|
dataMappingNeedUpdate: false,
|
|
@@ -106,7 +82,6 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
106
82
|
featureScaleNeedUpdate: false,
|
|
107
83
|
StyleAttrNeedUpdate: false
|
|
108
84
|
});
|
|
109
|
-
|
|
110
85
|
_defineProperty(_assertThisInitialized(_this), "hooks", {
|
|
111
86
|
init: new AsyncSeriesBailHook(),
|
|
112
87
|
afterInit: new SyncBailHook(),
|
|
@@ -122,56 +97,38 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
122
97
|
beforeDestroy: new SyncHook(),
|
|
123
98
|
afterDestroy: new SyncHook()
|
|
124
99
|
});
|
|
125
|
-
|
|
126
100
|
_defineProperty(_assertThisInitialized(_this), "models", []);
|
|
127
|
-
|
|
128
101
|
_defineProperty(_assertThisInitialized(_this), "startInit", false);
|
|
129
|
-
|
|
130
102
|
_defineProperty(_assertThisInitialized(_this), "layerChildren", []);
|
|
131
|
-
|
|
132
103
|
_defineProperty(_assertThisInitialized(_this), "masks", []);
|
|
133
|
-
|
|
134
104
|
_initializerDefineProperty(_assertThisInitialized(_this), "configService", _descriptor, _assertThisInitialized(_this));
|
|
135
|
-
|
|
136
105
|
_defineProperty(_assertThisInitialized(_this), "animateOptions", {
|
|
137
106
|
enable: false
|
|
138
107
|
});
|
|
139
|
-
|
|
140
108
|
_defineProperty(_assertThisInitialized(_this), "currentPickId", null);
|
|
141
|
-
|
|
109
|
+
_defineProperty(_assertThisInitialized(_this), "encodeStyleAttribute", {});
|
|
110
|
+
_defineProperty(_assertThisInitialized(_this), "enableEncodeStyles", []);
|
|
142
111
|
_defineProperty(_assertThisInitialized(_this), "pendingStyleAttributes", []);
|
|
143
|
-
|
|
144
112
|
_defineProperty(_assertThisInitialized(_this), "scaleOptions", {});
|
|
145
|
-
|
|
146
113
|
_defineProperty(_assertThisInitialized(_this), "animateStatus", false);
|
|
147
|
-
|
|
148
114
|
_defineProperty(_assertThisInitialized(_this), "isDestroyed", false);
|
|
149
|
-
|
|
150
115
|
_defineProperty(_assertThisInitialized(_this), "encodeDataLength", 0);
|
|
151
|
-
|
|
152
116
|
_defineProperty(_assertThisInitialized(_this), "sourceEvent", function () {
|
|
153
117
|
_this.dataState.dataSourceNeedUpdate = true;
|
|
154
|
-
|
|
155
118
|
var layerConfig = _this.getLayerConfig();
|
|
156
|
-
|
|
157
119
|
if (layerConfig && layerConfig.autoFit) {
|
|
158
120
|
_this.fitBounds(layerConfig.fitBoundsOptions);
|
|
159
121
|
}
|
|
160
|
-
|
|
161
122
|
var autoRender = _this.layerSource.getSourceCfg().autoRender;
|
|
162
|
-
|
|
163
123
|
if (autoRender) {
|
|
164
124
|
_this.reRender();
|
|
165
125
|
}
|
|
166
126
|
});
|
|
167
|
-
|
|
168
127
|
_this.name = config.name || _this.id;
|
|
169
128
|
_this.zIndex = config.zIndex || 0;
|
|
170
|
-
_this.rawConfig = config;
|
|
171
|
-
|
|
129
|
+
_this.rawConfig = config;
|
|
172
130
|
return _this;
|
|
173
131
|
}
|
|
174
|
-
|
|
175
132
|
_createClass(BaseLayer, [{
|
|
176
133
|
key: "addMask",
|
|
177
134
|
value: function addMask(layer) {
|
|
@@ -182,7 +139,6 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
182
139
|
key: "removeMask",
|
|
183
140
|
value: function removeMask(layer) {
|
|
184
141
|
var layerIndex = this.masks.indexOf(layer);
|
|
185
|
-
|
|
186
142
|
if (layerIndex > -1) {
|
|
187
143
|
this.masks.splice(layerIndex, 1);
|
|
188
144
|
}
|
|
@@ -200,23 +156,21 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
200
156
|
this.updateLayerConfig({
|
|
201
157
|
enableMask: true
|
|
202
158
|
});
|
|
203
|
-
}
|
|
204
|
-
|
|
159
|
+
}
|
|
160
|
+
// 将废弃
|
|
205
161
|
}, {
|
|
206
162
|
key: "addMaskLayer",
|
|
207
163
|
value: function addMaskLayer(maskLayer) {
|
|
208
164
|
this.masks.push(maskLayer);
|
|
209
|
-
}
|
|
210
|
-
|
|
165
|
+
}
|
|
166
|
+
// 将废弃
|
|
211
167
|
}, {
|
|
212
168
|
key: "removeMaskLayer",
|
|
213
169
|
value: function removeMaskLayer(maskLayer) {
|
|
214
170
|
var layerIndex = this.masks.indexOf(maskLayer);
|
|
215
|
-
|
|
216
171
|
if (layerIndex > -1) {
|
|
217
172
|
this.masks.splice(layerIndex, 1);
|
|
218
173
|
}
|
|
219
|
-
|
|
220
174
|
maskLayer.destroy();
|
|
221
175
|
}
|
|
222
176
|
}, {
|
|
@@ -233,7 +187,6 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
233
187
|
key: "updateLayerConfig",
|
|
234
188
|
value: function updateLayerConfig(configToUpdate) {
|
|
235
189
|
var _this2 = this;
|
|
236
|
-
|
|
237
190
|
// 同步 rawConfig
|
|
238
191
|
Object.keys(configToUpdate).map(function (key) {
|
|
239
192
|
if (key in _this2.rawConfig) {
|
|
@@ -241,25 +194,23 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
241
194
|
_this2.rawConfig[key] = configToUpdate[key];
|
|
242
195
|
}
|
|
243
196
|
});
|
|
244
|
-
|
|
245
197
|
if (!this.startInit) {
|
|
246
198
|
this.needUpdateConfig = _objectSpread(_objectSpread({}, this.needUpdateConfig), configToUpdate);
|
|
247
199
|
} else {
|
|
248
|
-
var sceneId = this.container.get(TYPES.SceneID);
|
|
249
|
-
|
|
250
|
-
styleDataMapping(configToUpdate, this); // 处理 style 中进行数据映射的属性字段
|
|
251
|
-
|
|
200
|
+
var sceneId = this.container.get(TYPES.SceneID);
|
|
201
|
+
// @ts-ignore
|
|
202
|
+
// styleDataMapping(configToUpdate, this); // 处理 style 中进行数据映射的属性字段
|
|
252
203
|
this.configService.setLayerConfig(sceneId, this.id, _objectSpread(_objectSpread(_objectSpread({}, this.configService.getLayerConfig(this.id)), this.needUpdateConfig), configToUpdate));
|
|
253
204
|
this.needUpdateConfig = {};
|
|
254
205
|
}
|
|
255
206
|
}
|
|
207
|
+
|
|
256
208
|
/**
|
|
257
209
|
* 注入图层容器,父容器为场景容器
|
|
258
210
|
* RootContainer 1
|
|
259
211
|
* -> SceneContainer 1.*
|
|
260
212
|
* -> LayerContainer 1.*
|
|
261
213
|
*/
|
|
262
|
-
|
|
263
214
|
}, {
|
|
264
215
|
key: "setContainer",
|
|
265
216
|
value: function setContainer(container, sceneContainer) {
|
|
@@ -282,146 +233,137 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
282
233
|
value: function () {
|
|
283
234
|
var _init = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
284
235
|
var _this3 = this;
|
|
285
|
-
|
|
286
236
|
var sceneId, _this$getLayerConfig, enableMultiPassRenderer, passes, _iterator, _step, plugin;
|
|
287
|
-
|
|
288
237
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
289
|
-
while (1) {
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
});
|
|
319
|
-
}
|
|
320
|
-
|
|
321
|
-
this.cameraService = this.container.get(TYPES.ICameraService);
|
|
322
|
-
this.coordinateService = this.container.get(TYPES.ICoordinateSystemService);
|
|
323
|
-
this.shaderModuleService = this.container.get(TYPES.IShaderModuleService);
|
|
324
|
-
this.postProcessingPassFactory = this.container.get(TYPES.IFactoryPostProcessingPass);
|
|
325
|
-
this.normalPassFactory = this.container.get(TYPES.IFactoryNormalPass); // 图层容器服务
|
|
326
|
-
|
|
327
|
-
this.styleAttributeService = this.container.get(TYPES.IStyleAttributeService);
|
|
328
|
-
|
|
329
|
-
if (enableMultiPassRenderer) {
|
|
330
|
-
// 按需初始化 瓦片频繁报错
|
|
331
|
-
this.multiPassRenderer = this.container.get(TYPES.IMultiPassRenderer);
|
|
332
|
-
this.multiPassRenderer.setLayer(this);
|
|
333
|
-
} // 完成样式服务注册完成前添加的属性
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
this.pendingStyleAttributes.forEach(function (_ref2) {
|
|
337
|
-
var attributeName = _ref2.attributeName,
|
|
338
|
-
attributeField = _ref2.attributeField,
|
|
339
|
-
attributeValues = _ref2.attributeValues,
|
|
340
|
-
updateOptions = _ref2.updateOptions;
|
|
341
|
-
|
|
342
|
-
_this3.styleAttributeService.updateStyleAttribute(attributeName, {
|
|
343
|
-
// @ts-ignore
|
|
344
|
-
scale: _objectSpread({
|
|
345
|
-
field: attributeField
|
|
346
|
-
}, _this3.splitValuesAndCallbackInAttribute( // @ts-ignore
|
|
347
|
-
attributeValues, // @ts-ignore
|
|
348
|
-
_this3.getLayerConfig()[attributeName]))
|
|
349
|
-
}, // @ts-ignore
|
|
350
|
-
updateOptions);
|
|
238
|
+
while (1) switch (_context.prev = _context.next) {
|
|
239
|
+
case 0:
|
|
240
|
+
// 设置配置项
|
|
241
|
+
sceneId = this.container.get(TYPES.SceneID);
|
|
242
|
+
this.startInit = true;
|
|
243
|
+
// 初始化图层配置项
|
|
244
|
+
// const { enableMultiPassRenderer = false } = this.rawConfig;
|
|
245
|
+
// this.configService.setLayerConfig(sceneId, this.id, {
|
|
246
|
+
// enableMultiPassRenderer,
|
|
247
|
+
// });
|
|
248
|
+
this.configService.setLayerConfig(sceneId, this.id, this.rawConfig);
|
|
249
|
+
this.layerType = this.rawConfig.layerType;
|
|
250
|
+
|
|
251
|
+
// 全局容器服务
|
|
252
|
+
|
|
253
|
+
// 场景容器服务
|
|
254
|
+
this.iconService = this.container.get(TYPES.IIconService);
|
|
255
|
+
this.fontService = this.container.get(TYPES.IFontService);
|
|
256
|
+
this.rendererService = this.container.get(TYPES.IRendererService);
|
|
257
|
+
this.layerService = this.container.get(TYPES.ILayerService);
|
|
258
|
+
this.debugService = this.container.get(TYPES.IDebugService);
|
|
259
|
+
this.interactionService = this.container.get(TYPES.IInteractionService);
|
|
260
|
+
this.pickingService = this.container.get(TYPES.IPickingService);
|
|
261
|
+
this.mapService = this.container.get(TYPES.IMapService);
|
|
262
|
+
_this$getLayerConfig = this.getLayerConfig(), enableMultiPassRenderer = _this$getLayerConfig.enableMultiPassRenderer, passes = _this$getLayerConfig.passes;
|
|
263
|
+
if (enableMultiPassRenderer && passes !== null && passes !== void 0 && passes.length && passes.length > 0) {
|
|
264
|
+
// Tip: 兼容 multiPassRender 在 amap1 时存在的图层不同步问题 zoom
|
|
265
|
+
this.mapService.on('mapAfterFrameChange', function () {
|
|
266
|
+
_this3.renderLayers();
|
|
351
267
|
});
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
268
|
+
}
|
|
269
|
+
this.cameraService = this.container.get(TYPES.ICameraService);
|
|
270
|
+
this.coordinateService = this.container.get(TYPES.ICoordinateSystemService);
|
|
271
|
+
this.shaderModuleService = this.container.get(TYPES.IShaderModuleService);
|
|
272
|
+
this.postProcessingPassFactory = this.container.get(TYPES.IFactoryPostProcessingPass);
|
|
273
|
+
this.normalPassFactory = this.container.get(TYPES.IFactoryNormalPass);
|
|
274
|
+
|
|
275
|
+
// 图层容器服务
|
|
276
|
+
this.styleAttributeService = this.container.get(TYPES.IStyleAttributeService);
|
|
277
|
+
if (enableMultiPassRenderer) {
|
|
278
|
+
// 按需初始化 瓦片频繁报错
|
|
279
|
+
this.multiPassRenderer = this.container.get(TYPES.IMultiPassRenderer);
|
|
280
|
+
this.multiPassRenderer.setLayer(this);
|
|
281
|
+
}
|
|
282
|
+
// 完成样式服务注册完成前添加的属性
|
|
283
|
+
this.pendingStyleAttributes.forEach(function (_ref2) {
|
|
284
|
+
var attributeName = _ref2.attributeName,
|
|
285
|
+
attributeField = _ref2.attributeField,
|
|
286
|
+
attributeValues = _ref2.attributeValues,
|
|
287
|
+
updateOptions = _ref2.updateOptions;
|
|
288
|
+
_this3.styleAttributeService.updateStyleAttribute(attributeName, {
|
|
289
|
+
// @ts-ignore
|
|
290
|
+
scale: _objectSpread({
|
|
291
|
+
field: attributeField
|
|
292
|
+
}, _this3.splitValuesAndCallbackInAttribute(
|
|
293
|
+
// @ts-ignore
|
|
294
|
+
attributeValues,
|
|
295
|
+
// @ts-ignore
|
|
296
|
+
_this3.getLayerConfig()[attributeName]))
|
|
297
|
+
},
|
|
298
|
+
// @ts-ignore
|
|
299
|
+
updateOptions);
|
|
300
|
+
});
|
|
301
|
+
this.pendingStyleAttributes = [];
|
|
302
|
+
|
|
303
|
+
// 获取插件集
|
|
304
|
+
this.plugins = this.container.getAll(TYPES.ILayerPlugin);
|
|
305
|
+
// 完成插件注册,传入场景和图层容器内的服务
|
|
306
|
+
_iterator = _createForOfIteratorHelper(this.plugins);
|
|
307
|
+
try {
|
|
308
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
309
|
+
plugin = _step.value;
|
|
310
|
+
plugin.apply(this, {
|
|
311
|
+
rendererService: this.rendererService,
|
|
312
|
+
mapService: this.mapService,
|
|
313
|
+
styleAttributeService: this.styleAttributeService,
|
|
314
|
+
normalPassFactory: this.normalPassFactory,
|
|
315
|
+
postProcessingPassFactory: this.postProcessingPassFactory
|
|
316
|
+
});
|
|
374
317
|
}
|
|
375
318
|
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
319
|
+
// 初始化其他服务
|
|
320
|
+
} catch (err) {
|
|
321
|
+
_iterator.e(err);
|
|
322
|
+
} finally {
|
|
323
|
+
_iterator.f();
|
|
324
|
+
}
|
|
325
|
+
this.layerPickService = new LayerPickService(this);
|
|
326
|
+
|
|
327
|
+
// 颜色纹理服务
|
|
328
|
+
this.textureService = new TextureService(this);
|
|
329
|
+
this.log(IDebugLog.LayerInitStart);
|
|
330
|
+
// 触发 init 生命周期插件
|
|
331
|
+
_context.next = 31;
|
|
332
|
+
return this.hooks.init.promise();
|
|
333
|
+
case 31:
|
|
334
|
+
this.log(IDebugLog.LayerInitEnd);
|
|
335
|
+
this.inited = true;
|
|
336
|
+
// add mask layer
|
|
337
|
+
// 触发初始化完成事件;
|
|
338
|
+
this.emit('inited', {
|
|
339
|
+
target: this,
|
|
340
|
+
type: 'inited'
|
|
341
|
+
});
|
|
342
|
+
this.emit('add', {
|
|
343
|
+
target: this,
|
|
344
|
+
type: 'add'
|
|
345
|
+
});
|
|
346
|
+
this.hooks.afterInit.call();
|
|
347
|
+
case 36:
|
|
348
|
+
case "end":
|
|
349
|
+
return _context.stop();
|
|
403
350
|
}
|
|
404
351
|
}, _callee, this);
|
|
405
352
|
}));
|
|
406
|
-
|
|
407
353
|
function init() {
|
|
408
354
|
return _init.apply(this, arguments);
|
|
409
355
|
}
|
|
410
|
-
|
|
411
356
|
return init;
|
|
412
357
|
}()
|
|
413
358
|
}, {
|
|
414
359
|
key: "log",
|
|
415
360
|
value: function log(logType) {
|
|
416
361
|
var _this$debugService;
|
|
417
|
-
|
|
418
362
|
var step = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'init';
|
|
419
|
-
|
|
420
363
|
// @ts-ignore 瓦片、瓦片图层目前不参与日志
|
|
421
364
|
if (this.tileLayer || this.isTileLayer) {
|
|
422
365
|
return;
|
|
423
366
|
}
|
|
424
|
-
|
|
425
367
|
var key = "".concat(this.id, ".").concat(step, ".").concat(logType);
|
|
426
368
|
var values = {
|
|
427
369
|
id: this.id,
|
|
@@ -444,15 +386,12 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
444
386
|
key: "createModelData",
|
|
445
387
|
value: function createModelData(data, option) {
|
|
446
388
|
var _this$layerModel;
|
|
447
|
-
|
|
448
389
|
if ((_this$layerModel = this.layerModel) !== null && _this$layerModel !== void 0 && _this$layerModel.createModelData) {
|
|
449
390
|
// 在某些特殊图层中单独构建 attribute & elements
|
|
450
391
|
return this.layerModel.createModelData(option);
|
|
451
392
|
}
|
|
452
|
-
|
|
453
393
|
var calEncodeData = this.calculateEncodeData(data, option);
|
|
454
394
|
var triangulation = this.triangulation;
|
|
455
|
-
|
|
456
395
|
if (calEncodeData && triangulation) {
|
|
457
396
|
return this.styleAttributeService.createAttributesAndIndices(calEncodeData, triangulation);
|
|
458
397
|
} else {
|
|
@@ -480,15 +419,16 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
480
419
|
/**
|
|
481
420
|
* Model初始化前需要更新Model样式
|
|
482
421
|
*/
|
|
483
|
-
|
|
484
422
|
}, {
|
|
485
423
|
key: "prepareBuildModel",
|
|
486
424
|
value: function prepareBuildModel() {
|
|
487
|
-
this.
|
|
425
|
+
if (Object.keys(this.needUpdateConfig || {}).length !== 0) {
|
|
426
|
+
this.updateLayerConfig({});
|
|
427
|
+
}
|
|
488
428
|
|
|
429
|
+
// 启动动画
|
|
489
430
|
var _this$getLayerConfig2 = this.getLayerConfig(),
|
|
490
|
-
|
|
491
|
-
|
|
431
|
+
animateOption = _this$getLayerConfig2.animateOption;
|
|
492
432
|
if (animateOption !== null && animateOption !== void 0 && animateOption.enable) {
|
|
493
433
|
this.layerService.startAnimate();
|
|
494
434
|
this.animateStatus = true;
|
|
@@ -499,8 +439,9 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
499
439
|
value: function color(field, values, updateOptions) {
|
|
500
440
|
this.updateStyleAttribute('color', field, values, updateOptions);
|
|
501
441
|
return this;
|
|
502
|
-
}
|
|
442
|
+
}
|
|
503
443
|
|
|
444
|
+
// 为对应的图层传入纹理的编号名称(point/image 在 shape 方法中传入纹理名称的方法并不通用)
|
|
504
445
|
}, {
|
|
505
446
|
key: "texture",
|
|
506
447
|
value: function texture(field, values, updateOptions) {
|
|
@@ -518,8 +459,8 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
518
459
|
value: function size(field, values, updateOptions) {
|
|
519
460
|
this.updateStyleAttribute('size', field, values, updateOptions);
|
|
520
461
|
return this;
|
|
521
|
-
}
|
|
522
|
-
|
|
462
|
+
}
|
|
463
|
+
// 对mapping后的数据过滤,scale保持不变
|
|
523
464
|
}, {
|
|
524
465
|
key: "filter",
|
|
525
466
|
value: function filter(field, values, updateOptions) {
|
|
@@ -553,14 +494,12 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
553
494
|
key: "animate",
|
|
554
495
|
value: function animate(options) {
|
|
555
496
|
var rawAnimate = {};
|
|
556
|
-
|
|
557
497
|
if (isObject(options)) {
|
|
558
498
|
rawAnimate.enable = true;
|
|
559
499
|
rawAnimate = _objectSpread(_objectSpread({}, rawAnimate), options);
|
|
560
500
|
} else {
|
|
561
501
|
rawAnimate.enable = options;
|
|
562
502
|
}
|
|
563
|
-
|
|
564
503
|
this.updateLayerConfig({
|
|
565
504
|
animateOption: rawAnimate
|
|
566
505
|
});
|
|
@@ -573,9 +512,8 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
573
512
|
// 判断是否为source
|
|
574
513
|
this.setSource(data);
|
|
575
514
|
return this;
|
|
576
|
-
}
|
|
577
|
-
|
|
578
|
-
|
|
515
|
+
}
|
|
516
|
+
// 设置source 配置
|
|
579
517
|
this.sourceOption = {
|
|
580
518
|
data: data,
|
|
581
519
|
options: options
|
|
@@ -587,7 +525,6 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
587
525
|
key: "setData",
|
|
588
526
|
value: function setData(data, options) {
|
|
589
527
|
var _this4 = this;
|
|
590
|
-
|
|
591
528
|
if (this.inited) {
|
|
592
529
|
this.log(IDebugLog.SourceInitStart, ILayerStage.UPDATE);
|
|
593
530
|
this.layerSource.setData(data, options);
|
|
@@ -595,82 +532,80 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
595
532
|
} else {
|
|
596
533
|
this.on('inited', function () {
|
|
597
534
|
_this4.log(IDebugLog.SourceInitStart, ILayerStage.UPDATE);
|
|
598
|
-
|
|
599
535
|
var currentSource = _this4.getSource();
|
|
600
|
-
|
|
601
536
|
if (!currentSource) {
|
|
602
537
|
// 执行 setData 的时候 source 还不存在(还未执行 addLayer)
|
|
603
538
|
_this4.source(new Source(data, options));
|
|
604
539
|
} else {
|
|
605
540
|
_this4.layerSource.setData(data, options);
|
|
606
541
|
}
|
|
607
|
-
|
|
608
542
|
_this4.layerSource.once('update', function () {
|
|
609
543
|
_this4.log(IDebugLog.SourceInitEnd, ILayerStage.UPDATE);
|
|
610
544
|
});
|
|
611
545
|
});
|
|
612
546
|
}
|
|
613
|
-
|
|
614
547
|
return this;
|
|
615
548
|
}
|
|
616
549
|
}, {
|
|
617
550
|
key: "style",
|
|
618
551
|
value: function style(options) {
|
|
619
552
|
var _this5 = this;
|
|
620
|
-
|
|
621
553
|
var passes = options.passes,
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
554
|
+
rest = _objectWithoutProperties(options, _excluded);
|
|
555
|
+
// passes 特殊处理
|
|
625
556
|
if (passes) {
|
|
626
557
|
normalizePasses(passes).forEach(function (pass) {
|
|
627
558
|
var postProcessingPass = _this5.multiPassRenderer.getPostProcessor().getPostProcessingPassByName(pass[0]);
|
|
628
|
-
|
|
629
559
|
if (postProcessingPass) {
|
|
630
560
|
postProcessingPass.updateOptions(pass[1]);
|
|
631
561
|
}
|
|
632
562
|
});
|
|
633
563
|
}
|
|
634
|
-
|
|
635
|
-
this.
|
|
636
|
-
|
|
637
|
-
if (this.container) {
|
|
638
|
-
this.updateLayerConfig(this.rawConfig);
|
|
639
|
-
this.styleNeedUpdate = true;
|
|
640
|
-
} // TODO style model 更新
|
|
641
|
-
// @ts-ignore
|
|
642
|
-
// if (lastConfig && lastConfig.mask === true && options.mask === false) {
|
|
643
|
-
// this.clearModels();
|
|
644
|
-
// this.layerModel.buildModels((models) => {
|
|
645
|
-
// this.models = models;
|
|
646
|
-
// });
|
|
647
|
-
// }
|
|
648
|
-
|
|
649
|
-
|
|
564
|
+
this.encodeStyle(rest);
|
|
565
|
+
this.updateLayerConfig(rest);
|
|
650
566
|
return this;
|
|
651
567
|
}
|
|
568
|
+
|
|
569
|
+
// 参与数据映射的字段 encodeing
|
|
570
|
+
}, {
|
|
571
|
+
key: "encodeStyle",
|
|
572
|
+
value: function encodeStyle(options) {
|
|
573
|
+
var _this6 = this;
|
|
574
|
+
Object.keys(options).forEach(function (key) {
|
|
575
|
+
if (
|
|
576
|
+
// 需要数据映射
|
|
577
|
+
_this6.enableEncodeStyles.includes(key) && isPlainObject(options[key]) && (options[key].field || options[key].values) && !isEqual(_this6.encodeStyleAttribute[key], options[key]) // 防止计算属性重复计算
|
|
578
|
+
) {
|
|
579
|
+
_this6.encodeStyleAttribute[key] = options[key];
|
|
580
|
+
_this6.updateStyleAttribute(key, options[key].field, options[key].values);
|
|
581
|
+
_this6.styleNeedUpdate = true;
|
|
582
|
+
} else {
|
|
583
|
+
// 不需要数据映射
|
|
584
|
+
if (_this6.encodeStyleAttribute[key]) {
|
|
585
|
+
delete _this6.encodeStyleAttribute[key]; // 删除已经存在的属性
|
|
586
|
+
}
|
|
587
|
+
}
|
|
588
|
+
});
|
|
589
|
+
}
|
|
652
590
|
}, {
|
|
653
591
|
key: "scale",
|
|
654
592
|
value: function scale(field, cfg) {
|
|
655
593
|
var preOption = _objectSpread({}, this.scaleOptions);
|
|
656
|
-
|
|
657
594
|
if (isObject(field)) {
|
|
658
595
|
this.scaleOptions = _objectSpread(_objectSpread({}, this.scaleOptions), field);
|
|
659
596
|
} else {
|
|
660
597
|
this.scaleOptions[field] = cfg;
|
|
661
598
|
}
|
|
662
|
-
|
|
663
599
|
if (this.styleAttributeService && !isEqual(preOption, this.scaleOptions)) {
|
|
664
600
|
var scaleOptions = isObject(field) ? field : _defineProperty({}, field, cfg);
|
|
665
601
|
this.styleAttributeService.updateScaleAttribute(scaleOptions);
|
|
666
602
|
}
|
|
667
|
-
|
|
668
603
|
return this;
|
|
669
604
|
}
|
|
605
|
+
|
|
670
606
|
/**
|
|
671
607
|
* 渲染所有的图层
|
|
672
608
|
*/
|
|
673
|
-
|
|
674
609
|
}, {
|
|
675
610
|
key: "renderLayers",
|
|
676
611
|
value: function renderLayers() {
|
|
@@ -682,75 +617,61 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
682
617
|
key: "render",
|
|
683
618
|
value: function render() {
|
|
684
619
|
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
685
|
-
|
|
686
620
|
if (this.tileLayer) {
|
|
687
621
|
// 瓦片图层执行单独的 render 渲染队列
|
|
688
622
|
this.tileLayer.render();
|
|
689
623
|
return this;
|
|
690
624
|
}
|
|
691
|
-
|
|
692
625
|
this.layerService.beforeRenderData(this);
|
|
693
|
-
|
|
694
626
|
if (this.encodeDataLength <= 0 && !this.forceRender) {
|
|
695
627
|
return this;
|
|
696
|
-
}
|
|
697
|
-
|
|
698
|
-
|
|
628
|
+
}
|
|
629
|
+
// Tip: this.getEncodedData().length !== 0 这个判断是为了解决在 2.5.x 引入数据纹理后产生的 空数据渲染导致 texture 超出上限问题
|
|
699
630
|
this.renderModels(options);
|
|
700
631
|
return this;
|
|
701
632
|
}
|
|
633
|
+
|
|
702
634
|
/**
|
|
703
635
|
* renderMultiPass 专门用于渲染支持 multipass 的 layer
|
|
704
636
|
*/
|
|
705
|
-
|
|
706
637
|
}, {
|
|
707
638
|
key: "renderMultiPass",
|
|
708
639
|
value: function () {
|
|
709
640
|
var _renderMultiPass = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
710
641
|
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
711
|
-
while (1) {
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
_context2.next = 2;
|
|
716
|
-
break;
|
|
717
|
-
}
|
|
718
|
-
|
|
719
|
-
return _context2.abrupt("return");
|
|
720
|
-
|
|
721
|
-
case 2:
|
|
722
|
-
if (!(this.multiPassRenderer && this.multiPassRenderer.getRenderFlag())) {
|
|
723
|
-
_context2.next = 7;
|
|
724
|
-
break;
|
|
725
|
-
}
|
|
726
|
-
|
|
727
|
-
_context2.next = 5;
|
|
728
|
-
return this.multiPassRenderer.render();
|
|
729
|
-
|
|
730
|
-
case 5:
|
|
731
|
-
_context2.next = 8;
|
|
642
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
643
|
+
case 0:
|
|
644
|
+
if (!(this.encodeDataLength <= 0 && !this.forceRender)) {
|
|
645
|
+
_context2.next = 2;
|
|
732
646
|
break;
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
647
|
+
}
|
|
648
|
+
return _context2.abrupt("return");
|
|
649
|
+
case 2:
|
|
650
|
+
if (!(this.multiPassRenderer && this.multiPassRenderer.getRenderFlag())) {
|
|
651
|
+
_context2.next = 7;
|
|
652
|
+
break;
|
|
653
|
+
}
|
|
654
|
+
_context2.next = 5;
|
|
655
|
+
return this.multiPassRenderer.render();
|
|
656
|
+
case 5:
|
|
657
|
+
_context2.next = 8;
|
|
658
|
+
break;
|
|
659
|
+
case 7:
|
|
660
|
+
if (this.multiPassRenderer) {
|
|
661
|
+
// renderPass 触发的渲染
|
|
662
|
+
this.renderModels();
|
|
663
|
+
} else {
|
|
664
|
+
this.renderModels();
|
|
665
|
+
}
|
|
666
|
+
case 8:
|
|
667
|
+
case "end":
|
|
668
|
+
return _context2.stop();
|
|
746
669
|
}
|
|
747
670
|
}, _callee2, this);
|
|
748
671
|
}));
|
|
749
|
-
|
|
750
672
|
function renderMultiPass() {
|
|
751
673
|
return _renderMultiPass.apply(this, arguments);
|
|
752
674
|
}
|
|
753
|
-
|
|
754
675
|
return renderMultiPass;
|
|
755
676
|
}()
|
|
756
677
|
}, {
|
|
@@ -758,34 +679,29 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
758
679
|
value: function active(options) {
|
|
759
680
|
var activeOption = {};
|
|
760
681
|
activeOption.enableHighlight = isObject(options) ? true : options;
|
|
761
|
-
|
|
762
682
|
if (isObject(options)) {
|
|
763
683
|
activeOption.enableHighlight = true;
|
|
764
|
-
|
|
765
684
|
if (options.color) {
|
|
766
685
|
activeOption.highlightColor = options.color;
|
|
767
686
|
}
|
|
768
|
-
|
|
769
687
|
if (options.mix) {
|
|
770
688
|
activeOption.activeMix = options.mix;
|
|
771
689
|
}
|
|
772
690
|
} else {
|
|
773
691
|
activeOption.enableHighlight = !!options;
|
|
774
692
|
}
|
|
775
|
-
|
|
776
693
|
this.updateLayerConfig(activeOption);
|
|
777
694
|
return this;
|
|
778
695
|
}
|
|
779
696
|
}, {
|
|
780
697
|
key: "setActive",
|
|
781
698
|
value: function setActive(id, options) {
|
|
782
|
-
var
|
|
783
|
-
|
|
699
|
+
var _this7 = this;
|
|
784
700
|
if (isObject(id)) {
|
|
785
701
|
var _id$x = id.x,
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
702
|
+
x = _id$x === void 0 ? 0 : _id$x,
|
|
703
|
+
_id$y = id.y,
|
|
704
|
+
y = _id$y === void 0 ? 0 : _id$y;
|
|
789
705
|
this.updateLayerConfig({
|
|
790
706
|
highlightColor: isObject(options) ? options.color : this.getLayerConfig().highlightColor,
|
|
791
707
|
activeMix: isObject(options) ? options.mix : this.getLayerConfig().activeMix
|
|
@@ -800,10 +716,11 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
800
716
|
highlightColor: isObject(options) ? options.color : this.getLayerConfig().highlightColor,
|
|
801
717
|
activeMix: isObject(options) ? options.mix : this.getLayerConfig().activeMix
|
|
802
718
|
});
|
|
803
|
-
this.hooks.beforeHighlight.call(encodePickingColor(id))
|
|
719
|
+
this.hooks.beforeHighlight.call(encodePickingColor(id))
|
|
720
|
+
// @ts-ignore
|
|
804
721
|
.then(function () {
|
|
805
722
|
setTimeout(function () {
|
|
806
|
-
|
|
723
|
+
_this7.reRender();
|
|
807
724
|
}, 1);
|
|
808
725
|
});
|
|
809
726
|
}
|
|
@@ -813,34 +730,29 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
813
730
|
value: function select(option) {
|
|
814
731
|
var activeOption = {};
|
|
815
732
|
activeOption.enableSelect = isObject(option) ? true : option;
|
|
816
|
-
|
|
817
733
|
if (isObject(option)) {
|
|
818
734
|
activeOption.enableSelect = true;
|
|
819
|
-
|
|
820
735
|
if (option.color) {
|
|
821
736
|
activeOption.selectColor = option.color;
|
|
822
737
|
}
|
|
823
|
-
|
|
824
738
|
if (option.mix) {
|
|
825
739
|
activeOption.selectMix = option.mix;
|
|
826
740
|
}
|
|
827
741
|
} else {
|
|
828
742
|
activeOption.enableSelect = !!option;
|
|
829
743
|
}
|
|
830
|
-
|
|
831
744
|
this.updateLayerConfig(activeOption);
|
|
832
745
|
return this;
|
|
833
746
|
}
|
|
834
747
|
}, {
|
|
835
748
|
key: "setSelect",
|
|
836
749
|
value: function setSelect(id, options) {
|
|
837
|
-
var
|
|
838
|
-
|
|
750
|
+
var _this8 = this;
|
|
839
751
|
if (isObject(id)) {
|
|
840
752
|
var _id$x2 = id.x,
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
753
|
+
x = _id$x2 === void 0 ? 0 : _id$x2,
|
|
754
|
+
_id$y2 = id.y,
|
|
755
|
+
y = _id$y2 === void 0 ? 0 : _id$y2;
|
|
844
756
|
this.updateLayerConfig({
|
|
845
757
|
selectColor: isObject(options) ? options.color : this.getLayerConfig().selectColor,
|
|
846
758
|
selectMix: isObject(options) ? options.mix : this.getLayerConfig().selectMix
|
|
@@ -855,10 +767,11 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
855
767
|
selectColor: isObject(options) ? options.color : this.getLayerConfig().selectColor,
|
|
856
768
|
selectMix: isObject(options) ? options.mix : this.getLayerConfig().selectMix
|
|
857
769
|
});
|
|
858
|
-
this.hooks.beforeSelect.call(encodePickingColor(id))
|
|
770
|
+
this.hooks.beforeSelect.call(encodePickingColor(id))
|
|
771
|
+
// @ts-ignore
|
|
859
772
|
.then(function () {
|
|
860
773
|
setTimeout(function () {
|
|
861
|
-
|
|
774
|
+
_this8.reRender();
|
|
862
775
|
}, 1);
|
|
863
776
|
});
|
|
864
777
|
}
|
|
@@ -868,8 +781,8 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
868
781
|
value: function setBlend(type) {
|
|
869
782
|
this.updateLayerConfig({
|
|
870
783
|
blend: type
|
|
871
|
-
});
|
|
872
|
-
|
|
784
|
+
});
|
|
785
|
+
// this.layerModelNeedUpdate = true;
|
|
873
786
|
this.reRender();
|
|
874
787
|
return this;
|
|
875
788
|
}
|
|
@@ -925,14 +838,12 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
925
838
|
key: "isVisible",
|
|
926
839
|
value: function isVisible() {
|
|
927
840
|
var zoom = this.mapService.getZoom();
|
|
928
|
-
|
|
929
841
|
var _this$getLayerConfig3 = this.getLayerConfig(),
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
842
|
+
visible = _this$getLayerConfig3.visible,
|
|
843
|
+
_this$getLayerConfig4 = _this$getLayerConfig3.minZoom,
|
|
844
|
+
minZoom = _this$getLayerConfig4 === void 0 ? -Infinity : _this$getLayerConfig4,
|
|
845
|
+
_this$getLayerConfig5 = _this$getLayerConfig3.maxZoom,
|
|
846
|
+
maxZoom = _this$getLayerConfig5 === void 0 ? Infinity : _this$getLayerConfig5;
|
|
936
847
|
return !!visible && zoom >= minZoom && zoom < maxZoom;
|
|
937
848
|
}
|
|
938
849
|
}, {
|
|
@@ -941,28 +852,22 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
941
852
|
this.updateLayerConfig({
|
|
942
853
|
enableMultiPassRenderer: enableMultiPass
|
|
943
854
|
});
|
|
944
|
-
|
|
945
855
|
if (currentPasses) {
|
|
946
856
|
this.updateLayerConfig({
|
|
947
857
|
passes: currentPasses
|
|
948
858
|
});
|
|
949
859
|
}
|
|
950
|
-
|
|
951
860
|
if (enableMultiPass) {
|
|
952
861
|
var _this$getLayerConfig6 = this.getLayerConfig(),
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
862
|
+
_this$getLayerConfig7 = _this$getLayerConfig6.passes,
|
|
863
|
+
passes = _this$getLayerConfig7 === void 0 ? [] : _this$getLayerConfig7;
|
|
956
864
|
this.multiPassRenderer = createMultiPassRenderer(this, passes, this.postProcessingPassFactory, this.normalPassFactory);
|
|
957
865
|
this.multiPassRenderer.setRenderFlag(true);
|
|
958
|
-
|
|
959
866
|
var _this$rendererService = this.rendererService.getViewportSize(),
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
867
|
+
width = _this$rendererService.width,
|
|
868
|
+
height = _this$rendererService.height;
|
|
963
869
|
this.multiPassRenderer.resize(width, height);
|
|
964
870
|
}
|
|
965
|
-
|
|
966
871
|
return this;
|
|
967
872
|
}
|
|
968
873
|
}, {
|
|
@@ -977,23 +882,21 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
977
882
|
key: "getMinZoom",
|
|
978
883
|
value: function getMinZoom() {
|
|
979
884
|
var _this$getLayerConfig8 = this.getLayerConfig(),
|
|
980
|
-
|
|
981
|
-
|
|
885
|
+
minZoom = _this$getLayerConfig8.minZoom;
|
|
982
886
|
return minZoom;
|
|
983
887
|
}
|
|
984
888
|
}, {
|
|
985
889
|
key: "getMaxZoom",
|
|
986
890
|
value: function getMaxZoom() {
|
|
987
891
|
var _this$getLayerConfig9 = this.getLayerConfig(),
|
|
988
|
-
|
|
989
|
-
|
|
892
|
+
maxZoom = _this$getLayerConfig9.maxZoom;
|
|
990
893
|
return maxZoom;
|
|
991
894
|
}
|
|
992
895
|
}, {
|
|
993
896
|
key: "get",
|
|
994
897
|
value: function get(name) {
|
|
995
|
-
var cfg = this.getLayerConfig();
|
|
996
|
-
|
|
898
|
+
var cfg = this.getLayerConfig();
|
|
899
|
+
// @ts-ignore
|
|
997
900
|
return cfg[name];
|
|
998
901
|
}
|
|
999
902
|
}, {
|
|
@@ -1012,10 +915,10 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
1012
915
|
});
|
|
1013
916
|
return this;
|
|
1014
917
|
}
|
|
918
|
+
|
|
1015
919
|
/**
|
|
1016
920
|
* zoom to layer Bounds
|
|
1017
921
|
*/
|
|
1018
|
-
|
|
1019
922
|
}, {
|
|
1020
923
|
key: "fitBounds",
|
|
1021
924
|
value: function fitBounds(fitBoundsOptions) {
|
|
@@ -1025,17 +928,14 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
1025
928
|
});
|
|
1026
929
|
return this;
|
|
1027
930
|
}
|
|
1028
|
-
|
|
1029
931
|
var source = this.getSource();
|
|
1030
932
|
var extent = source.extent;
|
|
1031
933
|
var isValid = extent.some(function (v) {
|
|
1032
934
|
return Math.abs(v) === Infinity;
|
|
1033
935
|
});
|
|
1034
|
-
|
|
1035
936
|
if (isValid) {
|
|
1036
937
|
return this;
|
|
1037
938
|
}
|
|
1038
|
-
|
|
1039
939
|
this.mapService.fitBounds([[extent[0], extent[1]], [extent[2], extent[3]]], fitBoundsOptions);
|
|
1040
940
|
return this;
|
|
1041
941
|
}
|
|
@@ -1043,43 +943,43 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
1043
943
|
key: "destroy",
|
|
1044
944
|
value: function destroy() {
|
|
1045
945
|
var _this$multiPassRender, _this$layerModel2, _this$tileLayer, _this$debugService2;
|
|
1046
|
-
|
|
1047
946
|
var refresh = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
1048
|
-
|
|
1049
947
|
if (this.isDestroyed) {
|
|
1050
948
|
return;
|
|
1051
|
-
}
|
|
1052
|
-
|
|
949
|
+
}
|
|
1053
950
|
|
|
951
|
+
// remove child layer
|
|
1054
952
|
this.layerChildren.map(function (child) {
|
|
1055
953
|
return child.destroy(false);
|
|
1056
954
|
});
|
|
1057
|
-
this.layerChildren = [];
|
|
955
|
+
this.layerChildren = [];
|
|
1058
956
|
|
|
957
|
+
// remove mask list maskfence 掩膜需要销毁
|
|
1059
958
|
var _this$getLayerConfig10 = this.getLayerConfig(),
|
|
1060
|
-
|
|
1061
|
-
|
|
959
|
+
maskfence = _this$getLayerConfig10.maskfence;
|
|
1062
960
|
if (maskfence) {
|
|
1063
961
|
this.masks.map(function (mask) {
|
|
1064
962
|
return mask.destroy(false);
|
|
1065
963
|
});
|
|
1066
964
|
this.masks = [];
|
|
1067
965
|
}
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
966
|
+
this.hooks.beforeDestroy.call();
|
|
967
|
+
// 清除sources事件
|
|
1071
968
|
this.layerSource.off('update', this.sourceEvent);
|
|
1072
969
|
(_this$multiPassRender = this.multiPassRenderer) === null || _this$multiPassRender === void 0 ? void 0 : _this$multiPassRender.destroy();
|
|
1073
|
-
this.textureService.destroy();
|
|
970
|
+
this.textureService.destroy();
|
|
1074
971
|
|
|
1075
|
-
this.
|
|
972
|
+
// 清除所有属性以及关联的 vao == 销毁所有 => model this.models.forEach((model) => model.destroy());
|
|
973
|
+
this.styleAttributeService.clearAllAttributes();
|
|
1076
974
|
|
|
1077
|
-
|
|
975
|
+
// 执行每个图层单独的 clearModels 方法 (清除一些额外的 texture、program、buffer 等)
|
|
1078
976
|
|
|
977
|
+
this.hooks.afterDestroy.call();
|
|
978
|
+
// Tip: 清除各个图层自定义的 models 资源
|
|
1079
979
|
(_this$layerModel2 = this.layerModel) === null || _this$layerModel2 === void 0 ? void 0 : _this$layerModel2.clearModels(refresh);
|
|
1080
980
|
(_this$tileLayer = this.tileLayer) === null || _this$tileLayer === void 0 ? void 0 : _this$tileLayer.destroy();
|
|
1081
|
-
this.models = [];
|
|
1082
|
-
|
|
981
|
+
this.models = [];
|
|
982
|
+
// 清除图层日志(如果有的话:非瓦片相关)
|
|
1083
983
|
(_this$debugService2 = this.debugService) === null || _this$debugService2 === void 0 ? void 0 : _this$debugService2.removeLog(this.id);
|
|
1084
984
|
this.emit('remove', {
|
|
1085
985
|
target: this,
|
|
@@ -1089,7 +989,8 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
1089
989
|
target: this,
|
|
1090
990
|
type: 'destroy'
|
|
1091
991
|
});
|
|
1092
|
-
this.removeAllListeners();
|
|
992
|
+
this.removeAllListeners();
|
|
993
|
+
// 解绑图层容器中的服务
|
|
1093
994
|
// this.container.unbind(TYPES.IStyleAttributeService);
|
|
1094
995
|
|
|
1095
996
|
this.isDestroyed = true;
|
|
@@ -1097,13 +998,13 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
1097
998
|
}, {
|
|
1098
999
|
key: "clear",
|
|
1099
1000
|
value: function clear() {
|
|
1100
|
-
this.styleAttributeService.clearAllAttributes();
|
|
1001
|
+
this.styleAttributeService.clearAllAttributes();
|
|
1002
|
+
// 销毁所有 model
|
|
1101
1003
|
}
|
|
1102
1004
|
}, {
|
|
1103
1005
|
key: "clearModels",
|
|
1104
1006
|
value: function clearModels() {
|
|
1105
1007
|
var _this$layerModel3;
|
|
1106
|
-
|
|
1107
1008
|
this.models.forEach(function (model) {
|
|
1108
1009
|
return model.destroy();
|
|
1109
1010
|
});
|
|
@@ -1116,55 +1017,46 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
1116
1017
|
return !!(this.styleAttributeService.getLayerStyleAttributes() || []).filter(function (attribute) {
|
|
1117
1018
|
return attribute.needRescale || attribute.needRemapping || attribute.needRegenerateVertices;
|
|
1118
1019
|
}).length;
|
|
1119
|
-
}
|
|
1120
|
-
|
|
1020
|
+
}
|
|
1021
|
+
// 外部初始化Source
|
|
1121
1022
|
}, {
|
|
1122
1023
|
key: "setSource",
|
|
1123
1024
|
value: function setSource(source) {
|
|
1124
|
-
var
|
|
1125
|
-
|
|
1025
|
+
var _this9 = this;
|
|
1126
1026
|
// 解除原 sources 事件
|
|
1127
1027
|
if (this.layerSource) {
|
|
1128
1028
|
this.layerSource.off('update', this.sourceEvent);
|
|
1129
1029
|
}
|
|
1130
|
-
|
|
1131
1030
|
this.layerSource = source;
|
|
1132
|
-
this.clusterZoom = 0;
|
|
1031
|
+
this.clusterZoom = 0;
|
|
1133
1032
|
|
|
1033
|
+
// 已 inited 且启用聚合进行更新聚合数据
|
|
1134
1034
|
if (this.inited && this.layerSource.cluster) {
|
|
1135
1035
|
var zoom = this.mapService.getZoom();
|
|
1136
1036
|
this.layerSource.updateClusterData(zoom);
|
|
1137
1037
|
}
|
|
1138
|
-
|
|
1139
1038
|
if (this.layerSource.inited) {
|
|
1140
1039
|
this.sourceEvent();
|
|
1141
|
-
}
|
|
1142
|
-
|
|
1143
|
-
|
|
1040
|
+
}
|
|
1041
|
+
// this.layerSource.inited 为 true update 事件不会再触发
|
|
1144
1042
|
this.layerSource.on('update', function (_ref4) {
|
|
1145
1043
|
var type = _ref4.type;
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
var
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
if ((_this8$mapService = _this8.mapService) !== null && _this8$mapService !== void 0 && _this8$mapService.setCoordCenter) {
|
|
1154
|
-
_this8.mapService.setCoordCenter(layerCenter);
|
|
1044
|
+
if (_this9.coordCenter === undefined) {
|
|
1045
|
+
var _this9$mapService;
|
|
1046
|
+
var layerCenter = _this9.layerSource.center;
|
|
1047
|
+
_this9.coordCenter = layerCenter;
|
|
1048
|
+
if ((_this9$mapService = _this9.mapService) !== null && _this9$mapService !== void 0 && _this9$mapService.setCoordCenter) {
|
|
1049
|
+
_this9.mapService.setCoordCenter(layerCenter);
|
|
1155
1050
|
}
|
|
1156
1051
|
}
|
|
1157
|
-
|
|
1158
1052
|
if (type === 'update') {
|
|
1159
|
-
if (
|
|
1053
|
+
if (_this9.tileLayer) {
|
|
1160
1054
|
// 瓦片图层独立更新
|
|
1161
|
-
|
|
1162
|
-
|
|
1055
|
+
_this9.tileLayer.reload();
|
|
1163
1056
|
return;
|
|
1164
|
-
}
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
_this8.sourceEvent();
|
|
1057
|
+
}
|
|
1058
|
+
// source 初始化不需要处理
|
|
1059
|
+
_this9.sourceEvent();
|
|
1168
1060
|
}
|
|
1169
1061
|
});
|
|
1170
1062
|
}
|
|
@@ -1198,7 +1090,6 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
1198
1090
|
key: "getLegend",
|
|
1199
1091
|
value: function getLegend(name) {
|
|
1200
1092
|
var _attribute$scale, _scales$0$option, _attribute$scale2;
|
|
1201
|
-
|
|
1202
1093
|
var attribute = this.styleAttributeService.getLayerStyleAttribute(name);
|
|
1203
1094
|
var scales = (attribute === null || attribute === void 0 ? void 0 : (_attribute$scale = attribute.scale) === null || _attribute$scale === void 0 ? void 0 : _attribute$scale.scalers) || [];
|
|
1204
1095
|
return {
|
|
@@ -1210,12 +1101,11 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
1210
1101
|
}, {
|
|
1211
1102
|
key: "getLegendItems",
|
|
1212
1103
|
value: function getLegendItems(name) {
|
|
1213
|
-
var scale = this.styleAttributeService.getLayerAttributeScale(name);
|
|
1214
|
-
|
|
1104
|
+
var scale = this.styleAttributeService.getLayerAttributeScale(name);
|
|
1105
|
+
// 函数自定义映射,没有 scale 返回为空数组
|
|
1215
1106
|
if (!scale) {
|
|
1216
1107
|
return [];
|
|
1217
1108
|
}
|
|
1218
|
-
|
|
1219
1109
|
if (scale.invertExtent) {
|
|
1220
1110
|
// 分段类型 Quantize、Quantile、Threshold
|
|
1221
1111
|
var items = scale.range().map(function (item) {
|
|
@@ -1231,7 +1121,6 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
1231
1121
|
value: item
|
|
1232
1122
|
}, name, scale(item));
|
|
1233
1123
|
});
|
|
1234
|
-
|
|
1235
1124
|
return _items;
|
|
1236
1125
|
} else if (scale !== null && scale !== void 0 && scale.domain) {
|
|
1237
1126
|
// 枚举类型 Cat
|
|
@@ -1242,17 +1131,15 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
1242
1131
|
value: item
|
|
1243
1132
|
}, name, scale(item));
|
|
1244
1133
|
});
|
|
1245
|
-
|
|
1246
1134
|
return _items2;
|
|
1247
1135
|
}
|
|
1248
|
-
|
|
1249
1136
|
return [];
|
|
1250
1137
|
}
|
|
1251
1138
|
}, {
|
|
1252
1139
|
key: "pick",
|
|
1253
1140
|
value: function pick(_ref8) {
|
|
1254
1141
|
var x = _ref8.x,
|
|
1255
|
-
|
|
1142
|
+
y = _ref8.y;
|
|
1256
1143
|
this.interactionService.triggerHover({
|
|
1257
1144
|
x: x,
|
|
1258
1145
|
y: y
|
|
@@ -1267,86 +1154,57 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
1267
1154
|
key: "buildLayerModel",
|
|
1268
1155
|
value: function () {
|
|
1269
1156
|
var _buildLayerModel = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(options) {
|
|
1270
|
-
var
|
|
1271
|
-
|
|
1272
|
-
var moduleName, vertexShader, fragmentShader, triangulation, segmentNumber, _options$workerEnable, workerEnabled, workerOptions, rest, _this$shaderModuleSer, vs, fs, uniforms, createModel;
|
|
1273
|
-
|
|
1157
|
+
var _this10 = this;
|
|
1158
|
+
var moduleName, vertexShader, fragmentShader, inject, triangulation, segmentNumber, rest, _this$shaderModuleSer, vs, fs, uniforms, createModel;
|
|
1274
1159
|
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
1275
|
-
while (1) {
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
count = _this9$styleAttribute.count;
|
|
1309
|
-
|
|
1310
|
-
var modelOptions = _objectSpread({
|
|
1311
|
-
attributes: attributes,
|
|
1312
|
-
uniforms: uniforms,
|
|
1313
|
-
fs: fs,
|
|
1314
|
-
vs: vs,
|
|
1315
|
-
elements: elements,
|
|
1316
|
-
blend: BlendTypes[BlendType.normal]
|
|
1317
|
-
}, rest);
|
|
1318
|
-
|
|
1319
|
-
if (count) {
|
|
1320
|
-
modelOptions.count = count;
|
|
1321
|
-
}
|
|
1322
|
-
|
|
1323
|
-
var m = createModel(modelOptions);
|
|
1324
|
-
resolve(m);
|
|
1325
|
-
}
|
|
1326
|
-
}));
|
|
1327
|
-
|
|
1328
|
-
case 5:
|
|
1329
|
-
case "end":
|
|
1330
|
-
return _context3.stop();
|
|
1331
|
-
}
|
|
1160
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
1161
|
+
case 0:
|
|
1162
|
+
moduleName = options.moduleName, vertexShader = options.vertexShader, fragmentShader = options.fragmentShader, inject = options.inject, triangulation = options.triangulation, segmentNumber = options.segmentNumber, rest = _objectWithoutProperties(options, _excluded2);
|
|
1163
|
+
this.shaderModuleService.registerModule(moduleName, {
|
|
1164
|
+
vs: vertexShader,
|
|
1165
|
+
fs: fragmentShader,
|
|
1166
|
+
inject: inject
|
|
1167
|
+
});
|
|
1168
|
+
_this$shaderModuleSer = this.shaderModuleService.getModule(moduleName), vs = _this$shaderModuleSer.vs, fs = _this$shaderModuleSer.fs, uniforms = _this$shaderModuleSer.uniforms;
|
|
1169
|
+
createModel = this.rendererService.createModel;
|
|
1170
|
+
return _context3.abrupt("return", new Promise(function (resolve) {
|
|
1171
|
+
// console.log(this.encodedData)
|
|
1172
|
+
var _this10$styleAttribut = _this10.styleAttributeService.createAttributesAndIndices(_this10.encodedData, triangulation, segmentNumber),
|
|
1173
|
+
attributes = _this10$styleAttribut.attributes,
|
|
1174
|
+
elements = _this10$styleAttribut.elements,
|
|
1175
|
+
count = _this10$styleAttribut.count;
|
|
1176
|
+
var modelOptions = _objectSpread({
|
|
1177
|
+
attributes: attributes,
|
|
1178
|
+
uniforms: uniforms,
|
|
1179
|
+
fs: fs,
|
|
1180
|
+
vs: vs,
|
|
1181
|
+
elements: elements,
|
|
1182
|
+
blend: BlendTypes[BlendType.normal]
|
|
1183
|
+
}, rest);
|
|
1184
|
+
if (count) {
|
|
1185
|
+
modelOptions.count = count;
|
|
1186
|
+
}
|
|
1187
|
+
var m = createModel(modelOptions);
|
|
1188
|
+
resolve(m);
|
|
1189
|
+
}));
|
|
1190
|
+
case 5:
|
|
1191
|
+
case "end":
|
|
1192
|
+
return _context3.stop();
|
|
1332
1193
|
}
|
|
1333
1194
|
}, _callee3, this);
|
|
1334
1195
|
}));
|
|
1335
|
-
|
|
1336
1196
|
function buildLayerModel(_x) {
|
|
1337
1197
|
return _buildLayerModel.apply(this, arguments);
|
|
1338
1198
|
}
|
|
1339
|
-
|
|
1340
1199
|
return buildLayerModel;
|
|
1341
1200
|
}()
|
|
1342
1201
|
}, {
|
|
1343
1202
|
key: "createAttributes",
|
|
1344
1203
|
value: function createAttributes(options) {
|
|
1345
|
-
var triangulation = options.triangulation;
|
|
1346
|
-
|
|
1204
|
+
var triangulation = options.triangulation;
|
|
1205
|
+
// @ts-ignore
|
|
1347
1206
|
var _this$styleAttributeS = this.styleAttributeService.createAttributes(this.encodedData, triangulation),
|
|
1348
|
-
|
|
1349
|
-
|
|
1207
|
+
attributes = _this$styleAttributeS.attributes;
|
|
1350
1208
|
return attributes;
|
|
1351
1209
|
}
|
|
1352
1210
|
}, {
|
|
@@ -1381,22 +1239,18 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
1381
1239
|
key: "needPick",
|
|
1382
1240
|
value: function needPick(type) {
|
|
1383
1241
|
var _this$getLayerConfig11 = this.getLayerConfig(),
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1242
|
+
_this$getLayerConfig12 = _this$getLayerConfig11.enableHighlight,
|
|
1243
|
+
enableHighlight = _this$getLayerConfig12 === void 0 ? true : _this$getLayerConfig12,
|
|
1244
|
+
_this$getLayerConfig13 = _this$getLayerConfig11.enableSelect,
|
|
1245
|
+
enableSelect = _this$getLayerConfig13 === void 0 ? true : _this$getLayerConfig13;
|
|
1246
|
+
// 判断layer是否监听事件;
|
|
1390
1247
|
var isPick = this.eventNames().indexOf(type) !== -1 || this.eventNames().indexOf('un' + type) !== -1;
|
|
1391
|
-
|
|
1392
1248
|
if ((type === 'click' || type === 'dblclick') && enableSelect) {
|
|
1393
1249
|
isPick = true;
|
|
1394
1250
|
}
|
|
1395
|
-
|
|
1396
1251
|
if (type === 'mousemove' && (enableHighlight || this.eventNames().indexOf('mouseenter') !== -1 || this.eventNames().indexOf('unmousemove') !== -1 || this.eventNames().indexOf('mouseout') !== -1)) {
|
|
1397
1252
|
isPick = true;
|
|
1398
1253
|
}
|
|
1399
|
-
|
|
1400
1254
|
return this.isVisible() && isPick;
|
|
1401
1255
|
}
|
|
1402
1256
|
}, {
|
|
@@ -1404,23 +1258,18 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
1404
1258
|
value: function () {
|
|
1405
1259
|
var _buildModels = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
|
|
1406
1260
|
return _regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
1407
|
-
while (1) {
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
case "end":
|
|
1414
|
-
return _context4.stop();
|
|
1415
|
-
}
|
|
1261
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
1262
|
+
case 0:
|
|
1263
|
+
throw new Error('Method not implemented.');
|
|
1264
|
+
case 1:
|
|
1265
|
+
case "end":
|
|
1266
|
+
return _context4.stop();
|
|
1416
1267
|
}
|
|
1417
1268
|
}, _callee4);
|
|
1418
1269
|
}));
|
|
1419
|
-
|
|
1420
1270
|
function buildModels() {
|
|
1421
1271
|
return _buildModels.apply(this, arguments);
|
|
1422
1272
|
}
|
|
1423
|
-
|
|
1424
1273
|
return buildModels;
|
|
1425
1274
|
}()
|
|
1426
1275
|
}, {
|
|
@@ -1428,24 +1277,19 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
1428
1277
|
value: function () {
|
|
1429
1278
|
var _rebuildModels = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5() {
|
|
1430
1279
|
return _regeneratorRuntime.wrap(function _callee5$(_context5) {
|
|
1431
|
-
while (1) {
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
case "end":
|
|
1439
|
-
return _context5.stop();
|
|
1440
|
-
}
|
|
1280
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
1281
|
+
case 0:
|
|
1282
|
+
_context5.next = 2;
|
|
1283
|
+
return this.buildModels();
|
|
1284
|
+
case 2:
|
|
1285
|
+
case "end":
|
|
1286
|
+
return _context5.stop();
|
|
1441
1287
|
}
|
|
1442
1288
|
}, _callee5, this);
|
|
1443
1289
|
}));
|
|
1444
|
-
|
|
1445
1290
|
function rebuildModels() {
|
|
1446
1291
|
return _rebuildModels.apply(this, arguments);
|
|
1447
1292
|
}
|
|
1448
|
-
|
|
1449
1293
|
return rebuildModels;
|
|
1450
1294
|
}()
|
|
1451
1295
|
}, {
|
|
@@ -1453,46 +1297,38 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
1453
1297
|
value: function () {
|
|
1454
1298
|
var _renderMulPass = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6(multiPassRenderer) {
|
|
1455
1299
|
return _regeneratorRuntime.wrap(function _callee6$(_context6) {
|
|
1456
|
-
while (1) {
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
case "end":
|
|
1464
|
-
return _context6.stop();
|
|
1465
|
-
}
|
|
1300
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
1301
|
+
case 0:
|
|
1302
|
+
_context6.next = 2;
|
|
1303
|
+
return multiPassRenderer.render();
|
|
1304
|
+
case 2:
|
|
1305
|
+
case "end":
|
|
1306
|
+
return _context6.stop();
|
|
1466
1307
|
}
|
|
1467
1308
|
}, _callee6);
|
|
1468
1309
|
}));
|
|
1469
|
-
|
|
1470
1310
|
function renderMulPass(_x2) {
|
|
1471
1311
|
return _renderMulPass.apply(this, arguments);
|
|
1472
1312
|
}
|
|
1473
|
-
|
|
1474
1313
|
return renderMulPass;
|
|
1475
1314
|
}()
|
|
1476
1315
|
}, {
|
|
1477
1316
|
key: "renderModels",
|
|
1478
1317
|
value: function renderModels() {
|
|
1479
|
-
var
|
|
1480
|
-
|
|
1318
|
+
var _this11 = this;
|
|
1481
1319
|
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
1482
|
-
|
|
1483
1320
|
// TODO: this.getEncodedData().length > 0 这个判断是为了解决在 2.5.x 引入数据纹理后产生的 空数据渲染导致 texture 超出上限问题
|
|
1484
1321
|
if (this.encodeDataLength <= 0 && !this.forceRender) {
|
|
1485
1322
|
// 数据为空销毁model
|
|
1486
1323
|
this.clearModels();
|
|
1487
1324
|
return this;
|
|
1488
1325
|
}
|
|
1489
|
-
|
|
1490
1326
|
this.hooks.beforeRender.call();
|
|
1491
1327
|
this.models.forEach(function (model) {
|
|
1492
1328
|
model.draw({
|
|
1493
|
-
uniforms:
|
|
1494
|
-
blend:
|
|
1495
|
-
stencil:
|
|
1329
|
+
uniforms: _this11.layerModel.getUninforms(),
|
|
1330
|
+
blend: _this11.layerModel.getBlend(),
|
|
1331
|
+
stencil: _this11.layerModel.getStencil(options)
|
|
1496
1332
|
}, (options === null || options === void 0 ? void 0 : options.ispick) || false);
|
|
1497
1333
|
});
|
|
1498
1334
|
this.hooks.afterRender.call();
|
|
@@ -1502,23 +1338,23 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
1502
1338
|
key: "updateStyleAttribute",
|
|
1503
1339
|
value: function updateStyleAttribute(type, field, values, updateOptions) {
|
|
1504
1340
|
// encode diff
|
|
1505
|
-
var preAttribute = this.configService.getAttributeConfig(this.id) || {};
|
|
1506
|
-
|
|
1341
|
+
var preAttribute = this.configService.getAttributeConfig(this.id) || {};
|
|
1342
|
+
// @ts-ignore
|
|
1507
1343
|
if (isEqual(preAttribute[type], {
|
|
1508
1344
|
field: field,
|
|
1509
1345
|
values: values
|
|
1510
1346
|
})) {
|
|
1347
|
+
// 检测是否发生更新
|
|
1511
1348
|
return false;
|
|
1512
|
-
}
|
|
1513
|
-
|
|
1349
|
+
}
|
|
1514
1350
|
|
|
1351
|
+
// 存储 Attribute 瓦片图层使用
|
|
1515
1352
|
if (['color', 'size', 'texture', 'rotate', 'filter', 'label', 'shape'].indexOf(type) !== -1) {
|
|
1516
1353
|
this.configService.setAttributeConfig(this.id, _defineProperty({}, type, {
|
|
1517
1354
|
field: field,
|
|
1518
1355
|
values: values
|
|
1519
1356
|
}));
|
|
1520
1357
|
}
|
|
1521
|
-
|
|
1522
1358
|
if (!this.startInit) {
|
|
1523
1359
|
// 开始初始化执行
|
|
1524
1360
|
this.pendingStyleAttributes.push({
|
|
@@ -1532,13 +1368,15 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
1532
1368
|
// @ts-ignore
|
|
1533
1369
|
scale: _objectSpread({
|
|
1534
1370
|
field: field
|
|
1535
|
-
}, this.splitValuesAndCallbackInAttribute(
|
|
1536
|
-
|
|
1371
|
+
}, this.splitValuesAndCallbackInAttribute(
|
|
1372
|
+
// @ts-ignore
|
|
1373
|
+
values,
|
|
1374
|
+
// @ts-ignore
|
|
1537
1375
|
this.getLayerConfig()[field]))
|
|
1538
|
-
},
|
|
1376
|
+
},
|
|
1377
|
+
// @ts-ignore
|
|
1539
1378
|
updateOptions);
|
|
1540
1379
|
}
|
|
1541
|
-
|
|
1542
1380
|
return true;
|
|
1543
1381
|
}
|
|
1544
1382
|
}, {
|
|
@@ -1551,19 +1389,20 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
1551
1389
|
value: function getShaderPickStat() {
|
|
1552
1390
|
return this.layerService.getShaderPickStat();
|
|
1553
1391
|
}
|
|
1392
|
+
|
|
1554
1393
|
/**
|
|
1555
1394
|
* 继承空方法
|
|
1556
1395
|
* @param time
|
|
1557
1396
|
*/
|
|
1558
1397
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
1559
|
-
|
|
1560
1398
|
}, {
|
|
1561
1399
|
key: "setEarthTime",
|
|
1562
1400
|
value: function setEarthTime(time) {
|
|
1563
1401
|
console.warn('empty fn');
|
|
1564
|
-
}
|
|
1565
|
-
// 在各个 layer 中继承
|
|
1402
|
+
}
|
|
1566
1403
|
|
|
1404
|
+
// 数据处理 在数据进行 mapping 生成 encodeData 之前对数据进行处理
|
|
1405
|
+
// 在各个 layer 中继承
|
|
1567
1406
|
}, {
|
|
1568
1407
|
key: "processData",
|
|
1569
1408
|
value: function processData(filterData) {
|
|
@@ -1584,31 +1423,25 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
1584
1423
|
value: function () {
|
|
1585
1424
|
var _initLayerModels = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7() {
|
|
1586
1425
|
return _regeneratorRuntime.wrap(function _callee7$(_context7) {
|
|
1587
|
-
while (1) {
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
case 5:
|
|
1601
|
-
case "end":
|
|
1602
|
-
return _context7.stop();
|
|
1603
|
-
}
|
|
1426
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
1427
|
+
case 0:
|
|
1428
|
+
this.models.forEach(function (model) {
|
|
1429
|
+
return model.destroy();
|
|
1430
|
+
});
|
|
1431
|
+
this.models = [];
|
|
1432
|
+
_context7.next = 4;
|
|
1433
|
+
return this.layerModel.initModels();
|
|
1434
|
+
case 4:
|
|
1435
|
+
this.models = _context7.sent;
|
|
1436
|
+
case 5:
|
|
1437
|
+
case "end":
|
|
1438
|
+
return _context7.stop();
|
|
1604
1439
|
}
|
|
1605
1440
|
}, _callee7, this);
|
|
1606
1441
|
}));
|
|
1607
|
-
|
|
1608
1442
|
function initLayerModels() {
|
|
1609
1443
|
return _initLayerModels.apply(this, arguments);
|
|
1610
1444
|
}
|
|
1611
|
-
|
|
1612
1445
|
return initLayerModels;
|
|
1613
1446
|
}()
|
|
1614
1447
|
}, {
|
|
@@ -1627,7 +1460,6 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
1627
1460
|
};
|
|
1628
1461
|
}
|
|
1629
1462
|
}]);
|
|
1630
|
-
|
|
1631
1463
|
return BaseLayer;
|
|
1632
1464
|
}(EventEmitter), (_descriptor = _applyDecoratedDescriptor(_class.prototype, "configService", [_dec], {
|
|
1633
1465
|
configurable: true,
|