@antv/l7-layers 2.15.2 → 2.15.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (242) 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.js +197 -299
  69. package/es/point/shape/extrude.js +4 -13
  70. package/es/polygon/index.js +11 -40
  71. package/es/polygon/models/extrude.js +48 -92
  72. package/es/polygon/models/fill.js +54 -88
  73. package/es/polygon/models/index.js +3 -2
  74. package/es/polygon/models/ocean.js +42 -76
  75. package/es/polygon/models/water.js +37 -71
  76. package/es/raster/buffers/triangulation.js +2 -4
  77. package/es/raster/index.js +9 -32
  78. package/es/raster/models/raster.js +80 -116
  79. package/es/raster/models/rasterRgb.js +84 -127
  80. package/es/raster/models/rasterTerrainRgb.js +56 -84
  81. package/es/tile/interaction/getRasterData.js +14 -20
  82. package/es/tile/interaction/utils.js +7 -9
  83. package/es/tile/manager/base.js +63 -96
  84. package/es/tile/service/TileLayerService.js +30 -52
  85. package/es/tile/service/TilePickService.js +26 -40
  86. package/es/tile/service/TileSourceService.js +3 -7
  87. package/es/tile/tileFactory/DebugTile.js +28 -45
  88. package/es/tile/tileFactory/ImageTile.js +20 -38
  89. package/es/tile/tileFactory/MaskTile.js +22 -43
  90. package/es/tile/tileFactory/RasterRGBTile.js +22 -42
  91. package/es/tile/tileFactory/RasterTerrainRGBTile.js +20 -38
  92. package/es/tile/tileFactory/RasterTile.js +30 -53
  93. package/es/tile/tileFactory/Tile.js +63 -97
  94. package/es/tile/tileFactory/VectorTile.js +41 -68
  95. package/es/tile/tileFactory/index.js +0 -11
  96. package/es/tile/tileFactory/layers/TileDebugLayer.js +6 -27
  97. package/es/tile/tileFactory/util.js +0 -3
  98. package/es/tile/tileLayer/BaseLayer.js +105 -146
  99. package/es/tile/utils.js +1 -1
  100. package/es/utils/blend.js +0 -2
  101. package/es/utils/collision-index.js +9 -16
  102. package/es/utils/dataMappingStyle.js +8 -18
  103. package/es/utils/extrude_polyline.js +101 -149
  104. package/es/utils/grid-index.js +2 -27
  105. package/es/utils/identityScale.js +0 -8
  106. package/es/utils/layerData.js +30 -44
  107. package/es/utils/multiPassRender.js +11 -13
  108. package/es/utils/polylineNormal.js +31 -37
  109. package/es/utils/simpleLine.js +2 -16
  110. package/es/utils/stencil.js +2 -3
  111. package/es/utils/symbol-layout.js +27 -53
  112. package/es/wind/index.js +9 -29
  113. package/es/wind/models/utils.js +26 -51
  114. package/es/wind/models/wind.js +101 -147
  115. package/es/wind/models/windRender.js +53 -66
  116. package/lib/Geometry/index.js +9 -38
  117. package/lib/Geometry/models/billboard.js +51 -97
  118. package/lib/Geometry/models/index.js +0 -5
  119. package/lib/Geometry/models/plane.js +79 -151
  120. package/lib/Geometry/models/sprite.js +60 -127
  121. package/lib/canvas/index.js +10 -40
  122. package/lib/canvas/models/canvas.js +41 -101
  123. package/lib/canvas/models/index.js +0 -3
  124. package/lib/citybuliding/building.js +8 -35
  125. package/lib/citybuliding/models/build.js +57 -92
  126. package/lib/core/BaseLayer.js +320 -478
  127. package/lib/core/BaseModel.js +97 -139
  128. package/lib/core/LayerPickService.js +21 -37
  129. package/lib/core/TextureService.js +0 -16
  130. package/lib/core/interface.js +21 -31
  131. package/lib/core/schema.js +0 -1
  132. package/lib/core/shape/Path.js +14 -31
  133. package/lib/core/shape/extrude.js +10 -54
  134. package/lib/core/triangulation.js +53 -153
  135. package/lib/earth/index.js +9 -43
  136. package/lib/earth/models/atmosphere.js +30 -63
  137. package/lib/earth/models/base.js +47 -90
  138. package/lib/earth/models/bloomsphere.js +30 -63
  139. package/lib/earth/utils.js +7 -31
  140. package/lib/heatmap/index.js +10 -48
  141. package/lib/heatmap/models/grid.js +28 -60
  142. package/lib/heatmap/models/grid3d.js +28 -60
  143. package/lib/heatmap/models/heatmap.js +91 -162
  144. package/lib/heatmap/models/hexagon.js +28 -60
  145. package/lib/heatmap/models/index.js +0 -6
  146. package/lib/heatmap/triangulation.js +0 -5
  147. package/lib/image/index.js +9 -36
  148. package/lib/image/models/image.js +66 -109
  149. package/lib/image/models/index.js +0 -3
  150. package/lib/index.js +7 -61
  151. package/lib/line/index.js +9 -40
  152. package/lib/line/models/arc.js +64 -128
  153. package/lib/line/models/arc_3d.js +58 -119
  154. package/lib/line/models/earthArc_3d.js +61 -122
  155. package/lib/line/models/great_circle.js +56 -111
  156. package/lib/line/models/half.js +46 -87
  157. package/lib/line/models/index.js +0 -11
  158. package/lib/line/models/line.js +92 -156
  159. package/lib/line/models/linearline.js +45 -92
  160. package/lib/line/models/simpleLine.js +41 -84
  161. package/lib/line/models/wall.js +52 -103
  162. package/lib/mask/index.js +9 -36
  163. package/lib/mask/models/fill.js +29 -63
  164. package/lib/mask/models/index.js +0 -3
  165. package/lib/plugins/DataMappingPlugin.js +80 -128
  166. package/lib/plugins/DataSourcePlugin.js +45 -76
  167. package/lib/plugins/FeatureScalePlugin.js +67 -138
  168. package/lib/plugins/LayerAnimateStylePlugin.js +0 -10
  169. package/lib/plugins/LayerMaskPlugin.js +4 -17
  170. package/lib/plugins/LayerModelPlugin.js +68 -113
  171. package/lib/plugins/LayerStylePlugin.js +4 -14
  172. package/lib/plugins/LightingPlugin.js +12 -25
  173. package/lib/plugins/MultiPassRendererPlugin.js +11 -22
  174. package/lib/plugins/PixelPickingPlugin.js +12 -27
  175. package/lib/plugins/RegisterStyleAttributePlugin.js +5 -19
  176. package/lib/plugins/ShaderUniformPlugin.js +13 -34
  177. package/lib/plugins/UpdateModelPlugin.js +1 -10
  178. package/lib/plugins/UpdateStyleAttributePlugin.js +5 -16
  179. package/lib/point/index.js +26 -83
  180. package/lib/point/models/earthExtrude.js +61 -113
  181. package/lib/point/models/earthFill.js +57 -117
  182. package/lib/point/models/extrude.js +60 -111
  183. package/lib/point/models/fill.js +68 -109
  184. package/lib/point/models/fillmage.js +61 -115
  185. package/lib/point/models/image.js +48 -98
  186. package/lib/point/models/index.js +1 -12
  187. package/lib/point/models/normal.js +30 -64
  188. package/lib/point/models/radar.js +40 -74
  189. package/lib/point/models/simplePoint.js +41 -79
  190. package/lib/point/models/text.js +197 -307
  191. package/lib/point/shape/extrude.js +4 -20
  192. package/lib/polygon/index.js +11 -48
  193. package/lib/polygon/models/extrude.js +48 -103
  194. package/lib/polygon/models/fill.js +54 -98
  195. package/lib/polygon/models/index.js +2 -14
  196. package/lib/polygon/models/ocean.js +42 -88
  197. package/lib/polygon/models/water.js +37 -82
  198. package/lib/raster/buffers/triangulation.js +3 -7
  199. package/lib/raster/index.js +9 -40
  200. package/lib/raster/models/index.js +0 -5
  201. package/lib/raster/models/raster.js +80 -125
  202. package/lib/raster/models/rasterRgb.js +84 -139
  203. package/lib/raster/models/rasterTerrainRgb.js +56 -93
  204. package/lib/tile/interaction/getRasterData.js +14 -25
  205. package/lib/tile/interaction/utils.js +7 -19
  206. package/lib/tile/manager/base.js +63 -104
  207. package/lib/tile/service/TileLayerService.js +30 -57
  208. package/lib/tile/service/TilePickService.js +26 -48
  209. package/lib/tile/service/TileSourceService.js +2 -16
  210. package/lib/tile/style/utils.js +0 -3
  211. package/lib/tile/tileFactory/DebugTile.js +28 -53
  212. package/lib/tile/tileFactory/ImageTile.js +20 -46
  213. package/lib/tile/tileFactory/MaskTile.js +22 -51
  214. package/lib/tile/tileFactory/RasterRGBTile.js +22 -50
  215. package/lib/tile/tileFactory/RasterTerrainRGBTile.js +20 -46
  216. package/lib/tile/tileFactory/RasterTile.js +30 -63
  217. package/lib/tile/tileFactory/Tile.js +63 -102
  218. package/lib/tile/tileFactory/VectorTile.js +41 -76
  219. package/lib/tile/tileFactory/index.js +0 -25
  220. package/lib/tile/tileFactory/layers/TileDebugLayer.js +6 -32
  221. package/lib/tile/tileFactory/util.js +0 -9
  222. package/lib/tile/tileLayer/BaseLayer.js +105 -153
  223. package/lib/tile/utils.js +1 -5
  224. package/lib/utils/blend.js +0 -5
  225. package/lib/utils/collision-index.js +9 -25
  226. package/lib/utils/dataMappingStyle.js +8 -19
  227. package/lib/utils/extrude_polyline.js +101 -181
  228. package/lib/utils/grid-index.js +2 -28
  229. package/lib/utils/identityScale.js +0 -9
  230. package/lib/utils/layerData.js +30 -49
  231. package/lib/utils/multiPassRender.js +11 -16
  232. package/lib/utils/polylineNormal.js +31 -66
  233. package/lib/utils/simpleLine.js +2 -21
  234. package/lib/utils/stencil.js +0 -4
  235. package/lib/utils/symbol-layout.js +27 -55
  236. package/lib/wind/index.js +9 -37
  237. package/lib/wind/models/index.js +0 -3
  238. package/lib/wind/models/utils.js +26 -62
  239. package/lib/wind/models/wind.js +101 -157
  240. package/lib/wind/models/windRender.js +53 -71
  241. package/lib/wind/models/windShader.js +0 -1
  242. package/package.json +7 -7
@@ -5,8 +5,8 @@ import _createClass from "@babel/runtime/helpers/esm/createClass";
5
5
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
6
6
  import { aProjectFlat } from '@antv/l7-utils';
7
7
  import { vec2 } from 'gl-matrix';
8
- var tmp = vec2.create(); // eslint-disable-next-line @typescript-eslint/no-unused-vars
9
-
8
+ var tmp = vec2.create();
9
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
10
10
  var capEnd = vec2.create();
11
11
  var lineA = vec2.create();
12
12
  var lineB = vec2.create();
@@ -26,17 +26,13 @@ export function direction(out, a, b) {
26
26
  vec2.normalize(out, out);
27
27
  return out;
28
28
  }
29
-
30
29
  function isPointEqual(a, b) {
31
30
  return a[0] === b[0] && a[1] === b[1];
32
31
  }
33
-
34
32
  export function getArrayUnique(matrix) {
35
33
  var map = new Map();
36
-
37
34
  for (var i = 0; i < matrix.length; i++) {
38
35
  var key = matrix[0].toString() + '-' + matrix[1].toString();
39
-
40
36
  if (map.get(key)) {
41
37
  matrix.splice(i, 1);
42
38
  i++;
@@ -44,28 +40,18 @@ export function getArrayUnique(matrix) {
44
40
  map.set(key, key);
45
41
  }
46
42
  }
47
-
48
43
  return matrix;
49
44
  }
50
-
51
45
  var ExtrudePolyline = /*#__PURE__*/function () {
52
46
  function ExtrudePolyline() {
53
47
  var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
54
-
55
48
  _classCallCheck(this, ExtrudePolyline);
56
-
57
49
  _defineProperty(this, "lastFlip", -1);
58
-
59
50
  _defineProperty(this, "miter", vec2.fromValues(0, 0));
60
-
61
51
  _defineProperty(this, "started", false);
62
-
63
52
  _defineProperty(this, "dash", false);
64
-
65
53
  _defineProperty(this, "totalDistance", 0);
66
-
67
54
  _defineProperty(this, "currentIndex", 0);
68
-
69
55
  this.join = opts.join || 'miter';
70
56
  this.cap = opts.cap || 'butt';
71
57
  this.miterLimit = opts.miterLimit || 10;
@@ -79,23 +65,19 @@ var ExtrudePolyline = /*#__PURE__*/function () {
79
65
  indexes: []
80
66
  };
81
67
  }
82
-
83
68
  _createClass(ExtrudePolyline, [{
84
69
  key: "simpleExtrude",
85
70
  value: function simpleExtrude(points) {
86
71
  var complex = this.complex;
87
-
88
72
  if (points.length <= 1) {
89
73
  return complex;
90
74
  }
91
-
92
75
  this.lastFlip = -1;
93
76
  this.started = false;
94
77
  this.normal = null;
95
78
  this.totalDistance = 0;
96
79
  var total = points.length;
97
80
  var count = complex.startIndex;
98
-
99
81
  for (var i = 1; i < total; i++) {
100
82
  var last = points[i - 1];
101
83
  var cur = points[i];
@@ -103,13 +85,11 @@ var ExtrudePolyline = /*#__PURE__*/function () {
103
85
  var amt = this.simpleSegment(complex, count, last, cur, next);
104
86
  count += amt;
105
87
  }
106
-
107
88
  if (this.dash) {
108
89
  for (var _i = 0; _i < complex.positions.length / 6; _i++) {
109
90
  complex.positions[_i * 6 + 5] = this.totalDistance;
110
91
  }
111
92
  }
112
-
113
93
  complex.startIndex = complex.positions.length / 6;
114
94
  return complex;
115
95
  }
@@ -117,48 +97,47 @@ var ExtrudePolyline = /*#__PURE__*/function () {
117
97
  key: "simpleExtrude_gaode2",
118
98
  value: function simpleExtrude_gaode2(points, originPoints) {
119
99
  var complex = this.complex;
120
-
121
100
  if (points.length <= 1) {
122
101
  return complex;
123
102
  }
124
-
125
103
  this.lastFlip = -1;
126
104
  this.started = false;
127
105
  this.normal = null;
128
- this.totalDistance = 0; // 去除数组里重复的点
106
+ this.totalDistance = 0;
107
+ // 去除数组里重复的点
129
108
  // points = getArrayUnique(points);
130
-
131
109
  var total = points.length;
132
110
  var count = complex.startIndex;
133
-
134
111
  for (var i = 1; i < total; i++) {
135
112
  var _originPoints$, _originPoints$i$, _originPoints$2;
136
-
137
113
  var last = points[i - 1];
138
- last.push((_originPoints$ = originPoints[i - 1][2]) !== null && _originPoints$ !== void 0 ? _originPoints$ : 0); // @ts-ignore
139
-
114
+ last.push((_originPoints$ = originPoints[i - 1][2]) !== null && _originPoints$ !== void 0 ? _originPoints$ : 0);
115
+ // @ts-ignore
140
116
  var originLast = originPoints[i - 1];
141
117
  var cur = points[i];
142
- cur.push((_originPoints$i$ = originPoints[i][2]) !== null && _originPoints$i$ !== void 0 ? _originPoints$i$ : 0); // @ts-ignore
143
-
118
+ cur.push((_originPoints$i$ = originPoints[i][2]) !== null && _originPoints$i$ !== void 0 ? _originPoints$i$ : 0);
119
+ // @ts-ignore
144
120
  var originCur = originPoints[i];
145
121
  var next = i < points.length - 1 ? [].concat(_toConsumableArray(points[i + 1]), [(_originPoints$2 = originPoints[i + 1][2]) !== null && _originPoints$2 !== void 0 ? _originPoints$2 : 0]) : null;
146
122
  var originNext = i < originPoints.length - 1 ? originPoints[i + 1] : null;
147
- var amt = this.simpleSegment(complex, count, // @ts-ignore
148
- last, // @ts-ignore
149
- cur, // @ts-ignore
150
- next, // @ts-ignore
151
- originLast, originCur, // @ts-ignore
123
+ var amt = this.simpleSegment(complex, count,
124
+ // @ts-ignore
125
+ last,
126
+ // @ts-ignore
127
+ cur,
128
+ // @ts-ignore
129
+ next,
130
+ // @ts-ignore
131
+ originLast, originCur,
132
+ // @ts-ignore
152
133
  originNext);
153
134
  count += amt;
154
135
  }
155
-
156
136
  if (this.dash) {
157
137
  for (var _i2 = 0; _i2 < complex.positions.length / 6; _i2++) {
158
138
  complex.positions[_i2 * 6 + 5] = this.totalDistance;
159
139
  }
160
140
  }
161
-
162
141
  complex.startIndex = complex.positions.length / 6;
163
142
  return complex;
164
143
  }
@@ -166,48 +145,47 @@ var ExtrudePolyline = /*#__PURE__*/function () {
166
145
  key: "extrude_gaode2",
167
146
  value: function extrude_gaode2(points, originPoints) {
168
147
  var complex = this.complex;
169
-
170
148
  if (points.length <= 1) {
171
149
  return complex;
172
150
  }
173
-
174
151
  this.lastFlip = -1;
175
152
  this.started = false;
176
153
  this.normal = null;
177
- this.totalDistance = 0; // 去除数组里重复的点
154
+ this.totalDistance = 0;
155
+ // 去除数组里重复的点
178
156
  // points = getArrayUnique(points);
179
-
180
157
  var total = points.length;
181
158
  var count = complex.startIndex;
182
-
183
159
  for (var i = 1; i < total; i++) {
184
160
  var _originPoints$3, _originPoints$i$2, _originPoints$4;
185
-
186
161
  var last = points[i - 1];
187
- last.push((_originPoints$3 = originPoints[i - 1][2]) !== null && _originPoints$3 !== void 0 ? _originPoints$3 : 0); // @ts-ignore
188
-
162
+ last.push((_originPoints$3 = originPoints[i - 1][2]) !== null && _originPoints$3 !== void 0 ? _originPoints$3 : 0);
163
+ // @ts-ignore
189
164
  var originLast = originPoints[i - 1];
190
165
  var cur = points[i];
191
- cur.push((_originPoints$i$2 = originPoints[i][2]) !== null && _originPoints$i$2 !== void 0 ? _originPoints$i$2 : 0); // @ts-ignore
192
-
166
+ cur.push((_originPoints$i$2 = originPoints[i][2]) !== null && _originPoints$i$2 !== void 0 ? _originPoints$i$2 : 0);
167
+ // @ts-ignore
193
168
  var originCur = originPoints[i];
194
169
  var next = i < points.length - 1 ? [].concat(_toConsumableArray(points[i + 1]), [(_originPoints$4 = originPoints[i + 1][2]) !== null && _originPoints$4 !== void 0 ? _originPoints$4 : 0]) : null;
195
170
  var originNext = i < originPoints.length - 1 ? originPoints[i + 1] : null;
196
- var amt = this.segment_gaode2(complex, count, // @ts-ignore
197
- last, // @ts-ignore
198
- cur, // @ts-ignore
199
- next, // @ts-ignore
200
- originLast, originCur, // @ts-ignore
171
+ var amt = this.segment_gaode2(complex, count,
172
+ // @ts-ignore
173
+ last,
174
+ // @ts-ignore
175
+ cur,
176
+ // @ts-ignore
177
+ next,
178
+ // @ts-ignore
179
+ originLast, originCur,
180
+ // @ts-ignore
201
181
  originNext);
202
182
  count += amt;
203
183
  }
204
-
205
184
  if (this.dash) {
206
185
  for (var _i3 = 0; _i3 < complex.positions.length / 6; _i3++) {
207
186
  complex.positions[_i3 * 6 + 5] = this.totalDistance;
208
187
  }
209
188
  }
210
-
211
189
  complex.startIndex = complex.positions.length / 6;
212
190
  return complex;
213
191
  }
@@ -215,20 +193,17 @@ var ExtrudePolyline = /*#__PURE__*/function () {
215
193
  key: "extrude",
216
194
  value: function extrude(points) {
217
195
  var complex = this.complex;
218
-
219
196
  if (points.length <= 1) {
220
197
  return complex;
221
198
  }
222
-
223
199
  this.lastFlip = -1;
224
200
  this.started = false;
225
201
  this.normal = null;
226
- this.totalDistance = 0; // 去除数组里重复的点
202
+ this.totalDistance = 0;
203
+ // 去除数组里重复的点
227
204
  // points = getArrayUnique(points);
228
-
229
205
  var total = points.length;
230
206
  var count = complex.startIndex;
231
-
232
207
  for (var i = 1; i < total; i++) {
233
208
  var last = points[i - 1];
234
209
  var cur = points[i];
@@ -236,13 +211,11 @@ var ExtrudePolyline = /*#__PURE__*/function () {
236
211
  var amt = this.segment(complex, count, last, cur, next);
237
212
  count += amt;
238
213
  }
239
-
240
214
  if (this.dash) {
241
215
  for (var _i4 = 0; _i4 < complex.positions.length / 6; _i4++) {
242
216
  complex.positions[_i4 * 6 + 5] = this.totalDistance;
243
217
  }
244
218
  }
245
-
246
219
  complex.startIndex = complex.positions.length / 6;
247
220
  return complex;
248
221
  }
@@ -254,29 +227,24 @@ var ExtrudePolyline = /*#__PURE__*/function () {
254
227
  var positions = complex.positions;
255
228
  var normals = complex.normals;
256
229
  var flatCur = aProjectFlat([cur[0], cur[1]]);
257
- var flatLast = aProjectFlat([last[0], last[1]]); // @ts-ignore
258
-
230
+ var flatLast = aProjectFlat([last[0], last[1]]);
231
+ // @ts-ignore
259
232
  direction(lineA, flatCur, flatLast);
260
233
  var segmentDistance = 0;
261
-
262
234
  if (this.dash) {
263
235
  // @ts-ignore
264
236
  segmentDistance = this.lineSegmentDistance(flatCur, flatLast);
265
237
  this.totalDistance += segmentDistance;
266
238
  }
267
-
268
239
  if (!this.normal) {
269
240
  this.normal = vec2.create();
270
241
  computeNormal(this.normal, lineA);
271
242
  }
272
-
273
243
  if (!this.started) {
274
244
  this.started = true;
275
245
  this.extrusions(positions, normals, last, this.normal, this.thickness, this.totalDistance - segmentDistance);
276
246
  }
277
-
278
247
  indices.push(index + 0, index + 1, index + 2);
279
-
280
248
  if (!next) {
281
249
  computeNormal(this.normal, lineA);
282
250
  this.extrusions(positions, normals, cur, this.normal, this.thickness, this.totalDistance);
@@ -284,35 +252,36 @@ var ExtrudePolyline = /*#__PURE__*/function () {
284
252
  count += 2;
285
253
  } else {
286
254
  var flatNext = aProjectFlat([next[0], next[1]]);
287
-
288
255
  if (isPointEqual(flatCur, flatNext)) {
289
256
  vec2.add(flatNext, flatCur, vec2.normalize(flatNext, vec2.subtract(flatNext, flatCur, flatLast)));
290
257
  }
258
+ direction(lineB, flatNext, flatCur);
291
259
 
292
- direction(lineB, flatNext, flatCur); // stores tangent & miter
260
+ // stores tangent & miter
293
261
 
294
262
  var _computeMiter = computeMiter(tangent, vec2.create(), lineA, lineB, this.thickness),
295
- _computeMiter2 = _slicedToArray(_computeMiter, 2),
296
- miterLen = _computeMiter2[0],
297
- miter = _computeMiter2[1]; // normal(tmp, lineA)
298
- // get orientation
299
-
263
+ _computeMiter2 = _slicedToArray(_computeMiter, 2),
264
+ miterLen = _computeMiter2[0],
265
+ miter = _computeMiter2[1];
266
+ // normal(tmp, lineA)
300
267
 
268
+ // get orientation
301
269
  var flip = vec2.dot(tangent, this.normal) < 0 ? -1 : 1;
302
270
  this.extrusions(positions, normals, cur, miter, miterLen, this.totalDistance);
303
271
  indices.push.apply(indices, _toConsumableArray(this.lastFlip === 1 ? [index, index + 2, index + 3] : [index + 2, index + 1, index + 3]));
304
- flip = -1; // the miter is now the normal for our next join
272
+ flip = -1;
305
273
 
274
+ // the miter is now the normal for our next join
306
275
  vec2.copy(this.normal, miter);
307
276
  count += 2;
308
277
  this.lastFlip = flip;
309
278
  }
310
-
311
279
  return count;
312
280
  }
313
281
  }, {
314
282
  key: "segment_gaode2",
315
- value: function segment_gaode2(complex, index, last, cur, next, originLast, originCur, // eslint-disable-next-line @typescript-eslint/no-unused-vars
283
+ value: function segment_gaode2(complex, index, last, cur, next, originLast, originCur,
284
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
316
285
  originNext) {
317
286
  var count = 0;
318
287
  var indices = complex.indices;
@@ -321,25 +290,23 @@ var ExtrudePolyline = /*#__PURE__*/function () {
321
290
  var capSquare = this.cap === 'square';
322
291
  var joinBevel = this.join === 'bevel';
323
292
  var flatCur = aProjectFlat([originCur[0], originCur[1]]);
324
- var flatLast = aProjectFlat([originLast[0], originLast[1]]); // @ts-ignore
325
-
293
+ var flatLast = aProjectFlat([originLast[0], originLast[1]]);
294
+ // @ts-ignore
326
295
  direction(lineA, cur, last);
327
296
  var segmentDistance = 0;
328
-
329
297
  if (this.dash) {
330
298
  // @ts-ignore
331
299
  segmentDistance = this.lineSegmentDistance(flatCur, flatLast);
332
300
  this.totalDistance += segmentDistance;
333
301
  }
334
-
335
302
  if (!this.normal) {
336
303
  this.normal = vec2.create();
337
304
  computeNormal(this.normal, lineA);
338
305
  }
339
-
340
306
  if (!this.started) {
341
- this.started = true; // if the end cap is type square, we can just push the verts out a bit
307
+ this.started = true;
342
308
 
309
+ // if the end cap is type square, we can just push the verts out a bit
343
310
  if (capSquare) {
344
311
  // vec2.scaleAndAdd(capEnd, last, lineA, -this.thickness);
345
312
  var out1 = vec2.create();
@@ -357,17 +324,12 @@ var ExtrudePolyline = /*#__PURE__*/function () {
357
324
  this.extrusions(positions, normals, last, this.normal, this.thickness, this.totalDistance - segmentDistance);
358
325
  }
359
326
  }
360
-
361
327
  indices.push(index + 0, index + 1, index + 2);
362
-
363
328
  if (!next) {
364
329
  computeNormal(this.normal, lineA);
365
-
366
330
  if (capSquare) {
367
331
  var _out = vec2.create();
368
-
369
332
  var _out2 = vec2.create();
370
-
371
333
  vec2.sub(_out2, lineA, this.normal);
372
334
  vec2.add(_out, lineA, this.normal);
373
335
  normals.push(_out2[0], _out2[1], 0);
@@ -380,40 +342,40 @@ var ExtrudePolyline = /*#__PURE__*/function () {
380
342
  } else {
381
343
  this.extrusions(positions, normals, cur, this.normal, this.thickness, this.totalDistance);
382
344
  }
383
-
384
345
  indices.push.apply(indices, _toConsumableArray(this.lastFlip === 1 ? [index, index + 2, index + 3] : [index + 2, index + 1, index + 3]));
385
346
  count += 2;
386
347
  } else {
387
348
  // @ts-ignore
388
349
  if (isPointEqual(cur, next)) {
389
- vec2.add( // @ts-ignore
390
- next, // @ts-ignore
391
- cur, vec2.normalize( // @ts-ignore
392
- next, // @ts-ignore
350
+ vec2.add(
351
+ // @ts-ignore
352
+ next,
353
+ // @ts-ignore
354
+ cur, vec2.normalize(
355
+ // @ts-ignore
356
+ next,
357
+ // @ts-ignore
393
358
  vec2.subtract(next, cur, last)));
394
- } // @ts-ignore
395
-
396
-
397
- direction(lineB, next, cur); // stores tangent & miter
359
+ }
360
+ // @ts-ignore
361
+ direction(lineB, next, cur);
362
+ // stores tangent & miter
398
363
 
399
364
  var _computeMiter3 = computeMiter(tangent, vec2.create(), lineA, lineB, this.thickness),
400
- _computeMiter4 = _slicedToArray(_computeMiter3, 2),
401
- miterLen = _computeMiter4[0],
402
- miter = _computeMiter4[1]; // normal(tmp, lineA)
403
- // get orientation
404
-
365
+ _computeMiter4 = _slicedToArray(_computeMiter3, 2),
366
+ miterLen = _computeMiter4[0],
367
+ miter = _computeMiter4[1];
368
+ // normal(tmp, lineA)
405
369
 
370
+ // get orientation
406
371
  var flip = vec2.dot(tangent, this.normal) < 0 ? -1 : 1;
407
372
  var bevel = joinBevel;
408
-
409
373
  if (!bevel && this.join === 'miter') {
410
374
  var limit = miterLen;
411
-
412
375
  if (limit > this.miterLimit) {
413
376
  bevel = true;
414
377
  }
415
378
  }
416
-
417
379
  if (bevel) {
418
380
  normals.push(this.normal[0], this.normal[1], 0);
419
381
  normals.push(miter[0], miter[1], 0);
@@ -422,12 +384,12 @@ var ExtrudePolyline = /*#__PURE__*/function () {
422
384
  positions.push(cur[0], cur[1], cur[2] | 0, this.totalDistance, this.thickness * flip, cur[2] | 0);
423
385
  this.complex.indexes.push(this.currentIndex);
424
386
  this.currentIndex++;
425
- indices.push.apply(indices, _toConsumableArray(this.lastFlip !== -flip ? [index, index + 2, index + 3] : [index + 2, index + 1, index + 3])); // now add the bevel triangle
387
+ indices.push.apply(indices, _toConsumableArray(this.lastFlip !== -flip ? [index, index + 2, index + 3] : [index + 2, index + 1, index + 3]));
426
388
 
389
+ // now add the bevel triangle
427
390
  indices.push(index + 2, index + 3, index + 4);
428
391
  computeNormal(tmp, lineB);
429
392
  vec2.copy(this.normal, tmp); // store normal for next round
430
-
431
393
  normals.push(this.normal[0], this.normal[1], 0);
432
394
  positions.push(cur[0], cur[1], cur[2] | 0, this.totalDistance, -this.thickness * flip, cur[2] | 0);
433
395
  this.complex.indexes.push(this.currentIndex);
@@ -436,15 +398,14 @@ var ExtrudePolyline = /*#__PURE__*/function () {
436
398
  } else {
437
399
  this.extrusions(positions, normals, cur, miter, miterLen, this.totalDistance);
438
400
  indices.push.apply(indices, _toConsumableArray(this.lastFlip === 1 ? [index, index + 2, index + 3] : [index + 2, index + 1, index + 3]));
439
- flip = -1; // the miter is now the normal for our next join
401
+ flip = -1;
440
402
 
403
+ // the miter is now the normal for our next join
441
404
  vec2.copy(this.normal, miter);
442
405
  count += 2;
443
406
  }
444
-
445
407
  this.lastFlip = flip;
446
408
  }
447
-
448
409
  return count;
449
410
  }
450
411
  }, {
@@ -457,25 +418,23 @@ var ExtrudePolyline = /*#__PURE__*/function () {
457
418
  var capSquare = this.cap === 'square';
458
419
  var joinBevel = this.join === 'bevel';
459
420
  var flatCur = aProjectFlat([cur[0], cur[1]]);
460
- var flatLast = aProjectFlat([last[0], last[1]]); // @ts-ignore
461
-
421
+ var flatLast = aProjectFlat([last[0], last[1]]);
422
+ // @ts-ignore
462
423
  direction(lineA, flatCur, flatLast);
463
424
  var segmentDistance = 0;
464
-
465
425
  if (this.dash) {
466
426
  // @ts-ignore
467
427
  segmentDistance = this.lineSegmentDistance(flatCur, flatLast);
468
428
  this.totalDistance += segmentDistance;
469
429
  }
470
-
471
430
  if (!this.normal) {
472
431
  this.normal = vec2.create();
473
432
  computeNormal(this.normal, lineA);
474
433
  }
475
-
476
434
  if (!this.started) {
477
- this.started = true; // if the end cap is type square, we can just push the verts out a bit
435
+ this.started = true;
478
436
 
437
+ // if the end cap is type square, we can just push the verts out a bit
479
438
  if (capSquare) {
480
439
  // vec2.scaleAndAdd(capEnd, last, lineA, -this.thickness);
481
440
  var out1 = vec2.create();
@@ -488,28 +447,24 @@ var ExtrudePolyline = /*#__PURE__*/function () {
488
447
  this.complex.indexes.push(this.currentIndex);
489
448
  positions.push(last[0], last[1], last[2] | 0, this.totalDistance - segmentDistance, this.thickness, last[2] | 0);
490
449
  this.complex.indexes.push(this.currentIndex);
491
- this.currentIndex++; // this.extrusions(positions, normals, last, out, this.thickness);
450
+ this.currentIndex++;
451
+ // this.extrusions(positions, normals, last, out, this.thickness);
492
452
  // last = capEnd;
493
453
  } else {
494
454
  this.extrusions(positions, normals, last, this.normal, this.thickness, this.totalDistance - segmentDistance);
495
455
  }
496
456
  }
497
-
498
457
  indices.push(index + 0, index + 1, index + 2);
499
-
500
458
  if (!next) {
501
459
  computeNormal(this.normal, lineA);
502
-
503
460
  if (capSquare) {
504
461
  // vec2.scaleAndAdd(capEnd, cur, lineA, this.thickness);
505
462
  // cur = capEnd;
506
463
  var _out3 = vec2.create();
507
-
508
464
  var _out4 = vec2.create();
509
-
510
465
  vec2.sub(_out4, lineA, this.normal);
511
- vec2.add(_out3, lineA, this.normal); // this.extrusions(positions, normals, cur, out, this.thickness);
512
-
466
+ vec2.add(_out3, lineA, this.normal);
467
+ // this.extrusions(positions, normals, cur, out, this.thickness);
513
468
  normals.push(_out4[0], _out4[1], 0);
514
469
  normals.push(_out3[0], _out3[1], 0);
515
470
  positions.push(cur[0], cur[1], cur[2] | 0, this.totalDistance, this.thickness, cur[2] | 0);
@@ -519,38 +474,35 @@ var ExtrudePolyline = /*#__PURE__*/function () {
519
474
  this.currentIndex++;
520
475
  } else {
521
476
  this.extrusions(positions, normals, cur, this.normal, this.thickness, this.totalDistance);
522
- } // this.extrusions(positions, normals, cur, this.normal, this.thickness);
523
-
477
+ }
524
478
 
479
+ // this.extrusions(positions, normals, cur, this.normal, this.thickness);
525
480
  indices.push.apply(indices, _toConsumableArray(this.lastFlip === 1 ? [index, index + 2, index + 3] : [index + 2, index + 1, index + 3]));
526
481
  count += 2;
527
482
  } else {
528
483
  var flatNext = aProjectFlat([next[0], next[1]]);
529
-
530
484
  if (isPointEqual(flatCur, flatNext)) {
531
485
  vec2.add(flatNext, flatCur, vec2.normalize(flatNext, vec2.subtract(flatNext, flatCur, flatLast)));
532
486
  }
487
+ direction(lineB, flatNext, flatCur);
533
488
 
534
- direction(lineB, flatNext, flatCur); // stores tangent & miter
489
+ // stores tangent & miter
535
490
 
536
491
  var _computeMiter5 = computeMiter(tangent, vec2.create(), lineA, lineB, this.thickness),
537
- _computeMiter6 = _slicedToArray(_computeMiter5, 2),
538
- miterLen = _computeMiter6[0],
539
- miter = _computeMiter6[1]; // normal(tmp, lineA)
540
- // get orientation
541
-
492
+ _computeMiter6 = _slicedToArray(_computeMiter5, 2),
493
+ miterLen = _computeMiter6[0],
494
+ miter = _computeMiter6[1];
495
+ // normal(tmp, lineA)
542
496
 
497
+ // get orientation
543
498
  var flip = vec2.dot(tangent, this.normal) < 0 ? -1 : 1;
544
499
  var bevel = joinBevel;
545
-
546
500
  if (!bevel && this.join === 'miter') {
547
501
  var limit = miterLen;
548
-
549
502
  if (limit > this.miterLimit) {
550
503
  bevel = true;
551
504
  }
552
505
  }
553
-
554
506
  if (bevel) {
555
507
  normals.push(this.normal[0], this.normal[1], 0);
556
508
  normals.push(miter[0], miter[1], 0);
@@ -559,12 +511,12 @@ var ExtrudePolyline = /*#__PURE__*/function () {
559
511
  positions.push(cur[0], cur[1], cur[2] | 0, this.totalDistance, this.thickness * flip, cur[2] | 0);
560
512
  this.complex.indexes.push(this.currentIndex);
561
513
  this.currentIndex++;
562
- indices.push.apply(indices, _toConsumableArray(this.lastFlip !== -flip ? [index, index + 2, index + 3] : [index + 2, index + 1, index + 3])); // now add the bevel triangle
514
+ indices.push.apply(indices, _toConsumableArray(this.lastFlip !== -flip ? [index, index + 2, index + 3] : [index + 2, index + 1, index + 3]));
563
515
 
516
+ // now add the bevel triangle
564
517
  indices.push(index + 2, index + 3, index + 4);
565
518
  computeNormal(tmp, lineB);
566
519
  vec2.copy(this.normal, tmp); // store normal for next round
567
-
568
520
  normals.push(this.normal[0], this.normal[1], 0);
569
521
  positions.push(cur[0], cur[1], cur[2] | 0, this.totalDistance, -this.thickness * flip, cur[2] | 0);
570
522
  this.complex.indexes.push(this.currentIndex);
@@ -573,22 +525,24 @@ var ExtrudePolyline = /*#__PURE__*/function () {
573
525
  } else {
574
526
  this.extrusions(positions, normals, cur, miter, miterLen, this.totalDistance);
575
527
  indices.push.apply(indices, _toConsumableArray(this.lastFlip === 1 ? [index, index + 2, index + 3] : [index + 2, index + 1, index + 3]));
576
- flip = -1; // the miter is now the normal for our next join
528
+ flip = -1;
577
529
 
530
+ // the miter is now the normal for our next join
578
531
  vec2.copy(this.normal, miter);
579
532
  count += 2;
580
533
  }
581
-
582
534
  this.lastFlip = flip;
583
535
  }
584
-
585
536
  return count;
586
537
  }
587
538
  }, {
588
539
  key: "extrusions",
589
- value: function extrusions(positions, normals, point, // 顶点
590
- normal, // 法向量
591
- thickness, // 高度
540
+ value: function extrusions(positions, normals, point,
541
+ // 顶点
542
+ normal,
543
+ // 法向量
544
+ thickness,
545
+ // 高度
592
546
  distanceRadio) {
593
547
  normals.push(normal[0], normal[1], 0);
594
548
  normals.push(normal[0], normal[1], 0);
@@ -606,8 +560,6 @@ var ExtrudePolyline = /*#__PURE__*/function () {
606
560
  return Math.sqrt(dx * dx + dy * dy);
607
561
  }
608
562
  }]);
609
-
610
563
  return ExtrudePolyline;
611
564
  }();
612
-
613
565
  export { ExtrudePolyline as default };