@skzz/components-gis 0.1.4 → 0.1.5
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/dist/assets/twinPreviewWorker-COILIqOa.js +1 -0
- package/dist/color-DVYdxZow.js +359 -0
- package/dist/esm-BXiGX6xE.js +86 -0
- package/dist/index.css +1 -1
- package/dist/index.d.ts +71 -6
- package/dist/index.es.js +1138 -9659
- package/dist/index.umd.js +5 -5
- package/dist/interpolation-Ctw2-y9G.js +211 -0
- package/dist/layerStack-CbiVJONn.js +181 -0
- package/dist/pako.esm-D6zcBi67.js +1455 -0
- package/dist/query-DgSNPfJM.js +239 -0
- package/dist/queryPoint-BOi_hkig.js +189 -0
- package/dist/zz-3dtiles-BzDYB-tW.js +75 -0
- package/dist/zz-gltf-BDHxqQjs.js +70 -0
- package/dist/zz-layer/zz-layer-shp-zzts/shpZztsCacheUtils.d.ts +53 -0
- package/dist/zz-layer/zz-layer-shp-zzts/shpZztsRenderer.d.ts +76 -6
- package/dist/zz-layer/zz-layer-zzts/zztsRasterCacheUtils.d.ts +35 -0
- package/dist/zz-layer/zz-layer-zzts/zztsRasterPreviewPolling.d.ts +10 -0
- package/dist/zz-layer/zz-layer-zzts3dv2/index.vue.d.ts +1 -0
- package/dist/zz-layer/zz-layer-zzts3dv2/twinPreviewWorker.d.ts +1 -0
- package/dist/zz-layer-geojson-CtTpn_f9.js +867 -0
- package/dist/zz-layer-mvt-R1-GwSIW.js +609 -0
- package/dist/zz-layer-shp-zzts-D8BjI5tI.js +1323 -0
- package/dist/zz-layer-zzts3d-DqZmLdW3.js +835 -0
- package/dist/zz-layer-zzts3d-grid-CTHFZBpo.js +314 -0
- package/dist/zz-layer-zzts3d-las-hNa-nqxq.js +560 -0
- package/dist/zz-layer-zzts3d-point-DrB5Uuwa.js +750 -0
- package/dist/zz-layer-zzts3dtype-BRl3mCk9.js +493 -0
- package/dist/zz-layer-zzts3dv2-D5udnVGT.js +913 -0
- package/dist/zz-terrain-excavation-A2NXSQ5P.js +502 -0
- package/dist/zz-viewer/index.vue.d.ts +2 -2
- package/dist/zzts3dLayerSignature-Cnu6KIys.js +42 -0
- package/package.json +2 -2
|
@@ -0,0 +1,867 @@
|
|
|
1
|
+
import { inject as e, onMounted as t, onUnmounted as n, ref as r, toRefs as i, watch as a } from "vue";
|
|
2
|
+
import * as o from "cesium";
|
|
3
|
+
import { httpService as s } from "@skzz/libs-base";
|
|
4
|
+
//#region src/utils/layerProviderKey.js
|
|
5
|
+
function c(e) {
|
|
6
|
+
return e ? typeof e == "string" ? e : typeof e?.url == "string" ? e.url : typeof e?._url == "string" ? e._url : String(e) : "";
|
|
7
|
+
}
|
|
8
|
+
function l(e = {}) {
|
|
9
|
+
let t = e.provider || e, n = t.rectangle;
|
|
10
|
+
return [
|
|
11
|
+
t.layer || t.layers || "",
|
|
12
|
+
t.dictCode || "",
|
|
13
|
+
t.serviceName || "",
|
|
14
|
+
c(t.url),
|
|
15
|
+
t.tileMatrixSetID || "",
|
|
16
|
+
t.style || "",
|
|
17
|
+
t.format || "",
|
|
18
|
+
t.geometryHash || "",
|
|
19
|
+
n ? `${n.west},${n.south},${n.east},${n.north}` : ""
|
|
20
|
+
].join("|");
|
|
21
|
+
}
|
|
22
|
+
function u(e = {}) {
|
|
23
|
+
return [
|
|
24
|
+
e.layer || "",
|
|
25
|
+
e.dictCode || "",
|
|
26
|
+
e.serviceName || "",
|
|
27
|
+
c(e.url),
|
|
28
|
+
e.sourceLayer || "",
|
|
29
|
+
e.scheme || "xyz"
|
|
30
|
+
].join("|");
|
|
31
|
+
}
|
|
32
|
+
//#endregion
|
|
33
|
+
//#region src/utils/polygonLabelPosition.ts
|
|
34
|
+
function d(e) {
|
|
35
|
+
let t = 0;
|
|
36
|
+
for (let n = 0; n < e.length; n++) {
|
|
37
|
+
let r = (n + 1) % e.length;
|
|
38
|
+
t += e[n][0] * e[r][1], t -= e[r][0] * e[n][1];
|
|
39
|
+
}
|
|
40
|
+
return t / 2;
|
|
41
|
+
}
|
|
42
|
+
function ee(e) {
|
|
43
|
+
if (!e.length || !e[0]?.length) return e;
|
|
44
|
+
let t = [], n = e[0];
|
|
45
|
+
t.push(d(n) < 0 ? [...n].reverse() : n);
|
|
46
|
+
for (let n = 1; n < e.length; n++) {
|
|
47
|
+
let r = e[n];
|
|
48
|
+
r?.length && t.push(d(r) > 0 ? [...r].reverse() : r);
|
|
49
|
+
}
|
|
50
|
+
return t;
|
|
51
|
+
}
|
|
52
|
+
function f(e, t = .5) {
|
|
53
|
+
if (!e?.length || !e[0]?.length) return null;
|
|
54
|
+
let n = Infinity, r = Infinity, i = -Infinity, a = -Infinity;
|
|
55
|
+
for (let t of e[0]) t[0] < n && (n = t[0]), t[1] < r && (r = t[1]), t[0] > i && (i = t[0]), t[1] > a && (a = t[1]);
|
|
56
|
+
let o = i - n, s = a - r;
|
|
57
|
+
if (o <= 0 && s <= 0) return [e[0][0][0], e[0][0][1]];
|
|
58
|
+
let c = Math.min(o, s);
|
|
59
|
+
if (c <= 0) return [(n + i) / 2, (r + a) / 2];
|
|
60
|
+
let l = c / 2, u = [];
|
|
61
|
+
for (let t = n; t < i; t += c) for (let n = r; n < a; n += c) u.push(p(t + l, n + l, l, e));
|
|
62
|
+
let d = p(n + o / 2, r + s / 2, 0, e);
|
|
63
|
+
for (u.sort((e, t) => t.max - e.max); u.length > 0;) {
|
|
64
|
+
let n = u.pop();
|
|
65
|
+
n.max - d.max <= t || (n.d > d.d && (d = n), !(n.h <= t) && (l = n.h / 2, u.push(p(n.x - l, n.y - l, l, e)), u.push(p(n.x + l, n.y - l, l, e)), u.push(p(n.x - l, n.y + l, l, e)), u.push(p(n.x + l, n.y + l, l, e))));
|
|
66
|
+
}
|
|
67
|
+
return [d.x, d.y];
|
|
68
|
+
}
|
|
69
|
+
function p(e, t, n, r) {
|
|
70
|
+
let i = m(e, t, r);
|
|
71
|
+
return {
|
|
72
|
+
x: e,
|
|
73
|
+
y: t,
|
|
74
|
+
h: n,
|
|
75
|
+
max: i + n * Math.SQRT2,
|
|
76
|
+
d: i
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
function m(e, t, n) {
|
|
80
|
+
let r = !1, i = Infinity;
|
|
81
|
+
for (let a = 0; a < n.length; a++) {
|
|
82
|
+
let o = n[a];
|
|
83
|
+
for (let n = 0, a = o.length, s = a - 1; n < a; s = n++) {
|
|
84
|
+
let a = o[n], c = o[s];
|
|
85
|
+
a[1] > t != c[1] > t && e < (c[0] - a[0]) * (t - a[1]) / (c[1] - a[1]) + a[0] && (r = !r), i = Math.min(i, h(e, t, a, c));
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
return (r ? 1 : -1) * Math.sqrt(i);
|
|
89
|
+
}
|
|
90
|
+
function h(e, t, n, r) {
|
|
91
|
+
let i = n[0], a = n[1], o = r[0] - i, s = r[1] - a;
|
|
92
|
+
if (o !== 0 || s !== 0) {
|
|
93
|
+
let n = ((e - i) * o + (t - a) * s) / (o * o + s * s);
|
|
94
|
+
n > 1 ? (i = r[0], a = r[1]) : n > 0 && (i += o * n, a += s * n);
|
|
95
|
+
}
|
|
96
|
+
return o = e - i, s = t - a, o * o + s * s;
|
|
97
|
+
}
|
|
98
|
+
function g(e, t) {
|
|
99
|
+
let n = new o.Cartesian3();
|
|
100
|
+
return e.map((e) => (o.Matrix4.multiplyByPoint(t, e, n), [n.x, n.y]));
|
|
101
|
+
}
|
|
102
|
+
function _(e, t) {
|
|
103
|
+
if (!e.positions?.length) return null;
|
|
104
|
+
let n = [g(e.positions, t)];
|
|
105
|
+
if (Array.isArray(e.holes)) for (let r of e.holes) r.positions?.length && n.push(g(r.positions, t));
|
|
106
|
+
return n;
|
|
107
|
+
}
|
|
108
|
+
function v(e, t, n) {
|
|
109
|
+
return o.Matrix4.multiplyByPoint(n, new o.Cartesian3(e, t, 0), new o.Cartesian3());
|
|
110
|
+
}
|
|
111
|
+
function y(e) {
|
|
112
|
+
if (!e?.length) return;
|
|
113
|
+
let t = new o.Cartesian3(0, 0, 0);
|
|
114
|
+
for (let n = 0; n < e.length; n++) o.Cartesian3.add(t, e[n], t);
|
|
115
|
+
return o.Cartesian3.multiplyByScalar(t, 1 / e.length, new o.Cartesian3());
|
|
116
|
+
}
|
|
117
|
+
function b(e) {
|
|
118
|
+
let t = e[0], n = Infinity, r = Infinity, i = -Infinity, a = -Infinity;
|
|
119
|
+
for (let [e, o] of t) e < n && (n = e), o < r && (r = o), e > i && (i = e), o > a && (a = o);
|
|
120
|
+
let o = i - n, s = a - r;
|
|
121
|
+
if (o <= 0 && s <= 0) return null;
|
|
122
|
+
let c = null;
|
|
123
|
+
for (let t = 0; t <= 24; t++) for (let i = 0; i <= 24; i++) {
|
|
124
|
+
let a = n + o * t / 24, l = r + s * i / 24, u = m(a, l, e);
|
|
125
|
+
u > 0 && (!c || u > c.d) && (c = {
|
|
126
|
+
x: a,
|
|
127
|
+
y: l,
|
|
128
|
+
d: u
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
return c ? [c.x, c.y] : null;
|
|
132
|
+
}
|
|
133
|
+
function x(e) {
|
|
134
|
+
let t = ee(e), n = t[0], r = Infinity, i = Infinity, a = -Infinity, o = -Infinity;
|
|
135
|
+
for (let [e, t] of n) e < r && (r = e), t < i && (i = t), e > a && (a = e), t > o && (o = t);
|
|
136
|
+
let s = Math.max(Math.min(a - r, o - i) / 80, .25), c = f(t, s);
|
|
137
|
+
if (c && m(c[0], c[1], t) > 0) return c;
|
|
138
|
+
let l = [[...n].reverse(), ...t.slice(1)], u = f(l, s);
|
|
139
|
+
return u && m(u[0], u[1], l) > 0 ? u : b(t) ?? b(l);
|
|
140
|
+
}
|
|
141
|
+
function te(e) {
|
|
142
|
+
let t = e.polygon?.hierarchy?.getValue?.(o.JulianDate.now());
|
|
143
|
+
if (!t?.positions?.length) return;
|
|
144
|
+
let n = y(t.positions);
|
|
145
|
+
if (!n) return;
|
|
146
|
+
let r = o.Transforms.eastNorthUpToFixedFrame(n), i = _(t, o.Matrix4.inverse(r, new o.Matrix4()));
|
|
147
|
+
if (i) {
|
|
148
|
+
let e = x(i);
|
|
149
|
+
if (e) return v(e[0], e[1], r);
|
|
150
|
+
}
|
|
151
|
+
return n;
|
|
152
|
+
}
|
|
153
|
+
//#endregion
|
|
154
|
+
//#region src/zz-layer/zz-layer-geojson/index.vue
|
|
155
|
+
var S = {
|
|
156
|
+
__name: "index",
|
|
157
|
+
props: {
|
|
158
|
+
geojson: {
|
|
159
|
+
type: [Object, String],
|
|
160
|
+
required: !0
|
|
161
|
+
},
|
|
162
|
+
name: {
|
|
163
|
+
type: String,
|
|
164
|
+
default: "GeoJSON Layer"
|
|
165
|
+
},
|
|
166
|
+
style: {
|
|
167
|
+
type: Object,
|
|
168
|
+
default: () => ({
|
|
169
|
+
point: {
|
|
170
|
+
radius: 8,
|
|
171
|
+
color: "#FF0000",
|
|
172
|
+
borderColor: "#FFFFFF",
|
|
173
|
+
borderWidth: 1,
|
|
174
|
+
showIcon: !1,
|
|
175
|
+
iconStyle: {
|
|
176
|
+
url: null,
|
|
177
|
+
width: 32,
|
|
178
|
+
height: 32
|
|
179
|
+
},
|
|
180
|
+
showLabel: !1,
|
|
181
|
+
labelStyle: {
|
|
182
|
+
field: "name",
|
|
183
|
+
color: "#000",
|
|
184
|
+
fontSize: "12px"
|
|
185
|
+
}
|
|
186
|
+
},
|
|
187
|
+
line: {
|
|
188
|
+
color: "#FFFF00",
|
|
189
|
+
width: 2,
|
|
190
|
+
dashLength: 0,
|
|
191
|
+
gapLength: 0,
|
|
192
|
+
borderColor: "#000000",
|
|
193
|
+
borderWidth: 0
|
|
194
|
+
},
|
|
195
|
+
polygon: {
|
|
196
|
+
color: "rgba(255, 255, 0, 0.3)",
|
|
197
|
+
outlineColor: "#FFFF00",
|
|
198
|
+
outlineWidth: 2
|
|
199
|
+
}
|
|
200
|
+
})
|
|
201
|
+
},
|
|
202
|
+
show: {
|
|
203
|
+
type: Boolean,
|
|
204
|
+
default: !0
|
|
205
|
+
},
|
|
206
|
+
hiddenValues: {
|
|
207
|
+
type: Array,
|
|
208
|
+
default: () => []
|
|
209
|
+
},
|
|
210
|
+
clampToGround: {
|
|
211
|
+
type: Boolean,
|
|
212
|
+
default: !0
|
|
213
|
+
},
|
|
214
|
+
token: {
|
|
215
|
+
type: String,
|
|
216
|
+
default: ""
|
|
217
|
+
},
|
|
218
|
+
directRequest: {
|
|
219
|
+
type: Boolean,
|
|
220
|
+
default: !1
|
|
221
|
+
},
|
|
222
|
+
showProperties: {
|
|
223
|
+
type: Boolean,
|
|
224
|
+
default: !1
|
|
225
|
+
},
|
|
226
|
+
sourceCrs: {
|
|
227
|
+
type: String,
|
|
228
|
+
default: ""
|
|
229
|
+
},
|
|
230
|
+
fitToLayer: {
|
|
231
|
+
type: Boolean,
|
|
232
|
+
default: !1
|
|
233
|
+
},
|
|
234
|
+
fitDuration: {
|
|
235
|
+
type: Number,
|
|
236
|
+
default: 2
|
|
237
|
+
},
|
|
238
|
+
layerZIndex: {
|
|
239
|
+
type: Number,
|
|
240
|
+
default: 0
|
|
241
|
+
},
|
|
242
|
+
styleByProperty: {
|
|
243
|
+
type: Object,
|
|
244
|
+
default: () => ({})
|
|
245
|
+
},
|
|
246
|
+
note: {
|
|
247
|
+
type: Object,
|
|
248
|
+
default: () => ({
|
|
249
|
+
fieldName: "",
|
|
250
|
+
fontFamily: "微软雅黑",
|
|
251
|
+
fontColor: "#E77148",
|
|
252
|
+
fontSize: 14,
|
|
253
|
+
wrap: !0,
|
|
254
|
+
maxChars: 10
|
|
255
|
+
})
|
|
256
|
+
},
|
|
257
|
+
noteOnly: {
|
|
258
|
+
type: Boolean,
|
|
259
|
+
default: !1
|
|
260
|
+
}
|
|
261
|
+
},
|
|
262
|
+
emits: [
|
|
263
|
+
"loaded",
|
|
264
|
+
"error",
|
|
265
|
+
"updated",
|
|
266
|
+
"click"
|
|
267
|
+
],
|
|
268
|
+
setup(c, { expose: l, emit: u }) {
|
|
269
|
+
let d = e("cesiumViewer"), ee = c, f = u, { geojson: p, name: m, style: h, show: g, clampToGround: _, fitToLayer: v, token: y, directRequest: b, showProperties: x, sourceCrs: S, fitDuration: ne, layerZIndex: C, styleByProperty: w, note: T, noteOnly: E, hiddenValues: D } = i(ee), O = null, k = r([]);
|
|
270
|
+
function A(e, t) {
|
|
271
|
+
if (!t || !e) return;
|
|
272
|
+
let n = e[t];
|
|
273
|
+
if (n != null) {
|
|
274
|
+
if (typeof n == "object" && !Array.isArray(n) && Object.prototype.hasOwnProperty.call(n, t)) {
|
|
275
|
+
let e = n[t];
|
|
276
|
+
if (e !== void 0) return e;
|
|
277
|
+
}
|
|
278
|
+
return n;
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
function j(e) {
|
|
282
|
+
return String(e ?? "").replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
283
|
+
}
|
|
284
|
+
function re(e) {
|
|
285
|
+
let t = Object.entries(e || {}).map(([e, t]) => `<tr><th>${j(e)}</th><td>${j(t)}</td></tr>`).join("");
|
|
286
|
+
return t ? `<table><tbody>${t}</tbody></table>` : "<span>该要素没有可展示属性</span>";
|
|
287
|
+
}
|
|
288
|
+
function ie(e) {
|
|
289
|
+
let t = String(e || "").toUpperCase();
|
|
290
|
+
return t.includes("3857") || t.includes("900913") || t.includes("102100") || t.includes("102113");
|
|
291
|
+
}
|
|
292
|
+
function ae(e) {
|
|
293
|
+
if (!Array.isArray(e) || e.length < 2) return e;
|
|
294
|
+
let t = 20037508.342789244, n = Number(e[0]), r = Number(e[1]);
|
|
295
|
+
return !Number.isFinite(n) || !Number.isFinite(r) ? e : [
|
|
296
|
+
n / t * 180,
|
|
297
|
+
(2 * Math.atan(Math.exp(r / t * Math.PI)) - Math.PI / 2) * 180 / Math.PI,
|
|
298
|
+
...e.slice(2)
|
|
299
|
+
];
|
|
300
|
+
}
|
|
301
|
+
function M(e) {
|
|
302
|
+
return Array.isArray(e) ? e.length >= 2 && e.every((e) => typeof e == "number") ? ae(e) : e.map(M) : e;
|
|
303
|
+
}
|
|
304
|
+
function N(e) {
|
|
305
|
+
if (!e || typeof e != "object") return e;
|
|
306
|
+
let t = { ...e };
|
|
307
|
+
return t.type === "FeatureCollection" ? t.features = Array.isArray(t.features) ? t.features.map(N) : t.features : t.type === "Feature" ? t.geometry = N(t.geometry) : t.type === "GeometryCollection" ? t.geometries = Array.isArray(t.geometries) ? t.geometries.map(N) : t.geometries : t.coordinates &&= M(t.coordinates), t;
|
|
308
|
+
}
|
|
309
|
+
function P(e, t) {
|
|
310
|
+
if (e == null) return "";
|
|
311
|
+
let n = String(e);
|
|
312
|
+
if (t?.wrap && t?.maxChars > 0) {
|
|
313
|
+
let e = Number(t.maxChars), r = [];
|
|
314
|
+
for (let t = 0; t < n.length; t += e) r.push(n.slice(t, t + e));
|
|
315
|
+
n = r.join("\n");
|
|
316
|
+
}
|
|
317
|
+
return n;
|
|
318
|
+
}
|
|
319
|
+
let F = {
|
|
320
|
+
微软雅黑: "\"Microsoft YaHei\", \"PingFang SC\", \"Helvetica Neue\", sans-serif",
|
|
321
|
+
"Microsoft YaHei": "\"Microsoft YaHei\", \"PingFang SC\", \"Helvetica Neue\", sans-serif",
|
|
322
|
+
宋体: "\"SimSun\", \"Songti SC\", serif",
|
|
323
|
+
SimSun: "\"SimSun\", \"Songti SC\", serif",
|
|
324
|
+
黑体: "\"SimHei\", \"Heiti SC\", sans-serif",
|
|
325
|
+
SimHei: "\"SimHei\", \"Heiti SC\", sans-serif",
|
|
326
|
+
楷体: "\"KaiTi\", \"Kaiti SC\", serif",
|
|
327
|
+
KaiTi: "\"KaiTi\", \"Kaiti SC\", serif"
|
|
328
|
+
};
|
|
329
|
+
function oe(e) {
|
|
330
|
+
let t = String(e || "").trim();
|
|
331
|
+
return t ? F[t] ? F[t] : t.includes(",") ? t : /[\u4e00-\u9fff]/.test(t) || /\s/.test(t) ? `"${t}", sans-serif` : `${t}, sans-serif` : "\"Microsoft YaHei\", \"PingFang SC\", sans-serif";
|
|
332
|
+
}
|
|
333
|
+
function I(e, t) {
|
|
334
|
+
return `${Number(e ?? 14)}px ${oe(t)}`;
|
|
335
|
+
}
|
|
336
|
+
function L(e) {
|
|
337
|
+
try {
|
|
338
|
+
return o.Color.fromCssColorString(e);
|
|
339
|
+
} catch {
|
|
340
|
+
return console.warn("无效的颜色字符串,使用默认颜色:", e), o.Color.YELLOW;
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
function R(e = {}, t = {}) {
|
|
344
|
+
let n = e.type || "solid", r = e.outlineColor || e.color || "#409EFF", i = e.fill || "rgba(198,53,4, 0.4)", a = Number(e.outlineWidth ?? t.outlineWidth ?? 1), o = Number(e.dashLength ?? t.dashLength ?? (n === "dashed" ? 8 : 0)), s = Number(e.gapLength ?? t.gapLength ?? (n === "dashed" ? 4 : 0));
|
|
345
|
+
return n === "dashed" && (o ||= 8, s ||= 4), {
|
|
346
|
+
type: n,
|
|
347
|
+
fill: i,
|
|
348
|
+
outlineColor: r,
|
|
349
|
+
outlineWidth: a,
|
|
350
|
+
color: e.color || t.color || r,
|
|
351
|
+
dashLength: o,
|
|
352
|
+
gapLength: s,
|
|
353
|
+
borderColor: e.borderColor || r,
|
|
354
|
+
borderWidth: Number(e.borderWidth ?? t.borderWidth ?? 0),
|
|
355
|
+
visible: e.visible !== !1
|
|
356
|
+
};
|
|
357
|
+
}
|
|
358
|
+
function z(e = {}) {
|
|
359
|
+
let t = e.point || {}, n = e.line || {}, r = e.polygon || {}, i = r.stroke?.outlineColor || r.stroke?.color || r.outlineColor || "#409EFF", a = Number(r.stroke?.outlineWidth ?? r.outlineWidth ?? 2), o = n.stroke?.outlineColor || n.stroke?.color || n.color || "#409EFF", s = Number(n.stroke?.outlineWidth ?? n.width ?? 2);
|
|
360
|
+
return {
|
|
361
|
+
point: {
|
|
362
|
+
fill: t.fill || t.color || "#FF0000",
|
|
363
|
+
radius: Number(t.radius ?? t.stroke?.radius ?? 8),
|
|
364
|
+
borderColor: t.stroke?.outlineColor || t.borderColor || "#FFFFFF",
|
|
365
|
+
borderWidth: Number(t.stroke?.outlineWidth ?? t.borderWidth ?? 1),
|
|
366
|
+
strokeVisible: t.stroke?.visible !== !1,
|
|
367
|
+
showIcon: !!t.showIcon,
|
|
368
|
+
iconStyle: t.iconStyle || {
|
|
369
|
+
url: null,
|
|
370
|
+
width: 32,
|
|
371
|
+
height: 32
|
|
372
|
+
},
|
|
373
|
+
showLabel: !!t.showLabel,
|
|
374
|
+
labelStyle: t.labelStyle || {
|
|
375
|
+
field: "name",
|
|
376
|
+
color: "#000",
|
|
377
|
+
fontSize: "12px"
|
|
378
|
+
},
|
|
379
|
+
stroke: R(t.stroke || {}, {
|
|
380
|
+
outlineColor: t.stroke?.outlineColor || t.borderColor || "#FFFFFF",
|
|
381
|
+
outlineWidth: 1
|
|
382
|
+
})
|
|
383
|
+
},
|
|
384
|
+
line: {
|
|
385
|
+
...n,
|
|
386
|
+
strokeVisible: n.stroke?.visible !== !1,
|
|
387
|
+
stroke: R(n.stroke || n, {
|
|
388
|
+
outlineColor: o,
|
|
389
|
+
outlineWidth: s,
|
|
390
|
+
color: o
|
|
391
|
+
})
|
|
392
|
+
},
|
|
393
|
+
polygon: {
|
|
394
|
+
fill: r.fill || r.color || "rgba(255, 255, 0, 0.3)",
|
|
395
|
+
outlineColor: i,
|
|
396
|
+
outlineWidth: a,
|
|
397
|
+
strokeVisible: r.stroke?.visible !== !1,
|
|
398
|
+
stroke: R(r.stroke || {}, {
|
|
399
|
+
outlineColor: i,
|
|
400
|
+
outlineWidth: a,
|
|
401
|
+
color: i,
|
|
402
|
+
borderColor: r.stroke?.borderColor || r.borderColor || i,
|
|
403
|
+
borderWidth: Number(r.stroke?.borderWidth ?? r.borderWidth ?? 0)
|
|
404
|
+
})
|
|
405
|
+
}
|
|
406
|
+
};
|
|
407
|
+
}
|
|
408
|
+
function B(e) {
|
|
409
|
+
return (e.type === "dashed" || e.dashLength > 0) && e.gapLength > 0 ? new o.PolylineDashMaterialProperty({
|
|
410
|
+
color: L(e.color),
|
|
411
|
+
dashLength: e.dashLength,
|
|
412
|
+
gapLength: e.gapLength
|
|
413
|
+
}) : e.borderWidth > 0 ? new o.PolylineOutlineMaterialProperty({
|
|
414
|
+
color: L(e.color),
|
|
415
|
+
outlineColor: L(e.borderColor),
|
|
416
|
+
outlineWidth: e.borderWidth
|
|
417
|
+
}) : new o.ColorMaterialProperty(L(e.color));
|
|
418
|
+
}
|
|
419
|
+
function se(e) {
|
|
420
|
+
let t = e && typeof e == "object" ? { ...e } : e;
|
|
421
|
+
if (!t || !t.type) throw Error("无效的GeoJSON数据");
|
|
422
|
+
let n = ie(t.crs?.properties?.name || t.crs?.name || t.sourceCrs || t.outputCrs || S.value) ? N(t) : t;
|
|
423
|
+
return delete n.crs, delete n.sourceCrs, delete n.outputCrs, n;
|
|
424
|
+
}
|
|
425
|
+
async function ce(e) {
|
|
426
|
+
if (b.value) {
|
|
427
|
+
let t = await fetch(e, {
|
|
428
|
+
credentials: "omit",
|
|
429
|
+
headers: { Accept: "application/geo+json, application/json" }
|
|
430
|
+
});
|
|
431
|
+
if (!t.ok) throw Error(`第三方 WFS 请求失败:${t.status}`);
|
|
432
|
+
return t.json();
|
|
433
|
+
}
|
|
434
|
+
let t = await s.request({
|
|
435
|
+
url: e,
|
|
436
|
+
method: "get",
|
|
437
|
+
headers: { ogc_token: y.value }
|
|
438
|
+
});
|
|
439
|
+
return t && typeof t == "object" && t.data && typeof t.status == "number" ? t.data : t;
|
|
440
|
+
}
|
|
441
|
+
async function V() {
|
|
442
|
+
try {
|
|
443
|
+
$();
|
|
444
|
+
let e;
|
|
445
|
+
e = typeof p.value == "string" ? await ce(p.value) : p.value, e = se(e), O = await o.GeoJsonDataSource.load(e, { clampToGround: _.value }), O.name = m.value, H(), await d.value.dataSources.add(O), O.show = g.value, le(), v.value && await Re(ne.value), f("loaded", {
|
|
446
|
+
dataSource: O,
|
|
447
|
+
entities: k.value,
|
|
448
|
+
name: m.value,
|
|
449
|
+
count: k.value.length
|
|
450
|
+
});
|
|
451
|
+
} catch (e) {
|
|
452
|
+
console.error("加载GeoJSON失败:", e), f("error", e);
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
function le() {
|
|
456
|
+
if (!O) return;
|
|
457
|
+
k.value = [];
|
|
458
|
+
let e = O.entities.values;
|
|
459
|
+
for (let t = 0; t < e.length; t++) k.value.push(e[t]);
|
|
460
|
+
}
|
|
461
|
+
function H() {
|
|
462
|
+
if (!O) return;
|
|
463
|
+
let e = O.entities.values;
|
|
464
|
+
for (let t = 0; t < e.length; t++) {
|
|
465
|
+
let n = e[t];
|
|
466
|
+
ue(n);
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
function ue(e) {
|
|
470
|
+
let t = Ie(e);
|
|
471
|
+
x.value && (e.description = re(t)), de(e, t), e.polygon ? Ae(e, t) : e.polyline ? je(e, t) : (e.point || e.billboard) && Me(e, t);
|
|
472
|
+
}
|
|
473
|
+
function de(e, t) {
|
|
474
|
+
let n = D.value || [];
|
|
475
|
+
if (!Array.isArray(n) || n.length === 0) {
|
|
476
|
+
e.show = !0;
|
|
477
|
+
return;
|
|
478
|
+
}
|
|
479
|
+
let r = X();
|
|
480
|
+
if (!r?.fieldName || !G(r)) {
|
|
481
|
+
e.show = !0;
|
|
482
|
+
return;
|
|
483
|
+
}
|
|
484
|
+
e.show = !fe(t, r);
|
|
485
|
+
}
|
|
486
|
+
function fe(e, t) {
|
|
487
|
+
let n = new Set((D.value || []).map(String));
|
|
488
|
+
if (!n.size) return !1;
|
|
489
|
+
let r = t.type, i = t.fieldName, a = A(e, i), o = n.has("__default__");
|
|
490
|
+
if (r === "uniqueShp" || r === "unique") {
|
|
491
|
+
let e = q(a);
|
|
492
|
+
return n.has(e) || n.has(String(a ?? "")) ? !0 : !(t.colorListArray || []).some((t) => q(t?.value) === e) && o;
|
|
493
|
+
}
|
|
494
|
+
if (r === "gradedColor" || r === "classified" || r === "classBreaks") {
|
|
495
|
+
let e = Number.parseFloat(a);
|
|
496
|
+
if (Number.isNaN(e)) return o;
|
|
497
|
+
let r = (t.colorListArray || []).find((t) => {
|
|
498
|
+
if (t?.valueMin === void 0 || t?.valueMax === void 0) return !1;
|
|
499
|
+
let n = Number(t.valueMin), r = Number(t.valueMax);
|
|
500
|
+
return e >= n && e < r;
|
|
501
|
+
});
|
|
502
|
+
return r ? n.has(`${r.valueMin}..${r.valueMax}`) || n.has(`${Number(r.valueMin)}..${Number(r.valueMax)}`) : o;
|
|
503
|
+
}
|
|
504
|
+
return !1;
|
|
505
|
+
}
|
|
506
|
+
function U(e) {
|
|
507
|
+
if (e?.a === void 0 || e?.a === null) return 1;
|
|
508
|
+
let t = Number(e.a);
|
|
509
|
+
return Number.isNaN(t) ? 1 : t <= 100 ? Math.max(0, Math.min(1, t / 100)) : Math.max(0, Math.min(1, t / 255));
|
|
510
|
+
}
|
|
511
|
+
function W(e, t) {
|
|
512
|
+
if (!e) return t;
|
|
513
|
+
if (e.color) {
|
|
514
|
+
let t = U(e);
|
|
515
|
+
if (t >= 1) return e.color;
|
|
516
|
+
try {
|
|
517
|
+
let n = o.Color.fromCssColorString(e.color);
|
|
518
|
+
return `rgba(${Math.round(n.red * 255)}, ${Math.round(n.green * 255)}, ${Math.round(n.blue * 255)}, ${t})`;
|
|
519
|
+
} catch {
|
|
520
|
+
return e.color;
|
|
521
|
+
}
|
|
522
|
+
}
|
|
523
|
+
if (e.r !== void 0 && e.g !== void 0 && e.b !== void 0) {
|
|
524
|
+
let t = U(e);
|
|
525
|
+
return `rgba(${e.r}, ${e.g}, ${e.b}, ${t})`;
|
|
526
|
+
}
|
|
527
|
+
return t;
|
|
528
|
+
}
|
|
529
|
+
function pe(e) {
|
|
530
|
+
return !Array.isArray(e) || e.length === 0 ? "" : e.some((e) => e && (e.valueMin !== void 0 || e.valueMax !== void 0)) ? "gradedColor" : e.some((e) => e && e.value !== void 0) ? "uniqueShp" : "";
|
|
531
|
+
}
|
|
532
|
+
function me(e = {}) {
|
|
533
|
+
let t = e.type || e.styleType || "";
|
|
534
|
+
return t === "classBreaks" || t === "classified" ? "gradedColor" : t === "unique" ? "uniqueShp" : t === "gradedColor" || t === "uniqueShp" ? t : pe(e.colorListArray);
|
|
535
|
+
}
|
|
536
|
+
function G(e) {
|
|
537
|
+
return !!(e.fieldName && e.colorListArray.length > 0 && e.type);
|
|
538
|
+
}
|
|
539
|
+
function K(e) {
|
|
540
|
+
return e.strictClassifiedStyle === !0 && G(e) && ["uniqueShp", "gradedColor"].includes(e.type);
|
|
541
|
+
}
|
|
542
|
+
function he(e) {
|
|
543
|
+
let t = e.stroke || {};
|
|
544
|
+
return {
|
|
545
|
+
outlineColor: t.outlineColor || e.outlineColor || "#409EFF",
|
|
546
|
+
outlineWidth: Number(t.outlineWidth ?? e.outlineWidth ?? 1),
|
|
547
|
+
type: t.type || "solid",
|
|
548
|
+
dashLength: t.dashLength ?? 0,
|
|
549
|
+
gapLength: t.gapLength ?? 0,
|
|
550
|
+
borderColor: t.borderColor || t.outlineColor || e.outlineColor || "#409EFF",
|
|
551
|
+
borderWidth: Number(t.borderWidth ?? 0),
|
|
552
|
+
visible: t.visible !== !1
|
|
553
|
+
};
|
|
554
|
+
}
|
|
555
|
+
function q(e) {
|
|
556
|
+
if (e == null) return "";
|
|
557
|
+
let t = String(e).trim(), n = Number(t);
|
|
558
|
+
return !Number.isNaN(n) && t !== "" ? String(n) : t;
|
|
559
|
+
}
|
|
560
|
+
function ge(e, t) {
|
|
561
|
+
if (!Array.isArray(e)) return null;
|
|
562
|
+
let n = q(t);
|
|
563
|
+
return e.find((e) => q(e.value) === n) || null;
|
|
564
|
+
}
|
|
565
|
+
function J(e) {
|
|
566
|
+
let t = Number(e?.a), n = Number.isFinite(t) ? t > 100 ? Math.round(Math.min(255, t) / 255 * 100) : t : 100;
|
|
567
|
+
if ([
|
|
568
|
+
e?.r,
|
|
569
|
+
e?.g,
|
|
570
|
+
e?.b
|
|
571
|
+
].every((e) => Number.isFinite(Number(e)))) return {
|
|
572
|
+
r: Number(e.r),
|
|
573
|
+
g: Number(e.g),
|
|
574
|
+
b: Number(e.b),
|
|
575
|
+
a: n
|
|
576
|
+
};
|
|
577
|
+
let r = String(e?.color || "").trim().match(/^#([0-9a-f]{6})([0-9a-f]{2})?$/i);
|
|
578
|
+
if (!r) return {
|
|
579
|
+
r: 153,
|
|
580
|
+
g: 153,
|
|
581
|
+
b: 153,
|
|
582
|
+
a: n
|
|
583
|
+
};
|
|
584
|
+
let i = r[2] === void 0 ? void 0 : parseInt(r[2], 16);
|
|
585
|
+
return {
|
|
586
|
+
r: parseInt(r[1].slice(0, 2), 16),
|
|
587
|
+
g: parseInt(r[1].slice(2, 4), 16),
|
|
588
|
+
b: parseInt(r[1].slice(4, 6), 16),
|
|
589
|
+
a: Number.isFinite(t) ? n : i === void 0 ? 100 : Math.round(i / 255 * 100)
|
|
590
|
+
};
|
|
591
|
+
}
|
|
592
|
+
function _e(e, t, n) {
|
|
593
|
+
let r = e[t], i = e[t + 1];
|
|
594
|
+
if (!i) return r;
|
|
595
|
+
let a = Number(r.valueMin), o = Number(i.valueMin ?? i.min), s = Number.isFinite(o) && o > a ? o : Number(r.valueMax), c = s > a ? Math.max(0, Math.min(1, (n - a) / (s - a))) : 0, l = J(r), u = J(i);
|
|
596
|
+
return {
|
|
597
|
+
r: Math.round(l.r + (u.r - l.r) * c),
|
|
598
|
+
g: Math.round(l.g + (u.g - l.g) * c),
|
|
599
|
+
b: Math.round(l.b + (u.b - l.b) * c),
|
|
600
|
+
a: Math.round(l.a + (u.a - l.a) * c)
|
|
601
|
+
};
|
|
602
|
+
}
|
|
603
|
+
function ve(e, t, n = !1) {
|
|
604
|
+
if (!Array.isArray(e) || e.length === 0) return null;
|
|
605
|
+
let r = [...e].filter((e) => e && e.valueMin !== void 0 && e.valueMax !== void 0).sort((e, t) => Number(e.valueMin) - Number(t.valueMin));
|
|
606
|
+
for (let e = 0; e < r.length; e++) {
|
|
607
|
+
let i = r[e], a = Number(i.valueMin), o = Number(i.valueMax);
|
|
608
|
+
if (t >= a && t < o) return n ? _e(r, e, t) : i;
|
|
609
|
+
}
|
|
610
|
+
return null;
|
|
611
|
+
}
|
|
612
|
+
function Y(e = {}) {
|
|
613
|
+
let t = e.colorList || {};
|
|
614
|
+
return t.point || t.line || t.polygon, t;
|
|
615
|
+
}
|
|
616
|
+
function ye(e, t) {
|
|
617
|
+
let n = Y(t)?.polygon;
|
|
618
|
+
return n?.fill || n?.color || e?.fill || e?.color || "rgba(255, 255, 0, 0.3)";
|
|
619
|
+
}
|
|
620
|
+
function be(e, t) {
|
|
621
|
+
let n = Y(t)?.point;
|
|
622
|
+
return n?.fill || n?.color || e?.fill || e?.color || "#FF0000";
|
|
623
|
+
}
|
|
624
|
+
function xe(e, t) {
|
|
625
|
+
let n = Y(t)?.line?.stroke;
|
|
626
|
+
return n?.outlineColor || n?.color || e?.stroke?.outlineColor || e?.stroke?.color || e?.color || "#409EFF";
|
|
627
|
+
}
|
|
628
|
+
function X() {
|
|
629
|
+
let e = w.value || {}, t = e.fieldName || "", n = Array.isArray(e.colorListArray) ? e.colorListArray : [], r = Y(e);
|
|
630
|
+
return {
|
|
631
|
+
type: me({
|
|
632
|
+
...e,
|
|
633
|
+
colorListArray: n
|
|
634
|
+
}),
|
|
635
|
+
fieldName: t,
|
|
636
|
+
colorListArray: n,
|
|
637
|
+
colorList: r,
|
|
638
|
+
defaults: {
|
|
639
|
+
point: z(h.value).point,
|
|
640
|
+
line: z(h.value).line,
|
|
641
|
+
polygon: z(h.value).polygon
|
|
642
|
+
},
|
|
643
|
+
strictClassifiedStyle: e.strictClassifiedStyle === !0,
|
|
644
|
+
continuousGraded: String(e.colorType || "continuous") === "continuous"
|
|
645
|
+
};
|
|
646
|
+
}
|
|
647
|
+
function Se(e, t) {
|
|
648
|
+
let n = t.colorList?.point;
|
|
649
|
+
return Number(n?.stroke?.radius ?? n?.radius ?? e.radius ?? 8);
|
|
650
|
+
}
|
|
651
|
+
function Z(e, t) {
|
|
652
|
+
let n = A(e, t.fieldName);
|
|
653
|
+
if (n == null || n === "") return null;
|
|
654
|
+
if (t.type === "gradedColor") {
|
|
655
|
+
let e = parseFloat(n);
|
|
656
|
+
return Number.isNaN(e) ? null : ve(t.colorListArray, e, t.continuousGraded);
|
|
657
|
+
}
|
|
658
|
+
return ge(t.colorListArray, n);
|
|
659
|
+
}
|
|
660
|
+
function Q(e, t, n) {
|
|
661
|
+
if (K(n)) return W(e, "rgba(0,0,0,0)");
|
|
662
|
+
let r = z(h.value);
|
|
663
|
+
return t === "polygon" ? W(e, ye(r.polygon, n)) : t === "line" ? W(e, xe(r.line, n)) : t === "point" ? W(e, be(r.point, n)) : W(e, "#409EFF");
|
|
664
|
+
}
|
|
665
|
+
function Ce(e) {
|
|
666
|
+
return te(e);
|
|
667
|
+
}
|
|
668
|
+
function we(e) {
|
|
669
|
+
let t = e.polyline;
|
|
670
|
+
if (!t?.positions) return null;
|
|
671
|
+
let n = t.positions;
|
|
672
|
+
return typeof n.getValue == "function" ? n.getValue(o.JulianDate.now()) : n;
|
|
673
|
+
}
|
|
674
|
+
function Te(e) {
|
|
675
|
+
let t = we(e);
|
|
676
|
+
if (!Array.isArray(t) || t.length === 0) return;
|
|
677
|
+
if (t.length === 1) return o.Cartesian3.clone(t[0]);
|
|
678
|
+
let n = 0;
|
|
679
|
+
for (let e = 0; e < t.length - 1; e++) n += o.Cartesian3.distance(t[e], t[e + 1]);
|
|
680
|
+
if (n <= 0) return o.Cartesian3.clone(t[0]);
|
|
681
|
+
let r = n / 2, i = 0;
|
|
682
|
+
for (let e = 0; e < t.length - 1; e++) {
|
|
683
|
+
let n = o.Cartesian3.distance(t[e], t[e + 1]);
|
|
684
|
+
if (i + n >= r) {
|
|
685
|
+
let a = n > 0 ? (r - i) / n : 0;
|
|
686
|
+
return o.Cartesian3.lerp(t[e], t[e + 1], a, new o.Cartesian3());
|
|
687
|
+
}
|
|
688
|
+
i += n;
|
|
689
|
+
}
|
|
690
|
+
return o.Cartesian3.clone(t[t.length - 1]);
|
|
691
|
+
}
|
|
692
|
+
function Ee(e, t, n, r = {}) {
|
|
693
|
+
if (!t) return;
|
|
694
|
+
let i = r.position;
|
|
695
|
+
if (!i) return;
|
|
696
|
+
e.position = new o.ConstantPositionProperty(i), e.label ||= new o.LabelGraphics();
|
|
697
|
+
let a = Number(n.fontSize ?? 14), s = n.fontColor || "#000", c = Number(r.pixelOffsetX ?? n.pixelOffsetX ?? 0), l = Number(r.pixelOffsetY ?? n.pixelOffsetY ?? 0), u = r.verticalOrigin ?? o.VerticalOrigin.CENTER, d = r.horizontalOrigin ?? o.HorizontalOrigin.CENTER;
|
|
698
|
+
e.label.show = new o.ConstantProperty(!0), e.label.text = new o.ConstantProperty(t), e.label.font = new o.ConstantProperty(I(a, n.fontFamily)), e.label.fillColor = new o.ConstantProperty(L(s)), e.label.outlineColor = new o.ConstantProperty(L(s)), e.label.outlineWidth = new o.ConstantProperty(0), e.label.style = o.LabelStyle.FILL_AND_OUTLINE, e.label.showBackground = new o.ConstantProperty(!1), e.label.backgroundColor = new o.ConstantProperty(o.Color.TRANSPARENT), e.label.backgroundPadding = new o.Cartesian2(0, 0), e.label.verticalOrigin = u, e.label.horizontalOrigin = d, e.label.pixelOffset = new o.Cartesian2(c, l), e.label.distanceDisplayCondition = new o.DistanceDisplayCondition(0, 5e5), e.label.scale = new o.ConstantProperty(1), n.translucencyByDistance && (e.label.translucencyByDistance = n.translucencyByDistance), n.pixelOffsetScaleByDistance && (e.label.pixelOffsetScaleByDistance = n.pixelOffsetScaleByDistance);
|
|
699
|
+
}
|
|
700
|
+
function De(e, t, n) {
|
|
701
|
+
let r = n?.fieldName, i = P(A(t, r), n);
|
|
702
|
+
if (!r || !i) return;
|
|
703
|
+
if (!e.position && e.point) {
|
|
704
|
+
let t = e.position?.getValue?.(o.JulianDate.now());
|
|
705
|
+
t && (e.position = new o.ConstantPositionProperty(t));
|
|
706
|
+
}
|
|
707
|
+
if (!e.position) return;
|
|
708
|
+
e.label ||= new o.LabelGraphics();
|
|
709
|
+
let a = Number(n.fontSize ?? 14), s = n.fontColor || "#000";
|
|
710
|
+
e.label.show = new o.ConstantProperty(!0), e.label.text = new o.ConstantProperty(i), e.label.font = new o.ConstantProperty(I(a, n.fontFamily)), e.label.fillColor = new o.ConstantProperty(L(s)), e.label.outlineWidth = new o.ConstantProperty(0), e.label.showBackground = new o.ConstantProperty(!1), e.label.backgroundColor = new o.ConstantProperty(o.Color.TRANSPARENT), e.label.backgroundPadding = new o.Cartesian2(0, 0), e.label.verticalOrigin = o.VerticalOrigin.BOTTOM, e.label.horizontalOrigin = o.HorizontalOrigin.CENTER;
|
|
711
|
+
let c = Number(e.point?.pixelSize?.getValue?.(o.JulianDate.now()) ?? z(h.value).point.radius ?? 8), l = Number(e.point?.outlineWidth?.getValue?.(o.JulianDate.now()) ?? 0), u = n.pixelOffsetY ?? -(c + l + a * .55 + 8);
|
|
712
|
+
e.label.pixelOffset = new o.Cartesian2(Number(n.pixelOffsetX ?? 0), u), e.label.distanceDisplayCondition = new o.DistanceDisplayCondition(0, 5e5), e.label.scale = new o.ConstantProperty(1);
|
|
713
|
+
}
|
|
714
|
+
function Oe(e, t, n) {
|
|
715
|
+
let r = n?.fieldName;
|
|
716
|
+
!r || !e.polygon || Ee(e, P(A(t, r), n), n, { position: Ce(e) });
|
|
717
|
+
}
|
|
718
|
+
function ke(e, t, n) {
|
|
719
|
+
let r = n?.fieldName;
|
|
720
|
+
!r || !e.polyline || Ee(e, P(A(t, r), n), n, { position: Te(e) });
|
|
721
|
+
}
|
|
722
|
+
function Ae(e, t) {
|
|
723
|
+
let n = z(h.value).polygon, r = he(n), i = X(), a = G(i) ? Z(t, i) : null, s = !K(i) || !!a;
|
|
724
|
+
if (E.value) {
|
|
725
|
+
e.polygon.material = new o.ColorMaterialProperty(o.Color.TRANSPARENT), e.polygon.outline = !1, e.polygon.outlineColor = new o.ConstantProperty(o.Color.TRANSPARENT), e.polygon.outlineWidth = new o.ConstantProperty(0), e.polyline = {
|
|
726
|
+
positions: e.polygon.hierarchy._value.positions,
|
|
727
|
+
show: !1,
|
|
728
|
+
width: 0,
|
|
729
|
+
material: o.Color.TRANSPARENT
|
|
730
|
+
}, s && T.value?.fieldName && Oe(e, t, T.value);
|
|
731
|
+
return;
|
|
732
|
+
}
|
|
733
|
+
let c = n.strokeVisible !== !1 && r.outlineWidth > 0, l = Q(a, "polygon", i), u = Number(C.value ?? 0), d = Number.isFinite(u) && u > 0 && _.value;
|
|
734
|
+
e.polygon.material = new o.ColorMaterialProperty(L(l)), d ? e.polygon.zIndex = new o.ConstantProperty(u) : e.polygon.zIndex = void 0, e.polygon.outline = c && s, e.polygon.outlineColor = new o.ConstantProperty(c && s ? L(r.outlineColor) : o.Color.TRANSPARENT), e.polygon.outlineWidth = new o.ConstantProperty(c && s ? r.outlineWidth : 0), e.polyline = {
|
|
735
|
+
positions: e.polygon.hierarchy._value.positions,
|
|
736
|
+
show: c && s,
|
|
737
|
+
width: r.outlineWidth,
|
|
738
|
+
material: B({
|
|
739
|
+
type: r.type,
|
|
740
|
+
color: r.outlineColor,
|
|
741
|
+
dashLength: r.dashLength,
|
|
742
|
+
gapLength: r.gapLength,
|
|
743
|
+
borderColor: r.borderColor,
|
|
744
|
+
borderWidth: r.borderWidth
|
|
745
|
+
})
|
|
746
|
+
}, d && (e.polyline.clampToGround = !0, e.polyline.zIndex = u), T.value?.fieldName && Oe(e, t, T.value);
|
|
747
|
+
}
|
|
748
|
+
function je(e, t) {
|
|
749
|
+
let n = z(h.value).line, r = X(), i = G(r) ? Z(t, r) : null, a = !K(r) || !!i;
|
|
750
|
+
if (E.value) {
|
|
751
|
+
e.polyline.width = new o.ConstantProperty(0), e.polyline.material = o.Color.TRANSPARENT, e.polyline && (e.polyline.show = !1);
|
|
752
|
+
return;
|
|
753
|
+
}
|
|
754
|
+
let s = Q(i, "line", r);
|
|
755
|
+
e.polyline.width = new o.ConstantProperty(a ? n.stroke.outlineWidth : 0), e.polyline.material = B({
|
|
756
|
+
type: n.stroke.type,
|
|
757
|
+
color: s,
|
|
758
|
+
dashLength: n.stroke.dashLength,
|
|
759
|
+
gapLength: n.stroke.gapLength,
|
|
760
|
+
borderColor: n.stroke.borderColor,
|
|
761
|
+
borderWidth: n.stroke.borderWidth
|
|
762
|
+
}), T.value?.fieldName && ke(e, t, T.value);
|
|
763
|
+
}
|
|
764
|
+
function Me(e, t) {
|
|
765
|
+
let n = z(h.value).point, r = X(), i = G(r) ? Z(t, r) : null, a = !K(r) || !!i;
|
|
766
|
+
if (E.value) {
|
|
767
|
+
e.billboard && (e.billboard.show = new o.ConstantProperty(!1)), e.point && (e.point.show = new o.ConstantProperty(!1));
|
|
768
|
+
return;
|
|
769
|
+
}
|
|
770
|
+
let s = Q(i, "point", r), c = Se(n, r);
|
|
771
|
+
e.billboard && (e.billboard.show = new o.ConstantProperty(!1)), e.point && (e.point.show = new o.ConstantProperty(!1)), n.showIcon && n.iconStyle.url ? Pe(e, n.iconStyle) : Ne(e, {
|
|
772
|
+
...n,
|
|
773
|
+
radius: c,
|
|
774
|
+
color: s,
|
|
775
|
+
borderColor: n.borderColor,
|
|
776
|
+
borderWidth: a ? n.borderWidth : 0
|
|
777
|
+
}), n.showLabel && n.labelStyle && Fe(e, t, n.labelStyle), T.value?.fieldName && De(e, t, T.value);
|
|
778
|
+
}
|
|
779
|
+
function Ne(e, t) {
|
|
780
|
+
e.point ||= new o.PointGraphics();
|
|
781
|
+
let n = t.strokeVisible !== !1 && Number(t.borderWidth) > 0;
|
|
782
|
+
e.point.show = new o.ConstantProperty(!0), e.point.pixelSize = new o.ConstantProperty(t.radius), e.point.color = new o.ConstantProperty(L(t.color || t.fill)), e.point.outlineColor = new o.ConstantProperty(n ? L(t.borderColor) : o.Color.TRANSPARENT), e.point.outlineWidth = new o.ConstantProperty(n ? t.borderWidth : 0);
|
|
783
|
+
}
|
|
784
|
+
function Pe(e, t) {
|
|
785
|
+
e.billboard ||= new o.BillboardGraphics(), e.billboard.show = new o.ConstantProperty(!0), e.billboard.image = new o.ConstantProperty(t.url), e.billboard.width = new o.ConstantProperty(t.width), e.billboard.height = new o.ConstantProperty(t.height), e.billboard.verticalOrigin = o.VerticalOrigin.BOTTOM;
|
|
786
|
+
}
|
|
787
|
+
function Fe(e, t, n) {
|
|
788
|
+
e.label ||= new o.LabelGraphics();
|
|
789
|
+
let r = "";
|
|
790
|
+
if (n.field) {
|
|
791
|
+
let e = A(t, n.field);
|
|
792
|
+
e != null && (r = String(e));
|
|
793
|
+
}
|
|
794
|
+
e.label.showBackground = new o.ConstantProperty(n.bgColor !== ""), e.label.backgroundColor = new o.ConstantProperty(L(n.bgColor)), e.label.show = new o.ConstantProperty(r !== ""), e.label.text = new o.ConstantProperty(r);
|
|
795
|
+
let i = parseInt(String(n.fontSize || "12"), 10) || 12;
|
|
796
|
+
e.label.font = new o.ConstantProperty(I(i, n.fontFamily)), e.label.fillColor = new o.ConstantProperty(L(n.color)), e.label.outlineColor = new o.ConstantProperty(o.Color.BLACK), e.label.outlineWidth = new o.ConstantProperty(1), e.label.verticalOrigin = o.VerticalOrigin.BOTTOM, e.label.pixelOffset = n.pixelOffset, e.label.distanceDisplayCondition = new o.DistanceDisplayCondition(0, 5e5);
|
|
797
|
+
}
|
|
798
|
+
function Ie(e) {
|
|
799
|
+
if (!e?.properties) return {};
|
|
800
|
+
let t = o.JulianDate.now(), n = e.properties, r = {}, i = n.propertyIds && [...n.propertyIds] || n.propertyNames && [...n.propertyNames] || [];
|
|
801
|
+
for (let e = 0; e < i.length; e++) {
|
|
802
|
+
let a = i[e], o = n[a];
|
|
803
|
+
if (o && typeof o.getValue == "function") try {
|
|
804
|
+
r[a] = o.getValue(t);
|
|
805
|
+
} catch {
|
|
806
|
+
r[a] = void 0;
|
|
807
|
+
}
|
|
808
|
+
}
|
|
809
|
+
return r;
|
|
810
|
+
}
|
|
811
|
+
function $() {
|
|
812
|
+
try {
|
|
813
|
+
O && d.value && (d.value.dataSources.remove(O), O = null, k.value = []);
|
|
814
|
+
} catch (e) {
|
|
815
|
+
console.warn("移除图层时发生错误:", e);
|
|
816
|
+
}
|
|
817
|
+
}
|
|
818
|
+
function Le(e) {
|
|
819
|
+
O && (O.show = e);
|
|
820
|
+
}
|
|
821
|
+
async function Re(e = 2) {
|
|
822
|
+
if (O && d.value) try {
|
|
823
|
+
return await d.value.flyTo(O, {
|
|
824
|
+
duration: e,
|
|
825
|
+
offset: {
|
|
826
|
+
heading: o.Math.toRadians(0),
|
|
827
|
+
pitch: o.Math.toRadians(-45),
|
|
828
|
+
range: void 0
|
|
829
|
+
}
|
|
830
|
+
}), !0;
|
|
831
|
+
} catch (e) {
|
|
832
|
+
return console.warn("飞行到图层范围失败:", e), !1;
|
|
833
|
+
}
|
|
834
|
+
return !1;
|
|
835
|
+
}
|
|
836
|
+
return a(p, (e) => {
|
|
837
|
+
e && V();
|
|
838
|
+
}, { deep: !0 }), a(g, (e) => {
|
|
839
|
+
Le(e);
|
|
840
|
+
}), a(h, () => {
|
|
841
|
+
O && H();
|
|
842
|
+
}, { deep: !0 }), a(w, () => {
|
|
843
|
+
O && H();
|
|
844
|
+
}, { deep: !0 }), a(D, () => {
|
|
845
|
+
O && H();
|
|
846
|
+
}, { deep: !0 }), a(C, () => {
|
|
847
|
+
O && H();
|
|
848
|
+
}), a(T, () => {
|
|
849
|
+
O && H();
|
|
850
|
+
}, { deep: !0 }), t(() => {
|
|
851
|
+
p.value && d.value && V();
|
|
852
|
+
}), a(d, (e) => {
|
|
853
|
+
p.value && e && V();
|
|
854
|
+
}), n(() => {
|
|
855
|
+
$();
|
|
856
|
+
}), l({
|
|
857
|
+
getDataSource: () => O,
|
|
858
|
+
getEntities: () => [...k.value],
|
|
859
|
+
flyTo: Re,
|
|
860
|
+
removeLayer: $,
|
|
861
|
+
reload: V,
|
|
862
|
+
setVisibility: Le
|
|
863
|
+
}), (e, t) => null;
|
|
864
|
+
}
|
|
865
|
+
};
|
|
866
|
+
//#endregion
|
|
867
|
+
export { l as n, u as r, S as t };
|