@lin1538001/unified-map 0.1.0 → 0.1.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/README.md CHANGED
@@ -1,11 +1,11 @@
1
- # @linyy/unified-map
1
+ # @lin1538001/unified-map
2
2
 
3
3
  一个 TypeScript 地图适配层,为高德地图、百度地图和 ArcGIS 提供统一的生命周期、覆盖物、批量图层、绘制与编辑 API。
4
4
 
5
5
  ## 安装
6
6
 
7
7
  ```bash
8
- pnpm add @linyy/unified-map vue
8
+ pnpm add @lin1538001/unified-map vue
9
9
  ```
10
10
 
11
11
  仅在使用 ArcGIS provider 时安装 ArcGIS SDK:
@@ -17,7 +17,7 @@ pnpm add @arcgis/core
17
17
  ## 基础用法
18
18
 
19
19
  ```ts
20
- import { UnifiedMap } from '@linyy/unified-map'
20
+ import { UnifiedMap } from '@lin1538001/unified-map'
21
21
 
22
22
  const map = new UnifiedMap({
23
23
  provider: 'amap',
@@ -1,11 +1,11 @@
1
1
  var S = Object.defineProperty;
2
2
  var g = (f, e, t) => e in f ? S(f, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : f[e] = t;
3
3
  var y = (f, e, t) => (g(f, typeof e != "symbol" ? e + "" : e, t), t);
4
- import { l as k, a as P } from "./mapLoader-06d6e155.js";
5
- import { M as n, a as u } from "./index-5b75eace.js";
6
- import { t as m } from "./color-128d7dff.js";
4
+ import { l as k, a as w } from "./mapLoader-06d6e155.js";
5
+ import { M as n, a as u } from "./index-dd303ebf.js";
6
+ import { t as p } from "./color-128d7dff.js";
7
7
  import "vue";
8
- class v {
8
+ class E {
9
9
  constructor() {
10
10
  y(this, "coordinateSystem", "gcj02");
11
11
  y(this, "sdk", null);
@@ -22,7 +22,7 @@ class v {
22
22
  y(this, "polygonLayers", /* @__PURE__ */ new Set());
23
23
  }
24
24
  async init(e) {
25
- var o, r, s, i;
25
+ var o, s, i, r;
26
26
  if (!e.key)
27
27
  throw new n("SDK_ERROR", "AMap requires a key");
28
28
  const t = this.resolveContainer(e.container);
@@ -31,26 +31,26 @@ class v {
31
31
  center: e.center || [116.397428, 39.90923],
32
32
  zoom: e.zoom ?? 12,
33
33
  viewMode: "2D"
34
- }), this.mouseTool = new this.sdk.MouseTool(this.map), this.locaSdk = await P(e.key), this.loca = new this.locaSdk.Container({ map: this.map });
34
+ }), this.mouseTool = new this.sdk.MouseTool(this.map), this.locaSdk = await w(e.key), this.loca = new this.locaSdk.Container({ map: this.map });
35
35
  } catch (a) {
36
- throw (r = (o = this.loca) == null ? void 0 : o.destroy) == null || r.call(o), this.loca = null, this.locaSdk = null, (i = (s = this.map) == null ? void 0 : s.destroy) == null || i.call(s), this.sdk = null, this.map = null, new n("SDK_ERROR", "Failed to initialize AMap", { cause: a });
36
+ throw (s = (o = this.loca) == null ? void 0 : o.destroy) == null || s.call(o), this.loca = null, this.locaSdk = null, (r = (i = this.map) == null ? void 0 : i.destroy) == null || r.call(i), this.sdk = null, this.map = null, new n("SDK_ERROR", "Failed to initialize AMap", { cause: a });
37
37
  }
38
38
  }
39
39
  destroy() {
40
- var e, t, o, r, s;
40
+ var e, t, o, s, i;
41
41
  this.activeEdit && this.finishEdit(this.activeEdit), this.cancelDraw();
42
- for (const i of this.massPointLayers)
43
- this.destroyMassPointLayer(i);
42
+ for (const r of this.massPointLayers)
43
+ this.destroyMassPointLayer(r);
44
44
  this.massPointLayers.clear();
45
- for (const i of this.scatterLayers)
46
- this.destroyScatterLayer(i);
45
+ for (const r of this.scatterLayers)
46
+ this.destroyScatterLayer(r);
47
47
  this.scatterLayers.clear();
48
- for (const i of this.polylineLayers)
49
- this.destroyPolylineLayer(i);
48
+ for (const r of this.polylineLayers)
49
+ this.destroyPolylineLayer(r);
50
50
  this.polylineLayers.clear();
51
- for (const i of this.polygonLayers)
52
- this.destroyPolygonLayer(i);
53
- this.polygonLayers.clear(), (o = (t = (e = this.loca) == null ? void 0 : e.animate) == null ? void 0 : t.stop) == null || o.call(t), (s = (r = this.loca) == null ? void 0 : r.destroy) == null || s.call(r), this.loca = null, this.locaSdk = null, this.map && typeof this.map.destroy == "function" && this.map.destroy(), this.mouseTool = null, this.map = null, this.sdk = null;
51
+ for (const r of this.polygonLayers)
52
+ this.destroyPolygonLayer(r);
53
+ this.polygonLayers.clear(), (o = (t = (e = this.loca) == null ? void 0 : e.animate) == null ? void 0 : t.stop) == null || o.call(t), (i = (s = this.loca) == null ? void 0 : s.destroy) == null || i.call(s), this.loca = null, this.locaSdk = null, this.map && typeof this.map.destroy == "function" && this.map.destroy(), this.mouseTool = null, this.map = null, this.sdk = null;
54
54
  }
55
55
  addMarker(e) {
56
56
  const t = this.createMarker(e);
@@ -71,14 +71,14 @@ class v {
71
71
  return this.polylineLayers.add(t), t;
72
72
  }
73
73
  updatePolylineLayer(e, t, o) {
74
- var i, a;
75
- const r = e;
76
- if (!this.polylineLayers.has(r))
74
+ var r, a;
75
+ const s = e;
76
+ if (!this.polylineLayers.has(s))
77
77
  throw new n("OVERLAY_NOT_FOUND", "Polyline layer is no longer registered");
78
78
  if (!("polylines" in o) && !("zIndex" in o) && !("minZoom" in o) && !("maxZoom" in o))
79
- return "style" in o && ((a = (i = r.layer).setStyle) == null || a.call(i, this.toPolylineLayerStyle(t))), "visible" in o && this.setLocaLayerVisibility(r.layer, t.visible !== !1), e;
80
- const s = this.createPolylineLayer(t);
81
- return this.polylineLayers.add(s), this.destroyPolylineLayer(r), this.polylineLayers.delete(r), s;
79
+ return "style" in o && ((a = (r = s.layer).setStyle) == null || a.call(r, this.toPolylineLayerStyle(t))), "visible" in o && this.setLocaLayerVisibility(s.layer, t.visible !== !1), e;
80
+ const i = this.createPolylineLayer(t);
81
+ return this.polylineLayers.add(i), this.destroyPolylineLayer(s), this.polylineLayers.delete(s), i;
82
82
  }
83
83
  removePolylineLayer(e) {
84
84
  const t = e;
@@ -91,14 +91,14 @@ class v {
91
91
  return this.polygonLayers.add(t), t;
92
92
  }
93
93
  updatePolygonLayer(e, t, o) {
94
- var i, a, l, h;
95
- const r = e;
96
- if (!this.polygonLayers.has(r))
94
+ var r, a, l, c;
95
+ const s = e;
96
+ if (!this.polygonLayers.has(s))
97
97
  throw new n("OVERLAY_NOT_FOUND", "Polygon layer is no longer registered");
98
98
  if (!("polygons" in o) && !("zIndex" in o) && !("minZoom" in o) && !("maxZoom" in o))
99
- return "style" in o && ((a = (i = r.layer).setStyle) == null || a.call(i, this.toPolygonLayerStyle(t)), (h = (l = r.outlineLayer).setStyle) == null || h.call(l, this.toPolygonOutlineStyle(t))), "visible" in o && (this.setLocaLayerVisibility(r.layer, t.visible !== !1), this.setLocaLayerVisibility(r.outlineLayer, t.visible !== !1)), e;
100
- const s = this.createPolygonLayer(t);
101
- return this.polygonLayers.add(s), this.destroyPolygonLayer(r), this.polygonLayers.delete(r), s;
99
+ return "style" in o && ((a = (r = s.layer).setStyle) == null || a.call(r, this.toPolygonLayerStyle(t)), (c = (l = s.outlineLayer).setStyle) == null || c.call(l, this.toPolygonOutlineStyle(t))), "visible" in o && (this.setLocaLayerVisibility(s.layer, t.visible !== !1), this.setLocaLayerVisibility(s.outlineLayer, t.visible !== !1)), e;
100
+ const i = this.createPolygonLayer(t);
101
+ return this.polygonLayers.add(i), this.destroyPolygonLayer(s), this.polygonLayers.delete(s), i;
102
102
  }
103
103
  removePolygonLayer(e) {
104
104
  const t = e;
@@ -114,45 +114,45 @@ class v {
114
114
  const o = e;
115
115
  if (!this.massPointLayers.has(o))
116
116
  throw new n("OVERLAY_NOT_FOUND", "Mass point layer is no longer registered");
117
- const r = this.createMassPointLayer(t);
118
- return this.massPointLayers.add(r), this.destroyMassPointLayer(o), this.massPointLayers.delete(o), r;
117
+ const s = this.createMassPointLayer(t);
118
+ return this.massPointLayers.add(s), this.destroyMassPointLayer(o), this.massPointLayers.delete(o), s;
119
119
  }
120
120
  removeMassPoints(e) {
121
121
  const t = e;
122
122
  this.massPointLayers.has(t) && (this.destroyMassPointLayer(t), this.massPointLayers.delete(t));
123
123
  }
124
124
  addScatterLayer(e) {
125
- var o, r;
125
+ var o, s;
126
126
  if (!this.loca || !this.locaSdk)
127
127
  throw new n("SDK_ERROR", "AMap Loca is unavailable");
128
128
  const t = this.createScatterLayer(e);
129
- return this.scatterLayers.add(t), (r = (o = this.loca.animate) == null ? void 0 : o.start) == null || r.call(o), t;
129
+ return this.scatterLayers.add(t), (s = (o = this.loca.animate) == null ? void 0 : o.start) == null || s.call(o), t;
130
130
  }
131
131
  updateScatterLayer(e, t) {
132
132
  const o = e;
133
133
  if (!this.scatterLayers.has(o))
134
134
  throw new n("OVERLAY_NOT_FOUND", "Scatter layer is no longer registered");
135
- const r = this.createScatterLayer(t);
136
- return this.scatterLayers.add(r), this.destroyScatterLayer(o), this.scatterLayers.delete(o), r;
135
+ const s = this.createScatterLayer(t);
136
+ return this.scatterLayers.add(s), this.destroyScatterLayer(o), this.scatterLayers.delete(o), s;
137
137
  }
138
138
  removeScatterLayer(e) {
139
- var o, r, s;
139
+ var o, s, i;
140
140
  const t = e;
141
- this.scatterLayers.has(t) && (this.destroyScatterLayer(t), this.scatterLayers.delete(t), this.scatterLayers.size === 0 && ((s = (r = (o = this.loca) == null ? void 0 : o.animate) == null ? void 0 : r.stop) == null || s.call(r)));
141
+ this.scatterLayers.has(t) && (this.destroyScatterLayer(t), this.scatterLayers.delete(t), this.scatterLayers.size === 0 && ((i = (s = (o = this.loca) == null ? void 0 : o.animate) == null ? void 0 : s.stop) == null || i.call(s)));
142
142
  }
143
143
  updateOverlay(e, t, o) {
144
- var i, a, l, h;
145
- const r = this.overlayKinds.get(e);
146
- if (!r)
144
+ var r, a, l, c;
145
+ const s = this.overlayKinds.get(e);
146
+ if (!s)
147
147
  throw new n("OVERLAY_NOT_FOUND", "Overlay is no longer registered");
148
- const s = e;
149
- if (r === "polyline") {
150
- const c = t;
151
- return (i = s.setOptions) == null || i.call(s, this.toPolylineStyle(c)), "path" in o && ((a = s.setPath) == null || a.call(s, c.path)), e;
148
+ const i = e;
149
+ if (s === "polyline") {
150
+ const h = t;
151
+ return (r = i.setOptions) == null || r.call(i, this.toPolylineStyle(h)), "path" in o && ((a = i.setPath) == null || a.call(i, h.path)), e;
152
152
  }
153
- if (r === "polygon") {
154
- const c = t;
155
- return (l = s.setOptions) == null || l.call(s, this.toPolygonStyle(c)), "path" in o && ((h = s.setPath) == null || h.call(s, c.path)), e;
153
+ if (s === "polygon") {
154
+ const h = t;
155
+ return (l = i.setOptions) == null || l.call(i, this.toPolygonStyle(h)), "path" in o && ((c = i.setPath) == null || c.call(i, h.path)), e;
156
156
  }
157
157
  return this.removeOverlay(e), this.addMarker(t);
158
158
  }
@@ -165,17 +165,17 @@ class v {
165
165
  return !t || typeof t.getPath != "function" ? null : t.getPath().map((o) => u([o.lng, o.lat]));
166
166
  }
167
167
  getPosition(e) {
168
- var r;
168
+ var s;
169
169
  const t = e;
170
170
  if (!t)
171
171
  return null;
172
- const o = typeof t.getPosition == "function" ? t.getPosition() : (r = t.getCenter) == null ? void 0 : r.call(t);
172
+ const o = typeof t.getPosition == "function" ? t.getPosition() : (s = t.getCenter) == null ? void 0 : s.call(t);
173
173
  return o ? u([o.lng, o.lat]) : null;
174
174
  }
175
175
  onMapClick(e) {
176
176
  const t = (o) => {
177
- const r = this.toClickEvent(o);
178
- r && e(r);
177
+ const s = this.toClickEvent(o);
178
+ s && e(s);
179
179
  };
180
180
  return this.map.on("click", t), () => {
181
181
  var o;
@@ -183,57 +183,57 @@ class v {
183
183
  };
184
184
  }
185
185
  onOverlayClick(e, t) {
186
- var s;
187
- const o = (i) => {
188
- const a = this.toClickEvent(i, e);
186
+ var i;
187
+ const o = (r) => {
188
+ const a = this.toClickEvent(r, e);
189
189
  a && t(a);
190
- }, r = e;
191
- return (s = r.on) == null || s.call(r, "click", o), () => {
192
- var i;
193
- return (i = r.off) == null ? void 0 : i.call(r, "click", o);
190
+ }, s = e;
191
+ return (i = s.on) == null || i.call(s, "click", o), () => {
192
+ var r;
193
+ return (r = s.off) == null ? void 0 : r.call(s, "click", o);
194
194
  };
195
195
  }
196
196
  startEdit(e, t, o) {
197
- var l, h, c;
197
+ var l, c, h;
198
198
  if (this.overlayKinds.get(e) !== t)
199
199
  throw new n("INVALID_OPTIONS", "Only polyline and polygon overlays can be edited");
200
- const r = t === "polyline" ? (l = this.sdk) == null ? void 0 : l.PolylineEditor : (h = this.sdk) == null ? void 0 : h.PolygonEditor;
201
- if (!r)
200
+ const s = t === "polyline" ? (l = this.sdk) == null ? void 0 : l.PolylineEditor : (c = this.sdk) == null ? void 0 : c.PolygonEditor;
201
+ if (!s)
202
202
  throw new n("SDK_ERROR", `AMap ${t} editor is unavailable`);
203
203
  if (this.activeDraw)
204
204
  throw new n("DRAW_IN_PROGRESS", "Cannot edit while drawing");
205
205
  this.activeEdit && this.finishEdit(this.activeEdit);
206
- const s = new r(this.map, e), i = { native: e, editor: s, handlers: [], onChange: o, stopped: !1 }, a = () => {
207
- if (i.stopped)
206
+ const i = new s(this.map, e), r = { native: e, editor: i, handlers: [], onChange: o, stopped: !1 }, a = () => {
207
+ if (r.stopped)
208
208
  return;
209
- const d = this.getPath(i.native);
210
- d && i.onChange(d);
209
+ const d = this.getPath(r.native);
210
+ d && r.onChange(d);
211
211
  };
212
212
  for (const d of ["adjust", "addnode", "removenode", "end"])
213
- (c = s.on) == null || c.call(s, d, a), i.handlers.push({ event: d, handler: a });
214
- this.activeEdit = i;
213
+ (h = i.on) == null || h.call(i, d, a), r.handlers.push({ event: d, handler: a });
214
+ this.activeEdit = r;
215
215
  try {
216
- s.open();
216
+ i.open();
217
217
  } catch (d) {
218
- throw this.finishEdit(i), new n("SDK_ERROR", `Failed to start AMap ${t} editing`, { cause: d });
218
+ throw this.finishEdit(r), new n("SDK_ERROR", `Failed to start AMap ${t} editing`, { cause: d });
219
219
  }
220
- return () => this.finishEdit(i);
220
+ return () => this.finishEdit(r);
221
221
  }
222
- startDraw(e, t, o, r) {
222
+ startDraw(e, t, o, s) {
223
223
  if (this.activeDraw)
224
224
  throw new n("DRAW_IN_PROGRESS", "A drawing operation is already active");
225
225
  this.activeEdit && this.finishEdit(this.activeEdit);
226
- const s = (i) => {
226
+ const i = (r) => {
227
227
  const a = this.activeDraw;
228
228
  if (!a || a.completed)
229
229
  return;
230
230
  a.completed = !0, this.cleanupDraw(a);
231
- const l = i == null ? void 0 : i.obj;
231
+ const l = r == null ? void 0 : r.obj;
232
232
  l && this.remember(l, e);
233
- const h = this.getPath(l) || [];
234
- o(l, h);
233
+ const c = this.getPath(l) || [];
234
+ o(l, c);
235
235
  };
236
- this.activeDraw = { handler: s, onCancel: r, completed: !1 }, this.mouseTool.on("draw", s), e === "polyline" ? this.mouseTool.polyline(this.toPolylineStyle(t)) : this.mouseTool.polygon(this.toPolygonStyle(t));
236
+ this.activeDraw = { handler: i, onCancel: s, completed: !1 }, this.mouseTool.on("draw", i), e === "polyline" ? this.mouseTool.polyline(this.toPolylineStyle(t)) : this.mouseTool.polygon(this.toPolygonStyle(t));
237
237
  }
238
238
  cancelDraw() {
239
239
  const e = this.activeDraw;
@@ -252,6 +252,44 @@ class v {
252
252
  getZoom() {
253
253
  return this.map.getZoom();
254
254
  }
255
+ fitView(e, t, o, s) {
256
+ if (e.length === 0)
257
+ return;
258
+ const i = new this.sdk.LngLat(e[0][0], e[0][1]), r = new this.sdk.Bounds(i, i);
259
+ if (e.slice(1).forEach((a) => r.extend(new this.sdk.LngLat(a[0], a[1]))), typeof this.map.getFitZoomAndCenterByBounds == "function") {
260
+ const [a, l] = this.map.getFitZoomAndCenterByBounds(r, [...o], s);
261
+ this.map.setZoomAndCenter(a, l, t);
262
+ return;
263
+ }
264
+ this.map.setBounds(r, t, [...o]), s !== void 0 && this.map.getZoom() > s && this.map.setZoom(s);
265
+ }
266
+ createInfoWindow(e, t, o) {
267
+ var a, l;
268
+ const s = new this.sdk.InfoWindow({
269
+ content: e.content ?? "",
270
+ position: e.position,
271
+ isCustom: e.isCustom ?? !1,
272
+ autoMove: e.autoMove ?? !0,
273
+ closeWhenClickMap: e.closeWhenClickMap ?? !1,
274
+ anchor: e.anchor ?? "bottom-center",
275
+ offset: e.offset ? new this.sdk.Pixel(e.offset[0], e.offset[1]) : void 0,
276
+ size: e.size ? new this.sdk.Size(e.size[0], e.size[1]) : void 0,
277
+ extData: e.extData
278
+ }), i = (c) => t(c), r = (c) => o(c);
279
+ return (a = s.on) == null || a.call(s, "open", i), (l = s.on) == null || l.call(s, "close", r), { value: s, openHandler: i, closeHandler: r };
280
+ }
281
+ openInfoWindow(e, t) {
282
+ e.value.open(this.map, t);
283
+ }
284
+ closeInfoWindow(e) {
285
+ var o, s;
286
+ (s = (o = e.value).close) == null || s.call(o);
287
+ }
288
+ destroyInfoWindow(e) {
289
+ var o, s, i, r, a, l;
290
+ const t = e;
291
+ (s = (o = t.value).off) == null || s.call(o, "open", t.openHandler), (r = (i = t.value).off) == null || r.call(i, "close", t.closeHandler), (l = (a = t.value).close) == null || l.call(a);
292
+ }
255
293
  resolveContainer(e) {
256
294
  if (typeof e == "string") {
257
295
  if (!document.getElementById(e))
@@ -284,8 +322,8 @@ class v {
284
322
  return Array.isArray(o) ? u(o) : u([o.lng, o.lat]);
285
323
  if (!t)
286
324
  return null;
287
- const r = this.getPath(t);
288
- return r && r.length > 0 ? r[0] : null;
325
+ const s = this.getPath(t);
326
+ return s && s.length > 0 ? s[0] : null;
289
327
  }
290
328
  createMarker(e) {
291
329
  const t = e.style || { kind: "circle" };
@@ -335,19 +373,34 @@ class v {
335
373
  });
336
374
  }
337
375
  createMassPointLayer(e) {
338
- const t = new this.locaSdk.GeoJSONSource({ data: this.toMassPointGeoJSON(e) }), o = new this.locaSdk.PointLayer({
376
+ const t = new this.locaSdk.GeoJSONSource({ data: this.toMassPointGeoJSON(e) }), o = e.style || {}, s = o.icon ? new this.locaSdk.IconLayer({
377
+ zIndex: e.zIndex ?? 100,
378
+ opacity: o.opacity ?? 1,
379
+ visible: e.visible !== !1,
380
+ zooms: [e.minZoom ?? 2, e.maxZoom ?? 26]
381
+ }) : new this.locaSdk.PointLayer({
339
382
  zIndex: e.zIndex ?? 100,
340
383
  opacity: 1,
341
384
  visible: e.visible !== !1,
342
385
  zooms: [e.minZoom ?? 2, e.maxZoom ?? 26]
343
- }), r = e.style || {};
344
- return o.setSource(t), o.setStyle({
345
- radius: (r.size ?? 10) / 2,
346
- color: m(r.color || "#1677ff", r.opacity ?? 0.85),
347
- borderWidth: r.borderWidth ?? 0,
348
- borderColor: r.borderColor || "#ffffff",
349
- unit: r.unit || "px"
350
- }), this.loca.add(o), { layer: o, source: t };
386
+ });
387
+ if (s.setSource(t), o.icon) {
388
+ const i = o.icon.width ?? o.size ?? 20, r = o.icon.height ?? o.size ?? 20;
389
+ s.setStyle({
390
+ icon: o.icon.url,
391
+ iconSize: [i, r],
392
+ offset: o.icon.anchor === "bottom-center" ? [0, r / 2] : [0, 0],
393
+ unit: o.unit || "px"
394
+ });
395
+ } else
396
+ s.setStyle({
397
+ radius: (o.size ?? 10) / 2,
398
+ color: p(o.color || "#1677ff", o.opacity ?? 0.85),
399
+ borderWidth: o.borderWidth ?? 0,
400
+ borderColor: o.borderColor || "#ffffff",
401
+ unit: o.unit || "px"
402
+ });
403
+ return this.loca.add(s), { layer: s, source: t };
351
404
  }
352
405
  createPolylineLayer(e) {
353
406
  const t = new this.locaSdk.GeoJSONSource({ data: this.toPolylineLayerGeoJSON(e) }), o = new this.locaSdk.LineLayer({
@@ -359,11 +412,11 @@ class v {
359
412
  return o.setSource(t), o.setStyle(this.toPolylineLayerStyle(e)), this.loca.add(o), { layer: o, source: t };
360
413
  }
361
414
  destroyPolylineLayer(e) {
362
- var t, o, r, s, i, a;
363
- (o = (t = this.loca) == null ? void 0 : t.remove) == null || o.call(t, e.layer), (s = (r = e.layer) == null ? void 0 : r.destroy) == null || s.call(r), (a = (i = e.source) == null ? void 0 : i.destroy) == null || a.call(i);
415
+ var t, o, s, i, r, a;
416
+ (o = (t = this.loca) == null ? void 0 : t.remove) == null || o.call(t, e.layer), (i = (s = e.layer) == null ? void 0 : s.destroy) == null || i.call(s), (a = (r = e.source) == null ? void 0 : r.destroy) == null || a.call(r);
364
417
  }
365
418
  createPolygonLayer(e) {
366
- const t = new this.locaSdk.GeoJSONSource({ data: this.toPolygonLayerGeoJSON(e) }), o = new this.locaSdk.GeoJSONSource({ data: this.toPolygonOutlineGeoJSON(e) }), r = new this.locaSdk.PolygonLayer({
419
+ const t = new this.locaSdk.GeoJSONSource({ data: this.toPolygonLayerGeoJSON(e) }), o = new this.locaSdk.GeoJSONSource({ data: this.toPolygonOutlineGeoJSON(e) }), s = new this.locaSdk.PolygonLayer({
367
420
  zIndex: e.zIndex ?? 80,
368
421
  opacity: 1,
369
422
  visible: e.visible !== !1,
@@ -374,23 +427,23 @@ class v {
374
427
  hasBottom: !1,
375
428
  depth: !1
376
429
  });
377
- r.setSource(t), r.setStyle(this.toPolygonLayerStyle(e));
378
- const s = new this.locaSdk.LineLayer({
430
+ s.setSource(t), s.setStyle(this.toPolygonLayerStyle(e));
431
+ const i = new this.locaSdk.LineLayer({
379
432
  zIndex: (e.zIndex ?? 80) + 1,
380
433
  opacity: 1,
381
434
  visible: e.visible !== !1,
382
435
  zooms: [e.minZoom ?? 2, e.maxZoom ?? 26]
383
436
  });
384
- return s.setSource(o), s.setStyle(this.toPolygonOutlineStyle(e)), this.loca.add(r), this.loca.add(s), { layer: r, outlineLayer: s, source: t, outlineSource: o };
437
+ return i.setSource(o), i.setStyle(this.toPolygonOutlineStyle(e)), this.loca.add(s), this.loca.add(i), { layer: s, outlineLayer: i, source: t, outlineSource: o };
385
438
  }
386
439
  destroyPolygonLayer(e) {
387
- var t, o, r, s, i, a, l, h, c, d, p, L;
388
- (o = (t = this.loca) == null ? void 0 : t.remove) == null || o.call(t, e.outlineLayer), (s = (r = this.loca) == null ? void 0 : r.remove) == null || s.call(r, e.layer), (a = (i = e.outlineLayer) == null ? void 0 : i.destroy) == null || a.call(i), (h = (l = e.layer) == null ? void 0 : l.destroy) == null || h.call(l), (d = (c = e.outlineSource) == null ? void 0 : c.destroy) == null || d.call(c), (L = (p = e.source) == null ? void 0 : p.destroy) == null || L.call(p);
440
+ var t, o, s, i, r, a, l, c, h, d, m, L;
441
+ (o = (t = this.loca) == null ? void 0 : t.remove) == null || o.call(t, e.outlineLayer), (i = (s = this.loca) == null ? void 0 : s.remove) == null || i.call(s, e.layer), (a = (r = e.outlineLayer) == null ? void 0 : r.destroy) == null || a.call(r), (c = (l = e.layer) == null ? void 0 : l.destroy) == null || c.call(l), (d = (h = e.outlineSource) == null ? void 0 : h.destroy) == null || d.call(h), (L = (m = e.source) == null ? void 0 : m.destroy) == null || L.call(m);
389
442
  }
390
443
  toPolylineLayerStyle(e) {
391
444
  const t = e.style || {};
392
445
  return {
393
- color: m(t.strokeColor || "#3366ff", t.strokeOpacity ?? 1),
446
+ color: p(t.strokeColor || "#3366ff", t.strokeOpacity ?? 1),
394
447
  lineWidth: t.strokeWeight ?? 3,
395
448
  borderWidth: 0,
396
449
  dash: t.strokeStyle === "dashed" ? [10, 10, 10, 10] : [0, 0, 0, 0]
@@ -399,7 +452,7 @@ class v {
399
452
  toPolygonLayerStyle(e) {
400
453
  const t = e.style || {};
401
454
  return {
402
- topColor: m(t.fillColor || "#3366ff", t.fillOpacity ?? 0.3),
455
+ topColor: p(t.fillColor || "#3366ff", t.fillOpacity ?? 0.3),
403
456
  altitude: 0,
404
457
  height: 0
405
458
  };
@@ -407,19 +460,19 @@ class v {
407
460
  toPolygonOutlineStyle(e) {
408
461
  const t = e.style || {};
409
462
  return {
410
- color: m(t.strokeColor || "#3366ff", t.strokeOpacity ?? 1),
463
+ color: p(t.strokeColor || "#3366ff", t.strokeOpacity ?? 1),
411
464
  lineWidth: t.strokeWeight ?? 2,
412
465
  borderWidth: 0,
413
466
  dash: t.strokeStyle === "dashed" ? [10, 10, 10, 10] : [0, 0, 0, 0]
414
467
  };
415
468
  }
416
469
  setLocaLayerVisibility(e, t) {
417
- var o, r;
418
- t ? (o = e == null ? void 0 : e.show) == null || o.call(e) : (r = e == null ? void 0 : e.hide) == null || r.call(e);
470
+ var o, s;
471
+ t ? (o = e == null ? void 0 : e.show) == null || o.call(e) : (s = e == null ? void 0 : e.hide) == null || s.call(e);
419
472
  }
420
473
  destroyMassPointLayer(e) {
421
- var t, o, r, s, i, a;
422
- (o = (t = this.loca) == null ? void 0 : t.remove) == null || o.call(t, e.layer), (s = (r = e.layer) == null ? void 0 : r.destroy) == null || s.call(r), (a = (i = e.source) == null ? void 0 : i.destroy) == null || a.call(i);
474
+ var t, o, s, i, r, a;
475
+ (o = (t = this.loca) == null ? void 0 : t.remove) == null || o.call(t, e.layer), (i = (s = e.layer) == null ? void 0 : s.destroy) == null || i.call(s), (a = (r = e.source) == null ? void 0 : r.destroy) == null || a.call(r);
423
476
  }
424
477
  createScatterLayer(e) {
425
478
  const t = new this.locaSdk.GeoJSONSource({ data: this.toMassPointGeoJSON(e) }), o = new this.locaSdk.ScatterLayer({
@@ -427,21 +480,21 @@ class v {
427
480
  opacity: 1,
428
481
  visible: e.visible !== !1,
429
482
  zooms: [e.minZoom ?? 2, e.maxZoom ?? 26]
430
- }), r = e.style || {};
483
+ }), s = e.style || {};
431
484
  return o.setSource(t), o.setStyle({
432
- size: [r.size ?? 40, r.size ?? 40],
485
+ size: [s.size ?? 40, s.size ?? 40],
433
486
  color: "#ffffff",
434
- borderWidth: r.borderWidth ?? 0,
435
- borderColor: r.borderColor || "#ffffff",
436
- unit: r.unit || "px",
437
- texture: r.texture || "/breath_red.png",
487
+ borderWidth: s.borderWidth ?? 0,
488
+ borderColor: s.borderColor || "#ffffff",
489
+ unit: s.unit || "px",
490
+ texture: s.texture || "/breath_red.png",
438
491
  animate: !0,
439
- duration: r.duration ?? 2e3
492
+ duration: s.duration ?? 2e3
440
493
  }), this.loca.add(o), { layer: o, source: t };
441
494
  }
442
495
  destroyScatterLayer(e) {
443
- var t, o, r, s, i, a;
444
- (o = (t = this.loca) == null ? void 0 : t.remove) == null || o.call(t, e.layer), (s = (r = e.layer) == null ? void 0 : r.destroy) == null || s.call(r), (a = (i = e.source) == null ? void 0 : i.destroy) == null || a.call(i);
496
+ var t, o, s, i, r, a;
497
+ (o = (t = this.loca) == null ? void 0 : t.remove) == null || o.call(t, e.layer), (i = (s = e.layer) == null ? void 0 : s.destroy) == null || i.call(s), (a = (r = e.source) == null ? void 0 : r.destroy) == null || a.call(r);
445
498
  }
446
499
  toMassPointGeoJSON(e) {
447
500
  return {
@@ -509,20 +562,20 @@ class v {
509
562
  };
510
563
  }
511
564
  cleanupDraw(e) {
512
- var t, o, r, s;
513
- (o = (t = this.mouseTool) == null ? void 0 : t.off) == null || o.call(t, "draw", e.handler), (s = (r = this.mouseTool) == null ? void 0 : r.close) == null || s.call(r), this.activeDraw === e && (this.activeDraw = null);
565
+ var t, o, s, i;
566
+ (o = (t = this.mouseTool) == null ? void 0 : t.off) == null || o.call(t, "draw", e.handler), (i = (s = this.mouseTool) == null ? void 0 : s.close) == null || i.call(s), this.activeDraw === e && (this.activeDraw = null);
514
567
  }
515
568
  finishEdit(e) {
516
- var o, r, s, i;
569
+ var o, s, i, r;
517
570
  if (e.stopped)
518
571
  return;
519
572
  const t = this.getPath(e.native);
520
- t && e.onChange(t), e.stopped = !0, (r = (o = e.editor).close) == null || r.call(o);
573
+ t && e.onChange(t), e.stopped = !0, (s = (o = e.editor).close) == null || s.call(o);
521
574
  for (const { event: a, handler: l } of e.handlers)
522
- (i = (s = e.editor).off) == null || i.call(s, a, l);
575
+ (r = (i = e.editor).off) == null || r.call(i, a, l);
523
576
  this.activeEdit === e && (this.activeEdit = null);
524
577
  }
525
578
  }
526
579
  export {
527
- v as AMapAdapter
580
+ E as AMapAdapter
528
581
  };