@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
@@ -9,66 +9,50 @@ import { updateLayersConfig } from "../style/utils";
9
9
  export var Base = /*#__PURE__*/function () {
10
10
  function Base() {
11
11
  _classCallCheck(this, Base);
12
-
13
12
  _defineProperty(this, "tileCache", new Map());
14
-
15
13
  _defineProperty(this, "tileLayerCache", new Map());
16
14
  }
17
-
18
15
  _createClass(Base, [{
19
16
  key: "initTileLayers",
20
17
  value: function () {
21
18
  var _initTileLayers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(layers, tile) {
22
19
  var _this = this;
23
-
24
20
  return _regeneratorRuntime.wrap(function _callee2$(_context2) {
25
- while (1) {
26
- switch (_context2.prev = _context2.next) {
27
- case 0:
28
- return _context2.abrupt("return", Promise.all(layers.map( /*#__PURE__*/function () {
29
- var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(layer) {
30
- var container;
31
- return _regeneratorRuntime.wrap(function _callee$(_context) {
32
- while (1) {
33
- switch (_context.prev = _context.next) {
34
- case 0:
35
- container = createLayerContainer(_this.parent.sceneContainer);
36
- layer.setContainer(container, _this.parent.sceneContainer);
37
- _context.next = 4;
38
- return layer.init();
39
-
40
- case 4:
41
- _this.addChild(layer);
42
-
43
- tile.layerLoad();
44
-
45
- _this.render();
46
-
47
- case 7:
48
- case "end":
49
- return _context.stop();
50
- }
51
- }
52
- }, _callee);
53
- }));
54
-
55
- return function (_x3) {
56
- return _ref.apply(this, arguments);
57
- };
58
- }())));
59
-
60
- case 1:
61
- case "end":
62
- return _context2.stop();
63
- }
21
+ while (1) switch (_context2.prev = _context2.next) {
22
+ case 0:
23
+ return _context2.abrupt("return", Promise.all(layers.map( /*#__PURE__*/function () {
24
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(layer) {
25
+ var container;
26
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
27
+ while (1) switch (_context.prev = _context.next) {
28
+ case 0:
29
+ container = createLayerContainer(_this.parent.sceneContainer);
30
+ layer.setContainer(container, _this.parent.sceneContainer);
31
+ _context.next = 4;
32
+ return layer.init();
33
+ case 4:
34
+ _this.addChild(layer);
35
+ tile.layerLoad();
36
+ _this.render();
37
+ case 7:
38
+ case "end":
39
+ return _context.stop();
40
+ }
41
+ }, _callee);
42
+ }));
43
+ return function (_x3) {
44
+ return _ref.apply(this, arguments);
45
+ };
46
+ }())));
47
+ case 1:
48
+ case "end":
49
+ return _context2.stop();
64
50
  }
65
51
  }, _callee2);
66
52
  }));
67
-
68
53
  function initTileLayers(_x, _x2) {
69
54
  return _initTileLayers.apply(this, arguments);
70
55
  }
71
-
72
56
  return initTileLayers;
73
57
  }()
74
58
  }, {
@@ -80,55 +64,48 @@ export var Base = /*#__PURE__*/function () {
80
64
  key: "hasTile",
81
65
  value: function hasTile(tile) {
82
66
  return this.tileCache.has(tile.key);
83
- } // 添加图层
67
+ }
84
68
 
69
+ // 添加图层
85
70
  }, {
86
71
  key: "addTile",
87
72
  value: function () {
88
73
  var _addTile = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(tile) {
89
74
  var layerCollections;
90
75
  return _regeneratorRuntime.wrap(function _callee3$(_context3) {
91
- while (1) {
92
- switch (_context3.prev = _context3.next) {
93
- case 0:
94
- if (!this.hasTile(tile)) {
95
- _context3.next = 2;
96
- break;
97
- }
98
-
99
- return _context3.abrupt("return", {
100
- layers: []
101
- });
102
-
103
- case 2:
104
- // 存储当前 tile
105
- this.tileCache.set(tile.key, tile); // 创建 tile 对应的 layers
106
-
107
- layerCollections = this.tileFactory.createTile(tile, this.initOptions); // // 初始化图层
108
-
109
- _context3.next = 6;
110
- return this.initTileLayers(layerCollections.layers, tile);
111
-
112
- case 6:
113
- this.tileLayerCache.set(tile.key, layerCollections.layers); // const visible = tile.parent ? tile.parent.children.every(t=>this.tileLayerCache.has(t.key)) : true
114
- // tile.parent?.children.forEach((t)=>{
115
- // updateLayersConfig(this.getLayers(t),'visible',visible)
116
- // })
117
-
118
- return _context3.abrupt("return", layerCollections);
119
-
120
- case 8:
121
- case "end":
122
- return _context3.stop();
123
- }
76
+ while (1) switch (_context3.prev = _context3.next) {
77
+ case 0:
78
+ if (!this.hasTile(tile)) {
79
+ _context3.next = 2;
80
+ break;
81
+ }
82
+ return _context3.abrupt("return", {
83
+ layers: []
84
+ });
85
+ case 2:
86
+ // 存储当前 tile
87
+ this.tileCache.set(tile.key, tile);
88
+
89
+ // 创建 tile 对应的 layers
90
+ layerCollections = this.tileFactory.createTile(tile, this.initOptions); // // 初始化图层
91
+ _context3.next = 6;
92
+ return this.initTileLayers(layerCollections.layers, tile);
93
+ case 6:
94
+ this.tileLayerCache.set(tile.key, layerCollections.layers);
95
+ // const visible = tile.parent ? tile.parent.children.every(t=>this.tileLayerCache.has(t.key)) : true
96
+ // tile.parent?.children.forEach((t)=>{
97
+ // updateLayersConfig(this.getLayers(t),'visible',visible)
98
+ // })
99
+ return _context3.abrupt("return", layerCollections);
100
+ case 8:
101
+ case "end":
102
+ return _context3.stop();
124
103
  }
125
104
  }, _callee3, this);
126
105
  }));
127
-
128
106
  function addTile(_x4) {
129
107
  return _addTile.apply(this, arguments);
130
108
  }
131
-
132
109
  return addTile;
133
110
  }()
134
111
  }, {
@@ -148,7 +125,6 @@ export var Base = /*#__PURE__*/function () {
148
125
  key: "addChildren",
149
126
  value: function addChildren(layers) {
150
127
  var _this$children;
151
-
152
128
  (_this$children = this.children).push.apply(_this$children, _toConsumableArray(layers));
153
129
  }
154
130
  }, {
@@ -167,11 +143,9 @@ export var Base = /*#__PURE__*/function () {
167
143
  key: "removeChild",
168
144
  value: function removeChild(layer) {
169
145
  var layerIndex = this.children.indexOf(layer);
170
-
171
146
  if (layerIndex > -1) {
172
147
  this.children.splice(layerIndex, 1);
173
148
  }
174
-
175
149
  layer.destroy();
176
150
  }
177
151
  }, {
@@ -180,7 +154,6 @@ export var Base = /*#__PURE__*/function () {
180
154
  if (!tile) {
181
155
  return [];
182
156
  }
183
-
184
157
  return this.tileLayerCache.get(tile.key) || [];
185
158
  }
186
159
  }, {
@@ -205,7 +178,8 @@ export var Base = /*#__PURE__*/function () {
205
178
  }
206
179
  }, {
207
180
  key: "initTileFactory",
208
- value: function initTileFactory() {// this.tileFactory = new TileFactory({
181
+ value: function initTileFactory() {
182
+ // this.tileFactory = new TileFactory({
209
183
  // parent: this.parent,
210
184
  // mapService: this.mapService,
211
185
  // rendererService: this.rendererService,
@@ -226,11 +200,9 @@ export var Base = /*#__PURE__*/function () {
226
200
  key: "updateTileVisible",
227
201
  value: function updateTileVisible(tile, layerService) {
228
202
  var layers = this.getLayers(tile);
229
-
230
203
  if (layers.length === 0) {
231
204
  return;
232
205
  }
233
-
234
206
  if (tile.isVisible) {
235
207
  // 如果可见直接进行渲染,父级发
236
208
  updateLayersConfig(layers, 'visible', tile.isVisible);
@@ -243,16 +215,16 @@ export var Base = /*#__PURE__*/function () {
243
215
  // console.log(`${t.x}/${t.y}/${t.z}`)
244
216
  // })
245
217
  updateLayersConfig(layers, 'visible', tile.isVisible);
246
- } // this.listenLoad(tile, () => {
218
+ }
219
+
220
+ // this.listenLoad(tile, () => {
247
221
  // this.isTileAllLoad(tile) && updateLayersConfig(layers, 'visible', tile.isVisible);
248
222
  // })
249
-
250
223
  }
251
224
  }, {
252
225
  key: "listenLoad",
253
226
  value: function listenLoad(tile, callback) {
254
227
  var _tile$parent;
255
-
256
228
  tile.once('layerLoaded', function () {
257
229
  callback();
258
230
  });
@@ -271,7 +243,6 @@ export var Base = /*#__PURE__*/function () {
271
243
  if (tile.isLoad) {
272
244
  return true;
273
245
  }
274
-
275
246
  var isLoad = this.getLayers(tile).length === tile.loadedLayers;
276
247
  tile.isLoad = isLoad;
277
248
  return isLoad;
@@ -280,11 +251,9 @@ export var Base = /*#__PURE__*/function () {
280
251
  key: "isTileChildLoaded",
281
252
  value: function isTileChildLoaded(tile) {
282
253
  var _this2 = this;
283
-
284
254
  if (tile.isChildLoad) {
285
255
  return true;
286
256
  }
287
-
288
257
  var children = tile.children;
289
258
  var isLoad = children.filter(function (child) {
290
259
  return _this2.isTileLoaded(child);
@@ -296,7 +265,6 @@ export var Base = /*#__PURE__*/function () {
296
265
  key: "isTileParentLoaded",
297
266
  value: function isTileParentLoaded(tile) {
298
267
  var parent = tile.parent;
299
-
300
268
  if (!parent) {
301
269
  return true;
302
270
  } else {
@@ -318,6 +286,5 @@ export var Base = /*#__PURE__*/function () {
318
286
  this.tileLayerCache.clear();
319
287
  }
320
288
  }]);
321
-
322
289
  return Base;
323
290
  }();
@@ -9,22 +9,18 @@ export var TileLayerService = /*#__PURE__*/function () {
9
9
  /**
10
10
  * tileResource 用于存储瓦片的全局资源
11
11
  */
12
+
12
13
  function TileLayerService(_ref) {
13
14
  var rendererService = _ref.rendererService,
14
- layerService = _ref.layerService,
15
- parent = _ref.parent;
16
-
15
+ layerService = _ref.layerService,
16
+ parent = _ref.parent;
17
17
  _classCallCheck(this, TileLayerService);
18
-
19
18
  _defineProperty(this, "tileResource", new Map());
20
-
21
19
  _defineProperty(this, "layerTiles", []);
22
-
23
20
  this.rendererService = rendererService;
24
21
  this.layerService = layerService;
25
22
  this.parent = parent;
26
23
  }
27
-
28
24
  _createClass(TileLayerService, [{
29
25
  key: "tiles",
30
26
  get: function get() {
@@ -64,7 +60,6 @@ export var TileLayerService = /*#__PURE__*/function () {
64
60
  return t.key === tileKey;
65
61
  });
66
62
  var tile = this.layerTiles.splice(index, 1);
67
-
68
63
  if (tile[0]) {
69
64
  tile[0].destroy();
70
65
  }
@@ -72,7 +67,8 @@ export var TileLayerService = /*#__PURE__*/function () {
72
67
  }, {
73
68
  key: "updateTileVisible",
74
69
  value: function updateTileVisible(sourceTile) {
75
- var tile = this.getTile(sourceTile.key); // if(sourceTile.isVisible) {
70
+ var tile = this.getTile(sourceTile.key);
71
+ // if(sourceTile.isVisible) {
76
72
  // // 不可见 => 可见 兄弟节点加载完成
77
73
  // if(sourceTile.parent) {
78
74
  // const flag = this.isChildrenLoaded(sourceTile.parent)
@@ -80,6 +76,7 @@ export var TileLayerService = /*#__PURE__*/function () {
80
76
  // } else {
81
77
  // tile?.updateVisible(true);
82
78
  // }
79
+
83
80
  // } else {
84
81
  // // 可见 => 不可见 兄弟节点加载完成
85
82
  // if(sourceTile.parent) {
@@ -89,8 +86,8 @@ export var TileLayerService = /*#__PURE__*/function () {
89
86
  // tile?.updateVisible(false);
90
87
  // }
91
88
  // }
92
-
93
- tile === null || tile === void 0 ? void 0 : tile.updateVisible(sourceTile.isVisible); // if (sourceTile.isVisible) {
89
+ tile === null || tile === void 0 ? void 0 : tile.updateVisible(sourceTile.isVisible);
90
+ // if (sourceTile.isVisible) {
94
91
  // tile?.updateVisible(sourceTile.isVisible);
95
92
  // } else {
96
93
  // this.removeTile(sourceTile.key);
@@ -100,34 +97,26 @@ export var TileLayerService = /*#__PURE__*/function () {
100
97
  key: "isParentLoaded",
101
98
  value: function isParentLoaded(sourceTile) {
102
99
  var parentTile = sourceTile.parent;
103
-
104
100
  if (!parentTile) {
105
101
  return true;
106
102
  }
107
-
108
103
  var tile = this.getTile(parentTile === null || parentTile === void 0 ? void 0 : parentTile.key);
109
-
110
104
  if (tile !== null && tile !== void 0 && tile.isLoaded) {
111
105
  // 递归父级
112
106
  return true;
113
107
  }
114
-
115
108
  return false;
116
109
  }
117
110
  }, {
118
111
  key: "isChildrenLoaded",
119
112
  value: function isChildrenLoaded(sourceTile) {
120
113
  var _this = this;
121
-
122
114
  var childrenTile = sourceTile === null || sourceTile === void 0 ? void 0 : sourceTile.children;
123
-
124
115
  if (childrenTile.length === 0) {
125
116
  return true;
126
117
  }
127
-
128
118
  return childrenTile.some(function (tile) {
129
119
  var tileLayer = _this.getTile(tile === null || tile === void 0 ? void 0 : tile.key);
130
-
131
120
  return (tileLayer === null || tileLayer === void 0 ? void 0 : tileLayer.isLoaded) === false;
132
121
  });
133
122
  }
@@ -136,49 +125,39 @@ export var TileLayerService = /*#__PURE__*/function () {
136
125
  value: function () {
137
126
  var _render = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
138
127
  var _this2 = this;
139
-
140
128
  var layers, renders;
141
129
  return _regeneratorRuntime.wrap(function _callee2$(_context2) {
142
- while (1) {
143
- switch (_context2.prev = _context2.next) {
144
- case 0:
145
- layers = this.getRenderLayers();
146
- renders = layers.map( /*#__PURE__*/function () {
147
- var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(layer) {
148
- return _regeneratorRuntime.wrap(function _callee$(_context) {
149
- while (1) {
150
- switch (_context.prev = _context.next) {
151
- case 0:
152
- _context.next = 2;
153
- return _this2.layerService.renderTileLayer(layer);
154
-
155
- case 2:
156
- case "end":
157
- return _context.stop();
158
- }
159
- }
160
- }, _callee);
161
- }));
162
-
163
- return function (_x) {
164
- return _ref2.apply(this, arguments);
165
- };
166
- }());
167
- _context2.next = 4;
168
- return Promise.all(renders);
169
-
170
- case 4:
171
- case "end":
172
- return _context2.stop();
173
- }
130
+ while (1) switch (_context2.prev = _context2.next) {
131
+ case 0:
132
+ layers = this.getRenderLayers();
133
+ renders = layers.map( /*#__PURE__*/function () {
134
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(layer) {
135
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
136
+ while (1) switch (_context.prev = _context.next) {
137
+ case 0:
138
+ _context.next = 2;
139
+ return _this2.layerService.renderTileLayer(layer);
140
+ case 2:
141
+ case "end":
142
+ return _context.stop();
143
+ }
144
+ }, _callee);
145
+ }));
146
+ return function (_x) {
147
+ return _ref2.apply(this, arguments);
148
+ };
149
+ }());
150
+ _context2.next = 4;
151
+ return Promise.all(renders);
152
+ case 4:
153
+ case "end":
154
+ return _context2.stop();
174
155
  }
175
156
  }, _callee2, this);
176
157
  }));
177
-
178
158
  function render() {
179
159
  return _render.apply(this, arguments);
180
160
  }
181
-
182
161
  return render;
183
162
  }()
184
163
  }, {
@@ -219,6 +198,5 @@ export var TileLayerService = /*#__PURE__*/function () {
219
198
  this.tileResource.clear();
220
199
  }
221
200
  }]);
222
-
223
201
  return TileLayerService;
224
202
  }();
@@ -11,25 +11,20 @@ var ACTIVE = 'active';
11
11
  export var TilePickService = /*#__PURE__*/function () {
12
12
  function TilePickService(_ref) {
13
13
  var layerService = _ref.layerService,
14
- tileLayerService = _ref.tileLayerService,
15
- parent = _ref.parent;
16
-
14
+ tileLayerService = _ref.tileLayerService,
15
+ parent = _ref.parent;
17
16
  _classCallCheck(this, TilePickService);
18
-
19
17
  _defineProperty(this, "tilePickID", new Map());
20
-
21
18
  this.layerService = layerService;
22
19
  this.tileLayerService = tileLayerService;
23
20
  this.parent = parent;
24
21
  this.tileSourceService = new TileSourceService();
25
22
  }
26
-
27
23
  _createClass(TilePickService, [{
28
24
  key: "pickRender",
29
25
  value: function pickRender(target) {
30
26
  // 一个 TileLayer 有多个 Tile,但是会同时触发事件的只有一个 Tile
31
27
  var tile = this.tileLayerService.getVisibleTileBylngLat(target.lngLat);
32
-
33
28
  if (tile) {
34
29
  // TODO 多图层拾取
35
30
  var pickLayer = tile.getMainLayer();
@@ -41,18 +36,14 @@ export var TilePickService = /*#__PURE__*/function () {
41
36
  value: function pick(layer, target) {
42
37
  var container = this.parent.getContainer();
43
38
  var pickingService = container.get(TYPES.IPickingService);
44
-
45
39
  if (layer.type === 'RasterLayer') {
46
40
  var tile = this.tileLayerService.getVisibleTileBylngLat(target.lngLat);
47
-
48
41
  if (tile && tile.getMainLayer() !== undefined) {
49
42
  var pickLayer = tile.getMainLayer();
50
43
  return pickLayer.layerPickService.pickRasterLayer(pickLayer, target, this.parent);
51
44
  }
52
-
53
45
  return false;
54
46
  }
55
-
56
47
  this.pickRender(target);
57
48
  return pickingService.pickFromPickingFBO(layer, target);
58
49
  }
@@ -61,10 +52,9 @@ export var TilePickService = /*#__PURE__*/function () {
61
52
  value: function selectFeature(pickedColors) {
62
53
  // @ts-ignore
63
54
  var _pickedColors = _slicedToArray(pickedColors, 3),
64
- r = _pickedColors[0],
65
- g = _pickedColors[1],
66
- b = _pickedColors[2];
67
-
55
+ r = _pickedColors[0],
56
+ g = _pickedColors[1],
57
+ b = _pickedColors[2];
68
58
  var id = this.color2PickId(r, g, b);
69
59
  this.tilePickID.set(SELECT, id);
70
60
  this.updateHighLight(r, g, b, SELECT);
@@ -74,10 +64,9 @@ export var TilePickService = /*#__PURE__*/function () {
74
64
  value: function highlightPickedFeature(pickedColors) {
75
65
  // @ts-ignore
76
66
  var _pickedColors2 = _slicedToArray(pickedColors, 3),
77
- r = _pickedColors2[0],
78
- g = _pickedColors2[1],
79
- b = _pickedColors2[2];
80
-
67
+ r = _pickedColors2[0],
68
+ g = _pickedColors2[1],
69
+ b = _pickedColors2[2];
81
70
  var id = this.color2PickId(r, g, b);
82
71
  this.tilePickID.set(ACTIVE, id);
83
72
  this.updateHighLight(r, g, b, ACTIVE);
@@ -87,12 +76,10 @@ export var TilePickService = /*#__PURE__*/function () {
87
76
  value: function updateHighLight(r, g, b, type) {
88
77
  this.tileLayerService.tiles.map(function (tile) {
89
78
  var layer = tile.getMainLayer();
90
-
91
79
  switch (type) {
92
80
  case SELECT:
93
81
  layer === null || layer === void 0 ? void 0 : layer.hooks.beforeSelect.call([r, g, b]);
94
82
  break;
95
-
96
83
  case ACTIVE:
97
84
  layer === null || layer === void 0 ? void 0 : layer.hooks.beforeHighlight.call([r, g, b]);
98
85
  break;
@@ -104,25 +91,21 @@ export var TilePickService = /*#__PURE__*/function () {
104
91
  value: function setPickState() {
105
92
  var selectColor = this.tilePickID.get(SELECT);
106
93
  var activeColor = this.tilePickID.get(ACTIVE);
107
-
108
94
  if (selectColor) {
109
95
  var _this$pickId2Color = this.pickId2Color(selectColor),
110
- _this$pickId2Color2 = _slicedToArray(_this$pickId2Color, 3),
111
- r = _this$pickId2Color2[0],
112
- g = _this$pickId2Color2[1],
113
- b = _this$pickId2Color2[2];
114
-
96
+ _this$pickId2Color2 = _slicedToArray(_this$pickId2Color, 3),
97
+ r = _this$pickId2Color2[0],
98
+ g = _this$pickId2Color2[1],
99
+ b = _this$pickId2Color2[2];
115
100
  this.updateHighLight(r, g, b, SELECT);
116
101
  return;
117
102
  }
118
-
119
103
  if (activeColor) {
120
104
  var _this$pickId2Color3 = this.pickId2Color(activeColor),
121
- _this$pickId2Color4 = _slicedToArray(_this$pickId2Color3, 3),
122
- _r = _this$pickId2Color4[0],
123
- _g = _this$pickId2Color4[1],
124
- _b = _this$pickId2Color4[2];
125
-
105
+ _this$pickId2Color4 = _slicedToArray(_this$pickId2Color3, 3),
106
+ _r = _this$pickId2Color4[0],
107
+ _g = _this$pickId2Color4[1],
108
+ _b = _this$pickId2Color4[2];
126
109
  this.updateHighLight(_r, _g, _b, ACTIVE);
127
110
  return;
128
111
  }
@@ -137,33 +120,36 @@ export var TilePickService = /*#__PURE__*/function () {
137
120
  value: function pickId2Color(str) {
138
121
  return encodePickingColor(str);
139
122
  }
140
- /** 从瓦片中根据数据 */
141
123
 
124
+ /** 从瓦片中根据数据 */
142
125
  }, {
143
126
  key: "getFeatureById",
144
127
  value: function getFeatureById(pickedFeatureIdx) {
145
128
  // 提取当前可见瓦片
146
129
  var tiles = this.tileLayerService.getTiles().filter(function (tile) {
147
130
  return tile.visible;
148
- }); // 提取当前可见瓦片中匹配 ID 的 feature 列表
149
-
131
+ });
132
+ // 提取当前可见瓦片中匹配 ID 的 feature 列表
150
133
  var features = [];
151
134
  tiles.forEach(function (tile) {
152
135
  features.push.apply(features, _toConsumableArray(tile.getFeatureById(pickedFeatureIdx)));
153
- }); // 将 feature 列表合并后返回
136
+ });
137
+
138
+ // 将 feature 列表合并后返回
154
139
  // 统一返回成 polygon 的格式 点、线、面可以通用
140
+
155
141
  // const data = this.tileSourceService.getCombineFeature(features);
156
142
 
157
143
  return features;
158
- } // Tip: for interface define
159
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
144
+ }
160
145
 
146
+ // Tip: for interface define
147
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
161
148
  }, {
162
149
  key: "pickRasterLayer",
163
150
  value: function pickRasterLayer(layer, target, parent) {
164
151
  return false;
165
152
  }
166
153
  }]);
167
-
168
154
  return TilePickService;
169
155
  }();
@@ -3,37 +3,33 @@ import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
3
3
  import _createClass from "@babel/runtime/helpers/esm/createClass";
4
4
  import * as turf from '@turf/helpers';
5
5
  import union from '@turf/union';
6
+
6
7
  /**
7
8
  * 专门处理 Tile 数据相关
8
9
  */
9
-
10
10
  export var TileSourceService = /*#__PURE__*/function () {
11
11
  function TileSourceService() {
12
12
  _classCallCheck(this, TileSourceService);
13
13
  }
14
-
15
14
  _createClass(TileSourceService, [{
16
15
  key: "getCombineFeature",
17
16
  value: function getCombineFeature(features) {
18
17
  var p = null;
19
18
  var properties = features[0];
20
19
  features.map(function (feature) {
21
- var polygon = turf.polygon(feature.coordinates); // tslint:disable-next-line: prefer-conditional-expression
22
-
20
+ var polygon = turf.polygon(feature.coordinates);
21
+ // tslint:disable-next-line: prefer-conditional-expression
23
22
  if (p === null) {
24
23
  p = polygon;
25
24
  } else {
26
25
  p = union(p, polygon);
27
26
  }
28
27
  });
29
-
30
28
  if (properties) {
31
29
  p.properties = _objectSpread({}, properties);
32
30
  }
33
-
34
31
  return p;
35
32
  }
36
33
  }]);
37
-
38
34
  return TileSourceService;
39
35
  }();