cesium-pocket 0.7.1-alpha → 0.7.2-alpha

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.
@@ -0,0 +1,794 @@
1
+ import { Cartographic as D, EllipsoidGeodesic as z, Cartesian3 as c, BoundingSphere as X, Transforms as K, Matrix4 as B, CustomDataSource as x, ConstantPositionProperty as b, ConstantProperty as u, Color as h, Cartesian2 as C, VerticalOrigin as L, HorizontalOrigin as P, LabelStyle as v, Math as Y, ScreenSpaceEventHandler as V, ScreenSpaceEventType as T, Primitive as J, PerInstanceColorAppearance as H, GeometryInstance as Q, ColorGeometryInstanceAttribute as _, EllipseGeometry as q, ArcType as $, PolygonHierarchy as W } from "cesium";
2
+ import { a as tt, R as et, P as it, D as k, C as j, b as st } from "./CircleDrawer-D2dAuEcD.js";
3
+ const m = (l, t) => {
4
+ const r = D.fromCartesian(l), i = D.fromCartesian(t);
5
+ return new z(r, i).surfaceDistance;
6
+ }, O = (l, t) => {
7
+ const r = new c();
8
+ return c.add(l, t, r), c.divideByScalar(r, 2, r), r;
9
+ }, f = (l) => {
10
+ let t = "";
11
+ return l > 1e3 * 100 ? t = (l / 1e3).toFixed(0) + " 公里" : l > 1e3 ? t = (l / 1e3).toFixed(2) + " 公里" : t = l.toFixed(2) + " 米", t;
12
+ }, A = (l) => {
13
+ if (!l || l.length === 0) return null;
14
+ let t = 0, r = 0, i = 0;
15
+ const e = l.length;
16
+ return l.forEach((a) => {
17
+ t += a.x, r += a.y, i += a.z;
18
+ }), new c(
19
+ t / e,
20
+ r / e,
21
+ i / e
22
+ );
23
+ }, at = (l) => l.reduce((r, i) => r + D.fromCartesian(i).height, 0) / l.length, G = (l) => {
24
+ if (l.length < 3) return 0;
25
+ const r = X.fromPoints(l).center, i = K.eastNorthUpToFixedFrame(r), e = B.inverse(i, new B()), s = l.map(
26
+ (n) => B.multiplyByPoint(e, n, new c())
27
+ );
28
+ let a = 0;
29
+ for (let n = 0; n < s.length; n++) {
30
+ const o = (n + 1) % s.length;
31
+ a += s[n].x * s[o].y, a -= s[o].x * s[n].y;
32
+ }
33
+ return Math.abs(a / 2);
34
+ }, R = (l) => {
35
+ let t = "";
36
+ return l > 1e3 * 1e3 * 1e3 ? t = (l / 1e3 / 1e3 / 1e4).toFixed(2) + "万平方公里" : l > 1e3 * 100 ? t = (l / 1e3 / 1e3).toFixed(2) + "平方公里" : t = l.toFixed(0) + "平方米", t;
37
+ }, y = (l) => R(G(l));
38
+ class dt {
39
+ constructor(t, r) {
40
+ this.tmpDistanceLabel = null, this.tmpAreaLabel = null, this.distanceLabel = null, this.areaLabel = null, this.dataSource = new x("gagugerDataSource"), this.assistDataSource = new x("assistDataSource"), this.circleEditFun = (i, e) => {
41
+ let s = 0;
42
+ if (this.distanceLabel) {
43
+ s = m(i, e);
44
+ const a = "半径:" + f(s);
45
+ this.distanceLabel.position = new b(e), this.distanceLabel.label && (this.distanceLabel.label.text = new u(a));
46
+ }
47
+ if (this.areaLabel) {
48
+ const a = window.Math.PI * s * s, n = "面积:" + R(a);
49
+ this.areaLabel.position = new b(i), this.areaLabel.label && (this.areaLabel.label.text = new u(n));
50
+ }
51
+ }, this.circleMovingFun = (i, e) => {
52
+ let s = 0;
53
+ if (this.tmpDistanceLabel) {
54
+ s = m(i, e);
55
+ const a = "半径:" + f(s);
56
+ this.tmpDistanceLabel.show = !0, this.tmpDistanceLabel.position = new b(e), this.tmpDistanceLabel.label && (this.tmpDistanceLabel.label.text = new u(a));
57
+ }
58
+ if (this.tmpAreaLabel) {
59
+ const a = window.Math.PI * s * s, n = "面积:" + R(a);
60
+ this.tmpAreaLabel.position = new b(i), this.tmpAreaLabel.label && (this.tmpAreaLabel.label.text = new u(n));
61
+ }
62
+ }, this.circleOverFun = (i, e) => {
63
+ this.tmpDistanceLabel.show = !1, this.tmpAreaLabel.show = !1;
64
+ const s = this.createTextLabel(new c(), "", h.DARKRED), a = this.createTextLabel(new c(), "", h.BLACK);
65
+ this.distanceLabel = this.assistDataSource.entities.add(s), this.areaLabel = this.assistDataSource.entities.add(a), this.circleEditFun(i, e);
66
+ }, this.createTextLabel = (i, e, s = h.DARKRED, a = -20) => {
67
+ const n = {
68
+ text: e,
69
+ font: "12px sans-serif bold",
70
+ fillColor: h.WHITE,
71
+ showBackground: !0,
72
+ backgroundColor: s,
73
+ style: v.FILL_AND_OUTLINE,
74
+ horizontalOrigin: P.CENTER,
75
+ verticalOrigin: L.CENTER,
76
+ pixelOffset: new C(0, a),
77
+ //偏移量
78
+ disableDepthTestDistance: Number.POSITIVE_INFINITY
79
+ };
80
+ return {
81
+ position: i,
82
+ label: n
83
+ };
84
+ }, this.viewer = t, this.viewer.dataSources.add(this.dataSource), this.viewer.dataSources.add(this.assistDataSource), this.init(r);
85
+ }
86
+ start() {
87
+ var i;
88
+ (i = this.circleDrawer) == null || i.start();
89
+ const t = this.createTextLabel(new c(), "", h.DARKRED.withAlpha(0.6)), r = this.createTextLabel(new c(), "", h.BLACK.withAlpha(0.6));
90
+ this.tmpDistanceLabel = this.assistDataSource.entities.add(t), this.tmpAreaLabel = this.assistDataSource.entities.add(r);
91
+ }
92
+ getStatus() {
93
+ var t;
94
+ (t = this.circleDrawer) == null || t.getStatus();
95
+ }
96
+ setEditStatus() {
97
+ var t;
98
+ (t = this.circleDrawer) == null || t.setEditStatus();
99
+ }
100
+ clearAll() {
101
+ var t;
102
+ (t = this.circleDrawer) == null || t.clearAll(), this.dataSource.entities.removeAll(), this.assistDataSource.entities.removeAll();
103
+ }
104
+ init(t) {
105
+ let i = { ...{
106
+ circleEditFun: this.circleEditFun,
107
+ circleMovingFun: this.circleMovingFun,
108
+ circleOverFun: this.circleOverFun
109
+ }, ...t };
110
+ this.circleDrawer = new tt(this.viewer, i);
111
+ }
112
+ }
113
+ class wt {
114
+ constructor(t, r) {
115
+ this.tmpLabel = null, this.totalLabel = null, this.dataSource = new x("gagugerDataSource"), this.assistDataSource = new x("assistDataSource"), this.rectEditFun = (i) => {
116
+ if (this.totalLabel) {
117
+ const e = A(i), s = "面积:" + y(i);
118
+ e && (this.totalLabel.show = !0, this.totalLabel.position = new b(e), this.totalLabel.label && (this.totalLabel.label.text = new u(s)));
119
+ }
120
+ }, this.rectMovingFun = (i) => {
121
+ if (this.tmpLabel) {
122
+ const e = A(i), s = "面积:" + y(i);
123
+ e && (this.tmpLabel.show = !0, this.tmpLabel.position = new b(e), this.tmpLabel.label && (this.tmpLabel.label.text = new u(s)));
124
+ }
125
+ }, this.rectOverFun = (i) => {
126
+ if (this.tmpLabel && (this.tmpLabel.show = !1), !this.totalLabel) {
127
+ const e = A(i), s = "面积:" + y(i);
128
+ if (e) {
129
+ const a = this.createTextlabel(e, s, h.BLACK);
130
+ this.totalLabel = this.assistDataSource.entities.add(a);
131
+ }
132
+ }
133
+ }, this.createTextlabel = (i, e, s = h.DARKRED, a = 0) => {
134
+ const n = {
135
+ text: e,
136
+ font: "12px sans-serif bold",
137
+ fillColor: h.WHITE,
138
+ showBackground: !0,
139
+ backgroundColor: s,
140
+ style: v.FILL_AND_OUTLINE,
141
+ horizontalOrigin: P.CENTER,
142
+ verticalOrigin: L.CENTER,
143
+ pixelOffset: new C(0, a),
144
+ //偏移量
145
+ disableDepthTestDistance: Number.POSITIVE_INFINITY
146
+ };
147
+ return {
148
+ position: i,
149
+ label: n
150
+ };
151
+ }, this.createTmplabel = () => {
152
+ let e = {
153
+ position: new c(),
154
+ label: {
155
+ text: "",
156
+ font: "12px sans-serif bold",
157
+ fillColor: h.WHITE,
158
+ showBackground: !0,
159
+ backgroundColor: h.BLACK.withAlpha(0.6),
160
+ style: v.FILL_AND_OUTLINE,
161
+ horizontalOrigin: P.LEFT,
162
+ verticalOrigin: L.BOTTOM,
163
+ disableDepthTestDistance: Number.POSITIVE_INFINITY
164
+ },
165
+ show: !1
166
+ };
167
+ return this.assistDataSource.entities.add(e);
168
+ }, this.viewer = t, this.viewer.dataSources.add(this.dataSource), this.viewer.dataSources.add(this.assistDataSource), this.init(r);
169
+ }
170
+ start() {
171
+ var t;
172
+ (t = this.rectDrawer) == null || t.start(), this.tmpLabel = this.createTmplabel();
173
+ }
174
+ getStatus() {
175
+ var t;
176
+ (t = this.rectDrawer) == null || t.getStatus();
177
+ }
178
+ setEditStatus() {
179
+ var t;
180
+ (t = this.rectDrawer) == null || t.setEditStatus();
181
+ }
182
+ clearAll() {
183
+ var t;
184
+ (t = this.rectDrawer) == null || t.clearAll(), this.dataSource.entities.removeAll(), this.assistDataSource.entities.removeAll();
185
+ }
186
+ init(t) {
187
+ let i = { ...{
188
+ rectEditFun: this.rectEditFun,
189
+ rectMovingFun: this.rectMovingFun,
190
+ rectOverFun: this.rectOverFun
191
+ }, ...t };
192
+ this.rectDrawer = new et(this.viewer, i);
193
+ }
194
+ }
195
+ const rt = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACwAAAMgCAYAAABYroDnAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyFpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTQ4IDc5LjE2NDAzNiwgMjAxOS8wOC8xMy0wMTowNjo1NyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0UmVmPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VSZWYjIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6QjA4Mzk1OTQ3QjdBMTFGMTg1RDM4RDA3NDg0RTQwNjEiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6QjA4Mzk1OTM3QjdBMTFGMTg1RDM4RDA3NDg0RTQwNjEiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIChXaW5kb3dzKSI+IDx4bXBNTTpEZXJpdmVkRnJvbSBzdFJlZjppbnN0YW5jZUlEPSJ4bXAuaWlkOjc4NkY3Rjg5QjVCMTExRUVBQjE4RjY1MkFFMzRBQjAxIiBzdFJlZjpkb2N1bWVudElEPSJ4bXAuZGlkOjc4NkY3RjhBQjVCMTExRUVBQjE4RjY1MkFFMzRBQjAxIi8+IDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8+uowDFwAAB3FJREFUeNrs3ctuHEUU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";
196
+ class pt {
197
+ constructor(t, r) {
198
+ this.editCallback = (i, e) => {
199
+ const s = this.getLonLatStr(i);
200
+ e.label && e.label.text && (e.label.text = new u(s));
201
+ }, this.billboardCallback = (i) => {
202
+ const e = this.getLonLatStr(i);
203
+ return this.viewer.entities.add({
204
+ position: i,
205
+ label: {
206
+ text: e,
207
+ font: "500 14px Helvetica",
208
+ style: v.FILL,
209
+ fillColor: h.WHITE,
210
+ outlineColor: h.BLACK,
211
+ pixelOffset: new C(0, -90),
212
+ //偏移量
213
+ showBackground: !0,
214
+ backgroundColor: h.ORANGERED,
215
+ horizontalOrigin: P.LEFT
216
+ },
217
+ billboard: {
218
+ image: rt,
219
+ width: 30,
220
+ height: 100,
221
+ scale: 1,
222
+ verticalOrigin: L.BOTTOM
223
+ },
224
+ show: !0
225
+ });
226
+ }, this.viewer = t, r ? (this.addPointFun = r.addBillboardFun ? r.addBillboardFun : this.billboardCallback, this.editPointFun = r.editPointFun ? r.editPointFun : this.editCallback, this.delConfirmFun = r.delConfirmFun) : (this.addPointFun = this.billboardCallback, this.editPointFun = this.editCallback), this.init();
227
+ }
228
+ start() {
229
+ var t;
230
+ (t = this.pointDrawer) == null || t.start();
231
+ }
232
+ getStatus() {
233
+ var t;
234
+ (t = this.pointDrawer) == null || t.getStatus();
235
+ }
236
+ setEditStatus() {
237
+ var t;
238
+ (t = this.pointDrawer) == null || t.setEditStatus();
239
+ }
240
+ setDelStatus() {
241
+ var t;
242
+ (t = this.pointDrawer) == null || t.setDelStatus();
243
+ }
244
+ clearAll() {
245
+ var t;
246
+ (t = this.pointDrawer) == null || t.clearAll();
247
+ }
248
+ getEntities() {
249
+ var t;
250
+ return (t = this.pointDrawer) == null ? void 0 : t.getEntities();
251
+ }
252
+ init() {
253
+ let t = {
254
+ addPointFun: this.addPointFun,
255
+ editPointFun: this.editPointFun
256
+ };
257
+ this.delConfirmFun && (t.delConfirmFun = this.delConfirmFun), this.pointDrawer = new it(this.viewer, t);
258
+ }
259
+ getLonLatStr(t) {
260
+ const r = D.fromCartesian(t), i = Y.toDegrees(r.longitude), e = Y.toDegrees(r.latitude);
261
+ return `${i.toFixed(2)}, ${e.toFixed(2)}`;
262
+ }
263
+ }
264
+ class bt {
265
+ constructor(t, r) {
266
+ this.tmpLabel = null, this.totalLabel = null, this.itemDisSource = new x("itemDisDataSource"), this.totalDisSource = new x("totalDisSource"), this.afterAddPointFun = (i) => {
267
+ var e, s, a;
268
+ if (((e = this.lineDrawer) == null ? void 0 : e.getStatus()) == k.DRAWABLE) {
269
+ const n = (s = i.position) == null ? void 0 : s.getValue(), o = this.lineDrawer.getPositions();
270
+ let p = o.length;
271
+ if (p > 1) {
272
+ const d = O(o[p - 2], n), E = m(o[p - 2], n), w = f(E);
273
+ let g = this.createTextlabel(d, w);
274
+ this.itemDisSource.entities.add(g);
275
+ }
276
+ } else ((a = this.lineDrawer) == null ? void 0 : a.getStatus()) == k.EDITABLE && this.reCreateAll();
277
+ }, this.movingCallbackFun = (i) => {
278
+ if (this.tmpLabel) {
279
+ const e = this.lineDrawer.getPositions(), s = e[e.length - 1];
280
+ let a = m(s, i), n = f(a);
281
+ this.tmpLabel.show = !0, this.tmpLabel.position = new b(i), this.tmpLabel.label && (this.tmpLabel.label.text = new u(n));
282
+ }
283
+ }, this.editCallbackFun = (i, e) => {
284
+ const s = this.lineDrawer.getPositions();
285
+ let a = -1, n = -1, o = 0, p = 0;
286
+ if (e > 0) {
287
+ a = e;
288
+ const w = this.itemDisSource.entities.values[e - 1], g = s[e - 1], S = O(g, i);
289
+ o = m(g, i);
290
+ const F = f(o);
291
+ w.position = new b(S), w.label.text = new u(F);
292
+ }
293
+ if (e < s.length - 1) {
294
+ n = e + 1;
295
+ const w = this.itemDisSource.entities.values[e], g = s[e + 1], S = O(i, g);
296
+ p = m(i, g);
297
+ const F = f(p);
298
+ w.position = new b(S), w.label.text = new u(F);
299
+ }
300
+ e == s.length - 1 && this.totalLabel && (this.totalLabel.position = new b(i));
301
+ let d = 0;
302
+ for (let w = 1, g = s.length; w < g; w++) {
303
+ if (a == w || n == w)
304
+ continue;
305
+ const S = s[w - 1], F = s[w], Z = m(S, F);
306
+ d += Z;
307
+ }
308
+ d += o, d += p;
309
+ let E = "共:" + f(d);
310
+ this.totalLabel && (this.totalLabel.label.text = new u(E));
311
+ }, this.stopDrawCallbackFun = () => {
312
+ if (this.tmpLabel && (this.tmpLabel.show = !1), !this.totalLabel) {
313
+ const i = this.lineDrawer.getPositions();
314
+ let e = 0, s = i.length;
315
+ for (let o = 1; o < s; o++) {
316
+ const p = i[o - 1], d = i[o], E = m(p, d);
317
+ e += E;
318
+ }
319
+ let a = "共:" + f(e), n = this.createTextlabel(i[s - 1], a, h.BLACK, -20);
320
+ this.totalLabel = this.totalDisSource.entities.add(n);
321
+ }
322
+ }, this.createTextlabel = (i, e, s = h.DARKRED, a = 0) => {
323
+ const n = {
324
+ text: e,
325
+ font: "12px sans-serif bold",
326
+ fillColor: h.WHITE,
327
+ showBackground: !0,
328
+ backgroundColor: s,
329
+ style: v.FILL_AND_OUTLINE,
330
+ horizontalOrigin: P.CENTER,
331
+ verticalOrigin: L.CENTER,
332
+ pixelOffset: new C(0, a),
333
+ //偏移量
334
+ disableDepthTestDistance: Number.POSITIVE_INFINITY
335
+ };
336
+ return {
337
+ position: i,
338
+ label: n
339
+ };
340
+ }, this.reCreateAll = () => {
341
+ this.itemDisSource.entities.removeAll(), this.totalDisSource.entities.removeAll();
342
+ const i = this.lineDrawer.getPositions();
343
+ let e = 0, s = i.length;
344
+ for (let o = 1; o < s; o++) {
345
+ const p = i[o - 1], d = i[o], E = O(p, d), w = m(p, d);
346
+ e += w;
347
+ let g = f(w), S = this.createTextlabel(E, g);
348
+ this.itemDisSource.entities.add(S);
349
+ }
350
+ let a = "共:" + f(e), n = this.createTextlabel(i[s - 1], a, h.BLACK, -20);
351
+ this.totalLabel = this.totalDisSource.entities.add(n);
352
+ }, this.viewer = t, this.viewer.dataSources.add(this.itemDisSource), this.viewer.dataSources.add(this.totalDisSource), this.init(r);
353
+ }
354
+ /**
355
+ * 开始绘制
356
+ */
357
+ start() {
358
+ var t;
359
+ (t = this.lineDrawer) == null || t.start();
360
+ }
361
+ /**
362
+ * 获取状态
363
+ */
364
+ getStatus() {
365
+ var t;
366
+ (t = this.lineDrawer) == null || t.getStatus();
367
+ }
368
+ /**
369
+ * 进入编辑状态
370
+ */
371
+ setEditStatus() {
372
+ var t;
373
+ (t = this.lineDrawer) == null || t.setEditStatus(), this.stopDrawCallbackFun();
374
+ }
375
+ /**
376
+ * 进入删除状态
377
+ */
378
+ setDelStatus() {
379
+ var t;
380
+ (t = this.lineDrawer) == null || t.setDelStatus(), this.stopDrawCallbackFun();
381
+ }
382
+ /**
383
+ * 全部清理
384
+ */
385
+ clearAll() {
386
+ var t;
387
+ (t = this.lineDrawer) == null || t.clearAll(), this.itemDisSource.entities.removeAll(), this.totalDisSource.entities.removeAll();
388
+ }
389
+ /**
390
+ * 初始化
391
+ * @param options
392
+ */
393
+ init(t) {
394
+ let i = { ...{
395
+ afterAddPointFun: this.afterAddPointFun,
396
+ movingCallbackFun: this.movingCallbackFun,
397
+ editCallbackFun: this.editCallbackFun,
398
+ stopDrawCallbackFun: this.stopDrawCallbackFun,
399
+ delCallbackFun: this.reCreateAll
400
+ }, ...t };
401
+ this.lineDrawer = new j(this.viewer, i);
402
+ }
403
+ }
404
+ class gt {
405
+ constructor(t, r) {
406
+ this.tmpLabel = null, this.totalLabel = null, this.openTmpLabel = !1, this.dataSource = new x("gagugerDataSource"), this.assistDataSource = new x("totalAreaDataSource"), this.afterAddPointFun = () => {
407
+ var i, e;
408
+ ((i = this.polygonDrawer) == null ? void 0 : i.getStatus()) == k.DRAWABLE ? this.polygonDrawer.getPositions().length > 1 && (this.openTmpLabel = !0) : ((e = this.polygonDrawer) == null ? void 0 : e.getStatus()) == k.EDITABLE && this.reCreateAll();
409
+ }, this.movingCallbackFun = (i) => {
410
+ if (this.openTmpLabel && this.tmpLabel) {
411
+ const s = [...this.polygonDrawer.getPositions(), i], a = A(s), n = "面积:" + y(s);
412
+ a && (this.tmpLabel.show = !0, this.tmpLabel.position = new b(a), this.tmpLabel.label && (this.tmpLabel.label.text = new u(n)));
413
+ }
414
+ }, this.editCallbackFun = (i) => {
415
+ if (this.openTmpLabel && this.totalLabel) {
416
+ const s = [...this.polygonDrawer.getPositions(), i], a = A(s), n = "面积:" + y(s);
417
+ a && (this.totalLabel.show = !0, this.totalLabel.position = new b(a), this.totalLabel.label && (this.totalLabel.label.text = new u(n)));
418
+ }
419
+ }, this.stopDrawCallbackFun = () => {
420
+ if (this.tmpLabel && (this.tmpLabel.show = !1), !this.totalLabel) {
421
+ const i = this.polygonDrawer.getPositions(), e = A(i), s = "面积:" + y(i);
422
+ if (e) {
423
+ const a = this.createTextlabel(e, s, h.BLACK);
424
+ this.totalLabel = this.assistDataSource.entities.add(a);
425
+ }
426
+ }
427
+ }, this.createTextlabel = (i, e, s = h.DARKRED, a = 0) => {
428
+ const n = {
429
+ text: e,
430
+ font: "12px sans-serif bold",
431
+ fillColor: h.WHITE,
432
+ showBackground: !0,
433
+ backgroundColor: s,
434
+ style: v.FILL_AND_OUTLINE,
435
+ horizontalOrigin: P.CENTER,
436
+ verticalOrigin: L.CENTER,
437
+ pixelOffset: new C(0, a),
438
+ //偏移量
439
+ disableDepthTestDistance: Number.POSITIVE_INFINITY
440
+ };
441
+ return {
442
+ position: i,
443
+ label: n
444
+ };
445
+ }, this.createTmplabel = () => {
446
+ let e = {
447
+ position: new c(),
448
+ label: {
449
+ text: "",
450
+ font: "12px sans-serif bold",
451
+ fillColor: h.WHITE,
452
+ showBackground: !0,
453
+ backgroundColor: h.BLACK.withAlpha(0.6),
454
+ style: v.FILL_AND_OUTLINE,
455
+ horizontalOrigin: P.CENTER,
456
+ verticalOrigin: L.CENTER,
457
+ disableDepthTestDistance: Number.POSITIVE_INFINITY
458
+ },
459
+ show: !1
460
+ };
461
+ return this.assistDataSource.entities.add(e);
462
+ }, this.reCreateAll = () => {
463
+ this.dataSource.entities.removeAll(), this.assistDataSource.entities.removeAll();
464
+ const i = this.polygonDrawer.getPositions(), e = A(i), s = y(i);
465
+ if (e) {
466
+ const a = this.createTextlabel(e, s, h.BLACK);
467
+ this.totalLabel = this.assistDataSource.entities.add(a);
468
+ }
469
+ }, this.viewer = t, this.viewer.dataSources.add(this.dataSource), this.viewer.dataSources.add(this.assistDataSource), this.init(r);
470
+ }
471
+ start() {
472
+ var t;
473
+ (t = this.polygonDrawer) == null || t.start(), this.tmpLabel = this.createTmplabel();
474
+ }
475
+ getStatus() {
476
+ var t;
477
+ (t = this.polygonDrawer) == null || t.getStatus();
478
+ }
479
+ setEditStatus() {
480
+ var t;
481
+ (t = this.polygonDrawer) == null || t.setEditStatus(), this.stopDrawCallbackFun();
482
+ }
483
+ setDelStatus() {
484
+ var t;
485
+ (t = this.polygonDrawer) == null || t.setDelStatus(), this.stopDrawCallbackFun();
486
+ }
487
+ clearAll() {
488
+ var t;
489
+ (t = this.polygonDrawer) == null || t.clearAll(), this.dataSource.entities.removeAll(), this.assistDataSource.entities.removeAll();
490
+ }
491
+ init(t) {
492
+ let i = { ...{
493
+ drawerMode: st.POLYGON,
494
+ afterAddPointFun: this.afterAddPointFun,
495
+ movingCallbackFun: this.movingCallbackFun,
496
+ editCallbackFun: this.editCallbackFun,
497
+ stopDrawCallbackFun: this.stopDrawCallbackFun,
498
+ delCallbackFun: this.reCreateAll
499
+ }, ...t };
500
+ this.polygonDrawer = new j(this.viewer, i);
501
+ }
502
+ }
503
+ let I = null, nt = 0;
504
+ const lt = 0.8, ot = (l) => l >= 1e3 ? `${(l / 1e3).toFixed(2)} km` : `${l.toFixed(2)} m`, U = (l, t, r, i) => {
505
+ const e = D.fromCartesian(l);
506
+ return c.fromRadians(e.longitude, e.latitude, t + r, void 0, i);
507
+ };
508
+ class Dt {
509
+ constructor(t, r) {
510
+ this.records = /* @__PURE__ */ new Map(), this.drag = null, this.placing = !1, this.suppressClick = !1, this.cameraHeld = !1, this.destroyed = !1, this.lastPosition = { x: 0, y: 0 }, this.applyExtrude = (e, s) => {
511
+ const a = Math.max(0, s);
512
+ e.extrude = a, U(e.base, e.baseHeight, a, e.top), U(e.base, e.baseHeight, a + lt, e.tip), c.subtract(e.tip, e.base, e.translation), e.disk.modelMatrix = B.fromTranslation(e.translation, e.modelMatrix);
513
+ const n = a > 0.05;
514
+ e.line.polyline.positions = new u([e.base, e.top]), e.line.show = n, e.label.position = new b(e.top), e.label.show = n;
515
+ const o = `高差:${ot(a)}`;
516
+ o !== e.labelText && (e.labelText = o, e.label.label.text = new u(o)), this.viewer.isDestroyed() || this.viewer.scene.requestRender();
517
+ }, this.metersPerPixel = (e) => {
518
+ const s = Math.max(c.distance(this.viewer.camera.positionWC, e), 1), n = this.viewer.camera.frustum.fovy ?? Math.PI / 3;
519
+ return 2 * s * Math.tan(n / 2) / Math.max(this.viewer.scene.canvas.clientHeight, 1);
520
+ }, this.find = (e) => {
521
+ if (this.destroyed || this.viewer.isDestroyed()) return null;
522
+ const s = this.viewer.scene.drillPick(new C(e.x, e.y));
523
+ for (const a of s) {
524
+ const n = a == null ? void 0 : a.id, o = typeof n == "string" ? n : n == null ? void 0 : n.id;
525
+ if (typeof o == "string" && this.records.has(o)) return this.records.get(o) ?? null;
526
+ }
527
+ return null;
528
+ }, this.hover = (e) => {
529
+ if (this.drag || this.destroyed || this.viewer.isDestroyed()) return;
530
+ const s = this.viewer.scene.canvas;
531
+ if (this.find(e)) {
532
+ I = this, s.style.cursor = "ns-resize";
533
+ return;
534
+ }
535
+ I === this && (I = null, s.style.cursor = "default");
536
+ }, this.onClick = (e) => {
537
+ var n;
538
+ if (this.suppressClick) {
539
+ this.suppressClick = !1;
540
+ return;
541
+ }
542
+ if (!this.placing || this.drag || this.destroyed || this.viewer.isDestroyed() || this.find(e.position)) return;
543
+ const s = this.viewer.camera.getPickRay(e.position), a = s && this.viewer.scene.globe.pick(s, this.viewer.scene);
544
+ a && (this.add(a), (n = this.onPlace) == null || n.call(this));
545
+ }, this.onDown = (e) => {
546
+ const s = this.find(e.position);
547
+ !s || this.viewer.isDestroyed() || (this.drag = {
548
+ record: s,
549
+ startY: e.position.y,
550
+ startExtrude: s.extrude,
551
+ metersPerPixel: this.metersPerPixel(s.base)
552
+ }, this.viewer.scene.screenSpaceCameraController.enableRotate = !1, this.viewer.scene.canvas.style.cursor = "ns-resize");
553
+ }, this.onMove = (e) => {
554
+ if (this.lastPosition = e.endPosition, !this.drag) {
555
+ this.hover(e.endPosition);
556
+ return;
557
+ }
558
+ const s = this.drag.startY - e.endPosition.y;
559
+ this.applyExtrude(this.drag.record, this.drag.startExtrude + s * this.drag.metersPerPixel);
560
+ }, this.onUp = () => {
561
+ !this.drag || this.viewer.isDestroyed() || (this.suppressClick = !0, this.drag = null, this.viewer.scene.screenSpaceCameraController.enableRotate = !0, this.hover(this.lastPosition), this.viewer.scene.requestRender());
562
+ }, this.canvasPosition = (e) => {
563
+ const s = this.viewer.scene.canvas.getBoundingClientRect();
564
+ return { x: e.clientX - s.left, y: e.clientY - s.top };
565
+ }, this.stopCamera = (e) => {
566
+ e.button !== 0 || this.destroyed || !this.find(this.canvasPosition(e)) || (this.viewer.scene.screenSpaceCameraController.enableRotate = !1, this.cameraHeld = !0);
567
+ }, this.restoreCamera = () => {
568
+ !this.cameraHeld || this.viewer.isDestroyed() || (this.cameraHeld = !1, this.viewer.scene.screenSpaceCameraController.enableRotate = !0);
569
+ }, this.viewer = t, this.onPlace = r == null ? void 0 : r.onPlace, this.handler = new V(t.scene.canvas), this.handler.setInputAction(this.onClick, T.LEFT_CLICK), this.handler.setInputAction(this.onDown, T.LEFT_DOWN), this.handler.setInputAction(this.onMove, T.MOUSE_MOVE), this.handler.setInputAction(this.onUp, T.LEFT_UP);
570
+ const i = t.scene.canvas;
571
+ i.addEventListener("pointerdown", this.stopCamera, !0), i.addEventListener("pointerup", this.restoreCamera, !0), i.addEventListener("pointercancel", this.restoreCamera, !0);
572
+ }
573
+ /** 开始在地图上放置圆面。放置会保持开启,以便连续测量。 */
574
+ start() {
575
+ this.placing = !0;
576
+ }
577
+ add(t) {
578
+ if (this.destroyed || this.viewer.isDestroyed()) return;
579
+ const r = D.fromCartesian(t), i = this.viewer.scene.globe.getHeight(r), e = typeof i == "number" ? i : r.height, s = c.fromRadians(r.longitude, r.latitude, e), a = Math.max(this.metersPerPixel(s) * 12, 8), n = `height-disk-${++nt}`, o = c.clone(s), p = c.clone(s), d = {
580
+ diskId: n,
581
+ base: s,
582
+ baseHeight: e,
583
+ extrude: 0,
584
+ top: o,
585
+ tip: p,
586
+ translation: new c(),
587
+ modelMatrix: new B(),
588
+ labelText: "高差:0 m"
589
+ };
590
+ d.disk = this.viewer.scene.primitives.add(
591
+ new J({
592
+ geometryInstances: new Q({
593
+ id: n,
594
+ geometry: new q({
595
+ center: s,
596
+ semiMajorAxis: a,
597
+ semiMinorAxis: a,
598
+ // 几何建在贴地点高度;抬升与拉高都只改 modelMatrix,避免重建。
599
+ height: e,
600
+ vertexFormat: H.VERTEX_FORMAT
601
+ }),
602
+ attributes: {
603
+ color: _.fromColor(h.CYAN.withAlpha(0.55))
604
+ }
605
+ }),
606
+ appearance: new H({
607
+ flat: !0,
608
+ translucent: !0,
609
+ closed: !1,
610
+ renderState: {
611
+ depthTest: { enabled: !1 },
612
+ depthMask: !1
613
+ }
614
+ }),
615
+ asynchronous: !1,
616
+ allowPicking: !0
617
+ })
618
+ ), d.line = this.viewer.entities.add({
619
+ polyline: {
620
+ positions: [s, o],
621
+ width: 4,
622
+ material: h.CYAN,
623
+ arcType: $.NONE
624
+ },
625
+ show: !1
626
+ }), d.label = this.viewer.entities.add({
627
+ position: o,
628
+ show: !1,
629
+ label: {
630
+ text: d.labelText,
631
+ font: "16px sans-serif",
632
+ fillColor: h.WHITE,
633
+ outlineColor: h.BLACK,
634
+ outlineWidth: 2,
635
+ style: v.FILL_AND_OUTLINE,
636
+ showBackground: !0,
637
+ backgroundColor: h.BLACK.withAlpha(0.7),
638
+ pixelOffset: new C(0, -12),
639
+ disableDepthTestDistance: Number.POSITIVE_INFINITY,
640
+ verticalOrigin: L.BOTTOM
641
+ }
642
+ }), this.records.set(n, d), this.records.set(d.line.id, d), this.records.set(d.label.id, d), this.applyExtrude(d, 0);
643
+ }
644
+ hits(t) {
645
+ return this.find(t) !== null;
646
+ }
647
+ destroy() {
648
+ if (this.destroyed) return;
649
+ this.destroyed = !0, I === this && (I = null, this.viewer.isDestroyed() || (this.viewer.scene.canvas.style.cursor = "default"));
650
+ const t = this.viewer.isDestroyed() ? null : this.viewer.scene.canvas;
651
+ if (t == null || t.removeEventListener("pointerdown", this.stopCamera, !0), t == null || t.removeEventListener("pointerup", this.restoreCamera, !0), t == null || t.removeEventListener("pointercancel", this.restoreCamera, !0), this.handler.isDestroyed() || this.handler.destroy(), t && this.cameraHeld && (this.viewer.scene.screenSpaceCameraController.enableRotate = !0), !this.viewer.isDestroyed()) {
652
+ const r = /* @__PURE__ */ new Set();
653
+ this.records.forEach((i) => {
654
+ r.has(i) || (r.add(i), this.viewer.scene.primitives.remove(i.disk), this.viewer.entities.remove(i.line), this.viewer.entities.remove(i.label));
655
+ });
656
+ }
657
+ this.drag = null, this.records.clear();
658
+ }
659
+ }
660
+ let M = null;
661
+ const ht = (l) => l >= 1e8 ? `${(l / 1e8).toFixed(2)} 亿 m³` : l >= 1e4 ? `${(l / 1e4).toFixed(2)} 万 m³` : `${l.toFixed(2)} m³`;
662
+ class N {
663
+ constructor(t) {
664
+ this.records = /* @__PURE__ */ new Map(), this.drag = null, this.cameraHeld = !1, this.paused = !1, this.destroyed = !1, this.lastPosition = { x: 0, y: 0 }, this.currentExtrude = (i, e) => {
665
+ var a;
666
+ const s = (a = i.extrudedHeight) == null ? void 0 : a.getValue(this.viewer.clock.currentTime);
667
+ return typeof s != "number" ? 0 : Math.max(0, s - e);
668
+ }, this.applyExtrude = (i, e) => {
669
+ const s = Math.max(0, e);
670
+ i.extrude = s, i.graphic.height = new u(i.baseHeight), i.graphic.extrudedHeight = s > 0.05 ? new u(i.baseHeight + s) : void 0;
671
+ const a = D.fromCartesian(i.center), n = c.fromRadians(a.longitude, a.latitude, i.baseHeight + s);
672
+ i.label.position = new b(n), i.label.label.text = new u(`体积:${ht(i.area * s)}`), i.label.show = s > 0.05, this.viewer.isDestroyed() || this.viewer.scene.requestRender();
673
+ }, this.metersPerPixel = (i) => {
674
+ const e = Math.max(c.distance(this.viewer.camera.positionWC, i), 1), a = this.viewer.camera.frustum.fovy ?? Math.PI / 3;
675
+ return 2 * e * Math.tan(a / 2) / Math.max(this.viewer.scene.canvas.clientHeight, 1);
676
+ }, this.createLabel = (i, e) => {
677
+ const s = D.fromCartesian(i);
678
+ return this.viewer.entities.add({
679
+ position: c.fromRadians(s.longitude, s.latitude, e),
680
+ show: !1,
681
+ label: {
682
+ text: "体积:0 m³",
683
+ font: "16px sans-serif",
684
+ fillColor: h.WHITE,
685
+ outlineColor: h.BLACK,
686
+ outlineWidth: 2,
687
+ style: v.FILL_AND_OUTLINE,
688
+ showBackground: !0,
689
+ backgroundColor: h.BLACK.withAlpha(0.7),
690
+ pixelOffset: new C(0, -12),
691
+ disableDepthTestDistance: Number.POSITIVE_INFINITY,
692
+ verticalOrigin: L.BOTTOM
693
+ }
694
+ });
695
+ }, this.canvasPosition = (i) => {
696
+ const e = this.viewer.scene.canvas.getBoundingClientRect();
697
+ return { x: i.clientX - e.left, y: i.clientY - e.top };
698
+ }, this.findVolume = (i) => {
699
+ if (this.paused || this.destroyed || this.viewer.isDestroyed()) return null;
700
+ const e = this.viewer.scene.drillPick(new C(i.x, i.y));
701
+ for (const s of e) {
702
+ const a = s == null ? void 0 : s.id;
703
+ if (!(!a || typeof a.id != "string")) {
704
+ if (this.records.has(a.id)) return this.records.get(a.id) ?? null;
705
+ if (a.ellipse || a.polygon || a.label) return null;
706
+ }
707
+ }
708
+ return null;
709
+ }, this.hover = (i) => {
710
+ if (this.drag || this.paused || this.destroyed || this.viewer.isDestroyed()) return;
711
+ const e = this.viewer.scene.canvas;
712
+ if (this.findVolume(i)) {
713
+ M = this, e.style.cursor = "ns-resize";
714
+ return;
715
+ }
716
+ M === this && (M = null, e.style.cursor = "default");
717
+ }, this.onExtrudeDown = (i) => {
718
+ const e = this.findVolume(i.position);
719
+ !e || this.viewer.isDestroyed() || (this.drag = {
720
+ record: e,
721
+ startY: i.position.y,
722
+ startExtrude: e.extrude,
723
+ metersPerPixel: this.metersPerPixel(e.center)
724
+ }, this.viewer.scene.screenSpaceCameraController.enableRotate = !1, this.viewer.scene.canvas.style.cursor = "ns-resize");
725
+ }, this.onExtrudeMove = (i) => {
726
+ if (this.lastPosition = i.endPosition, !this.drag) {
727
+ this.hover(i.endPosition);
728
+ return;
729
+ }
730
+ const e = this.drag.startY - i.endPosition.y;
731
+ this.applyExtrude(this.drag.record, this.drag.startExtrude + e * this.drag.metersPerPixel);
732
+ }, this.onExtrudeUp = () => {
733
+ !this.drag || this.viewer.isDestroyed() || (this.drag = null, this.viewer.scene.screenSpaceCameraController.enableRotate = !0, this.hover(this.lastPosition), this.viewer.scene.requestRender());
734
+ }, this.stopCameraOnVolume = (i) => {
735
+ i.button !== 0 || this.paused || this.destroyed || !this.findVolume(this.canvasPosition(i)) || (this.viewer.scene.screenSpaceCameraController.enableRotate = !1, this.cameraHeld = !0);
736
+ }, this.restoreCamera = () => {
737
+ !this.cameraHeld || this.viewer.isDestroyed() || (this.cameraHeld = !1, this.viewer.scene.screenSpaceCameraController.enableRotate = !0);
738
+ }, this.viewer = t, this.handler = new V(t.scene.canvas), this.handler.setInputAction(this.onExtrudeDown, T.LEFT_DOWN), this.handler.setInputAction(this.onExtrudeMove, T.MOUSE_MOVE), this.handler.setInputAction(this.onExtrudeUp, T.LEFT_UP);
739
+ const r = t.scene.canvas;
740
+ r.addEventListener("pointerdown", this.stopCameraOnVolume, !0), r.addEventListener("pointerup", this.restoreCamera, !0), r.addEventListener("pointercancel", this.restoreCamera, !0);
741
+ }
742
+ /** 贴地绘制过程中暂停上拉,避免和绘制抢鼠标。 */
743
+ setPause(t) {
744
+ this.paused = t;
745
+ }
746
+ destroy() {
747
+ if (this.destroyed) return;
748
+ this.destroyed = !0, M === this && (M = null, this.viewer.isDestroyed() || (this.viewer.scene.canvas.style.cursor = "default"));
749
+ const t = this.viewer.isDestroyed() ? null : this.viewer.scene.canvas;
750
+ t == null || t.removeEventListener("pointerdown", this.stopCameraOnVolume, !0), t == null || t.removeEventListener("pointerup", this.restoreCamera, !0), t == null || t.removeEventListener("pointercancel", this.restoreCamera, !0), this.handler.isDestroyed() || this.handler.destroy(), t && this.cameraHeld && (this.viewer.scene.screenSpaceCameraController.enableRotate = !0), this.drag = null, this.records.clear();
751
+ }
752
+ mount(t, r, i, e, s) {
753
+ if (this.destroyed || s <= 0 || this.records.has(t.id)) return;
754
+ const a = this.currentExtrude(r, e), n = this.createLabel(i, e + a), o = { entity: t, graphic: r, label: n, area: s, baseHeight: e, extrude: a, center: i };
755
+ this.records.set(t.id, o), this.records.set(n.id, o), this.applyExtrude(o, a);
756
+ }
757
+ }
758
+ class ft extends N {
759
+ add(t, r, i) {
760
+ !t.ellipse || i <= 0 || (t.ellipse.semiMajorAxis = new u(i), t.ellipse.semiMinorAxis = new u(i), this.mount(
761
+ t,
762
+ t.ellipse,
763
+ c.clone(r),
764
+ D.fromCartesian(r).height,
765
+ Math.PI * i * i
766
+ ));
767
+ }
768
+ }
769
+ class mt extends N {
770
+ add(t, r) {
771
+ const i = r.map((n) => c.clone(n)), e = G(i), s = A(i);
772
+ if (!t.polygon || i.length < 4 || e <= 0 || !s) return;
773
+ t.polygon.hierarchy = new u(new W(i)), t.polygon.perPositionHeight = new u(!1);
774
+ const a = (D.fromCartesian(i[0]).height + D.fromCartesian(i[2]).height) / 2;
775
+ this.mount(t, t.polygon, s, a, e);
776
+ }
777
+ }
778
+ class At extends N {
779
+ add(t, r) {
780
+ const i = r.map((a) => c.clone(a)), e = G(i), s = A(i);
781
+ !t.polygon || i.length < 3 || e <= 0 || !s || (t.polygon.hierarchy = new u(new W(i)), t.polygon.perPositionHeight = new u(!1), this.mount(t, t.polygon, s, at(i), e));
782
+ }
783
+ }
784
+ export {
785
+ dt as C,
786
+ Dt as H,
787
+ bt as L,
788
+ pt as P,
789
+ wt as R,
790
+ gt as a,
791
+ ft as b,
792
+ mt as c,
793
+ At as d
794
+ };