@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
|
@@ -7,33 +7,21 @@ import _possibleConstructorReturn from "@babel/runtime/helpers/esm/possibleConst
|
|
|
7
7
|
import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
|
|
8
8
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
9
9
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
10
|
-
|
|
11
10
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
12
|
-
|
|
13
11
|
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; } }
|
|
14
|
-
|
|
15
12
|
import BaseLayer from "../../../core/BaseLayer";
|
|
16
|
-
|
|
17
13
|
var TileDebugLayer = /*#__PURE__*/function (_BaseLayer) {
|
|
18
14
|
_inherits(TileDebugLayer, _BaseLayer);
|
|
19
|
-
|
|
20
15
|
var _super = _createSuper(TileDebugLayer);
|
|
21
|
-
|
|
22
16
|
function TileDebugLayer() {
|
|
23
17
|
var _this;
|
|
24
|
-
|
|
25
18
|
_classCallCheck(this, TileDebugLayer);
|
|
26
|
-
|
|
27
19
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
28
20
|
args[_key] = arguments[_key];
|
|
29
21
|
}
|
|
30
|
-
|
|
31
22
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
32
|
-
|
|
33
23
|
_defineProperty(_assertThisInitialized(_this), "type", 'TileDebugLayer');
|
|
34
|
-
|
|
35
24
|
_defineProperty(_assertThisInitialized(_this), "zIndex", 10000);
|
|
36
|
-
|
|
37
25
|
_defineProperty(_assertThisInitialized(_this), "defaultSourceConfig", {
|
|
38
26
|
data: [],
|
|
39
27
|
options: {
|
|
@@ -42,37 +30,28 @@ var TileDebugLayer = /*#__PURE__*/function (_BaseLayer) {
|
|
|
42
30
|
}
|
|
43
31
|
}
|
|
44
32
|
});
|
|
45
|
-
|
|
46
33
|
return _this;
|
|
47
34
|
}
|
|
48
|
-
|
|
49
35
|
_createClass(TileDebugLayer, [{
|
|
50
36
|
key: "buildModels",
|
|
51
37
|
value: function () {
|
|
52
38
|
var _buildModels = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
53
39
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
54
|
-
while (1) {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
case "end":
|
|
61
|
-
return _context.stop();
|
|
62
|
-
}
|
|
40
|
+
while (1) switch (_context.prev = _context.next) {
|
|
41
|
+
case 0:
|
|
42
|
+
return _context.abrupt("return");
|
|
43
|
+
case 1:
|
|
44
|
+
case "end":
|
|
45
|
+
return _context.stop();
|
|
63
46
|
}
|
|
64
47
|
}, _callee);
|
|
65
48
|
}));
|
|
66
|
-
|
|
67
49
|
function buildModels() {
|
|
68
50
|
return _buildModels.apply(this, arguments);
|
|
69
51
|
}
|
|
70
|
-
|
|
71
52
|
return buildModels;
|
|
72
53
|
}()
|
|
73
54
|
}]);
|
|
74
|
-
|
|
75
55
|
return TileDebugLayer;
|
|
76
56
|
}(BaseLayer);
|
|
77
|
-
|
|
78
57
|
export { TileDebugLayer as default };
|
|
@@ -5,15 +5,12 @@ export function getTileLayer(type) {
|
|
|
5
5
|
if (type === 'PolygonLayer') {
|
|
6
6
|
return PolygonLayer;
|
|
7
7
|
}
|
|
8
|
-
|
|
9
8
|
if (type === 'LineLayer') {
|
|
10
9
|
return LineLayer;
|
|
11
10
|
}
|
|
12
|
-
|
|
13
11
|
if (type === 'PointLayer') {
|
|
14
12
|
return PointLayer;
|
|
15
13
|
}
|
|
16
|
-
|
|
17
14
|
return PointLayer;
|
|
18
15
|
}
|
|
19
16
|
export function isNeedMask(type) {
|
|
@@ -9,96 +9,81 @@ import { TileLayerService } from "../service/TileLayerService";
|
|
|
9
9
|
import { TilePickService } from "../service/TilePickService";
|
|
10
10
|
import { ProxyFuncs } from "../style/constants";
|
|
11
11
|
import { getTileFactory } from "../tileFactory";
|
|
12
|
-
|
|
13
12
|
var BaseTileLayer = /*#__PURE__*/function () {
|
|
14
13
|
// 瓦片数据管理器
|
|
14
|
+
|
|
15
15
|
function BaseTileLayer(parent) {
|
|
16
16
|
var _this = this;
|
|
17
|
-
|
|
18
17
|
_classCallCheck(this, BaseTileLayer);
|
|
19
|
-
|
|
20
18
|
_defineProperty(this, "initedTileset", false);
|
|
21
|
-
|
|
22
19
|
_defineProperty(this, "mapchange", function () {
|
|
23
20
|
var _this$tilesetManager;
|
|
24
|
-
|
|
25
21
|
var _this$getCurrentView = _this.getCurrentView(),
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
22
|
+
latLonBounds = _this$getCurrentView.latLonBounds,
|
|
23
|
+
zoom = _this$getCurrentView.zoom;
|
|
29
24
|
if (_this.mapService.version === 'GAODE1.x') {
|
|
30
25
|
var _this$parent$getLayer = _this.parent.getLayerConfig(),
|
|
31
|
-
|
|
32
|
-
|
|
26
|
+
visible = _this$parent$getLayer.visible;
|
|
33
27
|
if (zoom < 2 && visible) {
|
|
34
28
|
_this.parent.updateLayerConfig({
|
|
35
29
|
visible: false
|
|
36
30
|
});
|
|
37
|
-
|
|
38
31
|
_this.layerService.reRender();
|
|
39
32
|
} else if (zoom >= 2 && !visible) {
|
|
40
33
|
_this.parent.updateLayerConfig({
|
|
41
34
|
visible: true
|
|
42
35
|
});
|
|
43
|
-
|
|
44
36
|
_this.layerService.reRender();
|
|
45
37
|
}
|
|
46
38
|
}
|
|
47
|
-
|
|
48
39
|
if (_this.lastViewStates && _this.lastViewStates.zoom === zoom && _this.lastViewStates.latLonBounds.toString() === latLonBounds.toString()) {
|
|
49
40
|
return;
|
|
50
41
|
}
|
|
51
|
-
|
|
52
42
|
_this.lastViewStates = {
|
|
53
43
|
zoom: zoom,
|
|
54
44
|
latLonBounds: latLonBounds
|
|
55
45
|
};
|
|
56
46
|
(_this$tilesetManager = _this.tilesetManager) === null || _this$tilesetManager === void 0 ? void 0 : _this$tilesetManager.throttleUpdate(zoom, latLonBounds);
|
|
57
47
|
});
|
|
58
|
-
|
|
59
48
|
_defineProperty(this, "viewchange", debounce(this.mapchange, 24));
|
|
60
|
-
|
|
61
49
|
this.parent = parent;
|
|
62
50
|
var container = this.parent.getContainer();
|
|
63
51
|
this.rendererService = container.get(TYPES.IRendererService);
|
|
64
52
|
this.layerService = container.get(TYPES.ILayerService);
|
|
65
53
|
this.mapService = container.get(TYPES.IMapService);
|
|
66
|
-
this.pickingService = container.get(TYPES.IPickingService);
|
|
54
|
+
this.pickingService = container.get(TYPES.IPickingService);
|
|
67
55
|
|
|
56
|
+
// 初始化瓦片管理服务
|
|
68
57
|
this.tileLayerService = new TileLayerService({
|
|
69
58
|
rendererService: this.rendererService,
|
|
70
59
|
layerService: this.layerService,
|
|
71
60
|
parent: parent
|
|
72
|
-
});
|
|
73
|
-
|
|
61
|
+
});
|
|
62
|
+
// 初始化拾取服务
|
|
74
63
|
this.tilePickService = new TilePickService({
|
|
75
64
|
tileLayerService: this.tileLayerService,
|
|
76
65
|
layerService: this.layerService,
|
|
77
66
|
parent: parent
|
|
78
|
-
});
|
|
67
|
+
});
|
|
79
68
|
|
|
69
|
+
// 重置
|
|
80
70
|
this.parent.setLayerPickService(this.tilePickService);
|
|
81
71
|
this.proxy(parent);
|
|
82
72
|
this.initTileSetManager();
|
|
83
73
|
}
|
|
84
|
-
|
|
85
74
|
_createClass(BaseTileLayer, [{
|
|
86
75
|
key: "initTileSetManager",
|
|
87
76
|
value: function initTileSetManager() {
|
|
88
77
|
var _this$tilesetManager2;
|
|
89
|
-
|
|
90
78
|
var source = this.parent.getSource();
|
|
91
79
|
this.tilesetManager = source.tileset;
|
|
92
|
-
|
|
93
80
|
if (!this.initedTileset) {
|
|
94
81
|
this.bindTilesetEvent();
|
|
95
82
|
this.initedTileset = true;
|
|
96
83
|
}
|
|
97
|
-
|
|
98
84
|
var _this$getCurrentView2 = this.getCurrentView(),
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
85
|
+
latLonBounds = _this$getCurrentView2.latLonBounds,
|
|
86
|
+
zoom = _this$getCurrentView2.zoom;
|
|
102
87
|
(_this$tilesetManager2 = this.tilesetManager) === null || _this$tilesetManager2 === void 0 ? void 0 : _this$tilesetManager2.update(zoom, latLonBounds);
|
|
103
88
|
}
|
|
104
89
|
}, {
|
|
@@ -116,27 +101,31 @@ var BaseTileLayer = /*#__PURE__*/function () {
|
|
|
116
101
|
key: "bindTilesetEvent",
|
|
117
102
|
value: function bindTilesetEvent() {
|
|
118
103
|
var _this2 = this;
|
|
119
|
-
|
|
120
104
|
// 瓦片数据加载成功
|
|
121
105
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
122
|
-
this.tilesetManager.on('tile-loaded', function (tile) {
|
|
123
|
-
|
|
106
|
+
this.tilesetManager.on('tile-loaded', function (tile) {
|
|
107
|
+
// 将事件抛出,图层上可以监听使用
|
|
108
|
+
});
|
|
124
109
|
|
|
110
|
+
// 瓦片数据从缓存删除或被执行重新加载
|
|
125
111
|
this.tilesetManager.on('tile-unload', function (tile) {
|
|
126
112
|
// 将事件抛出,图层上可以监听使用
|
|
127
113
|
_this2.tileUnLoad(tile);
|
|
128
|
-
});
|
|
129
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
114
|
+
});
|
|
130
115
|
|
|
116
|
+
// 瓦片数据加载失败
|
|
117
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
131
118
|
this.tilesetManager.on('tile-error', function (error, tile) {
|
|
132
119
|
// 将事件抛出,图层上可以监听使用
|
|
133
120
|
_this2.tileError(error);
|
|
134
|
-
});
|
|
121
|
+
});
|
|
135
122
|
|
|
123
|
+
// 瓦片显隐状态更新
|
|
136
124
|
this.tilesetManager.on('tile-update', function () {
|
|
137
125
|
_this2.tileUpdate();
|
|
138
|
-
});
|
|
126
|
+
});
|
|
139
127
|
|
|
128
|
+
// 地图视野发生改变
|
|
140
129
|
this.mapService.on('zoomend', this.mapchange);
|
|
141
130
|
this.mapService.on('moveend', this.viewchange);
|
|
142
131
|
}
|
|
@@ -159,12 +148,15 @@ var BaseTileLayer = /*#__PURE__*/function () {
|
|
|
159
148
|
key: "getTile",
|
|
160
149
|
value: function getTile(key) {
|
|
161
150
|
return this.tileLayerService.getTile(key);
|
|
162
|
-
}
|
|
151
|
+
}
|
|
163
152
|
|
|
153
|
+
// 防抖操作
|
|
164
154
|
}, {
|
|
165
155
|
key: "tileLoaded",
|
|
166
|
-
value:
|
|
167
|
-
|
|
156
|
+
value:
|
|
157
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
158
|
+
function tileLoaded(tile) {
|
|
159
|
+
//
|
|
168
160
|
}
|
|
169
161
|
}, {
|
|
170
162
|
key: "tileError",
|
|
@@ -175,25 +167,21 @@ var BaseTileLayer = /*#__PURE__*/function () {
|
|
|
175
167
|
key: "destroy",
|
|
176
168
|
value: function destroy() {
|
|
177
169
|
var _this$tilesetManager3;
|
|
178
|
-
|
|
179
170
|
this.mapService.off('zoomend', this.mapchange);
|
|
180
171
|
this.mapService.off('moveend', this.viewchange);
|
|
181
172
|
(_this$tilesetManager3 = this.tilesetManager) === null || _this$tilesetManager3 === void 0 ? void 0 : _this$tilesetManager3.destroy();
|
|
182
173
|
this.tileLayerService.destroy();
|
|
183
|
-
}
|
|
184
|
-
|
|
174
|
+
}
|
|
175
|
+
// 重新加载
|
|
185
176
|
}, {
|
|
186
177
|
key: "reload",
|
|
187
178
|
value: function reload() {
|
|
188
179
|
var _this$tilesetManager4;
|
|
189
|
-
|
|
190
180
|
// 瓦片重新加载
|
|
191
181
|
this.tilesetManager.clear();
|
|
192
|
-
|
|
193
182
|
var _this$getCurrentView3 = this.getCurrentView(),
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
183
|
+
latLonBounds = _this$getCurrentView3.latLonBounds,
|
|
184
|
+
zoom = _this$getCurrentView3.zoom;
|
|
197
185
|
(_this$tilesetManager4 = this.tilesetManager) === null || _this$tilesetManager4 === void 0 ? void 0 : _this$tilesetManager4.update(zoom, latLonBounds);
|
|
198
186
|
}
|
|
199
187
|
}, {
|
|
@@ -206,106 +194,84 @@ var BaseTileLayer = /*#__PURE__*/function () {
|
|
|
206
194
|
value: function () {
|
|
207
195
|
var _tileUpdate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
208
196
|
var _this3 = this;
|
|
209
|
-
|
|
210
197
|
var minZoom, maxZoom;
|
|
211
198
|
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
212
|
-
while (1) {
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
.
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
case 0:
|
|
243
|
-
if (_this3.tileLayerService.hasTile(tile.key)) {
|
|
244
|
-
_context.next = 9;
|
|
245
|
-
break;
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
tileInstance = getTileFactory(_this3.parent);
|
|
249
|
-
tileLayer = new tileInstance(tile, _this3.parent);
|
|
250
|
-
_context.next = 5;
|
|
251
|
-
return tileLayer.initTileLayer();
|
|
252
|
-
|
|
253
|
-
case 5:
|
|
254
|
-
_this3.tilePickService.setPickState();
|
|
255
|
-
|
|
256
|
-
if (tileLayer.getLayers().length !== 0) {
|
|
257
|
-
_this3.tileLayerService.addTile(tileLayer);
|
|
258
|
-
|
|
259
|
-
_this3.tileLayerService.updateTileVisible(tile);
|
|
260
|
-
|
|
261
|
-
_this3.layerService.reRender();
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
_context.next = 12;
|
|
265
|
-
break;
|
|
266
|
-
|
|
267
|
-
case 9:
|
|
268
|
-
// 已加载瓦片
|
|
269
|
-
_this3.tileLayerService.updateTileVisible(tile);
|
|
270
|
-
|
|
271
|
-
_this3.tilePickService.setPickState();
|
|
272
|
-
|
|
273
|
-
_this3.layerService.reRender();
|
|
274
|
-
|
|
275
|
-
case 12:
|
|
276
|
-
case "end":
|
|
277
|
-
return _context.stop();
|
|
199
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
200
|
+
case 0:
|
|
201
|
+
if (this.tilesetManager) {
|
|
202
|
+
_context2.next = 2;
|
|
203
|
+
break;
|
|
204
|
+
}
|
|
205
|
+
return _context2.abrupt("return");
|
|
206
|
+
case 2:
|
|
207
|
+
minZoom = this.parent.getMinZoom();
|
|
208
|
+
maxZoom = this.parent.getMaxZoom();
|
|
209
|
+
_context2.next = 6;
|
|
210
|
+
return Promise.all(this.tilesetManager.tiles.filter(function (tile) {
|
|
211
|
+
return tile.isLoaded;
|
|
212
|
+
}) // 过滤未加载完成的
|
|
213
|
+
.filter(function (tile) {
|
|
214
|
+
return tile.isVisibleChange;
|
|
215
|
+
}) // 过滤未发生变化的
|
|
216
|
+
.filter(function (tile) {
|
|
217
|
+
return tile.data;
|
|
218
|
+
}).filter(function (tile) {
|
|
219
|
+
return tile.z >= minZoom && tile.z < maxZoom;
|
|
220
|
+
}).map( /*#__PURE__*/function () {
|
|
221
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(tile) {
|
|
222
|
+
var tileInstance, tileLayer;
|
|
223
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
224
|
+
while (1) switch (_context.prev = _context.next) {
|
|
225
|
+
case 0:
|
|
226
|
+
if (_this3.tileLayerService.hasTile(tile.key)) {
|
|
227
|
+
_context.next = 9;
|
|
228
|
+
break;
|
|
278
229
|
}
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
230
|
+
tileInstance = getTileFactory(_this3.parent);
|
|
231
|
+
tileLayer = new tileInstance(tile, _this3.parent);
|
|
232
|
+
_context.next = 5;
|
|
233
|
+
return tileLayer.initTileLayer();
|
|
234
|
+
case 5:
|
|
235
|
+
_this3.tilePickService.setPickState();
|
|
236
|
+
if (tileLayer.getLayers().length !== 0) {
|
|
237
|
+
_this3.tileLayerService.addTile(tileLayer);
|
|
238
|
+
_this3.tileLayerService.updateTileVisible(tile);
|
|
239
|
+
_this3.layerService.reRender();
|
|
240
|
+
}
|
|
241
|
+
_context.next = 12;
|
|
242
|
+
break;
|
|
243
|
+
case 9:
|
|
244
|
+
// 已加载瓦片
|
|
245
|
+
|
|
246
|
+
_this3.tileLayerService.updateTileVisible(tile);
|
|
247
|
+
_this3.tilePickService.setPickState();
|
|
248
|
+
_this3.layerService.reRender();
|
|
249
|
+
case 12:
|
|
250
|
+
case "end":
|
|
251
|
+
return _context.stop();
|
|
252
|
+
}
|
|
253
|
+
}, _callee);
|
|
254
|
+
}));
|
|
255
|
+
return function (_x) {
|
|
256
|
+
return _ref.apply(this, arguments);
|
|
257
|
+
};
|
|
258
|
+
}()));
|
|
259
|
+
case 6:
|
|
260
|
+
if (this.tilesetManager.isLoaded) {
|
|
261
|
+
// 将事件抛出,图层上可以使用瓦片
|
|
262
|
+
this.parent.emit('tiles-loaded', this.tilesetManager.currentTiles);
|
|
263
|
+
}
|
|
264
|
+
case 7:
|
|
265
|
+
case "end":
|
|
266
|
+
return _context2.stop();
|
|
298
267
|
}
|
|
299
268
|
}, _callee2, this);
|
|
300
269
|
}));
|
|
301
|
-
|
|
302
270
|
function tileUpdate() {
|
|
303
271
|
return _tileUpdate.apply(this, arguments);
|
|
304
272
|
}
|
|
305
|
-
|
|
306
273
|
return tileUpdate;
|
|
307
274
|
}() // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
308
|
-
|
|
309
275
|
}, {
|
|
310
276
|
key: "setPickState",
|
|
311
277
|
value: function setPickState(layers) {
|
|
@@ -326,46 +292,39 @@ var BaseTileLayer = /*#__PURE__*/function () {
|
|
|
326
292
|
value: function highlightPickedFeature(pickedColors) {
|
|
327
293
|
this.tilePickService.highlightPickedFeature(pickedColors);
|
|
328
294
|
}
|
|
295
|
+
|
|
329
296
|
/**
|
|
330
297
|
* 实现 TileLayer 对子图层方法的代理
|
|
331
298
|
* @param parent
|
|
332
299
|
*/
|
|
333
|
-
|
|
334
300
|
}, {
|
|
335
301
|
key: "proxy",
|
|
336
302
|
value: function proxy(parent) {
|
|
337
303
|
var _this4 = this;
|
|
338
|
-
|
|
339
304
|
ProxyFuncs.forEach(function (func) {
|
|
340
305
|
// @ts-ignore
|
|
341
|
-
var oldStyleFunc = parent[func].bind(parent);
|
|
342
|
-
|
|
306
|
+
var oldStyleFunc = parent[func].bind(parent);
|
|
307
|
+
// @ts-ignore
|
|
343
308
|
parent[func] = function () {
|
|
344
309
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
345
310
|
args[_key] = arguments[_key];
|
|
346
311
|
}
|
|
347
|
-
|
|
348
312
|
oldStyleFunc.apply(void 0, args);
|
|
349
|
-
|
|
350
313
|
_this4.getLayers().map(function (child) {
|
|
351
314
|
// @ts-ignore
|
|
352
315
|
child[func].apply(child, args);
|
|
353
|
-
});
|
|
354
|
-
|
|
355
|
-
|
|
316
|
+
});
|
|
317
|
+
// Tip: 目前在更新 RasterData 的 colorTexture 的时候需要额外优化
|
|
356
318
|
if (func === 'style') {
|
|
357
319
|
_this4.getTiles().forEach(function (tile) {
|
|
358
320
|
return tile.styleUpdate.apply(tile, args);
|
|
359
321
|
});
|
|
360
322
|
}
|
|
361
|
-
|
|
362
323
|
return parent;
|
|
363
324
|
};
|
|
364
325
|
});
|
|
365
326
|
}
|
|
366
327
|
}]);
|
|
367
|
-
|
|
368
328
|
return BaseTileLayer;
|
|
369
329
|
}();
|
|
370
|
-
|
|
371
330
|
export { BaseTileLayer as default };
|
package/es/tile/utils.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { DOM } from '@antv/l7-utils';
|
|
2
2
|
export var tileVectorParser = ['mvt', 'geojsonvt', 'testTile'];
|
|
3
|
+
|
|
3
4
|
/**
|
|
4
5
|
* 判断当前图层是否是瓦片图层
|
|
5
6
|
* @param layer
|
|
6
7
|
* @returns
|
|
7
8
|
*/
|
|
8
|
-
|
|
9
9
|
export function isTileGroup(layer) {
|
|
10
10
|
var source = layer.getSource();
|
|
11
11
|
return tileVectorParser.includes(source.parser.type);
|
package/es/utils/blend.js
CHANGED
|
@@ -9,24 +9,20 @@ import GridIndex from "./grid-index";
|
|
|
9
9
|
* 基于网格实现文本避让,大幅提升包围盒碰撞检测效率
|
|
10
10
|
* @see https://zhuanlan.zhihu.com/p/74373214
|
|
11
11
|
*/
|
|
12
|
-
|
|
13
12
|
var CollisionIndex = /*#__PURE__*/function () {
|
|
14
13
|
function CollisionIndex(width, height) {
|
|
15
14
|
_classCallCheck(this, CollisionIndex);
|
|
16
|
-
|
|
17
15
|
_defineProperty(this, "viewportPadding", 100);
|
|
18
|
-
|
|
19
16
|
this.width = width;
|
|
20
17
|
this.height = height;
|
|
21
|
-
this.viewportPadding = Math.max(width, height);
|
|
22
|
-
|
|
18
|
+
this.viewportPadding = Math.max(width, height);
|
|
19
|
+
// 创建网格索引
|
|
23
20
|
this.grid = new GridIndex(width + this.viewportPadding, height + this.viewportPadding, 25);
|
|
24
21
|
this.screenRightBoundary = width + this.viewportPadding;
|
|
25
22
|
this.screenBottomBoundary = height + this.viewportPadding;
|
|
26
23
|
this.gridRightBoundary = width + 2 * this.viewportPadding;
|
|
27
24
|
this.gridBottomBoundary = height + 2 * this.viewportPadding;
|
|
28
25
|
}
|
|
29
|
-
|
|
30
26
|
_createClass(CollisionIndex, [{
|
|
31
27
|
key: "placeCollisionBox",
|
|
32
28
|
value: function placeCollisionBox(collisionBox) {
|
|
@@ -35,17 +31,16 @@ var CollisionIndex = /*#__PURE__*/function () {
|
|
|
35
31
|
// collisionBox.anchorPointX,
|
|
36
32
|
// collisionBox.anchorPointY,
|
|
37
33
|
// );
|
|
34
|
+
|
|
38
35
|
var tlX = collisionBox.x1 + collisionBox.anchorPointX + this.viewportPadding;
|
|
39
36
|
var tlY = collisionBox.y1 + collisionBox.anchorPointY + this.viewportPadding;
|
|
40
37
|
var brX = collisionBox.x2 + collisionBox.anchorPointX + this.viewportPadding;
|
|
41
38
|
var brY = collisionBox.y2 + collisionBox.anchorPointY + this.viewportPadding;
|
|
42
|
-
|
|
43
39
|
if (!this.isInsideGrid(tlX, tlY, brX, brY) || this.grid.hitTest(tlX, tlY, brX, brY)) {
|
|
44
40
|
return {
|
|
45
41
|
box: []
|
|
46
42
|
};
|
|
47
43
|
}
|
|
48
|
-
|
|
49
44
|
return {
|
|
50
45
|
box: [tlX, tlY, brX, brY]
|
|
51
46
|
};
|
|
@@ -58,6 +53,7 @@ var CollisionIndex = /*#__PURE__*/function () {
|
|
|
58
53
|
};
|
|
59
54
|
this.grid.insert(key, box[0], box[1], box[2], box[3]);
|
|
60
55
|
}
|
|
56
|
+
|
|
61
57
|
/**
|
|
62
58
|
* 后续碰撞检测都需要投影到 viewport 坐标系
|
|
63
59
|
* @param {THREE.Matrix4} mvpMatrix mvp矩阵
|
|
@@ -65,21 +61,21 @@ var CollisionIndex = /*#__PURE__*/function () {
|
|
|
65
61
|
* @param {number} y P20 平面坐标Y
|
|
66
62
|
* @return {Point} projectedPoint
|
|
67
63
|
*/
|
|
68
|
-
|
|
69
64
|
}, {
|
|
70
65
|
key: "project",
|
|
71
66
|
value: function project(mvpMatrix, x, y) {
|
|
72
67
|
var point = vec4.fromValues(x, y, 0, 1);
|
|
73
|
-
var out = vec4.create();
|
|
74
|
-
|
|
68
|
+
var out = vec4.create();
|
|
69
|
+
// @ts-ignore
|
|
75
70
|
var mat = mat4.fromValues.apply(mat4, _toConsumableArray(mvpMatrix));
|
|
76
|
-
vec4.transformMat4(out, point, mat);
|
|
77
|
-
|
|
71
|
+
vec4.transformMat4(out, point, mat);
|
|
72
|
+
// GL 坐标系[-1, 1] -> viewport 坐标系[width, height]
|
|
78
73
|
return {
|
|
79
74
|
x: (out[0] / out[3] + 1) / 2 * this.width + this.viewportPadding,
|
|
80
75
|
y: (-out[1] / out[3] + 1) / 2 * this.height + this.viewportPadding
|
|
81
76
|
};
|
|
82
77
|
}
|
|
78
|
+
|
|
83
79
|
/**
|
|
84
80
|
* 判断包围盒是否在整个网格内,需要加上 buffer
|
|
85
81
|
* @param {number} x1 x1
|
|
@@ -88,15 +84,12 @@ var CollisionIndex = /*#__PURE__*/function () {
|
|
|
88
84
|
* @param {number} y2 y2
|
|
89
85
|
* @return {Point} isInside
|
|
90
86
|
*/
|
|
91
|
-
|
|
92
87
|
}, {
|
|
93
88
|
key: "isInsideGrid",
|
|
94
89
|
value: function isInsideGrid(x1, y1, x2, y2) {
|
|
95
90
|
return x2 >= 0 && x1 < this.gridRightBoundary && y2 >= 0 && y1 < this.gridBottomBoundary;
|
|
96
91
|
}
|
|
97
92
|
}]);
|
|
98
|
-
|
|
99
93
|
return CollisionIndex;
|
|
100
94
|
}();
|
|
101
|
-
|
|
102
95
|
export { CollisionIndex as default };
|