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