@antv/l7-layers 2.13.4 → 2.13.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.
@@ -22,7 +22,7 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
22
22
 
23
23
  import { AttributeType, gl } from '@antv/l7-core';
24
24
  import { boundsContains, calculateCentroid, getMask, padBounds } from '@antv/l7-utils';
25
- import { isNumber } from 'lodash';
25
+ import { isEqual, isNumber } from 'lodash';
26
26
  import BaseModel from "../../core/BaseModel";
27
27
  import CollisionIndex from "../../utils/collision-index";
28
28
  import { getGlyphQuads, shapeText } from "../../utils/symbol-layout";
@@ -123,11 +123,6 @@ var TextModel = /*#__PURE__*/function (_BaseModel) {
123
123
  stroke = _ref2$stroke === void 0 ? '#fff' : _ref2$stroke,
124
124
  _ref2$strokeWidth = _ref2.strokeWidth,
125
125
  strokeWidth = _ref2$strokeWidth === void 0 ? 0 : _ref2$strokeWidth,
126
- _ref2$textAnchor = _ref2.textAnchor,
127
- textAnchor = _ref2$textAnchor === void 0 ? 'center' : _ref2$textAnchor,
128
- textOffset = _ref2.textOffset,
129
- _ref2$textAllowOverla = _ref2.textAllowOverlap,
130
- textAllowOverlap = _ref2$textAllowOverla === void 0 ? false : _ref2$textAllowOverla,
131
126
  _ref2$halo = _ref2.halo,
132
127
  halo = _ref2$halo === void 0 ? 0.5 : _ref2$halo,
133
128
  _ref2$gamma = _ref2.gamma,
@@ -144,11 +139,7 @@ var TextModel = /*#__PURE__*/function (_BaseModel) {
144
139
  this.textCount = Object.keys(mapping).length;
145
140
  }
146
141
 
147
- this.preTextStyle = {
148
- textAnchor: textAnchor,
149
- textAllowOverlap: textAllowOverlap,
150
- textOffset: textOffset
151
- };
142
+ this.preTextStyle = this.getTextStyle();
152
143
 
153
144
  if (this.dataTextureTest && this.dataTextureNeedUpdate({
154
145
  opacity: opacity,
@@ -204,8 +195,6 @@ var TextModel = /*#__PURE__*/function (_BaseModel) {
204
195
  key: "initModels",
205
196
  value: function () {
206
197
  var _initModels = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
207
- var _ref3, _ref3$textAnchor, textAnchor, _ref3$textAllowOverla, textAllowOverlap, textOffset;
208
-
209
198
  return _regeneratorRuntime.wrap(function _callee2$(_context2) {
210
199
  while (1) {
211
200
  switch (_context2.prev = _context2.next) {
@@ -213,19 +202,10 @@ var TextModel = /*#__PURE__*/function (_BaseModel) {
213
202
  // 绑定事件
214
203
  this.bindEvent();
215
204
  this.extent = this.textExtent();
216
- _ref3 = this.layer.getLayerConfig(), _ref3$textAnchor = _ref3.textAnchor, textAnchor = _ref3$textAnchor === void 0 ? 'center' : _ref3$textAnchor, _ref3$textAllowOverla = _ref3.textAllowOverlap, textAllowOverlap = _ref3$textAllowOverla === void 0 ? true : _ref3$textAllowOverla, textOffset = _ref3.textOffset;
217
- this.preTextStyle = {
218
- textAnchor: textAnchor,
219
- textAllowOverlap: textAllowOverlap,
220
- textOffset: textOffset
221
- };
222
- _context2.next = 6;
223
- return this.buildModels();
224
-
225
- case 6:
226
- return _context2.abrupt("return", _context2.sent);
205
+ this.preTextStyle = this.getTextStyle();
206
+ return _context2.abrupt("return", this.buildModels());
227
207
 
228
- case 7:
208
+ case 4:
229
209
  case "end":
230
210
  return _context2.stop();
231
211
  }
@@ -243,13 +223,13 @@ var TextModel = /*#__PURE__*/function (_BaseModel) {
243
223
  key: "buildModels",
244
224
  value: function () {
245
225
  var _buildModels = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
246
- var _ref4, _ref4$mask, mask, _ref4$maskInside, maskInside, _ref4$textAllowOverla, textAllowOverlap, model;
226
+ var _ref3, _ref3$mask, mask, _ref3$maskInside, maskInside, _ref3$textAllowOverla, textAllowOverlap, model;
247
227
 
248
228
  return _regeneratorRuntime.wrap(function _callee3$(_context3) {
249
229
  while (1) {
250
230
  switch (_context3.prev = _context3.next) {
251
231
  case 0:
252
- _ref4 = this.layer.getLayerConfig(), _ref4$mask = _ref4.mask, mask = _ref4$mask === void 0 ? false : _ref4$mask, _ref4$maskInside = _ref4.maskInside, maskInside = _ref4$maskInside === void 0 ? true : _ref4$maskInside, _ref4$textAllowOverla = _ref4.textAllowOverlap, textAllowOverlap = _ref4$textAllowOverla === void 0 ? false : _ref4$textAllowOverla; // this.mapping(); 重复调用
232
+ _ref3 = this.layer.getLayerConfig(), _ref3$mask = _ref3.mask, mask = _ref3$mask === void 0 ? false : _ref3$mask, _ref3$maskInside = _ref3.maskInside, maskInside = _ref3$maskInside === void 0 ? true : _ref3$maskInside, _ref3$textAllowOverla = _ref3.textAllowOverlap, textAllowOverlap = _ref3$textAllowOverla === void 0 ? false : _ref3$textAllowOverla; // this.mapping(); 重复调用
253
233
 
254
234
  this.initGlyph(); //
255
235
 
@@ -289,60 +269,65 @@ var TextModel = /*#__PURE__*/function (_BaseModel) {
289
269
  }
290
270
 
291
271
  return buildModels;
292
- }()
272
+ }() // 需要更新的场景
273
+ // 1. 文本偏移量发生改变
274
+ // 2. 文本锚点发生改变
275
+ // 3. 文本允许重叠发生改变
276
+ // 4. 文本字体发生改变
277
+ // 5. 文本字体粗细发生改变
278
+
293
279
  }, {
294
280
  key: "needUpdate",
295
281
  value: function () {
296
282
  var _needUpdate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
297
- var _ref5, _ref5$textAllowOverla, textAllowOverlap, _ref5$textAnchor, textAnchor, textOffset, data, zoom, extent, flag;
283
+ var _ref4, _ref4$textAllowOverla, textAllowOverlap, _ref4$textAnchor, textAnchor, textOffset, padding, fontFamily, fontWeight, zoom, extent, flag;
298
284
 
299
285
  return _regeneratorRuntime.wrap(function _callee4$(_context4) {
300
286
  while (1) {
301
287
  switch (_context4.prev = _context4.next) {
302
288
  case 0:
303
- _ref5 = this.layer.getLayerConfig(), _ref5$textAllowOverla = _ref5.textAllowOverlap, textAllowOverlap = _ref5$textAllowOverla === void 0 ? false : _ref5$textAllowOverla, _ref5$textAnchor = _ref5.textAnchor, textAnchor = _ref5$textAnchor === void 0 ? 'center' : _ref5$textAnchor, textOffset = _ref5.textOffset;
304
- data = this.layer.getEncodedData();
289
+ _ref4 = this.getTextStyle(), _ref4$textAllowOverla = _ref4.textAllowOverlap, textAllowOverlap = _ref4$textAllowOverla === void 0 ? false : _ref4$textAllowOverla, _ref4$textAnchor = _ref4.textAnchor, textAnchor = _ref4$textAnchor === void 0 ? 'center' : _ref4$textAnchor, textOffset = _ref4.textOffset, padding = _ref4.padding, fontFamily = _ref4.fontFamily, fontWeight = _ref4.fontWeight;
305
290
 
306
- if (!(JSON.stringify(textOffset) !== JSON.stringify(this.preTextStyle.textOffset) || textAnchor !== this.preTextStyle.textAnchor)) {
307
- _context4.next = 6;
291
+ if (!(!isEqual(padding, this.preTextStyle.padding) || !isEqual(textOffset, this.preTextStyle.textOffset) || !isEqual(textAnchor, this.preTextStyle.textAnchor) || !isEqual(fontFamily, this.preTextStyle.fontFamily) || !isEqual(fontWeight, this.preTextStyle.fontWeight))) {
292
+ _context4.next = 5;
308
293
  break;
309
294
  }
310
295
 
311
- _context4.next = 5;
296
+ _context4.next = 4;
312
297
  return this.mapping();
313
298
 
314
- case 5:
299
+ case 4:
315
300
  return _context4.abrupt("return", true);
316
301
 
317
- case 6:
318
- if (!(data.length < 5 || textAllowOverlap)) {
319
- _context4.next = 8;
302
+ case 5:
303
+ if (!textAllowOverlap) {
304
+ _context4.next = 7;
320
305
  break;
321
306
  }
322
307
 
323
308
  return _context4.abrupt("return", false);
324
309
 
325
- case 8:
310
+ case 7:
326
311
  // textAllowOverlap 发生改变
327
312
  zoom = this.mapService.getZoom();
328
313
  extent = this.mapService.getBounds();
329
314
  flag = boundsContains(this.extent, extent); // 文本不能压盖则进行过滤
330
315
 
331
- if (!(Math.abs(this.currentZoom - zoom) > 1 || !flag || textAllowOverlap !== this.preTextStyle.textAllowOverlap)) {
332
- _context4.next = 15;
316
+ if (!(Math.abs(this.currentZoom - zoom) > 0.5 || !flag || textAllowOverlap !== this.preTextStyle.textAllowOverlap)) {
317
+ _context4.next = 14;
333
318
  break;
334
319
  }
335
320
 
336
- _context4.next = 14;
321
+ _context4.next = 13;
337
322
  return this.reBuildModel();
338
323
 
339
- case 14:
324
+ case 13:
340
325
  return _context4.abrupt("return", true);
341
326
 
342
- case 15:
327
+ case 14:
343
328
  return _context4.abrupt("return", false);
344
329
 
345
- case 16:
330
+ case 15:
346
331
  case "end":
347
332
  return _context4.stop();
348
333
  }
@@ -462,11 +447,9 @@ var TextModel = /*#__PURE__*/function (_BaseModel) {
462
447
  }, {
463
448
  key: "initTextFont",
464
449
  value: function initTextFont() {
465
- var _ref6 = this.layer.getLayerConfig(),
466
- _ref6$fontWeight = _ref6.fontWeight,
467
- fontWeight = _ref6$fontWeight === void 0 ? '400' : _ref6$fontWeight,
468
- _ref6$fontFamily = _ref6.fontFamily,
469
- fontFamily = _ref6$fontFamily === void 0 ? 'sans-serif' : _ref6$fontFamily;
450
+ var _this$getTextStyle = this.getTextStyle(),
451
+ fontWeight = _this$getTextStyle.fontWeight,
452
+ fontFamily = _this$getTextStyle.fontFamily;
470
453
 
471
454
  var data = this.layer.getEncodedData();
472
455
  var characterSet = [];
@@ -507,11 +490,9 @@ var TextModel = /*#__PURE__*/function (_BaseModel) {
507
490
  }, {
508
491
  key: "initIconFontTex",
509
492
  value: function initIconFontTex() {
510
- var _ref7 = this.layer.getLayerConfig(),
511
- _ref7$fontWeight = _ref7.fontWeight,
512
- fontWeight = _ref7$fontWeight === void 0 ? '400' : _ref7$fontWeight,
513
- _ref7$fontFamily = _ref7.fontFamily,
514
- fontFamily = _ref7$fontFamily === void 0 ? 'sans-serif' : _ref7$fontFamily;
493
+ var _this$getTextStyle2 = this.getTextStyle(),
494
+ fontWeight = _this$getTextStyle2.fontWeight,
495
+ fontFamily = _this$getTextStyle2.fontFamily;
515
496
 
516
497
  var data = this.layer.getEncodedData();
517
498
  var characterSet = [];
@@ -531,6 +512,44 @@ var TextModel = /*#__PURE__*/function (_BaseModel) {
531
512
  iconfont: true
532
513
  });
533
514
  }
515
+ }, {
516
+ key: "getTextStyle",
517
+ value: function getTextStyle() {
518
+ var _ref5 = this.layer.getLayerConfig(),
519
+ _ref5$fontWeight = _ref5.fontWeight,
520
+ fontWeight = _ref5$fontWeight === void 0 ? '400' : _ref5$fontWeight,
521
+ _ref5$fontFamily = _ref5.fontFamily,
522
+ fontFamily = _ref5$fontFamily === void 0 ? 'sans-serif' : _ref5$fontFamily,
523
+ _ref5$textAllowOverla = _ref5.textAllowOverlap,
524
+ textAllowOverlap = _ref5$textAllowOverla === void 0 ? false : _ref5$textAllowOverla,
525
+ _ref5$padding = _ref5.padding,
526
+ padding = _ref5$padding === void 0 ? [0, 0] : _ref5$padding,
527
+ _ref5$textAnchor = _ref5.textAnchor,
528
+ textAnchor = _ref5$textAnchor === void 0 ? 'center' : _ref5$textAnchor,
529
+ _ref5$textOffset = _ref5.textOffset,
530
+ textOffset = _ref5$textOffset === void 0 ? [0, 0] : _ref5$textOffset,
531
+ _ref5$opacity = _ref5.opacity,
532
+ opacity = _ref5$opacity === void 0 ? 1 : _ref5$opacity,
533
+ _ref5$strokeOpacity = _ref5.strokeOpacity,
534
+ strokeOpacity = _ref5$strokeOpacity === void 0 ? 1 : _ref5$strokeOpacity,
535
+ _ref5$strokeWidth = _ref5.strokeWidth,
536
+ strokeWidth = _ref5$strokeWidth === void 0 ? 0 : _ref5$strokeWidth,
537
+ _ref5$stroke = _ref5.stroke,
538
+ stroke = _ref5$stroke === void 0 ? '#000' : _ref5$stroke;
539
+
540
+ return {
541
+ fontWeight: fontWeight,
542
+ fontFamily: fontFamily,
543
+ textAllowOverlap: textAllowOverlap,
544
+ padding: padding,
545
+ textAnchor: textAnchor,
546
+ textOffset: textOffset,
547
+ opacity: opacity,
548
+ strokeOpacity: strokeOpacity,
549
+ strokeWidth: strokeWidth,
550
+ stroke: stroke
551
+ };
552
+ }
534
553
  /**
535
554
  * 生成文字布局(对照文字纹理字典提取对应文字的位置很好信息)
536
555
  */
@@ -543,12 +562,12 @@ var TextModel = /*#__PURE__*/function (_BaseModel) {
543
562
  // 更新文字布局
544
563
  var mapping = this.fontService.mapping;
545
564
 
546
- var _ref8 = this.layer.getLayerConfig(),
547
- _ref8$spacing = _ref8.spacing,
548
- spacing = _ref8$spacing === void 0 ? 2 : _ref8$spacing,
549
- _ref8$textAnchor = _ref8.textAnchor,
550
- textAnchor = _ref8$textAnchor === void 0 ? 'center' : _ref8$textAnchor,
551
- textOffset = _ref8.textOffset;
565
+ var _ref6 = this.layer.getLayerConfig(),
566
+ _ref6$spacing = _ref6.spacing,
567
+ spacing = _ref6$spacing === void 0 ? 2 : _ref6$spacing,
568
+ _ref6$textAnchor = _ref6.textAnchor,
569
+ textAnchor = _ref6$textAnchor === void 0 ? 'center' : _ref6$textAnchor,
570
+ textOffset = _ref6.textOffset;
552
571
 
553
572
  var data = this.layer.getEncodedData();
554
573
  this.glyphInfo = data.map(function (feature) {
@@ -583,15 +602,14 @@ var TextModel = /*#__PURE__*/function (_BaseModel) {
583
602
  value: function filterGlyphs() {
584
603
  var _this3 = this;
585
604
 
586
- var _ref9 = this.layer.getLayerConfig(),
587
- _ref9$padding = _ref9.padding,
588
- padding = _ref9$padding === void 0 ? [0, 0] : _ref9$padding,
589
- _ref9$textAllowOverla = _ref9.textAllowOverlap,
590
- textAllowOverlap = _ref9$textAllowOverla === void 0 ? false : _ref9$textAllowOverla;
605
+ var _ref7 = this.layer.getLayerConfig(),
606
+ _ref7$padding = _ref7.padding,
607
+ padding = _ref7$padding === void 0 ? [0, 0] : _ref7$padding,
608
+ _ref7$textAllowOverla = _ref7.textAllowOverlap,
609
+ textAllowOverlap = _ref7$textAllowOverla === void 0 ? false : _ref7$textAllowOverla;
591
610
 
592
611
  if (textAllowOverlap) {
593
612
  // 如果允许文本覆盖
594
- // this.layer.setEncodedData(this.glyphInfo);
595
613
  return;
596
614
  }
597
615
 
@@ -650,8 +668,7 @@ var TextModel = /*#__PURE__*/function (_BaseModel) {
650
668
  iconfont = _this$layer$getLayerC2 === void 0 ? false : _this$layer$getLayerC2; // 1.生成文字纹理(或是生成 iconfont)
651
669
 
652
670
 
653
- iconfont ? this.initIconFontTex() : this.initTextFont(); // this.initTextFont();
654
- // 2.生成文字布局
671
+ iconfont ? this.initIconFontTex() : this.initTextFont(); // 2.生成文字布局
655
672
 
656
673
  this.generateGlyphLayout(iconfont);
657
674
  }
@@ -682,13 +699,13 @@ var TextModel = /*#__PURE__*/function (_BaseModel) {
682
699
  key: "reBuildModel",
683
700
  value: function () {
684
701
  var _reBuildModel = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5() {
685
- var _ref10, _ref10$mask, mask, _ref10$maskInside, maskInside, model;
702
+ var _ref8, _ref8$mask, mask, _ref8$maskInside, maskInside, model;
686
703
 
687
704
  return _regeneratorRuntime.wrap(function _callee5$(_context5) {
688
705
  while (1) {
689
706
  switch (_context5.prev = _context5.next) {
690
707
  case 0:
691
- _ref10 = this.layer.getLayerConfig(), _ref10$mask = _ref10.mask, mask = _ref10$mask === void 0 ? false : _ref10$mask, _ref10$maskInside = _ref10.maskInside, maskInside = _ref10$maskInside === void 0 ? true : _ref10$maskInside;
708
+ _ref8 = this.layer.getLayerConfig(), _ref8$mask = _ref8.mask, mask = _ref8$mask === void 0 ? false : _ref8$mask, _ref8$maskInside = _ref8.maskInside, maskInside = _ref8$maskInside === void 0 ? true : _ref8$maskInside;
692
709
  this.filterGlyphs();
693
710
  _context5.next = 4;
694
711
  return this.layer.buildLayerModel({
@@ -1,4 +1,4 @@
1
- import { ILayerService, ITilePickService, IInteractionTarget, ILayer } from '@antv/l7-core';
1
+ import { IInteractionTarget, ILayer, ILayerService, ITilePickService } from '@antv/l7-core';
2
2
  import { TileLayerService } from './TileLayerService';
3
3
  export interface ITilePickServiceOptions {
4
4
  layerService: ILayerService;
@@ -11,7 +11,7 @@ export declare class TilePickService implements ITilePickService {
11
11
  private tileSourceService;
12
12
  private parent;
13
13
  private tilePickID;
14
- constructor({ layerService, tileLayerService, parent }: ITilePickServiceOptions);
14
+ constructor({ layerService, tileLayerService, parent, }: ITilePickServiceOptions);
15
15
  pickRender(target: IInteractionTarget): void;
16
16
  pick(layer: ILayer, target: IInteractionTarget): boolean;
17
17
  selectFeature(pickedColors: Uint8Array | undefined): void;
@@ -80,6 +80,7 @@ export default abstract class Tile implements ITile {
80
80
  animate?: boolean | undefined;
81
81
  pickBufferScale?: number | undefined;
82
82
  stencil?: boolean | undefined;
83
+ debug?: boolean | undefined;
83
84
  antialias?: boolean | undefined;
84
85
  preserveDrawingBuffer?: boolean | undefined;
85
86
  };
@@ -11,9 +11,9 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
11
11
 
12
12
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
13
13
 
14
+ import MaskLayer from "../../mask";
14
15
  import Tile from "./Tile";
15
16
  import { getTileLayer } from "./util";
16
- import MaskLayer from "../../mask";
17
17
 
18
18
  var VectorTile = /*#__PURE__*/function (_Tile) {
19
19
  _inherits(VectorTile, _Tile);
@@ -100,7 +100,7 @@ var VectorTile = /*#__PURE__*/function (_Tile) {
100
100
  switch (_context2.prev = _context2.next) {
101
101
  case 0:
102
102
  mask = new MaskLayer({
103
- layerType: "MaskLayer"
103
+ layerType: 'MaskLayer'
104
104
  }).source({
105
105
  type: 'FeatureCollection',
106
106
  features: [this.sourceTile.bboxPolygon]
@@ -173,8 +173,8 @@ var VectorTile = /*#__PURE__*/function (_Tile) {
173
173
  }
174
174
  /**
175
175
  * 在一个 Tile 中可能存在一个相同 ID 的 feature
176
- * @param id
177
- * @returns
176
+ * @param id
177
+ * @returns
178
178
  */
179
179
 
180
180
  }, {
@@ -186,6 +186,7 @@ var VectorTile = /*#__PURE__*/function (_Tile) {
186
186
  return [];
187
187
  }
188
188
 
189
+ console.log(layer.getSource().data.dataArray, id);
189
190
  var res = layer.getSource().data.dataArray.filter(function (d) {
190
191
  return d._id === id;
191
192
  });
@@ -276,6 +276,7 @@ var BaseLayer = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
276
276
  this.fontService = this.container.get(_l7Core.TYPES.IFontService);
277
277
  this.rendererService = this.container.get(_l7Core.TYPES.IRendererService);
278
278
  this.layerService = this.container.get(_l7Core.TYPES.ILayerService);
279
+ this.debugService = this.container.get(_l7Core.TYPES.IDebugService);
279
280
  this.interactionService = this.container.get(_l7Core.TYPES.IInteractionService);
280
281
  this.pickingService = this.container.get(_l7Core.TYPES.IPickingService);
281
282
  this.mapService = this.container.get(_l7Core.TYPES.IMapService);
@@ -345,12 +346,14 @@ var BaseLayer = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
345
346
 
346
347
  this.layerPickService = new _LayerPickService.default(this); // 颜色纹理服务
347
348
 
348
- this.textureService = new _TextureService.default(this); // 触发 init 生命周期插件
349
+ this.textureService = new _TextureService.default(this);
350
+ this.log(_l7Core.IDebugLog.LayerInitStart); // 触发 init 生命周期插件
349
351
 
350
- _context.next = 29;
352
+ _context.next = 31;
351
353
  return this.hooks.init.promise();
352
354
 
353
- case 29:
355
+ case 31:
356
+ this.log(_l7Core.IDebugLog.LayerInitEnd);
354
357
  this.inited = true; // 触发初始化完成事件;
355
358
 
356
359
  this.emit('inited', {
@@ -363,7 +366,7 @@ var BaseLayer = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
363
366
  });
364
367
  this.hooks.afterInit.call();
365
368
 
366
- case 33:
369
+ case 36:
367
370
  case "end":
368
371
  return _context.stop();
369
372
  }
@@ -377,6 +380,26 @@ var BaseLayer = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
377
380
 
378
381
  return init;
379
382
  }()
383
+ }, {
384
+ key: "log",
385
+ value: function log(logType, time) {
386
+ // @ts-ignore 瓦片、瓦片图层目前不参与日志
387
+ if (this.tileLayer || this.isTileLayer) {
388
+ return;
389
+ }
390
+
391
+ var key = "".concat(this.id, ".").concat(logType);
392
+ var values = {
393
+ id: this.id,
394
+ type: this.type
395
+ };
396
+
397
+ if (time) {
398
+ values.time = time;
399
+ }
400
+
401
+ this.debugService.log(key, values);
402
+ }
380
403
  }, {
381
404
  key: "updateModelData",
382
405
  value: function updateModelData(data) {
@@ -1009,7 +1032,9 @@ var BaseLayer = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
1009
1032
 
1010
1033
  (_this$layerModel2 = this.layerModel) === null || _this$layerModel2 === void 0 ? void 0 : _this$layerModel2.clearModels(refresh);
1011
1034
  (_this$tileLayer = this.tileLayer) === null || _this$tileLayer === void 0 ? void 0 : _this$tileLayer.destroy();
1012
- this.models = [];
1035
+ this.models = []; // 清除图层日志(如果有的话:非瓦片相关)
1036
+
1037
+ this.debugService.removeLog(this.id);
1013
1038
  this.emit('remove', {
1014
1039
  target: this,
1015
1040
  type: 'remove'
@@ -75,6 +75,7 @@ var LineModel = /*#__PURE__*/function (_BaseModel) {
75
75
  }
76
76
 
77
77
  _this = _super.call.apply(_super, [this].concat(args));
78
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "textureEventFlag", false);
78
79
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "texture", _this.createTexture2D({
79
80
  data: [0, 0, 0, 0],
80
81
  mag: _l7Core.gl.NEAREST,
@@ -255,13 +256,17 @@ var LineModel = /*#__PURE__*/function (_BaseModel) {
255
256
  while (1) {
256
257
  switch (_context.prev = _context.next) {
257
258
  case 0:
258
- _context.next = 2;
259
- return this.buildModels();
259
+ // this.updateTexture();
260
+ // this.iconService.on('imageUpdate', this.updateTexture);
261
+ if (!this.textureEventFlag) {
262
+ this.textureEventFlag = true;
263
+ this.updateTexture();
264
+ this.iconService.on('imageUpdate', this.updateTexture);
265
+ }
260
266
 
261
- case 2:
262
- return _context.abrupt("return", _context.sent);
267
+ return _context.abrupt("return", this.buildModels());
263
268
 
264
- case 3:
269
+ case 2:
265
270
  case "end":
266
271
  return _context.stop();
267
272
  }
@@ -57,12 +57,15 @@ var DataMappingPlugin = (_dec = (0, _inversify.injectable)(), _dec2 = (0, _inver
57
57
  while (1) {
58
58
  switch (_context.prev = _context.next) {
59
59
  case 0:
60
- // 初始化重新生成 map
60
+ layer.log(_l7Core.IDebugLog.MappingStart); // 初始化重新生成 map
61
+
61
62
  _this.generateMaping(layer, {
62
63
  styleAttributeService: styleAttributeService
63
64
  });
64
65
 
65
- case 1:
66
+ layer.log(_l7Core.IDebugLog.MappingEnd);
67
+
68
+ case 3:
66
69
  case "end":
67
70
  return _context.stop();
68
71
  }
@@ -43,6 +43,7 @@ var DataSourcePlugin = (_dec = (0, _inversify.injectable)(), _dec(_class = /*#__
43
43
  while (1) {
44
44
  switch (_context.prev = _context.next) {
45
45
  case 0:
46
+ layer.log(_l7Core.IDebugLog.SourceInitStart);
46
47
  source = layer.getSource();
47
48
 
48
49
  if (!source) {
@@ -53,28 +54,31 @@ var DataSourcePlugin = (_dec = (0, _inversify.injectable)(), _dec(_class = /*#__
53
54
  }
54
55
 
55
56
  if (!source.inited) {
56
- _context.next = 6;
57
+ _context.next = 8;
57
58
  break;
58
59
  }
59
60
 
60
61
  _this.updateClusterData(layer);
61
62
 
62
- _context.next = 8;
63
+ layer.log(_l7Core.IDebugLog.SourceInitEnd);
64
+ _context.next = 10;
63
65
  break;
64
66
 
65
- case 6:
66
- _context.next = 8;
67
+ case 8:
68
+ _context.next = 10;
67
69
  return new Promise(function (resolve) {
68
70
  source.on('update', function (e) {
69
71
  if (e.type === 'inited') {
70
72
  _this.updateClusterData(layer);
73
+
74
+ layer.log(_l7Core.IDebugLog.SourceInitEnd);
71
75
  }
72
76
 
73
77
  resolve(null);
74
78
  });
75
79
  });
76
80
 
77
- case 8:
81
+ case 10:
78
82
  case "end":
79
83
  return _context.stop();
80
84
  }
@@ -83,7 +87,7 @@ var DataSourcePlugin = (_dec = (0, _inversify.injectable)(), _dec(_class = /*#__
83
87
  }))); // 检测数据是否需要更新
84
88
 
85
89
  layer.hooks.beforeRenderData.tapPromise('DataSourcePlugin', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
86
- var neeUpdateCluster, dataSourceNeedUpdate;
90
+ var neeUpdateCluster, dataSourceNeedUpdate, needScale;
87
91
  return _regenerator.default.wrap(function _callee2$(_context2) {
88
92
  while (1) {
89
93
  switch (_context2.prev = _context2.next) {
@@ -91,9 +95,10 @@ var DataSourcePlugin = (_dec = (0, _inversify.injectable)(), _dec(_class = /*#__
91
95
  neeUpdateCluster = _this.updateClusterData(layer);
92
96
  dataSourceNeedUpdate = layer.dataState.dataSourceNeedUpdate;
93
97
  layer.dataState.dataSourceNeedUpdate = false;
94
- return _context2.abrupt("return", neeUpdateCluster || dataSourceNeedUpdate);
98
+ needScale = neeUpdateCluster || dataSourceNeedUpdate;
99
+ return _context2.abrupt("return", needScale);
95
100
 
96
- case 4:
101
+ case 5:
97
102
  case "end":
98
103
  return _context2.stop();
99
104
  }
@@ -69,21 +69,25 @@ var FeatureScalePlugin = (_dec = (0, _inversify.injectable)(), _dec(_class = /*#
69
69
  while (1) {
70
70
  switch (_context.prev = _context.next) {
71
71
  case 0:
72
+ layer.log(_l7Core.IDebugLog.ScaleInitStart);
72
73
  _this.scaleOptions = layer.getScaleOptions();
73
74
  attributes = styleAttributeService.getLayerStyleAttributes();
74
75
  dataArray = (_layer$getSource = layer.getSource()) === null || _layer$getSource === void 0 ? void 0 : _layer$getSource.data.dataArray;
75
76
 
76
77
  if (!(Array.isArray(dataArray) && dataArray.length === 0)) {
77
- _context.next = 7;
78
+ _context.next = 8;
78
79
  break;
79
80
  }
80
81
 
81
82
  return _context.abrupt("return");
82
83
 
83
- case 7:
84
+ case 8:
84
85
  _this.caculateScalesForAttributes(attributes || [], dataArray);
85
86
 
86
- case 8:
87
+ case 9:
88
+ layer.log(_l7Core.IDebugLog.ScaleInitEnd);
89
+
90
+ case 10:
87
91
  case "end":
88
92
  return _context.stop();
89
93
  }