@antv/l7-layers 2.15.1 → 2.15.3

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