@antv/l7-layers 2.14.4 → 2.14.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.
@@ -188,9 +188,7 @@ export default class BaseLayer<ChildLayerStyleOptions = {}> extends EventEmitter
188
188
  clearModels(): void;
189
189
  isDirty(): boolean;
190
190
  setSource(source: Source): void;
191
- initSource(source: Source): void;
192
191
  getSource(): Source;
193
- private addSourceEvent;
194
192
  getScaleOptions(): IScaleOptions;
195
193
  encodeDataLength: number;
196
194
  setEncodedData(encodedData: IEncodeFeature[]): void;
@@ -1156,44 +1156,22 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
1156
1156
  }
1157
1157
 
1158
1158
  if (type === 'update') {
1159
- // source 初始化不需要处理
1159
+ if (_this8.tileLayer) {
1160
+ // 瓦片图层独立更新
1161
+ _this8.tileLayer.reload();
1162
+
1163
+ return;
1164
+ } // source 初始化不需要处理
1165
+
1166
+
1160
1167
  _this8.sourceEvent();
1161
1168
  }
1162
1169
  });
1163
- } // layer 初始化source
1164
-
1165
- }, {
1166
- key: "initSource",
1167
- value: function initSource(source) {
1168
- this.layerSource = source;
1169
- this.clusterZoom = 0;
1170
- this.addSourceEvent();
1171
1170
  }
1172
1171
  }, {
1173
1172
  key: "getSource",
1174
1173
  value: function getSource() {
1175
1174
  return this.layerSource;
1176
- } // 注册source 更新事件
1177
-
1178
- }, {
1179
- key: "addSourceEvent",
1180
- value: function addSourceEvent() {
1181
- var _this9 = this;
1182
-
1183
- this.layerSource.on('update', function () {
1184
- if (_this9.coordCenter === undefined) {
1185
- var _this9$mapService;
1186
-
1187
- var layerCenter = _this9.layerSource.center;
1188
- _this9.coordCenter = layerCenter;
1189
-
1190
- if ((_this9$mapService = _this9.mapService) !== null && _this9$mapService !== void 0 && _this9$mapService.setCoordCenter) {
1191
- _this9.mapService.setCoordCenter(layerCenter);
1192
- }
1193
- }
1194
-
1195
- _this9.sourceEvent();
1196
- });
1197
1175
  }
1198
1176
  }, {
1199
1177
  key: "getScaleOptions",
@@ -1289,7 +1267,7 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
1289
1267
  key: "buildLayerModel",
1290
1268
  value: function () {
1291
1269
  var _buildLayerModel = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(options) {
1292
- var _this10 = this;
1270
+ var _this9 = this;
1293
1271
 
1294
1272
  var moduleName, vertexShader, fragmentShader, triangulation, segmentNumber, _options$workerEnable, workerEnabled, workerOptions, rest, _this$shaderModuleSer, vs, fs, uniforms, createModel;
1295
1273
 
@@ -1307,7 +1285,7 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
1307
1285
  return _context3.abrupt("return", new Promise(function (resolve, reject) {
1308
1286
  // filter supported worker & worker enabled layer
1309
1287
  if (workerOptions && workerOptions.modelType in WorkerSourceMap && workerEnabled) {
1310
- _this10.styleAttributeService.createAttributesAndIndicesAscy(_this10.encodedData, segmentNumber, workerOptions).then(function (_ref9) {
1288
+ _this9.styleAttributeService.createAttributesAndIndicesAscy(_this9.encodedData, segmentNumber, workerOptions).then(function (_ref9) {
1311
1289
  var attributes = _ref9.attributes,
1312
1290
  elements = _ref9.elements;
1313
1291
  var m = createModel(_objectSpread({
@@ -1323,10 +1301,10 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
1323
1301
  return reject(err);
1324
1302
  });
1325
1303
  } else {
1326
- var _this10$styleAttribut = _this10.styleAttributeService.createAttributesAndIndices(_this10.encodedData, triangulation, segmentNumber),
1327
- attributes = _this10$styleAttribut.attributes,
1328
- elements = _this10$styleAttribut.elements,
1329
- count = _this10$styleAttribut.count;
1304
+ var _this9$styleAttribute = _this9.styleAttributeService.createAttributesAndIndices(_this9.encodedData, triangulation, segmentNumber),
1305
+ attributes = _this9$styleAttribute.attributes,
1306
+ elements = _this9$styleAttribute.elements,
1307
+ count = _this9$styleAttribute.count;
1330
1308
 
1331
1309
  var modelOptions = _objectSpread({
1332
1310
  attributes: attributes,
@@ -1497,7 +1475,7 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
1497
1475
  }, {
1498
1476
  key: "renderModels",
1499
1477
  value: function renderModels() {
1500
- var _this11 = this;
1478
+ var _this10 = this;
1501
1479
 
1502
1480
  var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
1503
1481
 
@@ -1509,9 +1487,9 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
1509
1487
  this.hooks.beforeRender.call();
1510
1488
  this.models.forEach(function (model) {
1511
1489
  model.draw({
1512
- uniforms: _this11.layerModel.getUninforms(),
1513
- blend: _this11.layerModel.getBlend(),
1514
- stencil: _this11.layerModel.getStencil(options)
1490
+ uniforms: _this10.layerModel.getUninforms(),
1491
+ blend: _this10.layerModel.getBlend(),
1492
+ stencil: _this10.layerModel.getStencil(options)
1515
1493
  }, (options === null || options === void 0 ? void 0 : options.ispick) || false);
1516
1494
  });
1517
1495
  this.hooks.afterRender.call();
@@ -32,6 +32,7 @@ export default class BaseTileLayer {
32
32
  tileLoaded(tile: SourceTile): void;
33
33
  tileError(error: Error): void;
34
34
  destroy(): void;
35
+ reload(): void;
35
36
  tileUnLoad(tile: SourceTile): void;
36
37
  tileUpdate(): Promise<void>;
37
38
  setPickState(layers: ILayer[]): void;
@@ -180,6 +180,21 @@ var BaseTileLayer = /*#__PURE__*/function () {
180
180
  this.mapService.off('moveend', this.viewchange);
181
181
  (_this$tilesetManager3 = this.tilesetManager) === null || _this$tilesetManager3 === void 0 ? void 0 : _this$tilesetManager3.destroy();
182
182
  this.tileLayerService.destroy();
183
+ } // 重新加载
184
+
185
+ }, {
186
+ key: "reload",
187
+ value: function reload() {
188
+ var _this$tilesetManager4;
189
+
190
+ // 瓦片重新加载
191
+ this.tilesetManager.clear();
192
+
193
+ var _this$getCurrentView3 = this.getCurrentView(),
194
+ latLonBounds = _this$getCurrentView3.latLonBounds,
195
+ zoom = _this$getCurrentView3.zoom;
196
+
197
+ (_this$tilesetManager4 = this.tilesetManager) === null || _this$tilesetManager4 === void 0 ? void 0 : _this$tilesetManager4.update(zoom, latLonBounds);
183
198
  }
184
199
  }, {
185
200
  key: "tileUnLoad",
@@ -1157,44 +1157,22 @@ var BaseLayer = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
1157
1157
  }
1158
1158
 
1159
1159
  if (type === 'update') {
1160
- // source 初始化不需要处理
1160
+ if (_this8.tileLayer) {
1161
+ // 瓦片图层独立更新
1162
+ _this8.tileLayer.reload();
1163
+
1164
+ return;
1165
+ } // source 初始化不需要处理
1166
+
1167
+
1161
1168
  _this8.sourceEvent();
1162
1169
  }
1163
1170
  });
1164
- } // layer 初始化source
1165
-
1166
- }, {
1167
- key: "initSource",
1168
- value: function initSource(source) {
1169
- this.layerSource = source;
1170
- this.clusterZoom = 0;
1171
- this.addSourceEvent();
1172
1171
  }
1173
1172
  }, {
1174
1173
  key: "getSource",
1175
1174
  value: function getSource() {
1176
1175
  return this.layerSource;
1177
- } // 注册source 更新事件
1178
-
1179
- }, {
1180
- key: "addSourceEvent",
1181
- value: function addSourceEvent() {
1182
- var _this9 = this;
1183
-
1184
- this.layerSource.on('update', function () {
1185
- if (_this9.coordCenter === undefined) {
1186
- var _this9$mapService;
1187
-
1188
- var layerCenter = _this9.layerSource.center;
1189
- _this9.coordCenter = layerCenter;
1190
-
1191
- if ((_this9$mapService = _this9.mapService) !== null && _this9$mapService !== void 0 && _this9$mapService.setCoordCenter) {
1192
- _this9.mapService.setCoordCenter(layerCenter);
1193
- }
1194
- }
1195
-
1196
- _this9.sourceEvent();
1197
- });
1198
1176
  }
1199
1177
  }, {
1200
1178
  key: "getScaleOptions",
@@ -1290,7 +1268,7 @@ var BaseLayer = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
1290
1268
  key: "buildLayerModel",
1291
1269
  value: function () {
1292
1270
  var _buildLayerModel = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(options) {
1293
- var _this10 = this;
1271
+ var _this9 = this;
1294
1272
 
1295
1273
  var moduleName, vertexShader, fragmentShader, triangulation, segmentNumber, _options$workerEnable, workerEnabled, workerOptions, rest, _this$shaderModuleSer, vs, fs, uniforms, createModel;
1296
1274
 
@@ -1308,7 +1286,7 @@ var BaseLayer = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
1308
1286
  return _context3.abrupt("return", new Promise(function (resolve, reject) {
1309
1287
  // filter supported worker & worker enabled layer
1310
1288
  if (workerOptions && workerOptions.modelType in _l7Utils.WorkerSourceMap && workerEnabled) {
1311
- _this10.styleAttributeService.createAttributesAndIndicesAscy(_this10.encodedData, segmentNumber, workerOptions).then(function (_ref9) {
1289
+ _this9.styleAttributeService.createAttributesAndIndicesAscy(_this9.encodedData, segmentNumber, workerOptions).then(function (_ref9) {
1312
1290
  var attributes = _ref9.attributes,
1313
1291
  elements = _ref9.elements;
1314
1292
  var m = createModel((0, _objectSpread2.default)({
@@ -1324,10 +1302,10 @@ var BaseLayer = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
1324
1302
  return reject(err);
1325
1303
  });
1326
1304
  } else {
1327
- var _this10$styleAttribut = _this10.styleAttributeService.createAttributesAndIndices(_this10.encodedData, triangulation, segmentNumber),
1328
- attributes = _this10$styleAttribut.attributes,
1329
- elements = _this10$styleAttribut.elements,
1330
- count = _this10$styleAttribut.count;
1305
+ var _this9$styleAttribute = _this9.styleAttributeService.createAttributesAndIndices(_this9.encodedData, triangulation, segmentNumber),
1306
+ attributes = _this9$styleAttribute.attributes,
1307
+ elements = _this9$styleAttribute.elements,
1308
+ count = _this9$styleAttribute.count;
1331
1309
 
1332
1310
  var modelOptions = (0, _objectSpread2.default)({
1333
1311
  attributes: attributes,
@@ -1498,7 +1476,7 @@ var BaseLayer = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
1498
1476
  }, {
1499
1477
  key: "renderModels",
1500
1478
  value: function renderModels() {
1501
- var _this11 = this;
1479
+ var _this10 = this;
1502
1480
 
1503
1481
  var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
1504
1482
 
@@ -1510,9 +1488,9 @@ var BaseLayer = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
1510
1488
  this.hooks.beforeRender.call();
1511
1489
  this.models.forEach(function (model) {
1512
1490
  model.draw({
1513
- uniforms: _this11.layerModel.getUninforms(),
1514
- blend: _this11.layerModel.getBlend(),
1515
- stencil: _this11.layerModel.getStencil(options)
1491
+ uniforms: _this10.layerModel.getUninforms(),
1492
+ blend: _this10.layerModel.getBlend(),
1493
+ stencil: _this10.layerModel.getStencil(options)
1516
1494
  }, (options === null || options === void 0 ? void 0 : options.ispick) || false);
1517
1495
  });
1518
1496
  this.hooks.afterRender.call();
@@ -195,6 +195,21 @@ var BaseTileLayer = /*#__PURE__*/function () {
195
195
  this.mapService.off('moveend', this.viewchange);
196
196
  (_this$tilesetManager3 = this.tilesetManager) === null || _this$tilesetManager3 === void 0 ? void 0 : _this$tilesetManager3.destroy();
197
197
  this.tileLayerService.destroy();
198
+ } // 重新加载
199
+
200
+ }, {
201
+ key: "reload",
202
+ value: function reload() {
203
+ var _this$tilesetManager4;
204
+
205
+ // 瓦片重新加载
206
+ this.tilesetManager.clear();
207
+
208
+ var _this$getCurrentView3 = this.getCurrentView(),
209
+ latLonBounds = _this$getCurrentView3.latLonBounds,
210
+ zoom = _this$getCurrentView3.zoom;
211
+
212
+ (_this$tilesetManager4 = this.tilesetManager) === null || _this$tilesetManager4 === void 0 ? void 0 : _this$tilesetManager4.update(zoom, latLonBounds);
198
213
  }
199
214
  }, {
200
215
  key: "tileUnLoad",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antv/l7-layers",
3
- "version": "2.14.4",
3
+ "version": "2.14.6",
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.2.9",
30
- "@antv/l7-core": "2.14.4",
31
- "@antv/l7-maps": "2.14.4",
32
- "@antv/l7-source": "2.14.4",
33
- "@antv/l7-utils": "2.14.4",
30
+ "@antv/l7-core": "2.14.6",
31
+ "@antv/l7-maps": "2.14.6",
32
+ "@antv/l7-source": "2.14.6",
33
+ "@antv/l7-utils": "2.14.6",
34
34
  "@babel/runtime": "^7.7.7",
35
35
  "@mapbox/martini": "^0.2.0",
36
36
  "@turf/clone": "^6.5.0",
@@ -53,7 +53,7 @@
53
53
  "reflect-metadata": "^0.1.13"
54
54
  },
55
55
  "devDependencies": {
56
- "@antv/l7-test-utils": "2.14.4",
56
+ "@antv/l7-test-utils": "2.14.6",
57
57
  "@types/d3-array": "^2.0.0",
58
58
  "@types/d3-color": "^1.2.2",
59
59
  "@types/d3-interpolate": "1.1.6",
@@ -62,7 +62,7 @@
62
62
  "@types/gl-matrix": "^2.4.5",
63
63
  "@types/lodash": "^4.14.138"
64
64
  },
65
- "gitHead": "0d01c2e1daea1b571b4e467186c9fee754b98429",
65
+ "gitHead": "5f8823a2b58da0d8bed10a23e21fc903458c1f77",
66
66
  "publishConfig": {
67
67
  "access": "public"
68
68
  }