@antv/l7-scene 2.9.36 → 2.9.37-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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antv/l7-scene",
3
- "version": "2.9.36",
3
+ "version": "2.9.37-alpha.2",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",
@@ -23,21 +23,22 @@
23
23
  "author": "xiaoiver",
24
24
  "license": "ISC",
25
25
  "dependencies": {
26
- "@antv/l7-component": "2.9.36",
27
- "@antv/l7-core": "2.9.36",
28
- "@antv/l7-layers": "2.9.36",
29
- "@antv/l7-maps": "2.9.36",
30
- "@antv/l7-renderer": "2.9.36",
31
- "@antv/l7-utils": "2.9.36",
26
+ "@antv/l7-component": "2.9.37-alpha.2",
27
+ "@antv/l7-core": "2.9.37-alpha.2",
28
+ "@antv/l7-layers": "2.9.37-alpha.2",
29
+ "@antv/l7-maps": "2.9.37-alpha.2",
30
+ "@antv/l7-renderer": "2.9.37-alpha.2",
31
+ "@antv/l7-utils": "2.9.37-alpha.2",
32
32
  "@babel/runtime": "^7.7.7",
33
+ "eventemitter3": "^4.0.7",
33
34
  "inversify": "^5.0.1",
34
35
  "mapbox-gl": "^1.2.1",
35
36
  "reflect-metadata": "^0.1.13"
36
37
  },
37
38
  "devDependencies": {
38
- "@antv/l7-test-utils": "2.9.36"
39
+ "@antv/l7-test-utils": "2.9.37-alpha.2"
39
40
  },
40
- "gitHead": "31c164f88bfa31eeed98c0b074236493b0b2f78b",
41
+ "gitHead": "6820a389076688efdaedfe10d324ca5a7b5ae2f5",
41
42
  "publishConfig": {
42
43
  "access": "public"
43
44
  }
@@ -1,9 +0,0 @@
1
- import { ILayer } from '@antv/l7-core';
2
- export default interface ILayerManager {
3
- enableShaderPick: () => void;
4
- diasbleShaderPick: () => void;
5
- addLayer(layer: ILayer): void;
6
- getLayers(): ILayer[];
7
- getLayer(id: string): ILayer | undefined;
8
- removeLayer(layer: ILayer): void;
9
- }
File without changes
@@ -1,62 +0,0 @@
1
- import { Bounds, ICameraOptions, ILngLat, IPoint, IStatusOptions, Point } from '@antv/l7-core';
2
- export default interface IMapController {
3
- /**
4
- * 当前缩放等级
5
- */
6
- getZoom(): number;
7
- /**
8
- * 中心点经纬度
9
- */
10
- getCenter(options?: ICameraOptions): ILngLat;
11
- /**
12
- * 仰角
13
- */
14
- getPitch(): number;
15
- /**
16
- * 逆时针旋转角度
17
- */
18
- getRotation(): number;
19
- /**
20
- * 获取当前地图可视区域 `[西南角、东北角]`
21
- */
22
- getBounds(): Bounds;
23
- /**
24
- * 放大地图
25
- */
26
- zoomIn(): void;
27
- /**
28
- * 缩小地图
29
- */
30
- zoomOut(): void;
31
- /**
32
- * 地图平移到指定点 `[x, y]`
33
- */
34
- panTo(p: Point): void;
35
- /**
36
- * 地图平移到指定点 `[x, y]`
37
- */
38
- panBy(x: number, y: number): void;
39
- /**
40
- * 调整地图适合指定区域
41
- */
42
- fitBounds(bound: Bounds, fitBoundsOptions?: unknown): void;
43
- getContainer(): HTMLElement | null;
44
- getSize(): [number, number];
45
- getMinZoom(): number;
46
- getMaxZoom(): number;
47
- getType(): string;
48
- getMapContainer(): HTMLElement | null;
49
- getMapCanvasContainer(): HTMLElement;
50
- setRotation(rotation: number): void;
51
- setZoomAndCenter(zoom: number, center: Point): void;
52
- setCenter(center: [number, number], options?: ICameraOptions): void;
53
- setPitch(pitch: number): void;
54
- setZoom(zoom: number): void;
55
- setMapStyle(style: any): void;
56
- setMapStatus(option: Partial<IStatusOptions>): void;
57
- pixelToLngLat(pixel: Point): ILngLat;
58
- lngLatToPixel(lnglat: Point): IPoint;
59
- containerToLngLat(pixel: Point): ILngLat;
60
- lngLatToContainer(lnglat: Point): IPoint;
61
- exportMap(type: 'jpg' | 'png'): string;
62
- }
File without changes
@@ -1,9 +0,0 @@
1
- import { IPostProcessingPass } from '@antv/l7-core';
2
- export default interface IPostProcessingPassPluggable {
3
- /**
4
- * 注册自定义后处理效果
5
- * @param constructor 效果构造函数
6
- * @param name 效果名,便于在 Layer 中引用
7
- */
8
- registerPostProcessingPass(constructor: new (...args: any[]) => IPostProcessingPass<unknown>, name: string): void;
9
- }
File without changes
package/es/index.d.ts DELETED
@@ -1,113 +0,0 @@
1
- import { Bounds, ICameraOptions, IControl, IIconFontGlyph, IImage, ILayer, ILngLat, IMapService, IMarker, IMarkerLayer, IPoint, IPopup, IPostProcessingPass, ISceneConfig, IStatusOptions, Point } from '@antv/l7-core';
2
- import { Container } from 'inversify';
3
- import ILayerManager from './ILayerManager';
4
- import IMapController from './IMapController';
5
- import IPostProcessingPassPluggable from './IPostProcessingPassPluggable';
6
- /**
7
- * 暴露 Scene API
8
- *
9
- * @example
10
- * import { Scene } from 'l7/scene';
11
- * import { PointLayer } from 'l7/layers';
12
- *
13
- * const scene = new Scene();
14
- * const pointLayer = new PointLayer();
15
- * scene.addLayer(pointLayer);
16
- *
17
- */
18
- declare class Scene implements IPostProcessingPassPluggable, IMapController, ILayerManager {
19
- private sceneService;
20
- private mapService;
21
- private controlService;
22
- private layerService;
23
- private iconService;
24
- private markerService;
25
- private popupService;
26
- private fontService;
27
- private interactionService;
28
- private container;
29
- constructor(config: ISceneConfig);
30
- get map(): unknown;
31
- get loaded(): boolean;
32
- getServiceContainer(): Container;
33
- getSize(): [number, number];
34
- getMinZoom(): number;
35
- getMaxZoom(): number;
36
- getType(): string;
37
- getMapContainer(): HTMLElement | null;
38
- getMapCanvasContainer(): HTMLElement;
39
- getMapService(): IMapService<unknown>;
40
- exportPng(type?: 'png' | 'jpg'): string;
41
- exportMap(type?: 'png' | 'jpg'): string;
42
- registerRenderService(render: any): void;
43
- setBgColor(color: string): void;
44
- addLayer(layer: ILayer): void;
45
- addMask(mask: ILayer, layerId: string): void;
46
- getPickedLayer(): number;
47
- getLayers(): ILayer[];
48
- getLayer(id: string): ILayer | undefined;
49
- getLayerByName(name: string): ILayer | undefined;
50
- removeLayer(layer: ILayer, parentLayer?: ILayer): void;
51
- removeAllLayer(): void;
52
- render(): void;
53
- setEnableRender(flag: boolean): void;
54
- /**
55
- * 为 layer/point/text 支持 iconfont 模式支持
56
- * @param fontUnicode
57
- * @param name
58
- */
59
- addIconFont(name: string, fontUnicode: string): void;
60
- addIconFonts(options: string[][]): void;
61
- /**
62
- * 用户自定义添加第三方字体
63
- * @param fontFamily
64
- * @param fontPath
65
- */
66
- addFontFace(fontFamily: string, fontPath: string): void;
67
- addImage(id: string, img: IImage): void;
68
- hasImage(id: string): boolean;
69
- removeImage(id: string): void;
70
- addIconFontGlyphs(fontFamily: string, glyphs: IIconFontGlyph[]): void;
71
- addControl(ctr: IControl): void;
72
- removeControl(ctr: IControl): void;
73
- getControlByName(name: string): IControl | undefined;
74
- addMarker(marker: IMarker): void;
75
- addMarkerLayer(layer: IMarkerLayer): void;
76
- removeMarkerLayer(layer: IMarkerLayer): void;
77
- removeAllMakers(): void;
78
- addPopup(popup: IPopup): void;
79
- on(type: string, handle: (...args: any[]) => void): void;
80
- once(type: string, handle: (...args: any[]) => void): void;
81
- emit(type: string, handle: (...args: any[]) => void): void;
82
- off(type: string, handle: (...args: any[]) => void): void;
83
- getZoom(): number;
84
- getCenter(options?: ICameraOptions): ILngLat;
85
- setCenter(center: [number, number], options?: ICameraOptions): void;
86
- getPitch(): number;
87
- setPitch(pitch: number): void;
88
- getRotation(): number;
89
- getBounds(): Bounds;
90
- setRotation(rotation: number): void;
91
- zoomIn(): void;
92
- zoomOut(): void;
93
- panTo(p: Point): void;
94
- panBy(x: number, y: number): void;
95
- getContainer(): HTMLElement | null;
96
- setZoom(zoom: number): void;
97
- fitBounds(bound: Bounds, options?: unknown): void;
98
- setZoomAndCenter(zoom: number, center: Point): void;
99
- setMapStyle(style: any): void;
100
- setMapStatus(options: Partial<IStatusOptions>): void;
101
- pixelToLngLat(pixel: Point): ILngLat;
102
- lngLatToPixel(lnglat: Point): IPoint;
103
- containerToLngLat(pixel: Point): ILngLat;
104
- lngLatToContainer(lnglat: Point): IPoint;
105
- destroy(): void;
106
- registerPostProcessingPass(constructor: new (...args: any[]) => IPostProcessingPass<unknown>, name: string): void;
107
- enableShaderPick(): void;
108
- diasbleShaderPick(): void;
109
- getPointSizeRange(): Float32Array;
110
- private initComponent;
111
- private initControl;
112
- }
113
- export { Scene };
package/es/index.js DELETED
@@ -1,525 +0,0 @@
1
- import _objectSpread from "@babel/runtime/helpers/objectSpread2";
2
- import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
- import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
4
- import _createClass from "@babel/runtime/helpers/createClass";
5
- import { Logo } from '@antv/l7-component';
6
- import { createLayerContainer, createSceneContainer, SceneEventList, TYPES } from '@antv/l7-core';
7
- import { MaskLayer } from '@antv/l7-layers';
8
- import { ReglRendererService } from '@antv/l7-renderer';
9
- import { DOM, isMini } from '@antv/l7-utils';
10
-
11
- /**
12
- * 暴露 Scene API
13
- *
14
- * @example
15
- * import { Scene } from 'l7/scene';
16
- * import { PointLayer } from 'l7/layers';
17
- *
18
- * const scene = new Scene();
19
- * const pointLayer = new PointLayer();
20
- * scene.addLayer(pointLayer);
21
- *
22
- */
23
- var Scene = /*#__PURE__*/function () {
24
- function Scene(config) {
25
- _classCallCheck(this, Scene);
26
-
27
- var id = config.id,
28
- map = config.map,
29
- canvas = config.canvas,
30
- hasBaseMap = config.hasBaseMap; // 创建场景容器
31
-
32
- var sceneContainer = createSceneContainer();
33
- this.container = sceneContainer; // 绑定地图服务
34
-
35
- map.setContainer(sceneContainer, id, canvas, hasBaseMap); // 绑定渲染引擎服务
36
-
37
- sceneContainer.bind(TYPES.IRendererService).to(ReglRendererService).inSingletonScope(); // 依赖注入
38
-
39
- this.sceneService = sceneContainer.get(TYPES.ISceneService);
40
- this.mapService = sceneContainer.get(TYPES.IMapService);
41
- this.iconService = sceneContainer.get(TYPES.IIconService);
42
- this.fontService = sceneContainer.get(TYPES.IFontService);
43
- this.controlService = sceneContainer.get(TYPES.IControlService);
44
- this.layerService = sceneContainer.get(TYPES.ILayerService);
45
- this.markerService = sceneContainer.get(TYPES.IMarkerService);
46
- this.interactionService = sceneContainer.get(TYPES.IInteractionService);
47
- this.popupService = sceneContainer.get(TYPES.IPopupService);
48
-
49
- if (isMini) {
50
- this.sceneService.initMiniScene(config);
51
- } else {
52
- this.initComponent(id); // 初始化 scene
53
-
54
- this.sceneService.init(config); // TODO: 初始化组件
55
-
56
- this.initControl();
57
- }
58
- }
59
-
60
- _createClass(Scene, [{
61
- key: "map",
62
- get: function get() {
63
- return this.mapService.map;
64
- }
65
- }, {
66
- key: "loaded",
67
- get: function get() {
68
- return this.sceneService.loaded;
69
- }
70
- }, {
71
- key: "getServiceContainer",
72
- value: function getServiceContainer() {
73
- return this.container;
74
- }
75
- }, {
76
- key: "getSize",
77
- value: function getSize() {
78
- return this.mapService.getSize();
79
- }
80
- }, {
81
- key: "getMinZoom",
82
- value: function getMinZoom() {
83
- return this.mapService.getMinZoom();
84
- }
85
- }, {
86
- key: "getMaxZoom",
87
- value: function getMaxZoom() {
88
- return this.mapService.getMaxZoom();
89
- }
90
- }, {
91
- key: "getType",
92
- value: function getType() {
93
- return this.mapService.getType();
94
- }
95
- }, {
96
- key: "getMapContainer",
97
- value: function getMapContainer() {
98
- return this.mapService.getMapContainer();
99
- }
100
- }, {
101
- key: "getMapCanvasContainer",
102
- value: function getMapCanvasContainer() {
103
- return this.mapService.getMapCanvasContainer();
104
- }
105
- }, {
106
- key: "getMapService",
107
- value: function getMapService() {
108
- return this.mapService;
109
- }
110
- }, {
111
- key: "exportPng",
112
- value: function exportPng(type) {
113
- return this.sceneService.exportPng(type);
114
- }
115
- }, {
116
- key: "exportMap",
117
- value: function exportMap(type) {
118
- return this.sceneService.exportPng(type);
119
- }
120
- }, {
121
- key: "registerRenderService",
122
- value: function registerRenderService(render) {
123
- var _this = this;
124
-
125
- if (this.sceneService.loaded) {
126
- var renderSerivce = new render(this);
127
- renderSerivce.init();
128
- } else {
129
- this.on('loaded', function () {
130
- var renderSerivce = new render(_this);
131
- renderSerivce.init();
132
- });
133
- }
134
- }
135
- }, {
136
- key: "setBgColor",
137
- value: function setBgColor(color) {
138
- this.mapService.setBgColor(color);
139
- } // layer 管理
140
-
141
- }, {
142
- key: "addLayer",
143
- value: function addLayer(layer) {
144
- // 为当前图层创建一个容器
145
- // TODO: 初始化的时候设置 容器
146
- var layerContainer = createLayerContainer(this.container);
147
- layer.setContainer(layerContainer, this.container);
148
- this.sceneService.addLayer(layer);
149
- var layerConfig = layer.getLayerConfig();
150
-
151
- if (layerConfig) {
152
- // 若 layer 未初始化成功,则 layerConfig 为 undefined (scene loaded 尚未执行完成)
153
- var mask = layerConfig.mask,
154
- maskfence = layerConfig.maskfence,
155
- _layerConfig$maskColo = layerConfig.maskColor,
156
- maskColor = _layerConfig$maskColo === void 0 ? '#000' : _layerConfig$maskColo,
157
- _layerConfig$maskOpac = layerConfig.maskOpacity,
158
- maskOpacity = _layerConfig$maskOpac === void 0 ? 0 : _layerConfig$maskOpac;
159
-
160
- if (mask && maskfence) {
161
- var maskInstance = new MaskLayer().source(maskfence).shape('fill').style({
162
- color: maskColor,
163
- opacity: maskOpacity
164
- });
165
- this.addMask(maskInstance, layer.id);
166
- }
167
- } else {
168
- console.warn('addLayer should run after scene loaded!');
169
- }
170
- }
171
- }, {
172
- key: "addMask",
173
- value: function addMask(mask, layerId) {
174
- var parent = this.getLayer(layerId);
175
-
176
- if (parent) {
177
- var layerContainer = createLayerContainer(this.container);
178
- mask.setContainer(layerContainer, this.container);
179
- parent.addMaskLayer(mask);
180
- this.sceneService.addLayer(mask);
181
- } else {
182
- console.warn('parent layer not find!');
183
- }
184
- }
185
- }, {
186
- key: "getPickedLayer",
187
- value: function getPickedLayer() {
188
- return this.layerService.pickedLayerId;
189
- }
190
- }, {
191
- key: "getLayers",
192
- value: function getLayers() {
193
- return this.layerService.getLayers();
194
- }
195
- }, {
196
- key: "getLayer",
197
- value: function getLayer(id) {
198
- return this.layerService.getLayer(id);
199
- }
200
- }, {
201
- key: "getLayerByName",
202
- value: function getLayerByName(name) {
203
- return this.layerService.getLayerByName(name);
204
- }
205
- }, {
206
- key: "removeLayer",
207
- value: function removeLayer(layer, parentLayer) {
208
- this.layerService.remove(layer, parentLayer);
209
- }
210
- }, {
211
- key: "removeAllLayer",
212
- value: function removeAllLayer() {
213
- this.layerService.removeAllLayers();
214
- }
215
- }, {
216
- key: "render",
217
- value: function render() {
218
- this.sceneService.render();
219
- }
220
- }, {
221
- key: "setEnableRender",
222
- value: function setEnableRender(flag) {
223
- this.layerService.setEnableRender(flag);
224
- } // asset method
225
-
226
- /**
227
- * 为 layer/point/text 支持 iconfont 模式支持
228
- * @param fontUnicode
229
- * @param name
230
- */
231
-
232
- }, {
233
- key: "addIconFont",
234
- value: function addIconFont(name, fontUnicode) {
235
- this.fontService.addIconFont(name, fontUnicode);
236
- }
237
- }, {
238
- key: "addIconFonts",
239
- value: function addIconFonts(options) {
240
- var _this2 = this;
241
-
242
- options.forEach(function (_ref) {
243
- var _ref2 = _slicedToArray(_ref, 2),
244
- name = _ref2[0],
245
- fontUnicode = _ref2[1];
246
-
247
- _this2.fontService.addIconFont(name, fontUnicode);
248
- });
249
- }
250
- /**
251
- * 用户自定义添加第三方字体
252
- * @param fontFamily
253
- * @param fontPath
254
- */
255
-
256
- }, {
257
- key: "addFontFace",
258
- value: function addFontFace(fontFamily, fontPath) {
259
- var _this3 = this;
260
-
261
- this.fontService.once('fontloaded', function (e) {
262
- _this3.emit('fontloaded', e);
263
- });
264
- this.fontService.addFontFace(fontFamily, fontPath);
265
- }
266
- }, {
267
- key: "addImage",
268
- value: function addImage(id, img) {
269
- if (!isMini) {
270
- this.iconService.addImage(id, img);
271
- } else {
272
- this.iconService.addImageMini(id, img, this.sceneService);
273
- }
274
- }
275
- }, {
276
- key: "hasImage",
277
- value: function hasImage(id) {
278
- return this.iconService.hasImage(id);
279
- }
280
- }, {
281
- key: "removeImage",
282
- value: function removeImage(id) {
283
- this.iconService.removeImage(id);
284
- }
285
- }, {
286
- key: "addIconFontGlyphs",
287
- value: function addIconFontGlyphs(fontFamily, glyphs) {
288
- this.fontService.addIconGlyphs(glyphs);
289
- } // map control method
290
-
291
- }, {
292
- key: "addControl",
293
- value: function addControl(ctr) {
294
- this.controlService.addControl(ctr, this.container);
295
- }
296
- }, {
297
- key: "removeControl",
298
- value: function removeControl(ctr) {
299
- this.controlService.removeControl(ctr);
300
- }
301
- }, {
302
- key: "getControlByName",
303
- value: function getControlByName(name) {
304
- return this.controlService.getControlByName(name);
305
- } // marker
306
-
307
- }, {
308
- key: "addMarker",
309
- value: function addMarker(marker) {
310
- this.markerService.addMarker(marker);
311
- }
312
- }, {
313
- key: "addMarkerLayer",
314
- value: function addMarkerLayer(layer) {
315
- this.markerService.addMarkerLayer(layer);
316
- }
317
- }, {
318
- key: "removeMarkerLayer",
319
- value: function removeMarkerLayer(layer) {
320
- this.markerService.removeMarkerLayer(layer);
321
- }
322
- }, {
323
- key: "removeAllMakers",
324
- value: function removeAllMakers() {
325
- this.markerService.removeAllMarkers();
326
- }
327
- }, {
328
- key: "addPopup",
329
- value: function addPopup(popup) {
330
- this.popupService.addPopup(popup);
331
- }
332
- }, {
333
- key: "on",
334
- value: function on(type, handle) {
335
- SceneEventList.indexOf(type) === -1 ? this.mapService.on(type, handle) : this.sceneService.on(type, handle);
336
- }
337
- }, {
338
- key: "once",
339
- value: function once(type, handle) {
340
- SceneEventList.indexOf(type) === -1 ? this.mapService.once(type, handle) : this.sceneService.once(type, handle);
341
- }
342
- }, {
343
- key: "emit",
344
- value: function emit(type, handle) {
345
- SceneEventList.indexOf(type) === -1 ? this.mapService.on(type, handle) : this.sceneService.emit(type, handle);
346
- }
347
- }, {
348
- key: "off",
349
- value: function off(type, handle) {
350
- SceneEventList.indexOf(type) === -1 ? this.mapService.off(type, handle) : this.sceneService.off(type, handle);
351
- } // implements IMapController
352
-
353
- }, {
354
- key: "getZoom",
355
- value: function getZoom() {
356
- return this.mapService.getZoom();
357
- }
358
- }, {
359
- key: "getCenter",
360
- value: function getCenter(options) {
361
- return this.mapService.getCenter(options);
362
- }
363
- }, {
364
- key: "setCenter",
365
- value: function setCenter(center, options) {
366
- return this.mapService.setCenter(center, options);
367
- }
368
- }, {
369
- key: "getPitch",
370
- value: function getPitch() {
371
- return this.mapService.getPitch();
372
- }
373
- }, {
374
- key: "setPitch",
375
- value: function setPitch(pitch) {
376
- return this.mapService.setPitch(pitch);
377
- }
378
- }, {
379
- key: "getRotation",
380
- value: function getRotation() {
381
- return this.mapService.getRotation();
382
- }
383
- }, {
384
- key: "getBounds",
385
- value: function getBounds() {
386
- return this.mapService.getBounds();
387
- }
388
- }, {
389
- key: "setRotation",
390
- value: function setRotation(rotation) {
391
- this.mapService.setRotation(rotation);
392
- }
393
- }, {
394
- key: "zoomIn",
395
- value: function zoomIn() {
396
- this.mapService.zoomIn();
397
- }
398
- }, {
399
- key: "zoomOut",
400
- value: function zoomOut() {
401
- this.mapService.zoomOut();
402
- }
403
- }, {
404
- key: "panTo",
405
- value: function panTo(p) {
406
- this.mapService.panTo(p);
407
- }
408
- }, {
409
- key: "panBy",
410
- value: function panBy(x, y) {
411
- this.mapService.panBy(x, y);
412
- }
413
- }, {
414
- key: "getContainer",
415
- value: function getContainer() {
416
- return this.mapService.getContainer();
417
- }
418
- }, {
419
- key: "setZoom",
420
- value: function setZoom(zoom) {
421
- this.mapService.setZoom(zoom);
422
- }
423
- }, {
424
- key: "fitBounds",
425
- value: function fitBounds(bound, options) {
426
- var _this$sceneService$ge = this.sceneService.getSceneConfig(),
427
- fitBoundsOptions = _this$sceneService$ge.fitBoundsOptions,
428
- animate = _this$sceneService$ge.animate;
429
-
430
- this.mapService.fitBounds(bound, // 选项优先级:用户传入,覆盖animate直接配置,覆盖Scene配置项传入
431
- options || _objectSpread(_objectSpread({}, fitBoundsOptions), {}, {
432
- animate: animate
433
- }));
434
- }
435
- }, {
436
- key: "setZoomAndCenter",
437
- value: function setZoomAndCenter(zoom, center) {
438
- this.mapService.setZoomAndCenter(zoom, center);
439
- }
440
- }, {
441
- key: "setMapStyle",
442
- value: function setMapStyle(style) {
443
- this.mapService.setMapStyle(style);
444
- }
445
- }, {
446
- key: "setMapStatus",
447
- value: function setMapStatus(options) {
448
- this.mapService.setMapStatus(options);
449
- } // conversion Method
450
-
451
- }, {
452
- key: "pixelToLngLat",
453
- value: function pixelToLngLat(pixel) {
454
- return this.mapService.pixelToLngLat(pixel);
455
- }
456
- }, {
457
- key: "lngLatToPixel",
458
- value: function lngLatToPixel(lnglat) {
459
- return this.mapService.lngLatToPixel(lnglat);
460
- }
461
- }, {
462
- key: "containerToLngLat",
463
- value: function containerToLngLat(pixel) {
464
- return this.mapService.containerToLngLat(pixel);
465
- }
466
- }, {
467
- key: "lngLatToContainer",
468
- value: function lngLatToContainer(lnglat) {
469
- return this.mapService.lngLatToContainer(lnglat);
470
- }
471
- }, {
472
- key: "destroy",
473
- value: function destroy() {
474
- this.sceneService.destroy(); // TODO: 清理其他 Service 例如 IconService
475
- }
476
- }, {
477
- key: "registerPostProcessingPass",
478
- value: function registerPostProcessingPass(constructor, name) {
479
- this.container.bind(TYPES.IPostProcessingPass).to(constructor).whenTargetNamed(name);
480
- } // 控制 shader pick 计算
481
-
482
- }, {
483
- key: "enableShaderPick",
484
- value: function enableShaderPick() {
485
- this.layerService.enableShaderPick();
486
- }
487
- }, {
488
- key: "diasbleShaderPick",
489
- value: function diasbleShaderPick() {
490
- this.layerService.disableShaderPick();
491
- } // get current point size info
492
-
493
- }, {
494
- key: "getPointSizeRange",
495
- value: function getPointSizeRange() {
496
- return this.sceneService.getPointSizeRange();
497
- }
498
- }, {
499
- key: "initComponent",
500
- value: function initComponent(id) {
501
- this.controlService.init({
502
- container: DOM.getContainer(id)
503
- }, this.container);
504
- this.markerService.init(this.container);
505
- this.popupService.init(this.container);
506
- }
507
- }, {
508
- key: "initControl",
509
- value: function initControl() {
510
- var _this$sceneService$ge2 = this.sceneService.getSceneConfig(),
511
- logoVisible = _this$sceneService$ge2.logoVisible,
512
- logoPosition = _this$sceneService$ge2.logoPosition;
513
-
514
- if (logoVisible) {
515
- this.addControl(new Logo({
516
- position: logoPosition
517
- }));
518
- }
519
- }
520
- }]);
521
-
522
- return Scene;
523
- }();
524
-
525
- export { Scene };
@@ -1,17 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __copyProps = (to, from, except, desc) => {
6
- if (from && typeof from === "object" || typeof from === "function") {
7
- for (let key of __getOwnPropNames(from))
8
- if (!__hasOwnProp.call(to, key) && key !== except)
9
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
10
- }
11
- return to;
12
- };
13
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
14
-
15
- // src/ILayerManager.ts
16
- var ILayerManager_exports = {};
17
- module.exports = __toCommonJS(ILayerManager_exports);
@@ -1,17 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __copyProps = (to, from, except, desc) => {
6
- if (from && typeof from === "object" || typeof from === "function") {
7
- for (let key of __getOwnPropNames(from))
8
- if (!__hasOwnProp.call(to, key) && key !== except)
9
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
10
- }
11
- return to;
12
- };
13
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
14
-
15
- // src/IMapController.ts
16
- var IMapController_exports = {};
17
- module.exports = __toCommonJS(IMapController_exports);
@@ -1,17 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __copyProps = (to, from, except, desc) => {
6
- if (from && typeof from === "object" || typeof from === "function") {
7
- for (let key of __getOwnPropNames(from))
8
- if (!__hasOwnProp.call(to, key) && key !== except)
9
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
10
- }
11
- return to;
12
- };
13
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
14
-
15
- // src/IPostProcessingPassPluggable.ts
16
- var IPostProcessingPassPluggable_exports = {};
17
- module.exports = __toCommonJS(IPostProcessingPassPluggable_exports);
package/lib/index.js DELETED
@@ -1,330 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all)
7
- __defProp(target, name, { get: all[name], enumerable: true });
8
- };
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (let key of __getOwnPropNames(from))
12
- if (!__hasOwnProp.call(to, key) && key !== except)
13
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- }
15
- return to;
16
- };
17
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
-
19
- // src/index.ts
20
- var src_exports = {};
21
- __export(src_exports, {
22
- Scene: () => Scene
23
- });
24
- module.exports = __toCommonJS(src_exports);
25
- var import_l7_component = require("@antv/l7-component");
26
- var import_l7_core = require("@antv/l7-core");
27
- var import_l7_layers = require("@antv/l7-layers");
28
- var import_l7_renderer = require("@antv/l7-renderer");
29
- var import_l7_utils = require("@antv/l7-utils");
30
- var Scene = class {
31
- constructor(config) {
32
- const { id, map, canvas, hasBaseMap } = config;
33
- const sceneContainer = (0, import_l7_core.createSceneContainer)();
34
- this.container = sceneContainer;
35
- map.setContainer(sceneContainer, id, canvas, hasBaseMap);
36
- sceneContainer.bind(import_l7_core.TYPES.IRendererService).to(import_l7_renderer.ReglRendererService).inSingletonScope();
37
- this.sceneService = sceneContainer.get(import_l7_core.TYPES.ISceneService);
38
- this.mapService = sceneContainer.get(import_l7_core.TYPES.IMapService);
39
- this.iconService = sceneContainer.get(import_l7_core.TYPES.IIconService);
40
- this.fontService = sceneContainer.get(import_l7_core.TYPES.IFontService);
41
- this.controlService = sceneContainer.get(import_l7_core.TYPES.IControlService);
42
- this.layerService = sceneContainer.get(import_l7_core.TYPES.ILayerService);
43
- this.markerService = sceneContainer.get(import_l7_core.TYPES.IMarkerService);
44
- this.interactionService = sceneContainer.get(import_l7_core.TYPES.IInteractionService);
45
- this.popupService = sceneContainer.get(import_l7_core.TYPES.IPopupService);
46
- if (import_l7_utils.isMini) {
47
- this.sceneService.initMiniScene(config);
48
- } else {
49
- this.initComponent(id);
50
- this.sceneService.init(config);
51
- this.initControl();
52
- }
53
- }
54
- get map() {
55
- return this.mapService.map;
56
- }
57
- get loaded() {
58
- return this.sceneService.loaded;
59
- }
60
- getServiceContainer() {
61
- return this.container;
62
- }
63
- getSize() {
64
- return this.mapService.getSize();
65
- }
66
- getMinZoom() {
67
- return this.mapService.getMinZoom();
68
- }
69
- getMaxZoom() {
70
- return this.mapService.getMaxZoom();
71
- }
72
- getType() {
73
- return this.mapService.getType();
74
- }
75
- getMapContainer() {
76
- return this.mapService.getMapContainer();
77
- }
78
- getMapCanvasContainer() {
79
- return this.mapService.getMapCanvasContainer();
80
- }
81
- getMapService() {
82
- return this.mapService;
83
- }
84
- exportPng(type) {
85
- return this.sceneService.exportPng(type);
86
- }
87
- exportMap(type) {
88
- return this.sceneService.exportPng(type);
89
- }
90
- registerRenderService(render) {
91
- if (this.sceneService.loaded) {
92
- const renderSerivce = new render(this);
93
- renderSerivce.init();
94
- } else {
95
- this.on("loaded", () => {
96
- const renderSerivce = new render(this);
97
- renderSerivce.init();
98
- });
99
- }
100
- }
101
- setBgColor(color) {
102
- this.mapService.setBgColor(color);
103
- }
104
- addLayer(layer) {
105
- const layerContainer = (0, import_l7_core.createLayerContainer)(this.container);
106
- layer.setContainer(layerContainer, this.container);
107
- this.sceneService.addLayer(layer);
108
- const layerConfig = layer.getLayerConfig();
109
- if (layerConfig) {
110
- const {
111
- mask,
112
- maskfence,
113
- maskColor = "#000",
114
- maskOpacity = 0
115
- } = layerConfig;
116
- if (mask && maskfence) {
117
- const maskInstance = new import_l7_layers.MaskLayer().source(maskfence).shape("fill").style({
118
- color: maskColor,
119
- opacity: maskOpacity
120
- });
121
- this.addMask(maskInstance, layer.id);
122
- }
123
- } else {
124
- console.warn("addLayer should run after scene loaded!");
125
- }
126
- }
127
- addMask(mask, layerId) {
128
- const parent = this.getLayer(layerId);
129
- if (parent) {
130
- const layerContainer = (0, import_l7_core.createLayerContainer)(this.container);
131
- mask.setContainer(layerContainer, this.container);
132
- parent.addMaskLayer(mask);
133
- this.sceneService.addLayer(mask);
134
- } else {
135
- console.warn("parent layer not find!");
136
- }
137
- }
138
- getPickedLayer() {
139
- return this.layerService.pickedLayerId;
140
- }
141
- getLayers() {
142
- return this.layerService.getLayers();
143
- }
144
- getLayer(id) {
145
- return this.layerService.getLayer(id);
146
- }
147
- getLayerByName(name) {
148
- return this.layerService.getLayerByName(name);
149
- }
150
- removeLayer(layer, parentLayer) {
151
- this.layerService.remove(layer, parentLayer);
152
- }
153
- removeAllLayer() {
154
- this.layerService.removeAllLayers();
155
- }
156
- render() {
157
- this.sceneService.render();
158
- }
159
- setEnableRender(flag) {
160
- this.layerService.setEnableRender(flag);
161
- }
162
- addIconFont(name, fontUnicode) {
163
- this.fontService.addIconFont(name, fontUnicode);
164
- }
165
- addIconFonts(options) {
166
- options.forEach(([name, fontUnicode]) => {
167
- this.fontService.addIconFont(name, fontUnicode);
168
- });
169
- }
170
- addFontFace(fontFamily, fontPath) {
171
- this.fontService.once("fontloaded", (e) => {
172
- this.emit("fontloaded", e);
173
- });
174
- this.fontService.addFontFace(fontFamily, fontPath);
175
- }
176
- addImage(id, img) {
177
- if (!import_l7_utils.isMini) {
178
- this.iconService.addImage(id, img);
179
- } else {
180
- this.iconService.addImageMini(id, img, this.sceneService);
181
- }
182
- }
183
- hasImage(id) {
184
- return this.iconService.hasImage(id);
185
- }
186
- removeImage(id) {
187
- this.iconService.removeImage(id);
188
- }
189
- addIconFontGlyphs(fontFamily, glyphs) {
190
- this.fontService.addIconGlyphs(glyphs);
191
- }
192
- addControl(ctr) {
193
- this.controlService.addControl(ctr, this.container);
194
- }
195
- removeControl(ctr) {
196
- this.controlService.removeControl(ctr);
197
- }
198
- getControlByName(name) {
199
- return this.controlService.getControlByName(name);
200
- }
201
- addMarker(marker) {
202
- this.markerService.addMarker(marker);
203
- }
204
- addMarkerLayer(layer) {
205
- this.markerService.addMarkerLayer(layer);
206
- }
207
- removeMarkerLayer(layer) {
208
- this.markerService.removeMarkerLayer(layer);
209
- }
210
- removeAllMakers() {
211
- this.markerService.removeAllMarkers();
212
- }
213
- addPopup(popup) {
214
- this.popupService.addPopup(popup);
215
- }
216
- on(type, handle) {
217
- import_l7_core.SceneEventList.indexOf(type) === -1 ? this.mapService.on(type, handle) : this.sceneService.on(type, handle);
218
- }
219
- once(type, handle) {
220
- import_l7_core.SceneEventList.indexOf(type) === -1 ? this.mapService.once(type, handle) : this.sceneService.once(type, handle);
221
- }
222
- emit(type, handle) {
223
- import_l7_core.SceneEventList.indexOf(type) === -1 ? this.mapService.on(type, handle) : this.sceneService.emit(type, handle);
224
- }
225
- off(type, handle) {
226
- import_l7_core.SceneEventList.indexOf(type) === -1 ? this.mapService.off(type, handle) : this.sceneService.off(type, handle);
227
- }
228
- getZoom() {
229
- return this.mapService.getZoom();
230
- }
231
- getCenter(options) {
232
- return this.mapService.getCenter(options);
233
- }
234
- setCenter(center, options) {
235
- return this.mapService.setCenter(center, options);
236
- }
237
- getPitch() {
238
- return this.mapService.getPitch();
239
- }
240
- setPitch(pitch) {
241
- return this.mapService.setPitch(pitch);
242
- }
243
- getRotation() {
244
- return this.mapService.getRotation();
245
- }
246
- getBounds() {
247
- return this.mapService.getBounds();
248
- }
249
- setRotation(rotation) {
250
- this.mapService.setRotation(rotation);
251
- }
252
- zoomIn() {
253
- this.mapService.zoomIn();
254
- }
255
- zoomOut() {
256
- this.mapService.zoomOut();
257
- }
258
- panTo(p) {
259
- this.mapService.panTo(p);
260
- }
261
- panBy(x, y) {
262
- this.mapService.panBy(x, y);
263
- }
264
- getContainer() {
265
- return this.mapService.getContainer();
266
- }
267
- setZoom(zoom) {
268
- this.mapService.setZoom(zoom);
269
- }
270
- fitBounds(bound, options) {
271
- const { fitBoundsOptions, animate } = this.sceneService.getSceneConfig();
272
- this.mapService.fitBounds(bound, options || {
273
- ...fitBoundsOptions,
274
- animate
275
- });
276
- }
277
- setZoomAndCenter(zoom, center) {
278
- this.mapService.setZoomAndCenter(zoom, center);
279
- }
280
- setMapStyle(style) {
281
- this.mapService.setMapStyle(style);
282
- }
283
- setMapStatus(options) {
284
- this.mapService.setMapStatus(options);
285
- }
286
- pixelToLngLat(pixel) {
287
- return this.mapService.pixelToLngLat(pixel);
288
- }
289
- lngLatToPixel(lnglat) {
290
- return this.mapService.lngLatToPixel(lnglat);
291
- }
292
- containerToLngLat(pixel) {
293
- return this.mapService.containerToLngLat(pixel);
294
- }
295
- lngLatToContainer(lnglat) {
296
- return this.mapService.lngLatToContainer(lnglat);
297
- }
298
- destroy() {
299
- this.sceneService.destroy();
300
- }
301
- registerPostProcessingPass(constructor, name) {
302
- this.container.bind(import_l7_core.TYPES.IPostProcessingPass).to(constructor).whenTargetNamed(name);
303
- }
304
- enableShaderPick() {
305
- this.layerService.enableShaderPick();
306
- }
307
- diasbleShaderPick() {
308
- this.layerService.disableShaderPick();
309
- }
310
- getPointSizeRange() {
311
- return this.sceneService.getPointSizeRange();
312
- }
313
- initComponent(id) {
314
- this.controlService.init({
315
- container: import_l7_utils.DOM.getContainer(id)
316
- }, this.container);
317
- this.markerService.init(this.container);
318
- this.popupService.init(this.container);
319
- }
320
- initControl() {
321
- const { logoVisible, logoPosition } = this.sceneService.getSceneConfig();
322
- if (logoVisible) {
323
- this.addControl(new import_l7_component.Logo({ position: logoPosition }));
324
- }
325
- }
326
- };
327
- // Annotate the CommonJS export names for ESM import in node:
328
- 0 && (module.exports = {
329
- Scene
330
- });