@antv/l7-layers 2.15.2 → 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 (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
@@ -1,24 +1,16 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.default = void 0;
9
-
10
8
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
11
-
12
9
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
13
-
14
10
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
15
-
16
11
  function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
17
-
18
12
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
19
-
20
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
21
-
13
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
22
14
  /**
23
15
  * 网格索引,相比 @mapbox/grid-index,在简单计算碰撞检测结果时效率更高
24
16
  * @see https://zhuanlan.zhihu.com/p/74373214
@@ -30,11 +22,9 @@ var GridIndex = /*#__PURE__*/function () {
30
22
  var boxCells = this.boxCells;
31
23
  this.xCellCount = Math.ceil(width / cellSize);
32
24
  this.yCellCount = Math.ceil(height / cellSize);
33
-
34
25
  for (var i = 0; i < this.xCellCount * this.yCellCount; i++) {
35
26
  boxCells.push([]);
36
27
  }
37
-
38
28
  this.boxKeys = [];
39
29
  this.bboxes = [];
40
30
  this.width = width;
@@ -43,7 +33,6 @@ var GridIndex = /*#__PURE__*/function () {
43
33
  this.yScale = this.yCellCount / height;
44
34
  this.boxUid = 0;
45
35
  }
46
-
47
36
  (0, _createClass2.default)(GridIndex, [{
48
37
  key: "insert",
49
38
  value: function insert(key, x1, y1, x2, y2) {
@@ -75,15 +64,12 @@ var GridIndex = /*#__PURE__*/function () {
75
64
  if (x2 < 0 || x1 > this.width || y2 < 0 || y1 > this.height) {
76
65
  return hitTest ? false : [];
77
66
  }
78
-
79
67
  var result = [];
80
-
81
68
  if (x1 <= 0 && y1 <= 0 && this.width <= x2 && this.height <= y2) {
82
69
  // 这一步是高效的关键,后续精确碰撞检测结果在计算文本可见性时并不需要
83
70
  if (hitTest) {
84
71
  return true;
85
72
  }
86
-
87
73
  for (var boxUid = 0; boxUid < this.boxKeys.length; boxUid++) {
88
74
  result.push({
89
75
  key: this.boxKeys[boxUid],
@@ -93,10 +79,8 @@ var GridIndex = /*#__PURE__*/function () {
93
79
  y2: this.bboxes[boxUid * 4 + 3]
94
80
  });
95
81
  }
96
-
97
82
  return predicate ? result.filter(predicate) : result;
98
83
  }
99
-
100
84
  var queryArgs = {
101
85
  hitTest: hitTest,
102
86
  seenUids: {
@@ -112,27 +96,21 @@ var GridIndex = /*#__PURE__*/function () {
112
96
  value: function queryCell(x1, y1, x2, y2, cellIndex, result, queryArgs, predicate) {
113
97
  var seenUids = queryArgs.seenUids;
114
98
  var boxCell = this.boxCells[cellIndex];
115
-
116
99
  if (boxCell !== null) {
117
100
  var bboxes = this.bboxes;
118
-
119
101
  var _iterator = _createForOfIteratorHelper(boxCell),
120
- _step;
121
-
102
+ _step;
122
103
  try {
123
104
  for (_iterator.s(); !(_step = _iterator.n()).done;) {
124
105
  var boxUid = _step.value;
125
-
126
106
  if (!seenUids.box[boxUid]) {
127
107
  seenUids.box[boxUid] = true;
128
108
  var offset = boxUid * 4;
129
-
130
109
  if (x1 <= bboxes[offset + 2] && y1 <= bboxes[offset + 3] && x2 >= bboxes[offset + 0] && y2 >= bboxes[offset + 1] && (!predicate || predicate(this.boxKeys[boxUid]))) {
131
110
  if (queryArgs.hitTest) {
132
111
  result.push(true);
133
112
  return true;
134
113
  }
135
-
136
114
  result.push({
137
115
  key: this.boxKeys[boxUid],
138
116
  x1: bboxes[offset],
@@ -149,7 +127,6 @@ var GridIndex = /*#__PURE__*/function () {
149
127
  _iterator.f();
150
128
  }
151
129
  }
152
-
153
130
  return false;
154
131
  }
155
132
  }, {
@@ -159,11 +136,9 @@ var GridIndex = /*#__PURE__*/function () {
159
136
  var cy1 = this.convertToYCellCoord(y1);
160
137
  var cx2 = this.convertToXCellCoord(x2);
161
138
  var cy2 = this.convertToYCellCoord(y2);
162
-
163
139
  for (var x = cx1; x <= cx2; x++) {
164
140
  for (var y = cy1; y <= cy2; y++) {
165
141
  var cellIndex = this.xCellCount * y + x;
166
-
167
142
  if (fn.call(this, x1, y1, x2, y2, cellIndex, arg1, arg2, predicate)) {
168
143
  return;
169
144
  }
@@ -183,6 +158,5 @@ var GridIndex = /*#__PURE__*/function () {
183
158
  }]);
184
159
  return GridIndex;
185
160
  }();
186
-
187
161
  var _default = GridIndex;
188
162
  exports.default = _default;
@@ -4,38 +4,29 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = identity;
7
-
8
7
  function identity(d) {
9
8
  var unknown;
10
9
  var domain = [];
11
-
12
10
  function scale(x) {
13
11
  return x == null ? unknown : x;
14
12
  }
15
-
16
13
  scale.invert = scale;
17
-
18
14
  scale.domain = scale.range = function (v) {
19
15
  if (v) {
20
16
  domain = v;
21
17
  return v;
22
18
  }
23
-
24
19
  return domain;
25
20
  };
26
-
27
21
  scale.unknown = function (v) {
28
22
  if (v) {
29
23
  unknown = v;
30
24
  return v;
31
25
  }
32
-
33
26
  return unknown;
34
27
  };
35
-
36
28
  scale.copy = function () {
37
29
  return identity(d).unknown(unknown);
38
30
  };
39
-
40
31
  return scale;
41
32
  }
@@ -1,66 +1,57 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.calculateData = calculateData;
9
-
10
8
  var _l7Maps = require("@antv/l7-maps");
11
-
12
9
  var _l7Source = _interopRequireDefault(require("@antv/l7-source"));
13
-
14
10
  var _l7Utils = require("@antv/l7-utils");
15
-
16
11
  var _lodash = require("lodash");
17
-
18
12
  function getArrowPoints(p1, p2) {
19
13
  var dir = [p2[0] - p1[0], p2[1] - p1[1]];
20
14
  var normalizeDir = (0, _l7Utils.normalize)(dir);
21
15
  var arrowPoint = [p1[0] + normalizeDir[0] * 0.0001, p1[1] + normalizeDir[1] * 0.0001];
22
16
  return arrowPoint;
23
17
  }
24
-
25
18
  function adjustData2Amap2Coordinates(mappedData, mapService, layer) {
26
19
  // 根据地图的类型判断是否需要对点位数据进行处理, 若是高德2.0则需要对坐标进行相对偏移
27
20
  if (mappedData.length > 0 && mapService.version === _l7Maps.Version['GAODE2.x']) {
28
21
  var layerCenter = layer.coordCenter;
29
-
30
22
  if (typeof mappedData[0].coordinates[0] === 'number') {
31
23
  // 单个的点数据
32
24
  // @ts-ignore
33
- mappedData // 避免经纬度被重复计算导致坐标位置偏移
25
+ mappedData
26
+ // 避免经纬度被重复计算导致坐标位置偏移
34
27
  .filter(function (d) {
35
28
  return !d.originCoordinates;
36
29
  }).map(function (d) {
37
- d.version = _l7Maps.Version['GAODE2.x']; // @ts-ignore
38
-
30
+ d.version = _l7Maps.Version['GAODE2.x'];
31
+ // @ts-ignore
39
32
  d.originCoordinates = (0, _lodash.cloneDeep)(d.coordinates); // 为了兼容高德1.x 需要保存一份原始的经纬度坐标数据(许多上层逻辑依赖经纬度数据)
40
33
  // @ts-ignore
41
34
  // d.coordinates = mapService.lngLatToCoord(d.coordinates);
42
-
43
35
  d.coordinates = mapService.lngLatToCoordByLayer(d.coordinates, layerCenter);
44
36
  });
45
37
  } else {
46
38
  // 连续的线、面数据
47
39
  // @ts-ignore
48
- mappedData // 避免经纬度被重复计算导致坐标位置偏移
40
+ mappedData
41
+ // 避免经纬度被重复计算导致坐标位置偏移
49
42
  .filter(function (d) {
50
43
  return !d.originCoordinates;
51
44
  }).map(function (d) {
52
- d.version = _l7Maps.Version['GAODE2.x']; // @ts-ignore
53
-
45
+ d.version = _l7Maps.Version['GAODE2.x'];
46
+ // @ts-ignore
54
47
  d.originCoordinates = (0, _lodash.cloneDeep)(d.coordinates); // 为了兼容高德1.x 需要保存一份原始的经纬度坐标数据(许多上层逻辑依赖经纬度数据)
55
48
  // @ts-ignore
56
49
  // d.coordinates = mapService.lngLatToCoords(d.coordinates);
57
-
58
50
  d.coordinates = mapService.lngLatToCoordsByLayer(d.coordinates, layerCenter);
59
51
  });
60
52
  }
61
53
  }
62
54
  }
63
-
64
55
  function adjustData2SimpleCoordinates(mappedData, mapService) {
65
56
  if (mappedData.length > 0 && mapService.version === _l7Maps.Version.SIMPLE) {
66
57
  mappedData.map(function (d) {
@@ -71,12 +62,10 @@ function adjustData2SimpleCoordinates(mappedData, mapService) {
71
62
  });
72
63
  }
73
64
  }
74
-
75
65
  function unProjectCoordinates(coordinates, mapService) {
76
66
  if (typeof coordinates[0] === 'number') {
77
67
  return mapService.simpleMapCoord.unproject(coordinates);
78
68
  }
79
-
80
69
  if (coordinates[0] && coordinates[0][0] instanceof Array) {
81
70
  // @ts-ignore
82
71
  var coords = [];
@@ -85,38 +74,33 @@ function unProjectCoordinates(coordinates, mapService) {
85
74
  var c1 = [];
86
75
  coord.map(function (co) {
87
76
  c1.push(mapService.simpleMapCoord.unproject(co));
88
- }); // @ts-ignore
89
-
77
+ });
78
+ // @ts-ignore
90
79
  coords.push(c1);
91
- }); // @ts-ignore
92
-
80
+ });
81
+ // @ts-ignore
93
82
  return coords;
94
83
  } else {
95
84
  // @ts-ignore
96
- var _coords = []; // @ts-ignore
97
-
85
+ var _coords = [];
86
+ // @ts-ignore
98
87
  coordinates.map(function (coord) {
99
88
  _coords.push(mapService.simpleMapCoord.unproject(coord));
100
- }); // @ts-ignore
101
-
89
+ });
90
+ // @ts-ignore
102
91
  return _coords;
103
92
  }
104
93
  }
105
-
106
94
  function applyAttributeMapping(attribute, record) {
107
95
  var _attribute$scale;
108
-
109
96
  if (!attribute.scale) {
110
97
  return [];
111
98
  }
112
-
113
99
  var scalers = (attribute === null || attribute === void 0 ? void 0 : (_attribute$scale = attribute.scale) === null || _attribute$scale === void 0 ? void 0 : _attribute$scale.scalers) || [];
114
100
  var params = [];
115
101
  scalers.forEach(function (_ref) {
116
102
  var _attribute$scale2;
117
-
118
103
  var field = _ref.field;
119
-
120
104
  if (record.hasOwnProperty(field) || ((_attribute$scale2 = attribute.scale) === null || _attribute$scale2 === void 0 ? void 0 : _attribute$scale2.type) === 'variable') {
121
105
  // TODO:多字段,常量
122
106
  params.push(record[field]);
@@ -125,14 +109,12 @@ function applyAttributeMapping(attribute, record) {
125
109
  var mappingResult = attribute.mapping ? attribute.mapping(params) : [];
126
110
  return mappingResult;
127
111
  }
128
-
129
112
  function mapping(attributes, data, fontService, mapService, layer) {
130
113
  var _ref2 = layer === null || layer === void 0 ? void 0 : layer.getLayerConfig(),
131
- _ref2$arrow = _ref2.arrow,
132
- arrow = _ref2$arrow === void 0 ? {
133
- enable: false
134
- } : _ref2$arrow;
135
-
114
+ _ref2$arrow = _ref2.arrow,
115
+ arrow = _ref2$arrow === void 0 ? {
116
+ enable: false
117
+ } : _ref2$arrow;
136
118
  var mappedData = data.map(function (record) {
137
119
  var encodeRecord = {
138
120
  id: record._id,
@@ -142,38 +124,37 @@ function mapping(attributes, data, fontService, mapService, layer) {
142
124
  return attribute.scale !== undefined;
143
125
  }).forEach(function (attribute) {
144
126
  var values = applyAttributeMapping(attribute, record);
145
- attribute.needRemapping = false; // TODO: 支持每个属性配置 postprocess
127
+ attribute.needRemapping = false;
146
128
 
129
+ // TODO: 支持每个属性配置 postprocess
147
130
  if (attribute.name === 'color') {
148
131
  values = values.map(function (c) {
149
132
  return (0, _l7Utils.rgb2arr)(c);
150
133
  });
151
- } // @ts-ignore
152
-
153
-
154
- encodeRecord[attribute.name] = Array.isArray(values) && values.length === 1 ? values[0] : values; // 增加对 layer/text/iconfont unicode 映射的解析
134
+ }
135
+ // @ts-ignore
136
+ encodeRecord[attribute.name] = Array.isArray(values) && values.length === 1 ? values[0] : values;
155
137
 
138
+ // 增加对 layer/text/iconfont unicode 映射的解析
156
139
  if (attribute.name === 'shape') {
157
140
  encodeRecord.shape = fontService.getIconFontKey(encodeRecord[attribute.name]);
158
141
  }
159
142
  });
160
-
161
143
  if (encodeRecord.shape === 'line' && arrow.enable) {
162
144
  // 只有在线图层且支持配置箭头的时候进行插入顶点的处理
163
145
  var coords = encodeRecord.coordinates;
164
146
  var arrowPoint = getArrowPoints(coords[0], coords[1]);
165
147
  encodeRecord.coordinates.splice(1, 0, arrowPoint, arrowPoint);
166
148
  }
167
-
168
149
  return encodeRecord;
169
- }); // 调整数据兼容 Amap2.0
170
-
171
- adjustData2Amap2Coordinates(mappedData, mapService, layer); // 调整数据兼容 SimpleCoordinates
150
+ });
151
+ // 调整数据兼容 Amap2.0
152
+ adjustData2Amap2Coordinates(mappedData, mapService, layer);
172
153
 
154
+ // 调整数据兼容 SimpleCoordinates
173
155
  adjustData2SimpleCoordinates(mappedData, mapService);
174
156
  return mappedData;
175
157
  }
176
-
177
158
  function calculateData(layer, fontService, mapService, styleAttributeService, data, options) {
178
159
  var source = new _l7Source.default(data, options);
179
160
  var attributes = styleAttributeService.getLayerStyleAttributes() || [];
@@ -1,15 +1,12 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.createMultiPassRenderer = createMultiPassRenderer;
9
8
  exports.normalizePasses = normalizePasses;
10
-
11
9
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
12
-
13
10
  /**
14
11
  * 'blurH' -> ['blurH', {}]
15
12
  */
@@ -18,43 +15,41 @@ function normalizePasses(passes) {
18
15
  if (typeof pass === 'string') {
19
16
  pass = [pass, {}];
20
17
  }
21
-
22
18
  return pass;
23
19
  });
24
20
  }
21
+
25
22
  /**
26
23
  * 默认添加 ClearPass、RenderPass
27
24
  * 以及 PostProcessing 中的最后一个 CopyPass
28
25
  */
29
-
30
-
31
26
  function createMultiPassRenderer(layer, passes, postProcessingPassFactory, normalPassFactory) {
32
27
  var multiPassRenderer = layer.multiPassRenderer;
33
-
34
28
  var _layer$getLayerConfig = layer.getLayerConfig(),
35
- enableTAA = _layer$getLayerConfig.enableTAA; // picking pass if enabled
29
+ enableTAA = _layer$getLayerConfig.enableTAA;
30
+
31
+ // picking pass if enabled
36
32
  // if (enablePicking) {
37
33
  // multiPassRenderer.add(normalPassFactory('pixelPicking'));
38
34
  // }
39
- // use TAA pass if enabled instead of render pass
40
-
41
35
 
36
+ // use TAA pass if enabled instead of render pass
42
37
  if (enableTAA) {
43
38
  multiPassRenderer.add(normalPassFactory('taa'));
44
39
  } else {
45
40
  // render all layers in this pass
46
41
  multiPassRenderer.add(normalPassFactory('render'));
47
- } // post processing
48
-
42
+ }
49
43
 
44
+ // post processing
50
45
  normalizePasses(passes).forEach(function (pass) {
51
46
  var _pass = (0, _slicedToArray2.default)(pass, 2),
52
- passName = _pass[0],
53
- initializationOptions = _pass[1];
54
-
47
+ passName = _pass[0],
48
+ initializationOptions = _pass[1];
55
49
  multiPassRenderer.add(postProcessingPassFactory(passName), initializationOptions);
56
- }); // 末尾为固定的 CopyPass
50
+ });
57
51
 
52
+ // 末尾为固定的 CopyPass
58
53
  multiPassRenderer.add(postProcessingPassFactory('copy'));
59
54
  return multiPassRenderer;
60
55
  }