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