@antv/l7-component 2.18.2 → 2.18.3

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.
Files changed (114) hide show
  1. package/es/assets/iconfont/iconfont.js +46 -0
  2. package/es/constants/index.d.ts +60 -0
  3. package/es/constants/index.js +60 -0
  4. package/es/control/baseControl/buttonControl.d.ts +59 -0
  5. package/es/control/baseControl/buttonControl.js +177 -0
  6. package/es/control/baseControl/control.d.ts +112 -0
  7. package/es/control/baseControl/control.js +302 -0
  8. package/es/control/baseControl/index.d.ts +4 -0
  9. package/es/control/baseControl/index.js +4 -0
  10. package/es/control/baseControl/popperControl.d.ts +26 -0
  11. package/es/control/baseControl/popperControl.js +120 -0
  12. package/es/control/baseControl/selectControl.d.ts +46 -0
  13. package/es/control/baseControl/selectControl.js +204 -0
  14. package/es/control/exportImage.d.ts +18 -0
  15. package/es/control/exportImage.js +159 -0
  16. package/es/control/fullscreen.d.ts +19 -0
  17. package/es/control/fullscreen.js +119 -0
  18. package/es/control/geoLocate.d.ts +16 -0
  19. package/es/control/geoLocate.js +107 -0
  20. package/es/control/layerSwitch.d.ts +19 -0
  21. package/es/control/layerSwitch.js +141 -0
  22. package/es/control/logo.d.ts +13 -0
  23. package/es/control/logo.js +75 -0
  24. package/es/control/mapTheme.d.ts +10 -0
  25. package/es/control/mapTheme.js +110 -0
  26. package/es/control/mouseLocation.d.ts +15 -0
  27. package/es/control/mouseLocation.js +83 -0
  28. package/es/control/scale.d.ts +34 -0
  29. package/es/control/scale.js +149 -0
  30. package/es/control/zoom.d.ts +38 -0
  31. package/es/control/zoom.js +132 -0
  32. package/es/css/button.less +70 -0
  33. package/es/css/control.less +71 -0
  34. package/es/css/index.css +594 -0
  35. package/es/css/index.less +12 -0
  36. package/es/css/l7.less +62 -0
  37. package/es/css/layerPopup.less +8 -0
  38. package/es/css/logo.less +18 -0
  39. package/es/css/mouseLocation.less +9 -0
  40. package/es/css/popper.less +64 -0
  41. package/es/css/popup.less +185 -0
  42. package/es/css/scale.less +34 -0
  43. package/es/css/select.less +86 -0
  44. package/es/css/variables.less +30 -0
  45. package/es/css/zoom.less +29 -0
  46. package/es/images/layers.png +0 -0
  47. package/es/images/layers.svg +1 -0
  48. package/es/images/logo.png +0 -0
  49. package/es/images/quanping.svg +12 -0
  50. package/es/index.d.ts +18 -0
  51. package/es/index.js +49 -0
  52. package/es/interface.d.ts +18 -0
  53. package/es/interface.js +1 -0
  54. package/es/marker-layer.d.ts +54 -0
  55. package/es/marker-layer.js +343 -0
  56. package/es/marker.d.ts +55 -0
  57. package/es/marker.js +410 -0
  58. package/es/popup/layerPopup.d.ts +86 -0
  59. package/es/popup/layerPopup.js +312 -0
  60. package/es/popup/popup.d.ts +139 -0
  61. package/es/popup/popup.js +567 -0
  62. package/es/utils/anchor.d.ts +22 -0
  63. package/es/utils/anchor.js +31 -0
  64. package/es/utils/icon.d.ts +1 -0
  65. package/es/utils/icon.js +9 -0
  66. package/es/utils/popper.d.ts +75 -0
  67. package/es/utils/popper.js +259 -0
  68. package/es/utils/screenfull.d.ts +2 -0
  69. package/es/utils/screenfull.js +128 -0
  70. package/lib/assets/iconfont/iconfont.js +48 -0
  71. package/lib/constants/index.js +68 -0
  72. package/lib/control/baseControl/buttonControl.js +183 -0
  73. package/lib/control/baseControl/control.js +314 -0
  74. package/lib/control/baseControl/index.js +39 -0
  75. package/lib/control/baseControl/popperControl.js +126 -0
  76. package/lib/control/baseControl/selectControl.js +210 -0
  77. package/lib/control/exportImage.js +165 -0
  78. package/lib/control/fullscreen.js +125 -0
  79. package/lib/control/geoLocate.js +113 -0
  80. package/lib/control/layerSwitch.js +147 -0
  81. package/lib/control/logo.js +81 -0
  82. package/lib/control/mapTheme.js +116 -0
  83. package/lib/control/mouseLocation.js +89 -0
  84. package/lib/control/scale.js +155 -0
  85. package/lib/control/zoom.js +138 -0
  86. package/lib/css/button.less +70 -0
  87. package/lib/css/control.less +71 -0
  88. package/lib/css/index.css +594 -0
  89. package/lib/css/index.less +12 -0
  90. package/lib/css/l7.less +62 -0
  91. package/lib/css/layerPopup.less +8 -0
  92. package/lib/css/logo.less +18 -0
  93. package/lib/css/mouseLocation.less +9 -0
  94. package/lib/css/popper.less +64 -0
  95. package/lib/css/popup.less +185 -0
  96. package/lib/css/scale.less +34 -0
  97. package/lib/css/select.less +86 -0
  98. package/lib/css/variables.less +30 -0
  99. package/lib/css/zoom.less +29 -0
  100. package/lib/images/layers.png +0 -0
  101. package/lib/images/layers.svg +1 -0
  102. package/lib/images/logo.png +0 -0
  103. package/lib/images/quanping.svg +12 -0
  104. package/lib/index.js +169 -0
  105. package/lib/interface.js +5 -0
  106. package/lib/marker-layer.js +349 -0
  107. package/lib/marker.js +417 -0
  108. package/lib/popup/layerPopup.js +317 -0
  109. package/lib/popup/popup.js +573 -0
  110. package/lib/utils/anchor.js +40 -0
  111. package/lib/utils/icon.js +16 -0
  112. package/lib/utils/popper.js +263 -0
  113. package/lib/utils/screenfull.js +136 -0
  114. package/package.json +6 -6
package/es/marker.js ADDED
@@ -0,0 +1,410 @@
1
+ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
+ import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
3
+ import _createClass from "@babel/runtime/helpers/esm/createClass";
4
+ import _assertThisInitialized from "@babel/runtime/helpers/esm/assertThisInitialized";
5
+ import _inherits from "@babel/runtime/helpers/esm/inherits";
6
+ import _possibleConstructorReturn from "@babel/runtime/helpers/esm/possibleConstructorReturn";
7
+ import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
8
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
9
+ 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); }; }
10
+ 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; } }
11
+ import { TYPES } from '@antv/l7-core';
12
+ import { anchorTranslate, anchorType, applyAnchorClass, bindAll, DOM, isPC } from '@antv/l7-utils';
13
+ import { EventEmitter } from 'eventemitter3';
14
+ // marker 支持 dragger 未完成
15
+ var Marker = /*#__PURE__*/function (_EventEmitter) {
16
+ _inherits(Marker, _EventEmitter);
17
+ var _super = _createSuper(Marker);
18
+ function Marker(option) {
19
+ var _this;
20
+ _classCallCheck(this, Marker);
21
+ _this = _super.call(this);
22
+ _defineProperty(_assertThisInitialized(_this), "added", false);
23
+ _defineProperty(_assertThisInitialized(_this), "eventHandle", function (e) {
24
+ _this.polyfillEvent(e);
25
+ _this.emit(e.type, {
26
+ target: e,
27
+ data: _this.markerOption.extData,
28
+ lngLat: _this.lngLat
29
+ });
30
+ });
31
+ _this.markerOption = _objectSpread(_objectSpread({}, _this.getDefault()), option);
32
+ bindAll(['update', 'onMove', 'onMapClick'], _assertThisInitialized(_this));
33
+ _this.init();
34
+ return _this;
35
+ }
36
+ _createClass(Marker, [{
37
+ key: "getMarkerLayerContainerSize",
38
+ value:
39
+ // tslint:disable-next-line: no-empty
40
+ function getMarkerLayerContainerSize() {}
41
+ }, {
42
+ key: "getDefault",
43
+ value: function getDefault() {
44
+ return {
45
+ element: undefined,
46
+ // DOM element
47
+ anchor: anchorType.BOTTOM,
48
+ offsets: [0, 0],
49
+ color: '#5B8FF9',
50
+ draggable: false
51
+ };
52
+ }
53
+ }, {
54
+ key: "addTo",
55
+ value: function addTo(scene) {
56
+ // this.remove();
57
+ this.scene = scene;
58
+ this.mapsService = scene.get(TYPES.IMapService);
59
+ this.sceneSerive = scene.get(TYPES.ISceneService);
60
+ var element = this.markerOption.element;
61
+ // this.sceneSerive.getSceneContainer().appendChild(element as HTMLElement);
62
+ this.mapsService.getMarkerContainer().appendChild(element);
63
+ this.registerMarkerEvent(element);
64
+ this.mapsService.on('camerachange', this.update); // 注册高德1.x 的地图事件监听
65
+ this.update();
66
+ this.added = true;
67
+ this.emit('added');
68
+ return this;
69
+ }
70
+ }, {
71
+ key: "remove",
72
+ value: function remove() {
73
+ if (this.mapsService) {
74
+ this.mapsService.off('click', this.onMapClick);
75
+ this.mapsService.off('move', this.update);
76
+ this.mapsService.off('moveend', this.update);
77
+ this.mapsService.off('camerachange', this.update);
78
+ }
79
+ this.unRegisterMarkerEvent();
80
+ this.removeAllListeners();
81
+ var element = this.markerOption.element;
82
+ if (element) {
83
+ DOM.remove(element);
84
+ }
85
+ if (this.popup) {
86
+ this.popup.remove();
87
+ }
88
+ return this;
89
+ }
90
+ }, {
91
+ key: "setLnglat",
92
+ value: function setLnglat(lngLat) {
93
+ this.lngLat = lngLat;
94
+ if (Array.isArray(lngLat)) {
95
+ this.lngLat = {
96
+ lng: lngLat[0],
97
+ lat: lngLat[1]
98
+ };
99
+ }
100
+ if (this.popup) {
101
+ this.popup.setLnglat(this.lngLat);
102
+ }
103
+ this.update();
104
+ return this;
105
+ }
106
+ }, {
107
+ key: "getLnglat",
108
+ value: function getLnglat() {
109
+ return this.lngLat;
110
+ }
111
+ }, {
112
+ key: "getElement",
113
+ value: function getElement() {
114
+ return this.markerOption.element;
115
+ }
116
+ }, {
117
+ key: "setElement",
118
+ value: function setElement(el) {
119
+ var _this2 = this;
120
+ if (!this.added) {
121
+ this.once('added', function () {
122
+ _this2.setElement(el);
123
+ });
124
+ return this;
125
+ }
126
+ var element = this.markerOption.element;
127
+ if (element) {
128
+ DOM.remove(element);
129
+ }
130
+ this.markerOption.element = el;
131
+ this.init();
132
+ this.mapsService.getMarkerContainer().appendChild(el);
133
+ this.registerMarkerEvent(el);
134
+ this.update();
135
+ return this;
136
+ }
137
+ }, {
138
+ key: "openPopup",
139
+ value: function openPopup() {
140
+ var _this3 = this;
141
+ if (!this.added) {
142
+ this.once('added', function () {
143
+ _this3.openPopup();
144
+ });
145
+ return this;
146
+ }
147
+ var popup = this.popup;
148
+ if (!popup) {
149
+ return this;
150
+ }
151
+ if (!popup.isOpen()) {
152
+ popup.addTo(this.scene);
153
+ }
154
+ return this;
155
+ }
156
+ }, {
157
+ key: "closePopup",
158
+ value: function closePopup() {
159
+ var _this4 = this;
160
+ if (!this.added) {
161
+ this.once('added', function () {
162
+ _this4.closePopup();
163
+ });
164
+ }
165
+ var popup = this.popup;
166
+ if (popup) {
167
+ popup.remove();
168
+ }
169
+ return this;
170
+ }
171
+ }, {
172
+ key: "setPopup",
173
+ value: function setPopup(popup) {
174
+ this.popup = popup;
175
+ if (this.lngLat) {
176
+ this.popup.setLnglat(this.lngLat);
177
+ }
178
+ return this;
179
+ }
180
+ }, {
181
+ key: "togglePopup",
182
+ value: function togglePopup() {
183
+ var popup = this.popup;
184
+ if (!popup) {
185
+ return this;
186
+ } else if (popup.isOpen()) {
187
+ popup.remove();
188
+ } else {
189
+ popup.addTo(this.scene);
190
+ }
191
+ return this;
192
+ }
193
+ }, {
194
+ key: "getPopup",
195
+ value: function getPopup() {
196
+ return this.popup;
197
+ }
198
+ }, {
199
+ key: "getOffset",
200
+ value: function getOffset() {
201
+ return this.markerOption.offsets;
202
+ }
203
+
204
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
205
+ }, {
206
+ key: "setDraggable",
207
+ value: function setDraggable(draggable) {
208
+ throw new Error('Method not implemented.');
209
+ }
210
+ }, {
211
+ key: "isDraggable",
212
+ value: function isDraggable() {
213
+ return this.markerOption.draggable;
214
+ }
215
+ }, {
216
+ key: "getExtData",
217
+ value: function getExtData() {
218
+ return this.markerOption.extData;
219
+ }
220
+ }, {
221
+ key: "setExtData",
222
+ value: function setExtData(data) {
223
+ this.markerOption.extData = data;
224
+ }
225
+ }, {
226
+ key: "update",
227
+ value: function update() {
228
+ if (!this.mapsService) {
229
+ return;
230
+ }
231
+ var _this$markerOption = this.markerOption,
232
+ element = _this$markerOption.element,
233
+ anchor = _this$markerOption.anchor;
234
+ this.updatePosition();
235
+ DOM.setTransform(element, "".concat(anchorTranslate[anchor]));
236
+ }
237
+
238
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
239
+ }, {
240
+ key: "onMapClick",
241
+ value: function onMapClick(e) {
242
+ var element = this.markerOption.element;
243
+ if (this.popup && element) {
244
+ this.togglePopup();
245
+ }
246
+ }
247
+ }, {
248
+ key: "getCurrentContainerSize",
249
+ value: function getCurrentContainerSize() {
250
+ var container = this.mapsService.getContainer();
251
+ return {
252
+ containerHeight: (container === null || container === void 0 ? void 0 : container.scrollHeight) || 0,
253
+ containerWidth: (container === null || container === void 0 ? void 0 : container.scrollWidth) || 0,
254
+ bounds: this.mapsService.getBounds()
255
+ };
256
+ }
257
+ }, {
258
+ key: "updatePosition",
259
+ value: function updatePosition() {
260
+ if (!this.mapsService) {
261
+ return;
262
+ }
263
+ var _this$markerOption2 = this.markerOption,
264
+ element = _this$markerOption2.element,
265
+ offsets = _this$markerOption2.offsets;
266
+ var _this$lngLat = this.lngLat,
267
+ lng = _this$lngLat.lng,
268
+ lat = _this$lngLat.lat;
269
+ var pos = this.mapsService.lngLatToContainer([lng, lat]);
270
+ if (element) {
271
+ element.style.display = 'block';
272
+ element.style.whiteSpace = 'nowrap';
273
+ var _ref = this.getMarkerLayerContainerSize() || this.getCurrentContainerSize(),
274
+ containerHeight = _ref.containerHeight,
275
+ containerWidth = _ref.containerWidth,
276
+ bounds = _ref.bounds;
277
+ if (!bounds) {
278
+ return;
279
+ }
280
+ // 当前可视区域包含跨日界线
281
+ if (Math.abs(bounds[0][0]) > 180 || Math.abs(bounds[1][0]) > 180) {
282
+ if (pos.x > containerWidth) {
283
+ // 日界线右侧点左移
284
+ var newPos = this.mapsService.lngLatToContainer([lng - 360, lat]);
285
+ pos.x = newPos.x;
286
+ }
287
+ if (pos.x < 0) {
288
+ // 日界线左侧点右移
289
+ var _newPos = this.mapsService.lngLatToContainer([lng + 360, lat]);
290
+ pos.x = _newPos.x;
291
+ }
292
+ }
293
+ // 不在当前可视区域内隐藏点
294
+ if (pos.x > containerWidth || pos.x < 0 || pos.y > containerHeight || pos.y < 0) {
295
+ element.style.display = 'none';
296
+ }
297
+ element.style.left = pos.x + offsets[0] + 'px';
298
+ element.style.top = pos.y - offsets[1] + 'px';
299
+ }
300
+ }
301
+ }, {
302
+ key: "init",
303
+ value: function init() {
304
+ var _this5 = this;
305
+ var element = this.markerOption.element;
306
+ var _this$markerOption3 = this.markerOption,
307
+ color = _this$markerOption3.color,
308
+ anchor = _this$markerOption3.anchor;
309
+ if (!element) {
310
+ this.defaultMarker = true;
311
+ element = DOM.create('div');
312
+ this.markerOption.element = element;
313
+ var svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
314
+ svg.setAttributeNS(null, 'display', 'block');
315
+ svg.setAttributeNS(null, 'height', '48px');
316
+ svg.setAttributeNS(null, 'width', '48px');
317
+ svg.setAttributeNS(null, 'viewBox', '0 0 1024 1024');
318
+ var path = document.createElementNS('http://www.w3.org/2000/svg', 'path');
319
+ path.setAttributeNS(null, 'd', 'M512 490.666667C453.12 490.666667 405.333333 442.88 405.333333 384 405.333333 325.12 453.12 277.333333 512 277.333333 570.88 277.333333 618.666667 325.12 618.666667 384 618.666667 442.88 570.88 490.666667 512 490.666667M512 85.333333C346.88 85.333333 213.333333 218.88 213.333333 384 213.333333 608 512 938.666667 512 938.666667 512 938.666667 810.666667 608 810.666667 384 810.666667 218.88 677.12 85.333333 512 85.333333Z');
320
+ path.setAttributeNS(null, 'fill', color);
321
+ svg.appendChild(path);
322
+ element.appendChild(svg);
323
+ }
324
+ DOM.addClass(element, 'l7-marker');
325
+ Object.keys(this.markerOption.style || {}).forEach(
326
+ // @ts-ignore
327
+ function (key) {
328
+ var _this5$markerOption, _this5$markerOption2;
329
+ var value = ((_this5$markerOption = _this5.markerOption) === null || _this5$markerOption === void 0 ? void 0 : _this5$markerOption.style) && ((_this5$markerOption2 = _this5.markerOption) === null || _this5$markerOption2 === void 0 ? void 0 : _this5$markerOption2.style[key]);
330
+ if (element) {
331
+ // @ts-ignore
332
+ element.style[key] = value;
333
+ }
334
+ });
335
+ applyAnchorClass(element, anchor, 'marker');
336
+ }
337
+ }, {
338
+ key: "registerMarkerEvent",
339
+ value: function registerMarkerEvent(element) {
340
+ element.addEventListener('click', this.onMapClick);
341
+ element.addEventListener('mousemove', this.eventHandle);
342
+ element.addEventListener('click', this.eventHandle);
343
+ element.addEventListener('mousedown', this.eventHandle);
344
+ element.addEventListener('mouseup', this.eventHandle);
345
+ element.addEventListener('dblclick', this.eventHandle);
346
+ element.addEventListener('contextmenu', this.eventHandle);
347
+ element.addEventListener('mouseover', this.eventHandle);
348
+ element.addEventListener('mouseout', this.eventHandle);
349
+ element.addEventListener('touchstart', this.eventHandle);
350
+ element.addEventListener('touchend', this.eventHandle);
351
+ }
352
+ }, {
353
+ key: "unRegisterMarkerEvent",
354
+ value: function unRegisterMarkerEvent() {
355
+ var element = this.getElement();
356
+ element.removeEventListener('click', this.onMapClick);
357
+ element.removeEventListener('mousemove', this.eventHandle);
358
+ element.removeEventListener('click', this.eventHandle);
359
+ element.removeEventListener('mousedown', this.eventHandle);
360
+ element.removeEventListener('mouseup', this.eventHandle);
361
+ element.removeEventListener('dblclick', this.eventHandle);
362
+ element.removeEventListener('contextmenu', this.eventHandle);
363
+ element.removeEventListener('mouseover', this.eventHandle);
364
+ element.removeEventListener('mouseout', this.eventHandle);
365
+ element.removeEventListener('touchstart', this.eventHandle);
366
+ element.removeEventListener('touchend', this.eventHandle);
367
+ }
368
+ }, {
369
+ key: "polyfillEvent",
370
+ value:
371
+ /**
372
+ * 高德 2.x 使用了 fastClick.js 避免延迟,导致 IOS 移动端的 click 事件不会正常触发,需要手动触发
373
+ * @param e
374
+ */
375
+
376
+ function polyfillEvent(e) {
377
+ if (!this.mapsService || this.mapsService.version !== 'GAODE2.x') {
378
+ return;
379
+ }
380
+ if (!isPC()) {
381
+ if (e.type === 'touchstart') {
382
+ this.touchStartTime = Date.now();
383
+ }
384
+ if (e.type === 'touchend' && Date.now() - this.touchStartTime < 300) {
385
+ this.emit('click', {
386
+ target: e,
387
+ data: this.markerOption.extData,
388
+ lngLat: this.lngLat
389
+ });
390
+ }
391
+ }
392
+ }
393
+
394
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
395
+ }, {
396
+ key: "addDragHandler",
397
+ value: function addDragHandler(e) {
398
+ return null;
399
+ }
400
+
401
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
402
+ }, {
403
+ key: "onUp",
404
+ value: function onUp(e) {
405
+ throw new Error('Method not implemented.');
406
+ }
407
+ }]);
408
+ return Marker;
409
+ }(EventEmitter);
410
+ export { Marker as default };
@@ -0,0 +1,86 @@
1
+ import { ILayer, IPopupOption } from '@antv/l7-core';
2
+ import { DOM } from '@antv/l7-utils';
3
+ import { Container } from 'inversify';
4
+ import Popup from './popup';
5
+ type ElementType = DOM.ElementType;
6
+ export type LayerField = {
7
+ field: string;
8
+ formatField?: ElementType | ((field: string, feature: any) => ElementType);
9
+ formatValue?: ElementType | ((value: any, feature: any) => ElementType);
10
+ getValue?: (feature: any) => any;
11
+ };
12
+ export type LayerPopupConfigItem = {
13
+ layer: ILayer | string;
14
+ fields?: Array<LayerField | string>;
15
+ title?: ElementType | ((feature: any) => ElementType);
16
+ customContent?: ElementType | ((feature: any) => ElementType);
17
+ };
18
+ export interface ILayerPopupOption extends IPopupOption {
19
+ config?: LayerPopupConfigItem[];
20
+ items?: LayerPopupConfigItem[];
21
+ trigger: 'hover' | 'click';
22
+ }
23
+ type LayerMapInfo = {
24
+ onMouseMove?: (layer: ILayer, e: any) => void;
25
+ onMouseOut?: (layer: ILayer, e: any) => void;
26
+ onClick?: (layer: ILayer, e: any) => void;
27
+ onSourceUpdate?: (layer: ILayer) => void;
28
+ } & Partial<LayerPopupConfigItem>;
29
+ export { LayerPopup };
30
+ export default class LayerPopup extends Popup<ILayerPopupOption> {
31
+ /**
32
+ * 用于保存图层对应的事件回调以及配置信息
33
+ * @protected
34
+ */
35
+ protected layerConfigMap: WeakMap<ILayer, LayerMapInfo>;
36
+ /**
37
+ * 当期正在展示的图层以及对应元素 id 的信息
38
+ * @protected
39
+ */
40
+ protected displayFeatureInfo?: {
41
+ layer: ILayer;
42
+ featureId: number;
43
+ };
44
+ protected get layerConfigItems(): LayerPopupConfigItem[];
45
+ addTo(scene: Container): this;
46
+ remove(): this;
47
+ setOptions(option: Partial<ILayerPopupOption>): this;
48
+ protected getDefault(option: Partial<ILayerPopupOption>): ILayerPopupOption;
49
+ /**
50
+ * 绑定对应的图层事件
51
+ * @protected
52
+ */
53
+ protected bindLayerEvent(): void;
54
+ /**
55
+ * 解绑对应的图层事件
56
+ * @protected
57
+ */
58
+ protected unbindLayerEvent(): void;
59
+ protected onLayerMouseMove(layer: ILayer, e: any): void;
60
+ protected onLayerMouseOut(layer: ILayer, e: any): void;
61
+ protected onLayerClick(layer: ILayer, e: any): void;
62
+ protected onSourceUpdate(layer: ILayer): void;
63
+ /**
64
+ * 通过当前图层和对应选中的元素获取气泡展示的 HTML 内容
65
+ * @param layer
66
+ * @param e
67
+ * @protected
68
+ */
69
+ protected getLayerInfoFrag(layer: ILayer, e: any): {
70
+ title: DocumentFragment | undefined;
71
+ content: DocumentFragment;
72
+ };
73
+ /**
74
+ * 通过 Layer 配置访问到真实的 Layer 实例
75
+ * @param configItem
76
+ * @protected
77
+ */
78
+ protected getLayerByConfig(configItem: LayerPopupConfigItem): ILayer | undefined;
79
+ /**
80
+ * 判断当前展示的 Feature 是否和上一次查看的一致
81
+ * @param layer
82
+ * @param featureId
83
+ * @protected
84
+ */
85
+ protected isSameFeature(layer: ILayer, featureId: number): boolean | undefined;
86
+ }