@antv/l7-layers 2.9.27-alpha.1 → 2.9.27-alpha.2

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.
@@ -3,6 +3,19 @@ import { IGeometryLayerStyleOptions } from '../core/interface';
3
3
  import { GeometryModelType } from './models';
4
4
  export default class GeometryLayer extends BaseLayer<IGeometryLayerStyleOptions> {
5
5
  type: string;
6
+ defaultSourceConfig: {
7
+ data: {
8
+ x: number;
9
+ y: number;
10
+ }[];
11
+ options: {
12
+ parser: {
13
+ type: string;
14
+ x: string;
15
+ y: string;
16
+ };
17
+ };
18
+ };
6
19
  buildModels(): void;
7
20
  rebuildModels(): void;
8
21
  protected getConfigSchema(): {
@@ -31,6 +31,20 @@ var GeometryLayer = /*#__PURE__*/function (_BaseLayer) {
31
31
 
32
32
  _defineProperty(_assertThisInitialized(_this), "type", 'GeometryLayer');
33
33
 
34
+ _defineProperty(_assertThisInitialized(_this), "defaultSourceConfig", {
35
+ data: [{
36
+ x: 0,
37
+ y: 0
38
+ }],
39
+ options: {
40
+ parser: {
41
+ type: 'json',
42
+ x: 'x',
43
+ y: 'y'
44
+ }
45
+ }
46
+ });
47
+
34
48
  return _this;
35
49
  }
36
50
 
@@ -17,6 +17,7 @@ export default class BaseLayer<ChildLayerStyleOptions = {}> extends EventEmitter
17
17
  selectedFeatureID: number | null;
18
18
  styleNeedUpdate: boolean;
19
19
  rendering: boolean;
20
+ forceRender: boolean;
20
21
  clusterZoom: number;
21
22
  layerType?: string | undefined;
22
23
  triangulation?: Triangulation | undefined;
@@ -176,6 +177,7 @@ export default class BaseLayer<ChildLayerStyleOptions = {}> extends EventEmitter
176
177
  setSource(source: Source): void;
177
178
  getSource(): Source;
178
179
  getScaleOptions(): IScaleOptions;
180
+ encodeDataLength: number;
179
181
  setEncodedData(encodedData: IEncodeFeature[]): void;
180
182
  getEncodedData(): IEncodeFeature[];
181
183
  getScale(name: string): any;
@@ -87,8 +87,19 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
87
87
 
88
88
  _defineProperty(_assertThisInitialized(_this), "styleNeedUpdate", false);
89
89
 
90
+ _defineProperty(_assertThisInitialized(_this), "forceRender", false);
91
+
90
92
  _defineProperty(_assertThisInitialized(_this), "clusterZoom", 0);
91
93
 
94
+ _defineProperty(_assertThisInitialized(_this), "defaultSourceConfig", {
95
+ data: [],
96
+ options: {
97
+ parser: {
98
+ type: 'json'
99
+ }
100
+ }
101
+ });
102
+
92
103
  _defineProperty(_assertThisInitialized(_this), "dataState", {
93
104
  dataSourceNeedUpdate: false,
94
105
  dataMappingNeedUpdate: false,
@@ -139,6 +150,8 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
139
150
 
140
151
  _defineProperty(_assertThisInitialized(_this), "isDestroied", false);
141
152
 
153
+ _defineProperty(_assertThisInitialized(_this), "encodeDataLength", 0);
154
+
142
155
  _defineProperty(_assertThisInitialized(_this), "sourceEvent", function () {
143
156
  _this.dataState.dataSourceNeedUpdate = true;
144
157
 
@@ -606,13 +619,11 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
606
619
  // 瓦片图层执行单独的 render 渲染队列
607
620
  this.tileLayer.render();
608
621
  return this;
609
- } // TODO: this.getEncodedData().length !== 0 这个判断是为了解决在 2.5.x 引入数据纹理后产生的 空数据渲染导致 texture 超出上限问题
610
-
611
-
612
- if (this.getEncodedData() && this.getEncodedData().length !== 0) {
613
- this.renderModels();
614
622
  }
615
623
 
624
+ if (this.encodeDataLength <= 0 && !this.forceRender) return this; // Tip: this.getEncodedData().length !== 0 这个判断是为了解决在 2.5.x 引入数据纹理后产生的 空数据渲染导致 texture 超出上限问题
625
+
626
+ this.renderModels();
616
627
  return this;
617
628
  }
618
629
  /**
@@ -627,24 +638,27 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
627
638
  while (1) {
628
639
  switch (_context.prev = _context.next) {
629
640
  case 0:
630
- if (!(this.getEncodedData() && this.getEncodedData().length !== 0)) {
631
- _context.next = 7;
641
+ if (!(this.encodeDataLength <= 0 && !this.forceRender)) {
642
+ _context.next = 2;
632
643
  break;
633
644
  }
634
645
 
646
+ return _context.abrupt("return");
647
+
648
+ case 2:
635
649
  if (!(this.multiPassRenderer && this.multiPassRenderer.getRenderFlag())) {
636
- _context.next = 6;
650
+ _context.next = 7;
637
651
  break;
638
652
  }
639
653
 
640
- _context.next = 4;
654
+ _context.next = 5;
641
655
  return this.multiPassRenderer.render();
642
656
 
643
- case 4:
644
- _context.next = 7;
657
+ case 5:
658
+ _context.next = 8;
645
659
  break;
646
660
 
647
- case 6:
661
+ case 7:
648
662
  if (this.multiPassRenderer) {
649
663
  // renderPass 触发的渲染
650
664
  this.renderModels();
@@ -652,7 +666,7 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
652
666
  this.renderModels();
653
667
  }
654
668
 
655
- case 7:
669
+ case 8:
656
670
  case "end":
657
671
  return _context.stop();
658
672
  }
@@ -1067,6 +1081,7 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
1067
1081
  key: "setEncodedData",
1068
1082
  value: function setEncodedData(encodedData) {
1069
1083
  this.encodedData = encodedData;
1084
+ this.encodeDataLength = encodedData.length;
1070
1085
  }
1071
1086
  }, {
1072
1087
  key: "getEncodedData",
@@ -1300,33 +1315,31 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
1300
1315
  }, {
1301
1316
  key: "renderModels",
1302
1317
  value: function renderModels(isPicking) {
1303
- var _this10 = this;
1318
+ var _this10 = this,
1319
+ _this$layerModel4;
1304
1320
 
1305
1321
  // TODO: this.getEncodedData().length > 0 这个判断是为了解决在 2.5.x 引入数据纹理后产生的 空数据渲染导致 texture 超出上限问题
1306
- if (this.getEncodedData() && this.getEncodedData().length > 0) {
1307
- var _this$layerModel4;
1308
-
1309
- if (this.layerModelNeedUpdate && this.layerModel) {
1310
- this.layerModel.buildModels(function (models) {
1311
- _this10.models = models;
1322
+ if (this.encodeDataLength <= 0 && !this.forceRender) return this;
1312
1323
 
1313
- _this10.hooks.beforeRender.call();
1314
-
1315
- _this10.layerModelNeedUpdate = false;
1316
- });
1317
- }
1324
+ if (this.layerModelNeedUpdate && this.layerModel) {
1325
+ this.layerModel.buildModels(function (models) {
1326
+ _this10.models = models;
1318
1327
 
1319
- if (this !== null && this !== void 0 && (_this$layerModel4 = this.layerModel) !== null && _this$layerModel4 !== void 0 && _this$layerModel4.renderUpdate) {
1320
- this.layerModel.renderUpdate();
1321
- }
1328
+ _this10.hooks.beforeRender.call();
1322
1329
 
1323
- this.models.forEach(function (model) {
1324
- model.draw({
1325
- uniforms: _this10.layerModel.getUninforms()
1326
- }, isPicking);
1330
+ _this10.layerModelNeedUpdate = false;
1327
1331
  });
1328
1332
  }
1329
1333
 
1334
+ if (this !== null && this !== void 0 && (_this$layerModel4 = this.layerModel) !== null && _this$layerModel4 !== void 0 && _this$layerModel4.renderUpdate) {
1335
+ this.layerModel.renderUpdate();
1336
+ }
1337
+
1338
+ this.models.forEach(function (model) {
1339
+ model.draw({
1340
+ uniforms: _this10.layerModel.getUninforms()
1341
+ }, isPicking);
1342
+ });
1330
1343
  return this;
1331
1344
  }
1332
1345
  }, {
@@ -1,4 +1,5 @@
1
1
  import BaseLayer from '../core/BaseLayer';
2
+ import { ISourceCFG } from '@antv/l7-core';
2
3
  interface IEarthLayerStyleOptions {
3
4
  opacity: number;
4
5
  setEarthTime(time: number): void;
@@ -6,6 +7,10 @@ interface IEarthLayerStyleOptions {
6
7
  export declare type EarthModelType = 'base' | 'atomSphere' | 'bloomSphere';
7
8
  export default class EarthLayer extends BaseLayer<IEarthLayerStyleOptions> {
8
9
  type: string;
10
+ defaultSourceConfig: {
11
+ data: any[];
12
+ options: ISourceCFG | undefined;
13
+ };
9
14
  buildModels(): void;
10
15
  /**
11
16
  * 设置当前地球时间
package/es/earth/index.js CHANGED
@@ -39,6 +39,15 @@ var EarthLayer = /*#__PURE__*/function (_BaseLayer) {
39
39
 
40
40
  _defineProperty(_assertThisInitialized(_this), "type", 'EarthLayer');
41
41
 
42
+ _defineProperty(_assertThisInitialized(_this), "defaultSourceConfig", {
43
+ data: [],
44
+ options: {
45
+ parser: {
46
+ type: 'json'
47
+ }
48
+ }
49
+ });
50
+
42
51
  return _this;
43
52
  }
44
53
 
@@ -45,6 +45,19 @@ var GeometryLayer = /*#__PURE__*/function (_BaseLayer) {
45
45
 
46
46
  _this = _super.call.apply(_super, [this].concat(args));
47
47
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "type", 'GeometryLayer');
48
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "defaultSourceConfig", {
49
+ data: [{
50
+ x: 0,
51
+ y: 0
52
+ }],
53
+ options: {
54
+ parser: {
55
+ type: 'json',
56
+ x: 'x',
57
+ y: 'y'
58
+ }
59
+ }
60
+ });
48
61
  return _this;
49
62
  }
50
63
 
@@ -106,7 +106,16 @@ var BaseLayer = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
106
106
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "pickedFeatureID", null);
107
107
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "selectedFeatureID", null);
108
108
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "styleNeedUpdate", false);
109
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "forceRender", false);
109
110
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "clusterZoom", 0);
111
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "defaultSourceConfig", {
112
+ data: [],
113
+ options: {
114
+ parser: {
115
+ type: 'json'
116
+ }
117
+ }
118
+ });
110
119
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "dataState", {
111
120
  dataSourceNeedUpdate: false,
112
121
  dataMappingNeedUpdate: false,
@@ -143,6 +152,7 @@ var BaseLayer = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
143
152
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "aniamateStatus", false);
144
153
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "bottomColor", 'rgba(0, 0, 0, 0)');
145
154
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "isDestroied", false);
155
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "encodeDataLength", 0);
146
156
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "sourceEvent", function () {
147
157
  _this.dataState.dataSourceNeedUpdate = true;
148
158
 
@@ -607,13 +617,11 @@ var BaseLayer = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
607
617
  // 瓦片图层执行单独的 render 渲染队列
608
618
  this.tileLayer.render();
609
619
  return this;
610
- } // TODO: this.getEncodedData().length !== 0 这个判断是为了解决在 2.5.x 引入数据纹理后产生的 空数据渲染导致 texture 超出上限问题
611
-
612
-
613
- if (this.getEncodedData() && this.getEncodedData().length !== 0) {
614
- this.renderModels();
615
620
  }
616
621
 
622
+ if (this.encodeDataLength <= 0 && !this.forceRender) return this; // Tip: this.getEncodedData().length !== 0 这个判断是为了解决在 2.5.x 引入数据纹理后产生的 空数据渲染导致 texture 超出上限问题
623
+
624
+ this.renderModels();
617
625
  return this;
618
626
  }
619
627
  /**
@@ -628,24 +636,27 @@ var BaseLayer = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
628
636
  while (1) {
629
637
  switch (_context.prev = _context.next) {
630
638
  case 0:
631
- if (!(this.getEncodedData() && this.getEncodedData().length !== 0)) {
632
- _context.next = 7;
639
+ if (!(this.encodeDataLength <= 0 && !this.forceRender)) {
640
+ _context.next = 2;
633
641
  break;
634
642
  }
635
643
 
644
+ return _context.abrupt("return");
645
+
646
+ case 2:
636
647
  if (!(this.multiPassRenderer && this.multiPassRenderer.getRenderFlag())) {
637
- _context.next = 6;
648
+ _context.next = 7;
638
649
  break;
639
650
  }
640
651
 
641
- _context.next = 4;
652
+ _context.next = 5;
642
653
  return this.multiPassRenderer.render();
643
654
 
644
- case 4:
645
- _context.next = 7;
655
+ case 5:
656
+ _context.next = 8;
646
657
  break;
647
658
 
648
- case 6:
659
+ case 7:
649
660
  if (this.multiPassRenderer) {
650
661
  // renderPass 触发的渲染
651
662
  this.renderModels();
@@ -653,7 +664,7 @@ var BaseLayer = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
653
664
  this.renderModels();
654
665
  }
655
666
 
656
- case 7:
667
+ case 8:
657
668
  case "end":
658
669
  return _context.stop();
659
670
  }
@@ -1068,6 +1079,7 @@ var BaseLayer = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
1068
1079
  key: "setEncodedData",
1069
1080
  value: function setEncodedData(encodedData) {
1070
1081
  this.encodedData = encodedData;
1082
+ this.encodeDataLength = encodedData.length;
1071
1083
  }
1072
1084
  }, {
1073
1085
  key: "getEncodedData",
@@ -1300,33 +1312,31 @@ var BaseLayer = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
1300
1312
  }, {
1301
1313
  key: "renderModels",
1302
1314
  value: function renderModels(isPicking) {
1303
- var _this10 = this;
1315
+ var _this10 = this,
1316
+ _this$layerModel4;
1304
1317
 
1305
1318
  // TODO: this.getEncodedData().length > 0 这个判断是为了解决在 2.5.x 引入数据纹理后产生的 空数据渲染导致 texture 超出上限问题
1306
- if (this.getEncodedData() && this.getEncodedData().length > 0) {
1307
- var _this$layerModel4;
1308
-
1309
- if (this.layerModelNeedUpdate && this.layerModel) {
1310
- this.layerModel.buildModels(function (models) {
1311
- _this10.models = models;
1319
+ if (this.encodeDataLength <= 0 && !this.forceRender) return this;
1312
1320
 
1313
- _this10.hooks.beforeRender.call();
1321
+ if (this.layerModelNeedUpdate && this.layerModel) {
1322
+ this.layerModel.buildModels(function (models) {
1323
+ _this10.models = models;
1314
1324
 
1315
- _this10.layerModelNeedUpdate = false;
1316
- });
1317
- }
1325
+ _this10.hooks.beforeRender.call();
1318
1326
 
1319
- if (this !== null && this !== void 0 && (_this$layerModel4 = this.layerModel) !== null && _this$layerModel4 !== void 0 && _this$layerModel4.renderUpdate) {
1320
- this.layerModel.renderUpdate();
1321
- }
1322
-
1323
- this.models.forEach(function (model) {
1324
- model.draw({
1325
- uniforms: _this10.layerModel.getUninforms()
1326
- }, isPicking);
1327
+ _this10.layerModelNeedUpdate = false;
1327
1328
  });
1328
1329
  }
1329
1330
 
1331
+ if (this !== null && this !== void 0 && (_this$layerModel4 = this.layerModel) !== null && _this$layerModel4 !== void 0 && _this$layerModel4.renderUpdate) {
1332
+ this.layerModel.renderUpdate();
1333
+ }
1334
+
1335
+ this.models.forEach(function (model) {
1336
+ model.draw({
1337
+ uniforms: _this10.layerModel.getUninforms()
1338
+ }, isPicking);
1339
+ });
1330
1340
  return this;
1331
1341
  }
1332
1342
  }, {
@@ -56,6 +56,14 @@ var EarthLayer = /*#__PURE__*/function (_BaseLayer) {
56
56
 
57
57
  _this = _super.call.apply(_super, [this].concat(args));
58
58
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "type", 'EarthLayer');
59
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "defaultSourceConfig", {
60
+ data: [],
61
+ options: {
62
+ parser: {
63
+ type: 'json'
64
+ }
65
+ }
66
+ });
59
67
  return _this;
60
68
  }
61
69
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antv/l7-layers",
3
- "version": "2.9.27-alpha.1",
3
+ "version": "2.9.27-alpha.2",
4
4
  "description": "L7's collection of built-in layers",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",
@@ -27,10 +27,10 @@
27
27
  "license": "ISC",
28
28
  "dependencies": {
29
29
  "@antv/async-hook": "^2.1.0",
30
- "@antv/l7-core": "2.9.27-alpha.1",
31
- "@antv/l7-maps": "2.9.27-alpha.1",
32
- "@antv/l7-source": "2.9.27-alpha.1",
33
- "@antv/l7-utils": "2.9.27-alpha.1",
30
+ "@antv/l7-core": "2.9.27-alpha.2",
31
+ "@antv/l7-maps": "2.9.27-alpha.2",
32
+ "@antv/l7-source": "2.9.27-alpha.2",
33
+ "@antv/l7-utils": "2.9.27-alpha.2",
34
34
  "@babel/runtime": "^7.7.7",
35
35
  "@mapbox/martini": "^0.2.0",
36
36
  "@turf/helpers": "^6.1.4",
@@ -60,7 +60,7 @@
60
60
  "@types/gl-matrix": "^2.4.5",
61
61
  "@types/lodash": "^4.14.138"
62
62
  },
63
- "gitHead": "4de1a35dd04dcb651d469b77aa66ab821453005c",
63
+ "gitHead": "209f0b76af7ad1c7342f5ea21aa1c2179e8c460d",
64
64
  "publishConfig": {
65
65
  "access": "public"
66
66
  }