@antv/l7-layers 2.17.2 → 2.17.4
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 +31 -9
- package/es/Geometry/models/billboard.js +89 -51
- package/es/Geometry/models/plane.js +143 -81
- package/es/Geometry/models/sprite.js +118 -60
- package/es/canvas/index.js +33 -10
- package/es/canvas/models/canvas.js +97 -41
- package/es/citybuliding/building.js +27 -8
- package/es/citybuliding/models/build.js +82 -57
- package/es/core/BaseLayer.js +478 -313
- package/es/core/BaseModel.js +80 -51
- package/es/core/CommonStyleAttribute.js +5 -2
- package/es/core/LayerPickService.js +32 -21
- package/es/core/TextureService.js +13 -0
- package/es/core/interface.js +24 -17
- package/es/core/shape/Path.js +20 -13
- package/es/core/shape/extrude.js +39 -27
- package/es/core/triangulation.js +136 -99
- package/es/earth/index.js +33 -9
- package/es/earth/models/atmosphere.js +54 -30
- package/es/earth/models/base.js +85 -47
- package/es/earth/models/bloomsphere.js +54 -30
- package/es/earth/utils.js +13 -9
- package/es/heatmap/index.js +40 -10
- package/es/heatmap/models/grid.js +52 -28
- package/es/heatmap/models/grid3d.js +52 -28
- package/es/heatmap/models/heatmap.js +149 -92
- package/es/heatmap/models/hexagon.js +52 -28
- package/es/heatmap/triangulation.js +4 -0
- package/es/image/index.js +28 -9
- package/es/image/models/image.js +100 -66
- package/es/index.js +17 -9
- package/es/line/index.js +35 -9
- package/es/line/models/arc.js +114 -64
- package/es/line/models/arc_3d.js +102 -58
- package/es/line/models/earthArc_3d.js +105 -60
- package/es/line/models/flow.js +60 -36
- package/es/line/models/great_circle.js +94 -53
- package/es/line/models/line.js +138 -86
- package/es/line/models/linearline.js +76 -43
- package/es/line/models/simpleLine.js +69 -39
- package/es/line/models/wall.js +92 -52
- package/es/mask/index.js +28 -9
- package/es/mask/models/fill.js +54 -29
- package/es/plugins/DataMappingPlugin.js +114 -78
- package/es/plugins/DataSourcePlugin.js +68 -45
- package/es/plugins/FeatureScalePlugin.js +122 -67
- package/es/plugins/LayerAnimateStylePlugin.js +5 -0
- package/es/plugins/LayerMaskPlugin.js +11 -3
- package/es/plugins/LayerModelPlugin.js +108 -69
- package/es/plugins/LayerStylePlugin.js +9 -3
- package/es/plugins/LightingPlugin.js +18 -12
- package/es/plugins/MultiPassRendererPlugin.js +16 -11
- package/es/plugins/PixelPickingPlugin.js +21 -12
- package/es/plugins/RegisterStyleAttributePlugin.js +12 -5
- package/es/plugins/ShaderUniformPlugin.js +27 -13
- package/es/plugins/UpdateModelPlugin.js +5 -0
- package/es/plugins/UpdateStyleAttributePlugin.js +11 -5
- package/es/point/index.js +78 -26
- package/es/point/models/earthExtrude.js +95 -58
- package/es/point/models/earthFill.js +80 -52
- package/es/point/models/extrude.js +94 -57
- package/es/point/models/fill.js +81 -56
- package/es/point/models/fillmage.js +100 -60
- package/es/point/models/image.js +83 -47
- package/es/point/models/index.js +2 -2
- package/es/point/models/normal.js +54 -30
- package/es/point/models/radar.js +63 -38
- package/es/point/models/simplePoint.js +62 -38
- package/es/point/models/text.js +296 -199
- package/es/point/shape/extrude.js +13 -4
- package/es/polygon/index.js +41 -11
- package/es/polygon/models/extrude.js +135 -87
- package/es/polygon/models/fill.js +79 -50
- package/es/polygon/models/index.js +2 -3
- package/es/polygon/models/ocean.js +76 -42
- package/es/polygon/models/water.js +71 -37
- package/es/raster/buffers/triangulation.js +4 -2
- package/es/raster/index.js +32 -9
- package/es/raster/models/raster.js +116 -80
- package/es/raster/models/rasterRgb.js +127 -84
- package/es/raster/models/rasterTerrainRgb.js +84 -56
- package/es/tile/interaction/getRasterData.js +20 -14
- package/es/tile/interaction/utils.js +9 -7
- package/es/tile/manager/base.js +96 -63
- package/es/tile/service/TileLayerService.js +55 -33
- package/es/tile/service/TilePickService.js +40 -26
- package/es/tile/service/TileSourceService.js +7 -3
- package/es/tile/tileFactory/DebugTile.js +46 -29
- package/es/tile/tileFactory/ImageTile.js +38 -20
- package/es/tile/tileFactory/MaskTile.js +43 -22
- package/es/tile/tileFactory/RasterRGBTile.js +42 -22
- package/es/tile/tileFactory/RasterTerrainRGBTile.js +38 -20
- package/es/tile/tileFactory/RasterTile.js +53 -30
- package/es/tile/tileFactory/Tile.js +97 -63
- package/es/tile/tileFactory/VectorTile.js +68 -41
- package/es/tile/tileFactory/index.js +11 -0
- package/es/tile/tileFactory/layers/TileDebugLayer.js +27 -6
- package/es/tile/tileFactory/util.js +3 -0
- package/es/tile/tileLayer/BaseLayer.js +146 -105
- package/es/tile/utils.js +1 -1
- package/es/utils/blend.js +2 -0
- package/es/utils/collision-index.js +16 -9
- package/es/utils/extrude_polyline.js +149 -101
- package/es/utils/grid-index.js +27 -2
- package/es/utils/identityScale.js +8 -0
- package/es/utils/layerData.js +44 -30
- package/es/utils/multiPassRender.js +13 -11
- package/es/utils/polylineNormal.js +37 -31
- package/es/utils/simpleLine.js +16 -2
- package/es/utils/stencil.js +3 -2
- package/es/utils/symbol-layout.js +53 -27
- package/es/wind/index.js +29 -9
- package/es/wind/models/utils.js +51 -26
- package/es/wind/models/wind.js +147 -101
- package/es/wind/models/windRender.js +66 -53
- package/lib/Geometry/index.js +38 -9
- package/lib/Geometry/models/billboard.js +97 -51
- package/lib/Geometry/models/index.js +5 -0
- package/lib/Geometry/models/plane.js +151 -79
- package/lib/Geometry/models/sprite.js +127 -60
- package/lib/canvas/index.js +40 -10
- package/lib/canvas/models/canvas.js +101 -41
- package/lib/canvas/models/index.js +3 -0
- package/lib/citybuliding/building.js +35 -8
- package/lib/citybuliding/models/build.js +92 -57
- package/lib/core/BaseLayer.js +469 -313
- package/lib/core/BaseModel.js +90 -51
- package/lib/core/CommonStyleAttribute.js +7 -2
- package/lib/core/LayerPickService.js +37 -21
- package/lib/core/TextureService.js +16 -0
- package/lib/core/interface.js +31 -21
- package/lib/core/schema.js +1 -0
- package/lib/core/shape/Path.js +31 -14
- package/lib/core/shape/extrude.js +62 -27
- package/lib/core/triangulation.js +177 -98
- package/lib/earth/index.js +43 -9
- package/lib/earth/models/atmosphere.js +63 -30
- package/lib/earth/models/base.js +90 -47
- package/lib/earth/models/bloomsphere.js +63 -30
- package/lib/earth/utils.js +31 -7
- package/lib/heatmap/index.js +48 -10
- package/lib/heatmap/models/grid.js +60 -28
- package/lib/heatmap/models/grid3d.js +60 -28
- package/lib/heatmap/models/heatmap.js +166 -92
- package/lib/heatmap/models/hexagon.js +60 -28
- package/lib/heatmap/models/index.js +6 -0
- package/lib/heatmap/triangulation.js +5 -0
- package/lib/image/index.js +36 -9
- package/lib/image/models/image.js +109 -66
- package/lib/image/models/index.js +3 -0
- package/lib/index.js +61 -7
- package/lib/line/index.js +40 -9
- package/lib/line/models/arc.js +124 -62
- package/lib/line/models/arc_3d.js +113 -56
- package/lib/line/models/earthArc_3d.js +115 -58
- package/lib/line/models/flow.js +70 -36
- package/lib/line/models/great_circle.js +104 -53
- package/lib/line/models/index.js +11 -0
- package/lib/line/models/line.js +146 -84
- package/lib/line/models/linearline.js +88 -43
- package/lib/line/models/simpleLine.js +79 -39
- package/lib/line/models/wall.js +103 -52
- package/lib/mask/index.js +36 -9
- package/lib/mask/models/fill.js +63 -29
- package/lib/mask/models/index.js +3 -0
- package/lib/plugins/DataMappingPlugin.js +125 -78
- package/lib/plugins/DataSourcePlugin.js +76 -45
- package/lib/plugins/FeatureScalePlugin.js +138 -67
- package/lib/plugins/LayerAnimateStylePlugin.js +10 -0
- package/lib/plugins/LayerMaskPlugin.js +17 -4
- package/lib/plugins/LayerModelPlugin.js +117 -70
- package/lib/plugins/LayerStylePlugin.js +14 -4
- package/lib/plugins/LightingPlugin.js +25 -12
- package/lib/plugins/MultiPassRendererPlugin.js +22 -11
- package/lib/plugins/PixelPickingPlugin.js +27 -12
- package/lib/plugins/RegisterStyleAttributePlugin.js +19 -5
- package/lib/plugins/ShaderUniformPlugin.js +34 -13
- package/lib/plugins/UpdateModelPlugin.js +10 -1
- package/lib/plugins/UpdateStyleAttributePlugin.js +16 -5
- package/lib/point/index.js +83 -26
- package/lib/point/models/earthExtrude.js +106 -58
- package/lib/point/models/earthFill.js +110 -52
- package/lib/point/models/extrude.js +103 -57
- package/lib/point/models/fill.js +90 -54
- package/lib/point/models/fillmage.js +107 -58
- package/lib/point/models/image.js +92 -47
- package/lib/point/models/index.js +12 -1
- package/lib/point/models/normal.js +64 -30
- package/lib/point/models/radar.js +72 -38
- package/lib/point/models/simplePoint.js +72 -38
- package/lib/point/models/text.js +305 -199
- package/lib/point/shape/extrude.js +20 -4
- package/lib/polygon/index.js +48 -11
- package/lib/polygon/models/extrude.js +146 -87
- package/lib/polygon/models/fill.js +89 -50
- package/lib/polygon/models/index.js +14 -2
- package/lib/polygon/models/ocean.js +88 -42
- package/lib/polygon/models/water.js +82 -37
- package/lib/raster/buffers/triangulation.js +7 -3
- package/lib/raster/index.js +40 -9
- package/lib/raster/models/index.js +5 -0
- package/lib/raster/models/raster.js +125 -80
- package/lib/raster/models/rasterRgb.js +139 -84
- package/lib/raster/models/rasterTerrainRgb.js +93 -56
- package/lib/tile/interaction/getRasterData.js +25 -14
- package/lib/tile/interaction/utils.js +19 -7
- package/lib/tile/manager/base.js +104 -63
- package/lib/tile/service/TileLayerService.js +60 -33
- package/lib/tile/service/TilePickService.js +48 -26
- package/lib/tile/service/TileSourceService.js +16 -2
- package/lib/tile/style/utils.js +3 -0
- package/lib/tile/tileFactory/DebugTile.js +54 -29
- package/lib/tile/tileFactory/ImageTile.js +46 -20
- package/lib/tile/tileFactory/MaskTile.js +51 -22
- package/lib/tile/tileFactory/RasterRGBTile.js +50 -22
- package/lib/tile/tileFactory/RasterTerrainRGBTile.js +46 -20
- package/lib/tile/tileFactory/RasterTile.js +63 -30
- package/lib/tile/tileFactory/Tile.js +102 -63
- package/lib/tile/tileFactory/VectorTile.js +76 -41
- package/lib/tile/tileFactory/index.js +25 -0
- package/lib/tile/tileFactory/layers/TileDebugLayer.js +32 -6
- package/lib/tile/tileFactory/util.js +9 -0
- package/lib/tile/tileLayer/BaseLayer.js +153 -105
- package/lib/tile/utils.js +5 -1
- package/lib/utils/blend.js +5 -0
- package/lib/utils/collision-index.js +25 -9
- package/lib/utils/extrude_polyline.js +181 -101
- package/lib/utils/grid-index.js +28 -2
- package/lib/utils/identityScale.js +9 -0
- package/lib/utils/layerData.js +49 -30
- package/lib/utils/multiPassRender.js +16 -11
- package/lib/utils/polylineNormal.js +66 -31
- package/lib/utils/simpleLine.js +21 -2
- package/lib/utils/stencil.js +4 -0
- package/lib/utils/symbol-layout.js +55 -27
- package/lib/wind/index.js +37 -9
- package/lib/wind/models/index.js +3 -0
- package/lib/wind/models/utils.js +62 -26
- package/lib/wind/models/wind.js +157 -101
- package/lib/wind/models/windRender.js +71 -53
- package/lib/wind/models/windShader.js +1 -0
- package/package.json +7 -7
package/es/core/shape/extrude.js
CHANGED
|
@@ -2,6 +2,7 @@ import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
|
2
2
|
import { lngLatToMeters } from '@antv/l7-utils';
|
|
3
3
|
import earcut from 'earcut';
|
|
4
4
|
import { vec3 } from 'gl-matrix';
|
|
5
|
+
|
|
5
6
|
/**
|
|
6
7
|
* 拉伸多边形顶点,返回拉伸后的顶点信息
|
|
7
8
|
* @param paths 路径数据组
|
|
@@ -10,16 +11,18 @@ import { vec3 } from 'gl-matrix';
|
|
|
10
11
|
export default function extrudePolygon(path) {
|
|
11
12
|
var p1 = path[0][0];
|
|
12
13
|
var p2 = path[0][path[0].length - 1];
|
|
14
|
+
|
|
13
15
|
if (p1[0] === p2[0] && p1[1] === p2[1]) {
|
|
14
16
|
path[0] = path[0].slice(0, path[0].length - 1);
|
|
15
17
|
}
|
|
18
|
+
|
|
16
19
|
var n = path[0].length;
|
|
17
20
|
var flattengeo = earcut.flatten(path);
|
|
18
21
|
var vertices = flattengeo.vertices,
|
|
19
|
-
|
|
22
|
+
dimensions = flattengeo.dimensions;
|
|
20
23
|
var positions = [];
|
|
21
|
-
var indexArray = [];
|
|
22
|
-
|
|
24
|
+
var indexArray = []; // 设置顶部z值
|
|
25
|
+
|
|
23
26
|
for (var j = 0; j < vertices.length / dimensions; j++) {
|
|
24
27
|
if (dimensions === 2) {
|
|
25
28
|
positions.push(vertices[j * 2], vertices[j * 2 + 1], 1);
|
|
@@ -27,23 +30,29 @@ export default function extrudePolygon(path) {
|
|
|
27
30
|
positions.push(vertices[j * 3], vertices[j * 3 + 1], 1);
|
|
28
31
|
}
|
|
29
32
|
}
|
|
33
|
+
|
|
30
34
|
var triangles = earcut(flattengeo.vertices, flattengeo.holes, flattengeo.dimensions);
|
|
31
35
|
indexArray.push.apply(indexArray, _toConsumableArray(triangles));
|
|
32
|
-
|
|
36
|
+
|
|
37
|
+
var _loop = function _loop(i) {
|
|
33
38
|
var prePoint = flattengeo.vertices.slice(i * dimensions, (i + 1) * dimensions);
|
|
34
39
|
var nextPoint = flattengeo.vertices.slice((i + 1) * dimensions, (i + 2) * dimensions);
|
|
40
|
+
|
|
35
41
|
if (nextPoint.length === 0) {
|
|
36
42
|
nextPoint = flattengeo.vertices.slice(0, dimensions);
|
|
37
43
|
}
|
|
44
|
+
|
|
38
45
|
var indexOffset = positions.length / 3;
|
|
39
46
|
positions.push(prePoint[0], prePoint[1], 1, nextPoint[0], nextPoint[1], 1, prePoint[0], prePoint[1], 0, nextPoint[0], nextPoint[1], 0);
|
|
40
47
|
indexArray.push.apply(indexArray, _toConsumableArray([0, 2, 1, 2, 3, 1].map(function (v) {
|
|
41
48
|
return v + indexOffset;
|
|
42
49
|
})));
|
|
43
50
|
};
|
|
51
|
+
|
|
44
52
|
for (var i = 0; i < n; i++) {
|
|
45
|
-
_loop();
|
|
53
|
+
_loop(i);
|
|
46
54
|
}
|
|
55
|
+
|
|
47
56
|
return {
|
|
48
57
|
positions: positions,
|
|
49
58
|
index: indexArray
|
|
@@ -61,46 +70,44 @@ export function extrude_PolygonNormal(path) {
|
|
|
61
70
|
var needFlat = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
62
71
|
var p1 = path[0][0];
|
|
63
72
|
var p2 = path[0][path[0].length - 1];
|
|
73
|
+
|
|
64
74
|
if (p1[0] === p2[0] && p1[1] === p2[1]) {
|
|
65
75
|
path[0] = path[0].slice(0, path[0].length - 1);
|
|
66
76
|
}
|
|
77
|
+
|
|
67
78
|
var n = path[0].length;
|
|
68
79
|
var flattengeo = earcut.flatten(path);
|
|
69
80
|
var vertices = flattengeo.vertices,
|
|
70
|
-
|
|
81
|
+
dimensions = flattengeo.dimensions;
|
|
71
82
|
var positions = [];
|
|
72
83
|
var indexArray = [];
|
|
73
|
-
var normals = [];
|
|
74
|
-
|
|
84
|
+
var normals = []; // 设置顶部z值 position uv
|
|
85
|
+
|
|
75
86
|
for (var j = 0; j < vertices.length / dimensions; j++) {
|
|
76
|
-
positions.push(vertices[j * dimensions],
|
|
77
|
-
//
|
|
78
|
-
|
|
79
|
-
//
|
|
80
|
-
1,
|
|
81
|
-
// z
|
|
82
|
-
-1,
|
|
83
|
-
// 顶部uv
|
|
87
|
+
positions.push(vertices[j * dimensions], // x
|
|
88
|
+
vertices[j * dimensions + 1], // y
|
|
89
|
+
1, // z
|
|
90
|
+
-1, // 顶部uv
|
|
84
91
|
-1 // 顶部uv
|
|
85
92
|
);
|
|
86
|
-
|
|
87
93
|
normals.push(0, 0, 1);
|
|
88
94
|
}
|
|
95
|
+
|
|
89
96
|
var triangles = earcut(flattengeo.vertices, flattengeo.holes, flattengeo.dimensions);
|
|
90
|
-
indexArray.push.apply(indexArray, _toConsumableArray(triangles));
|
|
91
|
-
|
|
92
|
-
var _loop2 = function _loop2() {
|
|
97
|
+
indexArray.push.apply(indexArray, _toConsumableArray(triangles)); // 设置侧面
|
|
98
|
+
|
|
99
|
+
var _loop2 = function _loop2(i) {
|
|
93
100
|
var prePoint = flattengeo.vertices.slice(i * dimensions, (i + 1) * dimensions);
|
|
94
101
|
var nextPoint = flattengeo.vertices.slice((i + 1) * dimensions, (i + 2) * dimensions);
|
|
102
|
+
|
|
95
103
|
if (nextPoint.length === 0) {
|
|
96
104
|
nextPoint = flattengeo.vertices.slice(0, dimensions);
|
|
97
105
|
}
|
|
98
|
-
|
|
99
|
-
// 侧面四顶点
|
|
100
|
-
|
|
101
|
-
// 侧面 低uv
|
|
102
|
-
0,
|
|
103
|
-
// 侧面低 uv
|
|
106
|
+
|
|
107
|
+
var indexOffset = positions.length / 5; // 侧面四顶点
|
|
108
|
+
|
|
109
|
+
positions.push(prePoint[0], prePoint[1], 1, 0, 0, nextPoint[0], nextPoint[1], 1, 0.1, // 侧面 低uv
|
|
110
|
+
0, // 侧面低 uv
|
|
104
111
|
prePoint[0], prePoint[1], 0, 0, 0.8, nextPoint[0], nextPoint[1], 0, 0.1, 0.8);
|
|
105
112
|
var normal = computeVertexNormals([nextPoint[0], nextPoint[1], 1], [prePoint[0], prePoint[1], 0], [prePoint[0], prePoint[1], 1], needFlat);
|
|
106
113
|
normals.push.apply(normals, _toConsumableArray(normal).concat(_toConsumableArray(normal), _toConsumableArray(normal), _toConsumableArray(normal)));
|
|
@@ -108,25 +115,30 @@ export function extrude_PolygonNormal(path) {
|
|
|
108
115
|
return v + indexOffset;
|
|
109
116
|
})));
|
|
110
117
|
};
|
|
118
|
+
|
|
111
119
|
for (var i = 0; i < n; i++) {
|
|
112
|
-
_loop2();
|
|
120
|
+
_loop2(i);
|
|
113
121
|
}
|
|
122
|
+
|
|
114
123
|
return {
|
|
115
124
|
positions: positions,
|
|
116
125
|
index: indexArray,
|
|
117
126
|
normals: normals
|
|
118
127
|
};
|
|
119
128
|
}
|
|
129
|
+
|
|
120
130
|
function computeVertexNormals(p1, p2, p3) {
|
|
121
131
|
var needFlat = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
122
132
|
var cb = vec3.create();
|
|
123
133
|
var ab = vec3.create();
|
|
124
134
|
var normal = vec3.create();
|
|
135
|
+
|
|
125
136
|
if (needFlat) {
|
|
126
137
|
p1 = lngLatToMeters(p1);
|
|
127
138
|
p2 = lngLatToMeters(p2);
|
|
128
139
|
p3 = lngLatToMeters(p3);
|
|
129
140
|
}
|
|
141
|
+
|
|
130
142
|
var pA = vec3.fromValues.apply(vec3, _toConsumableArray(p1));
|
|
131
143
|
var pB = vec3.fromValues.apply(vec3, _toConsumableArray(p2));
|
|
132
144
|
var pC = vec3.fromValues.apply(vec3, _toConsumableArray(p3));
|