@antv/l7-layers 2.20.20 → 2.21.0
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.
- package/es/canvas/index.d.ts +13 -8
- package/es/canvas/index.js +63 -36
- package/es/canvas/models/canvas.d.ts +19 -14
- package/es/canvas/models/canvas.js +125 -139
- package/es/canvas/models/constants.d.ts +2 -0
- package/es/canvas/models/constants.js +6 -0
- package/es/canvas/models/index.d.ts +2 -5
- package/es/canvas/models/index.js +2 -5
- package/es/core/BaseLayer.d.ts +17 -19
- package/es/core/BaseLayer.js +88 -62
- package/es/core/BaseModel.js +15 -29
- package/es/core/LayerPickService.js +4 -5
- package/es/core/TextureService.js +1 -2
- package/es/core/interface.d.ts +31 -4
- package/es/core/shape/arrow.js +2 -6
- package/es/heatmap/models/heatmap.d.ts +0 -1
- package/es/heatmap/models/heatmap.js +2 -5
- package/es/index.d.ts +2 -1
- package/es/index.js +2 -89
- package/es/line/models/arc.js +5 -5
- package/es/line/models/arc_3d.js +4 -3
- package/es/line/models/great_circle.js +4 -4
- package/es/line/models/line.js +5 -8
- package/es/line/models/simple_line.js +1 -2
- package/es/line/models/wall.js +4 -3
- package/es/plugins/DataMappingPlugin.d.ts +4 -7
- package/es/plugins/DataMappingPlugin.js +8 -23
- package/es/plugins/DataSourcePlugin.d.ts +0 -1
- package/es/plugins/DataSourcePlugin.js +4 -7
- package/es/plugins/FeatureScalePlugin.d.ts +2 -5
- package/es/plugins/FeatureScalePlugin.js +4 -6
- package/es/plugins/LayerAnimateStylePlugin.d.ts +0 -1
- package/es/plugins/LayerAnimateStylePlugin.js +2 -5
- package/es/plugins/LayerMaskPlugin.d.ts +0 -1
- package/es/plugins/LayerMaskPlugin.js +2 -8
- package/es/plugins/LayerModelPlugin.d.ts +0 -1
- package/es/plugins/LayerModelPlugin.js +13 -18
- package/es/plugins/LayerStylePlugin.d.ts +0 -1
- package/es/plugins/LayerStylePlugin.js +2 -5
- package/es/plugins/LightingPlugin.d.ts +0 -1
- package/es/plugins/LightingPlugin.js +2 -5
- package/es/plugins/MultiPassRendererPlugin.d.ts +0 -1
- package/es/plugins/MultiPassRendererPlugin.js +2 -5
- package/es/plugins/PixelPickingPlugin.d.ts +2 -6
- package/es/plugins/PixelPickingPlugin.js +4 -9
- package/es/plugins/RegisterStyleAttributePlugin.d.ts +2 -5
- package/es/plugins/RegisterStyleAttributePlugin.js +2 -5
- package/es/plugins/ShaderUniformPlugin.d.ts +7 -8
- package/es/plugins/ShaderUniformPlugin.js +16 -42
- package/es/plugins/UpdateModelPlugin.d.ts +0 -1
- package/es/plugins/UpdateModelPlugin.js +2 -5
- package/es/plugins/UpdateStyleAttributePlugin.d.ts +2 -5
- package/es/plugins/UpdateStyleAttributePlugin.js +2 -6
- package/es/plugins/index.d.ts +15 -0
- package/es/plugins/index.js +18 -0
- package/es/point/models/fill.d.ts +1 -1
- package/es/point/models/fill.js +6 -9
- package/es/point/models/fillImage.js +4 -3
- package/es/point/models/image.js +4 -3
- package/es/polygon/models/extrude.js +0 -1
- package/es/polygon/models/ocean.js +1 -2
- package/es/polygon/models/water.js +0 -2
- package/es/tile/core/BaseLayer.js +4 -5
- package/es/tile/interaction/getRasterData.js +0 -2
- package/es/tile/service/TileLayerService.d.ts +0 -1
- package/es/tile/service/TileLayerService.js +0 -1
- package/es/tile/service/TilePickService.d.ts +1 -1
- package/es/tile/service/TilePickService.js +2 -3
- package/es/tile/tile/Tile.js +8 -6
- package/lib/canvas/index.js +63 -37
- package/lib/canvas/models/canvas.js +125 -138
- package/lib/canvas/models/constants.js +12 -0
- package/lib/canvas/models/index.js +22 -7
- package/lib/core/BaseLayer.js +88 -62
- package/lib/core/BaseModel.js +14 -28
- package/lib/core/LayerPickService.js +4 -5
- package/lib/core/TextureService.js +1 -2
- package/lib/core/shape/arrow.js +2 -6
- package/lib/heatmap/models/heatmap.js +2 -5
- package/lib/index.js +9 -90
- package/lib/line/models/arc.js +4 -4
- package/lib/line/models/arc_3d.js +4 -3
- package/lib/line/models/great_circle.js +4 -4
- package/lib/line/models/line.js +5 -8
- package/lib/line/models/simple_line.js +0 -1
- package/lib/line/models/wall.js +4 -3
- package/lib/plugins/DataMappingPlugin.js +7 -22
- package/lib/plugins/DataSourcePlugin.js +3 -6
- package/lib/plugins/FeatureScalePlugin.js +4 -6
- package/lib/plugins/LayerAnimateStylePlugin.js +2 -5
- package/lib/plugins/LayerMaskPlugin.js +2 -8
- package/lib/plugins/LayerModelPlugin.js +13 -18
- package/lib/plugins/LayerStylePlugin.js +2 -5
- package/lib/plugins/LightingPlugin.js +2 -5
- package/lib/plugins/MultiPassRendererPlugin.js +2 -5
- package/lib/plugins/PixelPickingPlugin.js +4 -9
- package/lib/plugins/RegisterStyleAttributePlugin.js +2 -5
- package/lib/plugins/ShaderUniformPlugin.js +15 -41
- package/lib/plugins/UpdateModelPlugin.js +2 -5
- package/lib/plugins/UpdateStyleAttributePlugin.js +2 -5
- package/lib/plugins/index.js +26 -0
- package/lib/point/models/fill.js +6 -9
- package/lib/point/models/fillImage.js +4 -3
- package/lib/point/models/image.js +4 -3
- package/lib/polygon/models/extrude.js +0 -1
- package/lib/polygon/models/ocean.js +0 -1
- package/lib/polygon/models/water.js +0 -2
- package/lib/tile/core/BaseLayer.js +4 -5
- package/lib/tile/interaction/getRasterData.js +0 -2
- package/lib/tile/service/TileLayerService.js +0 -1
- package/lib/tile/service/TilePickService.js +2 -3
- package/lib/tile/tile/Tile.js +8 -6
- package/package.json +18 -20
package/es/core/BaseLayer.js
CHANGED
|
@@ -2,7 +2,6 @@ import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
3
|
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
4
4
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
5
|
-
import _initializerDefineProperty from "@babel/runtime/helpers/esm/initializerDefineProperty";
|
|
6
5
|
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
7
6
|
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
8
7
|
import _assertThisInitialized from "@babel/runtime/helpers/esm/assertThisInitialized";
|
|
@@ -10,11 +9,8 @@ import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
|
10
9
|
import _possibleConstructorReturn from "@babel/runtime/helpers/esm/possibleConstructorReturn";
|
|
11
10
|
import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
|
|
12
11
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
13
|
-
import _applyDecoratedDescriptor from "@babel/runtime/helpers/esm/applyDecoratedDescriptor";
|
|
14
|
-
import _initializerWarningHelper from "@babel/runtime/helpers/esm/initializerWarningHelper";
|
|
15
12
|
var _excluded = ["passes"],
|
|
16
13
|
_excluded2 = ["moduleName", "vertexShader", "fragmentShader", "inject", "triangulation", "styleOption", "pickingEnabled"];
|
|
17
|
-
var _dec, _class, _descriptor;
|
|
18
14
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
19
15
|
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; } } }; }
|
|
20
16
|
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); }
|
|
@@ -23,10 +19,10 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
|
|
|
23
19
|
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; } }
|
|
24
20
|
// @ts-ignore
|
|
25
21
|
import { AsyncSeriesBailHook, AsyncWaterfallHook, SyncBailHook, SyncHook } from '@antv/async-hook';
|
|
26
|
-
import { BlendType, IDebugLog, ILayerStage,
|
|
27
|
-
import Source from '@antv/l7-source';
|
|
22
|
+
import { BlendType, IDebugLog, ILayerStage, globalConfigService } from '@antv/l7-core';
|
|
28
23
|
import { encodePickingColor, lodashUtil } from '@antv/l7-utils';
|
|
29
24
|
import { EventEmitter } from 'eventemitter3';
|
|
25
|
+
import { createPlugins } from "../plugins";
|
|
30
26
|
import { BlendTypes } from "../utils/blend";
|
|
31
27
|
import { createMultiPassRenderer, normalizePasses } from "../utils/multiPassRender";
|
|
32
28
|
import LayerPickService from "./LayerPickService";
|
|
@@ -41,7 +37,7 @@ var isEqual = lodashUtil.isEqual,
|
|
|
41
37
|
* 分配 layer id
|
|
42
38
|
*/
|
|
43
39
|
var layerIdCounter = 0;
|
|
44
|
-
var BaseLayer =
|
|
40
|
+
var BaseLayer = /*#__PURE__*/function (_ref) {
|
|
45
41
|
_inherits(BaseLayer, _ref);
|
|
46
42
|
var _super = _createSuper(BaseLayer);
|
|
47
43
|
function BaseLayer() {
|
|
@@ -97,7 +93,7 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
97
93
|
// 用于保存子图层对象
|
|
98
94
|
_defineProperty(_assertThisInitialized(_this), "layerChildren", []);
|
|
99
95
|
_defineProperty(_assertThisInitialized(_this), "masks", []);
|
|
100
|
-
|
|
96
|
+
_defineProperty(_assertThisInitialized(_this), "configService", globalConfigService);
|
|
101
97
|
_defineProperty(_assertThisInitialized(_this), "animateOptions", {
|
|
102
98
|
enable: false
|
|
103
99
|
});
|
|
@@ -133,9 +129,70 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
133
129
|
_this.name = config.name || _this.id;
|
|
134
130
|
_this.zIndex = config.zIndex || 0;
|
|
135
131
|
_this.rawConfig = config;
|
|
132
|
+
_this.masks = config.maskLayers || [];
|
|
136
133
|
return _this;
|
|
137
134
|
}
|
|
138
135
|
_createClass(BaseLayer, [{
|
|
136
|
+
key: "shaderModuleService",
|
|
137
|
+
get: function get() {
|
|
138
|
+
return this.container.shaderModuleService;
|
|
139
|
+
}
|
|
140
|
+
}, {
|
|
141
|
+
key: "cameraService",
|
|
142
|
+
get: function get() {
|
|
143
|
+
return this.container.cameraService;
|
|
144
|
+
}
|
|
145
|
+
}, {
|
|
146
|
+
key: "coordinateService",
|
|
147
|
+
get: function get() {
|
|
148
|
+
return this.container.coordinateSystemService;
|
|
149
|
+
}
|
|
150
|
+
}, {
|
|
151
|
+
key: "iconService",
|
|
152
|
+
get: function get() {
|
|
153
|
+
return this.container.iconService;
|
|
154
|
+
}
|
|
155
|
+
}, {
|
|
156
|
+
key: "fontService",
|
|
157
|
+
get: function get() {
|
|
158
|
+
return this.container.fontService;
|
|
159
|
+
}
|
|
160
|
+
}, {
|
|
161
|
+
key: "pickingService",
|
|
162
|
+
get: function get() {
|
|
163
|
+
return this.container.pickingService;
|
|
164
|
+
}
|
|
165
|
+
}, {
|
|
166
|
+
key: "rendererService",
|
|
167
|
+
get: function get() {
|
|
168
|
+
return this.container.rendererService;
|
|
169
|
+
}
|
|
170
|
+
}, {
|
|
171
|
+
key: "layerService",
|
|
172
|
+
get: function get() {
|
|
173
|
+
return this.container.layerService;
|
|
174
|
+
}
|
|
175
|
+
}, {
|
|
176
|
+
key: "debugService",
|
|
177
|
+
get: function get() {
|
|
178
|
+
return this.container.debugService;
|
|
179
|
+
}
|
|
180
|
+
}, {
|
|
181
|
+
key: "interactionService",
|
|
182
|
+
get: function get() {
|
|
183
|
+
return this.container.interactionService;
|
|
184
|
+
}
|
|
185
|
+
}, {
|
|
186
|
+
key: "mapService",
|
|
187
|
+
get: function get() {
|
|
188
|
+
return this.container.mapService;
|
|
189
|
+
}
|
|
190
|
+
}, {
|
|
191
|
+
key: "normalPassFactory",
|
|
192
|
+
get: function get() {
|
|
193
|
+
return this.container.normalPassFactory;
|
|
194
|
+
}
|
|
195
|
+
}, {
|
|
139
196
|
key: "addMask",
|
|
140
197
|
value: function addMask(layer) {
|
|
141
198
|
this.masks.push(layer);
|
|
@@ -217,7 +274,7 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
217
274
|
if (!this.startInit) {
|
|
218
275
|
this.needUpdateConfig = _objectSpread(_objectSpread({}, this.needUpdateConfig), configToUpdate);
|
|
219
276
|
} else {
|
|
220
|
-
var sceneId = this.container.
|
|
277
|
+
var sceneId = this.container.id;
|
|
221
278
|
// @ts-ignore
|
|
222
279
|
// styleDataMapping(configToUpdate, this); // 处理 style 中进行数据映射的属性字段
|
|
223
280
|
this.configService.setLayerConfig(sceneId, this.id, _objectSpread(_objectSpread(_objectSpread({}, this.configService.getLayerConfig(this.id)), this.needUpdateConfig), configToUpdate));
|
|
@@ -233,9 +290,8 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
233
290
|
*/
|
|
234
291
|
}, {
|
|
235
292
|
key: "setContainer",
|
|
236
|
-
value: function setContainer(container
|
|
293
|
+
value: function setContainer(container) {
|
|
237
294
|
this.container = container;
|
|
238
|
-
this.sceneContainer = sceneContainer;
|
|
239
295
|
}
|
|
240
296
|
}, {
|
|
241
297
|
key: "getContainer",
|
|
@@ -258,7 +314,7 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
258
314
|
while (1) switch (_context.prev = _context.next) {
|
|
259
315
|
case 0:
|
|
260
316
|
// 设置配置项
|
|
261
|
-
sceneId = this.container.
|
|
317
|
+
sceneId = this.container.id;
|
|
262
318
|
this.startInit = true;
|
|
263
319
|
// 初始化图层配置项
|
|
264
320
|
// const { enableMultiPassRenderer = false } = this.rawConfig;
|
|
@@ -271,14 +327,6 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
271
327
|
// 全局容器服务
|
|
272
328
|
|
|
273
329
|
// 场景容器服务
|
|
274
|
-
this.iconService = this.container.get(TYPES.IIconService);
|
|
275
|
-
this.fontService = this.container.get(TYPES.IFontService);
|
|
276
|
-
this.rendererService = this.container.get(TYPES.IRendererService);
|
|
277
|
-
this.layerService = this.container.get(TYPES.ILayerService);
|
|
278
|
-
this.debugService = this.container.get(TYPES.IDebugService);
|
|
279
|
-
this.interactionService = this.container.get(TYPES.IInteractionService);
|
|
280
|
-
this.pickingService = this.container.get(TYPES.IPickingService);
|
|
281
|
-
this.mapService = this.container.get(TYPES.IMapService);
|
|
282
330
|
_this$getLayerConfig = this.getLayerConfig(), enableMultiPassRenderer = _this$getLayerConfig.enableMultiPassRenderer, passes = _this$getLayerConfig.passes;
|
|
283
331
|
if (enableMultiPassRenderer && passes !== null && passes !== void 0 && passes.length && passes.length > 0) {
|
|
284
332
|
// Tip: 兼容 multiPassRender 在 amap1 时存在的图层不同步问题 zoom
|
|
@@ -286,17 +334,13 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
286
334
|
_this3.renderLayers();
|
|
287
335
|
});
|
|
288
336
|
}
|
|
289
|
-
this.
|
|
290
|
-
this.coordinateService = this.container.get(TYPES.ICoordinateSystemService);
|
|
291
|
-
this.shaderModuleService = this.container.get(TYPES.IShaderModuleService);
|
|
292
|
-
this.postProcessingPassFactory = this.container.get(TYPES.IFactoryPostProcessingPass);
|
|
293
|
-
this.normalPassFactory = this.container.get(TYPES.IFactoryNormalPass);
|
|
337
|
+
this.postProcessingPassFactory = this.container.postProcessingPassFactory;
|
|
294
338
|
|
|
295
339
|
// 图层容器服务
|
|
296
|
-
this.styleAttributeService = this.container.
|
|
340
|
+
this.styleAttributeService = this.container.styleAttributeService;
|
|
297
341
|
if (enableMultiPassRenderer) {
|
|
298
342
|
// 按需初始化 瓦片频繁报错
|
|
299
|
-
this.multiPassRenderer = this.container.
|
|
343
|
+
this.multiPassRenderer = this.container.multiPassRenderer;
|
|
300
344
|
this.multiPassRenderer.setLayer(this);
|
|
301
345
|
}
|
|
302
346
|
// 完成样式服务注册完成前添加的属性
|
|
@@ -322,20 +366,17 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
322
366
|
this.pendingStyleAttributes = [];
|
|
323
367
|
|
|
324
368
|
// 获取插件集
|
|
325
|
-
this.plugins =
|
|
369
|
+
this.plugins = createPlugins();
|
|
326
370
|
// 完成插件注册,传入场景和图层容器内的服务
|
|
327
371
|
_iterator = _createForOfIteratorHelper(this.plugins);
|
|
328
372
|
try {
|
|
329
373
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
330
374
|
plugin = _step.value;
|
|
331
|
-
plugin.apply(this,
|
|
332
|
-
rendererService: this.rendererService,
|
|
333
|
-
mapService: this.mapService,
|
|
334
|
-
styleAttributeService: this.styleAttributeService,
|
|
335
|
-
normalPassFactory: this.normalPassFactory,
|
|
336
|
-
postProcessingPassFactory: this.postProcessingPassFactory
|
|
337
|
-
});
|
|
375
|
+
plugin.apply(this, this.container);
|
|
338
376
|
}
|
|
377
|
+
// if (this.getSource().isTile) {
|
|
378
|
+
// this.tileLayer = new TileLayer(this);
|
|
379
|
+
// }
|
|
339
380
|
|
|
340
381
|
// 初始化其他服务
|
|
341
382
|
} catch (err) {
|
|
@@ -349,9 +390,9 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
349
390
|
this.textureService = new TextureService(this);
|
|
350
391
|
this.log(IDebugLog.LayerInitStart);
|
|
351
392
|
// 触发 init 生命周期插件
|
|
352
|
-
_context.next =
|
|
393
|
+
_context.next = 19;
|
|
353
394
|
return this.hooks.init.promise();
|
|
354
|
-
case
|
|
395
|
+
case 19:
|
|
355
396
|
this.log(IDebugLog.LayerInitEnd);
|
|
356
397
|
this.inited = true;
|
|
357
398
|
// add mask layer
|
|
@@ -365,7 +406,7 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
365
406
|
type: 'add'
|
|
366
407
|
});
|
|
367
408
|
this.hooks.afterInit.call();
|
|
368
|
-
case
|
|
409
|
+
case 24:
|
|
369
410
|
case "end":
|
|
370
411
|
return _context.stop();
|
|
371
412
|
}
|
|
@@ -517,25 +558,17 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
517
558
|
key: "setData",
|
|
518
559
|
value: function setData(data, options) {
|
|
519
560
|
var _this4 = this;
|
|
561
|
+
this.log(IDebugLog.SourceInitStart, ILayerStage.UPDATE);
|
|
520
562
|
if (this.inited) {
|
|
521
|
-
this.log(IDebugLog.SourceInitStart, ILayerStage.UPDATE);
|
|
522
563
|
this.layerSource.setData(data, options);
|
|
523
|
-
this.log(IDebugLog.SourceInitEnd, ILayerStage.UPDATE);
|
|
524
564
|
} else {
|
|
525
565
|
this.on('inited', function () {
|
|
526
|
-
_this4.
|
|
527
|
-
var currentSource = _this4.getSource();
|
|
528
|
-
if (!currentSource) {
|
|
529
|
-
// 执行 setData 的时候 source 还不存在(还未执行 addLayer)
|
|
530
|
-
_this4.source(new Source(data, options));
|
|
531
|
-
} else {
|
|
532
|
-
_this4.layerSource.setData(data, options);
|
|
533
|
-
}
|
|
534
|
-
_this4.layerSource.once('update', function () {
|
|
535
|
-
_this4.log(IDebugLog.SourceInitEnd, ILayerStage.UPDATE);
|
|
536
|
-
});
|
|
566
|
+
_this4.layerSource.setData(data, options);
|
|
537
567
|
});
|
|
538
568
|
}
|
|
569
|
+
this.layerSource.once('update', function () {
|
|
570
|
+
_this4.log(IDebugLog.SourceInitEnd, ILayerStage.UPDATE);
|
|
571
|
+
});
|
|
539
572
|
return this;
|
|
540
573
|
}
|
|
541
574
|
}, {
|
|
@@ -1018,8 +1051,6 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
1018
1051
|
});
|
|
1019
1052
|
this.removeAllListeners();
|
|
1020
1053
|
this.isDestroyed = true;
|
|
1021
|
-
// 解绑图层容器中的服务
|
|
1022
|
-
// this.container.unbind(TYPES.IStyleAttributeService);
|
|
1023
1054
|
}
|
|
1024
1055
|
}, {
|
|
1025
1056
|
key: "clear",
|
|
@@ -1115,11 +1146,11 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
1115
1146
|
}, {
|
|
1116
1147
|
key: "getLegend",
|
|
1117
1148
|
value: function getLegend(name) {
|
|
1118
|
-
var _attribute$scale, _scales
|
|
1149
|
+
var _attribute$scale, _scales$, _attribute$scale2;
|
|
1119
1150
|
var attribute = this.styleAttributeService.getLayerStyleAttribute(name);
|
|
1120
1151
|
var scales = (attribute === null || attribute === void 0 || (_attribute$scale = attribute.scale) === null || _attribute$scale === void 0 ? void 0 : _attribute$scale.scalers) || [];
|
|
1121
1152
|
return {
|
|
1122
|
-
type: (_scales$
|
|
1153
|
+
type: (_scales$ = scales[0]) === null || _scales$ === void 0 || (_scales$ = _scales$.option) === null || _scales$ === void 0 ? void 0 : _scales$.type,
|
|
1123
1154
|
field: attribute === null || attribute === void 0 || (_attribute$scale2 = attribute.scale) === null || _attribute$scale2 === void 0 ? void 0 : _attribute$scale2.field,
|
|
1124
1155
|
items: this.getLegendItems(name)
|
|
1125
1156
|
};
|
|
@@ -1194,7 +1225,7 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
1194
1225
|
_this$shaderModuleSer = this.shaderModuleService.getModule(moduleName), vs = _this$shaderModuleSer.vs, fs = _this$shaderModuleSer.fs, uniforms = _this$shaderModuleSer.uniforms;
|
|
1195
1226
|
createModel = this.rendererService.createModel;
|
|
1196
1227
|
return _context3.abrupt("return", new Promise(function (resolve) {
|
|
1197
|
-
var _this10$styleAttribut = _this10.styleAttributeService.createAttributesAndIndices(_this10.encodedData, triangulation, styleOption),
|
|
1228
|
+
var _this10$styleAttribut = _this10.styleAttributeService.createAttributesAndIndices(_this10.encodedData, triangulation, styleOption, _this10),
|
|
1198
1229
|
attributes = _this10$styleAttribut.attributes,
|
|
1199
1230
|
elements = _this10$styleAttribut.elements,
|
|
1200
1231
|
count = _this10$styleAttribut.count;
|
|
@@ -1524,10 +1555,5 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
1524
1555
|
}
|
|
1525
1556
|
}]);
|
|
1526
1557
|
return BaseLayer;
|
|
1527
|
-
}(EventEmitter)
|
|
1528
|
-
configurable: true,
|
|
1529
|
-
enumerable: true,
|
|
1530
|
-
writable: true,
|
|
1531
|
-
initializer: null
|
|
1532
|
-
})), _class));
|
|
1558
|
+
}(EventEmitter);
|
|
1533
1559
|
export { BaseLayer as default };
|
package/es/core/BaseModel.js
CHANGED
|
@@ -1,15 +1,11 @@
|
|
|
1
1
|
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
2
2
|
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
3
3
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
4
|
-
import _initializerDefineProperty from "@babel/runtime/helpers/esm/initializerDefineProperty";
|
|
5
4
|
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
6
5
|
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
7
6
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
8
|
-
import _applyDecoratedDescriptor from "@babel/runtime/helpers/esm/applyDecoratedDescriptor";
|
|
9
|
-
import _initializerWarningHelper from "@babel/runtime/helpers/esm/initializerWarningHelper";
|
|
10
|
-
var _dec, _class, _descriptor;
|
|
11
7
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
12
|
-
import { BlendType,
|
|
8
|
+
import { BlendType, MaskOperation, StencilType } from '@antv/l7-core';
|
|
13
9
|
import { rgb2arr } from '@antv/l7-utils';
|
|
14
10
|
import { BlendTypes } from "../utils/blend";
|
|
15
11
|
import { getStencil as _getStencil, getStencilMask } from "../utils/stencil";
|
|
@@ -26,14 +22,9 @@ var shaderLocationMap = {
|
|
|
26
22
|
};
|
|
27
23
|
|
|
28
24
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
29
|
-
var BaseModel =
|
|
30
|
-
//
|
|
31
|
-
//
|
|
32
|
-
|
|
33
|
-
// @lazyInject(TYPES.IFontService)
|
|
34
|
-
// protected readonly fontService: IFontService;
|
|
35
|
-
|
|
36
|
-
// @lazyInject(TYPES.IShaderModuleService)
|
|
25
|
+
var BaseModel = /*#__PURE__*/function () {
|
|
26
|
+
// 用于数据传递的数据纹理
|
|
27
|
+
// 默认有多少列(宽度)
|
|
37
28
|
|
|
38
29
|
// 支持数据映射的buffer
|
|
39
30
|
// 不支持数据映射的buffer
|
|
@@ -46,17 +37,17 @@ var BaseModel = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
46
37
|
_defineProperty(this, "textures", []);
|
|
47
38
|
_defineProperty(this, "preStyleAttribute", {});
|
|
48
39
|
_defineProperty(this, "encodeStyleAttribute", {});
|
|
49
|
-
_initializerDefineProperty(this, "configService", _descriptor, this);
|
|
50
40
|
this.layer = layer;
|
|
51
|
-
this.
|
|
52
|
-
this.
|
|
53
|
-
this.
|
|
54
|
-
this.
|
|
55
|
-
this.
|
|
56
|
-
this.
|
|
57
|
-
this.
|
|
58
|
-
this.
|
|
59
|
-
this.
|
|
41
|
+
this.configService = layer.getContainer().globalConfigService;
|
|
42
|
+
this.rendererService = layer.getContainer().rendererService;
|
|
43
|
+
this.pickingService = layer.getContainer().pickingService;
|
|
44
|
+
this.shaderModuleService = layer.getContainer().shaderModuleService;
|
|
45
|
+
this.styleAttributeService = layer.getContainer().styleAttributeService;
|
|
46
|
+
this.mapService = layer.getContainer().mapService;
|
|
47
|
+
this.iconService = layer.getContainer().iconService;
|
|
48
|
+
this.fontService = layer.getContainer().fontService;
|
|
49
|
+
this.cameraService = layer.getContainer().cameraService;
|
|
50
|
+
this.layerService = layer.getContainer().layerService;
|
|
60
51
|
// 初始化支持数据映射的 Style 属性
|
|
61
52
|
|
|
62
53
|
this.registerStyleAttribute();
|
|
@@ -388,10 +379,5 @@ var BaseModel = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
388
379
|
}
|
|
389
380
|
}]);
|
|
390
381
|
return BaseModel;
|
|
391
|
-
}()
|
|
392
|
-
configurable: true,
|
|
393
|
-
enumerable: true,
|
|
394
|
-
writable: true,
|
|
395
|
-
initializer: null
|
|
396
|
-
})), _class));
|
|
382
|
+
}();
|
|
397
383
|
export { BaseModel as default };
|
|
@@ -4,7 +4,6 @@ import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
|
4
4
|
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
5
5
|
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
6
6
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
7
|
-
import { TYPES } from '@antv/l7-core';
|
|
8
7
|
import { lngLatInExtent } from '@antv/l7-utils';
|
|
9
8
|
var BaseLayerPickService = /*#__PURE__*/function () {
|
|
10
9
|
function BaseLayerPickService(layer) {
|
|
@@ -15,7 +14,7 @@ var BaseLayerPickService = /*#__PURE__*/function () {
|
|
|
15
14
|
key: "pickRender",
|
|
16
15
|
value: function pickRender(target) {
|
|
17
16
|
var container = this.layer.getContainer();
|
|
18
|
-
var layerService = container.
|
|
17
|
+
var layerService = container.layerService;
|
|
19
18
|
var layer = this.layer;
|
|
20
19
|
// 瓦片图层的拾取绘制
|
|
21
20
|
if (layer.tileLayer) {
|
|
@@ -38,7 +37,7 @@ var BaseLayerPickService = /*#__PURE__*/function () {
|
|
|
38
37
|
while (1) switch (_context.prev = _context.next) {
|
|
39
38
|
case 0:
|
|
40
39
|
container = this.layer.getContainer();
|
|
41
|
-
pickingService = container.
|
|
40
|
+
pickingService = container.pickingService;
|
|
42
41
|
if (!(layer.type === 'RasterLayer')) {
|
|
43
42
|
_context.next = 4;
|
|
44
43
|
break;
|
|
@@ -62,8 +61,8 @@ var BaseLayerPickService = /*#__PURE__*/function () {
|
|
|
62
61
|
key: "pickRasterLayer",
|
|
63
62
|
value: function pickRasterLayer(layer, target, parent) {
|
|
64
63
|
var container = this.layer.getContainer();
|
|
65
|
-
var pickingService = container.
|
|
66
|
-
var mapService = container.
|
|
64
|
+
var pickingService = container.pickingService;
|
|
65
|
+
var mapService = container.mapService;
|
|
67
66
|
var extent = this.layer.getSource().extent;
|
|
68
67
|
var isPick = lngLatInExtent(target.lngLat, extent);
|
|
69
68
|
var layerTarget = {
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
2
2
|
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
3
|
-
import { TYPES } from '@antv/l7-core';
|
|
4
3
|
import { generateCatRamp, generateColorRamp, generateCustomRamp, generateLinearRamp, generateQuantizeRamp } from '@antv/l7-utils';
|
|
5
4
|
var TextureService = /*#__PURE__*/function () {
|
|
6
5
|
function TextureService(layer) {
|
|
7
6
|
_classCallCheck(this, TextureService);
|
|
8
7
|
this.layer = layer;
|
|
9
8
|
var container = this.layer.getContainer();
|
|
10
|
-
this.rendererService = container.
|
|
9
|
+
this.rendererService = container.rendererService;
|
|
11
10
|
}
|
|
12
11
|
_createClass(TextureService, [{
|
|
13
12
|
key: "getColorTexture",
|
package/es/core/interface.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { IAnimateOption, IMapService, ITexture2D, StyleAttributeField, StyleAttributeOption } from '@antv/l7-core';
|
|
2
2
|
import type { IColorRamp } from '@antv/l7-utils';
|
|
3
|
+
import type { CanvasModelType } from '../canvas/models';
|
|
3
4
|
import type { anchorType } from '../utils/symbol-layout';
|
|
4
5
|
export declare enum lineStyleType {
|
|
5
6
|
'solid' = 0,
|
|
@@ -199,10 +200,36 @@ export interface IDrawingOnCanvas {
|
|
|
199
200
|
mapService: IMapService;
|
|
200
201
|
size: [number, number];
|
|
201
202
|
}
|
|
202
|
-
export interface
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
203
|
+
export interface ICanvasLayerRenderParams {
|
|
204
|
+
canvas: HTMLCanvasElement;
|
|
205
|
+
ctx: RenderingContext;
|
|
206
|
+
container: {
|
|
207
|
+
width: number;
|
|
208
|
+
height: number;
|
|
209
|
+
bounds: [[number, number], [number, number]];
|
|
210
|
+
};
|
|
211
|
+
size: [number, number];
|
|
212
|
+
utils: {
|
|
213
|
+
lngLatToContainer: IMapService['lngLatToContainer'];
|
|
214
|
+
};
|
|
215
|
+
mapService: IMapService;
|
|
216
|
+
}
|
|
217
|
+
export interface ICanvasLayerOptions {
|
|
218
|
+
zIndex?: number;
|
|
219
|
+
contextType?: CanvasModelType;
|
|
220
|
+
getContext?: (canvas: HTMLCanvasElement) => RenderingContext;
|
|
221
|
+
trigger?: 'end' | 'change';
|
|
222
|
+
/**
|
|
223
|
+
* @deprecated
|
|
224
|
+
* @alias trigger
|
|
225
|
+
*/
|
|
226
|
+
update?: CanvasUpdateType | string;
|
|
227
|
+
draw?: (renderParams: ICanvasLayerRenderParams) => void;
|
|
228
|
+
/**
|
|
229
|
+
* @deprecated
|
|
230
|
+
* @alias draw
|
|
231
|
+
*/
|
|
232
|
+
drawingOnCanvas?: (renderParams: ICanvasLayerRenderParams) => void;
|
|
206
233
|
}
|
|
207
234
|
export interface IHeatMapLayerStyleOptions extends IBaseLayerStyleOptions {
|
|
208
235
|
intensity: number;
|
package/es/core/shape/arrow.js
CHANGED
|
@@ -110,14 +110,10 @@ export function lineArrowPath(coord) {
|
|
|
110
110
|
var targetType = _typeof(symbol['target']) === 'object' ? symbol['target'].type : symbol['target'];
|
|
111
111
|
var _ref = _typeof(symbol['source']) === 'object' ? symbol['source'] : {},
|
|
112
112
|
_ref$width = _ref.width,
|
|
113
|
-
sourceWidth = _ref$width === void 0 ? sourceType ? maxArrowWidthMap[sourceType] : 0 : _ref$width
|
|
114
|
-
_ref$height = _ref.height,
|
|
115
|
-
sourceHeight = _ref$height === void 0 ? 2 : _ref$height;
|
|
113
|
+
sourceWidth = _ref$width === void 0 ? sourceType ? maxArrowWidthMap[sourceType] : 0 : _ref$width;
|
|
116
114
|
var _ref2 = _typeof(symbol['target']) === 'object' ? symbol['target'] : {},
|
|
117
115
|
_ref2$width = _ref2.width,
|
|
118
|
-
targetWidth = _ref2$width === void 0 ? targetType ? maxArrowWidthMap[targetType] : 0 : _ref2$width
|
|
119
|
-
_ref2$height = _ref2.height,
|
|
120
|
-
targetHeight = _ref2$height === void 0 ? 2 : _ref2$height;
|
|
116
|
+
targetWidth = _ref2$width === void 0 ? targetType ? maxArrowWidthMap[targetType] : 0 : _ref2$width;
|
|
121
117
|
return {
|
|
122
118
|
vertices: [0, PathHeight, 1 * sourceWidth].concat(_toConsumableArray(coord), [1, PathHeight, -1 * targetWidth], _toConsumableArray(coord), [1, -PathHeight, -1 * targetWidth], _toConsumableArray(coord), [0, -PathHeight, 1 * sourceWidth], _toConsumableArray(coord), [0, PathHeight, 1 * sourceWidth], _toConsumableArray(coord), [1, PathHeight, -1 * targetWidth], _toConsumableArray(coord), [1, -PathHeight, -1 * targetWidth], _toConsumableArray(coord), [0, -PathHeight, 1 * sourceWidth], _toConsumableArray(coord)),
|
|
123
119
|
outLineIndices: [0, 1, 2, 0, 2, 3].map(function (t) {
|
|
@@ -8,15 +8,12 @@ import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
|
8
8
|
import _possibleConstructorReturn from "@babel/runtime/helpers/esm/possibleConstructorReturn";
|
|
9
9
|
import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
|
|
10
10
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
11
|
-
var _dec, _class;
|
|
12
11
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
13
12
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
14
13
|
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; } }
|
|
15
14
|
import { AttributeType, TextureUsage, gl } from '@antv/l7-core';
|
|
16
15
|
import { generateColorRamp, getCullFace, lodashUtil } from '@antv/l7-utils';
|
|
17
16
|
import { mat4 } from 'gl-matrix';
|
|
18
|
-
import { injectable } from 'inversify';
|
|
19
|
-
import 'reflect-metadata';
|
|
20
17
|
import BaseModel from "../../core/BaseModel";
|
|
21
18
|
import { HeatmapTriangulation } from "../../core/triangulation";
|
|
22
19
|
/* babel-plugin-inline-import '../shaders/heatmap/heatmap_3d_frag.glsl' */
|
|
@@ -34,7 +31,7 @@ var heatmap_framebuffer_frag = "layout(std140) uniform commonUniforms {\n float
|
|
|
34
31
|
var heatmap_framebuffer_vert = "layout(location = 0) in vec3 a_Position;\nlayout(location = 9) in float a_Size;\nlayout(location = 10) in vec2 a_Dir;\n\n\nlayout(std140) uniform commonUniforms {\n float u_radius;\n float u_intensity;\n float u_common_uniforms_padding1;\n float u_common_uniforms_padding2;\n};\n\nout vec2 v_extrude;\nout float v_weight;\n\n#define GAUSS_COEF 0.3989422804014327\n\n#pragma include \"projection\"\n#pragma include \"picking\"\n\nvoid main(){\n vec3 picking_color_placeholder = u_PickingColor;\n\n v_weight = a_Size;\n float ZERO = 1.0 / 255.0 / 16.0;\n float extrude_x = a_Dir.x * 2.0 -1.0;\n float extrude_y = a_Dir.y * 2.0 -1.0;\n vec2 extrude_dir = normalize(vec2(extrude_x,extrude_y));\n float S = sqrt(-2.0 * log(ZERO / a_Size / u_intensity / GAUSS_COEF)) / 2.5;\n v_extrude = extrude_dir * S;\n\n vec2 offset = project_pixel(v_extrude * u_radius);\n vec4 project_pos = project_position(vec4(a_Position.xy, 0.0, 1.0));\n\n // gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, 0.0, 1.0));\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n gl_Position = u_Mvp * (vec4(project_pos.xy + offset, 0.0, 1.0));\n } else {\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, 0.0, 1.0));\n }\n}\n";
|
|
35
32
|
import { heatMap3DTriangulation } from "../triangulation";
|
|
36
33
|
var isEqual = lodashUtil.isEqual;
|
|
37
|
-
var HeatMapModel =
|
|
34
|
+
var HeatMapModel = /*#__PURE__*/function (_BaseModel) {
|
|
38
35
|
_inherits(HeatMapModel, _BaseModel);
|
|
39
36
|
var _super = _createSuper(HeatMapModel);
|
|
40
37
|
function HeatMapModel() {
|
|
@@ -491,5 +488,5 @@ var HeatMapModel = (_dec = injectable(), _dec(_class = /*#__PURE__*/function (_B
|
|
|
491
488
|
}
|
|
492
489
|
}]);
|
|
493
490
|
return HeatMapModel;
|
|
494
|
-
}(BaseModel)
|
|
491
|
+
}(BaseModel);
|
|
495
492
|
export { HeatMapModel as default };
|
package/es/index.d.ts
CHANGED
|
@@ -9,9 +9,10 @@ import LineLayer from './line/index';
|
|
|
9
9
|
import PointLayer from './point';
|
|
10
10
|
import PolygonLayer from './polygon';
|
|
11
11
|
import RasterLayer from './raster';
|
|
12
|
+
import TileLayer from './tile/core/BaseLayer';
|
|
12
13
|
import TileDebugLayer from './tile/core/TileDebugLayer';
|
|
13
14
|
import EarthLayer from './earth';
|
|
14
15
|
import MaskLayer from './mask';
|
|
15
16
|
import WindLayer from './wind';
|
|
16
17
|
export * from './core/interface';
|
|
17
|
-
export { BaseLayer, BaseModel,
|
|
18
|
+
export { BaseLayer, BaseModel, CanvasLayer, CityBuildingLayer, EarthLayer, GeometryLayer, HeatmapLayer, ImageLayer, LineLayer, MaskLayer, PointLayer, PolygonLayer, RasterLayer, TileDebugLayer, TileLayer, WindLayer, };
|