@antv/l7-layers 2.9.37-alpha.2 → 2.9.37-alpha.3
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.d.ts +23 -0
- package/es/Geometry/index.js +105 -0
- package/es/Geometry/models/billboard.d.ts +17 -0
- package/es/Geometry/models/billboard.js +215 -0
- package/es/Geometry/models/index.d.ts +5 -0
- package/es/Geometry/models/index.js +9 -0
- package/es/Geometry/models/plane.d.ts +36 -0
- package/es/Geometry/models/plane.js +406 -0
- package/es/Geometry/models/sprite.d.ts +38 -0
- package/es/Geometry/models/sprite.js +288 -0
- package/es/Geometry/shaders/billboard_frag.glsl +13 -0
- package/es/Geometry/shaders/billboard_vert.glsl +50 -0
- package/es/Geometry/shaders/plane_frag.glsl +22 -0
- package/es/Geometry/shaders/plane_vert.glsl +53 -0
- package/es/Geometry/shaders/sprite_frag.glsl +21 -0
- package/es/Geometry/shaders/sprite_vert.glsl +28 -0
- package/es/canvas/index.d.ts +14 -0
- package/es/canvas/index.js +108 -0
- package/es/canvas/models/canvas.d.ts +18 -0
- package/es/canvas/models/canvas.js +212 -0
- package/es/canvas/models/index.d.ts +5 -0
- package/es/canvas/models/index.js +5 -0
- package/es/citybuliding/building.d.ts +8 -0
- package/es/citybuliding/building.js +73 -0
- package/es/citybuliding/models/build.d.ts +22 -0
- package/es/citybuliding/models/build.js +187 -0
- package/es/citybuliding/shaders/build_frag.glsl +117 -0
- package/es/citybuliding/shaders/build_vert.glsl +54 -0
- package/es/core/BaseLayer.d.ts +225 -0
- package/es/core/BaseLayer.js +1439 -0
- package/es/core/BaseModel.d.ts +140 -0
- package/es/core/BaseModel.js +490 -0
- package/es/core/interface.d.ts +225 -0
- package/es/core/interface.js +30 -0
- package/es/core/schema.d.ts +27 -0
- package/es/core/schema.js +25 -0
- package/es/core/shape/Path.d.ts +39 -0
- package/es/core/shape/Path.js +62 -0
- package/es/core/shape/extrude.d.ts +17 -0
- package/es/core/shape/extrude.js +148 -0
- package/es/core/triangulation.d.ts +130 -0
- package/es/core/triangulation.js +552 -0
- package/es/earth/index.d.ts +22 -0
- package/es/earth/index.js +98 -0
- package/es/earth/models/atmosphere.d.ts +9 -0
- package/es/earth/models/atmosphere.js +135 -0
- package/es/earth/models/base.d.ts +16 -0
- package/es/earth/models/base.js +206 -0
- package/es/earth/models/bloomsphere.d.ts +9 -0
- package/es/earth/models/bloomsphere.js +134 -0
- package/es/earth/shaders/atmosphere_frag.glsl +17 -0
- package/es/earth/shaders/atmosphere_vert.glsl +26 -0
- package/es/earth/shaders/base_frag.glsl +13 -0
- package/es/earth/shaders/base_vert.glsl +52 -0
- package/es/earth/shaders/bloomsphere_frag.glsl +15 -0
- package/es/earth/shaders/bloomsphere_vert.glsl +20 -0
- package/es/earth/utils.d.ts +26 -0
- package/es/earth/utils.js +104 -0
- package/es/glsl.d.ts +5 -0
- package/es/heatmap/index.d.ts +12 -0
- package/es/heatmap/index.js +128 -0
- package/es/heatmap/models/grid.d.ts +8 -0
- package/es/heatmap/models/grid.js +106 -0
- package/es/heatmap/models/grid3d.d.ts +8 -0
- package/es/heatmap/models/grid3d.js +140 -0
- package/es/heatmap/models/heatmap.d.ts +24 -0
- package/es/heatmap/models/heatmap.js +461 -0
- package/es/heatmap/models/hexagon.d.ts +8 -0
- package/es/heatmap/models/hexagon.js +107 -0
- package/es/heatmap/models/index.d.ts +5 -0
- package/es/heatmap/models/index.js +12 -0
- package/es/heatmap/shaders/grid_vert.glsl +42 -0
- package/es/heatmap/shaders/heatmap_3d_frag.glsl +14 -0
- package/es/heatmap/shaders/heatmap_3d_vert.glsl +46 -0
- package/es/heatmap/shaders/heatmap_frag.glsl +47 -0
- package/es/heatmap/shaders/heatmap_framebuffer_frag.glsl +10 -0
- package/es/heatmap/shaders/heatmap_framebuffer_vert.glsl +35 -0
- package/es/heatmap/shaders/heatmap_vert.glsl +10 -0
- package/es/heatmap/shaders/hexagon_3d_frag.glsl +0 -0
- package/es/heatmap/shaders/hexagon_3d_vert.glsl +64 -0
- package/es/heatmap/shaders/hexagon_frag.glsl +12 -0
- package/es/heatmap/shaders/hexagon_vert.glsl +41 -0
- package/es/heatmap/triangulation.d.ts +5 -0
- package/es/heatmap/triangulation.js +37 -0
- package/es/image/index.d.ts +10 -0
- package/es/image/index.js +91 -0
- package/es/image/models/dataImage.d.ts +13 -0
- package/es/image/models/dataImage.js +186 -0
- package/es/image/models/image.d.ts +10 -0
- package/es/image/models/image.js +150 -0
- package/es/image/models/index.d.ts +5 -0
- package/es/image/models/index.js +9 -0
- package/es/image/models/tileDataImage.d.ts +10 -0
- package/es/image/models/tileDataImage.js +160 -0
- package/es/image/shaders/dataImage_frag.glsl +38 -0
- package/es/image/shaders/image_frag.glsl +9 -0
- package/es/image/shaders/image_vert.glsl +17 -0
- package/es/index.d.ts +17 -0
- package/es/index.js +107 -0
- package/es/line/index.d.ts +34 -0
- package/es/line/index.js +127 -0
- package/es/line/models/arc.d.ts +17 -0
- package/es/line/models/arc.js +356 -0
- package/es/line/models/arc_3d.d.ts +17 -0
- package/es/line/models/arc_3d.js +333 -0
- package/es/line/models/earthArc_3d.d.ts +17 -0
- package/es/line/models/earthArc_3d.js +336 -0
- package/es/line/models/great_circle.d.ts +12 -0
- package/es/line/models/great_circle.js +294 -0
- package/es/line/models/half.d.ts +18 -0
- package/es/line/models/half.js +281 -0
- package/es/line/models/index.d.ts +5 -0
- package/es/line/models/index.js +25 -0
- package/es/line/models/line.d.ts +21 -0
- package/es/line/models/line.js +443 -0
- package/es/line/models/linearline.d.ts +11 -0
- package/es/line/models/linearline.js +275 -0
- package/es/line/models/simpleLine.d.ts +14 -0
- package/es/line/models/simpleLine.js +234 -0
- package/es/line/models/simpleTileLine.d.ts +9 -0
- package/es/line/models/simpleTileLine.js +100 -0
- package/es/line/models/tile.d.ts +8 -0
- package/es/line/models/tile.js +178 -0
- package/es/line/models/wall.d.ts +12 -0
- package/es/line/models/wall.js +293 -0
- package/es/line/shaders/arc_chunks.vert.glsl +21 -0
- package/es/line/shaders/dash/arc_dash_frag.glsl +28 -0
- package/es/line/shaders/dash/arc_dash_vert.glsl +150 -0
- package/es/line/shaders/dash/line_dash_frag.glsl +31 -0
- package/es/line/shaders/dash/line_dash_vert.glsl +93 -0
- package/es/line/shaders/half/line_half_frag.glsl +53 -0
- package/es/line/shaders/half/line_half_vert.glsl +169 -0
- package/es/line/shaders/line_arc2d_vert.glsl +114 -0
- package/es/line/shaders/line_arc_3d_frag.glsl +103 -0
- package/es/line/shaders/line_arc_3d_vert.glsl +206 -0
- package/es/line/shaders/line_arc_frag.glsl +88 -0
- package/es/line/shaders/line_arc_great_circle_frag.glsl +101 -0
- package/es/line/shaders/line_arc_great_circle_vert.glsl +214 -0
- package/es/line/shaders/line_arc_vert.glsl +178 -0
- package/es/line/shaders/line_bezier_vert.glsl +85 -0
- package/es/line/shaders/line_frag.glsl +99 -0
- package/es/line/shaders/line_vert.glsl +192 -0
- package/es/line/shaders/linear/arc3d_linear_frag.glsl +46 -0
- package/es/line/shaders/linear/arc3d_linear_vert.glsl +206 -0
- package/es/line/shaders/linear/arc_linear_frag.glsl +38 -0
- package/es/line/shaders/linear/arc_linear_vert.glsl +138 -0
- package/es/line/shaders/linear/line_linear_frag.glsl +27 -0
- package/es/line/shaders/linearLine/line_linear_frag.glsl +20 -0
- package/es/line/shaders/linearLine/line_linear_vert.glsl +112 -0
- package/es/line/shaders/simple/simpleline_frag.glsl +10 -0
- package/es/line/shaders/simple/simpleline_linear_frag.glsl +11 -0
- package/es/line/shaders/simple/simpleline_vert.glsl +79 -0
- package/es/line/shaders/tile/line_tile_map_vert.glsl +25 -0
- package/es/line/shaders/tile/line_tile_vert.glsl +52 -0
- package/es/line/shaders/tile/simpleline_map_vert.glsl +15 -0
- package/es/line/shaders/tile/simpleline_vert.glsl +21 -0
- package/es/line/shaders/wall/wall_frag.glsl +89 -0
- package/es/line/shaders/wall/wall_vert.glsl +77 -0
- package/es/mask/index.d.ts +18 -0
- package/es/mask/index.js +147 -0
- package/es/mask/models/fill.d.ts +12 -0
- package/es/mask/models/fill.js +124 -0
- package/es/mask/models/index.d.ts +5 -0
- package/es/mask/models/index.js +7 -0
- package/es/mask/shaders/mask_vert.glsl +16 -0
- package/es/plugins/DataMappingPlugin.d.ts +18 -0
- package/es/plugins/DataMappingPlugin.js +413 -0
- package/es/plugins/DataSourcePlugin.d.ts +7 -0
- package/es/plugins/DataSourcePlugin.js +84 -0
- package/es/plugins/FeatureScalePlugin.d.ts +24 -0
- package/es/plugins/FeatureScalePlugin.js +342 -0
- package/es/plugins/LayerAnimateStylePlugin.d.ts +5 -0
- package/es/plugins/LayerAnimateStylePlugin.js +29 -0
- package/es/plugins/LayerModelPlugin.d.ts +10 -0
- package/es/plugins/LayerModelPlugin.js +72 -0
- package/es/plugins/LayerStylePlugin.d.ts +8 -0
- package/es/plugins/LayerStylePlugin.js +39 -0
- package/es/plugins/LightingPlugin.d.ts +36 -0
- package/es/plugins/LightingPlugin.js +104 -0
- package/es/plugins/MultiPassRendererPlugin.d.ts +23 -0
- package/es/plugins/MultiPassRendererPlugin.js +65 -0
- package/es/plugins/PixelPickingPlugin.d.ts +8 -0
- package/es/plugins/PixelPickingPlugin.js +126 -0
- package/es/plugins/RegisterStyleAttributePlugin.d.ts +15 -0
- package/es/plugins/RegisterStyleAttributePlugin.js +151 -0
- package/es/plugins/ShaderUniformPlugin.d.ts +21 -0
- package/es/plugins/ShaderUniformPlugin.js +106 -0
- package/es/plugins/UpdateModelPlugin.d.ts +8 -0
- package/es/plugins/UpdateModelPlugin.js +31 -0
- package/es/plugins/UpdateStyleAttributePlugin.d.ts +12 -0
- package/es/plugins/UpdateStyleAttributePlugin.js +83 -0
- package/es/point/index.d.ts +31 -0
- package/es/point/index.js +216 -0
- package/es/point/models/earthExtrude.d.ts +24 -0
- package/es/point/models/earthExtrude.js +274 -0
- package/es/point/models/earthFill.d.ts +11 -0
- package/es/point/models/earthFill.js +258 -0
- package/es/point/models/extrude.d.ts +24 -0
- package/es/point/models/extrude.js +295 -0
- package/es/point/models/fill.d.ts +40 -0
- package/es/point/models/fill.js +403 -0
- package/es/point/models/fillmage.d.ts +25 -0
- package/es/point/models/fillmage.js +366 -0
- package/es/point/models/image.d.ts +11 -0
- package/es/point/models/image.js +239 -0
- package/es/point/models/index.d.ts +5 -0
- package/es/point/models/index.js +30 -0
- package/es/point/models/normal.d.ts +16 -0
- package/es/point/models/normal.js +124 -0
- package/es/point/models/radar.d.ts +24 -0
- package/es/point/models/radar.js +232 -0
- package/es/point/models/simplePoint.d.ts +16 -0
- package/es/point/models/simplePoint.js +179 -0
- package/es/point/models/text.d.ts +57 -0
- package/es/point/models/text.js +619 -0
- package/es/point/models/tile.d.ts +15 -0
- package/es/point/models/tile.js +175 -0
- package/es/point/models/tileText.d.ts +52 -0
- package/es/point/models/tileText.js +509 -0
- package/es/point/shaders/animate/wave_frag.glsl +65 -0
- package/es/point/shaders/earth/extrude_frag.glsl +44 -0
- package/es/point/shaders/earth/extrude_vert.glsl +140 -0
- package/es/point/shaders/earth/fill_frag.glsl +86 -0
- package/es/point/shaders/earth/fill_vert.glsl +125 -0
- package/es/point/shaders/extrude/extrude_frag.glsl +44 -0
- package/es/point/shaders/extrude/extrude_vert.glsl +121 -0
- package/es/point/shaders/fill_frag.glsl +84 -0
- package/es/point/shaders/fill_vert.glsl +188 -0
- package/es/point/shaders/image/fillImage_frag.glsl +20 -0
- package/es/point/shaders/image/fillImage_vert.glsl +116 -0
- package/es/point/shaders/image_frag.glsl +39 -0
- package/es/point/shaders/image_vert.glsl +90 -0
- package/es/point/shaders/normal_frag.glsl +6 -0
- package/es/point/shaders/normal_vert.glsl +24 -0
- package/es/point/shaders/radar/radar_frag.glsl +53 -0
- package/es/point/shaders/radar/radar_vert.glsl +70 -0
- package/es/point/shaders/simplePoint_frag.glsl +53 -0
- package/es/point/shaders/simplePoint_vert.glsl +79 -0
- package/es/point/shaders/text_frag.glsl +48 -0
- package/es/point/shaders/text_vert.glsl +131 -0
- package/es/point/shaders/tile/fill_tile_frag.glsl +76 -0
- package/es/point/shaders/tile/fill_tile_vert.glsl +78 -0
- package/es/point/shaders/tile/text_frag.glsl +33 -0
- package/es/point/shaders/tile/text_map_frag.glsl +31 -0
- package/es/point/shaders/tile/text_map_vert.glsl +38 -0
- package/es/point/shaders/tile/text_vert.glsl +48 -0
- package/es/point/shape/extrude.d.ts +15 -0
- package/es/point/shape/extrude.js +63 -0
- package/es/polygon/index.d.ts +18 -0
- package/es/polygon/index.js +133 -0
- package/es/polygon/models/extrude.d.ts +28 -0
- package/es/polygon/models/extrude.js +302 -0
- package/es/polygon/models/fill.d.ts +17 -0
- package/es/polygon/models/fill.js +210 -0
- package/es/polygon/models/index.d.ts +5 -0
- package/es/polygon/models/index.js +28 -0
- package/es/polygon/models/ocean.d.ts +21 -0
- package/es/polygon/models/ocean.js +201 -0
- package/es/polygon/models/tile.d.ts +12 -0
- package/es/polygon/models/tile.js +101 -0
- package/es/polygon/models/water.d.ts +16 -0
- package/es/polygon/models/water.js +178 -0
- package/es/polygon/shaders/extrude/polygon_extrude_frag.glsl +44 -0
- package/es/polygon/shaders/extrude/polygon_extrude_picklight_frag.glsl +44 -0
- package/es/polygon/shaders/extrude/polygon_extrude_picklight_vert.glsl +85 -0
- package/es/polygon/shaders/extrude/polygon_extrude_vert.glsl +90 -0
- package/es/polygon/shaders/extrude/polygon_extrudetex_frag.glsl +48 -0
- package/es/polygon/shaders/extrude/polygon_extrudetex_vert.glsl +93 -0
- package/es/polygon/shaders/polygon_frag.glsl +12 -0
- package/es/polygon/shaders/polygon_linear_frag.glsl +22 -0
- package/es/polygon/shaders/polygon_linear_vert.glsl +74 -0
- package/es/polygon/shaders/polygon_vert.glsl +66 -0
- package/es/polygon/shaders/tile/polygon_tile_map_vert.glsl +16 -0
- package/es/polygon/shaders/tile/polygon_tile_vert.glsl +42 -0
- package/es/polygon/shaders/water/polygon_ocean_frag.glsl +247 -0
- package/es/polygon/shaders/water/polygon_ocean_vert.glsl +21 -0
- package/es/polygon/shaders/water/polygon_water_frag.glsl +71 -0
- package/es/polygon/shaders/water/polygon_water_vert.glsl +26 -0
- package/es/raster/buffers/triangulation.d.ts +6 -0
- package/es/raster/buffers/triangulation.js +25 -0
- package/es/raster/index.d.ts +10 -0
- package/es/raster/index.js +94 -0
- package/es/raster/models/index.d.ts +5 -0
- package/es/raster/models/index.js +10 -0
- package/es/raster/models/raster.d.ts +22 -0
- package/es/raster/models/raster.js +241 -0
- package/es/raster/models/rasterRgb.d.ts +20 -0
- package/es/raster/models/rasterRgb.js +225 -0
- package/es/raster/models/rasterTile.d.ts +18 -0
- package/es/raster/models/rasterTile.js +139 -0
- package/es/raster/raster.d.ts +21 -0
- package/es/raster/raster.js +161 -0
- package/es/raster/shaders/raster_2d_frag.glsl +64 -0
- package/es/raster/shaders/raster_2d_vert.glsl +17 -0
- package/es/raster/shaders/raster_frag.glsl +9 -0
- package/es/raster/shaders/raster_rgb_frag.glsl +12 -0
- package/es/raster/shaders/raster_vert.glsl +44 -0
- package/es/shader/minify_frag.glsl +7 -0
- package/es/shader/minify_picking_frag.glsl +10 -0
- package/es/tile/interaction/TilePickService.d.ts +16 -0
- package/es/tile/interaction/TilePickService.js +129 -0
- package/es/tile/interaction/getFeatureData.d.ts +0 -0
- package/es/tile/interaction/getFeatureData.js +0 -0
- package/es/tile/interaction/getRasterData.d.ts +4 -0
- package/es/tile/interaction/getRasterData.js +70 -0
- package/es/tile/interaction/utils.d.ts +11 -0
- package/es/tile/interaction/utils.js +97 -0
- package/es/tile/interface.d.ts +28 -0
- package/es/tile/interface.js +1 -0
- package/es/tile/manager/base.d.ts +30 -0
- package/es/tile/manager/base.js +146 -0
- package/es/tile/manager/layerManager.d.ts +19 -0
- package/es/tile/manager/layerManager.js +254 -0
- package/es/tile/manager/mapLayerManager.d.ts +7 -0
- package/es/tile/manager/mapLayerManager.js +119 -0
- package/es/tile/models/tileModel.d.ts +10 -0
- package/es/tile/models/tileModel.js +81 -0
- package/es/tile/render/TileRenderService.d.ts +10 -0
- package/es/tile/render/TileRenderService.js +68 -0
- package/es/tile/style/TileStyleService.d.ts +17 -0
- package/es/tile/style/TileStyleService.js +118 -0
- package/es/tile/style/constants.d.ts +13 -0
- package/es/tile/style/constants.js +17 -0
- package/es/tile/style/utils.d.ts +9 -0
- package/es/tile/style/utils.js +139 -0
- package/es/tile/tileFactory/base.d.ts +45 -0
- package/es/tile/tileFactory/base.js +403 -0
- package/es/tile/tileFactory/index.d.ts +5 -0
- package/es/tile/tileFactory/index.js +38 -0
- package/es/tile/tileFactory/layers/rasterDataLayer.d.ts +11 -0
- package/es/tile/tileFactory/layers/rasterDataLayer.js +77 -0
- package/es/tile/tileFactory/layers/tileTest.d.ts +15 -0
- package/es/tile/tileFactory/layers/tileTest.js +62 -0
- package/es/tile/tileFactory/layers/vectorLayer.d.ts +30 -0
- package/es/tile/tileFactory/layers/vectorLayer.js +253 -0
- package/es/tile/tileFactory/line.d.ts +12 -0
- package/es/tile/tileFactory/line.js +59 -0
- package/es/tile/tileFactory/mask.d.ts +12 -0
- package/es/tile/tileFactory/mask.js +60 -0
- package/es/tile/tileFactory/point.d.ts +12 -0
- package/es/tile/tileFactory/point.js +60 -0
- package/es/tile/tileFactory/polygon.d.ts +12 -0
- package/es/tile/tileFactory/polygon.js +59 -0
- package/es/tile/tileFactory/raster.d.ts +12 -0
- package/es/tile/tileFactory/raster.js +55 -0
- package/es/tile/tileFactory/rasterData.d.ts +12 -0
- package/es/tile/tileFactory/rasterData.js +81 -0
- package/es/tile/tileFactory/test.d.ts +12 -0
- package/es/tile/tileFactory/test.js +94 -0
- package/es/tile/tileLayer/MapTileLayer.d.ts +6 -0
- package/es/tile/tileLayer/MapTileLayer.js +48 -0
- package/es/tile/tileLayer/TileLayer.d.ts +22 -0
- package/es/tile/tileLayer/TileLayer.js +198 -0
- package/es/tile/tileLayer/base.d.ts +33 -0
- package/es/tile/tileLayer/base.js +212 -0
- package/es/tile/utils.d.ts +22 -0
- package/es/tile/utils.js +149 -0
- package/es/utils/blend.d.ts +2 -0
- package/es/utils/blend.js +54 -0
- package/es/utils/collision-index.d.ts +47 -0
- package/es/utils/collision-index.js +102 -0
- package/es/utils/dataMappingStyle.d.ts +31 -0
- package/es/utils/dataMappingStyle.js +147 -0
- package/es/utils/extrude_polyline.d.ts +68 -0
- package/es/utils/extrude_polyline.js +613 -0
- package/es/utils/grid-index.d.ts +28 -0
- package/es/utils/grid-index.js +179 -0
- package/es/utils/layerData.d.ts +2 -0
- package/es/utils/layerData.js +179 -0
- package/es/utils/multiPassRender.d.ts +16 -0
- package/es/utils/multiPassRender.js +49 -0
- package/es/utils/polylineNormal.d.ts +9 -0
- package/es/utils/polylineNormal.js +191 -0
- package/es/utils/simpleLine.d.ts +23 -0
- package/es/utils/simpleLine.js +103 -0
- package/es/utils/symbol-layout.d.ts +43 -0
- package/es/utils/symbol-layout.js +299 -0
- package/es/utils/updateShape.d.ts +2 -0
- package/es/utils/updateShape.js +20 -0
- package/es/wind/index.d.ts +11 -0
- package/es/wind/index.js +85 -0
- package/es/wind/models/index.d.ts +5 -0
- package/es/wind/models/index.js +5 -0
- package/es/wind/models/utils.d.ts +19 -0
- package/es/wind/models/utils.js +226 -0
- package/es/wind/models/wind.d.ts +24 -0
- package/es/wind/models/wind.js +317 -0
- package/es/wind/models/windRender.d.ts +104 -0
- package/es/wind/models/windRender.js +357 -0
- package/es/wind/models/windShader.d.ts +12 -0
- package/es/wind/models/windShader.js +12 -0
- package/es/wind/shaders/wind_frag.glsl +9 -0
- package/es/wind/shaders/wind_vert.glsl +17 -0
- package/lib/Geometry/index.js +117 -0
- package/lib/Geometry/models/billboard.js +229 -0
- package/lib/Geometry/models/index.js +22 -0
- package/lib/Geometry/models/plane.js +421 -0
- package/lib/Geometry/models/sprite.js +302 -0
- package/lib/Geometry/shaders/billboard_frag.glsl +13 -0
- package/lib/Geometry/shaders/billboard_vert.glsl +50 -0
- package/lib/Geometry/shaders/plane_frag.glsl +22 -0
- package/lib/Geometry/shaders/plane_vert.glsl +53 -0
- package/lib/Geometry/shaders/sprite_frag.glsl +21 -0
- package/lib/Geometry/shaders/sprite_vert.glsl +28 -0
- package/lib/canvas/index.js +120 -0
- package/lib/canvas/models/canvas.js +221 -0
- package/lib/canvas/models/index.js +16 -0
- package/lib/citybuliding/building.js +86 -0
- package/lib/citybuliding/models/build.js +202 -0
- package/lib/citybuliding/shaders/build_frag.glsl +117 -0
- package/lib/citybuliding/shaders/build_vert.glsl +54 -0
- package/lib/core/BaseLayer.js +1434 -0
- package/lib/core/BaseModel.js +507 -0
- package/lib/core/interface.js +41 -0
- package/lib/core/schema.js +33 -0
- package/lib/core/shape/Path.js +88 -0
- package/lib/core/shape/extrude.js +180 -0
- package/lib/core/triangulation.js +620 -0
- package/lib/earth/index.js +113 -0
- package/lib/earth/models/atmosphere.js +149 -0
- package/lib/earth/models/base.js +216 -0
- package/lib/earth/models/bloomsphere.js +148 -0
- package/lib/earth/shaders/atmosphere_frag.glsl +17 -0
- package/lib/earth/shaders/atmosphere_vert.glsl +26 -0
- package/lib/earth/shaders/base_frag.glsl +13 -0
- package/lib/earth/shaders/base_vert.glsl +52 -0
- package/lib/earth/shaders/bloomsphere_frag.glsl +15 -0
- package/lib/earth/shaders/bloomsphere_vert.glsl +20 -0
- package/lib/earth/utils.js +136 -0
- package/lib/glsl.d.ts +5 -0
- package/lib/heatmap/index.js +141 -0
- package/lib/heatmap/models/grid.js +120 -0
- package/lib/heatmap/models/grid3d.js +154 -0
- package/lib/heatmap/models/heatmap.js +484 -0
- package/lib/heatmap/models/hexagon.js +121 -0
- package/lib/heatmap/models/index.js +26 -0
- package/lib/heatmap/shaders/grid_vert.glsl +42 -0
- package/lib/heatmap/shaders/heatmap_3d_frag.glsl +14 -0
- package/lib/heatmap/shaders/heatmap_3d_vert.glsl +46 -0
- package/lib/heatmap/shaders/heatmap_frag.glsl +47 -0
- package/lib/heatmap/shaders/heatmap_framebuffer_frag.glsl +10 -0
- package/lib/heatmap/shaders/heatmap_framebuffer_vert.glsl +35 -0
- package/lib/heatmap/shaders/heatmap_vert.glsl +10 -0
- package/lib/heatmap/shaders/hexagon_3d_frag.glsl +0 -0
- package/lib/heatmap/shaders/hexagon_3d_vert.glsl +64 -0
- package/lib/heatmap/shaders/hexagon_frag.glsl +12 -0
- package/lib/heatmap/shaders/hexagon_vert.glsl +41 -0
- package/lib/heatmap/triangulation.js +44 -0
- package/lib/image/index.js +104 -0
- package/lib/image/models/dataImage.js +201 -0
- package/lib/image/models/image.js +164 -0
- package/lib/image/models/index.js +22 -0
- package/lib/image/models/tileDataImage.js +174 -0
- package/lib/image/shaders/dataImage_frag.glsl +38 -0
- package/lib/image/shaders/image_frag.glsl +9 -0
- package/lib/image/shaders/image_vert.glsl +17 -0
- package/lib/index.js +275 -0
- package/lib/line/index.js +139 -0
- package/lib/line/models/arc.js +373 -0
- package/lib/line/models/arc_3d.js +351 -0
- package/lib/line/models/earthArc_3d.js +354 -0
- package/lib/line/models/great_circle.js +310 -0
- package/lib/line/models/half.js +298 -0
- package/lib/line/models/index.js +46 -0
- package/lib/line/models/line.js +460 -0
- package/lib/line/models/linearline.js +292 -0
- package/lib/line/models/simpleLine.js +249 -0
- package/lib/line/models/simpleTileLine.js +115 -0
- package/lib/line/models/tile.js +194 -0
- package/lib/line/models/wall.js +309 -0
- package/lib/line/shaders/arc_chunks.vert.glsl +21 -0
- package/lib/line/shaders/dash/arc_dash_frag.glsl +28 -0
- package/lib/line/shaders/dash/arc_dash_vert.glsl +150 -0
- package/lib/line/shaders/dash/line_dash_frag.glsl +31 -0
- package/lib/line/shaders/dash/line_dash_vert.glsl +93 -0
- package/lib/line/shaders/half/line_half_frag.glsl +53 -0
- package/lib/line/shaders/half/line_half_vert.glsl +169 -0
- package/lib/line/shaders/line_arc2d_vert.glsl +114 -0
- package/lib/line/shaders/line_arc_3d_frag.glsl +103 -0
- package/lib/line/shaders/line_arc_3d_vert.glsl +206 -0
- package/lib/line/shaders/line_arc_frag.glsl +88 -0
- package/lib/line/shaders/line_arc_great_circle_frag.glsl +101 -0
- package/lib/line/shaders/line_arc_great_circle_vert.glsl +214 -0
- package/lib/line/shaders/line_arc_vert.glsl +178 -0
- package/lib/line/shaders/line_bezier_vert.glsl +85 -0
- package/lib/line/shaders/line_frag.glsl +99 -0
- package/lib/line/shaders/line_vert.glsl +192 -0
- package/lib/line/shaders/linear/arc3d_linear_frag.glsl +46 -0
- package/lib/line/shaders/linear/arc3d_linear_vert.glsl +206 -0
- package/lib/line/shaders/linear/arc_linear_frag.glsl +38 -0
- package/lib/line/shaders/linear/arc_linear_vert.glsl +138 -0
- package/lib/line/shaders/linear/line_linear_frag.glsl +27 -0
- package/lib/line/shaders/linearLine/line_linear_frag.glsl +20 -0
- package/lib/line/shaders/linearLine/line_linear_vert.glsl +112 -0
- package/lib/line/shaders/simple/simpleline_frag.glsl +10 -0
- package/lib/line/shaders/simple/simpleline_linear_frag.glsl +11 -0
- package/lib/line/shaders/simple/simpleline_vert.glsl +79 -0
- package/lib/line/shaders/tile/line_tile_map_vert.glsl +25 -0
- package/lib/line/shaders/tile/line_tile_vert.glsl +52 -0
- package/lib/line/shaders/tile/simpleline_map_vert.glsl +15 -0
- package/lib/line/shaders/tile/simpleline_vert.glsl +21 -0
- package/lib/line/shaders/wall/wall_frag.glsl +89 -0
- package/lib/line/shaders/wall/wall_vert.glsl +77 -0
- package/lib/mask/index.js +163 -0
- package/lib/mask/models/fill.js +141 -0
- package/lib/mask/models/index.js +19 -0
- package/lib/mask/shaders/mask_vert.glsl +16 -0
- package/lib/plugins/DataMappingPlugin.js +427 -0
- package/lib/plugins/DataSourcePlugin.js +97 -0
- package/lib/plugins/FeatureScalePlugin.js +365 -0
- package/lib/plugins/LayerAnimateStylePlugin.js +41 -0
- package/lib/plugins/LayerModelPlugin.js +83 -0
- package/lib/plugins/LayerStylePlugin.js +50 -0
- package/lib/plugins/LightingPlugin.js +119 -0
- package/lib/plugins/MultiPassRendererPlugin.js +77 -0
- package/lib/plugins/PixelPickingPlugin.js +139 -0
- package/lib/plugins/RegisterStyleAttributePlugin.js +164 -0
- package/lib/plugins/ShaderUniformPlugin.js +119 -0
- package/lib/plugins/UpdateModelPlugin.js +42 -0
- package/lib/plugins/UpdateStyleAttributePlugin.js +94 -0
- package/lib/point/index.js +229 -0
- package/lib/point/models/earthExtrude.js +290 -0
- package/lib/point/models/earthFill.js +293 -0
- package/lib/point/models/extrude.js +312 -0
- package/lib/point/models/fill.js +419 -0
- package/lib/point/models/fillmage.js +382 -0
- package/lib/point/models/image.js +255 -0
- package/lib/point/models/index.js +53 -0
- package/lib/point/models/normal.js +141 -0
- package/lib/point/models/radar.js +249 -0
- package/lib/point/models/simplePoint.js +196 -0
- package/lib/point/models/text.js +634 -0
- package/lib/point/models/tile.js +189 -0
- package/lib/point/models/tileText.js +524 -0
- package/lib/point/shaders/animate/wave_frag.glsl +65 -0
- package/lib/point/shaders/earth/extrude_frag.glsl +44 -0
- package/lib/point/shaders/earth/extrude_vert.glsl +140 -0
- package/lib/point/shaders/earth/fill_frag.glsl +86 -0
- package/lib/point/shaders/earth/fill_vert.glsl +125 -0
- package/lib/point/shaders/extrude/extrude_frag.glsl +44 -0
- package/lib/point/shaders/extrude/extrude_vert.glsl +121 -0
- package/lib/point/shaders/fill_frag.glsl +84 -0
- package/lib/point/shaders/fill_vert.glsl +188 -0
- package/lib/point/shaders/image/fillImage_frag.glsl +20 -0
- package/lib/point/shaders/image/fillImage_vert.glsl +116 -0
- package/lib/point/shaders/image_frag.glsl +39 -0
- package/lib/point/shaders/image_vert.glsl +90 -0
- package/lib/point/shaders/normal_frag.glsl +6 -0
- package/lib/point/shaders/normal_vert.glsl +24 -0
- package/lib/point/shaders/radar/radar_frag.glsl +53 -0
- package/lib/point/shaders/radar/radar_vert.glsl +70 -0
- package/lib/point/shaders/simplePoint_frag.glsl +53 -0
- package/lib/point/shaders/simplePoint_vert.glsl +79 -0
- package/lib/point/shaders/text_frag.glsl +48 -0
- package/lib/point/shaders/text_vert.glsl +131 -0
- package/lib/point/shaders/tile/fill_tile_frag.glsl +76 -0
- package/lib/point/shaders/tile/fill_tile_vert.glsl +78 -0
- package/lib/point/shaders/tile/text_frag.glsl +33 -0
- package/lib/point/shaders/tile/text_map_frag.glsl +31 -0
- package/lib/point/shaders/tile/text_map_vert.glsl +38 -0
- package/lib/point/shaders/tile/text_vert.glsl +48 -0
- package/lib/point/shape/extrude.js +78 -0
- package/lib/polygon/index.js +147 -0
- package/lib/polygon/models/extrude.js +318 -0
- package/lib/polygon/models/fill.js +225 -0
- package/lib/polygon/models/index.js +50 -0
- package/lib/polygon/models/ocean.js +218 -0
- package/lib/polygon/models/tile.js +114 -0
- package/lib/polygon/models/water.js +195 -0
- package/lib/polygon/shaders/extrude/polygon_extrude_frag.glsl +44 -0
- package/lib/polygon/shaders/extrude/polygon_extrude_picklight_frag.glsl +44 -0
- package/lib/polygon/shaders/extrude/polygon_extrude_picklight_vert.glsl +85 -0
- package/lib/polygon/shaders/extrude/polygon_extrude_vert.glsl +90 -0
- package/lib/polygon/shaders/extrude/polygon_extrudetex_frag.glsl +48 -0
- package/lib/polygon/shaders/extrude/polygon_extrudetex_vert.glsl +93 -0
- package/lib/polygon/shaders/polygon_frag.glsl +12 -0
- package/lib/polygon/shaders/polygon_linear_frag.glsl +22 -0
- package/lib/polygon/shaders/polygon_linear_vert.glsl +74 -0
- package/lib/polygon/shaders/polygon_vert.glsl +66 -0
- package/lib/polygon/shaders/tile/polygon_tile_map_vert.glsl +16 -0
- package/lib/polygon/shaders/tile/polygon_tile_vert.glsl +42 -0
- package/lib/polygon/shaders/water/polygon_ocean_frag.glsl +247 -0
- package/lib/polygon/shaders/water/polygon_ocean_vert.glsl +21 -0
- package/lib/polygon/shaders/water/polygon_water_frag.glsl +71 -0
- package/lib/polygon/shaders/water/polygon_water_vert.glsl +26 -0
- package/lib/raster/buffers/triangulation.js +35 -0
- package/lib/raster/index.js +107 -0
- package/lib/raster/models/index.js +23 -0
- package/lib/raster/models/raster.js +258 -0
- package/lib/raster/models/rasterRgb.js +240 -0
- package/lib/raster/models/rasterTile.js +153 -0
- package/lib/raster/raster.js +178 -0
- package/lib/raster/shaders/raster_2d_frag.glsl +64 -0
- package/lib/raster/shaders/raster_2d_vert.glsl +17 -0
- package/lib/raster/shaders/raster_frag.glsl +9 -0
- package/lib/raster/shaders/raster_rgb_frag.glsl +12 -0
- package/lib/raster/shaders/raster_vert.glsl +44 -0
- package/lib/shader/minify_frag.glsl +7 -0
- package/lib/shader/minify_picking_frag.glsl +10 -0
- package/lib/tile/interaction/TilePickService.js +143 -0
- package/lib/tile/interaction/getFeatureData.js +1 -0
- package/lib/tile/interaction/getRasterData.js +83 -0
- package/lib/tile/interaction/utils.js +120 -0
- package/lib/tile/interface.js +5 -0
- package/lib/tile/manager/base.js +161 -0
- package/lib/tile/manager/layerManager.js +275 -0
- package/lib/tile/manager/mapLayerManager.js +134 -0
- package/lib/tile/models/tileModel.js +94 -0
- package/lib/tile/render/TileRenderService.js +78 -0
- package/lib/tile/style/TileStyleService.js +133 -0
- package/lib/tile/style/constants.js +26 -0
- package/lib/tile/style/utils.js +163 -0
- package/lib/tile/tileFactory/base.js +427 -0
- package/lib/tile/tileFactory/index.js +71 -0
- package/lib/tile/tileFactory/layers/rasterDataLayer.js +91 -0
- package/lib/tile/tileFactory/layers/tileTest.js +74 -0
- package/lib/tile/tileFactory/layers/vectorLayer.js +268 -0
- package/lib/tile/tileFactory/line.js +70 -0
- package/lib/tile/tileFactory/mask.js +71 -0
- package/lib/tile/tileFactory/point.js +71 -0
- package/lib/tile/tileFactory/polygon.js +70 -0
- package/lib/tile/tileFactory/raster.js +68 -0
- package/lib/tile/tileFactory/rasterData.js +93 -0
- package/lib/tile/tileFactory/test.js +106 -0
- package/lib/tile/tileLayer/MapTileLayer.js +63 -0
- package/lib/tile/tileLayer/TileLayer.js +215 -0
- package/lib/tile/tileLayer/base.js +225 -0
- package/lib/tile/utils.js +181 -0
- package/lib/utils/blend.js +65 -0
- package/lib/utils/collision-index.js +118 -0
- package/lib/utils/dataMappingStyle.js +151 -0
- package/lib/utils/extrude_polyline.js +656 -0
- package/lib/utils/grid-index.js +188 -0
- package/lib/utils/layerData.js +191 -0
- package/lib/utils/multiPassRender.js +60 -0
- package/lib/utils/polylineNormal.js +230 -0
- package/lib/utils/simpleLine.js +116 -0
- package/lib/utils/symbol-layout.js +308 -0
- package/lib/utils/updateShape.js +27 -0
- package/lib/wind/index.js +98 -0
- package/lib/wind/models/index.js +16 -0
- package/lib/wind/models/utils.js +253 -0
- package/lib/wind/models/wind.js +332 -0
- package/lib/wind/models/windRender.js +373 -0
- package/lib/wind/models/windShader.js +25 -0
- package/lib/wind/shaders/wind_frag.glsl +9 -0
- package/lib/wind/shaders/wind_vert.glsl +17 -0
- package/package.json +6 -6
|
@@ -0,0 +1,1439 @@
|
|
|
1
|
+
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
+
import _objectSpread from "@babel/runtime/helpers/objectSpread2";
|
|
4
|
+
import _initializerDefineProperty from "@babel/runtime/helpers/initializerDefineProperty";
|
|
5
|
+
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
6
|
+
import _createClass from "@babel/runtime/helpers/createClass";
|
|
7
|
+
import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
|
|
8
|
+
import _inherits from "@babel/runtime/helpers/inherits";
|
|
9
|
+
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
10
|
+
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
11
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
12
|
+
import _applyDecoratedDescriptor from "@babel/runtime/helpers/applyDecoratedDescriptor";
|
|
13
|
+
import _initializerWarningHelper from "@babel/runtime/helpers/initializerWarningHelper";
|
|
14
|
+
var _excluded = ["passes"],
|
|
15
|
+
_excluded2 = ["moduleName", "vertexShader", "fragmentShader", "triangulation", "segmentNumber", "workerEnabled", "workerOptions"];
|
|
16
|
+
|
|
17
|
+
var _dec, _class, _descriptor;
|
|
18
|
+
|
|
19
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
20
|
+
|
|
21
|
+
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
22
|
+
|
|
23
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
24
|
+
|
|
25
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
26
|
+
|
|
27
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
28
|
+
|
|
29
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
30
|
+
|
|
31
|
+
// @ts-ignore
|
|
32
|
+
import { SyncBailHook, SyncHook, SyncWaterfallHook } from '@antv/async-hook';
|
|
33
|
+
import { BlendType, lazyInject, TYPES } from '@antv/l7-core';
|
|
34
|
+
import Source from '@antv/l7-source';
|
|
35
|
+
import { encodePickingColor, WorkerSourceMap } from '@antv/l7-utils';
|
|
36
|
+
import { EventEmitter } from 'eventemitter3';
|
|
37
|
+
import { isFunction, isObject, isUndefined } from 'lodash';
|
|
38
|
+
import { BlendTypes } from "../utils/blend";
|
|
39
|
+
import { handleStyleDataMapping } from "../utils/dataMappingStyle";
|
|
40
|
+
import { calculateData } from "../utils/layerData";
|
|
41
|
+
import { createMultiPassRenderer, normalizePasses } from "../utils/multiPassRender";
|
|
42
|
+
import { updateShape } from "../utils/updateShape";
|
|
43
|
+
/**
|
|
44
|
+
* 分配 layer id
|
|
45
|
+
*/
|
|
46
|
+
|
|
47
|
+
var layerIdCounter = 0;
|
|
48
|
+
var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__PURE__*/function (_ref) {
|
|
49
|
+
_inherits(BaseLayer, _ref);
|
|
50
|
+
|
|
51
|
+
var _super = _createSuper(BaseLayer);
|
|
52
|
+
|
|
53
|
+
// 生命周期钩子
|
|
54
|
+
// 待渲染 model 列表
|
|
55
|
+
// 用于保存子图层对象
|
|
56
|
+
// Tip: 用于标识矢量图层
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* 待更新样式属性,在初始化阶段完成注册
|
|
60
|
+
*/
|
|
61
|
+
// Tip: layer 保底颜色
|
|
62
|
+
// private pickingPassRender: IPass<'pixelPicking'>;
|
|
63
|
+
function BaseLayer() {
|
|
64
|
+
var _this;
|
|
65
|
+
|
|
66
|
+
var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
67
|
+
|
|
68
|
+
_classCallCheck(this, BaseLayer);
|
|
69
|
+
|
|
70
|
+
_this = _super.call(this);
|
|
71
|
+
|
|
72
|
+
_defineProperty(_assertThisInitialized(_this), "id", "".concat(layerIdCounter++));
|
|
73
|
+
|
|
74
|
+
_defineProperty(_assertThisInitialized(_this), "name", "".concat(layerIdCounter));
|
|
75
|
+
|
|
76
|
+
_defineProperty(_assertThisInitialized(_this), "visible", true);
|
|
77
|
+
|
|
78
|
+
_defineProperty(_assertThisInitialized(_this), "zIndex", 0);
|
|
79
|
+
|
|
80
|
+
_defineProperty(_assertThisInitialized(_this), "inited", false);
|
|
81
|
+
|
|
82
|
+
_defineProperty(_assertThisInitialized(_this), "layerModelNeedUpdate", false);
|
|
83
|
+
|
|
84
|
+
_defineProperty(_assertThisInitialized(_this), "pickedFeatureID", null);
|
|
85
|
+
|
|
86
|
+
_defineProperty(_assertThisInitialized(_this), "selectedFeatureID", null);
|
|
87
|
+
|
|
88
|
+
_defineProperty(_assertThisInitialized(_this), "styleNeedUpdate", false);
|
|
89
|
+
|
|
90
|
+
_defineProperty(_assertThisInitialized(_this), "forceRender", false);
|
|
91
|
+
|
|
92
|
+
_defineProperty(_assertThisInitialized(_this), "clusterZoom", 0);
|
|
93
|
+
|
|
94
|
+
_defineProperty(_assertThisInitialized(_this), "defaultSourceConfig", {
|
|
95
|
+
data: [],
|
|
96
|
+
options: {
|
|
97
|
+
parser: {
|
|
98
|
+
type: 'json'
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
_defineProperty(_assertThisInitialized(_this), "dataState", {
|
|
104
|
+
dataSourceNeedUpdate: false,
|
|
105
|
+
dataMappingNeedUpdate: false,
|
|
106
|
+
filterNeedUpdate: false,
|
|
107
|
+
featureScaleNeedUpdate: false,
|
|
108
|
+
StyleAttrNeedUpdate: false
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
_defineProperty(_assertThisInitialized(_this), "hooks", {
|
|
112
|
+
init: new SyncBailHook(),
|
|
113
|
+
afterInit: new SyncBailHook(),
|
|
114
|
+
beforeRender: new SyncBailHook(),
|
|
115
|
+
beforeRenderData: new SyncWaterfallHook(),
|
|
116
|
+
afterRender: new SyncHook(),
|
|
117
|
+
beforePickingEncode: new SyncHook(),
|
|
118
|
+
afterPickingEncode: new SyncHook(),
|
|
119
|
+
beforeHighlight: new SyncHook(['pickedColor']),
|
|
120
|
+
afterHighlight: new SyncHook(),
|
|
121
|
+
beforeSelect: new SyncHook(['pickedColor']),
|
|
122
|
+
afterSelect: new SyncHook(),
|
|
123
|
+
beforeDestroy: new SyncHook(),
|
|
124
|
+
afterDestroy: new SyncHook()
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
_defineProperty(_assertThisInitialized(_this), "models", []);
|
|
128
|
+
|
|
129
|
+
_defineProperty(_assertThisInitialized(_this), "modelLoaded", false);
|
|
130
|
+
|
|
131
|
+
_defineProperty(_assertThisInitialized(_this), "layerChildren", []);
|
|
132
|
+
|
|
133
|
+
_defineProperty(_assertThisInitialized(_this), "masks", []);
|
|
134
|
+
|
|
135
|
+
_defineProperty(_assertThisInitialized(_this), "isVector", false);
|
|
136
|
+
|
|
137
|
+
_initializerDefineProperty(_assertThisInitialized(_this), "configService", _descriptor, _assertThisInitialized(_this));
|
|
138
|
+
|
|
139
|
+
_defineProperty(_assertThisInitialized(_this), "animateOptions", {
|
|
140
|
+
enable: false
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
_defineProperty(_assertThisInitialized(_this), "currentPickId", null);
|
|
144
|
+
|
|
145
|
+
_defineProperty(_assertThisInitialized(_this), "pendingStyleAttributes", []);
|
|
146
|
+
|
|
147
|
+
_defineProperty(_assertThisInitialized(_this), "scaleOptions", {});
|
|
148
|
+
|
|
149
|
+
_defineProperty(_assertThisInitialized(_this), "animateStatus", false);
|
|
150
|
+
|
|
151
|
+
_defineProperty(_assertThisInitialized(_this), "bottomColor", 'rgba(0, 0, 0, 0)');
|
|
152
|
+
|
|
153
|
+
_defineProperty(_assertThisInitialized(_this), "isDestroyed", false);
|
|
154
|
+
|
|
155
|
+
_defineProperty(_assertThisInitialized(_this), "encodeDataLength", 0);
|
|
156
|
+
|
|
157
|
+
_defineProperty(_assertThisInitialized(_this), "sourceEvent", function () {
|
|
158
|
+
_this.dataState.dataSourceNeedUpdate = true;
|
|
159
|
+
|
|
160
|
+
var layerConfig = _this.getLayerConfig();
|
|
161
|
+
|
|
162
|
+
if (layerConfig && layerConfig.autoFit) {
|
|
163
|
+
_this.fitBounds(layerConfig.fitBoundsOptions);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
_this.reRender();
|
|
167
|
+
});
|
|
168
|
+
|
|
169
|
+
_this.name = config.name || _this.id;
|
|
170
|
+
_this.zIndex = config.zIndex || 0;
|
|
171
|
+
_this.rawConfig = config;
|
|
172
|
+
return _this;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
_createClass(BaseLayer, [{
|
|
176
|
+
key: "addMaskLayer",
|
|
177
|
+
value: function addMaskLayer(maskLayer) {
|
|
178
|
+
this.masks.push(maskLayer);
|
|
179
|
+
}
|
|
180
|
+
}, {
|
|
181
|
+
key: "removeMaskLayer",
|
|
182
|
+
value: function removeMaskLayer(maskLayer) {
|
|
183
|
+
var layerIndex = this.masks.indexOf(maskLayer);
|
|
184
|
+
|
|
185
|
+
if (layerIndex > -1) {
|
|
186
|
+
this.masks.splice(layerIndex, 1);
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
maskLayer.destroy();
|
|
190
|
+
}
|
|
191
|
+
}, {
|
|
192
|
+
key: "getAttribute",
|
|
193
|
+
value: function getAttribute(name) {
|
|
194
|
+
return this.styleAttributeService.getLayerStyleAttribute(name);
|
|
195
|
+
}
|
|
196
|
+
}, {
|
|
197
|
+
key: "getLayerConfig",
|
|
198
|
+
value: function getLayerConfig() {
|
|
199
|
+
return this.configService.getLayerConfig(this.id);
|
|
200
|
+
}
|
|
201
|
+
}, {
|
|
202
|
+
key: "updateLayerConfig",
|
|
203
|
+
value: function updateLayerConfig(configToUpdate) {
|
|
204
|
+
var _this2 = this;
|
|
205
|
+
|
|
206
|
+
// 同步 rawConfig
|
|
207
|
+
Object.keys(configToUpdate).map(function (key) {
|
|
208
|
+
if (key in _this2.rawConfig) {
|
|
209
|
+
// @ts-ignore
|
|
210
|
+
_this2.rawConfig[key] = configToUpdate[key];
|
|
211
|
+
}
|
|
212
|
+
});
|
|
213
|
+
|
|
214
|
+
if (!this.inited) {
|
|
215
|
+
this.needUpdateConfig = _objectSpread(_objectSpread({}, this.needUpdateConfig), configToUpdate);
|
|
216
|
+
} else {
|
|
217
|
+
var sceneId = this.container.get(TYPES.SceneID); // @ts-ignore
|
|
218
|
+
|
|
219
|
+
handleStyleDataMapping(configToUpdate, this); // 处理 style 中进行数据映射的属性字段
|
|
220
|
+
|
|
221
|
+
this.configService.setLayerConfig(sceneId, this.id, _objectSpread(_objectSpread(_objectSpread({}, this.configService.getLayerConfig(this.id)), this.needUpdateConfig), configToUpdate));
|
|
222
|
+
this.needUpdateConfig = {};
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
/**
|
|
226
|
+
* 注入图层容器,父容器为场景容器
|
|
227
|
+
* RootContainer 1
|
|
228
|
+
* -> SceneContainer 1.*
|
|
229
|
+
* -> LayerContainer 1.*
|
|
230
|
+
*/
|
|
231
|
+
|
|
232
|
+
}, {
|
|
233
|
+
key: "setContainer",
|
|
234
|
+
value: function setContainer(container, sceneContainer) {
|
|
235
|
+
this.container = container;
|
|
236
|
+
this.sceneContainer = sceneContainer;
|
|
237
|
+
}
|
|
238
|
+
}, {
|
|
239
|
+
key: "getContainer",
|
|
240
|
+
value: function getContainer() {
|
|
241
|
+
return this.container;
|
|
242
|
+
}
|
|
243
|
+
}, {
|
|
244
|
+
key: "setBottomColor",
|
|
245
|
+
value: function setBottomColor(color) {
|
|
246
|
+
this.bottomColor = color;
|
|
247
|
+
}
|
|
248
|
+
}, {
|
|
249
|
+
key: "getBottomColor",
|
|
250
|
+
value: function getBottomColor() {
|
|
251
|
+
return this.bottomColor;
|
|
252
|
+
}
|
|
253
|
+
}, {
|
|
254
|
+
key: "addPlugin",
|
|
255
|
+
value: function addPlugin(plugin) {
|
|
256
|
+
this.plugins.push(plugin);
|
|
257
|
+
return this;
|
|
258
|
+
}
|
|
259
|
+
}, {
|
|
260
|
+
key: "init",
|
|
261
|
+
value: function init() {
|
|
262
|
+
var _this3 = this;
|
|
263
|
+
|
|
264
|
+
// 设置配置项
|
|
265
|
+
var sceneId = this.container.get(TYPES.SceneID); // 初始化图层配置项
|
|
266
|
+
// const { enableMultiPassRenderer = false } = this.rawConfig;
|
|
267
|
+
// this.configService.setLayerConfig(sceneId, this.id, {
|
|
268
|
+
// enableMultiPassRenderer,
|
|
269
|
+
// });
|
|
270
|
+
|
|
271
|
+
this.configService.setLayerConfig(sceneId, this.id, this.rawConfig);
|
|
272
|
+
this.layerType = this.rawConfig.layerType; // 全局容器服务
|
|
273
|
+
// 场景容器服务
|
|
274
|
+
|
|
275
|
+
this.iconService = this.container.get(TYPES.IIconService);
|
|
276
|
+
this.fontService = this.container.get(TYPES.IFontService);
|
|
277
|
+
this.rendererService = this.container.get(TYPES.IRendererService);
|
|
278
|
+
this.layerService = this.container.get(TYPES.ILayerService);
|
|
279
|
+
this.interactionService = this.container.get(TYPES.IInteractionService);
|
|
280
|
+
this.pickingService = this.container.get(TYPES.IPickingService);
|
|
281
|
+
this.mapService = this.container.get(TYPES.IMapService);
|
|
282
|
+
|
|
283
|
+
var _this$getLayerConfig = this.getLayerConfig(),
|
|
284
|
+
enableMultiPassRenderer = _this$getLayerConfig.enableMultiPassRenderer,
|
|
285
|
+
passes = _this$getLayerConfig.passes;
|
|
286
|
+
|
|
287
|
+
if (enableMultiPassRenderer && passes !== null && passes !== void 0 && passes.length && passes.length > 0) {
|
|
288
|
+
// Tip: 兼容 multiPassRender 在 amap1 时存在的图层不同步问题 zoom
|
|
289
|
+
this.mapService.on('mapAfterFrameChange', function () {
|
|
290
|
+
_this3.renderLayers();
|
|
291
|
+
});
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
this.cameraService = this.container.get(TYPES.ICameraService);
|
|
295
|
+
this.coordinateService = this.container.get(TYPES.ICoordinateSystemService);
|
|
296
|
+
this.shaderModuleService = this.container.get(TYPES.IShaderModuleService);
|
|
297
|
+
this.postProcessingPassFactory = this.container.get(TYPES.IFactoryPostProcessingPass);
|
|
298
|
+
this.normalPassFactory = this.container.get(TYPES.IFactoryNormalPass); // 图层容器服务
|
|
299
|
+
|
|
300
|
+
this.styleAttributeService = this.container.get(TYPES.IStyleAttributeService);
|
|
301
|
+
this.multiPassRenderer = this.container.get(TYPES.IMultiPassRenderer);
|
|
302
|
+
this.multiPassRenderer.setLayer(this); // 完成样式服务注册完成前添加的属性
|
|
303
|
+
|
|
304
|
+
this.pendingStyleAttributes.forEach(function (_ref2) {
|
|
305
|
+
var attributeName = _ref2.attributeName,
|
|
306
|
+
attributeField = _ref2.attributeField,
|
|
307
|
+
attributeValues = _ref2.attributeValues,
|
|
308
|
+
updateOptions = _ref2.updateOptions;
|
|
309
|
+
|
|
310
|
+
_this3.styleAttributeService.updateStyleAttribute(attributeName, {
|
|
311
|
+
// @ts-ignore
|
|
312
|
+
scale: _objectSpread({
|
|
313
|
+
field: attributeField
|
|
314
|
+
}, _this3.splitValuesAndCallbackInAttribute( // @ts-ignore
|
|
315
|
+
attributeValues, // @ts-ignore
|
|
316
|
+
_this3.getLayerConfig()[attributeName]))
|
|
317
|
+
}, // @ts-ignore
|
|
318
|
+
updateOptions);
|
|
319
|
+
});
|
|
320
|
+
this.pendingStyleAttributes = []; // 获取插件集
|
|
321
|
+
|
|
322
|
+
this.plugins = this.container.getAll(TYPES.ILayerPlugin); // 完成插件注册,传入场景和图层容器内的服务
|
|
323
|
+
|
|
324
|
+
var _iterator = _createForOfIteratorHelper(this.plugins),
|
|
325
|
+
_step;
|
|
326
|
+
|
|
327
|
+
try {
|
|
328
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
329
|
+
var plugin = _step.value;
|
|
330
|
+
plugin.apply(this, {
|
|
331
|
+
rendererService: this.rendererService,
|
|
332
|
+
mapService: this.mapService,
|
|
333
|
+
styleAttributeService: this.styleAttributeService,
|
|
334
|
+
normalPassFactory: this.normalPassFactory,
|
|
335
|
+
postProcessingPassFactory: this.postProcessingPassFactory
|
|
336
|
+
});
|
|
337
|
+
} // 触发 init 生命周期插件
|
|
338
|
+
|
|
339
|
+
} catch (err) {
|
|
340
|
+
_iterator.e(err);
|
|
341
|
+
} finally {
|
|
342
|
+
_iterator.f();
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
this.hooks.init.call(); // this.pickingPassRender = this.normalPassFactory('pixelPicking');
|
|
346
|
+
// this.pickingPassRender.init(this);
|
|
347
|
+
|
|
348
|
+
this.hooks.afterInit.call(); // 触发初始化完成事件;
|
|
349
|
+
|
|
350
|
+
this.emit('inited', {
|
|
351
|
+
target: this,
|
|
352
|
+
type: 'inited'
|
|
353
|
+
});
|
|
354
|
+
this.emit('add', {
|
|
355
|
+
target: this,
|
|
356
|
+
type: 'add'
|
|
357
|
+
});
|
|
358
|
+
return this;
|
|
359
|
+
}
|
|
360
|
+
}, {
|
|
361
|
+
key: "updateModelData",
|
|
362
|
+
value: function updateModelData(data) {
|
|
363
|
+
if (data.attributes && data.elements) {
|
|
364
|
+
this.models.map(function (m) {
|
|
365
|
+
m.updateAttributesAndElements(data.attributes, data.elements);
|
|
366
|
+
});
|
|
367
|
+
} else {
|
|
368
|
+
console.warn('data error');
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
}, {
|
|
372
|
+
key: "createModelData",
|
|
373
|
+
value: function createModelData(data, option) {
|
|
374
|
+
var _this$layerModel;
|
|
375
|
+
|
|
376
|
+
if ((_this$layerModel = this.layerModel) !== null && _this$layerModel !== void 0 && _this$layerModel.createModelData) {
|
|
377
|
+
// 在某些特殊图层中单独构建 attribute & elements
|
|
378
|
+
return this.layerModel.createModelData(option);
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
var calEncodeData = this.calculateEncodeData(data, option);
|
|
382
|
+
var triangulation = this.triangulation;
|
|
383
|
+
|
|
384
|
+
if (calEncodeData && triangulation) {
|
|
385
|
+
return this.styleAttributeService.createAttributesAndIndices(calEncodeData, triangulation);
|
|
386
|
+
} else {
|
|
387
|
+
return {
|
|
388
|
+
attributes: undefined,
|
|
389
|
+
elements: undefined
|
|
390
|
+
};
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
}, {
|
|
394
|
+
key: "calculateEncodeData",
|
|
395
|
+
value: function calculateEncodeData(data, option) {
|
|
396
|
+
if (this.inited) {
|
|
397
|
+
return calculateData(this, this.fontService, this.mapService, this.styleAttributeService, data, option);
|
|
398
|
+
} else {
|
|
399
|
+
console.warn('layer not inited!');
|
|
400
|
+
return null;
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
/**
|
|
404
|
+
* Model初始化前需要更新Model样式
|
|
405
|
+
*/
|
|
406
|
+
|
|
407
|
+
}, {
|
|
408
|
+
key: "prepareBuildModel",
|
|
409
|
+
value: function prepareBuildModel() {
|
|
410
|
+
this.inited = true;
|
|
411
|
+
this.updateLayerConfig(_objectSpread(_objectSpread({}, this.getDefaultConfig()), this.rawConfig)); // 启动动画
|
|
412
|
+
|
|
413
|
+
var _this$getLayerConfig2 = this.getLayerConfig(),
|
|
414
|
+
animateOption = _this$getLayerConfig2.animateOption;
|
|
415
|
+
|
|
416
|
+
if (animateOption !== null && animateOption !== void 0 && animateOption.enable) {
|
|
417
|
+
this.layerService.startAnimate();
|
|
418
|
+
this.animateStatus = true;
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
}, {
|
|
422
|
+
key: "color",
|
|
423
|
+
value: function color(field, values, updateOptions) {
|
|
424
|
+
this.updateStyleAttribute('color', field, values, updateOptions);
|
|
425
|
+
return this;
|
|
426
|
+
} // 为对应的图层传入纹理的编号名称(point/image 在 shape 方法中传入纹理名称的方法并不通用)
|
|
427
|
+
|
|
428
|
+
}, {
|
|
429
|
+
key: "texture",
|
|
430
|
+
value: function texture(field, values, updateOptions) {
|
|
431
|
+
this.updateStyleAttribute('texture', field, values, updateOptions);
|
|
432
|
+
return this;
|
|
433
|
+
}
|
|
434
|
+
}, {
|
|
435
|
+
key: "rotate",
|
|
436
|
+
value: function rotate(field, values, updateOptions) {
|
|
437
|
+
this.updateStyleAttribute('rotate', field, values, updateOptions);
|
|
438
|
+
return this;
|
|
439
|
+
}
|
|
440
|
+
}, {
|
|
441
|
+
key: "size",
|
|
442
|
+
value: function size(field, values, updateOptions) {
|
|
443
|
+
this.updateStyleAttribute('size', field, values, updateOptions);
|
|
444
|
+
return this;
|
|
445
|
+
} // 对mapping后的数据过滤,scale保持不变
|
|
446
|
+
|
|
447
|
+
}, {
|
|
448
|
+
key: "filter",
|
|
449
|
+
value: function filter(field, values, updateOptions) {
|
|
450
|
+
this.updateStyleAttribute('filter', field, values, updateOptions);
|
|
451
|
+
return this;
|
|
452
|
+
}
|
|
453
|
+
}, {
|
|
454
|
+
key: "shape",
|
|
455
|
+
value: function shape(field, values, updateOptions) {
|
|
456
|
+
var _this$styleAttributeS, _this$styleAttributeS2, _this$styleAttributeS3;
|
|
457
|
+
|
|
458
|
+
var lastShape = (_this$styleAttributeS = this.styleAttributeService) === null || _this$styleAttributeS === void 0 ? void 0 : (_this$styleAttributeS2 = _this$styleAttributeS.getLayerStyleAttribute('shape')) === null || _this$styleAttributeS2 === void 0 ? void 0 : (_this$styleAttributeS3 = _this$styleAttributeS2.scale) === null || _this$styleAttributeS3 === void 0 ? void 0 : _this$styleAttributeS3.field;
|
|
459
|
+
var currentShape = field;
|
|
460
|
+
this.shapeOption = {
|
|
461
|
+
field: field,
|
|
462
|
+
values: values
|
|
463
|
+
};
|
|
464
|
+
this.updateStyleAttribute('shape', field, values, updateOptions); // Tip: 根据 shape 判断是否需要更新 model
|
|
465
|
+
|
|
466
|
+
if (!this.tileLayer) {
|
|
467
|
+
updateShape(this, lastShape, currentShape);
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
return this;
|
|
471
|
+
}
|
|
472
|
+
}, {
|
|
473
|
+
key: "label",
|
|
474
|
+
value: function label(field, values, updateOptions) {
|
|
475
|
+
this.pendingStyleAttributes.push({
|
|
476
|
+
attributeName: 'label',
|
|
477
|
+
attributeField: field,
|
|
478
|
+
attributeValues: values,
|
|
479
|
+
updateOptions: updateOptions
|
|
480
|
+
});
|
|
481
|
+
return this;
|
|
482
|
+
}
|
|
483
|
+
}, {
|
|
484
|
+
key: "animate",
|
|
485
|
+
value: function animate(options) {
|
|
486
|
+
var rawAnimate = {};
|
|
487
|
+
|
|
488
|
+
if (isObject(options)) {
|
|
489
|
+
rawAnimate.enable = true;
|
|
490
|
+
rawAnimate = _objectSpread(_objectSpread({}, rawAnimate), options);
|
|
491
|
+
} else {
|
|
492
|
+
rawAnimate.enable = options;
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
this.updateLayerConfig({
|
|
496
|
+
animateOption: rawAnimate
|
|
497
|
+
});
|
|
498
|
+
return this;
|
|
499
|
+
}
|
|
500
|
+
}, {
|
|
501
|
+
key: "source",
|
|
502
|
+
value: function source(data, options) {
|
|
503
|
+
if ((data === null || data === void 0 ? void 0 : data.type) === 'source') {
|
|
504
|
+
// 判断是否为source
|
|
505
|
+
this.setSource(data);
|
|
506
|
+
return this;
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
this.sourceOption = {
|
|
510
|
+
data: data,
|
|
511
|
+
options: options
|
|
512
|
+
};
|
|
513
|
+
this.clusterZoom = 0;
|
|
514
|
+
return this;
|
|
515
|
+
}
|
|
516
|
+
}, {
|
|
517
|
+
key: "setData",
|
|
518
|
+
value: function setData(data, options) {
|
|
519
|
+
var _this4 = this;
|
|
520
|
+
|
|
521
|
+
if (this.inited) {
|
|
522
|
+
this.layerSource.setData(data, options);
|
|
523
|
+
} else {
|
|
524
|
+
this.on('inited', function () {
|
|
525
|
+
var currentSource = _this4.getSource();
|
|
526
|
+
|
|
527
|
+
if (!currentSource) {
|
|
528
|
+
// 执行 setData 的时候 source 还不存在(还未执行 addLayer)
|
|
529
|
+
_this4.source(new Source(data, options));
|
|
530
|
+
|
|
531
|
+
_this4.sourceEvent();
|
|
532
|
+
} else {
|
|
533
|
+
_this4.layerSource.setData(data, options);
|
|
534
|
+
} // this.layerSource.setData(data, options);
|
|
535
|
+
|
|
536
|
+
});
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
return this;
|
|
540
|
+
}
|
|
541
|
+
}, {
|
|
542
|
+
key: "style",
|
|
543
|
+
value: function style(options) {
|
|
544
|
+
var _this5 = this;
|
|
545
|
+
|
|
546
|
+
var lastConfig = this.getLayerConfig();
|
|
547
|
+
|
|
548
|
+
var passes = options.passes,
|
|
549
|
+
rest = _objectWithoutProperties(options, _excluded); // passes 特殊处理
|
|
550
|
+
|
|
551
|
+
|
|
552
|
+
if (passes) {
|
|
553
|
+
normalizePasses(passes).forEach(function (pass) {
|
|
554
|
+
var postProcessingPass = _this5.multiPassRenderer.getPostProcessor().getPostProcessingPassByName(pass[0]);
|
|
555
|
+
|
|
556
|
+
if (postProcessingPass) {
|
|
557
|
+
postProcessingPass.updateOptions(pass[1]);
|
|
558
|
+
}
|
|
559
|
+
});
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
this.rawConfig = _objectSpread(_objectSpread({}, this.rawConfig), rest);
|
|
563
|
+
|
|
564
|
+
if (this.container) {
|
|
565
|
+
this.updateLayerConfig(this.rawConfig);
|
|
566
|
+
this.styleNeedUpdate = true;
|
|
567
|
+
} // @ts-ignore
|
|
568
|
+
|
|
569
|
+
|
|
570
|
+
if (lastConfig && lastConfig.mask === true && options.mask === false) {
|
|
571
|
+
this.clearModels();
|
|
572
|
+
this.layerModel.buildModels(function (models) {
|
|
573
|
+
_this5.models = models;
|
|
574
|
+
});
|
|
575
|
+
}
|
|
576
|
+
|
|
577
|
+
return this;
|
|
578
|
+
}
|
|
579
|
+
}, {
|
|
580
|
+
key: "scale",
|
|
581
|
+
value: function scale(field, cfg) {
|
|
582
|
+
if (isObject(field)) {
|
|
583
|
+
this.scaleOptions = _objectSpread(_objectSpread({}, this.scaleOptions), field);
|
|
584
|
+
} else {
|
|
585
|
+
this.scaleOptions[field] = cfg;
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
return this;
|
|
589
|
+
}
|
|
590
|
+
/**
|
|
591
|
+
* 渲染所有的图层
|
|
592
|
+
*/
|
|
593
|
+
|
|
594
|
+
}, {
|
|
595
|
+
key: "renderLayers",
|
|
596
|
+
value: function renderLayers() {
|
|
597
|
+
this.rendering = true;
|
|
598
|
+
this.layerService.renderLayers();
|
|
599
|
+
this.rendering = false;
|
|
600
|
+
}
|
|
601
|
+
}, {
|
|
602
|
+
key: "render",
|
|
603
|
+
value: function render() {
|
|
604
|
+
if (this.tileLayer) {
|
|
605
|
+
// 瓦片图层执行单独的 render 渲染队列
|
|
606
|
+
this.tileLayer.render();
|
|
607
|
+
return this;
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
if (this.encodeDataLength <= 0 && !this.forceRender) return this; // Tip: this.getEncodedData().length !== 0 这个判断是为了解决在 2.5.x 引入数据纹理后产生的 空数据渲染导致 texture 超出上限问题
|
|
611
|
+
|
|
612
|
+
this.renderModels();
|
|
613
|
+
return this;
|
|
614
|
+
}
|
|
615
|
+
/**
|
|
616
|
+
* renderMultiPass 专门用于渲染支持 multipass 的 layer
|
|
617
|
+
*/
|
|
618
|
+
|
|
619
|
+
}, {
|
|
620
|
+
key: "renderMultiPass",
|
|
621
|
+
value: function () {
|
|
622
|
+
var _renderMultiPass = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
623
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
624
|
+
while (1) {
|
|
625
|
+
switch (_context.prev = _context.next) {
|
|
626
|
+
case 0:
|
|
627
|
+
if (!(this.encodeDataLength <= 0 && !this.forceRender)) {
|
|
628
|
+
_context.next = 2;
|
|
629
|
+
break;
|
|
630
|
+
}
|
|
631
|
+
|
|
632
|
+
return _context.abrupt("return");
|
|
633
|
+
|
|
634
|
+
case 2:
|
|
635
|
+
if (!(this.multiPassRenderer && this.multiPassRenderer.getRenderFlag())) {
|
|
636
|
+
_context.next = 7;
|
|
637
|
+
break;
|
|
638
|
+
}
|
|
639
|
+
|
|
640
|
+
_context.next = 5;
|
|
641
|
+
return this.multiPassRenderer.render();
|
|
642
|
+
|
|
643
|
+
case 5:
|
|
644
|
+
_context.next = 8;
|
|
645
|
+
break;
|
|
646
|
+
|
|
647
|
+
case 7:
|
|
648
|
+
if (this.multiPassRenderer) {
|
|
649
|
+
// renderPass 触发的渲染
|
|
650
|
+
this.renderModels();
|
|
651
|
+
} else {
|
|
652
|
+
this.renderModels();
|
|
653
|
+
}
|
|
654
|
+
|
|
655
|
+
case 8:
|
|
656
|
+
case "end":
|
|
657
|
+
return _context.stop();
|
|
658
|
+
}
|
|
659
|
+
}
|
|
660
|
+
}, _callee, this);
|
|
661
|
+
}));
|
|
662
|
+
|
|
663
|
+
function renderMultiPass() {
|
|
664
|
+
return _renderMultiPass.apply(this, arguments);
|
|
665
|
+
}
|
|
666
|
+
|
|
667
|
+
return renderMultiPass;
|
|
668
|
+
}()
|
|
669
|
+
}, {
|
|
670
|
+
key: "active",
|
|
671
|
+
value: function active(options) {
|
|
672
|
+
var activeOption = {};
|
|
673
|
+
activeOption.enableHighlight = isObject(options) ? true : options;
|
|
674
|
+
|
|
675
|
+
if (isObject(options)) {
|
|
676
|
+
activeOption.enableHighlight = true;
|
|
677
|
+
|
|
678
|
+
if (options.color) {
|
|
679
|
+
activeOption.highlightColor = options.color;
|
|
680
|
+
}
|
|
681
|
+
|
|
682
|
+
if (options.mix) {
|
|
683
|
+
activeOption.activeMix = options.mix;
|
|
684
|
+
}
|
|
685
|
+
} else {
|
|
686
|
+
activeOption.enableHighlight = !!options;
|
|
687
|
+
}
|
|
688
|
+
|
|
689
|
+
this.updateLayerConfig(activeOption);
|
|
690
|
+
return this;
|
|
691
|
+
}
|
|
692
|
+
}, {
|
|
693
|
+
key: "setActive",
|
|
694
|
+
value: function setActive(id, options) {
|
|
695
|
+
var _this6 = this;
|
|
696
|
+
|
|
697
|
+
if (isObject(id)) {
|
|
698
|
+
var _id$x = id.x,
|
|
699
|
+
x = _id$x === void 0 ? 0 : _id$x,
|
|
700
|
+
_id$y = id.y,
|
|
701
|
+
y = _id$y === void 0 ? 0 : _id$y;
|
|
702
|
+
this.updateLayerConfig({
|
|
703
|
+
highlightColor: isObject(options) ? options.color : this.getLayerConfig().highlightColor,
|
|
704
|
+
activeMix: isObject(options) ? options.mix : this.getLayerConfig().activeMix
|
|
705
|
+
});
|
|
706
|
+
this.pick({
|
|
707
|
+
x: x,
|
|
708
|
+
y: y
|
|
709
|
+
});
|
|
710
|
+
} else {
|
|
711
|
+
this.updateLayerConfig({
|
|
712
|
+
pickedFeatureID: id,
|
|
713
|
+
highlightColor: isObject(options) ? options.color : this.getLayerConfig().highlightColor,
|
|
714
|
+
activeMix: isObject(options) ? options.mix : this.getLayerConfig().activeMix
|
|
715
|
+
});
|
|
716
|
+
this.hooks.beforeSelect.call(encodePickingColor(id)) // @ts-ignore
|
|
717
|
+
.then(function () {
|
|
718
|
+
setTimeout(function () {
|
|
719
|
+
_this6.reRender();
|
|
720
|
+
}, 1);
|
|
721
|
+
});
|
|
722
|
+
}
|
|
723
|
+
}
|
|
724
|
+
}, {
|
|
725
|
+
key: "select",
|
|
726
|
+
value: function select(option) {
|
|
727
|
+
var activeOption = {};
|
|
728
|
+
activeOption.enableSelect = isObject(option) ? true : option;
|
|
729
|
+
|
|
730
|
+
if (isObject(option)) {
|
|
731
|
+
activeOption.enableSelect = true;
|
|
732
|
+
|
|
733
|
+
if (option.color) {
|
|
734
|
+
activeOption.selectColor = option.color;
|
|
735
|
+
}
|
|
736
|
+
|
|
737
|
+
if (option.mix) {
|
|
738
|
+
activeOption.selectMix = option.mix;
|
|
739
|
+
}
|
|
740
|
+
} else {
|
|
741
|
+
activeOption.enableSelect = !!option;
|
|
742
|
+
}
|
|
743
|
+
|
|
744
|
+
this.updateLayerConfig(activeOption);
|
|
745
|
+
return this;
|
|
746
|
+
}
|
|
747
|
+
}, {
|
|
748
|
+
key: "setSelect",
|
|
749
|
+
value: function setSelect(id, options) {
|
|
750
|
+
var _this7 = this;
|
|
751
|
+
|
|
752
|
+
if (isObject(id)) {
|
|
753
|
+
var _id$x2 = id.x,
|
|
754
|
+
x = _id$x2 === void 0 ? 0 : _id$x2,
|
|
755
|
+
_id$y2 = id.y,
|
|
756
|
+
y = _id$y2 === void 0 ? 0 : _id$y2;
|
|
757
|
+
this.updateLayerConfig({
|
|
758
|
+
selectColor: isObject(options) ? options.color : this.getLayerConfig().selectColor,
|
|
759
|
+
selectMix: isObject(options) ? options.mix : this.getLayerConfig().selectMix
|
|
760
|
+
});
|
|
761
|
+
this.pick({
|
|
762
|
+
x: x,
|
|
763
|
+
y: y
|
|
764
|
+
});
|
|
765
|
+
} else {
|
|
766
|
+
this.updateLayerConfig({
|
|
767
|
+
pickedFeatureID: id,
|
|
768
|
+
selectColor: isObject(options) ? options.color : this.getLayerConfig().selectColor,
|
|
769
|
+
selectMix: isObject(options) ? options.mix : this.getLayerConfig().selectMix
|
|
770
|
+
});
|
|
771
|
+
this.hooks.beforeSelect.call(encodePickingColor(id)) // @ts-ignore
|
|
772
|
+
.then(function () {
|
|
773
|
+
setTimeout(function () {
|
|
774
|
+
_this7.reRender();
|
|
775
|
+
}, 1);
|
|
776
|
+
});
|
|
777
|
+
}
|
|
778
|
+
}
|
|
779
|
+
}, {
|
|
780
|
+
key: "setBlend",
|
|
781
|
+
value: function setBlend(type) {
|
|
782
|
+
this.updateLayerConfig({
|
|
783
|
+
blend: type
|
|
784
|
+
});
|
|
785
|
+
this.layerModelNeedUpdate = true;
|
|
786
|
+
this.reRender();
|
|
787
|
+
return this;
|
|
788
|
+
}
|
|
789
|
+
}, {
|
|
790
|
+
key: "show",
|
|
791
|
+
value: function show() {
|
|
792
|
+
this.updateLayerConfig({
|
|
793
|
+
visible: true
|
|
794
|
+
});
|
|
795
|
+
this.reRender();
|
|
796
|
+
this.emit('show');
|
|
797
|
+
return this;
|
|
798
|
+
}
|
|
799
|
+
}, {
|
|
800
|
+
key: "hide",
|
|
801
|
+
value: function hide() {
|
|
802
|
+
this.updateLayerConfig({
|
|
803
|
+
visible: false
|
|
804
|
+
});
|
|
805
|
+
this.reRender();
|
|
806
|
+
this.emit('hide');
|
|
807
|
+
return this;
|
|
808
|
+
}
|
|
809
|
+
}, {
|
|
810
|
+
key: "setIndex",
|
|
811
|
+
value: function setIndex(index) {
|
|
812
|
+
this.zIndex = index;
|
|
813
|
+
this.layerService.updateLayerRenderList();
|
|
814
|
+
this.layerService.renderLayers();
|
|
815
|
+
return this;
|
|
816
|
+
}
|
|
817
|
+
}, {
|
|
818
|
+
key: "setCurrentPickId",
|
|
819
|
+
value: function setCurrentPickId(id) {
|
|
820
|
+
this.currentPickId = id;
|
|
821
|
+
}
|
|
822
|
+
}, {
|
|
823
|
+
key: "getCurrentPickId",
|
|
824
|
+
value: function getCurrentPickId() {
|
|
825
|
+
return this.currentPickId;
|
|
826
|
+
}
|
|
827
|
+
}, {
|
|
828
|
+
key: "setCurrentSelectedId",
|
|
829
|
+
value: function setCurrentSelectedId(id) {
|
|
830
|
+
this.selectedFeatureID = id;
|
|
831
|
+
}
|
|
832
|
+
}, {
|
|
833
|
+
key: "getCurrentSelectedId",
|
|
834
|
+
value: function getCurrentSelectedId() {
|
|
835
|
+
return this.selectedFeatureID;
|
|
836
|
+
}
|
|
837
|
+
}, {
|
|
838
|
+
key: "isVisible",
|
|
839
|
+
value: function isVisible() {
|
|
840
|
+
var zoom = this.mapService.getZoom();
|
|
841
|
+
|
|
842
|
+
var _this$getLayerConfig3 = this.getLayerConfig(),
|
|
843
|
+
visible = _this$getLayerConfig3.visible,
|
|
844
|
+
_this$getLayerConfig4 = _this$getLayerConfig3.minZoom,
|
|
845
|
+
minZoom = _this$getLayerConfig4 === void 0 ? -Infinity : _this$getLayerConfig4,
|
|
846
|
+
_this$getLayerConfig5 = _this$getLayerConfig3.maxZoom,
|
|
847
|
+
maxZoom = _this$getLayerConfig5 === void 0 ? Infinity : _this$getLayerConfig5;
|
|
848
|
+
|
|
849
|
+
return !!visible && zoom >= minZoom && zoom <= maxZoom;
|
|
850
|
+
}
|
|
851
|
+
}, {
|
|
852
|
+
key: "setMultiPass",
|
|
853
|
+
value: function setMultiPass(enableMultiPass, currentPasses) {
|
|
854
|
+
this.updateLayerConfig({
|
|
855
|
+
enableMultiPassRenderer: enableMultiPass
|
|
856
|
+
});
|
|
857
|
+
|
|
858
|
+
if (currentPasses) {
|
|
859
|
+
this.updateLayerConfig({
|
|
860
|
+
passes: currentPasses
|
|
861
|
+
});
|
|
862
|
+
}
|
|
863
|
+
|
|
864
|
+
if (enableMultiPass) {
|
|
865
|
+
var _this$getLayerConfig6 = this.getLayerConfig(),
|
|
866
|
+
_this$getLayerConfig7 = _this$getLayerConfig6.passes,
|
|
867
|
+
passes = _this$getLayerConfig7 === void 0 ? [] : _this$getLayerConfig7;
|
|
868
|
+
|
|
869
|
+
this.multiPassRenderer = createMultiPassRenderer(this, passes, this.postProcessingPassFactory, this.normalPassFactory);
|
|
870
|
+
this.multiPassRenderer.setRenderFlag(true);
|
|
871
|
+
|
|
872
|
+
var _this$rendererService = this.rendererService.getViewportSize(),
|
|
873
|
+
width = _this$rendererService.width,
|
|
874
|
+
height = _this$rendererService.height;
|
|
875
|
+
|
|
876
|
+
this.multiPassRenderer.resize(width, height);
|
|
877
|
+
}
|
|
878
|
+
|
|
879
|
+
return this;
|
|
880
|
+
}
|
|
881
|
+
}, {
|
|
882
|
+
key: "setMinZoom",
|
|
883
|
+
value: function setMinZoom(minZoom) {
|
|
884
|
+
this.updateLayerConfig({
|
|
885
|
+
minZoom: minZoom
|
|
886
|
+
});
|
|
887
|
+
return this;
|
|
888
|
+
}
|
|
889
|
+
}, {
|
|
890
|
+
key: "getMinZoom",
|
|
891
|
+
value: function getMinZoom() {
|
|
892
|
+
var _this$getLayerConfig8 = this.getLayerConfig(),
|
|
893
|
+
minZoom = _this$getLayerConfig8.minZoom;
|
|
894
|
+
|
|
895
|
+
return minZoom;
|
|
896
|
+
}
|
|
897
|
+
}, {
|
|
898
|
+
key: "getMaxZoom",
|
|
899
|
+
value: function getMaxZoom() {
|
|
900
|
+
var _this$getLayerConfig9 = this.getLayerConfig(),
|
|
901
|
+
maxZoom = _this$getLayerConfig9.maxZoom;
|
|
902
|
+
|
|
903
|
+
return maxZoom;
|
|
904
|
+
}
|
|
905
|
+
}, {
|
|
906
|
+
key: "get",
|
|
907
|
+
value: function get(name) {
|
|
908
|
+
var cfg = this.getLayerConfig(); // @ts-ignore
|
|
909
|
+
|
|
910
|
+
return cfg[name];
|
|
911
|
+
}
|
|
912
|
+
}, {
|
|
913
|
+
key: "setMaxZoom",
|
|
914
|
+
value: function setMaxZoom(maxZoom) {
|
|
915
|
+
this.updateLayerConfig({
|
|
916
|
+
maxZoom: maxZoom
|
|
917
|
+
});
|
|
918
|
+
return this;
|
|
919
|
+
}
|
|
920
|
+
}, {
|
|
921
|
+
key: "setAutoFit",
|
|
922
|
+
value: function setAutoFit(autoFit) {
|
|
923
|
+
this.updateLayerConfig({
|
|
924
|
+
autoFit: autoFit
|
|
925
|
+
});
|
|
926
|
+
return this;
|
|
927
|
+
}
|
|
928
|
+
/**
|
|
929
|
+
* zoom to layer Bounds
|
|
930
|
+
*/
|
|
931
|
+
|
|
932
|
+
}, {
|
|
933
|
+
key: "fitBounds",
|
|
934
|
+
value: function fitBounds(fitBoundsOptions) {
|
|
935
|
+
if (!this.inited) {
|
|
936
|
+
this.updateLayerConfig({
|
|
937
|
+
autoFit: true
|
|
938
|
+
});
|
|
939
|
+
return this;
|
|
940
|
+
}
|
|
941
|
+
|
|
942
|
+
var source = this.getSource();
|
|
943
|
+
var extent = source.extent;
|
|
944
|
+
var isValid = extent.some(function (v) {
|
|
945
|
+
return Math.abs(v) === Infinity;
|
|
946
|
+
});
|
|
947
|
+
|
|
948
|
+
if (isValid) {
|
|
949
|
+
return this;
|
|
950
|
+
}
|
|
951
|
+
|
|
952
|
+
this.mapService.fitBounds([[extent[0], extent[1]], [extent[2], extent[3]]], fitBoundsOptions);
|
|
953
|
+
return this;
|
|
954
|
+
}
|
|
955
|
+
}, {
|
|
956
|
+
key: "destroy",
|
|
957
|
+
value: function destroy() {
|
|
958
|
+
var _this$multiPassRender, _this$layerModel2, _this$tileLayer;
|
|
959
|
+
|
|
960
|
+
var refresh = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
961
|
+
|
|
962
|
+
if (this.isDestroyed) {
|
|
963
|
+
return;
|
|
964
|
+
} // remove child layer
|
|
965
|
+
|
|
966
|
+
|
|
967
|
+
this.layerChildren.map(function (child) {
|
|
968
|
+
return child.destroy(false);
|
|
969
|
+
});
|
|
970
|
+
this.layerChildren = []; // remove mask list
|
|
971
|
+
|
|
972
|
+
this.masks.map(function (mask) {
|
|
973
|
+
return mask.destroy(false);
|
|
974
|
+
});
|
|
975
|
+
this.masks = [];
|
|
976
|
+
this.hooks.beforeDestroy.call(); // 清除sources事件
|
|
977
|
+
|
|
978
|
+
this.layerSource.off('update', this.sourceEvent);
|
|
979
|
+
(_this$multiPassRender = this.multiPassRenderer) === null || _this$multiPassRender === void 0 ? void 0 : _this$multiPassRender.destroy(); // 清除所有属性以及关联的 vao == 销毁所有 => model this.models.forEach((model) => model.destroy());
|
|
980
|
+
|
|
981
|
+
this.styleAttributeService.clearAllAttributes(); // 执行每个图层单独的 clearModels 方法 (清除一些额外的 texture、program、buffer 等)
|
|
982
|
+
|
|
983
|
+
this.hooks.afterDestroy.call(); // Tip: 清除各个图层自定义的 models 资源
|
|
984
|
+
|
|
985
|
+
(_this$layerModel2 = this.layerModel) === null || _this$layerModel2 === void 0 ? void 0 : _this$layerModel2.clearModels(refresh);
|
|
986
|
+
(_this$tileLayer = this.tileLayer) === null || _this$tileLayer === void 0 ? void 0 : _this$tileLayer.destroy();
|
|
987
|
+
this.models = [];
|
|
988
|
+
this.layerService.cleanRemove(this, refresh);
|
|
989
|
+
this.emit('remove', {
|
|
990
|
+
target: this,
|
|
991
|
+
type: 'remove'
|
|
992
|
+
});
|
|
993
|
+
this.emit('destroy', {
|
|
994
|
+
target: this,
|
|
995
|
+
type: 'destroy'
|
|
996
|
+
});
|
|
997
|
+
this.removeAllListeners(); // 解绑图层容器中的服务
|
|
998
|
+
// this.container.unbind(TYPES.IStyleAttributeService);
|
|
999
|
+
|
|
1000
|
+
this.isDestroyed = true;
|
|
1001
|
+
}
|
|
1002
|
+
}, {
|
|
1003
|
+
key: "clear",
|
|
1004
|
+
value: function clear() {
|
|
1005
|
+
this.styleAttributeService.clearAllAttributes(); // 销毁所有 model
|
|
1006
|
+
}
|
|
1007
|
+
}, {
|
|
1008
|
+
key: "clearModels",
|
|
1009
|
+
value: function clearModels() {
|
|
1010
|
+
var _this$layerModel3;
|
|
1011
|
+
|
|
1012
|
+
this.models.forEach(function (model) {
|
|
1013
|
+
return model.destroy();
|
|
1014
|
+
});
|
|
1015
|
+
(_this$layerModel3 = this.layerModel) === null || _this$layerModel3 === void 0 ? void 0 : _this$layerModel3.clearModels();
|
|
1016
|
+
this.models = [];
|
|
1017
|
+
}
|
|
1018
|
+
}, {
|
|
1019
|
+
key: "isDirty",
|
|
1020
|
+
value: function isDirty() {
|
|
1021
|
+
return !!(this.styleAttributeService.getLayerStyleAttributes() || []).filter(function (attribute) {
|
|
1022
|
+
return attribute.needRescale || attribute.needRemapping || attribute.needRegenerateVertices;
|
|
1023
|
+
}).length;
|
|
1024
|
+
}
|
|
1025
|
+
}, {
|
|
1026
|
+
key: "setSource",
|
|
1027
|
+
value: function setSource(source) {
|
|
1028
|
+
var _this8 = this;
|
|
1029
|
+
|
|
1030
|
+
// 清除旧 sources 事件
|
|
1031
|
+
if (this.layerSource) {
|
|
1032
|
+
this.layerSource.off('update', this.sourceEvent);
|
|
1033
|
+
}
|
|
1034
|
+
|
|
1035
|
+
this.layerSource = source;
|
|
1036
|
+
this.clusterZoom = 0; // 已 inited 且启用聚合进行更新聚合数据
|
|
1037
|
+
|
|
1038
|
+
if (this.inited && this.layerSource.cluster) {
|
|
1039
|
+
var zoom = this.mapService.getZoom();
|
|
1040
|
+
this.layerSource.updateClusterData(zoom);
|
|
1041
|
+
} // source 可能会复用,会在其它layer被修改
|
|
1042
|
+
|
|
1043
|
+
|
|
1044
|
+
if (this.layerSource.inited) {
|
|
1045
|
+
this.sourceEvent();
|
|
1046
|
+
} // this.layerSource.inited 为 true update 事件不会再触发
|
|
1047
|
+
|
|
1048
|
+
|
|
1049
|
+
this.layerSource.on('update', function () {
|
|
1050
|
+
if (_this8.coordCenter === undefined) {
|
|
1051
|
+
var _this8$mapService;
|
|
1052
|
+
|
|
1053
|
+
var layerCenter = _this8.layerSource.center;
|
|
1054
|
+
_this8.coordCenter = layerCenter;
|
|
1055
|
+
((_this8$mapService = _this8.mapService) === null || _this8$mapService === void 0 ? void 0 : _this8$mapService.setCoordCenter) && _this8.mapService.setCoordCenter(layerCenter);
|
|
1056
|
+
}
|
|
1057
|
+
|
|
1058
|
+
_this8.sourceEvent();
|
|
1059
|
+
});
|
|
1060
|
+
}
|
|
1061
|
+
}, {
|
|
1062
|
+
key: "getSource",
|
|
1063
|
+
value: function getSource() {
|
|
1064
|
+
return this.layerSource;
|
|
1065
|
+
}
|
|
1066
|
+
}, {
|
|
1067
|
+
key: "getScaleOptions",
|
|
1068
|
+
value: function getScaleOptions() {
|
|
1069
|
+
return this.scaleOptions;
|
|
1070
|
+
}
|
|
1071
|
+
}, {
|
|
1072
|
+
key: "setEncodedData",
|
|
1073
|
+
value: function setEncodedData(encodedData) {
|
|
1074
|
+
this.encodedData = encodedData;
|
|
1075
|
+
this.encodeDataLength = encodedData.length;
|
|
1076
|
+
}
|
|
1077
|
+
}, {
|
|
1078
|
+
key: "getEncodedData",
|
|
1079
|
+
value: function getEncodedData() {
|
|
1080
|
+
return this.encodedData;
|
|
1081
|
+
}
|
|
1082
|
+
}, {
|
|
1083
|
+
key: "getScale",
|
|
1084
|
+
value: function getScale(name) {
|
|
1085
|
+
return this.styleAttributeService.getLayerAttributeScale(name);
|
|
1086
|
+
}
|
|
1087
|
+
}, {
|
|
1088
|
+
key: "getLegend",
|
|
1089
|
+
value: function getLegend(name) {
|
|
1090
|
+
var _attribute$scale, _scales$0$option, _attribute$scale2;
|
|
1091
|
+
|
|
1092
|
+
var attribute = this.styleAttributeService.getLayerStyleAttribute(name);
|
|
1093
|
+
var scales = (attribute === null || attribute === void 0 ? void 0 : (_attribute$scale = attribute.scale) === null || _attribute$scale === void 0 ? void 0 : _attribute$scale.scalers) || [];
|
|
1094
|
+
return {
|
|
1095
|
+
type: (_scales$0$option = scales[0].option) === null || _scales$0$option === void 0 ? void 0 : _scales$0$option.type,
|
|
1096
|
+
field: attribute === null || attribute === void 0 ? void 0 : (_attribute$scale2 = attribute.scale) === null || _attribute$scale2 === void 0 ? void 0 : _attribute$scale2.field,
|
|
1097
|
+
items: this.getLegendItems(name)
|
|
1098
|
+
};
|
|
1099
|
+
}
|
|
1100
|
+
}, {
|
|
1101
|
+
key: "getLegendItems",
|
|
1102
|
+
value: function getLegendItems(name) {
|
|
1103
|
+
var scale = this.styleAttributeService.getLayerAttributeScale(name); // 函数自定义映射,没有 scale 返回为空数组
|
|
1104
|
+
|
|
1105
|
+
if (!scale) {
|
|
1106
|
+
return [];
|
|
1107
|
+
}
|
|
1108
|
+
|
|
1109
|
+
if (scale.invertExtent) {
|
|
1110
|
+
// 分段类型 Quantize、Quantile、Threshold
|
|
1111
|
+
var items = scale.range().map(function (item) {
|
|
1112
|
+
return _defineProperty({
|
|
1113
|
+
value: scale.invertExtent(item)
|
|
1114
|
+
}, name, item);
|
|
1115
|
+
});
|
|
1116
|
+
return items;
|
|
1117
|
+
} else if (scale.ticks) {
|
|
1118
|
+
// 连续类型 Continuous (Linear, Power, Log, Identity, Time)
|
|
1119
|
+
var _items = scale.ticks().map(function (item) {
|
|
1120
|
+
return _defineProperty({
|
|
1121
|
+
value: item
|
|
1122
|
+
}, name, scale(item));
|
|
1123
|
+
});
|
|
1124
|
+
|
|
1125
|
+
return _items;
|
|
1126
|
+
} else if (scale !== null && scale !== void 0 && scale.domain) {
|
|
1127
|
+
// 枚举类型 Cat
|
|
1128
|
+
var _items2 = scale.domain().filter(function (item) {
|
|
1129
|
+
return !isUndefined(item);
|
|
1130
|
+
}).map(function (item) {
|
|
1131
|
+
return _defineProperty({
|
|
1132
|
+
value: item
|
|
1133
|
+
}, name, scale(item));
|
|
1134
|
+
});
|
|
1135
|
+
|
|
1136
|
+
return _items2;
|
|
1137
|
+
}
|
|
1138
|
+
|
|
1139
|
+
return [];
|
|
1140
|
+
}
|
|
1141
|
+
}, {
|
|
1142
|
+
key: "pick",
|
|
1143
|
+
value: function pick(_ref6) {
|
|
1144
|
+
var x = _ref6.x,
|
|
1145
|
+
y = _ref6.y;
|
|
1146
|
+
this.interactionService.triggerHover({
|
|
1147
|
+
x: x,
|
|
1148
|
+
y: y
|
|
1149
|
+
});
|
|
1150
|
+
}
|
|
1151
|
+
}, {
|
|
1152
|
+
key: "boxSelect",
|
|
1153
|
+
value: function boxSelect(box, cb) {
|
|
1154
|
+
this.pickingService.boxPickLayer(this, box, cb);
|
|
1155
|
+
}
|
|
1156
|
+
}, {
|
|
1157
|
+
key: "buildLayerModel",
|
|
1158
|
+
value: function buildLayerModel(options) {
|
|
1159
|
+
var _this9 = this;
|
|
1160
|
+
|
|
1161
|
+
var moduleName = options.moduleName,
|
|
1162
|
+
vertexShader = options.vertexShader,
|
|
1163
|
+
fragmentShader = options.fragmentShader,
|
|
1164
|
+
triangulation = options.triangulation,
|
|
1165
|
+
segmentNumber = options.segmentNumber,
|
|
1166
|
+
_options$workerEnable = options.workerEnabled,
|
|
1167
|
+
workerEnabled = _options$workerEnable === void 0 ? false : _options$workerEnable,
|
|
1168
|
+
workerOptions = options.workerOptions,
|
|
1169
|
+
rest = _objectWithoutProperties(options, _excluded2);
|
|
1170
|
+
|
|
1171
|
+
this.shaderModuleService.registerModule(moduleName, {
|
|
1172
|
+
vs: vertexShader,
|
|
1173
|
+
fs: fragmentShader
|
|
1174
|
+
});
|
|
1175
|
+
|
|
1176
|
+
var _this$shaderModuleSer = this.shaderModuleService.getModule(moduleName),
|
|
1177
|
+
vs = _this$shaderModuleSer.vs,
|
|
1178
|
+
fs = _this$shaderModuleSer.fs,
|
|
1179
|
+
uniforms = _this$shaderModuleSer.uniforms;
|
|
1180
|
+
|
|
1181
|
+
var createModel = this.rendererService.createModel;
|
|
1182
|
+
return new Promise(function (resolve, reject) {
|
|
1183
|
+
setTimeout(function () {
|
|
1184
|
+
// filter supported worker & worker enabled layer
|
|
1185
|
+
if (workerOptions && workerOptions.modelType in WorkerSourceMap && workerEnabled) {
|
|
1186
|
+
_this9.styleAttributeService.createAttributesAndIndicesAscy(_this9.encodedData, segmentNumber, workerOptions).then(function (_ref7) {
|
|
1187
|
+
var attributes = _ref7.attributes,
|
|
1188
|
+
elements = _ref7.elements;
|
|
1189
|
+
var m = createModel(_objectSpread({
|
|
1190
|
+
attributes: attributes,
|
|
1191
|
+
uniforms: uniforms,
|
|
1192
|
+
fs: fs,
|
|
1193
|
+
vs: vs,
|
|
1194
|
+
elements: elements,
|
|
1195
|
+
blend: BlendTypes[BlendType.normal]
|
|
1196
|
+
}, rest));
|
|
1197
|
+
resolve(m);
|
|
1198
|
+
}).catch(function (err) {
|
|
1199
|
+
return reject(err);
|
|
1200
|
+
});
|
|
1201
|
+
} else {
|
|
1202
|
+
// console.log(this.encodedData[1].originCoordinates[0])
|
|
1203
|
+
// console.log(this.encodedData[1].coordinates[0])
|
|
1204
|
+
var _this9$styleAttribute = _this9.styleAttributeService.createAttributesAndIndices(_this9.encodedData, triangulation, segmentNumber),
|
|
1205
|
+
attributes = _this9$styleAttribute.attributes,
|
|
1206
|
+
elements = _this9$styleAttribute.elements,
|
|
1207
|
+
count = _this9$styleAttribute.count;
|
|
1208
|
+
|
|
1209
|
+
var modelOptions = _objectSpread({
|
|
1210
|
+
attributes: attributes,
|
|
1211
|
+
uniforms: uniforms,
|
|
1212
|
+
fs: fs,
|
|
1213
|
+
vs: vs,
|
|
1214
|
+
elements: elements,
|
|
1215
|
+
blend: BlendTypes[BlendType.normal]
|
|
1216
|
+
}, rest);
|
|
1217
|
+
|
|
1218
|
+
if (count) {
|
|
1219
|
+
modelOptions.count = count;
|
|
1220
|
+
}
|
|
1221
|
+
|
|
1222
|
+
var m = createModel(modelOptions);
|
|
1223
|
+
resolve(m);
|
|
1224
|
+
}
|
|
1225
|
+
});
|
|
1226
|
+
});
|
|
1227
|
+
}
|
|
1228
|
+
}, {
|
|
1229
|
+
key: "createAttributes",
|
|
1230
|
+
value: function createAttributes(options) {
|
|
1231
|
+
var triangulation = options.triangulation; // @ts-ignore
|
|
1232
|
+
|
|
1233
|
+
var _this$styleAttributeS4 = this.styleAttributeService.createAttributes(this.encodedData, triangulation),
|
|
1234
|
+
attributes = _this$styleAttributeS4.attributes;
|
|
1235
|
+
|
|
1236
|
+
return attributes;
|
|
1237
|
+
}
|
|
1238
|
+
}, {
|
|
1239
|
+
key: "getTime",
|
|
1240
|
+
value: function getTime() {
|
|
1241
|
+
return this.layerService.clock.getDelta();
|
|
1242
|
+
}
|
|
1243
|
+
}, {
|
|
1244
|
+
key: "setAnimateStartTime",
|
|
1245
|
+
value: function setAnimateStartTime() {
|
|
1246
|
+
this.animateStartTime = this.layerService.clock.getElapsedTime();
|
|
1247
|
+
}
|
|
1248
|
+
}, {
|
|
1249
|
+
key: "stopAnimate",
|
|
1250
|
+
value: function stopAnimate() {
|
|
1251
|
+
if (this.animateStatus) {
|
|
1252
|
+
this.layerService.stopAnimate();
|
|
1253
|
+
this.animateStatus = false;
|
|
1254
|
+
this.updateLayerConfig({
|
|
1255
|
+
animateOption: {
|
|
1256
|
+
enable: false
|
|
1257
|
+
}
|
|
1258
|
+
});
|
|
1259
|
+
}
|
|
1260
|
+
}
|
|
1261
|
+
}, {
|
|
1262
|
+
key: "getLayerAnimateTime",
|
|
1263
|
+
value: function getLayerAnimateTime() {
|
|
1264
|
+
return this.layerService.clock.getElapsedTime() - this.animateStartTime;
|
|
1265
|
+
}
|
|
1266
|
+
}, {
|
|
1267
|
+
key: "needPick",
|
|
1268
|
+
value: function needPick(type) {
|
|
1269
|
+
// 地图图层的判断
|
|
1270
|
+
if (this.rawConfig.usage === 'basemap') return false;
|
|
1271
|
+
|
|
1272
|
+
var _this$getLayerConfig10 = this.getLayerConfig(),
|
|
1273
|
+
_this$getLayerConfig11 = _this$getLayerConfig10.enableHighlight,
|
|
1274
|
+
enableHighlight = _this$getLayerConfig11 === void 0 ? true : _this$getLayerConfig11,
|
|
1275
|
+
_this$getLayerConfig12 = _this$getLayerConfig10.enableSelect,
|
|
1276
|
+
enableSelect = _this$getLayerConfig12 === void 0 ? true : _this$getLayerConfig12; // 判断layer是否监听事件;
|
|
1277
|
+
|
|
1278
|
+
|
|
1279
|
+
var isPick = this.eventNames().indexOf(type) !== -1 || this.eventNames().indexOf('un' + type) !== -1;
|
|
1280
|
+
|
|
1281
|
+
if ((type === 'click' || type === 'dblclick') && enableSelect) {
|
|
1282
|
+
isPick = true;
|
|
1283
|
+
}
|
|
1284
|
+
|
|
1285
|
+
if (type === 'mousemove' && (enableHighlight || this.eventNames().indexOf('mouseenter') !== -1 || this.eventNames().indexOf('unmousemove') !== -1 || this.eventNames().indexOf('mouseout') !== -1)) {
|
|
1286
|
+
isPick = true;
|
|
1287
|
+
}
|
|
1288
|
+
|
|
1289
|
+
return this.isVisible() && isPick;
|
|
1290
|
+
}
|
|
1291
|
+
}, {
|
|
1292
|
+
key: "buildModels",
|
|
1293
|
+
value: function buildModels() {
|
|
1294
|
+
throw new Error('Method not implemented.');
|
|
1295
|
+
}
|
|
1296
|
+
}, {
|
|
1297
|
+
key: "rebuildModels",
|
|
1298
|
+
value: function rebuildModels() {
|
|
1299
|
+
throw new Error('Method not implemented.');
|
|
1300
|
+
}
|
|
1301
|
+
}, {
|
|
1302
|
+
key: "renderMulPass",
|
|
1303
|
+
value: function () {
|
|
1304
|
+
var _renderMulPass = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(multiPassRenderer) {
|
|
1305
|
+
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
1306
|
+
while (1) {
|
|
1307
|
+
switch (_context2.prev = _context2.next) {
|
|
1308
|
+
case 0:
|
|
1309
|
+
_context2.next = 2;
|
|
1310
|
+
return multiPassRenderer.render();
|
|
1311
|
+
|
|
1312
|
+
case 2:
|
|
1313
|
+
case "end":
|
|
1314
|
+
return _context2.stop();
|
|
1315
|
+
}
|
|
1316
|
+
}
|
|
1317
|
+
}, _callee2);
|
|
1318
|
+
}));
|
|
1319
|
+
|
|
1320
|
+
function renderMulPass(_x) {
|
|
1321
|
+
return _renderMulPass.apply(this, arguments);
|
|
1322
|
+
}
|
|
1323
|
+
|
|
1324
|
+
return renderMulPass;
|
|
1325
|
+
}()
|
|
1326
|
+
}, {
|
|
1327
|
+
key: "renderModels",
|
|
1328
|
+
value: function renderModels(isPicking) {
|
|
1329
|
+
var _this10 = this;
|
|
1330
|
+
|
|
1331
|
+
// TODO: this.getEncodedData().length > 0 这个判断是为了解决在 2.5.x 引入数据纹理后产生的 空数据渲染导致 texture 超出上限问题
|
|
1332
|
+
if (this.encodeDataLength <= 0 && !this.forceRender) return this;
|
|
1333
|
+
|
|
1334
|
+
if (this.layerModelNeedUpdate && this.layerModel) {
|
|
1335
|
+
this.layerModel.buildModels(function (models) {
|
|
1336
|
+
_this10.models = models;
|
|
1337
|
+
|
|
1338
|
+
_this10.hooks.beforeRender.call();
|
|
1339
|
+
|
|
1340
|
+
_this10.layerModelNeedUpdate = false;
|
|
1341
|
+
});
|
|
1342
|
+
}
|
|
1343
|
+
|
|
1344
|
+
this.models.forEach(function (model) {
|
|
1345
|
+
model.draw({
|
|
1346
|
+
uniforms: _this10.layerModel.getUninforms()
|
|
1347
|
+
}, isPicking);
|
|
1348
|
+
});
|
|
1349
|
+
return this;
|
|
1350
|
+
}
|
|
1351
|
+
}, {
|
|
1352
|
+
key: "updateStyleAttribute",
|
|
1353
|
+
value: function updateStyleAttribute(type, field, values, updateOptions) {
|
|
1354
|
+
if (!this.inited) {
|
|
1355
|
+
this.pendingStyleAttributes.push({
|
|
1356
|
+
attributeName: type,
|
|
1357
|
+
attributeField: field,
|
|
1358
|
+
attributeValues: values,
|
|
1359
|
+
updateOptions: updateOptions
|
|
1360
|
+
});
|
|
1361
|
+
} else {
|
|
1362
|
+
this.styleAttributeService.updateStyleAttribute(type, {
|
|
1363
|
+
// @ts-ignore
|
|
1364
|
+
scale: _objectSpread({
|
|
1365
|
+
field: field
|
|
1366
|
+
}, this.splitValuesAndCallbackInAttribute( // @ts-ignore
|
|
1367
|
+
values, // @ts-ignore
|
|
1368
|
+
this.getLayerConfig()[field]))
|
|
1369
|
+
}, // @ts-ignore
|
|
1370
|
+
updateOptions);
|
|
1371
|
+
}
|
|
1372
|
+
}
|
|
1373
|
+
}, {
|
|
1374
|
+
key: "getShaderPickStat",
|
|
1375
|
+
value: function getShaderPickStat() {
|
|
1376
|
+
return this.layerService.getShaderPickStat();
|
|
1377
|
+
}
|
|
1378
|
+
/**
|
|
1379
|
+
* 继承空方法
|
|
1380
|
+
* @param time
|
|
1381
|
+
*/
|
|
1382
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
1383
|
+
|
|
1384
|
+
}, {
|
|
1385
|
+
key: "setEarthTime",
|
|
1386
|
+
value: function setEarthTime(time) {
|
|
1387
|
+
console.warn('empty fn');
|
|
1388
|
+
}
|
|
1389
|
+
}, {
|
|
1390
|
+
key: "getModelType",
|
|
1391
|
+
value: function getModelType() {
|
|
1392
|
+
throw new Error('Method not implemented.');
|
|
1393
|
+
}
|
|
1394
|
+
}, {
|
|
1395
|
+
key: "getDefaultConfig",
|
|
1396
|
+
value: function getDefaultConfig() {
|
|
1397
|
+
return {};
|
|
1398
|
+
}
|
|
1399
|
+
}, {
|
|
1400
|
+
key: "dispatchModelLoad",
|
|
1401
|
+
value: function dispatchModelLoad(models) {
|
|
1402
|
+
var _this11 = this;
|
|
1403
|
+
|
|
1404
|
+
this.models.forEach(function (model) {
|
|
1405
|
+
return model.destroy();
|
|
1406
|
+
});
|
|
1407
|
+
this.models = [];
|
|
1408
|
+
this.models = models;
|
|
1409
|
+
this.emit('modelLoaded', null);
|
|
1410
|
+
this.modelLoaded = true; // Tip: setTimeout 用于延迟绘制,可以让拖动图层时连续的 setData 更加平滑 - L7Draw
|
|
1411
|
+
|
|
1412
|
+
setTimeout(function () {
|
|
1413
|
+
// Tip: 使用 renderLayers 而不是 throttleRenderLayers,让图层之间的 setData 更新绘制不存在延迟
|
|
1414
|
+
_this11.layerService.renderLayers();
|
|
1415
|
+
}, 32);
|
|
1416
|
+
}
|
|
1417
|
+
}, {
|
|
1418
|
+
key: "reRender",
|
|
1419
|
+
value: function reRender() {
|
|
1420
|
+
this.inited && this.layerService.reRender();
|
|
1421
|
+
}
|
|
1422
|
+
}, {
|
|
1423
|
+
key: "splitValuesAndCallbackInAttribute",
|
|
1424
|
+
value: function splitValuesAndCallbackInAttribute(valuesOrCallback, defaultValues) {
|
|
1425
|
+
return {
|
|
1426
|
+
values: isFunction(valuesOrCallback) ? undefined : valuesOrCallback || defaultValues,
|
|
1427
|
+
callback: isFunction(valuesOrCallback) ? valuesOrCallback : undefined
|
|
1428
|
+
};
|
|
1429
|
+
}
|
|
1430
|
+
}]);
|
|
1431
|
+
|
|
1432
|
+
return BaseLayer;
|
|
1433
|
+
}(EventEmitter), (_descriptor = _applyDecoratedDescriptor(_class.prototype, "configService", [_dec], {
|
|
1434
|
+
configurable: true,
|
|
1435
|
+
enumerable: true,
|
|
1436
|
+
writable: true,
|
|
1437
|
+
initializer: null
|
|
1438
|
+
})), _class));
|
|
1439
|
+
export { BaseLayer as default };
|