@antv/l7-layers 2.25.7 → 2.25.10
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/canvas/index.d.ts +18 -0
- package/es/canvas/index.js +70 -0
- package/es/canvas/models/canvas.d.ts +23 -0
- package/es/canvas/models/canvas.js +141 -0
- package/es/canvas/models/constants.d.ts +2 -0
- package/es/canvas/models/constants.js +6 -0
- package/es/canvas/models/index.d.ts +2 -0
- package/es/canvas/models/index.js +2 -0
- package/es/citybuilding/building.d.ts +7 -0
- package/es/citybuilding/building.js +25 -0
- package/es/citybuilding/models/build.d.ts +33 -0
- package/es/citybuilding/models/build.js +160 -0
- package/es/citybuilding/shaders/build_frag.glsl +123 -0
- package/es/citybuilding/shaders/build_vert.glsl +58 -0
- package/es/core/BaseLayer.d.ts +265 -0
- package/es/core/BaseLayer.js +1310 -0
- package/es/core/BaseModel.d.ts +95 -0
- package/es/core/BaseModel.js +367 -0
- package/es/core/CommonStyleAttribute.d.ts +16 -0
- package/es/core/CommonStyleAttribute.js +114 -0
- package/es/core/LayerPickService.d.ts +12 -0
- package/es/core/LayerPickService.js +102 -0
- package/es/core/TextureService.d.ts +15 -0
- package/es/core/TextureService.js +65 -0
- package/es/core/constant.d.ts +6 -0
- package/es/core/constant.js +19 -0
- package/es/core/interface.d.ts +284 -0
- package/es/core/interface.js +32 -0
- package/es/core/line_trangluation.d.ts +19 -0
- package/es/core/line_trangluation.js +86 -0
- package/es/core/schema.d.ts +27 -0
- package/es/core/schema.js +25 -0
- package/es/core/shape/Path.d.ts +40 -0
- package/es/core/shape/Path.js +69 -0
- package/es/core/shape/arrow.d.ts +25 -0
- package/es/core/shape/arrow.js +144 -0
- package/es/core/shape/extrude.d.ts +17 -0
- package/es/core/shape/extrude.js +133 -0
- package/es/core/triangulation.d.ts +136 -0
- package/es/core/triangulation.js +601 -0
- package/es/core/utils.d.ts +5 -0
- package/es/core/utils.js +36 -0
- package/es/earth/index.d.ts +22 -0
- package/es/earth/index.js +54 -0
- package/es/earth/models/atmosphere.d.ts +30 -0
- package/es/earth/models/atmosphere.js +116 -0
- package/es/earth/models/base.d.ts +37 -0
- package/es/earth/models/base.js +172 -0
- package/es/earth/models/bloomsphere.d.ts +30 -0
- package/es/earth/models/bloomsphere.js +115 -0
- package/es/earth/shaders/atmosphere/atmosphere_frag.glsl +17 -0
- package/es/earth/shaders/atmosphere/atmosphere_vert.glsl +24 -0
- package/es/earth/shaders/base/base_frag.glsl +11 -0
- package/es/earth/shaders/base/base_vert.glsl +52 -0
- package/es/earth/shaders/bloomshpere/bloomsphere_frag.glsl +15 -0
- package/es/earth/shaders/bloomshpere/bloomsphere_vert.glsl +20 -0
- package/es/earth/utils.d.ts +26 -0
- package/es/earth/utils.js +99 -0
- package/es/geometry/index.d.ts +22 -0
- package/es/geometry/index.js +53 -0
- package/es/geometry/models/billboard.d.ts +39 -0
- package/es/geometry/models/billboard.js +175 -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 +58 -0
- package/es/geometry/models/plane.js +308 -0
- package/es/geometry/models/sprite.d.ts +48 -0
- package/es/geometry/models/sprite.js +225 -0
- package/es/geometry/shaders/billboard_frag.glsl +18 -0
- package/es/geometry/shaders/billboard_vert.glsl +43 -0
- package/es/geometry/shaders/plane_frag.glsl +23 -0
- package/es/geometry/shaders/plane_vert.glsl +31 -0
- package/es/geometry/shaders/sprite_frag.glsl +23 -0
- package/es/geometry/shaders/sprite_vert.glsl +21 -0
- package/es/heatmap/index.d.ts +13 -0
- package/es/heatmap/index.js +87 -0
- package/es/heatmap/models/grid.d.ts +29 -0
- package/es/heatmap/models/grid.js +83 -0
- package/es/heatmap/models/grid3d.d.ts +31 -0
- package/es/heatmap/models/grid3d.js +122 -0
- package/es/heatmap/models/heatmap.d.ts +46 -0
- package/es/heatmap/models/heatmap.js +447 -0
- package/es/heatmap/models/hexagon.d.ts +29 -0
- package/es/heatmap/models/hexagon.js +83 -0
- package/es/heatmap/models/index.d.ts +5 -0
- package/es/heatmap/models/index.js +12 -0
- package/es/heatmap/shaders/grid/grid_frag.glsl +9 -0
- package/es/heatmap/shaders/grid/grid_vert.glsl +30 -0
- package/es/heatmap/shaders/grid3d/grid_3d_frag.glsl +17 -0
- package/es/heatmap/shaders/grid3d/grid_3d_vert.glsl +34 -0
- package/es/heatmap/shaders/heatmap/heatmap_3d_frag.glsl +23 -0
- package/es/heatmap/shaders/heatmap/heatmap_3d_vert.glsl +59 -0
- package/es/heatmap/shaders/heatmap/heatmap_frag.glsl +40 -0
- package/es/heatmap/shaders/heatmap/heatmap_framebuffer_frag.glsl +17 -0
- package/es/heatmap/shaders/heatmap/heatmap_framebuffer_vert.glsl +36 -0
- package/es/heatmap/shaders/heatmap/heatmap_vert.glsl +21 -0
- package/es/heatmap/shaders/hexagon/hexagon_frag.glsl +8 -0
- package/es/heatmap/shaders/hexagon/hexagon_vert.glsl +30 -0
- package/es/heatmap/triangulation.d.ts +5 -0
- package/es/heatmap/triangulation.js +33 -0
- package/es/image/index.d.ts +9 -0
- package/es/image/index.js +28 -0
- package/es/image/models/image.d.ts +31 -0
- package/es/image/models/image.js +113 -0
- package/es/image/models/index.d.ts +5 -0
- package/es/image/models/index.js +5 -0
- package/es/image/shaders/dataImage_frag.glsl +32 -0
- package/es/image/shaders/image_frag.glsl +38 -0
- package/es/image/shaders/image_vert.glsl +20 -0
- package/es/index.d.ts +18 -0
- package/es/index.js +18 -0
- package/es/line/index.d.ts +36 -0
- package/es/line/index.js +90 -0
- package/es/line/models/arc.d.ts +40 -0
- package/es/line/models/arc.js +279 -0
- package/es/line/models/arc_3d.d.ts +40 -0
- package/es/line/models/arc_3d.js +269 -0
- package/es/line/models/flow.d.ts +31 -0
- package/es/line/models/flow.js +140 -0
- package/es/line/models/great_circle.d.ts +34 -0
- package/es/line/models/great_circle.js +240 -0
- package/es/line/models/index.d.ts +5 -0
- package/es/line/models/index.js +18 -0
- package/es/line/models/line.d.ts +44 -0
- package/es/line/models/line.js +273 -0
- package/es/line/models/simple_line.d.ts +33 -0
- package/es/line/models/simple_line.js +118 -0
- package/es/line/models/wall.d.ts +34 -0
- package/es/line/models/wall.js +223 -0
- package/es/line/shaders/arc/line_arc_frag.glsl +92 -0
- package/es/line/shaders/arc/line_arc_vert.glsl +156 -0
- package/es/line/shaders/arc3d/line_arc_3d_frag.glsl +108 -0
- package/es/line/shaders/arc3d/line_arc_3d_vert.glsl +177 -0
- package/es/line/shaders/flow/flow_line_frag.glsl +13 -0
- package/es/line/shaders/flow/flow_line_vert.glsl +76 -0
- package/es/line/shaders/greatCircle/line_arc_great_circle_frag.glsl +99 -0
- package/es/line/shaders/greatCircle/line_arc_great_circle_vert.glsl +165 -0
- package/es/line/shaders/line/line_frag.glsl +122 -0
- package/es/line/shaders/line/line_vert.glsl +101 -0
- package/es/line/shaders/simple/simpleline_frag.glsl +30 -0
- package/es/line/shaders/simple/simpleline_vert.glsl +45 -0
- package/es/line/shaders/wall/wall_frag.glsl +94 -0
- package/es/line/shaders/wall/wall_vert.glsl +90 -0
- package/es/mask/index.d.ts +16 -0
- package/es/mask/index.js +21 -0
- package/es/mask/models/fill.d.ts +18 -0
- package/es/mask/models/fill.js +61 -0
- package/es/mask/models/index.d.ts +5 -0
- package/es/mask/models/index.js +5 -0
- package/es/mask/shaders/mask_vert.glsl +14 -0
- package/es/plugins/DataMappingPlugin.d.ts +12 -0
- package/es/plugins/DataMappingPlugin.js +226 -0
- package/es/plugins/DataSourcePlugin.d.ts +6 -0
- package/es/plugins/DataSourcePlugin.js +75 -0
- package/es/plugins/FeatureScalePlugin.d.ts +20 -0
- package/es/plugins/FeatureScalePlugin.js +295 -0
- package/es/plugins/LayerAnimateStylePlugin.d.ts +4 -0
- package/es/plugins/LayerAnimateStylePlugin.js +14 -0
- package/es/plugins/LayerMaskPlugin.d.ts +7 -0
- package/es/plugins/LayerMaskPlugin.js +19 -0
- package/es/plugins/LayerModelPlugin.d.ts +10 -0
- package/es/plugins/LayerModelPlugin.js +60 -0
- package/es/plugins/LayerStylePlugin.d.ts +7 -0
- package/es/plugins/LayerStylePlugin.js +18 -0
- package/es/plugins/LightingPlugin.d.ts +35 -0
- package/es/plugins/LightingPlugin.js +84 -0
- package/es/plugins/MultiPassRendererPlugin.d.ts +22 -0
- package/es/plugins/MultiPassRendererPlugin.js +52 -0
- package/es/plugins/PixelPickingPlugin.d.ts +11 -0
- package/es/plugins/PixelPickingPlugin.js +146 -0
- package/es/plugins/RegisterStyleAttributePlugin.d.ts +10 -0
- package/es/plugins/RegisterStyleAttributePlugin.js +72 -0
- package/es/plugins/ShaderUniformPlugin.d.ts +17 -0
- package/es/plugins/ShaderUniformPlugin.js +196 -0
- package/es/plugins/UpdateModelPlugin.d.ts +7 -0
- package/es/plugins/UpdateModelPlugin.js +20 -0
- package/es/plugins/UpdateStyleAttributePlugin.d.ts +9 -0
- package/es/plugins/UpdateStyleAttributePlugin.js +54 -0
- package/es/plugins/index.d.ts +15 -0
- package/es/plugins/index.js +18 -0
- package/es/point/index.d.ts +35 -0
- package/es/point/index.js +153 -0
- package/es/point/models/billboard_point.d.ts +35 -0
- package/es/point/models/billboard_point.js +95 -0
- package/es/point/models/earthExtrude.d.ts +32 -0
- package/es/point/models/earthExtrude.js +199 -0
- package/es/point/models/earthFill.d.ts +31 -0
- package/es/point/models/earthFill.js +158 -0
- package/es/point/models/extrude.d.ts +32 -0
- package/es/point/models/extrude.js +195 -0
- package/es/point/models/fill.d.ts +47 -0
- package/es/point/models/fill.js +180 -0
- package/es/point/models/fillImage.d.ts +42 -0
- package/es/point/models/fillImage.js +189 -0
- package/es/point/models/image.d.ts +48 -0
- package/es/point/models/image.js +293 -0
- package/es/point/models/index.d.ts +5 -0
- package/es/point/models/index.js +24 -0
- package/es/point/models/normal.d.ts +36 -0
- package/es/point/models/normal.js +89 -0
- package/es/point/models/radar.d.ts +37 -0
- package/es/point/models/radar.js +115 -0
- package/es/point/models/text.d.ts +85 -0
- package/es/point/models/text.js +503 -0
- package/es/point/shaders/billboard/billboard_point_frag.glsl +48 -0
- package/es/point/shaders/billboard/billboard_point_vert.glsl +33 -0
- package/es/point/shaders/earthExtrude/earthExtrude_frag.glsl +36 -0
- package/es/point/shaders/earthExtrude/earthExtrude_vert.glsl +118 -0
- package/es/point/shaders/earthFill/earthFill_frag.glsl +79 -0
- package/es/point/shaders/earthFill/earthFill_vert.glsl +46 -0
- package/es/point/shaders/extrude/extrude_frag.glsl +29 -0
- package/es/point/shaders/extrude/extrude_vert.glsl +95 -0
- package/es/point/shaders/fill/fill_frag.glsl +97 -0
- package/es/point/shaders/fill/fill_vert.glsl +79 -0
- package/es/point/shaders/fillImage/fillImage_frag.glsl +23 -0
- package/es/point/shaders/fillImage/fillImage_vert.glsl +46 -0
- package/es/point/shaders/image/image_frag.glsl +45 -0
- package/es/point/shaders/image/image_vert.glsl +47 -0
- package/es/point/shaders/normal/normal_frag.glsl +5 -0
- package/es/point/shaders/normal/normal_vert.glsl +22 -0
- package/es/point/shaders/radar/radar_frag.glsl +52 -0
- package/es/point/shaders/radar/radar_vert.glsl +53 -0
- package/es/point/shaders/text/text_frag.glsl +47 -0
- package/es/point/shaders/text/text_vert.glsl +65 -0
- package/es/point/shape/extrude.d.ts +15 -0
- package/es/point/shape/extrude.js +48 -0
- package/es/polygon/index.d.ts +18 -0
- package/es/polygon/index.js +71 -0
- package/es/polygon/models/extrude.d.ts +41 -0
- package/es/polygon/models/extrude.js +248 -0
- package/es/polygon/models/extrusion.d.ts +40 -0
- package/es/polygon/models/extrusion.js +137 -0
- package/es/polygon/models/fill.d.ts +32 -0
- package/es/polygon/models/fill.js +127 -0
- package/es/polygon/models/index.d.ts +5 -0
- package/es/polygon/models/index.js +26 -0
- package/es/polygon/models/ocean.d.ts +37 -0
- package/es/polygon/models/ocean.js +172 -0
- package/es/polygon/models/water.d.ts +35 -0
- package/es/polygon/models/water.js +150 -0
- package/es/polygon/shaders/extrude/polygon_extrude_frag.glsl +24 -0
- package/es/polygon/shaders/extrude/polygon_extrude_picklight_frag.glsl +49 -0
- package/es/polygon/shaders/extrude/polygon_extrude_picklight_vert.glsl +53 -0
- package/es/polygon/shaders/extrude/polygon_extrude_vert.glsl +74 -0
- package/es/polygon/shaders/extrude/polygon_extrudetex_frag.glsl +55 -0
- package/es/polygon/shaders/extrude/polygon_extrudetex_vert.glsl +54 -0
- package/es/polygon/shaders/extrusion/polygon_extrusion_frag.glsl +8 -0
- package/es/polygon/shaders/extrusion/polygon_extrusion_vert.glsl +24 -0
- package/es/polygon/shaders/fill/fill_frag.glsl +8 -0
- package/es/polygon/shaders/fill/fill_linear_frag.glsl +23 -0
- package/es/polygon/shaders/fill/fill_linear_vert.glsl +36 -0
- package/es/polygon/shaders/fill/fill_vert.glsl +35 -0
- package/es/polygon/shaders/ocean/ocean_frag.glsl +277 -0
- package/es/polygon/shaders/ocean/ocean_vert.glsl +21 -0
- package/es/polygon/shaders/water/polygon_water_frag.glsl +78 -0
- package/es/polygon/shaders/water/polygon_water_vert.glsl +22 -0
- package/es/raster/buffers/triangulation.d.ts +6 -0
- package/es/raster/buffers/triangulation.js +25 -0
- package/es/raster/index.d.ts +11 -0
- package/es/raster/index.js +55 -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 +35 -0
- package/es/raster/models/raster.js +156 -0
- package/es/raster/models/rasterRgb.d.ts +35 -0
- package/es/raster/models/rasterRgb.js +158 -0
- package/es/raster/models/rasterTerrainRgb.d.ts +30 -0
- package/es/raster/models/rasterTerrainRgb.js +118 -0
- package/es/raster/shaders/raster/raster_2d_frag.glsl +37 -0
- package/es/raster/shaders/raster/raster_2d_vert.glsl +21 -0
- package/es/raster/shaders/rgb/raster_rgb_frag.glsl +30 -0
- package/es/raster/shaders/rgb/raster_rgb_vert.glsl +21 -0
- package/es/raster/shaders/terrain/terrain_rgb_frag.glsl +40 -0
- package/es/raster/shaders/terrain/terrain_rgb_vert.glsl +19 -0
- package/es/shader/minify_frag.glsl +11 -0
- package/es/shader/minify_picking_frag.glsl +10 -0
- package/es/tile/core/BaseLayer.d.ts +50 -0
- package/es/tile/core/BaseLayer.js +256 -0
- package/es/tile/core/TileDebugLayer.d.ts +15 -0
- package/es/tile/core/TileDebugLayer.js +23 -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 +45 -0
- package/es/tile/interaction/utils.d.ts +11 -0
- package/es/tile/interaction/utils.js +69 -0
- package/es/tile/interface.d.ts +29 -0
- package/es/tile/interface.js +1 -0
- package/es/tile/service/TileLayerService.d.ts +58 -0
- package/es/tile/service/TileLayerService.js +195 -0
- package/es/tile/service/TilePickService.d.ts +26 -0
- package/es/tile/service/TilePickService.js +126 -0
- package/es/tile/service/TileSourceService.d.ts +7 -0
- package/es/tile/service/TileSourceService.js +26 -0
- package/es/tile/tile/DebugTile.d.ts +16 -0
- package/es/tile/tile/DebugTile.js +47 -0
- package/es/tile/tile/ImageTile.d.ts +14 -0
- package/es/tile/tile/ImageTile.js +39 -0
- package/es/tile/tile/MaskTile.d.ts +18 -0
- package/es/tile/tile/MaskTile.js +54 -0
- package/es/tile/tile/RasterRGBTile.d.ts +11 -0
- package/es/tile/tile/RasterRGBTile.js +47 -0
- package/es/tile/tile/RasterTerrainRGBTile.d.ts +14 -0
- package/es/tile/tile/RasterTerrainRGBTile.js +39 -0
- package/es/tile/tile/RasterTile.d.ts +18 -0
- package/es/tile/tile/RasterTile.js +81 -0
- package/es/tile/tile/Tile.d.ts +112 -0
- package/es/tile/tile/Tile.js +166 -0
- package/es/tile/tile/VectorTile.d.ts +26 -0
- package/es/tile/tile/VectorTile.js +87 -0
- package/es/tile/tile/index.d.ts +12 -0
- package/es/tile/tile/index.js +44 -0
- package/es/tile/tile/util.d.ts +5 -0
- package/es/tile/tile/util.js +18 -0
- package/es/tile/utils/constants.d.ts +1 -0
- package/es/tile/utils/constants.js +8 -0
- package/es/tile/utils/utils.d.ts +8 -0
- package/es/tile/utils/utils.js +11 -0
- package/es/utils/blend.d.ts +2 -0
- package/es/utils/blend.js +57 -0
- package/es/utils/collision-index.d.ts +47 -0
- package/es/utils/collision-index.js +87 -0
- package/es/utils/extrude_polyline.d.ts +53 -0
- package/es/utils/extrude_polyline.js +319 -0
- package/es/utils/grid-index.d.ts +28 -0
- package/es/utils/grid-index.js +128 -0
- package/es/utils/identityScale.d.ts +8 -0
- package/es/utils/identityScale.js +26 -0
- package/es/utils/load-image.d.ts +1 -0
- package/es/utils/load-image.js +22 -0
- package/es/utils/multiPassRender.d.ts +16 -0
- package/es/utils/multiPassRender.js +37 -0
- package/es/utils/polylineNormal.d.ts +9 -0
- package/es/utils/polylineNormal.js +182 -0
- package/es/utils/rampcolor_legend.d.ts +6 -0
- package/es/utils/rampcolor_legend.js +12 -0
- package/es/utils/scale.d.ts +87 -0
- package/es/utils/scale.js +595 -0
- package/es/utils/simpleLine.d.ts +23 -0
- package/es/utils/simpleLine.js +76 -0
- package/es/utils/stencil.d.ts +7 -0
- package/es/utils/stencil.js +49 -0
- package/es/utils/symbol-layout.d.ts +43 -0
- package/es/utils/symbol-layout.js +251 -0
- package/es/wind/index.d.ts +11 -0
- package/es/wind/index.js +34 -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 +213 -0
- package/es/wind/models/wind.d.ts +38 -0
- package/es/wind/models/wind.js +240 -0
- package/es/wind/models/windRender.d.ts +104 -0
- package/es/wind/models/windRender.js +333 -0
- package/es/wind/models/windShader.d.ts +12 -0
- package/es/wind/models/windShader.js +151 -0
- package/es/wind/shaders/wind_frag.glsl +9 -0
- package/es/wind/shaders/wind_vert.glsl +14 -0
- package/lib/canvas/index.d.ts +18 -0
- package/lib/canvas/index.js +79 -0
- package/lib/canvas/models/canvas.d.ts +23 -0
- package/lib/canvas/models/canvas.js +149 -0
- package/lib/canvas/models/constants.d.ts +2 -0
- package/lib/canvas/models/constants.js +12 -0
- package/lib/canvas/models/index.d.ts +2 -0
- package/lib/canvas/models/index.js +27 -0
- package/lib/citybuilding/building.d.ts +7 -0
- package/lib/citybuilding/building.js +33 -0
- package/lib/citybuilding/models/build.d.ts +33 -0
- package/lib/citybuilding/models/build.js +168 -0
- package/lib/citybuilding/shaders/build_frag.glsl +123 -0
- package/lib/citybuilding/shaders/build_vert.glsl +58 -0
- package/lib/core/BaseLayer.d.ts +265 -0
- package/lib/core/BaseLayer.js +1317 -0
- package/lib/core/BaseModel.d.ts +95 -0
- package/lib/core/BaseModel.js +375 -0
- package/lib/core/CommonStyleAttribute.d.ts +16 -0
- package/lib/core/CommonStyleAttribute.js +120 -0
- package/lib/core/LayerPickService.d.ts +12 -0
- package/lib/core/LayerPickService.js +110 -0
- package/lib/core/TextureService.d.ts +15 -0
- package/lib/core/TextureService.js +73 -0
- package/lib/core/constant.d.ts +6 -0
- package/lib/core/constant.js +25 -0
- package/lib/core/interface.d.ts +284 -0
- package/lib/core/interface.js +34 -0
- package/lib/core/line_trangluation.d.ts +19 -0
- package/lib/core/line_trangluation.js +94 -0
- package/lib/core/schema.d.ts +27 -0
- package/lib/core/schema.js +31 -0
- package/lib/core/shape/Path.d.ts +40 -0
- package/lib/core/shape/Path.js +81 -0
- package/lib/core/shape/arrow.d.ts +25 -0
- package/lib/core/shape/arrow.js +158 -0
- package/lib/core/shape/extrude.d.ts +17 -0
- package/lib/core/shape/extrude.js +142 -0
- package/lib/core/triangulation.d.ts +136 -0
- package/lib/core/triangulation.js +628 -0
- package/lib/core/utils.d.ts +5 -0
- package/lib/core/utils.js +44 -0
- package/lib/earth/index.d.ts +22 -0
- package/lib/earth/index.js +62 -0
- package/lib/earth/models/atmosphere.d.ts +30 -0
- package/lib/earth/models/atmosphere.js +124 -0
- package/lib/earth/models/base.d.ts +37 -0
- package/lib/earth/models/base.js +180 -0
- package/lib/earth/models/bloomsphere.d.ts +30 -0
- package/lib/earth/models/bloomsphere.js +123 -0
- package/lib/earth/shaders/atmosphere/atmosphere_frag.glsl +17 -0
- package/lib/earth/shaders/atmosphere/atmosphere_vert.glsl +24 -0
- package/lib/earth/shaders/base/base_frag.glsl +11 -0
- package/lib/earth/shaders/base/base_vert.glsl +52 -0
- package/lib/earth/shaders/bloomshpere/bloomsphere_frag.glsl +15 -0
- package/lib/earth/shaders/bloomshpere/bloomsphere_vert.glsl +20 -0
- package/lib/earth/utils.d.ts +26 -0
- package/lib/earth/utils.js +107 -0
- package/lib/geometry/index.d.ts +22 -0
- package/lib/geometry/index.js +61 -0
- package/lib/geometry/models/billboard.d.ts +39 -0
- package/lib/geometry/models/billboard.js +183 -0
- package/lib/geometry/models/index.d.ts +5 -0
- package/lib/geometry/models/index.js +16 -0
- package/lib/geometry/models/plane.d.ts +58 -0
- package/lib/geometry/models/plane.js +316 -0
- package/lib/geometry/models/sprite.d.ts +48 -0
- package/lib/geometry/models/sprite.js +233 -0
- package/lib/geometry/shaders/billboard_frag.glsl +18 -0
- package/lib/geometry/shaders/billboard_vert.glsl +43 -0
- package/lib/geometry/shaders/plane_frag.glsl +23 -0
- package/lib/geometry/shaders/plane_vert.glsl +31 -0
- package/lib/geometry/shaders/sprite_frag.glsl +23 -0
- package/lib/geometry/shaders/sprite_vert.glsl +21 -0
- package/lib/heatmap/index.d.ts +13 -0
- package/lib/heatmap/index.js +95 -0
- package/lib/heatmap/models/grid.d.ts +29 -0
- package/lib/heatmap/models/grid.js +91 -0
- package/lib/heatmap/models/grid3d.d.ts +31 -0
- package/lib/heatmap/models/grid3d.js +130 -0
- package/lib/heatmap/models/heatmap.d.ts +46 -0
- package/lib/heatmap/models/heatmap.js +455 -0
- package/lib/heatmap/models/hexagon.d.ts +29 -0
- package/lib/heatmap/models/hexagon.js +91 -0
- package/lib/heatmap/models/index.d.ts +5 -0
- package/lib/heatmap/models/index.js +19 -0
- package/lib/heatmap/shaders/grid/grid_frag.glsl +9 -0
- package/lib/heatmap/shaders/grid/grid_vert.glsl +30 -0
- package/lib/heatmap/shaders/grid3d/grid_3d_frag.glsl +17 -0
- package/lib/heatmap/shaders/grid3d/grid_3d_vert.glsl +34 -0
- package/lib/heatmap/shaders/heatmap/heatmap_3d_frag.glsl +23 -0
- package/lib/heatmap/shaders/heatmap/heatmap_3d_vert.glsl +59 -0
- package/lib/heatmap/shaders/heatmap/heatmap_frag.glsl +40 -0
- package/lib/heatmap/shaders/heatmap/heatmap_framebuffer_frag.glsl +17 -0
- package/lib/heatmap/shaders/heatmap/heatmap_framebuffer_vert.glsl +36 -0
- package/lib/heatmap/shaders/heatmap/heatmap_vert.glsl +21 -0
- package/lib/heatmap/shaders/hexagon/hexagon_frag.glsl +8 -0
- package/lib/heatmap/shaders/hexagon/hexagon_vert.glsl +30 -0
- package/lib/heatmap/triangulation.d.ts +5 -0
- package/lib/heatmap/triangulation.js +39 -0
- package/lib/image/index.d.ts +9 -0
- package/lib/image/index.js +36 -0
- package/lib/image/models/image.d.ts +31 -0
- package/lib/image/models/image.js +121 -0
- package/lib/image/models/index.d.ts +5 -0
- package/lib/image/models/index.js +12 -0
- package/lib/image/shaders/dataImage_frag.glsl +32 -0
- package/lib/image/shaders/image_frag.glsl +38 -0
- package/lib/image/shaders/image_vert.glsl +20 -0
- package/lib/index.d.ts +18 -0
- package/lib/index.js +148 -0
- package/lib/line/index.d.ts +36 -0
- package/lib/line/index.js +98 -0
- package/lib/line/models/arc.d.ts +40 -0
- package/lib/line/models/arc.js +287 -0
- package/lib/line/models/arc_3d.d.ts +40 -0
- package/lib/line/models/arc_3d.js +277 -0
- package/lib/line/models/flow.d.ts +31 -0
- package/lib/line/models/flow.js +148 -0
- package/lib/line/models/great_circle.d.ts +34 -0
- package/lib/line/models/great_circle.js +248 -0
- package/lib/line/models/index.d.ts +5 -0
- package/lib/line/models/index.js +25 -0
- package/lib/line/models/line.d.ts +44 -0
- package/lib/line/models/line.js +281 -0
- package/lib/line/models/simple_line.d.ts +33 -0
- package/lib/line/models/simple_line.js +126 -0
- package/lib/line/models/wall.d.ts +34 -0
- package/lib/line/models/wall.js +231 -0
- package/lib/line/shaders/arc/line_arc_frag.glsl +92 -0
- package/lib/line/shaders/arc/line_arc_vert.glsl +156 -0
- package/lib/line/shaders/arc3d/line_arc_3d_frag.glsl +108 -0
- package/lib/line/shaders/arc3d/line_arc_3d_vert.glsl +177 -0
- package/lib/line/shaders/flow/flow_line_frag.glsl +13 -0
- package/lib/line/shaders/flow/flow_line_vert.glsl +76 -0
- package/lib/line/shaders/greatCircle/line_arc_great_circle_frag.glsl +99 -0
- package/lib/line/shaders/greatCircle/line_arc_great_circle_vert.glsl +165 -0
- package/lib/line/shaders/line/line_frag.glsl +122 -0
- package/lib/line/shaders/line/line_vert.glsl +101 -0
- package/lib/line/shaders/simple/simpleline_frag.glsl +30 -0
- package/lib/line/shaders/simple/simpleline_vert.glsl +45 -0
- package/lib/line/shaders/wall/wall_frag.glsl +94 -0
- package/lib/line/shaders/wall/wall_vert.glsl +90 -0
- package/lib/mask/index.d.ts +16 -0
- package/lib/mask/index.js +29 -0
- package/lib/mask/models/fill.d.ts +18 -0
- package/lib/mask/models/fill.js +69 -0
- package/lib/mask/models/index.d.ts +5 -0
- package/lib/mask/models/index.js +12 -0
- package/lib/mask/shaders/mask_vert.glsl +14 -0
- package/lib/plugins/DataMappingPlugin.d.ts +12 -0
- package/lib/plugins/DataMappingPlugin.js +234 -0
- package/lib/plugins/DataSourcePlugin.d.ts +6 -0
- package/lib/plugins/DataSourcePlugin.js +83 -0
- package/lib/plugins/FeatureScalePlugin.d.ts +20 -0
- package/lib/plugins/FeatureScalePlugin.js +303 -0
- package/lib/plugins/LayerAnimateStylePlugin.d.ts +4 -0
- package/lib/plugins/LayerAnimateStylePlugin.js +22 -0
- package/lib/plugins/LayerMaskPlugin.d.ts +7 -0
- package/lib/plugins/LayerMaskPlugin.js +26 -0
- package/lib/plugins/LayerModelPlugin.d.ts +10 -0
- package/lib/plugins/LayerModelPlugin.js +68 -0
- package/lib/plugins/LayerStylePlugin.d.ts +7 -0
- package/lib/plugins/LayerStylePlugin.js +25 -0
- package/lib/plugins/LightingPlugin.d.ts +35 -0
- package/lib/plugins/LightingPlugin.js +93 -0
- package/lib/plugins/MultiPassRendererPlugin.d.ts +22 -0
- package/lib/plugins/MultiPassRendererPlugin.js +59 -0
- package/lib/plugins/PixelPickingPlugin.d.ts +11 -0
- package/lib/plugins/PixelPickingPlugin.js +154 -0
- package/lib/plugins/RegisterStyleAttributePlugin.d.ts +10 -0
- package/lib/plugins/RegisterStyleAttributePlugin.js +78 -0
- package/lib/plugins/ShaderUniformPlugin.d.ts +17 -0
- package/lib/plugins/ShaderUniformPlugin.js +203 -0
- package/lib/plugins/UpdateModelPlugin.d.ts +7 -0
- package/lib/plugins/UpdateModelPlugin.js +27 -0
- package/lib/plugins/UpdateStyleAttributePlugin.d.ts +9 -0
- package/lib/plugins/UpdateStyleAttributePlugin.js +61 -0
- package/lib/plugins/index.d.ts +15 -0
- package/lib/plugins/index.js +26 -0
- package/lib/point/index.d.ts +35 -0
- package/lib/point/index.js +161 -0
- package/lib/point/models/billboard_point.d.ts +35 -0
- package/lib/point/models/billboard_point.js +104 -0
- package/lib/point/models/earthExtrude.d.ts +32 -0
- package/lib/point/models/earthExtrude.js +207 -0
- package/lib/point/models/earthFill.d.ts +31 -0
- package/lib/point/models/earthFill.js +166 -0
- package/lib/point/models/extrude.d.ts +32 -0
- package/lib/point/models/extrude.js +203 -0
- package/lib/point/models/fill.d.ts +47 -0
- package/lib/point/models/fill.js +188 -0
- package/lib/point/models/fillImage.d.ts +42 -0
- package/lib/point/models/fillImage.js +197 -0
- package/lib/point/models/image.d.ts +48 -0
- package/lib/point/models/image.js +301 -0
- package/lib/point/models/index.d.ts +5 -0
- package/lib/point/models/index.js +32 -0
- package/lib/point/models/normal.d.ts +36 -0
- package/lib/point/models/normal.js +98 -0
- package/lib/point/models/radar.d.ts +37 -0
- package/lib/point/models/radar.js +123 -0
- package/lib/point/models/text.d.ts +85 -0
- package/lib/point/models/text.js +512 -0
- package/lib/point/shaders/billboard/billboard_point_frag.glsl +48 -0
- package/lib/point/shaders/billboard/billboard_point_vert.glsl +33 -0
- package/lib/point/shaders/earthExtrude/earthExtrude_frag.glsl +36 -0
- package/lib/point/shaders/earthExtrude/earthExtrude_vert.glsl +118 -0
- package/lib/point/shaders/earthFill/earthFill_frag.glsl +79 -0
- package/lib/point/shaders/earthFill/earthFill_vert.glsl +46 -0
- package/lib/point/shaders/extrude/extrude_frag.glsl +29 -0
- package/lib/point/shaders/extrude/extrude_vert.glsl +95 -0
- package/lib/point/shaders/fill/fill_frag.glsl +97 -0
- package/lib/point/shaders/fill/fill_vert.glsl +79 -0
- package/lib/point/shaders/fillImage/fillImage_frag.glsl +23 -0
- package/lib/point/shaders/fillImage/fillImage_vert.glsl +46 -0
- package/lib/point/shaders/image/image_frag.glsl +45 -0
- package/lib/point/shaders/image/image_vert.glsl +47 -0
- package/lib/point/shaders/normal/normal_frag.glsl +5 -0
- package/lib/point/shaders/normal/normal_vert.glsl +22 -0
- package/lib/point/shaders/radar/radar_frag.glsl +52 -0
- package/lib/point/shaders/radar/radar_vert.glsl +53 -0
- package/lib/point/shaders/text/text_frag.glsl +47 -0
- package/lib/point/shaders/text/text_vert.glsl +65 -0
- package/lib/point/shape/extrude.d.ts +15 -0
- package/lib/point/shape/extrude.js +56 -0
- package/lib/polygon/index.d.ts +18 -0
- package/lib/polygon/index.js +79 -0
- package/lib/polygon/models/extrude.d.ts +41 -0
- package/lib/polygon/models/extrude.js +256 -0
- package/lib/polygon/models/extrusion.d.ts +40 -0
- package/lib/polygon/models/extrusion.js +145 -0
- package/lib/polygon/models/fill.d.ts +32 -0
- package/lib/polygon/models/fill.js +135 -0
- package/lib/polygon/models/index.d.ts +5 -0
- package/lib/polygon/models/index.js +33 -0
- package/lib/polygon/models/ocean.d.ts +37 -0
- package/lib/polygon/models/ocean.js +180 -0
- package/lib/polygon/models/water.d.ts +35 -0
- package/lib/polygon/models/water.js +158 -0
- package/lib/polygon/shaders/extrude/polygon_extrude_frag.glsl +24 -0
- package/lib/polygon/shaders/extrude/polygon_extrude_picklight_frag.glsl +49 -0
- package/lib/polygon/shaders/extrude/polygon_extrude_picklight_vert.glsl +53 -0
- package/lib/polygon/shaders/extrude/polygon_extrude_vert.glsl +74 -0
- package/lib/polygon/shaders/extrude/polygon_extrudetex_frag.glsl +55 -0
- package/lib/polygon/shaders/extrude/polygon_extrudetex_vert.glsl +54 -0
- package/lib/polygon/shaders/extrusion/polygon_extrusion_frag.glsl +8 -0
- package/lib/polygon/shaders/extrusion/polygon_extrusion_vert.glsl +24 -0
- package/lib/polygon/shaders/fill/fill_frag.glsl +8 -0
- package/lib/polygon/shaders/fill/fill_linear_frag.glsl +23 -0
- package/lib/polygon/shaders/fill/fill_linear_vert.glsl +36 -0
- package/lib/polygon/shaders/fill/fill_vert.glsl +35 -0
- package/lib/polygon/shaders/ocean/ocean_frag.glsl +277 -0
- package/lib/polygon/shaders/ocean/ocean_vert.glsl +21 -0
- package/lib/polygon/shaders/water/polygon_water_frag.glsl +78 -0
- package/lib/polygon/shaders/water/polygon_water_vert.glsl +22 -0
- package/lib/raster/buffers/triangulation.d.ts +6 -0
- package/lib/raster/buffers/triangulation.js +33 -0
- package/lib/raster/index.d.ts +11 -0
- package/lib/raster/index.js +63 -0
- package/lib/raster/models/index.d.ts +5 -0
- package/lib/raster/models/index.js +17 -0
- package/lib/raster/models/raster.d.ts +35 -0
- package/lib/raster/models/raster.js +164 -0
- package/lib/raster/models/rasterRgb.d.ts +35 -0
- package/lib/raster/models/rasterRgb.js +166 -0
- package/lib/raster/models/rasterTerrainRgb.d.ts +30 -0
- package/lib/raster/models/rasterTerrainRgb.js +126 -0
- package/lib/raster/shaders/raster/raster_2d_frag.glsl +37 -0
- package/lib/raster/shaders/raster/raster_2d_vert.glsl +21 -0
- package/lib/raster/shaders/rgb/raster_rgb_frag.glsl +30 -0
- package/lib/raster/shaders/rgb/raster_rgb_vert.glsl +21 -0
- package/lib/raster/shaders/terrain/terrain_rgb_frag.glsl +40 -0
- package/lib/raster/shaders/terrain/terrain_rgb_vert.glsl +19 -0
- package/lib/shader/minify_frag.glsl +11 -0
- package/lib/shader/minify_picking_frag.glsl +10 -0
- package/lib/tile/core/BaseLayer.d.ts +50 -0
- package/lib/tile/core/BaseLayer.js +264 -0
- package/lib/tile/core/TileDebugLayer.d.ts +15 -0
- package/lib/tile/core/TileDebugLayer.js +31 -0
- package/lib/tile/interaction/getFeatureData.d.ts +0 -0
- package/lib/tile/interaction/getFeatureData.js +1 -0
- package/lib/tile/interaction/getRasterData.d.ts +4 -0
- package/lib/tile/interaction/getRasterData.js +52 -0
- package/lib/tile/interaction/utils.d.ts +11 -0
- package/lib/tile/interaction/utils.js +81 -0
- package/lib/tile/interface.d.ts +29 -0
- package/lib/tile/interface.js +5 -0
- package/lib/tile/service/TileLayerService.d.ts +58 -0
- package/lib/tile/service/TileLayerService.js +203 -0
- package/lib/tile/service/TilePickService.d.ts +26 -0
- package/lib/tile/service/TilePickService.js +134 -0
- package/lib/tile/service/TileSourceService.d.ts +7 -0
- package/lib/tile/service/TileSourceService.js +35 -0
- package/lib/tile/tile/DebugTile.d.ts +16 -0
- package/lib/tile/tile/DebugTile.js +55 -0
- package/lib/tile/tile/ImageTile.d.ts +14 -0
- package/lib/tile/tile/ImageTile.js +47 -0
- package/lib/tile/tile/MaskTile.d.ts +18 -0
- package/lib/tile/tile/MaskTile.js +62 -0
- package/lib/tile/tile/RasterRGBTile.d.ts +11 -0
- package/lib/tile/tile/RasterRGBTile.js +55 -0
- package/lib/tile/tile/RasterTerrainRGBTile.d.ts +14 -0
- package/lib/tile/tile/RasterTerrainRGBTile.js +47 -0
- package/lib/tile/tile/RasterTile.d.ts +18 -0
- package/lib/tile/tile/RasterTile.js +89 -0
- package/lib/tile/tile/Tile.d.ts +112 -0
- package/lib/tile/tile/Tile.js +174 -0
- package/lib/tile/tile/VectorTile.d.ts +26 -0
- package/lib/tile/tile/VectorTile.js +95 -0
- package/lib/tile/tile/index.d.ts +12 -0
- package/lib/tile/tile/index.js +76 -0
- package/lib/tile/tile/util.d.ts +5 -0
- package/lib/tile/tile/util.js +26 -0
- package/lib/tile/utils/constants.d.ts +1 -0
- package/lib/tile/utils/constants.js +14 -0
- package/lib/tile/utils/utils.d.ts +8 -0
- package/lib/tile/utils/utils.js +18 -0
- package/lib/utils/blend.d.ts +2 -0
- package/lib/utils/blend.js +63 -0
- package/lib/utils/collision-index.d.ts +47 -0
- package/lib/utils/collision-index.js +96 -0
- package/lib/utils/extrude_polyline.d.ts +53 -0
- package/lib/utils/extrude_polyline.js +331 -0
- package/lib/utils/grid-index.d.ts +28 -0
- package/lib/utils/grid-index.js +135 -0
- package/lib/utils/identityScale.d.ts +8 -0
- package/lib/utils/identityScale.js +32 -0
- package/lib/utils/load-image.d.ts +1 -0
- package/lib/utils/load-image.js +29 -0
- package/lib/utils/multiPassRender.d.ts +16 -0
- package/lib/utils/multiPassRender.js +44 -0
- package/lib/utils/polylineNormal.d.ts +9 -0
- package/lib/utils/polylineNormal.js +191 -0
- package/lib/utils/rampcolor_legend.d.ts +6 -0
- package/lib/utils/rampcolor_legend.js +18 -0
- package/lib/utils/scale.d.ts +87 -0
- package/lib/utils/scale.js +610 -0
- package/lib/utils/simpleLine.d.ts +23 -0
- package/lib/utils/simpleLine.js +85 -0
- package/lib/utils/stencil.d.ts +7 -0
- package/lib/utils/stencil.js +56 -0
- package/lib/utils/symbol-layout.d.ts +43 -0
- package/lib/utils/symbol-layout.js +258 -0
- package/lib/wind/index.d.ts +11 -0
- package/lib/wind/index.js +42 -0
- package/lib/wind/models/index.d.ts +5 -0
- package/lib/wind/models/index.js +12 -0
- package/lib/wind/models/utils.d.ts +19 -0
- package/lib/wind/models/utils.js +229 -0
- package/lib/wind/models/wind.d.ts +38 -0
- package/lib/wind/models/wind.js +248 -0
- package/lib/wind/models/windRender.d.ts +104 -0
- package/lib/wind/models/windRender.js +343 -0
- package/lib/wind/models/windShader.d.ts +12 -0
- package/lib/wind/models/windShader.js +157 -0
- package/lib/wind/shaders/wind_frag.glsl +9 -0
- package/lib/wind/shaders/wind_vert.glsl +14 -0
- package/package.json +6 -6
|
@@ -0,0 +1,601 @@
|
|
|
1
|
+
import { aProjectFlat, calculateCentroid, calculatePointsCenterAndRadius, lngLatToMeters } from '@antv/l7-utils';
|
|
2
|
+
import earcut from 'earcut';
|
|
3
|
+
// @ts-ignore
|
|
4
|
+
import { vec3 } from 'gl-matrix';
|
|
5
|
+
import { EARTH_RADIUS, EARTH_RADIUS_OUTER, EARTH_SEGMENTS, lglt2xyz, primitiveSphere } from "../earth/utils";
|
|
6
|
+
import ExtrudePolyline from "../utils/extrude_polyline";
|
|
7
|
+
import { geometryShape } from "./shape/Path";
|
|
8
|
+
import extrudePolygon, { extrude_PolygonNormal, fillPolygon } from "./shape/extrude";
|
|
9
|
+
import { getPolygonSurfaceIndices } from "./utils";
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* 质心计算缓存
|
|
13
|
+
* 避免对相同坐标的重复计算
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
const centroidCache = {};
|
|
17
|
+
const CENTROID_CACHE_MAX_SIZE = 500;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* 生成坐标的缓存键
|
|
21
|
+
*/
|
|
22
|
+
function getCoordinateKey(coordinates) {
|
|
23
|
+
if (typeof coordinates === 'number') {
|
|
24
|
+
return String(coordinates);
|
|
25
|
+
}
|
|
26
|
+
if (Array.isArray(coordinates)) {
|
|
27
|
+
if (typeof coordinates[0] === 'number') {
|
|
28
|
+
return coordinates.slice(0, 2).join(',');
|
|
29
|
+
}
|
|
30
|
+
// 对于嵌套数组,取第一个点
|
|
31
|
+
return getCoordinateKey(coordinates[0]);
|
|
32
|
+
}
|
|
33
|
+
return '';
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* 带缓存的质心计算
|
|
38
|
+
*/
|
|
39
|
+
function cachedCalculateCentroid(coordinates) {
|
|
40
|
+
const key = getCoordinateKey(coordinates);
|
|
41
|
+
if (key && centroidCache[key]) {
|
|
42
|
+
return centroidCache[key].slice();
|
|
43
|
+
}
|
|
44
|
+
const centroid = calculateCentroid(coordinates);
|
|
45
|
+
|
|
46
|
+
// 限制缓存大小
|
|
47
|
+
const keys = Object.keys(centroidCache);
|
|
48
|
+
if (keys.length >= CENTROID_CACHE_MAX_SIZE) {
|
|
49
|
+
// 删除一半的缓存
|
|
50
|
+
const deleteCount = Math.floor(CENTROID_CACHE_MAX_SIZE / 2);
|
|
51
|
+
for (let i = 0; i < deleteCount; i++) {
|
|
52
|
+
delete centroidCache[keys[i]];
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
if (key) {
|
|
56
|
+
centroidCache[key] = centroid.slice();
|
|
57
|
+
}
|
|
58
|
+
return centroid;
|
|
59
|
+
}
|
|
60
|
+
const GeometryCache = {};
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* 计算2D 填充点图顶点
|
|
64
|
+
* @param feature 映射feature
|
|
65
|
+
*/
|
|
66
|
+
|
|
67
|
+
export function PointFillTriangulation(feature) {
|
|
68
|
+
const coordinates = cachedCalculateCentroid(feature.coordinates);
|
|
69
|
+
return {
|
|
70
|
+
vertices: [...coordinates, ...coordinates, ...coordinates, ...coordinates],
|
|
71
|
+
indices: [0, 1, 2, 2, 3, 0],
|
|
72
|
+
size: coordinates.length
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* 计算2D 填充点图顶点 (地球模式)
|
|
77
|
+
* @param feature 映射feature
|
|
78
|
+
*/
|
|
79
|
+
export function GlobelPointFillTriangulation(feature) {
|
|
80
|
+
const coordinates = calculateCentroid(feature.coordinates);
|
|
81
|
+
const xyz = lglt2xyz(coordinates);
|
|
82
|
+
return {
|
|
83
|
+
vertices: [...xyz, ...xyz, ...xyz, ...xyz],
|
|
84
|
+
indices: [0, 1, 2, 2, 3, 0],
|
|
85
|
+
size: xyz.length
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* 计算3D 拉伸点图
|
|
91
|
+
* @param feature 映射feature
|
|
92
|
+
*/
|
|
93
|
+
export function PointExtrudeTriangulation(feature) {
|
|
94
|
+
const {
|
|
95
|
+
shape
|
|
96
|
+
} = feature;
|
|
97
|
+
const {
|
|
98
|
+
positions,
|
|
99
|
+
index,
|
|
100
|
+
normals
|
|
101
|
+
} = getGeometry(shape, false);
|
|
102
|
+
return {
|
|
103
|
+
vertices: positions,
|
|
104
|
+
indices: index,
|
|
105
|
+
normals,
|
|
106
|
+
size: 5
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* 计算图片标注
|
|
112
|
+
* @param feature 映射feature
|
|
113
|
+
*/
|
|
114
|
+
export function PointImageTriangulation(feature) {
|
|
115
|
+
// @ts-ignore
|
|
116
|
+
const that = this;
|
|
117
|
+
const id = feature.id;
|
|
118
|
+
// 当 imageFilterMap 存在且该 feature 未通过碰撞检测时,返回空几何(等效隐藏)
|
|
119
|
+
if (that !== null && that !== void 0 && that.imageFilterMap && !that.imageFilterMap[id]) {
|
|
120
|
+
return {
|
|
121
|
+
vertices: [],
|
|
122
|
+
indices: [],
|
|
123
|
+
size: 3
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
const coordinates = calculateCentroid(feature.coordinates);
|
|
127
|
+
return {
|
|
128
|
+
vertices: [...coordinates],
|
|
129
|
+
indices: [0],
|
|
130
|
+
size: coordinates.length
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* 线三角化
|
|
136
|
+
* @param feature 映射feature
|
|
137
|
+
*/
|
|
138
|
+
export function LineTriangulation(feature) {
|
|
139
|
+
const {
|
|
140
|
+
coordinates
|
|
141
|
+
} = feature;
|
|
142
|
+
// let path = coordinates as number[][][] | number[][];
|
|
143
|
+
// if (!Array.isArray(path[0][0])) {
|
|
144
|
+
// path = [coordinates] as number[][][];
|
|
145
|
+
// }
|
|
146
|
+
|
|
147
|
+
const line = new ExtrudePolyline({
|
|
148
|
+
dash: true,
|
|
149
|
+
join: 'bevel'
|
|
150
|
+
});
|
|
151
|
+
let path = coordinates;
|
|
152
|
+
if (path[0] && !Array.isArray(path[0][0])) {
|
|
153
|
+
path = [coordinates];
|
|
154
|
+
}
|
|
155
|
+
path.forEach(item => {
|
|
156
|
+
line.extrude(item);
|
|
157
|
+
});
|
|
158
|
+
const linebuffer = line.complex;
|
|
159
|
+
return {
|
|
160
|
+
vertices: linebuffer.positions,
|
|
161
|
+
// [ x,y,z, distance, miter,total ]
|
|
162
|
+
indices: linebuffer.indices,
|
|
163
|
+
normals: linebuffer.normals,
|
|
164
|
+
indexes: linebuffer.indexes,
|
|
165
|
+
size: 6
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
export function FlowLineFillTriangulation(feature) {
|
|
169
|
+
// @ts-ignore
|
|
170
|
+
const coord = feature.coordinates.flat();
|
|
171
|
+
const tin = 1;
|
|
172
|
+
const tout = 1.0;
|
|
173
|
+
return {
|
|
174
|
+
vertices: [1, 0, 0, ...coord,
|
|
175
|
+
// 0
|
|
176
|
+
1, 2, -3,
|
|
177
|
+
// mapbox 为正
|
|
178
|
+
...coord,
|
|
179
|
+
// 1
|
|
180
|
+
1, 1, -3,
|
|
181
|
+
// mapbox 为正
|
|
182
|
+
...coord,
|
|
183
|
+
// 2
|
|
184
|
+
0, 1, 0, ...coord,
|
|
185
|
+
// 3
|
|
186
|
+
0, 0, 0, ...coord,
|
|
187
|
+
// 4
|
|
188
|
+
1, 0, 0, ...coord,
|
|
189
|
+
// 0
|
|
190
|
+
1, 2, -3,
|
|
191
|
+
// mapbox 为正
|
|
192
|
+
...coord,
|
|
193
|
+
// 1
|
|
194
|
+
1, 1, -3,
|
|
195
|
+
// // mapbox 为正
|
|
196
|
+
...coord,
|
|
197
|
+
// 2
|
|
198
|
+
0, 1, 0, ...coord,
|
|
199
|
+
// 3
|
|
200
|
+
0, 0, 0, ...coord // 4
|
|
201
|
+
],
|
|
202
|
+
normals: [-tin, 2 * tout, 1,
|
|
203
|
+
// 0
|
|
204
|
+
2 * tout, -tout, 1,
|
|
205
|
+
// 1
|
|
206
|
+
tout, -tout, 1,
|
|
207
|
+
// 2
|
|
208
|
+
tout, -tout, 1,
|
|
209
|
+
// 3
|
|
210
|
+
-tin, -tout, 1,
|
|
211
|
+
// 4
|
|
212
|
+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
|
213
|
+
indices: [0, 1, 2, 0, 2, 3, 0, 3, 4, 5, 6, 7, 5, 7, 8, 5, 8, 9],
|
|
214
|
+
size: 7
|
|
215
|
+
};
|
|
216
|
+
}
|
|
217
|
+
export function SimpleLineTriangulation(feature) {
|
|
218
|
+
const {
|
|
219
|
+
coordinates
|
|
220
|
+
} = feature;
|
|
221
|
+
const pos = [];
|
|
222
|
+
if (!Array.isArray(coordinates[0])) {
|
|
223
|
+
return {
|
|
224
|
+
vertices: [],
|
|
225
|
+
indices: [],
|
|
226
|
+
normals: [],
|
|
227
|
+
size: 6,
|
|
228
|
+
count: 0
|
|
229
|
+
};
|
|
230
|
+
}
|
|
231
|
+
const {
|
|
232
|
+
results,
|
|
233
|
+
totalDistance
|
|
234
|
+
} = getSimpleLineVertices(coordinates);
|
|
235
|
+
results.map(point => {
|
|
236
|
+
pos.push(point[0], point[1], point[2], point[3], 0, totalDistance);
|
|
237
|
+
});
|
|
238
|
+
return {
|
|
239
|
+
vertices: pos,
|
|
240
|
+
indices: [],
|
|
241
|
+
normals: [],
|
|
242
|
+
size: 6,
|
|
243
|
+
count: results.length
|
|
244
|
+
};
|
|
245
|
+
}
|
|
246
|
+
export function TileSimpleLineTriangulation(feature) {
|
|
247
|
+
const {
|
|
248
|
+
coordinates
|
|
249
|
+
} = feature;
|
|
250
|
+
const pos = [];
|
|
251
|
+
if (!Array.isArray(coordinates[0])) {
|
|
252
|
+
return {
|
|
253
|
+
vertices: [],
|
|
254
|
+
indices: [],
|
|
255
|
+
size: 4,
|
|
256
|
+
count: 0
|
|
257
|
+
};
|
|
258
|
+
}
|
|
259
|
+
const {
|
|
260
|
+
results
|
|
261
|
+
} = getTileSimpleLineVertices(coordinates);
|
|
262
|
+
results.map(point => {
|
|
263
|
+
pos.push(point[0], point[1], point[2], point[3]);
|
|
264
|
+
});
|
|
265
|
+
return {
|
|
266
|
+
vertices: pos,
|
|
267
|
+
indices: [],
|
|
268
|
+
size: 4,
|
|
269
|
+
count: results.length
|
|
270
|
+
};
|
|
271
|
+
}
|
|
272
|
+
function lineSegmentDistance(b1, a1) {
|
|
273
|
+
const dx = a1[0] - b1[0];
|
|
274
|
+
const dy = a1[1] - b1[1];
|
|
275
|
+
return Math.sqrt(dx * dx + dy * dy);
|
|
276
|
+
}
|
|
277
|
+
function pushDis(point, n) {
|
|
278
|
+
if (point.length < 3) {
|
|
279
|
+
point.push(0);
|
|
280
|
+
}
|
|
281
|
+
if (n !== undefined) {
|
|
282
|
+
point.push(n);
|
|
283
|
+
}
|
|
284
|
+
return point;
|
|
285
|
+
}
|
|
286
|
+
function getSimpleLineVertices(coordinates) {
|
|
287
|
+
let points = coordinates;
|
|
288
|
+
if (Array.isArray(points) && Array.isArray(points[0]) && Array.isArray(points[0][0])) {
|
|
289
|
+
// @ts-ignore
|
|
290
|
+
points = coordinates.flat();
|
|
291
|
+
}
|
|
292
|
+
//修改计算距离的方式,与普通线的计算方式保持一致 edit by huyang 20231214
|
|
293
|
+
let distance = 0;
|
|
294
|
+
if (points.length < 2) {
|
|
295
|
+
return {
|
|
296
|
+
results: points,
|
|
297
|
+
totalDistance: 0
|
|
298
|
+
};
|
|
299
|
+
} else {
|
|
300
|
+
const results = [];
|
|
301
|
+
const point = pushDis(points[0], distance);
|
|
302
|
+
results.push(point);
|
|
303
|
+
for (let i = 1; i < points.length - 1; i++) {
|
|
304
|
+
const subDistance = lineSegmentDistance(aProjectFlat(points[i - 1]), aProjectFlat(points[i]));
|
|
305
|
+
distance += subDistance;
|
|
306
|
+
const mulPoint = pushDis(points[i], distance);
|
|
307
|
+
results.push(mulPoint);
|
|
308
|
+
results.push(mulPoint);
|
|
309
|
+
}
|
|
310
|
+
const pointDistance = lineSegmentDistance(aProjectFlat(points[points.length - 2]), aProjectFlat(points[points.length - 1]));
|
|
311
|
+
distance += pointDistance;
|
|
312
|
+
results.push(pushDis(points[points.length - 1], distance));
|
|
313
|
+
return {
|
|
314
|
+
results,
|
|
315
|
+
totalDistance: distance
|
|
316
|
+
};
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
function getTileSimpleLineVertices(points) {
|
|
320
|
+
if (points.length < 2) {
|
|
321
|
+
return {
|
|
322
|
+
results: points
|
|
323
|
+
};
|
|
324
|
+
} else {
|
|
325
|
+
const results = [];
|
|
326
|
+
const point = pushDis(points[0]);
|
|
327
|
+
results.push(point);
|
|
328
|
+
for (let i = 1; i < points.length - 1; i++) {
|
|
329
|
+
const mulPoint = pushDis(points[i]);
|
|
330
|
+
results.push(mulPoint);
|
|
331
|
+
results.push(mulPoint);
|
|
332
|
+
}
|
|
333
|
+
results.push(pushDis(points[points.length - 1]));
|
|
334
|
+
return {
|
|
335
|
+
results
|
|
336
|
+
};
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
export function polygonTriangulation(feature) {
|
|
340
|
+
const {
|
|
341
|
+
coordinates
|
|
342
|
+
} = feature;
|
|
343
|
+
const flattengeo = earcut.flatten(coordinates);
|
|
344
|
+
const {
|
|
345
|
+
vertices,
|
|
346
|
+
dimensions,
|
|
347
|
+
holes
|
|
348
|
+
} = flattengeo;
|
|
349
|
+
const indices = getPolygonSurfaceIndices(vertices, holes, dimensions);
|
|
350
|
+
return {
|
|
351
|
+
indices,
|
|
352
|
+
vertices,
|
|
353
|
+
size: dimensions
|
|
354
|
+
};
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
// 构建几何图形(带有中心点和大小)
|
|
358
|
+
export function polygonTriangulationWithCenter(feature) {
|
|
359
|
+
const {
|
|
360
|
+
indices,
|
|
361
|
+
vertices,
|
|
362
|
+
size
|
|
363
|
+
} = polygonTriangulation(feature);
|
|
364
|
+
return {
|
|
365
|
+
indices: indices,
|
|
366
|
+
vertices: getVerticesWithCenter(vertices),
|
|
367
|
+
size: size + 4
|
|
368
|
+
};
|
|
369
|
+
}
|
|
370
|
+
function getVerticesWithCenter(vertices) {
|
|
371
|
+
const verticesWithCenter = [];
|
|
372
|
+
const {
|
|
373
|
+
center,
|
|
374
|
+
radius
|
|
375
|
+
} = calculatePointsCenterAndRadius(vertices);
|
|
376
|
+
for (let i = 0; i < vertices.length; i += 2) {
|
|
377
|
+
const lng = vertices[i];
|
|
378
|
+
const lat = vertices[i + 1];
|
|
379
|
+
verticesWithCenter.push(lng, lat, 0, ...center, radius);
|
|
380
|
+
}
|
|
381
|
+
return verticesWithCenter;
|
|
382
|
+
}
|
|
383
|
+
export function PolygonExtrudeTriangulation(feature) {
|
|
384
|
+
const coordinates = feature.coordinates;
|
|
385
|
+
const {
|
|
386
|
+
positions,
|
|
387
|
+
index,
|
|
388
|
+
normals
|
|
389
|
+
} = extrude_PolygonNormal(coordinates, true);
|
|
390
|
+
return {
|
|
391
|
+
vertices: positions,
|
|
392
|
+
// [ x, y, z, uv.x,uv.y ]
|
|
393
|
+
indices: index,
|
|
394
|
+
normals,
|
|
395
|
+
size: 5
|
|
396
|
+
};
|
|
397
|
+
}
|
|
398
|
+
export function HeatmapGridTriangulation(feature) {
|
|
399
|
+
const {
|
|
400
|
+
shape
|
|
401
|
+
} = feature;
|
|
402
|
+
const {
|
|
403
|
+
positions,
|
|
404
|
+
index
|
|
405
|
+
} = getHeatmapGeometry(shape);
|
|
406
|
+
return {
|
|
407
|
+
vertices: positions,
|
|
408
|
+
// [ x, y, z ] 多边形顶点
|
|
409
|
+
indices: index,
|
|
410
|
+
size: 3
|
|
411
|
+
};
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
/**
|
|
415
|
+
* 图片图层顶点构造
|
|
416
|
+
* @param feature 数据
|
|
417
|
+
*/
|
|
418
|
+
export function RasterImageTriangulation(feature) {
|
|
419
|
+
const coordinates = feature.coordinates;
|
|
420
|
+
// [ x, y, z. uv.x, uv.y]
|
|
421
|
+
const positions = [...coordinates[0], 0, 0, 0, ...coordinates[1], 0, 1, 0, ...coordinates[2], 0, 1, 1, ...coordinates[3], 0, 0, 1];
|
|
422
|
+
const indexs = [0, 1, 2, 0, 2, 3];
|
|
423
|
+
return {
|
|
424
|
+
vertices: positions,
|
|
425
|
+
indices: indexs,
|
|
426
|
+
size: 5
|
|
427
|
+
};
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
/**
|
|
431
|
+
* 计算3D弧线顶点
|
|
432
|
+
* @param feature 映射数据
|
|
433
|
+
* @param segNum 弧线线段数
|
|
434
|
+
*/
|
|
435
|
+
export function LineArcTriangulation(feature, styleOption) {
|
|
436
|
+
// @ts-ignore
|
|
437
|
+
const {
|
|
438
|
+
segmentNumber = 30
|
|
439
|
+
} = styleOption;
|
|
440
|
+
const coordinates = feature.coordinates;
|
|
441
|
+
const positions = [];
|
|
442
|
+
const indexArray = [];
|
|
443
|
+
for (let i = 0; i < segmentNumber; i++) {
|
|
444
|
+
// 上线两个顶点
|
|
445
|
+
// [ x, y, z, sx,sy, tx,ty]
|
|
446
|
+
positions.push(i, 1, i, coordinates[0][0], coordinates[0][1], coordinates[1][0], coordinates[1][1], i, -1, i, coordinates[0][0], coordinates[0][1], coordinates[1][0], coordinates[1][1]);
|
|
447
|
+
if (i !== segmentNumber - 1) {
|
|
448
|
+
indexArray.push(...[0, 1, 2, 1, 3, 2].map(v => {
|
|
449
|
+
return i * 2 + v;
|
|
450
|
+
}));
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
return {
|
|
454
|
+
vertices: positions,
|
|
455
|
+
indices: indexArray,
|
|
456
|
+
size: 7
|
|
457
|
+
};
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
/**
|
|
461
|
+
* 构建热力图密度图的顶点
|
|
462
|
+
* @param feature
|
|
463
|
+
* @returns
|
|
464
|
+
*/
|
|
465
|
+
export function HeatmapTriangulation(feature) {
|
|
466
|
+
const coordinates = feature.coordinates;
|
|
467
|
+
if (coordinates.length === 2) {
|
|
468
|
+
coordinates.push(0);
|
|
469
|
+
}
|
|
470
|
+
const dir = addDir(-1, 1);
|
|
471
|
+
const dir1 = addDir(1, 1);
|
|
472
|
+
const dir2 = addDir(-1, -1);
|
|
473
|
+
const dir3 = addDir(1, -1);
|
|
474
|
+
// [x,y,z, dirx ,diry, weight]
|
|
475
|
+
const positions = [...coordinates, ...dir, ...coordinates, ...dir2, ...coordinates, ...dir3, ...coordinates, ...dir1];
|
|
476
|
+
const indexArray = [0, 1, 2, 3, 0, 2];
|
|
477
|
+
return {
|
|
478
|
+
vertices: positions,
|
|
479
|
+
indices: indexArray,
|
|
480
|
+
size: 5
|
|
481
|
+
};
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
/**
|
|
485
|
+
* 点图层3d geomerty
|
|
486
|
+
* @param shape 3D形状
|
|
487
|
+
*/
|
|
488
|
+
function getGeometry(shape, needFlat = false) {
|
|
489
|
+
if (GeometryCache && GeometryCache[shape]) {
|
|
490
|
+
return GeometryCache[shape];
|
|
491
|
+
}
|
|
492
|
+
const path = geometryShape[shape] ? geometryShape[shape]() : geometryShape.cylinder();
|
|
493
|
+
const geometry = extrude_PolygonNormal([path], needFlat);
|
|
494
|
+
GeometryCache[shape] = geometry;
|
|
495
|
+
return geometry;
|
|
496
|
+
}
|
|
497
|
+
export function computeVertexNormals(positions, indexArray, dim = 3, needFlat = false) {
|
|
498
|
+
const normals = new Float32Array(positions.length / dim * 3);
|
|
499
|
+
let vA;
|
|
500
|
+
let vB;
|
|
501
|
+
let vC;
|
|
502
|
+
const cb = vec3.create();
|
|
503
|
+
const ab = vec3.create();
|
|
504
|
+
const normal = vec3.create();
|
|
505
|
+
for (let i = 0, li = indexArray.length; i < li; i += 3) {
|
|
506
|
+
vA = indexArray[i + 0] * 3;
|
|
507
|
+
vB = indexArray[i + 1] * 3;
|
|
508
|
+
vC = indexArray[i + 2] * 3;
|
|
509
|
+
let p1 = [positions[vA], positions[vA + 1]];
|
|
510
|
+
let p2 = [positions[vB], positions[vB + 1]];
|
|
511
|
+
let p3 = [positions[vC], positions[vC + 1]];
|
|
512
|
+
if (needFlat) {
|
|
513
|
+
p1 = lngLatToMeters(p1);
|
|
514
|
+
p2 = lngLatToMeters(p2);
|
|
515
|
+
p3 = lngLatToMeters(p3);
|
|
516
|
+
}
|
|
517
|
+
const [ax, ay] = p1;
|
|
518
|
+
const pA = vec3.fromValues(ax, ay, positions[vA + 2]);
|
|
519
|
+
const [bx, by] = p2;
|
|
520
|
+
const pB = vec3.fromValues(bx, by, positions[vB + 2]);
|
|
521
|
+
const [cx, cy] = p3;
|
|
522
|
+
const pC = vec3.fromValues(cx, cy, positions[vC + 2]);
|
|
523
|
+
vec3.sub(cb, pC, pB);
|
|
524
|
+
vec3.sub(ab, pA, pB);
|
|
525
|
+
vec3.cross(normal, cb, ab);
|
|
526
|
+
normals[vA] += cb[0];
|
|
527
|
+
normals[vA + 1] += cb[1];
|
|
528
|
+
normals[vA + 2] += cb[2];
|
|
529
|
+
normals[vB] += cb[0];
|
|
530
|
+
normals[vB + 1] += cb[1];
|
|
531
|
+
normals[vB + 2] += cb[2];
|
|
532
|
+
normals[vC] += cb[0];
|
|
533
|
+
normals[vC + 1] += cb[1];
|
|
534
|
+
normals[vC + 2] += cb[2];
|
|
535
|
+
}
|
|
536
|
+
normalizeNormals(normals);
|
|
537
|
+
return normals;
|
|
538
|
+
}
|
|
539
|
+
function normalizeNormals(normals) {
|
|
540
|
+
for (let i = 0, li = normals.length; i < li; i += 3) {
|
|
541
|
+
const normal = vec3.fromValues(normals[i], normals[i + 1], normals[i + 2]);
|
|
542
|
+
const newNormal = vec3.create();
|
|
543
|
+
vec3.normalize(newNormal, normal);
|
|
544
|
+
normals.set(newNormal, i);
|
|
545
|
+
}
|
|
546
|
+
}
|
|
547
|
+
export function checkIsClosed(points) {
|
|
548
|
+
const p1 = points[0][0];
|
|
549
|
+
const p2 = points[0][points[0].length - 1];
|
|
550
|
+
return p1[0] === p2[0] && p1[1] === p2[1];
|
|
551
|
+
}
|
|
552
|
+
function getHeatmapGeometry(shape) {
|
|
553
|
+
const shape3d = ['cylinder', 'triangleColumn', 'hexagonColumn', 'squareColumn'];
|
|
554
|
+
const path = geometryShape[shape] ? geometryShape[shape]() : geometryShape.circle();
|
|
555
|
+
const geometry = shape3d.indexOf(shape) === -1 ? fillPolygon([path]) : extrudePolygon([path]);
|
|
556
|
+
// const geometry = fillPolygon([path]);
|
|
557
|
+
return geometry;
|
|
558
|
+
}
|
|
559
|
+
// 热力图计算范围
|
|
560
|
+
function addDir(dirX, dirY) {
|
|
561
|
+
const x = (dirX + 1) / 2;
|
|
562
|
+
const y = (dirY + 1) / 2;
|
|
563
|
+
return [x, y];
|
|
564
|
+
}
|
|
565
|
+
|
|
566
|
+
/**
|
|
567
|
+
* 构建地球三角网格
|
|
568
|
+
* @returns
|
|
569
|
+
*/
|
|
570
|
+
export function earthTriangulation() {
|
|
571
|
+
const earthmesh = primitiveSphere(EARTH_RADIUS, {
|
|
572
|
+
segments: EARTH_SEGMENTS
|
|
573
|
+
});
|
|
574
|
+
const {
|
|
575
|
+
positionsArr,
|
|
576
|
+
indicesArr,
|
|
577
|
+
normalArr
|
|
578
|
+
} = earthmesh;
|
|
579
|
+
return {
|
|
580
|
+
vertices: positionsArr,
|
|
581
|
+
indices: indicesArr,
|
|
582
|
+
size: 5,
|
|
583
|
+
normals: normalArr
|
|
584
|
+
};
|
|
585
|
+
}
|
|
586
|
+
export function earthOuterTriangulation() {
|
|
587
|
+
const earthmesh = primitiveSphere(EARTH_RADIUS + EARTH_RADIUS_OUTER, {
|
|
588
|
+
segments: EARTH_SEGMENTS
|
|
589
|
+
});
|
|
590
|
+
const {
|
|
591
|
+
positionsArr,
|
|
592
|
+
indicesArr,
|
|
593
|
+
normalArr
|
|
594
|
+
} = earthmesh;
|
|
595
|
+
return {
|
|
596
|
+
vertices: positionsArr,
|
|
597
|
+
indices: indicesArr,
|
|
598
|
+
size: 5,
|
|
599
|
+
normals: normalArr
|
|
600
|
+
};
|
|
601
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare function MultipleOfFourNumber(num: number): number;
|
|
2
|
+
/**
|
|
3
|
+
* Get vertex indices for drawing polygon mesh (triangulation)
|
|
4
|
+
*/
|
|
5
|
+
export declare function getPolygonSurfaceIndices(positions: number[], holeIndices: number[], positionSize: number, preproject?: boolean): number[];
|
package/es/core/utils.js
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { lngLatToMeters } from '@antv/l7-utils';
|
|
2
|
+
import earcut from 'earcut';
|
|
3
|
+
export function MultipleOfFourNumber(num) {
|
|
4
|
+
return Math.max(Math.ceil(num / 4) * 4, 4);
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Get vertex indices for drawing polygon mesh (triangulation)
|
|
9
|
+
*/
|
|
10
|
+
export function getPolygonSurfaceIndices(positions, holeIndices, positionSize, preproject = true) {
|
|
11
|
+
const is3d = positionSize === 3;
|
|
12
|
+
if (preproject) {
|
|
13
|
+
positions = positions.slice();
|
|
14
|
+
const p = [];
|
|
15
|
+
for (let i = 0; i < positions.length; i += positionSize) {
|
|
16
|
+
p[0] = positions[i];
|
|
17
|
+
p[1] = positions[i + 1];
|
|
18
|
+
if (is3d) {
|
|
19
|
+
p[2] = positions[i + 2];
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
// earcut is a 2D triangulation algorithm, and handles 3D data as if it was projected onto the XY plane
|
|
23
|
+
const xy = lngLatToMeters(p, true, {
|
|
24
|
+
enable: false,
|
|
25
|
+
decimal: 1
|
|
26
|
+
});
|
|
27
|
+
positions[i] = xy[0];
|
|
28
|
+
positions[i + 1] = xy[1];
|
|
29
|
+
if (is3d) {
|
|
30
|
+
positions[i + 2] = xy[2];
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
const indices = earcut(positions, holeIndices, positionSize);
|
|
35
|
+
return indices;
|
|
36
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { ISourceCFG } from '@antv/l7-core';
|
|
2
|
+
import BaseLayer from '../core/BaseLayer';
|
|
3
|
+
interface IEarthLayerStyleOptions {
|
|
4
|
+
opacity: number;
|
|
5
|
+
setEarthTime(time: number): void;
|
|
6
|
+
}
|
|
7
|
+
export type EarthModelType = 'base' | 'atomSphere' | 'bloomSphere';
|
|
8
|
+
export default class EarthLayer extends BaseLayer<IEarthLayerStyleOptions> {
|
|
9
|
+
type: string;
|
|
10
|
+
defaultSourceConfig: {
|
|
11
|
+
data: any[];
|
|
12
|
+
options: ISourceCFG | undefined;
|
|
13
|
+
};
|
|
14
|
+
buildModels(): Promise<void>;
|
|
15
|
+
/**
|
|
16
|
+
* 设置当前地球时间
|
|
17
|
+
* @param time
|
|
18
|
+
*/
|
|
19
|
+
setEarthTime(time: number): void;
|
|
20
|
+
getModelType(): EarthModelType;
|
|
21
|
+
}
|
|
22
|
+
export {};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
2
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
3
|
+
import BaseLayer from "../core/BaseLayer";
|
|
4
|
+
import EarthAtomSphereModel from "./models/atmosphere";
|
|
5
|
+
import BaseEarthModel from "./models/base";
|
|
6
|
+
import EarthBloomSphereModel from "./models/bloomsphere";
|
|
7
|
+
const EarthModels = {
|
|
8
|
+
base: BaseEarthModel,
|
|
9
|
+
atomSphere: EarthAtomSphereModel,
|
|
10
|
+
bloomSphere: EarthBloomSphereModel
|
|
11
|
+
};
|
|
12
|
+
const earthLayerTypes = ['base', 'atomSphere', 'bloomSphere'];
|
|
13
|
+
export default class EarthLayer extends BaseLayer {
|
|
14
|
+
constructor(...args) {
|
|
15
|
+
super(...args);
|
|
16
|
+
_defineProperty(this, "type", 'EarthLayer');
|
|
17
|
+
_defineProperty(this, "defaultSourceConfig", {
|
|
18
|
+
data: [],
|
|
19
|
+
options: {
|
|
20
|
+
parser: {
|
|
21
|
+
type: 'json'
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
buildModels() {
|
|
27
|
+
var _this = this;
|
|
28
|
+
return _asyncToGenerator(function* () {
|
|
29
|
+
const shape = _this.getModelType();
|
|
30
|
+
_this.layerModel = new EarthModels[shape](_this);
|
|
31
|
+
yield _this.initLayerModels();
|
|
32
|
+
})();
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* 设置当前地球时间
|
|
37
|
+
* @param time
|
|
38
|
+
*/
|
|
39
|
+
setEarthTime(time) {
|
|
40
|
+
if (this.layerModel && this.layerModel.setEarthTime) {
|
|
41
|
+
this.layerModel.setEarthTime(time);
|
|
42
|
+
} else {
|
|
43
|
+
console.warn('请在 scene loaded 之后执行该方法!');
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
getModelType() {
|
|
47
|
+
var _this$shapeOption;
|
|
48
|
+
let shape = ((_this$shapeOption = this.shapeOption) === null || _this$shapeOption === void 0 ? void 0 : _this$shapeOption.field) || 'base';
|
|
49
|
+
if (earthLayerTypes.indexOf(shape) < 0) {
|
|
50
|
+
shape = 'base';
|
|
51
|
+
}
|
|
52
|
+
return shape;
|
|
53
|
+
}
|
|
54
|
+
}
|