@antv/l7-layers 2.17.4 → 2.17.5
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.js +325 -483
- package/es/core/BaseModel.js +51 -80
- package/es/core/CommonStyleAttribute.js +2 -5
- package/es/core/LayerPickService.js +21 -32
- package/es/core/TextureService.js +0 -13
- package/es/core/interface.js +17 -24
- package/es/core/shape/Path.js +13 -20
- package/es/core/shape/extrude.js +27 -39
- package/es/core/triangulation.js +99 -136
- 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 +28 -52
- package/es/heatmap/models/grid3d.js +28 -52
- package/es/heatmap/models/heatmap.js +92 -149
- package/es/heatmap/models/hexagon.js +28 -52
- 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.js +9 -35
- package/es/line/models/arc.js +63 -112
- package/es/line/models/arc_3d.js +58 -102
- package/es/line/models/earthArc_3d.js +60 -105
- package/es/line/models/flow.js +36 -60
- package/es/line/models/great_circle.js +53 -94
- package/es/line/models/line.js +92 -144
- package/es/line/models/linearline.js +42 -74
- package/es/line/models/simpleLine.js +38 -67
- package/es/line/models/wall.js +52 -92
- package/es/line/shaders/dash/line_dash_vert.glsl +1 -2
- package/es/line/shaders/line_frag.glsl +1 -3
- package/es/line/shaders/line_vert.glsl +2 -0
- package/es/line/shaders/linear/line_linear_frag.glsl +1 -1
- package/es/mask/index.js +9 -28
- package/es/mask/models/fill.js +29 -54
- package/es/plugins/DataMappingPlugin.js +78 -114
- 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 +69 -118
- package/es/plugins/LayerStylePlugin.js +4 -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 +13 -27
- package/es/plugins/UpdateModelPlugin.js +0 -5
- package/es/plugins/UpdateStyleAttributePlugin.js +5 -11
- package/es/point/index.js +26 -78
- package/es/point/models/earthExtrude.js +58 -95
- package/es/point/models/earthFill.js +52 -80
- package/es/point/models/extrude.js +57 -94
- package/es/point/models/fill.js +56 -81
- package/es/point/models/fillmage.js +60 -100
- package/es/point/models/image.js +47 -83
- package/es/point/models/index.js +2 -2
- package/es/point/models/normal.js +30 -54
- package/es/point/models/radar.js +38 -63
- package/es/point/models/simplePoint.js +38 -62
- package/es/point/models/text.js +199 -296
- package/es/point/shape/extrude.js +4 -13
- package/es/polygon/index.js +11 -41
- package/es/polygon/models/extrude.js +87 -135
- package/es/polygon/models/fill.js +50 -79
- 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/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 +30 -44
- 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 +325 -474
- package/lib/core/BaseModel.js +51 -90
- package/lib/core/CommonStyleAttribute.js +2 -7
- 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 -62
- package/lib/core/triangulation.js +98 -177
- 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 +28 -60
- package/lib/heatmap/models/grid3d.js +28 -60
- package/lib/heatmap/models/heatmap.js +92 -166
- package/lib/heatmap/models/hexagon.js +28 -60
- package/lib/heatmap/models/index.js +0 -6
- 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 +9 -40
- package/lib/line/models/arc.js +61 -122
- package/lib/line/models/arc_3d.js +56 -113
- package/lib/line/models/earthArc_3d.js +58 -115
- package/lib/line/models/flow.js +36 -70
- package/lib/line/models/great_circle.js +53 -104
- package/lib/line/models/index.js +0 -11
- package/lib/line/models/line.js +90 -152
- package/lib/line/models/linearline.js +42 -86
- package/lib/line/models/simpleLine.js +38 -77
- package/lib/line/models/wall.js +52 -103
- package/lib/line/shaders/dash/line_dash_vert.glsl +1 -2
- package/lib/line/shaders/line_frag.glsl +1 -3
- package/lib/line/shaders/line_vert.glsl +2 -0
- package/lib/line/shaders/linear/line_linear_frag.glsl +1 -1
- 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 +78 -125
- 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 +70 -127
- package/lib/plugins/LayerStylePlugin.js +5 -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 +13 -34
- package/lib/plugins/UpdateModelPlugin.js +1 -10
- package/lib/plugins/UpdateStyleAttributePlugin.js +5 -16
- package/lib/point/index.js +26 -83
- package/lib/point/models/earthExtrude.js +58 -106
- package/lib/point/models/earthFill.js +52 -110
- package/lib/point/models/extrude.js +57 -103
- package/lib/point/models/fill.js +54 -90
- package/lib/point/models/fillmage.js +58 -107
- package/lib/point/models/image.js +47 -92
- package/lib/point/models/index.js +1 -12
- package/lib/point/models/normal.js +30 -64
- package/lib/point/models/radar.js +38 -72
- package/lib/point/models/simplePoint.js +38 -72
- package/lib/point/models/text.js +199 -305
- package/lib/point/shape/extrude.js +4 -20
- package/lib/polygon/index.js +11 -48
- package/lib/polygon/models/extrude.js +87 -146
- package/lib/polygon/models/fill.js +50 -89
- 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/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 +30 -49
- 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/core/shape/extrude.js
CHANGED
|
@@ -2,7 +2,6 @@ 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
|
-
|
|
6
5
|
/**
|
|
7
6
|
* 拉伸多边形顶点,返回拉伸后的顶点信息
|
|
8
7
|
* @param paths 路径数据组
|
|
@@ -11,18 +10,16 @@ import { vec3 } from 'gl-matrix';
|
|
|
11
10
|
export default function extrudePolygon(path) {
|
|
12
11
|
var p1 = path[0][0];
|
|
13
12
|
var p2 = path[0][path[0].length - 1];
|
|
14
|
-
|
|
15
13
|
if (p1[0] === p2[0] && p1[1] === p2[1]) {
|
|
16
14
|
path[0] = path[0].slice(0, path[0].length - 1);
|
|
17
15
|
}
|
|
18
|
-
|
|
19
16
|
var n = path[0].length;
|
|
20
17
|
var flattengeo = earcut.flatten(path);
|
|
21
18
|
var vertices = flattengeo.vertices,
|
|
22
|
-
|
|
19
|
+
dimensions = flattengeo.dimensions;
|
|
23
20
|
var positions = [];
|
|
24
|
-
var indexArray = [];
|
|
25
|
-
|
|
21
|
+
var indexArray = [];
|
|
22
|
+
// 设置顶部z值
|
|
26
23
|
for (var j = 0; j < vertices.length / dimensions; j++) {
|
|
27
24
|
if (dimensions === 2) {
|
|
28
25
|
positions.push(vertices[j * 2], vertices[j * 2 + 1], 1);
|
|
@@ -30,29 +27,23 @@ export default function extrudePolygon(path) {
|
|
|
30
27
|
positions.push(vertices[j * 3], vertices[j * 3 + 1], 1);
|
|
31
28
|
}
|
|
32
29
|
}
|
|
33
|
-
|
|
34
30
|
var triangles = earcut(flattengeo.vertices, flattengeo.holes, flattengeo.dimensions);
|
|
35
31
|
indexArray.push.apply(indexArray, _toConsumableArray(triangles));
|
|
36
|
-
|
|
37
|
-
var _loop = function _loop(i) {
|
|
32
|
+
var _loop = function _loop() {
|
|
38
33
|
var prePoint = flattengeo.vertices.slice(i * dimensions, (i + 1) * dimensions);
|
|
39
34
|
var nextPoint = flattengeo.vertices.slice((i + 1) * dimensions, (i + 2) * dimensions);
|
|
40
|
-
|
|
41
35
|
if (nextPoint.length === 0) {
|
|
42
36
|
nextPoint = flattengeo.vertices.slice(0, dimensions);
|
|
43
37
|
}
|
|
44
|
-
|
|
45
38
|
var indexOffset = positions.length / 3;
|
|
46
39
|
positions.push(prePoint[0], prePoint[1], 1, nextPoint[0], nextPoint[1], 1, prePoint[0], prePoint[1], 0, nextPoint[0], nextPoint[1], 0);
|
|
47
40
|
indexArray.push.apply(indexArray, _toConsumableArray([0, 2, 1, 2, 3, 1].map(function (v) {
|
|
48
41
|
return v + indexOffset;
|
|
49
42
|
})));
|
|
50
43
|
};
|
|
51
|
-
|
|
52
44
|
for (var i = 0; i < n; i++) {
|
|
53
|
-
_loop(
|
|
45
|
+
_loop();
|
|
54
46
|
}
|
|
55
|
-
|
|
56
47
|
return {
|
|
57
48
|
positions: positions,
|
|
58
49
|
index: indexArray
|
|
@@ -70,44 +61,46 @@ export function extrude_PolygonNormal(path) {
|
|
|
70
61
|
var needFlat = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
71
62
|
var p1 = path[0][0];
|
|
72
63
|
var p2 = path[0][path[0].length - 1];
|
|
73
|
-
|
|
74
64
|
if (p1[0] === p2[0] && p1[1] === p2[1]) {
|
|
75
65
|
path[0] = path[0].slice(0, path[0].length - 1);
|
|
76
66
|
}
|
|
77
|
-
|
|
78
67
|
var n = path[0].length;
|
|
79
68
|
var flattengeo = earcut.flatten(path);
|
|
80
69
|
var vertices = flattengeo.vertices,
|
|
81
|
-
|
|
70
|
+
dimensions = flattengeo.dimensions;
|
|
82
71
|
var positions = [];
|
|
83
72
|
var indexArray = [];
|
|
84
|
-
var normals = [];
|
|
85
|
-
|
|
73
|
+
var normals = [];
|
|
74
|
+
// 设置顶部z值 position uv
|
|
86
75
|
for (var j = 0; j < vertices.length / dimensions; j++) {
|
|
87
|
-
positions.push(vertices[j * dimensions],
|
|
88
|
-
|
|
89
|
-
1,
|
|
90
|
-
|
|
76
|
+
positions.push(vertices[j * dimensions],
|
|
77
|
+
// x
|
|
78
|
+
vertices[j * dimensions + 1],
|
|
79
|
+
// y
|
|
80
|
+
1,
|
|
81
|
+
// z
|
|
82
|
+
-1,
|
|
83
|
+
// 顶部uv
|
|
91
84
|
-1 // 顶部uv
|
|
92
85
|
);
|
|
86
|
+
|
|
93
87
|
normals.push(0, 0, 1);
|
|
94
88
|
}
|
|
95
|
-
|
|
96
89
|
var triangles = earcut(flattengeo.vertices, flattengeo.holes, flattengeo.dimensions);
|
|
97
|
-
indexArray.push.apply(indexArray, _toConsumableArray(triangles));
|
|
98
|
-
|
|
99
|
-
var _loop2 = function _loop2(
|
|
90
|
+
indexArray.push.apply(indexArray, _toConsumableArray(triangles));
|
|
91
|
+
// 设置侧面
|
|
92
|
+
var _loop2 = function _loop2() {
|
|
100
93
|
var prePoint = flattengeo.vertices.slice(i * dimensions, (i + 1) * dimensions);
|
|
101
94
|
var nextPoint = flattengeo.vertices.slice((i + 1) * dimensions, (i + 2) * dimensions);
|
|
102
|
-
|
|
103
95
|
if (nextPoint.length === 0) {
|
|
104
96
|
nextPoint = flattengeo.vertices.slice(0, dimensions);
|
|
105
97
|
}
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
0,
|
|
98
|
+
var indexOffset = positions.length / 5;
|
|
99
|
+
// 侧面四顶点
|
|
100
|
+
positions.push(prePoint[0], prePoint[1], 1, 0, 0, nextPoint[0], nextPoint[1], 1, 0.1,
|
|
101
|
+
// 侧面 低uv
|
|
102
|
+
0,
|
|
103
|
+
// 侧面低 uv
|
|
111
104
|
prePoint[0], prePoint[1], 0, 0, 0.8, nextPoint[0], nextPoint[1], 0, 0.1, 0.8);
|
|
112
105
|
var normal = computeVertexNormals([nextPoint[0], nextPoint[1], 1], [prePoint[0], prePoint[1], 0], [prePoint[0], prePoint[1], 1], needFlat);
|
|
113
106
|
normals.push.apply(normals, _toConsumableArray(normal).concat(_toConsumableArray(normal), _toConsumableArray(normal), _toConsumableArray(normal)));
|
|
@@ -115,30 +108,25 @@ export function extrude_PolygonNormal(path) {
|
|
|
115
108
|
return v + indexOffset;
|
|
116
109
|
})));
|
|
117
110
|
};
|
|
118
|
-
|
|
119
111
|
for (var i = 0; i < n; i++) {
|
|
120
|
-
_loop2(
|
|
112
|
+
_loop2();
|
|
121
113
|
}
|
|
122
|
-
|
|
123
114
|
return {
|
|
124
115
|
positions: positions,
|
|
125
116
|
index: indexArray,
|
|
126
117
|
normals: normals
|
|
127
118
|
};
|
|
128
119
|
}
|
|
129
|
-
|
|
130
120
|
function computeVertexNormals(p1, p2, p3) {
|
|
131
121
|
var needFlat = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
132
122
|
var cb = vec3.create();
|
|
133
123
|
var ab = vec3.create();
|
|
134
124
|
var normal = vec3.create();
|
|
135
|
-
|
|
136
125
|
if (needFlat) {
|
|
137
126
|
p1 = lngLatToMeters(p1);
|
|
138
127
|
p2 = lngLatToMeters(p2);
|
|
139
128
|
p3 = lngLatToMeters(p3);
|
|
140
129
|
}
|
|
141
|
-
|
|
142
130
|
var pA = vec3.fromValues.apply(vec3, _toConsumableArray(p1));
|
|
143
131
|
var pB = vec3.fromValues.apply(vec3, _toConsumableArray(p2));
|
|
144
132
|
var pC = vec3.fromValues.apply(vec3, _toConsumableArray(p3));
|