@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.
Files changed (250) hide show
  1. package/es/Geometry/index.js +9 -31
  2. package/es/Geometry/models/billboard.js +51 -89
  3. package/es/Geometry/models/plane.js +81 -143
  4. package/es/Geometry/models/sprite.js +60 -118
  5. package/es/canvas/index.js +10 -33
  6. package/es/canvas/models/canvas.js +41 -97
  7. package/es/citybuliding/building.js +8 -27
  8. package/es/citybuliding/models/build.js +57 -82
  9. package/es/core/BaseLayer.js +325 -483
  10. package/es/core/BaseModel.js +51 -80
  11. package/es/core/CommonStyleAttribute.js +2 -5
  12. package/es/core/LayerPickService.js +21 -32
  13. package/es/core/TextureService.js +0 -13
  14. package/es/core/interface.js +17 -24
  15. package/es/core/shape/Path.js +13 -20
  16. package/es/core/shape/extrude.js +27 -39
  17. package/es/core/triangulation.js +99 -136
  18. package/es/earth/index.js +9 -33
  19. package/es/earth/models/atmosphere.js +30 -54
  20. package/es/earth/models/base.js +47 -85
  21. package/es/earth/models/bloomsphere.js +30 -54
  22. package/es/earth/utils.js +9 -13
  23. package/es/heatmap/index.js +10 -40
  24. package/es/heatmap/models/grid.js +28 -52
  25. package/es/heatmap/models/grid3d.js +28 -52
  26. package/es/heatmap/models/heatmap.js +92 -149
  27. package/es/heatmap/models/hexagon.js +28 -52
  28. package/es/heatmap/triangulation.js +0 -4
  29. package/es/image/index.js +9 -28
  30. package/es/image/models/image.js +66 -100
  31. package/es/index.js +9 -17
  32. package/es/line/index.js +9 -35
  33. package/es/line/models/arc.js +63 -112
  34. package/es/line/models/arc_3d.js +58 -102
  35. package/es/line/models/earthArc_3d.js +60 -105
  36. package/es/line/models/flow.js +36 -60
  37. package/es/line/models/great_circle.js +53 -94
  38. package/es/line/models/line.js +92 -144
  39. package/es/line/models/linearline.js +42 -74
  40. package/es/line/models/simpleLine.js +38 -67
  41. package/es/line/models/wall.js +52 -92
  42. package/es/line/shaders/dash/line_dash_vert.glsl +1 -2
  43. package/es/line/shaders/line_frag.glsl +1 -3
  44. package/es/line/shaders/line_vert.glsl +2 -0
  45. package/es/line/shaders/linear/line_linear_frag.glsl +1 -1
  46. package/es/mask/index.js +9 -28
  47. package/es/mask/models/fill.js +29 -54
  48. package/es/plugins/DataMappingPlugin.js +78 -114
  49. package/es/plugins/DataSourcePlugin.js +45 -68
  50. package/es/plugins/FeatureScalePlugin.js +67 -122
  51. package/es/plugins/LayerAnimateStylePlugin.js +0 -5
  52. package/es/plugins/LayerMaskPlugin.js +3 -11
  53. package/es/plugins/LayerModelPlugin.js +69 -118
  54. package/es/plugins/LayerStylePlugin.js +4 -9
  55. package/es/plugins/LightingPlugin.js +12 -18
  56. package/es/plugins/MultiPassRendererPlugin.js +11 -16
  57. package/es/plugins/PixelPickingPlugin.js +12 -21
  58. package/es/plugins/RegisterStyleAttributePlugin.js +5 -12
  59. package/es/plugins/ShaderUniformPlugin.js +13 -27
  60. package/es/plugins/UpdateModelPlugin.js +0 -5
  61. package/es/plugins/UpdateStyleAttributePlugin.js +5 -11
  62. package/es/point/index.js +26 -78
  63. package/es/point/models/earthExtrude.js +58 -95
  64. package/es/point/models/earthFill.js +52 -80
  65. package/es/point/models/extrude.js +57 -94
  66. package/es/point/models/fill.js +56 -81
  67. package/es/point/models/fillmage.js +60 -100
  68. package/es/point/models/image.js +47 -83
  69. package/es/point/models/index.js +2 -2
  70. package/es/point/models/normal.js +30 -54
  71. package/es/point/models/radar.js +38 -63
  72. package/es/point/models/simplePoint.js +38 -62
  73. package/es/point/models/text.js +199 -296
  74. package/es/point/shape/extrude.js +4 -13
  75. package/es/polygon/index.js +11 -41
  76. package/es/polygon/models/extrude.js +87 -135
  77. package/es/polygon/models/fill.js +50 -79
  78. package/es/polygon/models/index.js +3 -2
  79. package/es/polygon/models/ocean.js +42 -76
  80. package/es/polygon/models/water.js +37 -71
  81. package/es/raster/buffers/triangulation.js +2 -4
  82. package/es/raster/index.js +9 -32
  83. package/es/raster/models/raster.js +80 -116
  84. package/es/raster/models/rasterRgb.js +84 -127
  85. package/es/raster/models/rasterTerrainRgb.js +56 -84
  86. package/es/tile/interaction/getRasterData.js +14 -20
  87. package/es/tile/interaction/utils.js +7 -9
  88. package/es/tile/manager/base.js +63 -96
  89. package/es/tile/service/TileLayerService.js +33 -55
  90. package/es/tile/service/TilePickService.js +26 -40
  91. package/es/tile/service/TileSourceService.js +3 -7
  92. package/es/tile/tileFactory/DebugTile.js +29 -46
  93. package/es/tile/tileFactory/ImageTile.js +20 -38
  94. package/es/tile/tileFactory/MaskTile.js +22 -43
  95. package/es/tile/tileFactory/RasterRGBTile.js +22 -42
  96. package/es/tile/tileFactory/RasterTerrainRGBTile.js +20 -38
  97. package/es/tile/tileFactory/RasterTile.js +30 -53
  98. package/es/tile/tileFactory/Tile.js +63 -97
  99. package/es/tile/tileFactory/VectorTile.js +41 -68
  100. package/es/tile/tileFactory/index.js +0 -11
  101. package/es/tile/tileFactory/layers/TileDebugLayer.js +6 -27
  102. package/es/tile/tileFactory/util.js +0 -3
  103. package/es/tile/tileLayer/BaseLayer.js +105 -146
  104. package/es/tile/utils.js +1 -1
  105. package/es/utils/blend.js +0 -2
  106. package/es/utils/collision-index.js +9 -16
  107. package/es/utils/extrude_polyline.js +101 -149
  108. package/es/utils/grid-index.js +2 -27
  109. package/es/utils/identityScale.js +0 -8
  110. package/es/utils/layerData.js +30 -44
  111. package/es/utils/multiPassRender.js +11 -13
  112. package/es/utils/polylineNormal.js +31 -37
  113. package/es/utils/simpleLine.js +2 -16
  114. package/es/utils/stencil.js +2 -3
  115. package/es/utils/symbol-layout.js +27 -53
  116. package/es/wind/index.js +9 -29
  117. package/es/wind/models/utils.js +26 -51
  118. package/es/wind/models/wind.js +101 -147
  119. package/es/wind/models/windRender.js +53 -66
  120. package/lib/Geometry/index.js +9 -38
  121. package/lib/Geometry/models/billboard.js +51 -97
  122. package/lib/Geometry/models/index.js +0 -5
  123. package/lib/Geometry/models/plane.js +79 -151
  124. package/lib/Geometry/models/sprite.js +60 -127
  125. package/lib/canvas/index.js +10 -40
  126. package/lib/canvas/models/canvas.js +41 -101
  127. package/lib/canvas/models/index.js +0 -3
  128. package/lib/citybuliding/building.js +8 -35
  129. package/lib/citybuliding/models/build.js +57 -92
  130. package/lib/core/BaseLayer.js +325 -474
  131. package/lib/core/BaseModel.js +51 -90
  132. package/lib/core/CommonStyleAttribute.js +2 -7
  133. package/lib/core/LayerPickService.js +21 -37
  134. package/lib/core/TextureService.js +0 -16
  135. package/lib/core/interface.js +21 -31
  136. package/lib/core/schema.js +0 -1
  137. package/lib/core/shape/Path.js +14 -31
  138. package/lib/core/shape/extrude.js +27 -62
  139. package/lib/core/triangulation.js +98 -177
  140. package/lib/earth/index.js +9 -43
  141. package/lib/earth/models/atmosphere.js +30 -63
  142. package/lib/earth/models/base.js +47 -90
  143. package/lib/earth/models/bloomsphere.js +30 -63
  144. package/lib/earth/utils.js +7 -31
  145. package/lib/heatmap/index.js +10 -48
  146. package/lib/heatmap/models/grid.js +28 -60
  147. package/lib/heatmap/models/grid3d.js +28 -60
  148. package/lib/heatmap/models/heatmap.js +92 -166
  149. package/lib/heatmap/models/hexagon.js +28 -60
  150. package/lib/heatmap/models/index.js +0 -6
  151. package/lib/heatmap/triangulation.js +0 -5
  152. package/lib/image/index.js +9 -36
  153. package/lib/image/models/image.js +66 -109
  154. package/lib/image/models/index.js +0 -3
  155. package/lib/index.js +7 -61
  156. package/lib/line/index.js +9 -40
  157. package/lib/line/models/arc.js +61 -122
  158. package/lib/line/models/arc_3d.js +56 -113
  159. package/lib/line/models/earthArc_3d.js +58 -115
  160. package/lib/line/models/flow.js +36 -70
  161. package/lib/line/models/great_circle.js +53 -104
  162. package/lib/line/models/index.js +0 -11
  163. package/lib/line/models/line.js +90 -152
  164. package/lib/line/models/linearline.js +42 -86
  165. package/lib/line/models/simpleLine.js +38 -77
  166. package/lib/line/models/wall.js +52 -103
  167. package/lib/line/shaders/dash/line_dash_vert.glsl +1 -2
  168. package/lib/line/shaders/line_frag.glsl +1 -3
  169. package/lib/line/shaders/line_vert.glsl +2 -0
  170. package/lib/line/shaders/linear/line_linear_frag.glsl +1 -1
  171. package/lib/mask/index.js +9 -36
  172. package/lib/mask/models/fill.js +29 -63
  173. package/lib/mask/models/index.js +0 -3
  174. package/lib/plugins/DataMappingPlugin.js +78 -125
  175. package/lib/plugins/DataSourcePlugin.js +45 -76
  176. package/lib/plugins/FeatureScalePlugin.js +67 -138
  177. package/lib/plugins/LayerAnimateStylePlugin.js +0 -10
  178. package/lib/plugins/LayerMaskPlugin.js +4 -17
  179. package/lib/plugins/LayerModelPlugin.js +70 -127
  180. package/lib/plugins/LayerStylePlugin.js +5 -14
  181. package/lib/plugins/LightingPlugin.js +12 -25
  182. package/lib/plugins/MultiPassRendererPlugin.js +11 -22
  183. package/lib/plugins/PixelPickingPlugin.js +12 -27
  184. package/lib/plugins/RegisterStyleAttributePlugin.js +5 -19
  185. package/lib/plugins/ShaderUniformPlugin.js +13 -34
  186. package/lib/plugins/UpdateModelPlugin.js +1 -10
  187. package/lib/plugins/UpdateStyleAttributePlugin.js +5 -16
  188. package/lib/point/index.js +26 -83
  189. package/lib/point/models/earthExtrude.js +58 -106
  190. package/lib/point/models/earthFill.js +52 -110
  191. package/lib/point/models/extrude.js +57 -103
  192. package/lib/point/models/fill.js +54 -90
  193. package/lib/point/models/fillmage.js +58 -107
  194. package/lib/point/models/image.js +47 -92
  195. package/lib/point/models/index.js +1 -12
  196. package/lib/point/models/normal.js +30 -64
  197. package/lib/point/models/radar.js +38 -72
  198. package/lib/point/models/simplePoint.js +38 -72
  199. package/lib/point/models/text.js +199 -305
  200. package/lib/point/shape/extrude.js +4 -20
  201. package/lib/polygon/index.js +11 -48
  202. package/lib/polygon/models/extrude.js +87 -146
  203. package/lib/polygon/models/fill.js +50 -89
  204. package/lib/polygon/models/index.js +2 -14
  205. package/lib/polygon/models/ocean.js +42 -88
  206. package/lib/polygon/models/water.js +37 -82
  207. package/lib/raster/buffers/triangulation.js +3 -7
  208. package/lib/raster/index.js +9 -40
  209. package/lib/raster/models/index.js +0 -5
  210. package/lib/raster/models/raster.js +80 -125
  211. package/lib/raster/models/rasterRgb.js +84 -139
  212. package/lib/raster/models/rasterTerrainRgb.js +56 -93
  213. package/lib/tile/interaction/getRasterData.js +14 -25
  214. package/lib/tile/interaction/utils.js +7 -19
  215. package/lib/tile/manager/base.js +63 -104
  216. package/lib/tile/service/TileLayerService.js +33 -60
  217. package/lib/tile/service/TilePickService.js +26 -48
  218. package/lib/tile/service/TileSourceService.js +2 -16
  219. package/lib/tile/style/utils.js +0 -3
  220. package/lib/tile/tileFactory/DebugTile.js +29 -54
  221. package/lib/tile/tileFactory/ImageTile.js +20 -46
  222. package/lib/tile/tileFactory/MaskTile.js +22 -51
  223. package/lib/tile/tileFactory/RasterRGBTile.js +22 -50
  224. package/lib/tile/tileFactory/RasterTerrainRGBTile.js +20 -46
  225. package/lib/tile/tileFactory/RasterTile.js +30 -63
  226. package/lib/tile/tileFactory/Tile.js +63 -102
  227. package/lib/tile/tileFactory/VectorTile.js +41 -76
  228. package/lib/tile/tileFactory/index.js +0 -25
  229. package/lib/tile/tileFactory/layers/TileDebugLayer.js +6 -32
  230. package/lib/tile/tileFactory/util.js +0 -9
  231. package/lib/tile/tileLayer/BaseLayer.js +105 -153
  232. package/lib/tile/utils.js +1 -5
  233. package/lib/utils/blend.js +0 -5
  234. package/lib/utils/collision-index.js +9 -25
  235. package/lib/utils/extrude_polyline.js +101 -181
  236. package/lib/utils/grid-index.js +2 -28
  237. package/lib/utils/identityScale.js +0 -9
  238. package/lib/utils/layerData.js +30 -49
  239. package/lib/utils/multiPassRender.js +11 -16
  240. package/lib/utils/polylineNormal.js +31 -66
  241. package/lib/utils/simpleLine.js +2 -21
  242. package/lib/utils/stencil.js +0 -4
  243. package/lib/utils/symbol-layout.js +27 -55
  244. package/lib/wind/index.js +9 -37
  245. package/lib/wind/models/index.js +0 -3
  246. package/lib/wind/models/utils.js +26 -62
  247. package/lib/wind/models/wind.js +101 -157
  248. package/lib/wind/models/windRender.js +53 -71
  249. package/lib/wind/models/windShader.js +0 -1
  250. 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
- positions = _getGeometry.positions,
94
- index = _getGeometry.index,
95
- normals = _getGeometry.normals;
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
- originCoordinates = feature.originCoordinates,
127
- version = feature.version; // let path = coordinates as number[][][] | number[][];
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), [// 0
188
- 1, 2, -3], (0, _toConsumableArray2.default)(coord), [// 1
189
- 1, 1, -3], (0, _toConsumableArray2.default)(coord), [// 2
190
- 0, 1, 0], (0, _toConsumableArray2.default)(coord), [// 3
191
- 0, 0, 0], (0, _toConsumableArray2.default)(coord), [// 4
192
- 1, 0, 0], (0, _toConsumableArray2.default)(coord), [// 0
193
- 1, 2, -3], (0, _toConsumableArray2.default)(coord), [// 1
194
- 1, 1, -3], (0, _toConsumableArray2.default)(coord), [// 2
195
- 0, 1, 0], (0, _toConsumableArray2.default)(coord), [// 3
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, // 0
198
- 2 * tout, -tout, 1, // 1
199
- tout, -tout, 1, // 2
200
- tout, -tout, 1, // 3
201
- -tin, -tout, 1, // 4
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), [// 0
215
- 1, 2, -3], (0, _toConsumableArray2.default)(coord), [// 1
216
- 1, 1, -3], (0, _toConsumableArray2.default)(coord), [// 2
217
- 0, 1, 0], (0, _toConsumableArray2.default)(coord), [// 3
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, // 0
220
- 2 * tout, -tout, 1, // 1
221
- tout, -tout, 1, // 2
222
- tout, -tout, 1, // 3
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
- results = _getSimpleLineVertice.results,
246
- totalDistance = _getSimpleLineVertice.totalDistance;
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
- results = _getTileSimpleLineVer.results;
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
- dimensions = flattengeo.dimensions,
373
- holes = flattengeo.holes;
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
- dimensions = flattengeo.dimensions,
389
- holes = flattengeo.holes;
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
- center = _calculatePointsCente.center,
402
- radius = _calculatePointsCente.radius;
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
- positions = _extrude_PolygonNorma.positions,
418
- index = _extrude_PolygonNorma.index,
419
- normals = _extrude_PolygonNorma.normals;
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
- positions = _getHeatmapGeometry.positions,
435
- index = _getHeatmapGeometry.index;
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; // [ x, y, z. uv.x, uv.y]
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); // [x,y,z, dirx ,diry, weight]
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
- _p2 = (0, _slicedToArray2.default)(_p, 2),
572
- ax = _p2[0],
573
- ay = _p2[1];
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
- _p4 = (0, _slicedToArray2.default)(_p3, 2),
579
- bx = _p4[0],
580
- by = _p4[1];
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
- _p6 = (0, _slicedToArray2.default)(_p5, 2),
586
- cx = _p6[0],
587
- cy = _p6[1];
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]); // const geometry = fillPolygon([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
- indicesArr = earthmesh.indicesArr,
656
- normalArr = earthmesh.normalArr;
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
- indicesArr = earthmesh.indicesArr,
671
- normalArr = earthmesh.normalArr;
591
+ indicesArr = earthmesh.indicesArr,
592
+ normalArr = earthmesh.normalArr;
672
593
  return {
673
594
  vertices: positionsArr,
674
595
  indices: indicesArr,