@antv/l7-layers 2.17.4 → 2.17.6

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