@antv/l7-layers 2.20.20 → 2.21.1
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 +18 -19
- package/es/core/BaseLayer.js +134 -101
- package/es/core/BaseModel.js +15 -31
- package/es/core/LayerPickService.js +4 -6
- package/es/core/TextureService.js +1 -2
- package/es/core/interface.d.ts +31 -4
- package/es/core/shape/Path.js +1 -2
- package/es/core/shape/arrow.js +2 -6
- package/es/core/shape/extrude.js +0 -1
- package/es/core/triangulation.js +2 -2
- package/es/earth/models/base.js +0 -1
- package/es/heatmap/index.js +0 -1
- 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 -4
- package/es/line/models/great_circle.js +4 -4
- package/es/line/models/line.js +8 -12
- package/es/line/models/simple_line.js +1 -2
- package/es/line/models/wall.js +5 -4
- package/es/line/shaders/line/line_vert.glsl +0 -2
- package/es/line/shaders/wall/wall_vert.glsl +15 -0
- package/es/plugins/DataMappingPlugin.d.ts +4 -7
- package/es/plugins/DataMappingPlugin.js +8 -25
- 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 +5 -7
- 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 +6 -12
- 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 +17 -43
- 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 +7 -10
- 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/fill.js +2 -3
- package/es/polygon/models/index.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 -3
- 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/es/utils/blend.js +7 -8
- package/es/utils/polylineNormal.js +0 -1
- package/es/utils/rampcolor_legend.js +1 -2
- package/es/wind/index.js +0 -1
- 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 +134 -101
- package/lib/core/BaseModel.js +14 -30
- package/lib/core/LayerPickService.js +4 -6
- package/lib/core/TextureService.js +1 -2
- package/lib/core/shape/Path.js +1 -2
- package/lib/core/shape/arrow.js +2 -6
- package/lib/core/shape/extrude.js +0 -1
- package/lib/core/triangulation.js +2 -2
- package/lib/earth/models/base.js +0 -1
- package/lib/heatmap/index.js +0 -1
- 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 -4
- package/lib/line/models/great_circle.js +4 -4
- package/lib/line/models/line.js +10 -12
- package/lib/line/models/simple_line.js +0 -1
- package/lib/line/models/wall.js +5 -4
- package/lib/line/shaders/line/line_vert.glsl +0 -2
- package/lib/line/shaders/wall/wall_vert.glsl +15 -0
- package/lib/plugins/DataMappingPlugin.js +7 -24
- package/lib/plugins/DataSourcePlugin.js +3 -6
- package/lib/plugins/FeatureScalePlugin.js +5 -7
- 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 +6 -12
- package/lib/plugins/RegisterStyleAttributePlugin.js +2 -5
- package/lib/plugins/ShaderUniformPlugin.js +16 -42
- 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 +10 -13
- 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/fill.js +1 -2
- 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 -3
- 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/lib/utils/blend.js +7 -8
- package/lib/utils/polylineNormal.js +0 -1
- package/lib/utils/rampcolor_legend.js +1 -2
- package/lib/wind/index.js +0 -1
- 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
|
}
|
|
@@ -518,36 +559,35 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
518
559
|
value: function setData(data, options) {
|
|
519
560
|
var _this4 = this;
|
|
520
561
|
if (this.inited) {
|
|
521
|
-
this.
|
|
562
|
+
this.dataUpdatelog();
|
|
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
|
-
|
|
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.dataUpdatelog();
|
|
567
|
+
_this4.layerSource.setData(data, options);
|
|
537
568
|
});
|
|
538
569
|
}
|
|
539
570
|
return this;
|
|
540
571
|
}
|
|
572
|
+
}, {
|
|
573
|
+
key: "dataUpdatelog",
|
|
574
|
+
value: function dataUpdatelog() {
|
|
575
|
+
var _this5 = this;
|
|
576
|
+
this.log(IDebugLog.SourceInitStart, ILayerStage.UPDATE);
|
|
577
|
+
this.layerSource.once('update', function () {
|
|
578
|
+
_this5.log(IDebugLog.SourceInitEnd, ILayerStage.UPDATE);
|
|
579
|
+
});
|
|
580
|
+
}
|
|
541
581
|
}, {
|
|
542
582
|
key: "style",
|
|
543
583
|
value: function style(options) {
|
|
544
|
-
var
|
|
584
|
+
var _this6 = this;
|
|
545
585
|
var passes = options.passes,
|
|
546
586
|
rest = _objectWithoutProperties(options, _excluded);
|
|
547
587
|
// passes 特殊处理
|
|
548
588
|
if (passes) {
|
|
549
589
|
normalizePasses(passes).forEach(function (pass) {
|
|
550
|
-
var postProcessingPass =
|
|
590
|
+
var postProcessingPass = _this6.multiPassRenderer.getPostProcessor().getPostProcessingPassByName(pass[0]);
|
|
551
591
|
if (postProcessingPass) {
|
|
552
592
|
postProcessingPass.updateOptions(pass[1]);
|
|
553
593
|
}
|
|
@@ -586,22 +626,22 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
586
626
|
}, {
|
|
587
627
|
key: "encodeStyle",
|
|
588
628
|
value: function encodeStyle(options) {
|
|
589
|
-
var
|
|
629
|
+
var _this7 = this;
|
|
590
630
|
Object.keys(options).forEach(function (key) {
|
|
591
631
|
if (
|
|
592
632
|
// 需要数据映射
|
|
593
|
-
[].concat(_toConsumableArray(
|
|
633
|
+
[].concat(_toConsumableArray(_this7.enableShaderEncodeStyles), _toConsumableArray(_this7.enableDataEncodeStyles)).includes(key) && isPlainObject(options[key]) && (options[key].field || options[key].value) && !isEqual(_this7.encodeStyleAttribute[key], options[key]) // 防止计算属性重复计算
|
|
594
634
|
) {
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
if (
|
|
598
|
-
|
|
635
|
+
_this7.encodeStyleAttribute[key] = options[key];
|
|
636
|
+
_this7.updateStyleAttribute(key, options[key].field, options[key].value);
|
|
637
|
+
if (_this7.inited) {
|
|
638
|
+
_this7.dataState.dataMappingNeedUpdate = true;
|
|
599
639
|
}
|
|
600
640
|
} else {
|
|
601
641
|
// 不需要数据映射
|
|
602
|
-
if (
|
|
603
|
-
delete
|
|
604
|
-
|
|
642
|
+
if (_this7.encodeStyleAttribute[key]) {
|
|
643
|
+
delete _this7.encodeStyleAttribute[key]; // 删除已经存在的属性
|
|
644
|
+
_this7.dataState.dataSourceNeedUpdate = true;
|
|
605
645
|
}
|
|
606
646
|
}
|
|
607
647
|
});
|
|
@@ -658,7 +698,7 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
658
698
|
*/
|
|
659
699
|
}, {
|
|
660
700
|
key: "renderMultiPass",
|
|
661
|
-
value: function () {
|
|
701
|
+
value: (function () {
|
|
662
702
|
var _renderMultiPass = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
663
703
|
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
664
704
|
while (1) switch (_context2.prev = _context2.next) {
|
|
@@ -695,7 +735,7 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
695
735
|
return _renderMultiPass.apply(this, arguments);
|
|
696
736
|
}
|
|
697
737
|
return renderMultiPass;
|
|
698
|
-
}()
|
|
738
|
+
}())
|
|
699
739
|
}, {
|
|
700
740
|
key: "active",
|
|
701
741
|
value: function active(options) {
|
|
@@ -718,7 +758,7 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
718
758
|
}, {
|
|
719
759
|
key: "setActive",
|
|
720
760
|
value: function setActive(id, options) {
|
|
721
|
-
var
|
|
761
|
+
var _this8 = this;
|
|
722
762
|
if (isObject(id)) {
|
|
723
763
|
var _id$x = id.x,
|
|
724
764
|
x = _id$x === void 0 ? 0 : _id$x,
|
|
@@ -742,7 +782,7 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
742
782
|
// @ts-ignore
|
|
743
783
|
.then(function () {
|
|
744
784
|
setTimeout(function () {
|
|
745
|
-
|
|
785
|
+
_this8.reRender();
|
|
746
786
|
}, 1);
|
|
747
787
|
});
|
|
748
788
|
}
|
|
@@ -769,7 +809,7 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
769
809
|
}, {
|
|
770
810
|
key: "setSelect",
|
|
771
811
|
value: function setSelect(id, options) {
|
|
772
|
-
var
|
|
812
|
+
var _this9 = this;
|
|
773
813
|
if (isObject(id)) {
|
|
774
814
|
var _id$x2 = id.x,
|
|
775
815
|
x = _id$x2 === void 0 ? 0 : _id$x2,
|
|
@@ -793,7 +833,7 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
793
833
|
// @ts-ignore
|
|
794
834
|
.then(function () {
|
|
795
835
|
setTimeout(function () {
|
|
796
|
-
|
|
836
|
+
_this9.reRender();
|
|
797
837
|
}, 1);
|
|
798
838
|
});
|
|
799
839
|
}
|
|
@@ -1018,8 +1058,6 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
1018
1058
|
});
|
|
1019
1059
|
this.removeAllListeners();
|
|
1020
1060
|
this.isDestroyed = true;
|
|
1021
|
-
// 解绑图层容器中的服务
|
|
1022
|
-
// this.container.unbind(TYPES.IStyleAttributeService);
|
|
1023
1061
|
}
|
|
1024
1062
|
}, {
|
|
1025
1063
|
key: "clear",
|
|
@@ -1048,7 +1086,7 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
1048
1086
|
}, {
|
|
1049
1087
|
key: "setSource",
|
|
1050
1088
|
value: function setSource(source) {
|
|
1051
|
-
var
|
|
1089
|
+
var _this10 = this;
|
|
1052
1090
|
// 解除原 sources 事件
|
|
1053
1091
|
if (this.layerSource) {
|
|
1054
1092
|
this.layerSource.off('update', this.sourceEvent);
|
|
@@ -1067,22 +1105,22 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
1067
1105
|
// this.layerSource.inited 为 true update 事件不会再触发
|
|
1068
1106
|
this.layerSource.on('update', function (_ref4) {
|
|
1069
1107
|
var type = _ref4.type;
|
|
1070
|
-
if (
|
|
1071
|
-
var
|
|
1072
|
-
var layerCenter =
|
|
1073
|
-
|
|
1074
|
-
if ((
|
|
1075
|
-
|
|
1108
|
+
if (_this10.coordCenter === undefined) {
|
|
1109
|
+
var _this10$mapService;
|
|
1110
|
+
var layerCenter = _this10.layerSource.center;
|
|
1111
|
+
_this10.coordCenter = layerCenter;
|
|
1112
|
+
if ((_this10$mapService = _this10.mapService) !== null && _this10$mapService !== void 0 && _this10$mapService.setCoordCenter) {
|
|
1113
|
+
_this10.mapService.setCoordCenter(layerCenter);
|
|
1076
1114
|
}
|
|
1077
1115
|
}
|
|
1078
1116
|
if (type === 'update') {
|
|
1079
|
-
if (
|
|
1117
|
+
if (_this10.tileLayer) {
|
|
1080
1118
|
// 瓦片图层独立更新
|
|
1081
|
-
|
|
1119
|
+
_this10.tileLayer.reload();
|
|
1082
1120
|
return;
|
|
1083
1121
|
}
|
|
1084
1122
|
// source 初始化不需要处理
|
|
1085
|
-
|
|
1123
|
+
_this10.sourceEvent();
|
|
1086
1124
|
}
|
|
1087
1125
|
});
|
|
1088
1126
|
}
|
|
@@ -1115,11 +1153,11 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
1115
1153
|
}, {
|
|
1116
1154
|
key: "getLegend",
|
|
1117
1155
|
value: function getLegend(name) {
|
|
1118
|
-
var _attribute$scale, _scales
|
|
1156
|
+
var _attribute$scale, _scales$, _attribute$scale2;
|
|
1119
1157
|
var attribute = this.styleAttributeService.getLayerStyleAttribute(name);
|
|
1120
1158
|
var scales = (attribute === null || attribute === void 0 || (_attribute$scale = attribute.scale) === null || _attribute$scale === void 0 ? void 0 : _attribute$scale.scalers) || [];
|
|
1121
1159
|
return {
|
|
1122
|
-
type: (_scales$
|
|
1160
|
+
type: (_scales$ = scales[0]) === null || _scales$ === void 0 || (_scales$ = _scales$.option) === null || _scales$ === void 0 ? void 0 : _scales$.type,
|
|
1123
1161
|
field: attribute === null || attribute === void 0 || (_attribute$scale2 = attribute.scale) === null || _attribute$scale2 === void 0 ? void 0 : _attribute$scale2.field,
|
|
1124
1162
|
items: this.getLegendItems(name)
|
|
1125
1163
|
};
|
|
@@ -1180,7 +1218,7 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
1180
1218
|
key: "buildLayerModel",
|
|
1181
1219
|
value: function () {
|
|
1182
1220
|
var _buildLayerModel = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(options) {
|
|
1183
|
-
var
|
|
1221
|
+
var _this11 = this;
|
|
1184
1222
|
var moduleName, vertexShader, fragmentShader, inject, triangulation, styleOption, _options$pickingEnabl, pickingEnabled, rest, _this$shaderModuleSer, vs, fs, uniforms, createModel;
|
|
1185
1223
|
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
1186
1224
|
while (1) switch (_context3.prev = _context3.next) {
|
|
@@ -1194,13 +1232,13 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
1194
1232
|
_this$shaderModuleSer = this.shaderModuleService.getModule(moduleName), vs = _this$shaderModuleSer.vs, fs = _this$shaderModuleSer.fs, uniforms = _this$shaderModuleSer.uniforms;
|
|
1195
1233
|
createModel = this.rendererService.createModel;
|
|
1196
1234
|
return _context3.abrupt("return", new Promise(function (resolve) {
|
|
1197
|
-
var
|
|
1198
|
-
attributes =
|
|
1199
|
-
elements =
|
|
1200
|
-
count =
|
|
1201
|
-
var uniformBuffers = [].concat(_toConsumableArray(
|
|
1235
|
+
var _this11$styleAttribut = _this11.styleAttributeService.createAttributesAndIndices(_this11.encodedData, triangulation, styleOption, _this11),
|
|
1236
|
+
attributes = _this11$styleAttribut.attributes,
|
|
1237
|
+
elements = _this11$styleAttribut.elements,
|
|
1238
|
+
count = _this11$styleAttribut.count;
|
|
1239
|
+
var uniformBuffers = [].concat(_toConsumableArray(_this11.layerModel.uniformBuffers), _toConsumableArray(_this11.rendererService.uniformBuffers), [_this11.getLayerUniformBuffer()]);
|
|
1202
1240
|
if (pickingEnabled) {
|
|
1203
|
-
uniformBuffers.push(
|
|
1241
|
+
uniformBuffers.push(_this11.getPickingUniformBuffer());
|
|
1204
1242
|
}
|
|
1205
1243
|
var modelOptions = _objectSpread({
|
|
1206
1244
|
attributes: attributes,
|
|
@@ -1210,7 +1248,7 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
1210
1248
|
elements: elements,
|
|
1211
1249
|
blend: BlendTypes[BlendType.normal],
|
|
1212
1250
|
uniformBuffers: uniformBuffers,
|
|
1213
|
-
textures:
|
|
1251
|
+
textures: _this11.layerModel.textures
|
|
1214
1252
|
}, rest);
|
|
1215
1253
|
if (count) {
|
|
1216
1254
|
modelOptions.count = count;
|
|
@@ -1346,7 +1384,7 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
1346
1384
|
}, {
|
|
1347
1385
|
key: "renderModels",
|
|
1348
1386
|
value: function renderModels() {
|
|
1349
|
-
var
|
|
1387
|
+
var _this12 = this;
|
|
1350
1388
|
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
1351
1389
|
// TODO: this.getEncodedData().length > 0 这个判断是为了解决在 2.5.x 引入数据纹理后产生的 空数据渲染导致 texture 超出上限问题
|
|
1352
1390
|
if (this.encodeDataLength <= 0 && !this.forceRender) {
|
|
@@ -1357,10 +1395,10 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
1357
1395
|
this.hooks.beforeRender.call();
|
|
1358
1396
|
this.models.forEach(function (model) {
|
|
1359
1397
|
model.draw({
|
|
1360
|
-
uniforms:
|
|
1361
|
-
blend:
|
|
1362
|
-
stencil:
|
|
1363
|
-
textures:
|
|
1398
|
+
uniforms: _this12.layerModel.getUninforms(),
|
|
1399
|
+
blend: _this12.layerModel.getBlend(),
|
|
1400
|
+
stencil: _this12.layerModel.getStencil(options),
|
|
1401
|
+
textures: _this12.layerModel.textures
|
|
1364
1402
|
}, (options === null || options === void 0 ? void 0 : options.ispick) || false);
|
|
1365
1403
|
});
|
|
1366
1404
|
this.hooks.afterRender.call();
|
|
@@ -1524,10 +1562,5 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
1524
1562
|
}
|
|
1525
1563
|
}]);
|
|
1526
1564
|
return BaseLayer;
|
|
1527
|
-
}(EventEmitter)
|
|
1528
|
-
configurable: true,
|
|
1529
|
-
enumerable: true,
|
|
1530
|
-
writable: true,
|
|
1531
|
-
initializer: null
|
|
1532
|
-
})), _class));
|
|
1565
|
+
}(EventEmitter);
|
|
1533
1566
|
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();
|
|
@@ -95,13 +86,11 @@ var BaseModel = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
95
86
|
stencilType: StencilType.SINGLE
|
|
96
87
|
}); // 用于遮罩的stencil 参数
|
|
97
88
|
}
|
|
98
|
-
|
|
99
89
|
if (option.isStencil) {
|
|
100
90
|
return getStencilMask(_objectSpread(_objectSpread({}, option), {}, {
|
|
101
91
|
maskOperation: maskOperation
|
|
102
92
|
})); // 用于遮罩的stencil 参数
|
|
103
93
|
}
|
|
104
|
-
|
|
105
94
|
var maskflag = mask ||
|
|
106
95
|
// mask 兼容历史写法
|
|
107
96
|
enableMask && this.layer.masks.length !== 0 ||
|
|
@@ -388,10 +377,5 @@ var BaseModel = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
388
377
|
}
|
|
389
378
|
}]);
|
|
390
379
|
return BaseModel;
|
|
391
|
-
}()
|
|
392
|
-
configurable: true,
|
|
393
|
-
enumerable: true,
|
|
394
|
-
writable: true,
|
|
395
|
-
initializer: null
|
|
396
|
-
})), _class));
|
|
380
|
+
}();
|
|
397
381
|
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 = {
|
|
@@ -110,7 +109,6 @@ var BaseLayerPickService = /*#__PURE__*/function () {
|
|
|
110
109
|
// x
|
|
111
110
|
(y - tileMaxXY.y) / tilePixelHeight // y
|
|
112
111
|
];
|
|
113
|
-
|
|
114
112
|
var tileWidth = rasterData.width || 1;
|
|
115
113
|
var tileHeight = rasterData.height || 1;
|
|
116
114
|
var indexX = Math.floor(pos[0] * tileWidth);
|
|
@@ -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",
|