@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 +3 -3
- package/dist/chunks/{AMapAdapter-6257126f.js → AMapAdapter-76901841.js} +170 -117
- package/dist/chunks/{ArcGISAdapter-09b4e73f.js → ArcGISAdapter-5e6881de.js} +182 -83
- package/dist/chunks/{BMapAdapter-eb942a66.js → BMapAdapter-0d882313.js} +168 -117
- package/dist/chunks/index-dd303ebf.js +1190 -0
- package/dist/index.js +3 -2
- package/dist/types/map/InfoWindow.d.ts +38 -0
- package/dist/types/map/InfoWindow.d.ts.map +1 -0
- package/dist/types/map/UnifiedMap.d.ts +27 -1
- package/dist/types/map/UnifiedMap.d.ts.map +1 -1
- package/dist/types/map/adapters/AMapAdapter.d.ts +7 -2
- package/dist/types/map/adapters/AMapAdapter.d.ts.map +1 -1
- package/dist/types/map/adapters/ArcGISAdapter.d.ts +9 -2
- package/dist/types/map/adapters/ArcGISAdapter.d.ts.map +1 -1
- package/dist/types/map/adapters/BMapAdapter.d.ts +8 -2
- package/dist/types/map/adapters/BMapAdapter.d.ts.map +1 -1
- package/dist/types/map/adapters/MapAdapter.d.ts +7 -1
- package/dist/types/map/adapters/MapAdapter.d.ts.map +1 -1
- package/dist/types/map/index.d.ts +1 -0
- package/dist/types/map/index.d.ts.map +1 -1
- package/dist/types/map/types.d.ts +37 -1
- package/dist/types/map/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/chunks/index-5b75eace.js +0 -893
|
@@ -1,29 +1,31 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var h = (
|
|
1
|
+
var x = Object.defineProperty;
|
|
2
|
+
var T = (L, e, t) => e in L ? x(L, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : L[e] = t;
|
|
3
|
+
var h = (L, e, t) => (T(L, typeof e != "symbol" ? e + "" : e, t), t);
|
|
4
4
|
import "@arcgis/core/assets/esri/themes/light/main.css";
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
5
|
+
import * as A from "@arcgis/core/core/reactiveUtils";
|
|
6
|
+
import f from "@arcgis/core/Graphic";
|
|
7
|
+
import W from "@arcgis/core/geometry/Multipoint";
|
|
8
|
+
import g from "@arcgis/core/geometry/Point";
|
|
9
|
+
import M from "@arcgis/core/geometry/Polygon";
|
|
10
|
+
import V from "@arcgis/core/geometry/Polyline";
|
|
11
|
+
import { xyToLngLat as D } from "@arcgis/core/geometry/support/webMercatorUtils";
|
|
10
12
|
import k from "@arcgis/core/layers/FeatureLayer";
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
13
|
+
import O from "@arcgis/core/symbols/PictureMarkerSymbol";
|
|
14
|
+
import F from "@arcgis/core/symbols/CIMSymbol";
|
|
15
|
+
import I from "@arcgis/core/symbols/SimpleFillSymbol";
|
|
14
16
|
import b from "@arcgis/core/symbols/SimpleLineSymbol";
|
|
15
17
|
import P from "@arcgis/core/symbols/SimpleMarkerSymbol";
|
|
16
18
|
import w from "@arcgis/core/renderers/SimpleRenderer";
|
|
17
|
-
import
|
|
18
|
-
import
|
|
19
|
-
import
|
|
20
|
-
import
|
|
21
|
-
import { M as c, a as
|
|
19
|
+
import R from "@arcgis/core/widgets/Sketch/SketchViewModel";
|
|
20
|
+
import G from "@arcgis/core/Map";
|
|
21
|
+
import H from "@arcgis/core/views/MapView";
|
|
22
|
+
import N from "@arcgis/core/layers/GraphicsLayer";
|
|
23
|
+
import { M as c, a as E } from "./index-dd303ebf.js";
|
|
22
24
|
import { a as d } from "./color-128d7dff.js";
|
|
23
25
|
import "vue";
|
|
24
|
-
class
|
|
26
|
+
class K {
|
|
25
27
|
constructor() {
|
|
26
|
-
this.map = null, this.mapView = null, this.graphicsLayer = null, this.clickHandler = null, this.Graphic =
|
|
28
|
+
this.map = null, this.mapView = null, this.graphicsLayer = null, this.clickHandler = null, this.Graphic = f, this.Point = g, this.Polyline = V, this.Polygon = M, this.SimpleMarkerSymbol = P, this.SimpleLineSymbol = b, this.SimpleFillSymbol = I, this.SketchViewModel = R;
|
|
27
29
|
}
|
|
28
30
|
/**
|
|
29
31
|
* 创建地图
|
|
@@ -41,15 +43,15 @@ class N {
|
|
|
41
43
|
} = t, o = typeof e == "string" ? e : e.id;
|
|
42
44
|
if (!o)
|
|
43
45
|
throw new Error("地图容器必须有id属性");
|
|
44
|
-
return this.map = new
|
|
46
|
+
return this.map = new G({
|
|
45
47
|
basemap: a
|
|
46
48
|
// null 表示空白底图
|
|
47
|
-
}), this.mapView = new
|
|
49
|
+
}), this.mapView = new H({
|
|
48
50
|
container: o,
|
|
49
51
|
map: this.map,
|
|
50
52
|
center: i,
|
|
51
53
|
zoom: r
|
|
52
|
-
}), this.graphicsLayer = new
|
|
54
|
+
}), this.graphicsLayer = new N({
|
|
53
55
|
elevationInfo: { mode: "on-the-ground" }
|
|
54
56
|
// ✅ 确保图形贴地显示
|
|
55
57
|
}), this.map.add(this.graphicsLayer), s && console.warn('⚠️ ArcGIS 自动点击打点已禁用,请使用 MapManager.on("click") 事件'), await this.mapView.when(), console.log("地图创建成功(ArcGIS 4.x)"), {
|
|
@@ -67,10 +69,10 @@ class N {
|
|
|
67
69
|
if (!this.mapView || !this.graphicsLayer)
|
|
68
70
|
throw new Error("地图未初始化,请先调用createMap");
|
|
69
71
|
let i;
|
|
70
|
-
e.longitude !== void 0 && e.latitude !== void 0 ? i = e : Array.isArray(e) ? i = new
|
|
72
|
+
e.longitude !== void 0 && e.latitude !== void 0 ? i = e : Array.isArray(e) ? i = new g({
|
|
71
73
|
longitude: e[0],
|
|
72
74
|
latitude: e[1]
|
|
73
|
-
}) : i = new
|
|
75
|
+
}) : i = new g(e);
|
|
74
76
|
const r = new P({
|
|
75
77
|
color: t.color || "red",
|
|
76
78
|
size: t.size || 12,
|
|
@@ -78,7 +80,7 @@ class N {
|
|
|
78
80
|
color: t.outlineColor || "white",
|
|
79
81
|
width: t.outlineWidth || 2
|
|
80
82
|
}
|
|
81
|
-
}), a = new
|
|
83
|
+
}), a = new f({
|
|
82
84
|
geometry: i,
|
|
83
85
|
symbol: r,
|
|
84
86
|
attributes: t.attributes || {}
|
|
@@ -102,9 +104,9 @@ class N {
|
|
|
102
104
|
return o;
|
|
103
105
|
let l = o || "#3366FF";
|
|
104
106
|
l = l.replace("#", "");
|
|
105
|
-
const n = parseInt(l.substring(0, 2), 16),
|
|
106
|
-
return [n,
|
|
107
|
-
}, r = new
|
|
107
|
+
const n = parseInt(l.substring(0, 2), 16), y = parseInt(l.substring(2, 4), 16), u = parseInt(l.substring(4, 6), 16);
|
|
108
|
+
return [n, y, u];
|
|
109
|
+
}, r = new V({
|
|
108
110
|
paths: [e.map((o) => [o[0], o[1]])]
|
|
109
111
|
// ArcGIS Polyline paths 格式
|
|
110
112
|
}), a = new b({
|
|
@@ -116,7 +118,7 @@ class N {
|
|
|
116
118
|
const o = i(t.color);
|
|
117
119
|
a.color = [...o, t.opacity];
|
|
118
120
|
}
|
|
119
|
-
const s = new
|
|
121
|
+
const s = new f({
|
|
120
122
|
geometry: r,
|
|
121
123
|
symbol: a,
|
|
122
124
|
attributes: t.attributes || {}
|
|
@@ -136,14 +138,14 @@ class N {
|
|
|
136
138
|
addCircleMarker(e, t = {}) {
|
|
137
139
|
if (!this.mapView || !this.graphicsLayer)
|
|
138
140
|
throw new Error("地图未初始化,请先调用createMap");
|
|
139
|
-
const i = this.SimpleMarkerSymbol, r = this.Graphic, a = this.Point, s = (
|
|
140
|
-
if (Array.isArray(
|
|
141
|
-
return
|
|
142
|
-
let
|
|
143
|
-
|
|
144
|
-
const _ = parseInt(
|
|
145
|
-
return [_,
|
|
146
|
-
}, o = s(t.color || "#FF0000"), l = t.radius || 4, n = s(t.strokeColor || "#FFFFFF"),
|
|
141
|
+
const i = this.SimpleMarkerSymbol, r = this.Graphic, a = this.Point, s = (p) => {
|
|
142
|
+
if (Array.isArray(p))
|
|
143
|
+
return p;
|
|
144
|
+
let m = p || "#FF0000";
|
|
145
|
+
m = m.replace("#", "");
|
|
146
|
+
const _ = parseInt(m.substring(0, 2), 16), C = parseInt(m.substring(2, 4), 16), v = parseInt(m.substring(4, 6), 16);
|
|
147
|
+
return [_, C, v];
|
|
148
|
+
}, o = s(t.color || "#FF0000"), l = t.radius || 4, n = s(t.strokeColor || "#FFFFFF"), y = t.strokeWidth || 2, u = new a({
|
|
147
149
|
longitude: e[0],
|
|
148
150
|
latitude: e[1]
|
|
149
151
|
}), z = new i({
|
|
@@ -152,7 +154,7 @@ class N {
|
|
|
152
154
|
size: l,
|
|
153
155
|
outline: {
|
|
154
156
|
color: n,
|
|
155
|
-
width:
|
|
157
|
+
width: y
|
|
156
158
|
}
|
|
157
159
|
}), S = new r({
|
|
158
160
|
geometry: u,
|
|
@@ -173,22 +175,22 @@ class N {
|
|
|
173
175
|
addPolygon(e, t = {}) {
|
|
174
176
|
if (!this.mapView || !this.graphicsLayer)
|
|
175
177
|
throw new Error("地图未初始化,请先调用createMap");
|
|
176
|
-
const i = this.Polygon, r = this.SimpleFillSymbol, a = this.Graphic, s = (
|
|
177
|
-
if (Array.isArray(
|
|
178
|
-
return
|
|
179
|
-
let
|
|
180
|
-
|
|
181
|
-
const _ = parseInt(
|
|
182
|
-
return [_,
|
|
183
|
-
}, o = s(t.fillColor || "#3366FF"), l = t.fillOpacity || 0.3, n = s(t.strokeColor || "#3366FF"),
|
|
184
|
-
rings: [e.map((
|
|
178
|
+
const i = this.Polygon, r = this.SimpleFillSymbol, a = this.Graphic, s = (p) => {
|
|
179
|
+
if (Array.isArray(p))
|
|
180
|
+
return p;
|
|
181
|
+
let m = p || "#3366FF";
|
|
182
|
+
m = m.replace("#", "");
|
|
183
|
+
const _ = parseInt(m.substring(0, 2), 16), C = parseInt(m.substring(2, 4), 16), v = parseInt(m.substring(4, 6), 16);
|
|
184
|
+
return [_, C, v];
|
|
185
|
+
}, o = s(t.fillColor || "#3366FF"), l = t.fillOpacity || 0.3, n = s(t.strokeColor || "#3366FF"), y = t.strokeWidth || 5, u = new i({
|
|
186
|
+
rings: [e.map((p) => [p[0], p[1]])]
|
|
185
187
|
// ArcGIS 使用 rings 属性
|
|
186
188
|
}), z = new r({
|
|
187
189
|
color: [...o, l],
|
|
188
190
|
// ✅ RGBA 格式(支持透明度)
|
|
189
191
|
outline: {
|
|
190
192
|
color: n,
|
|
191
|
-
width:
|
|
193
|
+
width: y
|
|
192
194
|
}
|
|
193
195
|
}), S = new a({
|
|
194
196
|
geometry: u,
|
|
@@ -223,10 +225,10 @@ class N {
|
|
|
223
225
|
this.mapView && (this.mapView.destroy(), this.mapView = null, this.map = null, this.graphicsLayer = null);
|
|
224
226
|
}
|
|
225
227
|
}
|
|
226
|
-
class
|
|
228
|
+
class ye {
|
|
227
229
|
constructor() {
|
|
228
230
|
h(this, "coordinateSystem", "wgs84");
|
|
229
|
-
h(this, "loader", new
|
|
231
|
+
h(this, "loader", new K());
|
|
230
232
|
h(this, "mapView", null);
|
|
231
233
|
h(this, "graphicsLayer", null);
|
|
232
234
|
h(this, "sketchViewModel", null);
|
|
@@ -240,6 +242,7 @@ class ce {
|
|
|
240
242
|
h(this, "scatterLayers", /* @__PURE__ */ new Set());
|
|
241
243
|
h(this, "polylineLayers", /* @__PURE__ */ new Set());
|
|
242
244
|
h(this, "polygonLayers", /* @__PURE__ */ new Set());
|
|
245
|
+
h(this, "activeInfoWindow", null);
|
|
243
246
|
}
|
|
244
247
|
async init(e) {
|
|
245
248
|
const t = this.resolveContainer(e.container);
|
|
@@ -273,7 +276,7 @@ class ce {
|
|
|
273
276
|
this.polylineLayers.clear();
|
|
274
277
|
for (const t of [...this.polygonLayers])
|
|
275
278
|
this.destroyVectorLayer(t);
|
|
276
|
-
this.polygonLayers.clear(), this.loader.destroy(), this.mapView = null, this.graphicsLayer = null;
|
|
279
|
+
this.polygonLayers.clear(), this.activeInfoWindow && this.destroyInfoWindow(this.activeInfoWindow), this.loader.destroy(), this.mapView = null, this.graphicsLayer = null;
|
|
277
280
|
}
|
|
278
281
|
addMarker(e) {
|
|
279
282
|
const t = this.createMarker(e);
|
|
@@ -324,7 +327,7 @@ class ce {
|
|
|
324
327
|
return r >= 0 ? i.add(t.layer, r) : i.add(t.layer), this.massPointLayers.add(t), this.reorderVisualizationLayers(), t;
|
|
325
328
|
}
|
|
326
329
|
updateMassPoints(e, t, i) {
|
|
327
|
-
var n;
|
|
330
|
+
var n, y;
|
|
328
331
|
const r = e;
|
|
329
332
|
if (!this.massPointLayers.has(r))
|
|
330
333
|
throw new c("OVERLAY_NOT_FOUND", "Mass point layer is no longer registered");
|
|
@@ -332,7 +335,7 @@ class ce {
|
|
|
332
335
|
if (!a)
|
|
333
336
|
throw new c("SDK_ERROR", "ArcGIS map is unavailable");
|
|
334
337
|
if (!("points" in i))
|
|
335
|
-
return r.layer.renderer = new w({ symbol: this.createMassPointSymbol(t) }), r.layer.visible = t.visible !== !1, r.layer.minScale = this.zoomToScale(t.minZoom ?? 3), r.layer.maxScale = this.zoomToScale(t.maxZoom ?? 21), r.zIndex = t.zIndex ?? 100, this.reorderVisualizationLayers(), e;
|
|
338
|
+
return r.layer.renderer = new w({ symbol: this.createMassPointSymbol(t) }), r.layer.opacity = (y = t.style) != null && y.icon ? t.style.opacity ?? 1 : 1, r.layer.visible = t.visible !== !1, r.layer.minScale = this.zoomToScale(t.minZoom ?? 3), r.layer.maxScale = this.zoomToScale(t.maxZoom ?? 21), r.zIndex = t.zIndex ?? 100, this.reorderVisualizationLayers(), e;
|
|
336
339
|
const s = this.createMassPointLayer(t), o = r.layer, l = a.layers.indexOf(o);
|
|
337
340
|
return a.remove(o), l >= 0 ? a.add(s.layer, l) : a.add(s.layer), o.destroy(), r.layer = s.layer, r.zIndex = s.zIndex, this.reorderVisualizationLayers(), e;
|
|
338
341
|
}
|
|
@@ -412,8 +415,8 @@ class ce {
|
|
|
412
415
|
var n;
|
|
413
416
|
if (!t)
|
|
414
417
|
return;
|
|
415
|
-
const l = (n = o.results) == null ? void 0 : n.find((
|
|
416
|
-
const u =
|
|
418
|
+
const l = (n = o.results) == null ? void 0 : n.find((y) => {
|
|
419
|
+
const u = y == null ? void 0 : y.graphic;
|
|
417
420
|
return u && this.overlayKinds.has(u);
|
|
418
421
|
});
|
|
419
422
|
e(s, l == null ? void 0 : l.graphic);
|
|
@@ -491,7 +494,7 @@ class ce {
|
|
|
491
494
|
}
|
|
492
495
|
getCenter() {
|
|
493
496
|
const e = this.mapView.center;
|
|
494
|
-
return
|
|
497
|
+
return E([e.longitude, e.latitude]);
|
|
495
498
|
}
|
|
496
499
|
setZoom(e) {
|
|
497
500
|
this.mapView.zoom = e;
|
|
@@ -499,6 +502,91 @@ class ce {
|
|
|
499
502
|
getZoom() {
|
|
500
503
|
return this.mapView.zoom;
|
|
501
504
|
}
|
|
505
|
+
async fitView(e, t, i, r) {
|
|
506
|
+
if (e.length === 0)
|
|
507
|
+
return;
|
|
508
|
+
const a = { ...this.mapView.padding || {} };
|
|
509
|
+
this.mapView.padding = {
|
|
510
|
+
top: i[0],
|
|
511
|
+
bottom: i[1],
|
|
512
|
+
left: i[2],
|
|
513
|
+
right: i[3]
|
|
514
|
+
};
|
|
515
|
+
const s = e.length === 1 ? {
|
|
516
|
+
target: new g({
|
|
517
|
+
longitude: e[0][0],
|
|
518
|
+
latitude: e[0][1],
|
|
519
|
+
spatialReference: { wkid: 4326 }
|
|
520
|
+
}),
|
|
521
|
+
zoom: r ?? 18
|
|
522
|
+
} : {
|
|
523
|
+
target: new W({
|
|
524
|
+
points: e.map((o) => [o[0], o[1]]),
|
|
525
|
+
spatialReference: { wkid: 4326 }
|
|
526
|
+
})
|
|
527
|
+
};
|
|
528
|
+
try {
|
|
529
|
+
await this.mapView.goTo(s, { animate: !t }), r !== void 0 && this.mapView.zoom > r && await this.mapView.goTo(
|
|
530
|
+
{ center: this.mapView.center, zoom: r },
|
|
531
|
+
{ animate: !1 }
|
|
532
|
+
);
|
|
533
|
+
} catch (o) {
|
|
534
|
+
if ((o == null ? void 0 : o.name) !== "AbortError")
|
|
535
|
+
throw o;
|
|
536
|
+
} finally {
|
|
537
|
+
this.mapView.padding = a;
|
|
538
|
+
}
|
|
539
|
+
}
|
|
540
|
+
createInfoWindow(e, t, i) {
|
|
541
|
+
return {
|
|
542
|
+
options: { ...e },
|
|
543
|
+
onOpen: t,
|
|
544
|
+
onClose: i,
|
|
545
|
+
closeWatch: null,
|
|
546
|
+
mapClickHandle: null
|
|
547
|
+
};
|
|
548
|
+
}
|
|
549
|
+
openInfoWindow(e, t) {
|
|
550
|
+
const i = e;
|
|
551
|
+
this.activeInfoWindow = i, i.options.closeWhenClickMap && (i.mapClickHandle = this.mapView.on("click", () => {
|
|
552
|
+
this.activeInfoWindow === i && this.closeInfoWindow(i);
|
|
553
|
+
}));
|
|
554
|
+
const r = new g({
|
|
555
|
+
longitude: t[0],
|
|
556
|
+
latitude: t[1],
|
|
557
|
+
spatialReference: { wkid: 4326 }
|
|
558
|
+
});
|
|
559
|
+
this.mapView.openPopup({
|
|
560
|
+
location: r,
|
|
561
|
+
content: i.options.content ?? ""
|
|
562
|
+
}).then(() => {
|
|
563
|
+
this.activeInfoWindow === i && (i.onOpen(), i.closeWatch = A.watch(
|
|
564
|
+
() => {
|
|
565
|
+
var a, s;
|
|
566
|
+
return (s = (a = this.mapView) == null ? void 0 : a.popup) == null ? void 0 : s.visible;
|
|
567
|
+
},
|
|
568
|
+
(a) => {
|
|
569
|
+
a !== !1 || this.activeInfoWindow !== i || this.finishInfoWindow(i, !0);
|
|
570
|
+
}
|
|
571
|
+
));
|
|
572
|
+
}).catch((a) => {
|
|
573
|
+
console.error("ArcGIS info window failed to open", a), this.finishInfoWindow(i, !0);
|
|
574
|
+
});
|
|
575
|
+
}
|
|
576
|
+
closeInfoWindow(e) {
|
|
577
|
+
var i, r;
|
|
578
|
+
const t = e;
|
|
579
|
+
this.activeInfoWindow === t && ((r = (i = this.mapView) == null ? void 0 : i.closePopup) == null || r.call(i), this.finishInfoWindow(t, !0));
|
|
580
|
+
}
|
|
581
|
+
destroyInfoWindow(e) {
|
|
582
|
+
var i, r;
|
|
583
|
+
const t = e;
|
|
584
|
+
this.activeInfoWindow === t && ((r = (i = this.mapView) == null ? void 0 : i.closePopup) == null || r.call(i)), this.finishInfoWindow(t, !1);
|
|
585
|
+
}
|
|
586
|
+
finishInfoWindow(e, t) {
|
|
587
|
+
var i, r;
|
|
588
|
+
(i = e.closeWatch) == null || i.remove(), e.closeWatch = null, (r = e.mapClickHandle) == null || r.remove(), e.mapClickHandle = null, this.activeInfoWindow === e && (this.activeInfoWindow = null), t && e.onClose();
|
|
589
|
+
}
|
|
502
590
|
resolveContainer(e) {
|
|
503
591
|
if (typeof e == "string") {
|
|
504
592
|
if (!document.getElementById(e))
|
|
@@ -513,7 +601,7 @@ class ce {
|
|
|
513
601
|
this.overlayKinds.set(e, t);
|
|
514
602
|
}
|
|
515
603
|
createMarker(e) {
|
|
516
|
-
const t = e.style || { kind: "circle" }, i = new
|
|
604
|
+
const t = e.style || { kind: "circle" }, i = new g({ longitude: e.position[0], latitude: e.position[1] }), r = t.kind === "icon" ? new O({
|
|
517
605
|
url: t.url,
|
|
518
606
|
width: t.width,
|
|
519
607
|
height: t.height,
|
|
@@ -527,11 +615,11 @@ class ce {
|
|
|
527
615
|
width: t.strokeWeight ?? 2
|
|
528
616
|
}
|
|
529
617
|
});
|
|
530
|
-
return new
|
|
618
|
+
return new f({ geometry: i, symbol: r });
|
|
531
619
|
}
|
|
532
620
|
createPolyline(e) {
|
|
533
|
-
return new
|
|
534
|
-
geometry: new
|
|
621
|
+
return new f({
|
|
622
|
+
geometry: new V({ paths: [e.path.map((t) => [t[0], t[1]])], spatialReference: { wkid: 4326 } }),
|
|
535
623
|
symbol: new b({
|
|
536
624
|
color: d(e.strokeColor || "#3366ff", e.strokeOpacity ?? 1),
|
|
537
625
|
width: e.strokeWeight ?? 5,
|
|
@@ -541,9 +629,9 @@ class ce {
|
|
|
541
629
|
}
|
|
542
630
|
createPolygon(e) {
|
|
543
631
|
const t = e.path.map((i) => [i[0], i[1]]);
|
|
544
|
-
return t.length > 0 && (t[0][0] !== t[t.length - 1][0] || t[0][1] !== t[t.length - 1][1]) && t.push(t[0]), new
|
|
545
|
-
geometry: new
|
|
546
|
-
symbol: new
|
|
632
|
+
return t.length > 0 && (t[0][0] !== t[t.length - 1][0] || t[0][1] !== t[t.length - 1][1]) && t.push(t[0]), new f({
|
|
633
|
+
geometry: new M({ rings: [t], spatialReference: { wkid: 4326 } }),
|
|
634
|
+
symbol: new I({
|
|
547
635
|
color: d(e.fillColor || "#3366ff", e.fillOpacity ?? 0.3),
|
|
548
636
|
outline: {
|
|
549
637
|
color: d(e.strokeColor || "#3366ff", e.strokeOpacity ?? 1),
|
|
@@ -554,15 +642,16 @@ class ce {
|
|
|
554
642
|
});
|
|
555
643
|
}
|
|
556
644
|
createMassPointLayer(e) {
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
645
|
+
var r;
|
|
646
|
+
const t = e.points.map((a, s) => new f({
|
|
647
|
+
geometry: new g({
|
|
648
|
+
longitude: a.position[0],
|
|
649
|
+
latitude: a.position[1],
|
|
561
650
|
spatialReference: { wkid: 4326 }
|
|
562
651
|
}),
|
|
563
652
|
attributes: {
|
|
564
|
-
...
|
|
565
|
-
__unified_object_id:
|
|
653
|
+
...a.properties || {},
|
|
654
|
+
__unified_object_id: s + 1
|
|
566
655
|
}
|
|
567
656
|
})), i = new k({
|
|
568
657
|
...e.id ? { id: e.id, title: e.id } : {},
|
|
@@ -576,6 +665,7 @@ class ce {
|
|
|
576
665
|
geometryType: "point",
|
|
577
666
|
spatialReference: { wkid: 4326 },
|
|
578
667
|
renderer: new w({ symbol: this.createMassPointSymbol(e) }),
|
|
668
|
+
opacity: (r = e.style) != null && r.icon ? e.style.opacity ?? 1 : 1,
|
|
579
669
|
popupEnabled: !1,
|
|
580
670
|
visible: e.visible !== !1,
|
|
581
671
|
// ArcGIS 使用比例尺分母:minScale 是最远可见范围(较大的数),
|
|
@@ -583,13 +673,13 @@ class ce {
|
|
|
583
673
|
minScale: this.zoomToScale(e.minZoom ?? 3),
|
|
584
674
|
maxScale: this.zoomToScale(e.maxZoom ?? 21)
|
|
585
675
|
});
|
|
586
|
-
return i.load().catch((
|
|
587
|
-
console.error("ArcGIS mass point layer failed to load",
|
|
676
|
+
return i.load().catch((a) => {
|
|
677
|
+
console.error("ArcGIS mass point layer failed to load", a);
|
|
588
678
|
}), { layer: i, zIndex: e.zIndex ?? 100 };
|
|
589
679
|
}
|
|
590
680
|
createPolylineLayer(e) {
|
|
591
|
-
const t = e.polylines.map((r, a) => new
|
|
592
|
-
geometry: new
|
|
681
|
+
const t = e.polylines.map((r, a) => new f({
|
|
682
|
+
geometry: new V({
|
|
593
683
|
paths: [r.path.map((s) => [s[0], s[1]])],
|
|
594
684
|
spatialReference: { wkid: 4326 }
|
|
595
685
|
}),
|
|
@@ -621,8 +711,8 @@ class ce {
|
|
|
621
711
|
});
|
|
622
712
|
}
|
|
623
713
|
createPolygonLayer(e) {
|
|
624
|
-
const t = e.polygons.map((r, a) => new
|
|
625
|
-
geometry: new
|
|
714
|
+
const t = e.polygons.map((r, a) => new f({
|
|
715
|
+
geometry: new M({
|
|
626
716
|
rings: [this.closeRing(r.path).map(([s, o]) => [s, o])],
|
|
627
717
|
spatialReference: { wkid: 4326 }
|
|
628
718
|
}),
|
|
@@ -647,7 +737,7 @@ class ce {
|
|
|
647
737
|
}
|
|
648
738
|
createPolygonLayerSymbol(e) {
|
|
649
739
|
const t = e.style || {};
|
|
650
|
-
return new
|
|
740
|
+
return new I({
|
|
651
741
|
color: d(t.fillColor || "#3366ff", t.fillOpacity ?? 0.3),
|
|
652
742
|
outline: {
|
|
653
743
|
color: d(t.strokeColor || "#3366ff", t.strokeOpacity ?? 1),
|
|
@@ -658,6 +748,15 @@ class ce {
|
|
|
658
748
|
}
|
|
659
749
|
createMassPointSymbol(e) {
|
|
660
750
|
const t = e.style || {};
|
|
751
|
+
if (t.icon) {
|
|
752
|
+
const i = t.icon.width ?? t.size ?? 20, r = t.icon.height ?? t.size ?? 20;
|
|
753
|
+
return new O({
|
|
754
|
+
url: t.icon.url,
|
|
755
|
+
width: i,
|
|
756
|
+
height: r,
|
|
757
|
+
yoffset: t.icon.anchor === "bottom-center" ? r / 2 : 0
|
|
758
|
+
});
|
|
759
|
+
}
|
|
661
760
|
return new P({
|
|
662
761
|
style: "circle",
|
|
663
762
|
size: t.size ?? 10,
|
|
@@ -669,8 +768,8 @@ class ce {
|
|
|
669
768
|
});
|
|
670
769
|
}
|
|
671
770
|
createScatterLayer(e) {
|
|
672
|
-
const t = e.points.map((r, a) => new
|
|
673
|
-
geometry: new
|
|
771
|
+
const t = e.points.map((r, a) => new f({
|
|
772
|
+
geometry: new g({
|
|
674
773
|
longitude: r.position[0],
|
|
675
774
|
latitude: r.position[1],
|
|
676
775
|
spatialReference: { wkid: 4326 }
|
|
@@ -705,7 +804,7 @@ class ce {
|
|
|
705
804
|
repeatDelay: a,
|
|
706
805
|
duration: r
|
|
707
806
|
};
|
|
708
|
-
return new
|
|
807
|
+
return new F({
|
|
709
808
|
data: {
|
|
710
809
|
type: "CIMSymbolReference",
|
|
711
810
|
symbol: {
|
|
@@ -783,7 +882,7 @@ class ce {
|
|
|
783
882
|
return 591657527591555e-6 / Math.pow(2, e);
|
|
784
883
|
}
|
|
785
884
|
getSketchViewModel() {
|
|
786
|
-
return this.sketchViewModel || (this.sketchViewModel = new
|
|
885
|
+
return this.sketchViewModel || (this.sketchViewModel = new R({
|
|
787
886
|
view: this.mapView,
|
|
788
887
|
layer: this.graphicsLayer,
|
|
789
888
|
updateOnGraphicClick: !1,
|
|
@@ -811,7 +910,7 @@ class ce {
|
|
|
811
910
|
return;
|
|
812
911
|
}
|
|
813
912
|
const r = i;
|
|
814
|
-
e.polygonSymbol = new
|
|
913
|
+
e.polygonSymbol = new I({
|
|
815
914
|
color: d(r.fillColor || "#3366ff", r.fillOpacity ?? 0.3),
|
|
816
915
|
outline: {
|
|
817
916
|
color: d(i.strokeColor || "#3366ff", i.strokeOpacity ?? 1),
|
|
@@ -832,8 +931,8 @@ class ce {
|
|
|
832
931
|
i && e.onChange(i), e.finished = !0, (r = e.handle) == null || r.remove(), t && e.sketch.state === "active" ? e.sketch.complete() : !t && e.sketch.state === "active" && e.sketch.cancel(), ((a = this.activeEdit) == null ? void 0 : a.id) === e.id && (this.activeEdit = null);
|
|
833
932
|
}
|
|
834
933
|
toLngLat(e, t, i) {
|
|
835
|
-
const r = i == null ? void 0 : i.wkid, s = (i == null ? void 0 : i.isWebMercator) || r === 3857 || r === 102100 || r === 102113 ?
|
|
836
|
-
return
|
|
934
|
+
const r = i == null ? void 0 : i.wkid, s = (i == null ? void 0 : i.isWebMercator) || r === 3857 || r === 102100 || r === 102113 ? D(e, t) : [e, t];
|
|
935
|
+
return E(s);
|
|
837
936
|
}
|
|
838
937
|
ensureHitTestListener() {
|
|
839
938
|
this.hitTestHandle || (this.hitTestHandle = this.mapView.on("click", (e) => {
|
|
@@ -859,5 +958,5 @@ class ce {
|
|
|
859
958
|
}
|
|
860
959
|
}
|
|
861
960
|
export {
|
|
862
|
-
|
|
961
|
+
ye as ArcGISAdapter
|
|
863
962
|
};
|