@antv/l7-layers 2.16.1 → 2.16.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/Geometry/index.js +9 -31
- package/es/Geometry/models/billboard.js +51 -89
- package/es/Geometry/models/plane.js +81 -143
- package/es/Geometry/models/sprite.js +60 -118
- package/es/canvas/index.js +10 -33
- package/es/canvas/models/canvas.js +41 -97
- package/es/citybuliding/building.js +8 -27
- package/es/citybuliding/models/build.js +57 -82
- package/es/core/BaseLayer.d.ts +3 -0
- package/es/core/BaseLayer.js +360 -528
- package/es/core/BaseModel.d.ts +9 -71
- package/es/core/BaseModel.js +118 -429
- package/es/core/CommonStyleAttribute.d.ts +2 -0
- package/es/core/CommonStyleAttribute.js +66 -0
- package/es/core/LayerPickService.js +21 -32
- package/es/core/TextureService.js +0 -13
- package/es/core/interface.d.ts +13 -3
- package/es/core/interface.js +17 -24
- package/es/core/shape/Path.js +13 -20
- package/es/core/shape/extrude.js +27 -36
- package/es/core/triangulation.d.ts +12 -0
- package/es/core/triangulation.js +124 -114
- package/es/earth/index.js +9 -33
- package/es/earth/models/atmosphere.js +30 -54
- package/es/earth/models/base.js +47 -85
- package/es/earth/models/bloomsphere.js +30 -54
- package/es/earth/utils.js +9 -13
- package/es/heatmap/index.js +10 -40
- package/es/heatmap/models/grid.js +29 -53
- package/es/heatmap/models/grid3d.js +29 -53
- package/es/heatmap/models/heatmap.d.ts +1 -0
- package/es/heatmap/models/heatmap.js +99 -150
- package/es/heatmap/models/hexagon.js +29 -53
- package/es/heatmap/shaders/grid_vert.glsl +2 -2
- package/es/heatmap/shaders/hexagon_3d_vert.glsl +2 -2
- package/es/heatmap/shaders/hexagon_vert.glsl +2 -2
- package/es/heatmap/triangulation.js +0 -4
- package/es/image/index.js +9 -28
- package/es/image/models/image.js +66 -100
- package/es/index.js +9 -17
- package/es/line/index.d.ts +1 -0
- package/es/line/index.js +12 -36
- package/es/line/models/arc.js +72 -160
- package/es/line/models/arc_3d.js +67 -148
- package/es/line/models/earthArc_3d.js +66 -148
- package/es/line/models/{half.d.ts → flow.d.ts} +1 -11
- package/es/line/models/flow.js +167 -0
- package/es/line/models/great_circle.js +57 -135
- package/es/line/models/index.d.ts +1 -1
- package/es/line/models/index.js +3 -3
- package/es/line/models/line.js +98 -186
- package/es/line/models/linearline.js +46 -115
- package/es/line/models/simpleLine.d.ts +0 -1
- package/es/line/models/simpleLine.js +42 -114
- package/es/line/models/wall.js +52 -92
- package/es/line/shaders/dash/arc_dash_frag.glsl +3 -6
- package/es/line/shaders/dash/arc_dash_vert.glsl +6 -46
- package/es/line/shaders/dash/line_dash_frag.glsl +4 -7
- package/es/line/shaders/dash/line_dash_vert.glsl +3 -33
- package/es/line/shaders/flow/flow_line_frag.glsl +13 -0
- package/es/line/shaders/flow/flow_line_vert.glsl +83 -0
- package/es/line/shaders/line_arc_3d_frag.glsl +6 -6
- package/es/line/shaders/line_arc_3d_vert.glsl +4 -34
- package/es/line/shaders/line_arc_frag.glsl +7 -11
- package/es/line/shaders/line_arc_great_circle_frag.glsl +5 -6
- package/es/line/shaders/line_arc_great_circle_vert.glsl +4 -32
- package/es/line/shaders/line_arc_vert.glsl +9 -45
- package/es/line/shaders/line_frag.glsl +15 -17
- package/es/line/shaders/line_vert.glsl +3 -34
- package/es/line/shaders/linear/arc3d_linear_frag.glsl +5 -19
- package/es/line/shaders/linear/arc3d_linear_vert.glsl +9 -48
- package/es/line/shaders/linear/arc_linear_frag.glsl +2 -30
- package/es/line/shaders/linear/arc_linear_vert.glsl +9 -45
- package/es/line/shaders/linear/line_linear_frag.glsl +5 -6
- package/es/line/shaders/linearLine/line_linear_frag.glsl +2 -14
- package/es/line/shaders/linearLine/line_linear_vert.glsl +14 -32
- package/es/line/shaders/simple/simpleline_frag.glsl +1 -5
- package/es/line/shaders/simple/simpleline_linear_frag.glsl +2 -6
- package/es/line/shaders/simple/simpleline_vert.glsl +7 -33
- package/es/mask/index.js +9 -28
- package/es/mask/models/fill.js +29 -54
- package/es/plugins/DataMappingPlugin.js +90 -141
- package/es/plugins/DataSourcePlugin.js +45 -68
- package/es/plugins/FeatureScalePlugin.js +67 -122
- package/es/plugins/LayerAnimateStylePlugin.js +0 -5
- package/es/plugins/LayerMaskPlugin.js +3 -11
- package/es/plugins/LayerModelPlugin.js +79 -104
- package/es/plugins/LayerStylePlugin.js +3 -9
- package/es/plugins/LightingPlugin.js +12 -18
- package/es/plugins/MultiPassRendererPlugin.js +11 -16
- package/es/plugins/PixelPickingPlugin.js +12 -21
- package/es/plugins/RegisterStyleAttributePlugin.js +5 -12
- package/es/plugins/ShaderUniformPlugin.js +15 -29
- package/es/plugins/UpdateModelPlugin.js +0 -5
- package/es/plugins/UpdateStyleAttributePlugin.js +5 -11
- package/es/point/index.d.ts +1 -0
- package/es/point/index.js +27 -77
- package/es/point/models/earthExtrude.d.ts +0 -3
- package/es/point/models/earthExtrude.js +60 -139
- package/es/point/models/earthFill.d.ts +0 -1
- package/es/point/models/earthFill.js +59 -140
- package/es/point/models/extrude.d.ts +0 -3
- package/es/point/models/extrude.js +60 -140
- package/es/point/models/fill.d.ts +0 -1
- package/es/point/models/fill.js +67 -158
- package/es/point/models/fillmage.js +66 -147
- package/es/point/models/image.js +52 -126
- package/es/point/models/index.js +2 -2
- package/es/point/models/normal.js +32 -56
- package/es/point/models/radar.d.ts +0 -1
- package/es/point/models/radar.js +42 -75
- package/es/point/models/simplePoint.d.ts +0 -1
- package/es/point/models/simplePoint.js +46 -115
- package/es/point/models/text.js +211 -344
- package/es/point/shaders/animate/wave_frag.glsl +1 -11
- package/es/point/shaders/earth/extrude_frag.glsl +5 -17
- package/es/point/shaders/earth/extrude_vert.glsl +14 -29
- package/es/point/shaders/earth/fill_frag.glsl +5 -14
- package/es/point/shaders/earth/fill_vert.glsl +1 -75
- package/es/point/shaders/extrude/extrude_frag.glsl +3 -29
- package/es/point/shaders/extrude/extrude_vert.glsl +27 -35
- package/es/point/shaders/fill_frag.glsl +9 -20
- package/es/point/shaders/fill_vert.glsl +16 -101
- package/es/point/shaders/image/fillImage_frag.glsl +2 -5
- package/es/point/shaders/image/fillImage_vert.glsl +4 -47
- package/es/point/shaders/image_frag.glsl +1 -5
- package/es/point/shaders/image_vert.glsl +1 -44
- package/es/point/shaders/normal_frag.glsl +0 -2
- package/es/point/shaders/normal_vert.glsl +2 -1
- package/es/point/shaders/radar/radar_vert.glsl +2 -2
- package/es/point/shaders/simplePoint_frag.glsl +0 -7
- package/es/point/shaders/simplePoint_vert.glsl +3 -45
- package/es/point/shaders/text_frag.glsl +6 -19
- package/es/point/shaders/text_vert.glsl +5 -66
- package/es/point/shape/extrude.js +4 -13
- package/es/polygon/index.d.ts +1 -0
- package/es/polygon/index.js +12 -40
- package/es/polygon/models/extrude.d.ts +0 -3
- package/es/polygon/models/extrude.js +122 -162
- package/es/polygon/models/fill.d.ts +0 -4
- package/es/polygon/models/fill.js +57 -130
- package/es/polygon/models/index.js +3 -2
- package/es/polygon/models/ocean.js +42 -76
- package/es/polygon/models/water.js +37 -71
- package/es/polygon/shaders/extrude/polygon_extrude_frag.glsl +2 -23
- package/es/polygon/shaders/extrude/polygon_extrude_picklight_frag.glsl +7 -5
- package/es/polygon/shaders/extrude/polygon_extrude_picklight_vert.glsl +7 -32
- package/es/polygon/shaders/extrude/polygon_extrude_vert.glsl +33 -38
- package/es/polygon/shaders/extrude/polygon_extrudetex_frag.glsl +12 -9
- package/es/polygon/shaders/extrude/polygon_extrudetex_vert.glsl +16 -44
- package/es/polygon/shaders/polygon_frag.glsl +0 -5
- package/es/polygon/shaders/polygon_linear_frag.glsl +0 -8
- package/es/polygon/shaders/polygon_linear_vert.glsl +0 -32
- package/es/polygon/shaders/polygon_vert.glsl +1 -27
- package/es/raster/buffers/triangulation.js +2 -4
- package/es/raster/index.js +9 -32
- package/es/raster/models/raster.js +80 -116
- package/es/raster/models/rasterRgb.js +84 -127
- package/es/raster/models/rasterTerrainRgb.js +56 -84
- package/es/tile/interaction/getRasterData.js +14 -20
- package/es/tile/interaction/utils.js +7 -9
- package/es/tile/manager/base.js +63 -96
- package/es/tile/service/TileLayerService.js +33 -55
- package/es/tile/service/TilePickService.js +26 -40
- package/es/tile/service/TileSourceService.js +3 -7
- package/es/tile/tileFactory/DebugTile.js +29 -46
- package/es/tile/tileFactory/ImageTile.js +20 -38
- package/es/tile/tileFactory/MaskTile.js +22 -43
- package/es/tile/tileFactory/RasterRGBTile.js +22 -42
- package/es/tile/tileFactory/RasterTerrainRGBTile.js +20 -38
- package/es/tile/tileFactory/RasterTile.js +30 -53
- package/es/tile/tileFactory/Tile.js +63 -97
- package/es/tile/tileFactory/VectorTile.js +41 -68
- package/es/tile/tileFactory/index.js +0 -11
- package/es/tile/tileFactory/layers/TileDebugLayer.js +6 -27
- package/es/tile/tileFactory/util.js +0 -3
- package/es/tile/tileLayer/BaseLayer.js +105 -146
- package/es/tile/utils.js +1 -1
- package/es/utils/blend.js +0 -2
- package/es/utils/collision-index.js +9 -16
- package/es/utils/extrude_polyline.js +101 -149
- package/es/utils/grid-index.js +2 -27
- package/es/utils/identityScale.js +0 -8
- package/es/utils/layerData.js +32 -46
- package/es/utils/multiPassRender.js +11 -13
- package/es/utils/polylineNormal.js +31 -37
- package/es/utils/simpleLine.js +2 -16
- package/es/utils/stencil.js +2 -3
- package/es/utils/symbol-layout.js +27 -53
- package/es/wind/index.js +9 -29
- package/es/wind/models/utils.js +26 -51
- package/es/wind/models/wind.js +101 -147
- package/es/wind/models/windRender.js +53 -66
- package/lib/Geometry/index.js +9 -38
- package/lib/Geometry/models/billboard.js +51 -97
- package/lib/Geometry/models/index.js +0 -5
- package/lib/Geometry/models/plane.js +79 -151
- package/lib/Geometry/models/sprite.js +60 -127
- package/lib/canvas/index.js +10 -40
- package/lib/canvas/models/canvas.js +41 -101
- package/lib/canvas/models/index.js +0 -3
- package/lib/citybuliding/building.js +8 -35
- package/lib/citybuliding/models/build.js +57 -92
- package/lib/core/BaseLayer.js +358 -520
- package/lib/core/BaseModel.js +117 -441
- package/lib/core/CommonStyleAttribute.js +72 -0
- package/lib/core/LayerPickService.js +21 -37
- package/lib/core/TextureService.js +0 -16
- package/lib/core/interface.js +21 -31
- package/lib/core/schema.js +0 -1
- package/lib/core/shape/Path.js +14 -31
- package/lib/core/shape/extrude.js +27 -59
- package/lib/core/triangulation.js +125 -153
- package/lib/earth/index.js +9 -43
- package/lib/earth/models/atmosphere.js +30 -63
- package/lib/earth/models/base.js +47 -90
- package/lib/earth/models/bloomsphere.js +30 -63
- package/lib/earth/utils.js +7 -31
- package/lib/heatmap/index.js +10 -48
- package/lib/heatmap/models/grid.js +29 -61
- package/lib/heatmap/models/grid3d.js +29 -61
- package/lib/heatmap/models/heatmap.js +99 -166
- package/lib/heatmap/models/hexagon.js +29 -61
- package/lib/heatmap/models/index.js +0 -6
- package/lib/heatmap/shaders/grid_vert.glsl +2 -2
- package/lib/heatmap/shaders/hexagon_3d_vert.glsl +2 -2
- package/lib/heatmap/shaders/hexagon_vert.glsl +2 -2
- package/lib/heatmap/triangulation.js +0 -5
- package/lib/image/index.js +9 -36
- package/lib/image/models/image.js +66 -109
- package/lib/image/models/index.js +0 -3
- package/lib/index.js +7 -61
- package/lib/line/index.js +12 -42
- package/lib/line/models/arc.js +70 -170
- package/lib/line/models/arc_3d.js +65 -159
- package/lib/line/models/earthArc_3d.js +64 -159
- package/lib/line/models/flow.js +174 -0
- package/lib/line/models/great_circle.js +57 -146
- package/lib/line/models/index.js +3 -14
- package/lib/line/models/line.js +96 -194
- package/lib/line/models/linearline.js +46 -127
- package/lib/line/models/simpleLine.js +42 -124
- package/lib/line/models/wall.js +52 -103
- package/lib/line/shaders/dash/arc_dash_frag.glsl +3 -6
- package/lib/line/shaders/dash/arc_dash_vert.glsl +6 -46
- package/lib/line/shaders/dash/line_dash_frag.glsl +4 -7
- package/lib/line/shaders/dash/line_dash_vert.glsl +3 -33
- package/lib/line/shaders/flow/flow_line_frag.glsl +13 -0
- package/lib/line/shaders/flow/flow_line_vert.glsl +83 -0
- package/lib/line/shaders/line_arc_3d_frag.glsl +6 -6
- package/lib/line/shaders/line_arc_3d_vert.glsl +4 -34
- package/lib/line/shaders/line_arc_frag.glsl +7 -11
- package/lib/line/shaders/line_arc_great_circle_frag.glsl +5 -6
- package/lib/line/shaders/line_arc_great_circle_vert.glsl +4 -32
- package/lib/line/shaders/line_arc_vert.glsl +9 -45
- package/lib/line/shaders/line_frag.glsl +15 -17
- package/lib/line/shaders/line_vert.glsl +3 -34
- package/lib/line/shaders/linear/arc3d_linear_frag.glsl +5 -19
- package/lib/line/shaders/linear/arc3d_linear_vert.glsl +9 -48
- package/lib/line/shaders/linear/arc_linear_frag.glsl +2 -30
- package/lib/line/shaders/linear/arc_linear_vert.glsl +9 -45
- package/lib/line/shaders/linear/line_linear_frag.glsl +5 -6
- package/lib/line/shaders/linearLine/line_linear_frag.glsl +2 -14
- package/lib/line/shaders/linearLine/line_linear_vert.glsl +14 -32
- package/lib/line/shaders/simple/simpleline_frag.glsl +1 -5
- package/lib/line/shaders/simple/simpleline_linear_frag.glsl +2 -6
- package/lib/line/shaders/simple/simpleline_vert.glsl +7 -33
- package/lib/mask/index.js +9 -36
- package/lib/mask/models/fill.js +29 -63
- package/lib/mask/models/index.js +0 -3
- package/lib/plugins/DataMappingPlugin.js +90 -152
- package/lib/plugins/DataSourcePlugin.js +45 -76
- package/lib/plugins/FeatureScalePlugin.js +67 -138
- package/lib/plugins/LayerAnimateStylePlugin.js +0 -10
- package/lib/plugins/LayerMaskPlugin.js +4 -17
- package/lib/plugins/LayerModelPlugin.js +80 -113
- package/lib/plugins/LayerStylePlugin.js +4 -14
- package/lib/plugins/LightingPlugin.js +12 -25
- package/lib/plugins/MultiPassRendererPlugin.js +11 -22
- package/lib/plugins/PixelPickingPlugin.js +12 -27
- package/lib/plugins/RegisterStyleAttributePlugin.js +5 -19
- package/lib/plugins/ShaderUniformPlugin.js +15 -36
- package/lib/plugins/UpdateModelPlugin.js +1 -10
- package/lib/plugins/UpdateStyleAttributePlugin.js +5 -16
- package/lib/point/index.js +27 -83
- package/lib/point/models/earthExtrude.js +60 -150
- package/lib/point/models/earthFill.js +59 -170
- package/lib/point/models/extrude.js +60 -150
- package/lib/point/models/fill.js +65 -167
- package/lib/point/models/fillmage.js +64 -155
- package/lib/point/models/image.js +52 -136
- package/lib/point/models/index.js +1 -12
- package/lib/point/models/normal.js +32 -66
- package/lib/point/models/radar.js +42 -85
- package/lib/point/models/simplePoint.js +46 -125
- package/lib/point/models/text.js +209 -350
- package/lib/point/shaders/animate/wave_frag.glsl +1 -11
- package/lib/point/shaders/earth/extrude_frag.glsl +5 -17
- package/lib/point/shaders/earth/extrude_vert.glsl +14 -29
- package/lib/point/shaders/earth/fill_frag.glsl +5 -14
- package/lib/point/shaders/earth/fill_vert.glsl +1 -75
- package/lib/point/shaders/extrude/extrude_frag.glsl +3 -29
- package/lib/point/shaders/extrude/extrude_vert.glsl +27 -35
- package/lib/point/shaders/fill_frag.glsl +9 -20
- package/lib/point/shaders/fill_vert.glsl +16 -101
- package/lib/point/shaders/image/fillImage_frag.glsl +2 -5
- package/lib/point/shaders/image/fillImage_vert.glsl +4 -47
- package/lib/point/shaders/image_frag.glsl +1 -5
- package/lib/point/shaders/image_vert.glsl +1 -44
- package/lib/point/shaders/normal_frag.glsl +0 -2
- package/lib/point/shaders/normal_vert.glsl +2 -1
- package/lib/point/shaders/radar/radar_vert.glsl +2 -2
- package/lib/point/shaders/simplePoint_frag.glsl +0 -7
- package/lib/point/shaders/simplePoint_vert.glsl +3 -45
- package/lib/point/shaders/text_frag.glsl +6 -19
- package/lib/point/shaders/text_vert.glsl +5 -66
- package/lib/point/shape/extrude.js +4 -20
- package/lib/polygon/index.js +12 -48
- package/lib/polygon/models/extrude.js +122 -173
- package/lib/polygon/models/fill.js +57 -140
- package/lib/polygon/models/index.js +2 -14
- package/lib/polygon/models/ocean.js +42 -88
- package/lib/polygon/models/water.js +37 -82
- package/lib/polygon/shaders/extrude/polygon_extrude_frag.glsl +2 -23
- package/lib/polygon/shaders/extrude/polygon_extrude_picklight_frag.glsl +7 -5
- package/lib/polygon/shaders/extrude/polygon_extrude_picklight_vert.glsl +7 -32
- package/lib/polygon/shaders/extrude/polygon_extrude_vert.glsl +33 -38
- package/lib/polygon/shaders/extrude/polygon_extrudetex_frag.glsl +12 -9
- package/lib/polygon/shaders/extrude/polygon_extrudetex_vert.glsl +16 -44
- package/lib/polygon/shaders/polygon_frag.glsl +0 -5
- package/lib/polygon/shaders/polygon_linear_frag.glsl +0 -8
- package/lib/polygon/shaders/polygon_linear_vert.glsl +0 -32
- package/lib/polygon/shaders/polygon_vert.glsl +1 -27
- package/lib/raster/buffers/triangulation.js +3 -7
- package/lib/raster/index.js +9 -40
- package/lib/raster/models/index.js +0 -5
- package/lib/raster/models/raster.js +80 -125
- package/lib/raster/models/rasterRgb.js +84 -139
- package/lib/raster/models/rasterTerrainRgb.js +56 -93
- package/lib/tile/interaction/getRasterData.js +14 -25
- package/lib/tile/interaction/utils.js +7 -19
- package/lib/tile/manager/base.js +63 -104
- package/lib/tile/service/TileLayerService.js +33 -60
- package/lib/tile/service/TilePickService.js +26 -48
- package/lib/tile/service/TileSourceService.js +2 -16
- package/lib/tile/style/utils.js +0 -3
- package/lib/tile/tileFactory/DebugTile.js +29 -54
- package/lib/tile/tileFactory/ImageTile.js +20 -46
- package/lib/tile/tileFactory/MaskTile.js +22 -51
- package/lib/tile/tileFactory/RasterRGBTile.js +22 -50
- package/lib/tile/tileFactory/RasterTerrainRGBTile.js +20 -46
- package/lib/tile/tileFactory/RasterTile.js +30 -63
- package/lib/tile/tileFactory/Tile.js +63 -102
- package/lib/tile/tileFactory/VectorTile.js +41 -76
- package/lib/tile/tileFactory/index.js +0 -25
- package/lib/tile/tileFactory/layers/TileDebugLayer.js +6 -32
- package/lib/tile/tileFactory/util.js +0 -9
- package/lib/tile/tileLayer/BaseLayer.js +105 -153
- package/lib/tile/utils.js +1 -5
- package/lib/utils/blend.js +0 -5
- package/lib/utils/collision-index.js +9 -25
- package/lib/utils/extrude_polyline.js +101 -181
- package/lib/utils/grid-index.js +2 -28
- package/lib/utils/identityScale.js +0 -9
- package/lib/utils/layerData.js +32 -51
- package/lib/utils/multiPassRender.js +11 -16
- package/lib/utils/polylineNormal.js +31 -66
- package/lib/utils/simpleLine.js +2 -21
- package/lib/utils/stencil.js +0 -4
- package/lib/utils/symbol-layout.js +27 -55
- package/lib/wind/index.js +9 -37
- package/lib/wind/models/index.js +0 -3
- package/lib/wind/models/utils.js +26 -62
- package/lib/wind/models/wind.js +101 -157
- package/lib/wind/models/windRender.js +53 -71
- package/lib/wind/models/windShader.js +0 -1
- package/package.json +7 -7
- package/es/line/models/half.js +0 -298
- package/es/line/shaders/half/line_half_frag.glsl +0 -53
- package/es/line/shaders/half/line_half_vert.glsl +0 -169
- package/es/utils/dataMappingStyle.d.ts +0 -31
- package/es/utils/dataMappingStyle.js +0 -147
- package/lib/line/models/half.js +0 -315
- package/lib/line/shaders/half/line_half_frag.glsl +0 -53
- package/lib/line/shaders/half/line_half_vert.glsl +0 -169
- package/lib/utils/dataMappingStyle.js +0 -151
package/es/core/triangulation.js
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
2
|
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
3
3
|
import { calculateCentroid, calculatePointsCenterAndRadius, lngLatToMeters } from '@antv/l7-utils';
|
|
4
|
-
import earcut from 'earcut';
|
|
5
|
-
|
|
4
|
+
import earcut from 'earcut';
|
|
5
|
+
// @ts-ignore
|
|
6
6
|
import { vec3 } from 'gl-matrix';
|
|
7
7
|
import { EARTH_RADIUS, EARTH_RADIUS_OUTER, EARTH_SEGMENTS, lglt2xyz, primitiveSphere } from "../earth/utils";
|
|
8
8
|
import ExtrudePolyline from "../utils/extrude_polyline";
|
|
9
9
|
import extrudePolygon, { extrude_PolygonNormal, fillPolygon } from "./shape/extrude";
|
|
10
10
|
import { geometryShape } from "./shape/Path";
|
|
11
11
|
var GeometryCache = {};
|
|
12
|
+
|
|
12
13
|
/**
|
|
13
14
|
* 计算2D 填充点图顶点
|
|
14
15
|
* @param feature 映射feature
|
|
@@ -26,7 +27,6 @@ export function PointFillTriangulation(feature) {
|
|
|
26
27
|
* 计算2D 填充点图顶点 (地球模式)
|
|
27
28
|
* @param feature 映射feature
|
|
28
29
|
*/
|
|
29
|
-
|
|
30
30
|
export function GlobelPointFillTriangulation(feature) {
|
|
31
31
|
var coordinates = calculateCentroid(feature.coordinates);
|
|
32
32
|
var xyz = lglt2xyz(coordinates);
|
|
@@ -36,19 +36,17 @@ export function GlobelPointFillTriangulation(feature) {
|
|
|
36
36
|
size: xyz.length
|
|
37
37
|
};
|
|
38
38
|
}
|
|
39
|
+
|
|
39
40
|
/**
|
|
40
41
|
* 计算3D 拉伸点图
|
|
41
42
|
* @param feature 映射feature
|
|
42
43
|
*/
|
|
43
|
-
|
|
44
44
|
export function PointExtrudeTriangulation(feature) {
|
|
45
45
|
var shape = feature.shape;
|
|
46
|
-
|
|
47
46
|
var _getGeometry = getGeometry(shape, false),
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
47
|
+
positions = _getGeometry.positions,
|
|
48
|
+
index = _getGeometry.index,
|
|
49
|
+
normals = _getGeometry.normals;
|
|
52
50
|
return {
|
|
53
51
|
vertices: positions,
|
|
54
52
|
indices: index,
|
|
@@ -56,11 +54,11 @@ export function PointExtrudeTriangulation(feature) {
|
|
|
56
54
|
size: 5
|
|
57
55
|
};
|
|
58
56
|
}
|
|
57
|
+
|
|
59
58
|
/**
|
|
60
59
|
* 计算图片标注
|
|
61
60
|
* @param feature 映射feature
|
|
62
61
|
*/
|
|
63
|
-
|
|
64
62
|
export function PointImageTriangulation(feature) {
|
|
65
63
|
var coordinates = calculateCentroid(feature.coordinates);
|
|
66
64
|
return {
|
|
@@ -69,15 +67,16 @@ export function PointImageTriangulation(feature) {
|
|
|
69
67
|
size: coordinates.length
|
|
70
68
|
};
|
|
71
69
|
}
|
|
70
|
+
|
|
72
71
|
/**
|
|
73
72
|
* 线三角化
|
|
74
73
|
* @param feature 映射feature
|
|
75
74
|
*/
|
|
76
|
-
|
|
77
75
|
export function LineTriangulation(feature) {
|
|
78
76
|
var coordinates = feature.coordinates,
|
|
79
|
-
|
|
80
|
-
|
|
77
|
+
originCoordinates = feature.originCoordinates,
|
|
78
|
+
version = feature.version;
|
|
79
|
+
// let path = coordinates as number[][][] | number[][];
|
|
81
80
|
// if (!Array.isArray(path[0][0])) {
|
|
82
81
|
// path = [coordinates] as number[][][];
|
|
83
82
|
// }
|
|
@@ -86,21 +85,16 @@ export function LineTriangulation(feature) {
|
|
|
86
85
|
dash: true,
|
|
87
86
|
join: 'bevel'
|
|
88
87
|
});
|
|
89
|
-
|
|
90
88
|
if (version === 'GAODE2.x') {
|
|
91
89
|
// 处理高德2.0几何体构建
|
|
92
90
|
var path1 = coordinates; // 计算位置
|
|
93
|
-
|
|
94
91
|
if (!Array.isArray(path1[0][0])) {
|
|
95
92
|
path1 = [coordinates];
|
|
96
93
|
}
|
|
97
|
-
|
|
98
94
|
var path2 = originCoordinates; // 计算法线
|
|
99
|
-
|
|
100
95
|
if (!Array.isArray(path2[0][0])) {
|
|
101
96
|
path2 = [originCoordinates];
|
|
102
97
|
}
|
|
103
|
-
|
|
104
98
|
for (var i = 0; i < path1.length; i++) {
|
|
105
99
|
// 高德2.0在计算线时,需要使用经纬度计算发现,使用 customCoords.lnglatToCoords 计算的数据来计算顶点的位置
|
|
106
100
|
var item1 = path1[i];
|
|
@@ -110,16 +104,13 @@ export function LineTriangulation(feature) {
|
|
|
110
104
|
} else {
|
|
111
105
|
// 处理非高德2.0的几何体构建
|
|
112
106
|
var path = coordinates;
|
|
113
|
-
|
|
114
107
|
if (path[0] && !Array.isArray(path[0][0])) {
|
|
115
108
|
path = [coordinates];
|
|
116
109
|
}
|
|
117
|
-
|
|
118
110
|
path.forEach(function (item) {
|
|
119
111
|
line.extrude(item);
|
|
120
112
|
});
|
|
121
113
|
}
|
|
122
|
-
|
|
123
114
|
var linebuffer = line.complex;
|
|
124
115
|
return {
|
|
125
116
|
vertices: linebuffer.positions,
|
|
@@ -130,10 +121,79 @@ export function LineTriangulation(feature) {
|
|
|
130
121
|
size: 6
|
|
131
122
|
};
|
|
132
123
|
}
|
|
124
|
+
export function FlowLineFillTriangulation(feature) {
|
|
125
|
+
// @ts-ignore
|
|
126
|
+
var coord = feature.coordinates.flat();
|
|
127
|
+
var tin = 1;
|
|
128
|
+
var tout = 1.0;
|
|
129
|
+
return {
|
|
130
|
+
vertices: [1, 0, 0].concat(_toConsumableArray(coord), [
|
|
131
|
+
// 0
|
|
132
|
+
1, 2, -3], _toConsumableArray(coord), [
|
|
133
|
+
// 1
|
|
134
|
+
1, 1, -3], _toConsumableArray(coord), [
|
|
135
|
+
// 2
|
|
136
|
+
0, 1, 0], _toConsumableArray(coord), [
|
|
137
|
+
// 3
|
|
138
|
+
0, 0, 0], _toConsumableArray(coord), [
|
|
139
|
+
// 4
|
|
140
|
+
1, 0, 0], _toConsumableArray(coord), [
|
|
141
|
+
// 0
|
|
142
|
+
1, 2, -3], _toConsumableArray(coord), [
|
|
143
|
+
// 1
|
|
144
|
+
1, 1, -3], _toConsumableArray(coord), [
|
|
145
|
+
// 2
|
|
146
|
+
0, 1, 0], _toConsumableArray(coord), [
|
|
147
|
+
// 3
|
|
148
|
+
0, 0, 0], _toConsumableArray(coord)),
|
|
149
|
+
normals: [-tin, 2 * tout, 1,
|
|
150
|
+
// 0
|
|
151
|
+
2 * tout, -tout, 1,
|
|
152
|
+
// 1
|
|
153
|
+
tout, -tout, 1,
|
|
154
|
+
// 2
|
|
155
|
+
tout, -tout, 1,
|
|
156
|
+
// 3
|
|
157
|
+
-tin, -tout, 1,
|
|
158
|
+
// 4
|
|
159
|
+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
|
160
|
+
indices: [0, 1, 2, 0, 2, 3, 0, 3, 4, 5, 6, 7, 5, 7, 8, 5, 8, 9],
|
|
161
|
+
size: 7
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
export function FlowLineStrokeTriangulation(feature) {
|
|
165
|
+
// @ts-ignore
|
|
166
|
+
var coord = feature.coordinates.flat();
|
|
167
|
+
var tin = 1;
|
|
168
|
+
var tout = 1;
|
|
169
|
+
return {
|
|
170
|
+
vertices: [1, 0, 0].concat(_toConsumableArray(coord), [
|
|
171
|
+
// 0
|
|
172
|
+
1, 2, -3], _toConsumableArray(coord), [
|
|
173
|
+
// 1
|
|
174
|
+
1, 1, -3], _toConsumableArray(coord), [
|
|
175
|
+
// 2
|
|
176
|
+
0, 1, 0], _toConsumableArray(coord), [
|
|
177
|
+
// 3
|
|
178
|
+
0, 0, 0], _toConsumableArray(coord)),
|
|
179
|
+
normals: [-tin, 2 * tout, 1,
|
|
180
|
+
// 0
|
|
181
|
+
2 * tout, -tout, 1,
|
|
182
|
+
// 1
|
|
183
|
+
tout, -tout, 1,
|
|
184
|
+
// 2
|
|
185
|
+
tout, -tout, 1,
|
|
186
|
+
// 3
|
|
187
|
+
-tin, -tout, 1 // 4
|
|
188
|
+
],
|
|
189
|
+
|
|
190
|
+
indices: [0, 1, 1, 2, 2, 3, 3, 4, 4, 0],
|
|
191
|
+
size: 7
|
|
192
|
+
};
|
|
193
|
+
}
|
|
133
194
|
export function SimpleLineTriangulation(feature) {
|
|
134
195
|
var coordinates = feature.coordinates;
|
|
135
196
|
var pos = [];
|
|
136
|
-
|
|
137
197
|
if (!Array.isArray(coordinates[0])) {
|
|
138
198
|
return {
|
|
139
199
|
vertices: [],
|
|
@@ -143,11 +203,9 @@ export function SimpleLineTriangulation(feature) {
|
|
|
143
203
|
count: 0
|
|
144
204
|
};
|
|
145
205
|
}
|
|
146
|
-
|
|
147
206
|
var _getSimpleLineVertice = getSimpleLineVertices(coordinates),
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
207
|
+
results = _getSimpleLineVertice.results,
|
|
208
|
+
totalDistance = _getSimpleLineVertice.totalDistance;
|
|
151
209
|
results.map(function (point) {
|
|
152
210
|
pos.push(point[0], point[1], point[2], point[3], 0, totalDistance);
|
|
153
211
|
});
|
|
@@ -162,7 +220,6 @@ export function SimpleLineTriangulation(feature) {
|
|
|
162
220
|
export function TileSimpleLineTriangulation(feature) {
|
|
163
221
|
var coordinates = feature.coordinates;
|
|
164
222
|
var pos = [];
|
|
165
|
-
|
|
166
223
|
if (!Array.isArray(coordinates[0])) {
|
|
167
224
|
return {
|
|
168
225
|
vertices: [],
|
|
@@ -171,10 +228,8 @@ export function TileSimpleLineTriangulation(feature) {
|
|
|
171
228
|
count: 0
|
|
172
229
|
};
|
|
173
230
|
}
|
|
174
|
-
|
|
175
231
|
var _getTileSimpleLineVer = getTileSimpleLineVertices(coordinates),
|
|
176
|
-
|
|
177
|
-
|
|
232
|
+
results = _getTileSimpleLineVer.results;
|
|
178
233
|
results.map(function (point) {
|
|
179
234
|
pos.push(point[0], point[1], point[2], point[3]);
|
|
180
235
|
});
|
|
@@ -185,35 +240,27 @@ export function TileSimpleLineTriangulation(feature) {
|
|
|
185
240
|
count: results.length
|
|
186
241
|
};
|
|
187
242
|
}
|
|
188
|
-
|
|
189
243
|
function lineSegmentDistance(b1, a1) {
|
|
190
244
|
var dx = a1[0] - b1[0];
|
|
191
245
|
var dy = a1[1] - b1[1];
|
|
192
246
|
return Math.sqrt(dx * dx + dy * dy);
|
|
193
247
|
}
|
|
194
|
-
|
|
195
248
|
function pushDis(point, n) {
|
|
196
249
|
if (point.length < 3) {
|
|
197
250
|
point.push(0);
|
|
198
251
|
}
|
|
199
|
-
|
|
200
252
|
if (n !== undefined) {
|
|
201
253
|
point.push(n);
|
|
202
254
|
}
|
|
203
|
-
|
|
204
255
|
return point;
|
|
205
256
|
}
|
|
206
|
-
|
|
207
257
|
function getSimpleLineVertices(coordinates) {
|
|
208
258
|
var points = coordinates;
|
|
209
|
-
|
|
210
259
|
if (Array.isArray(points) && Array.isArray(points[0]) && Array.isArray(points[0][0])) {
|
|
211
260
|
// @ts-ignore
|
|
212
261
|
points = coordinates.flat();
|
|
213
262
|
}
|
|
214
|
-
|
|
215
263
|
var distance = 0;
|
|
216
|
-
|
|
217
264
|
if (points.length < 2) {
|
|
218
265
|
return {
|
|
219
266
|
results: points,
|
|
@@ -223,7 +270,6 @@ function getSimpleLineVertices(coordinates) {
|
|
|
223
270
|
var results = [];
|
|
224
271
|
var point = pushDis(points[0], distance);
|
|
225
272
|
results.push(point);
|
|
226
|
-
|
|
227
273
|
for (var i = 1; i < points.length - 1; i++) {
|
|
228
274
|
var subDistance = lineSegmentDistance(points[i - 1], points[i]);
|
|
229
275
|
distance += subDistance;
|
|
@@ -231,7 +277,6 @@ function getSimpleLineVertices(coordinates) {
|
|
|
231
277
|
results.push(mulPoint);
|
|
232
278
|
results.push(mulPoint);
|
|
233
279
|
}
|
|
234
|
-
|
|
235
280
|
var pointDistance = lineSegmentDistance(points[points.length - 2], points[points.length - 1]);
|
|
236
281
|
distance += pointDistance;
|
|
237
282
|
results.push(pushDis(points[points.length - 1], distance));
|
|
@@ -241,7 +286,6 @@ function getSimpleLineVertices(coordinates) {
|
|
|
241
286
|
};
|
|
242
287
|
}
|
|
243
288
|
}
|
|
244
|
-
|
|
245
289
|
function getTileSimpleLineVertices(points) {
|
|
246
290
|
if (points.length < 2) {
|
|
247
291
|
return {
|
|
@@ -251,70 +295,61 @@ function getTileSimpleLineVertices(points) {
|
|
|
251
295
|
var results = [];
|
|
252
296
|
var point = pushDis(points[0]);
|
|
253
297
|
results.push(point);
|
|
254
|
-
|
|
255
298
|
for (var i = 1; i < points.length - 1; i++) {
|
|
256
299
|
var mulPoint = pushDis(points[i]);
|
|
257
300
|
results.push(mulPoint);
|
|
258
301
|
results.push(mulPoint);
|
|
259
302
|
}
|
|
260
|
-
|
|
261
303
|
results.push(pushDis(points[points.length - 1]));
|
|
262
304
|
return {
|
|
263
305
|
results: results
|
|
264
306
|
};
|
|
265
307
|
}
|
|
266
308
|
}
|
|
267
|
-
|
|
268
309
|
export function polygonTriangulation(feature) {
|
|
269
310
|
var coordinates = feature.coordinates;
|
|
270
311
|
var flattengeo = earcut.flatten(coordinates);
|
|
271
312
|
var vertices = flattengeo.vertices,
|
|
272
|
-
|
|
273
|
-
|
|
313
|
+
dimensions = flattengeo.dimensions,
|
|
314
|
+
holes = flattengeo.holes;
|
|
274
315
|
return {
|
|
275
316
|
indices: earcut(vertices, holes, dimensions),
|
|
276
317
|
vertices: vertices,
|
|
277
318
|
size: dimensions
|
|
278
319
|
};
|
|
279
|
-
}
|
|
320
|
+
}
|
|
280
321
|
|
|
322
|
+
// 构建几何图形(带有中心点和大小)
|
|
281
323
|
export function polygonTriangulationWithCenter(feature) {
|
|
282
324
|
var coordinates = feature.coordinates;
|
|
283
325
|
var flattengeo = earcut.flatten(coordinates);
|
|
284
326
|
var vertices = flattengeo.vertices,
|
|
285
|
-
|
|
286
|
-
|
|
327
|
+
dimensions = flattengeo.dimensions,
|
|
328
|
+
holes = flattengeo.holes;
|
|
287
329
|
return {
|
|
288
330
|
indices: earcut(vertices, holes, dimensions),
|
|
289
331
|
vertices: getVerticesWithCenter(vertices),
|
|
290
332
|
size: dimensions + 4
|
|
291
333
|
};
|
|
292
334
|
}
|
|
293
|
-
|
|
294
335
|
function getVerticesWithCenter(vertices) {
|
|
295
336
|
var verticesWithCenter = [];
|
|
296
|
-
|
|
297
337
|
var _calculatePointsCente = calculatePointsCenterAndRadius(vertices),
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
338
|
+
center = _calculatePointsCente.center,
|
|
339
|
+
radius = _calculatePointsCente.radius;
|
|
301
340
|
for (var i = 0; i < vertices.length; i += 2) {
|
|
302
341
|
var lng = vertices[i];
|
|
303
342
|
var lat = vertices[i + 1];
|
|
304
343
|
verticesWithCenter.push.apply(verticesWithCenter, [lng, lat, 0].concat(_toConsumableArray(center), [radius]));
|
|
305
344
|
}
|
|
306
|
-
|
|
307
345
|
return verticesWithCenter;
|
|
308
346
|
}
|
|
309
|
-
|
|
310
347
|
export function PolygonExtrudeTriangulation(feature) {
|
|
311
348
|
var coordinates = feature.coordinates;
|
|
312
|
-
|
|
313
349
|
var _extrude_PolygonNorma = extrude_PolygonNormal(coordinates, true),
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
350
|
+
positions = _extrude_PolygonNorma.positions,
|
|
351
|
+
index = _extrude_PolygonNorma.index,
|
|
352
|
+
normals = _extrude_PolygonNorma.normals;
|
|
318
353
|
return {
|
|
319
354
|
vertices: positions,
|
|
320
355
|
// [ x, y, z, uv.x,uv.y ]
|
|
@@ -325,11 +360,9 @@ export function PolygonExtrudeTriangulation(feature) {
|
|
|
325
360
|
}
|
|
326
361
|
export function HeatmapGridTriangulation(feature) {
|
|
327
362
|
var shape = feature.shape;
|
|
328
|
-
|
|
329
363
|
var _getHeatmapGeometry = getHeatmapGeometry(shape),
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
364
|
+
positions = _getHeatmapGeometry.positions,
|
|
365
|
+
index = _getHeatmapGeometry.index;
|
|
333
366
|
return {
|
|
334
367
|
vertices: positions,
|
|
335
368
|
// [ x, y, z ] 多边形顶点
|
|
@@ -337,14 +370,14 @@ export function HeatmapGridTriangulation(feature) {
|
|
|
337
370
|
size: 3
|
|
338
371
|
};
|
|
339
372
|
}
|
|
373
|
+
|
|
340
374
|
/**
|
|
341
375
|
* 图片图层顶点构造
|
|
342
376
|
* @param feature 数据
|
|
343
377
|
*/
|
|
344
|
-
|
|
345
378
|
export function RasterImageTriangulation(feature) {
|
|
346
|
-
var coordinates = feature.coordinates;
|
|
347
|
-
|
|
379
|
+
var coordinates = feature.coordinates;
|
|
380
|
+
// [ x, y, z. uv.x, uv.y]
|
|
348
381
|
var positions = [].concat(_toConsumableArray(coordinates[0]), [0, 0, 1, coordinates[1][0], coordinates[0][1], 0, 1, 1], _toConsumableArray(coordinates[1]), [0, 1, 0], _toConsumableArray(coordinates[0]), [0, 0, 1], _toConsumableArray(coordinates[1]), [0, 1, 0, coordinates[0][0], coordinates[1][1], 0, 0, 0]);
|
|
349
382
|
var indexs = [0, 1, 2, 3, 4, 5];
|
|
350
383
|
return {
|
|
@@ -353,58 +386,52 @@ export function RasterImageTriangulation(feature) {
|
|
|
353
386
|
size: 5
|
|
354
387
|
};
|
|
355
388
|
}
|
|
389
|
+
|
|
356
390
|
/**
|
|
357
391
|
* 计算3D弧线顶点
|
|
358
392
|
* @param feature 映射数据
|
|
359
393
|
* @param segNum 弧线线段数
|
|
360
394
|
*/
|
|
361
|
-
|
|
362
395
|
export function LineArcTriangulation(feature, segmentNumber) {
|
|
363
396
|
var segNum = segmentNumber ? segmentNumber : 30;
|
|
364
397
|
var coordinates = feature.coordinates;
|
|
365
398
|
var positions = [];
|
|
366
399
|
var indexArray = [];
|
|
367
|
-
|
|
368
400
|
var _loop = function _loop(i) {
|
|
369
401
|
// 上线两个顶点
|
|
370
402
|
// [ x, y, z, sx,sy, tx,ty]
|
|
371
403
|
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]);
|
|
372
|
-
|
|
373
404
|
if (i !== segNum - 1) {
|
|
374
405
|
indexArray.push.apply(indexArray, _toConsumableArray([0, 1, 2, 1, 3, 2].map(function (v) {
|
|
375
406
|
return i * 2 + v;
|
|
376
407
|
})));
|
|
377
408
|
}
|
|
378
409
|
};
|
|
379
|
-
|
|
380
410
|
for (var i = 0; i < segNum; i++) {
|
|
381
411
|
_loop(i);
|
|
382
412
|
}
|
|
383
|
-
|
|
384
413
|
return {
|
|
385
414
|
vertices: positions,
|
|
386
415
|
indices: indexArray,
|
|
387
416
|
size: 7
|
|
388
417
|
};
|
|
389
418
|
}
|
|
419
|
+
|
|
390
420
|
/**
|
|
391
421
|
* 构建热力图密度图的顶点
|
|
392
422
|
* @param feature
|
|
393
423
|
* @returns
|
|
394
424
|
*/
|
|
395
|
-
|
|
396
425
|
export function HeatmapTriangulation(feature) {
|
|
397
426
|
var coordinates = feature.coordinates;
|
|
398
|
-
|
|
399
427
|
if (coordinates.length === 2) {
|
|
400
428
|
coordinates.push(0);
|
|
401
429
|
}
|
|
402
|
-
|
|
403
430
|
var dir = addDir(-1, 1);
|
|
404
431
|
var dir1 = addDir(1, 1);
|
|
405
432
|
var dir2 = addDir(-1, -1);
|
|
406
|
-
var dir3 = addDir(1, -1);
|
|
407
|
-
|
|
433
|
+
var dir3 = addDir(1, -1);
|
|
434
|
+
// [x,y,z, dirx ,diry, weight]
|
|
408
435
|
var positions = [].concat(_toConsumableArray(coordinates), _toConsumableArray(dir), _toConsumableArray(coordinates), _toConsumableArray(dir2), _toConsumableArray(coordinates), _toConsumableArray(dir3), _toConsumableArray(coordinates), _toConsumableArray(dir1));
|
|
409
436
|
var indexArray = [0, 1, 2, 3, 0, 2];
|
|
410
437
|
return {
|
|
@@ -413,24 +440,21 @@ export function HeatmapTriangulation(feature) {
|
|
|
413
440
|
size: 5
|
|
414
441
|
};
|
|
415
442
|
}
|
|
443
|
+
|
|
416
444
|
/**
|
|
417
445
|
* 点图层3d geomerty
|
|
418
446
|
* @param shape 3D形状
|
|
419
447
|
*/
|
|
420
|
-
|
|
421
448
|
function getGeometry(shape) {
|
|
422
449
|
var needFlat = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
423
|
-
|
|
424
450
|
if (GeometryCache && GeometryCache[shape]) {
|
|
425
451
|
return GeometryCache[shape];
|
|
426
452
|
}
|
|
427
|
-
|
|
428
453
|
var path = geometryShape[shape] ? geometryShape[shape]() : geometryShape.cylinder();
|
|
429
454
|
var geometry = extrude_PolygonNormal([path], needFlat);
|
|
430
455
|
GeometryCache[shape] = geometry;
|
|
431
456
|
return geometry;
|
|
432
457
|
}
|
|
433
|
-
|
|
434
458
|
export function computeVertexNormals(positions, indexArray) {
|
|
435
459
|
var dim = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 3;
|
|
436
460
|
var needFlat = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
@@ -441,7 +465,6 @@ export function computeVertexNormals(positions, indexArray) {
|
|
|
441
465
|
var cb = vec3.create();
|
|
442
466
|
var ab = vec3.create();
|
|
443
467
|
var normal = vec3.create();
|
|
444
|
-
|
|
445
468
|
for (var i = 0, li = indexArray.length; i < li; i += 3) {
|
|
446
469
|
vA = indexArray[i + 0] * 3;
|
|
447
470
|
vB = indexArray[i + 1] * 3;
|
|
@@ -449,32 +472,25 @@ export function computeVertexNormals(positions, indexArray) {
|
|
|
449
472
|
var p1 = [positions[vA], positions[vA + 1]];
|
|
450
473
|
var p2 = [positions[vB], positions[vB + 1]];
|
|
451
474
|
var p3 = [positions[vC], positions[vC + 1]];
|
|
452
|
-
|
|
453
475
|
if (needFlat) {
|
|
454
476
|
p1 = lngLatToMeters(p1);
|
|
455
477
|
p2 = lngLatToMeters(p2);
|
|
456
478
|
p3 = lngLatToMeters(p3);
|
|
457
479
|
}
|
|
458
|
-
|
|
459
480
|
var _p = p1,
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
481
|
+
_p2 = _slicedToArray(_p, 2),
|
|
482
|
+
ax = _p2[0],
|
|
483
|
+
ay = _p2[1];
|
|
464
484
|
var pA = vec3.fromValues(ax, ay, positions[vA + 2]);
|
|
465
|
-
|
|
466
485
|
var _p3 = p2,
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
486
|
+
_p4 = _slicedToArray(_p3, 2),
|
|
487
|
+
bx = _p4[0],
|
|
488
|
+
by = _p4[1];
|
|
471
489
|
var pB = vec3.fromValues(bx, by, positions[vB + 2]);
|
|
472
|
-
|
|
473
490
|
var _p5 = p3,
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
491
|
+
_p6 = _slicedToArray(_p5, 2),
|
|
492
|
+
cx = _p6[0],
|
|
493
|
+
cy = _p6[1];
|
|
478
494
|
var pC = vec3.fromValues(cx, cy, positions[vC + 2]);
|
|
479
495
|
vec3.sub(cb, pC, pB);
|
|
480
496
|
vec3.sub(ab, pA, pB);
|
|
@@ -489,11 +505,9 @@ export function computeVertexNormals(positions, indexArray) {
|
|
|
489
505
|
normals[vC + 1] += cb[1];
|
|
490
506
|
normals[vC + 2] += cb[2];
|
|
491
507
|
}
|
|
492
|
-
|
|
493
508
|
normalizeNormals(normals);
|
|
494
509
|
return normals;
|
|
495
510
|
}
|
|
496
|
-
|
|
497
511
|
function normalizeNormals(normals) {
|
|
498
512
|
for (var i = 0, li = normals.length; i < li; i += 3) {
|
|
499
513
|
var normal = vec3.fromValues(normals[i], normals[i + 1], normals[i + 2]);
|
|
@@ -502,40 +516,36 @@ function normalizeNormals(normals) {
|
|
|
502
516
|
normals.set(newNormal, i);
|
|
503
517
|
}
|
|
504
518
|
}
|
|
505
|
-
|
|
506
519
|
export function checkIsClosed(points) {
|
|
507
520
|
var p1 = points[0][0];
|
|
508
521
|
var p2 = points[0][points[0].length - 1];
|
|
509
522
|
return p1[0] === p2[0] && p1[1] === p2[1];
|
|
510
523
|
}
|
|
511
|
-
|
|
512
524
|
function getHeatmapGeometry(shape) {
|
|
513
525
|
var shape3d = ['cylinder', 'triangleColumn', 'hexagonColumn', 'squareColumn'];
|
|
514
526
|
var path = geometryShape[shape] ? geometryShape[shape]() : geometryShape.circle();
|
|
515
|
-
var geometry = shape3d.indexOf(shape) === -1 ? fillPolygon([path]) : extrudePolygon([path]);
|
|
516
|
-
|
|
527
|
+
var geometry = shape3d.indexOf(shape) === -1 ? fillPolygon([path]) : extrudePolygon([path]);
|
|
528
|
+
// const geometry = fillPolygon([path]);
|
|
517
529
|
return geometry;
|
|
518
|
-
}
|
|
519
|
-
|
|
520
|
-
|
|
530
|
+
}
|
|
531
|
+
// 热力图计算范围
|
|
521
532
|
function addDir(dirX, dirY) {
|
|
522
533
|
var x = (dirX + 1) / 2;
|
|
523
534
|
var y = (dirY + 1) / 2;
|
|
524
535
|
return [x, y];
|
|
525
536
|
}
|
|
537
|
+
|
|
526
538
|
/**
|
|
527
539
|
* 构建地球三角网格
|
|
528
540
|
* @returns
|
|
529
541
|
*/
|
|
530
|
-
|
|
531
|
-
|
|
532
542
|
export function earthTriangulation() {
|
|
533
543
|
var earthmesh = primitiveSphere(EARTH_RADIUS, {
|
|
534
544
|
segments: EARTH_SEGMENTS
|
|
535
545
|
});
|
|
536
546
|
var positionsArr = earthmesh.positionsArr,
|
|
537
|
-
|
|
538
|
-
|
|
547
|
+
indicesArr = earthmesh.indicesArr,
|
|
548
|
+
normalArr = earthmesh.normalArr;
|
|
539
549
|
return {
|
|
540
550
|
vertices: positionsArr,
|
|
541
551
|
indices: indicesArr,
|
|
@@ -548,8 +558,8 @@ export function earthOuterTriangulation() {
|
|
|
548
558
|
segments: EARTH_SEGMENTS
|
|
549
559
|
});
|
|
550
560
|
var positionsArr = earthmesh.positionsArr,
|
|
551
|
-
|
|
552
|
-
|
|
561
|
+
indicesArr = earthmesh.indicesArr,
|
|
562
|
+
normalArr = earthmesh.normalArr;
|
|
553
563
|
return {
|
|
554
564
|
vertices: positionsArr,
|
|
555
565
|
indices: indicesArr,
|