@antv/l7-layers 2.15.2 → 2.15.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 +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 +320 -484
- package/es/core/BaseModel.js +97 -126
- 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 +10 -31
- package/es/core/triangulation.js +54 -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 +28 -52
- package/es/heatmap/models/grid3d.js +28 -52
- package/es/heatmap/models/heatmap.js +91 -146
- 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 -34
- package/es/line/models/arc.js +66 -118
- package/es/line/models/arc_3d.js +60 -108
- package/es/line/models/earthArc_3d.js +63 -111
- package/es/line/models/great_circle.js +56 -100
- package/es/line/models/half.js +46 -77
- package/es/line/models/line.js +94 -148
- package/es/line/models/linearline.js +45 -80
- package/es/line/models/simpleLine.js +41 -74
- package/es/line/models/wall.js +52 -92
- package/es/mask/index.js +9 -28
- package/es/mask/models/fill.js +29 -54
- package/es/plugins/DataMappingPlugin.js +80 -117
- 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 +67 -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 +13 -27
- package/es/plugins/UpdateModelPlugin.js +0 -5
- package/es/plugins/UpdateStyleAttributePlugin.js +5 -11
- package/es/point/index.js +26 -77
- package/es/point/models/earthExtrude.js +61 -102
- package/es/point/models/earthFill.js +57 -87
- package/es/point/models/extrude.js +60 -101
- package/es/point/models/fill.js +70 -100
- package/es/point/models/fillmage.js +63 -107
- package/es/point/models/image.js +48 -88
- package/es/point/models/index.js +2 -2
- package/es/point/models/normal.js +30 -54
- package/es/point/models/radar.js +40 -64
- package/es/point/models/simplePoint.js +41 -69
- package/es/point/models/text.js +197 -299
- package/es/point/shape/extrude.js +4 -13
- package/es/polygon/index.js +11 -40
- package/es/polygon/models/extrude.js +48 -92
- package/es/polygon/models/fill.js +54 -88
- 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 +30 -52
- package/es/tile/service/TilePickService.js +26 -40
- package/es/tile/service/TileSourceService.js +3 -7
- package/es/tile/tileFactory/DebugTile.js +28 -45
- 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/dataMappingStyle.js +8 -18
- 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 +320 -478
- package/lib/core/BaseModel.js +97 -139
- 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 +10 -54
- package/lib/core/triangulation.js +53 -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 +28 -60
- package/lib/heatmap/models/grid3d.js +28 -60
- package/lib/heatmap/models/heatmap.js +91 -162
- 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 +64 -128
- package/lib/line/models/arc_3d.js +58 -119
- package/lib/line/models/earthArc_3d.js +61 -122
- package/lib/line/models/great_circle.js +56 -111
- package/lib/line/models/half.js +46 -87
- package/lib/line/models/index.js +0 -11
- package/lib/line/models/line.js +92 -156
- package/lib/line/models/linearline.js +45 -92
- package/lib/line/models/simpleLine.js +41 -84
- package/lib/line/models/wall.js +52 -103
- 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 +80 -128
- 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 +68 -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 +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 +61 -113
- package/lib/point/models/earthFill.js +57 -117
- package/lib/point/models/extrude.js +60 -111
- package/lib/point/models/fill.js +68 -109
- package/lib/point/models/fillmage.js +61 -115
- package/lib/point/models/image.js +48 -98
- package/lib/point/models/index.js +1 -12
- package/lib/point/models/normal.js +30 -64
- package/lib/point/models/radar.js +40 -74
- package/lib/point/models/simplePoint.js +41 -79
- package/lib/point/models/text.js +197 -307
- package/lib/point/shape/extrude.js +4 -20
- package/lib/polygon/index.js +11 -48
- package/lib/polygon/models/extrude.js +48 -103
- package/lib/polygon/models/fill.js +54 -98
- 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 +30 -57
- 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 +28 -53
- 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/dataMappingStyle.js +8 -19
- 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
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
-
|
|
7
5
|
Object.defineProperty(exports, "__esModule", {
|
|
8
6
|
value: true
|
|
9
7
|
});
|
|
@@ -25,31 +23,21 @@ exports.earthOuterTriangulation = earthOuterTriangulation;
|
|
|
25
23
|
exports.earthTriangulation = earthTriangulation;
|
|
26
24
|
exports.polygonTriangulation = polygonTriangulation;
|
|
27
25
|
exports.polygonTriangulationWithCenter = polygonTriangulationWithCenter;
|
|
28
|
-
|
|
29
26
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
30
|
-
|
|
31
27
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
32
|
-
|
|
33
28
|
var _l7Utils = require("@antv/l7-utils");
|
|
34
|
-
|
|
35
29
|
var _earcut = _interopRequireDefault(require("earcut"));
|
|
36
|
-
|
|
37
30
|
var _glMatrix = require("gl-matrix");
|
|
38
|
-
|
|
39
31
|
var _utils = require("../earth/utils");
|
|
40
|
-
|
|
41
32
|
var _extrude_polyline = _interopRequireDefault(require("../utils/extrude_polyline"));
|
|
42
|
-
|
|
43
33
|
var _extrude = _interopRequireWildcard(require("./shape/extrude"));
|
|
44
|
-
|
|
45
34
|
var _Path = require("./shape/Path");
|
|
46
|
-
|
|
47
35
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
48
|
-
|
|
49
36
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
50
|
-
|
|
51
37
|
// @ts-ignore
|
|
38
|
+
|
|
52
39
|
var GeometryCache = {};
|
|
40
|
+
|
|
53
41
|
/**
|
|
54
42
|
* 计算2D 填充点图顶点
|
|
55
43
|
* @param feature 映射feature
|
|
@@ -67,8 +55,6 @@ function PointFillTriangulation(feature) {
|
|
|
67
55
|
* 计算2D 填充点图顶点 (地球模式)
|
|
68
56
|
* @param feature 映射feature
|
|
69
57
|
*/
|
|
70
|
-
|
|
71
|
-
|
|
72
58
|
function GlobelPointFillTriangulation(feature) {
|
|
73
59
|
var coordinates = (0, _l7Utils.calculateCentroid)(feature.coordinates);
|
|
74
60
|
var xyz = (0, _utils.lglt2xyz)(coordinates);
|
|
@@ -78,20 +64,17 @@ function GlobelPointFillTriangulation(feature) {
|
|
|
78
64
|
size: xyz.length
|
|
79
65
|
};
|
|
80
66
|
}
|
|
67
|
+
|
|
81
68
|
/**
|
|
82
69
|
* 计算3D 拉伸点图
|
|
83
70
|
* @param feature 映射feature
|
|
84
71
|
*/
|
|
85
|
-
|
|
86
|
-
|
|
87
72
|
function PointExtrudeTriangulation(feature) {
|
|
88
73
|
var shape = feature.shape;
|
|
89
|
-
|
|
90
74
|
var _getGeometry = getGeometry(shape, false),
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
75
|
+
positions = _getGeometry.positions,
|
|
76
|
+
index = _getGeometry.index,
|
|
77
|
+
normals = _getGeometry.normals;
|
|
95
78
|
return {
|
|
96
79
|
vertices: positions,
|
|
97
80
|
indices: index,
|
|
@@ -99,12 +82,11 @@ function PointExtrudeTriangulation(feature) {
|
|
|
99
82
|
size: 5
|
|
100
83
|
};
|
|
101
84
|
}
|
|
85
|
+
|
|
102
86
|
/**
|
|
103
87
|
* 计算图片标注
|
|
104
88
|
* @param feature 映射feature
|
|
105
89
|
*/
|
|
106
|
-
|
|
107
|
-
|
|
108
90
|
function PointImageTriangulation(feature) {
|
|
109
91
|
var coordinates = (0, _l7Utils.calculateCentroid)(feature.coordinates);
|
|
110
92
|
return {
|
|
@@ -113,16 +95,16 @@ function PointImageTriangulation(feature) {
|
|
|
113
95
|
size: coordinates.length
|
|
114
96
|
};
|
|
115
97
|
}
|
|
98
|
+
|
|
116
99
|
/**
|
|
117
100
|
* 线三角化
|
|
118
101
|
* @param feature 映射feature
|
|
119
102
|
*/
|
|
120
|
-
|
|
121
|
-
|
|
122
103
|
function LineTriangulation(feature) {
|
|
123
104
|
var coordinates = feature.coordinates,
|
|
124
|
-
|
|
125
|
-
|
|
105
|
+
originCoordinates = feature.originCoordinates,
|
|
106
|
+
version = feature.version;
|
|
107
|
+
// let path = coordinates as number[][][] | number[][];
|
|
126
108
|
// if (!Array.isArray(path[0][0])) {
|
|
127
109
|
// path = [coordinates] as number[][][];
|
|
128
110
|
// }
|
|
@@ -131,21 +113,16 @@ function LineTriangulation(feature) {
|
|
|
131
113
|
dash: true,
|
|
132
114
|
join: 'bevel'
|
|
133
115
|
});
|
|
134
|
-
|
|
135
116
|
if (version === 'GAODE2.x') {
|
|
136
117
|
// 处理高德2.0几何体构建
|
|
137
118
|
var path1 = coordinates; // 计算位置
|
|
138
|
-
|
|
139
119
|
if (!Array.isArray(path1[0][0])) {
|
|
140
120
|
path1 = [coordinates];
|
|
141
121
|
}
|
|
142
|
-
|
|
143
122
|
var path2 = originCoordinates; // 计算法线
|
|
144
|
-
|
|
145
123
|
if (!Array.isArray(path2[0][0])) {
|
|
146
124
|
path2 = [originCoordinates];
|
|
147
125
|
}
|
|
148
|
-
|
|
149
126
|
for (var i = 0; i < path1.length; i++) {
|
|
150
127
|
// 高德2.0在计算线时,需要使用经纬度计算发现,使用 customCoords.lnglatToCoords 计算的数据来计算顶点的位置
|
|
151
128
|
var item1 = path1[i];
|
|
@@ -155,16 +132,13 @@ function LineTriangulation(feature) {
|
|
|
155
132
|
} else {
|
|
156
133
|
// 处理非高德2.0的几何体构建
|
|
157
134
|
var path = coordinates;
|
|
158
|
-
|
|
159
135
|
if (path[0] && !Array.isArray(path[0][0])) {
|
|
160
136
|
path = [coordinates];
|
|
161
137
|
}
|
|
162
|
-
|
|
163
138
|
path.forEach(function (item) {
|
|
164
139
|
line.extrude(item);
|
|
165
140
|
});
|
|
166
141
|
}
|
|
167
|
-
|
|
168
142
|
var linebuffer = line.complex;
|
|
169
143
|
return {
|
|
170
144
|
vertices: linebuffer.positions,
|
|
@@ -175,11 +149,9 @@ function LineTriangulation(feature) {
|
|
|
175
149
|
size: 6
|
|
176
150
|
};
|
|
177
151
|
}
|
|
178
|
-
|
|
179
152
|
function SimpleLineTriangulation(feature) {
|
|
180
153
|
var coordinates = feature.coordinates;
|
|
181
154
|
var pos = [];
|
|
182
|
-
|
|
183
155
|
if (!Array.isArray(coordinates[0])) {
|
|
184
156
|
return {
|
|
185
157
|
vertices: [],
|
|
@@ -189,11 +161,9 @@ function SimpleLineTriangulation(feature) {
|
|
|
189
161
|
count: 0
|
|
190
162
|
};
|
|
191
163
|
}
|
|
192
|
-
|
|
193
164
|
var _getSimpleLineVertice = getSimpleLineVertices(coordinates),
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
165
|
+
results = _getSimpleLineVertice.results,
|
|
166
|
+
totalDistance = _getSimpleLineVertice.totalDistance;
|
|
197
167
|
results.map(function (point) {
|
|
198
168
|
pos.push(point[0], point[1], point[2], point[3], 0, totalDistance);
|
|
199
169
|
});
|
|
@@ -205,11 +175,9 @@ function SimpleLineTriangulation(feature) {
|
|
|
205
175
|
count: results.length
|
|
206
176
|
};
|
|
207
177
|
}
|
|
208
|
-
|
|
209
178
|
function TileSimpleLineTriangulation(feature) {
|
|
210
179
|
var coordinates = feature.coordinates;
|
|
211
180
|
var pos = [];
|
|
212
|
-
|
|
213
181
|
if (!Array.isArray(coordinates[0])) {
|
|
214
182
|
return {
|
|
215
183
|
vertices: [],
|
|
@@ -218,10 +186,8 @@ function TileSimpleLineTriangulation(feature) {
|
|
|
218
186
|
count: 0
|
|
219
187
|
};
|
|
220
188
|
}
|
|
221
|
-
|
|
222
189
|
var _getTileSimpleLineVer = getTileSimpleLineVertices(coordinates),
|
|
223
|
-
|
|
224
|
-
|
|
190
|
+
results = _getTileSimpleLineVer.results;
|
|
225
191
|
results.map(function (point) {
|
|
226
192
|
pos.push(point[0], point[1], point[2], point[3]);
|
|
227
193
|
});
|
|
@@ -232,35 +198,27 @@ function TileSimpleLineTriangulation(feature) {
|
|
|
232
198
|
count: results.length
|
|
233
199
|
};
|
|
234
200
|
}
|
|
235
|
-
|
|
236
201
|
function lineSegmentDistance(b1, a1) {
|
|
237
202
|
var dx = a1[0] - b1[0];
|
|
238
203
|
var dy = a1[1] - b1[1];
|
|
239
204
|
return Math.sqrt(dx * dx + dy * dy);
|
|
240
205
|
}
|
|
241
|
-
|
|
242
206
|
function pushDis(point, n) {
|
|
243
207
|
if (point.length < 3) {
|
|
244
208
|
point.push(0);
|
|
245
209
|
}
|
|
246
|
-
|
|
247
210
|
if (n !== undefined) {
|
|
248
211
|
point.push(n);
|
|
249
212
|
}
|
|
250
|
-
|
|
251
213
|
return point;
|
|
252
214
|
}
|
|
253
|
-
|
|
254
215
|
function getSimpleLineVertices(coordinates) {
|
|
255
216
|
var points = coordinates;
|
|
256
|
-
|
|
257
217
|
if (Array.isArray(points) && Array.isArray(points[0]) && Array.isArray(points[0][0])) {
|
|
258
218
|
// @ts-ignore
|
|
259
219
|
points = coordinates.flat();
|
|
260
220
|
}
|
|
261
|
-
|
|
262
221
|
var distance = 0;
|
|
263
|
-
|
|
264
222
|
if (points.length < 2) {
|
|
265
223
|
return {
|
|
266
224
|
results: points,
|
|
@@ -270,7 +228,6 @@ function getSimpleLineVertices(coordinates) {
|
|
|
270
228
|
var results = [];
|
|
271
229
|
var point = pushDis(points[0], distance);
|
|
272
230
|
results.push(point);
|
|
273
|
-
|
|
274
231
|
for (var i = 1; i < points.length - 1; i++) {
|
|
275
232
|
var subDistance = lineSegmentDistance(points[i - 1], points[i]);
|
|
276
233
|
distance += subDistance;
|
|
@@ -278,7 +235,6 @@ function getSimpleLineVertices(coordinates) {
|
|
|
278
235
|
results.push(mulPoint);
|
|
279
236
|
results.push(mulPoint);
|
|
280
237
|
}
|
|
281
|
-
|
|
282
238
|
var pointDistance = lineSegmentDistance(points[points.length - 2], points[points.length - 1]);
|
|
283
239
|
distance += pointDistance;
|
|
284
240
|
results.push(pushDis(points[points.length - 1], distance));
|
|
@@ -288,7 +244,6 @@ function getSimpleLineVertices(coordinates) {
|
|
|
288
244
|
};
|
|
289
245
|
}
|
|
290
246
|
}
|
|
291
|
-
|
|
292
247
|
function getTileSimpleLineVertices(points) {
|
|
293
248
|
if (points.length < 2) {
|
|
294
249
|
return {
|
|
@@ -298,75 +253,61 @@ function getTileSimpleLineVertices(points) {
|
|
|
298
253
|
var results = [];
|
|
299
254
|
var point = pushDis(points[0]);
|
|
300
255
|
results.push(point);
|
|
301
|
-
|
|
302
256
|
for (var i = 1; i < points.length - 1; i++) {
|
|
303
257
|
var mulPoint = pushDis(points[i]);
|
|
304
258
|
results.push(mulPoint);
|
|
305
259
|
results.push(mulPoint);
|
|
306
260
|
}
|
|
307
|
-
|
|
308
261
|
results.push(pushDis(points[points.length - 1]));
|
|
309
262
|
return {
|
|
310
263
|
results: results
|
|
311
264
|
};
|
|
312
265
|
}
|
|
313
266
|
}
|
|
314
|
-
|
|
315
267
|
function polygonTriangulation(feature) {
|
|
316
268
|
var coordinates = feature.coordinates;
|
|
317
|
-
|
|
318
269
|
var flattengeo = _earcut.default.flatten(coordinates);
|
|
319
|
-
|
|
320
270
|
var vertices = flattengeo.vertices,
|
|
321
|
-
|
|
322
|
-
|
|
271
|
+
dimensions = flattengeo.dimensions,
|
|
272
|
+
holes = flattengeo.holes;
|
|
323
273
|
return {
|
|
324
274
|
indices: (0, _earcut.default)(vertices, holes, dimensions),
|
|
325
275
|
vertices: vertices,
|
|
326
276
|
size: dimensions
|
|
327
277
|
};
|
|
328
|
-
}
|
|
329
|
-
|
|
278
|
+
}
|
|
330
279
|
|
|
280
|
+
// 构建几何图形(带有中心点和大小)
|
|
331
281
|
function polygonTriangulationWithCenter(feature) {
|
|
332
282
|
var coordinates = feature.coordinates;
|
|
333
|
-
|
|
334
283
|
var flattengeo = _earcut.default.flatten(coordinates);
|
|
335
|
-
|
|
336
284
|
var vertices = flattengeo.vertices,
|
|
337
|
-
|
|
338
|
-
|
|
285
|
+
dimensions = flattengeo.dimensions,
|
|
286
|
+
holes = flattengeo.holes;
|
|
339
287
|
return {
|
|
340
288
|
indices: (0, _earcut.default)(vertices, holes, dimensions),
|
|
341
289
|
vertices: getVerticesWithCenter(vertices),
|
|
342
290
|
size: dimensions + 4
|
|
343
291
|
};
|
|
344
292
|
}
|
|
345
|
-
|
|
346
293
|
function getVerticesWithCenter(vertices) {
|
|
347
294
|
var verticesWithCenter = [];
|
|
348
|
-
|
|
349
295
|
var _calculatePointsCente = (0, _l7Utils.calculatePointsCenterAndRadius)(vertices),
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
296
|
+
center = _calculatePointsCente.center,
|
|
297
|
+
radius = _calculatePointsCente.radius;
|
|
353
298
|
for (var i = 0; i < vertices.length; i += 2) {
|
|
354
299
|
var lng = vertices[i];
|
|
355
300
|
var lat = vertices[i + 1];
|
|
356
301
|
verticesWithCenter.push.apply(verticesWithCenter, [lng, lat, 0].concat((0, _toConsumableArray2.default)(center), [radius]));
|
|
357
302
|
}
|
|
358
|
-
|
|
359
303
|
return verticesWithCenter;
|
|
360
304
|
}
|
|
361
|
-
|
|
362
305
|
function PolygonExtrudeTriangulation(feature) {
|
|
363
306
|
var coordinates = feature.coordinates;
|
|
364
|
-
|
|
365
307
|
var _extrude_PolygonNorma = (0, _extrude.extrude_PolygonNormal)(coordinates, true),
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
308
|
+
positions = _extrude_PolygonNorma.positions,
|
|
309
|
+
index = _extrude_PolygonNorma.index,
|
|
310
|
+
normals = _extrude_PolygonNorma.normals;
|
|
370
311
|
return {
|
|
371
312
|
vertices: positions,
|
|
372
313
|
// [ x, y, z, uv.x,uv.y ]
|
|
@@ -375,14 +316,11 @@ function PolygonExtrudeTriangulation(feature) {
|
|
|
375
316
|
size: 5
|
|
376
317
|
};
|
|
377
318
|
}
|
|
378
|
-
|
|
379
319
|
function HeatmapGridTriangulation(feature) {
|
|
380
320
|
var shape = feature.shape;
|
|
381
|
-
|
|
382
321
|
var _getHeatmapGeometry = getHeatmapGeometry(shape),
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
322
|
+
positions = _getHeatmapGeometry.positions,
|
|
323
|
+
index = _getHeatmapGeometry.index;
|
|
386
324
|
return {
|
|
387
325
|
vertices: positions,
|
|
388
326
|
// [ x, y, z ] 多边形顶点
|
|
@@ -390,15 +328,14 @@ function HeatmapGridTriangulation(feature) {
|
|
|
390
328
|
size: 3
|
|
391
329
|
};
|
|
392
330
|
}
|
|
331
|
+
|
|
393
332
|
/**
|
|
394
333
|
* 图片图层顶点构造
|
|
395
334
|
* @param feature 数据
|
|
396
335
|
*/
|
|
397
|
-
|
|
398
|
-
|
|
399
336
|
function RasterImageTriangulation(feature) {
|
|
400
|
-
var coordinates = feature.coordinates;
|
|
401
|
-
|
|
337
|
+
var coordinates = feature.coordinates;
|
|
338
|
+
// [ x, y, z. uv.x, uv.y]
|
|
402
339
|
var positions = [].concat((0, _toConsumableArray2.default)(coordinates[0]), [0, 0, 1, coordinates[1][0], coordinates[0][1], 0, 1, 1], (0, _toConsumableArray2.default)(coordinates[1]), [0, 1, 0], (0, _toConsumableArray2.default)(coordinates[0]), [0, 0, 1], (0, _toConsumableArray2.default)(coordinates[1]), [0, 1, 0, coordinates[0][0], coordinates[1][1], 0, 0, 0]);
|
|
403
340
|
var indexs = [0, 1, 2, 3, 4, 5];
|
|
404
341
|
return {
|
|
@@ -407,60 +344,52 @@ function RasterImageTriangulation(feature) {
|
|
|
407
344
|
size: 5
|
|
408
345
|
};
|
|
409
346
|
}
|
|
347
|
+
|
|
410
348
|
/**
|
|
411
349
|
* 计算3D弧线顶点
|
|
412
350
|
* @param feature 映射数据
|
|
413
351
|
* @param segNum 弧线线段数
|
|
414
352
|
*/
|
|
415
|
-
|
|
416
|
-
|
|
417
353
|
function LineArcTriangulation(feature, segmentNumber) {
|
|
418
354
|
var segNum = segmentNumber ? segmentNumber : 30;
|
|
419
355
|
var coordinates = feature.coordinates;
|
|
420
356
|
var positions = [];
|
|
421
357
|
var indexArray = [];
|
|
422
|
-
|
|
423
358
|
var _loop = function _loop(i) {
|
|
424
359
|
// 上线两个顶点
|
|
425
360
|
// [ x, y, z, sx,sy, tx,ty]
|
|
426
361
|
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]);
|
|
427
|
-
|
|
428
362
|
if (i !== segNum - 1) {
|
|
429
363
|
indexArray.push.apply(indexArray, (0, _toConsumableArray2.default)([0, 1, 2, 1, 3, 2].map(function (v) {
|
|
430
364
|
return i * 2 + v;
|
|
431
365
|
})));
|
|
432
366
|
}
|
|
433
367
|
};
|
|
434
|
-
|
|
435
368
|
for (var i = 0; i < segNum; i++) {
|
|
436
369
|
_loop(i);
|
|
437
370
|
}
|
|
438
|
-
|
|
439
371
|
return {
|
|
440
372
|
vertices: positions,
|
|
441
373
|
indices: indexArray,
|
|
442
374
|
size: 7
|
|
443
375
|
};
|
|
444
376
|
}
|
|
377
|
+
|
|
445
378
|
/**
|
|
446
379
|
* 构建热力图密度图的顶点
|
|
447
380
|
* @param feature
|
|
448
381
|
* @returns
|
|
449
382
|
*/
|
|
450
|
-
|
|
451
|
-
|
|
452
383
|
function HeatmapTriangulation(feature) {
|
|
453
384
|
var coordinates = feature.coordinates;
|
|
454
|
-
|
|
455
385
|
if (coordinates.length === 2) {
|
|
456
386
|
coordinates.push(0);
|
|
457
387
|
}
|
|
458
|
-
|
|
459
388
|
var dir = addDir(-1, 1);
|
|
460
389
|
var dir1 = addDir(1, 1);
|
|
461
390
|
var dir2 = addDir(-1, -1);
|
|
462
|
-
var dir3 = addDir(1, -1);
|
|
463
|
-
|
|
391
|
+
var dir3 = addDir(1, -1);
|
|
392
|
+
// [x,y,z, dirx ,diry, weight]
|
|
464
393
|
var positions = [].concat((0, _toConsumableArray2.default)(coordinates), (0, _toConsumableArray2.default)(dir), (0, _toConsumableArray2.default)(coordinates), (0, _toConsumableArray2.default)(dir2), (0, _toConsumableArray2.default)(coordinates), (0, _toConsumableArray2.default)(dir3), (0, _toConsumableArray2.default)(coordinates), (0, _toConsumableArray2.default)(dir1));
|
|
465
394
|
var indexArray = [0, 1, 2, 3, 0, 2];
|
|
466
395
|
return {
|
|
@@ -469,25 +398,21 @@ function HeatmapTriangulation(feature) {
|
|
|
469
398
|
size: 5
|
|
470
399
|
};
|
|
471
400
|
}
|
|
401
|
+
|
|
472
402
|
/**
|
|
473
403
|
* 点图层3d geomerty
|
|
474
404
|
* @param shape 3D形状
|
|
475
405
|
*/
|
|
476
|
-
|
|
477
|
-
|
|
478
406
|
function getGeometry(shape) {
|
|
479
407
|
var needFlat = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
480
|
-
|
|
481
408
|
if (GeometryCache && GeometryCache[shape]) {
|
|
482
409
|
return GeometryCache[shape];
|
|
483
410
|
}
|
|
484
|
-
|
|
485
411
|
var path = _Path.geometryShape[shape] ? _Path.geometryShape[shape]() : _Path.geometryShape.cylinder();
|
|
486
412
|
var geometry = (0, _extrude.extrude_PolygonNormal)([path], needFlat);
|
|
487
413
|
GeometryCache[shape] = geometry;
|
|
488
414
|
return geometry;
|
|
489
415
|
}
|
|
490
|
-
|
|
491
416
|
function computeVertexNormals(positions, indexArray) {
|
|
492
417
|
var dim = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 3;
|
|
493
418
|
var needFlat = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
@@ -495,13 +420,9 @@ function computeVertexNormals(positions, indexArray) {
|
|
|
495
420
|
var vA;
|
|
496
421
|
var vB;
|
|
497
422
|
var vC;
|
|
498
|
-
|
|
499
423
|
var cb = _glMatrix.vec3.create();
|
|
500
|
-
|
|
501
424
|
var ab = _glMatrix.vec3.create();
|
|
502
|
-
|
|
503
425
|
var normal = _glMatrix.vec3.create();
|
|
504
|
-
|
|
505
426
|
for (var i = 0, li = indexArray.length; i < li; i += 3) {
|
|
506
427
|
vA = indexArray[i + 0] * 3;
|
|
507
428
|
vB = indexArray[i + 1] * 3;
|
|
@@ -509,40 +430,29 @@ function computeVertexNormals(positions, indexArray) {
|
|
|
509
430
|
var p1 = [positions[vA], positions[vA + 1]];
|
|
510
431
|
var p2 = [positions[vB], positions[vB + 1]];
|
|
511
432
|
var p3 = [positions[vC], positions[vC + 1]];
|
|
512
|
-
|
|
513
433
|
if (needFlat) {
|
|
514
434
|
p1 = (0, _l7Utils.lngLatToMeters)(p1);
|
|
515
435
|
p2 = (0, _l7Utils.lngLatToMeters)(p2);
|
|
516
436
|
p3 = (0, _l7Utils.lngLatToMeters)(p3);
|
|
517
437
|
}
|
|
518
|
-
|
|
519
438
|
var _p = p1,
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
439
|
+
_p2 = (0, _slicedToArray2.default)(_p, 2),
|
|
440
|
+
ax = _p2[0],
|
|
441
|
+
ay = _p2[1];
|
|
524
442
|
var pA = _glMatrix.vec3.fromValues(ax, ay, positions[vA + 2]);
|
|
525
|
-
|
|
526
443
|
var _p3 = p2,
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
444
|
+
_p4 = (0, _slicedToArray2.default)(_p3, 2),
|
|
445
|
+
bx = _p4[0],
|
|
446
|
+
by = _p4[1];
|
|
531
447
|
var pB = _glMatrix.vec3.fromValues(bx, by, positions[vB + 2]);
|
|
532
|
-
|
|
533
448
|
var _p5 = p3,
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
449
|
+
_p6 = (0, _slicedToArray2.default)(_p5, 2),
|
|
450
|
+
cx = _p6[0],
|
|
451
|
+
cy = _p6[1];
|
|
538
452
|
var pC = _glMatrix.vec3.fromValues(cx, cy, positions[vC + 2]);
|
|
539
|
-
|
|
540
453
|
_glMatrix.vec3.sub(cb, pC, pB);
|
|
541
|
-
|
|
542
454
|
_glMatrix.vec3.sub(ab, pA, pB);
|
|
543
|
-
|
|
544
455
|
_glMatrix.vec3.cross(normal, cb, ab);
|
|
545
|
-
|
|
546
456
|
normals[vA] += cb[0];
|
|
547
457
|
normals[vA + 1] += cb[1];
|
|
548
458
|
normals[vA + 2] += cb[2];
|
|
@@ -553,56 +463,47 @@ function computeVertexNormals(positions, indexArray) {
|
|
|
553
463
|
normals[vC + 1] += cb[1];
|
|
554
464
|
normals[vC + 2] += cb[2];
|
|
555
465
|
}
|
|
556
|
-
|
|
557
466
|
normalizeNormals(normals);
|
|
558
467
|
return normals;
|
|
559
468
|
}
|
|
560
|
-
|
|
561
469
|
function normalizeNormals(normals) {
|
|
562
470
|
for (var i = 0, li = normals.length; i < li; i += 3) {
|
|
563
471
|
var normal = _glMatrix.vec3.fromValues(normals[i], normals[i + 1], normals[i + 2]);
|
|
564
|
-
|
|
565
472
|
var newNormal = _glMatrix.vec3.create();
|
|
566
|
-
|
|
567
473
|
_glMatrix.vec3.normalize(newNormal, normal);
|
|
568
|
-
|
|
569
474
|
normals.set(newNormal, i);
|
|
570
475
|
}
|
|
571
476
|
}
|
|
572
|
-
|
|
573
477
|
function checkIsClosed(points) {
|
|
574
478
|
var p1 = points[0][0];
|
|
575
479
|
var p2 = points[0][points[0].length - 1];
|
|
576
480
|
return p1[0] === p2[0] && p1[1] === p2[1];
|
|
577
481
|
}
|
|
578
|
-
|
|
579
482
|
function getHeatmapGeometry(shape) {
|
|
580
483
|
var shape3d = ['cylinder', 'triangleColumn', 'hexagonColumn', 'squareColumn'];
|
|
581
484
|
var path = _Path.geometryShape[shape] ? _Path.geometryShape[shape]() : _Path.geometryShape.circle();
|
|
582
|
-
var geometry = shape3d.indexOf(shape) === -1 ? (0, _extrude.fillPolygon)([path]) : (0, _extrude.default)([path]);
|
|
583
|
-
|
|
485
|
+
var geometry = shape3d.indexOf(shape) === -1 ? (0, _extrude.fillPolygon)([path]) : (0, _extrude.default)([path]);
|
|
486
|
+
// const geometry = fillPolygon([path]);
|
|
584
487
|
return geometry;
|
|
585
|
-
}
|
|
586
|
-
|
|
587
|
-
|
|
488
|
+
}
|
|
489
|
+
// 热力图计算范围
|
|
588
490
|
function addDir(dirX, dirY) {
|
|
589
491
|
var x = (dirX + 1) / 2;
|
|
590
492
|
var y = (dirY + 1) / 2;
|
|
591
493
|
return [x, y];
|
|
592
494
|
}
|
|
495
|
+
|
|
593
496
|
/**
|
|
594
497
|
* 构建地球三角网格
|
|
595
498
|
* @returns
|
|
596
499
|
*/
|
|
597
|
-
|
|
598
|
-
|
|
599
500
|
function earthTriangulation() {
|
|
600
501
|
var earthmesh = (0, _utils.primitiveSphere)(_utils.EARTH_RADIUS, {
|
|
601
502
|
segments: _utils.EARTH_SEGMENTS
|
|
602
503
|
});
|
|
603
504
|
var positionsArr = earthmesh.positionsArr,
|
|
604
|
-
|
|
605
|
-
|
|
505
|
+
indicesArr = earthmesh.indicesArr,
|
|
506
|
+
normalArr = earthmesh.normalArr;
|
|
606
507
|
return {
|
|
607
508
|
vertices: positionsArr,
|
|
608
509
|
indices: indicesArr,
|
|
@@ -610,14 +511,13 @@ function earthTriangulation() {
|
|
|
610
511
|
normals: normalArr
|
|
611
512
|
};
|
|
612
513
|
}
|
|
613
|
-
|
|
614
514
|
function earthOuterTriangulation() {
|
|
615
515
|
var earthmesh = (0, _utils.primitiveSphere)(_utils.EARTH_RADIUS + _utils.EARTH_RADIUS_OUTER, {
|
|
616
516
|
segments: _utils.EARTH_SEGMENTS
|
|
617
517
|
});
|
|
618
518
|
var positionsArr = earthmesh.positionsArr,
|
|
619
|
-
|
|
620
|
-
|
|
519
|
+
indicesArr = earthmesh.indicesArr,
|
|
520
|
+
normalArr = earthmesh.normalArr;
|
|
621
521
|
return {
|
|
622
522
|
vertices: positionsArr,
|
|
623
523
|
indices: indicesArr,
|