cesium-pocket 0.3.6-alpha → 0.4.0-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.
|
@@ -1,70 +1,70 @@
|
|
|
1
|
-
import { Cartographic as
|
|
2
|
-
import { a as
|
|
1
|
+
import { Cartographic as G, EllipsoidGeodesic as R, Cartesian3 as b, BoundingSphere as N, Transforms as Y, Matrix4 as B, CustomDataSource as L, ConstantPositionProperty as d, ConstantProperty as u, Color as o, Cartesian2 as I, VerticalOrigin as S, HorizontalOrigin as f, LabelStyle as C, Math as O } from "cesium";
|
|
2
|
+
import { a as y, R as j, P as U, C as P, b as W } from "./CircleDrawer-DotSQduG.js";
|
|
3
3
|
const A = (r, t) => {
|
|
4
|
-
const
|
|
5
|
-
return new
|
|
6
|
-
},
|
|
7
|
-
const
|
|
8
|
-
return b.add(r, t,
|
|
4
|
+
const l = G.fromCartesian(r), e = G.fromCartesian(t);
|
|
5
|
+
return new R(l, e).surfaceDistance;
|
|
6
|
+
}, v = (r, t) => {
|
|
7
|
+
const l = new b();
|
|
8
|
+
return b.add(r, t, l), b.divideByScalar(l, 2, l), l;
|
|
9
9
|
}, g = (r) => {
|
|
10
10
|
let t = "";
|
|
11
11
|
return r > 1e3 * 100 ? t = (r / 1e3).toFixed(0) + " 公里" : r > 1e3 ? t = (r / 1e3).toFixed(2) + " 公里" : t = r.toFixed(2) + " 米", t;
|
|
12
|
-
},
|
|
12
|
+
}, T = (r) => {
|
|
13
13
|
if (!r || r.length === 0) return null;
|
|
14
|
-
let t = 0,
|
|
14
|
+
let t = 0, l = 0, e = 0;
|
|
15
15
|
const i = r.length;
|
|
16
16
|
return r.forEach((a) => {
|
|
17
|
-
t += a.x,
|
|
17
|
+
t += a.x, l += a.y, e += a.z;
|
|
18
18
|
}), new b(
|
|
19
19
|
t / i,
|
|
20
|
-
|
|
20
|
+
l / i,
|
|
21
21
|
e / i
|
|
22
22
|
);
|
|
23
23
|
}, F = (r) => {
|
|
24
24
|
if (r.length < 3) return "0平方米";
|
|
25
|
-
const
|
|
26
|
-
(
|
|
25
|
+
const l = N.fromPoints(r).center, e = Y.eastNorthUpToFixedFrame(l), i = B.inverse(e, new B()), s = r.map(
|
|
26
|
+
(n) => B.multiplyByPoint(i, n, new b())
|
|
27
27
|
);
|
|
28
28
|
let a = 0;
|
|
29
|
-
for (let
|
|
30
|
-
const c = (
|
|
31
|
-
a += s[
|
|
29
|
+
for (let n = 0; n < s.length; n++) {
|
|
30
|
+
const c = (n + 1) % s.length;
|
|
31
|
+
a += s[n].x * s[c].y, a -= s[c].x * s[n].y;
|
|
32
32
|
}
|
|
33
|
-
return a = Math.abs(a / 2),
|
|
34
|
-
},
|
|
33
|
+
return a = Math.abs(a / 2), M(a);
|
|
34
|
+
}, M = (r) => {
|
|
35
35
|
let t = "";
|
|
36
36
|
return r > 1e3 * 1e3 * 1e3 ? t = (r / 1e3 / 1e3 / 1e4).toFixed(2) + "万平方公里" : r > 1e3 * 100 ? t = (r / 1e3 / 1e3).toFixed(2) + "平方公里" : t = r.toFixed(0) + "平方米", t;
|
|
37
37
|
};
|
|
38
|
-
class
|
|
39
|
-
constructor(t,
|
|
38
|
+
class H {
|
|
39
|
+
constructor(t, l = null) {
|
|
40
40
|
this.tmpDistanceLabel = null, this.tmpAreaLabel = null, this.distanceLabel = null, this.areaLabel = null, this.dataSource = new L("gagugerDataSource"), this.assistDataSource = new L("assistDataSource"), this.circleEditFun = (e, i) => {
|
|
41
41
|
let s = 0;
|
|
42
42
|
if (this.distanceLabel) {
|
|
43
43
|
s = A(e, i);
|
|
44
|
-
const a = g(s);
|
|
44
|
+
const a = "半径:" + g(s);
|
|
45
45
|
this.distanceLabel.position = new d(i), this.distanceLabel.label && (this.distanceLabel.label.text = new u(a));
|
|
46
46
|
}
|
|
47
47
|
if (this.areaLabel) {
|
|
48
|
-
const a = window.Math.PI * s * s,
|
|
49
|
-
this.areaLabel.position = new d(e), this.areaLabel.label && (this.areaLabel.label.text = new u(
|
|
48
|
+
const a = window.Math.PI * s * s, n = "面积:" + M(a);
|
|
49
|
+
this.areaLabel.position = new d(e), this.areaLabel.label && (this.areaLabel.label.text = new u(n));
|
|
50
50
|
}
|
|
51
51
|
}, this.circleMovingFun = (e, i) => {
|
|
52
52
|
let s = 0;
|
|
53
53
|
if (this.tmpDistanceLabel) {
|
|
54
54
|
s = A(e, i);
|
|
55
|
-
const a = g(s);
|
|
55
|
+
const a = "半径:" + g(s);
|
|
56
56
|
this.tmpDistanceLabel.show = !0, this.tmpDistanceLabel.position = new d(i), this.tmpDistanceLabel.label && (this.tmpDistanceLabel.label.text = new u(a));
|
|
57
57
|
}
|
|
58
58
|
if (this.tmpAreaLabel) {
|
|
59
|
-
const a = window.Math.PI * s * s,
|
|
60
|
-
this.tmpAreaLabel.position = new d(e), this.tmpAreaLabel.label && (this.tmpAreaLabel.label.text = new u(
|
|
59
|
+
const a = window.Math.PI * s * s, n = "面积:" + M(a);
|
|
60
|
+
this.tmpAreaLabel.position = new d(e), this.tmpAreaLabel.label && (this.tmpAreaLabel.label.text = new u(n));
|
|
61
61
|
}
|
|
62
62
|
}, this.circleOverFun = (e, i) => {
|
|
63
63
|
this.tmpDistanceLabel.show = !1, this.tmpAreaLabel.show = !1;
|
|
64
64
|
const s = this.createTextLabel(new b(), "", o.DARKRED), a = this.createTextLabel(new b(), "", o.BLACK);
|
|
65
65
|
this.distanceLabel = this.assistDataSource.entities.add(s), this.areaLabel = this.assistDataSource.entities.add(a), this.circleEditFun(e, i);
|
|
66
66
|
}, this.createTextLabel = (e, i, s = o.DARKRED, a = -20) => {
|
|
67
|
-
const
|
|
67
|
+
const n = {
|
|
68
68
|
text: i,
|
|
69
69
|
font: "12px sans-serif bold",
|
|
70
70
|
fillColor: o.WHITE,
|
|
@@ -73,21 +73,21 @@ class X {
|
|
|
73
73
|
style: C.FILL_AND_OUTLINE,
|
|
74
74
|
horizontalOrigin: f.CENTER,
|
|
75
75
|
verticalOrigin: S.CENTER,
|
|
76
|
-
pixelOffset: new
|
|
76
|
+
pixelOffset: new I(0, a),
|
|
77
77
|
//偏移量
|
|
78
|
-
|
|
78
|
+
disableDepthTestDistance: Number.POSITIVE_INFINITY
|
|
79
79
|
};
|
|
80
80
|
return {
|
|
81
81
|
position: e,
|
|
82
|
-
label:
|
|
82
|
+
label: n
|
|
83
83
|
};
|
|
84
|
-
}, this.viewer = t, this.viewer.dataSources.add(this.dataSource), this.viewer.dataSources.add(this.assistDataSource), this.init(
|
|
84
|
+
}, this.viewer = t, this.viewer.dataSources.add(this.dataSource), this.viewer.dataSources.add(this.assistDataSource), this.init(l);
|
|
85
85
|
}
|
|
86
86
|
start() {
|
|
87
87
|
var e;
|
|
88
88
|
(e = this.circleDrawer) == null || e.start();
|
|
89
|
-
const t = this.createTextLabel(new b(), "", o.DARKRED.withAlpha(0.6)),
|
|
90
|
-
this.tmpDistanceLabel = this.assistDataSource.entities.add(t), this.tmpAreaLabel = this.assistDataSource.entities.add(
|
|
89
|
+
const t = this.createTextLabel(new b(), "", o.DARKRED.withAlpha(0.6)), l = this.createTextLabel(new b(), "", o.BLACK.withAlpha(0.6));
|
|
90
|
+
this.tmpDistanceLabel = this.assistDataSource.entities.add(t), this.tmpAreaLabel = this.assistDataSource.entities.add(l);
|
|
91
91
|
}
|
|
92
92
|
getStatus() {
|
|
93
93
|
var t;
|
|
@@ -107,31 +107,31 @@ class X {
|
|
|
107
107
|
circleMovingFun: this.circleMovingFun,
|
|
108
108
|
circleOverFun: this.circleOverFun
|
|
109
109
|
}, ...t };
|
|
110
|
-
this.circleDrawer = new
|
|
110
|
+
this.circleDrawer = new y(this.viewer, e);
|
|
111
111
|
}
|
|
112
112
|
}
|
|
113
|
-
class
|
|
114
|
-
constructor(t,
|
|
113
|
+
class X {
|
|
114
|
+
constructor(t, l = null) {
|
|
115
115
|
this.tmpLabel = null, this.totalLabel = null, this.dataSource = new L("gagugerDataSource"), this.assistDataSource = new L("assistDataSource"), this.rectEditFun = (e) => {
|
|
116
116
|
if (this.totalLabel) {
|
|
117
|
-
const i =
|
|
117
|
+
const i = T(e), s = "面积:" + F(e);
|
|
118
118
|
i && (this.totalLabel.show = !0, this.totalLabel.position = new d(i), this.totalLabel.label && (this.totalLabel.label.text = new u(s)));
|
|
119
119
|
}
|
|
120
120
|
}, this.rectMovingFun = (e) => {
|
|
121
121
|
if (this.tmpLabel) {
|
|
122
|
-
const i =
|
|
122
|
+
const i = T(e), s = "面积:" + F(e);
|
|
123
123
|
i && (this.tmpLabel.show = !0, this.tmpLabel.position = new d(i), this.tmpLabel.label && (this.tmpLabel.label.text = new u(s)));
|
|
124
124
|
}
|
|
125
125
|
}, this.rectOverFun = (e) => {
|
|
126
126
|
if (this.tmpLabel && (this.tmpLabel.show = !1), !this.totalLabel) {
|
|
127
|
-
const i =
|
|
127
|
+
const i = T(e), s = "面积:" + F(e);
|
|
128
128
|
if (i) {
|
|
129
129
|
const a = this.createTextlabel(i, s, o.BLACK);
|
|
130
130
|
this.totalLabel = this.assistDataSource.entities.add(a);
|
|
131
131
|
}
|
|
132
132
|
}
|
|
133
133
|
}, this.createTextlabel = (e, i, s = o.DARKRED, a = 0) => {
|
|
134
|
-
const
|
|
134
|
+
const n = {
|
|
135
135
|
text: i,
|
|
136
136
|
font: "12px sans-serif bold",
|
|
137
137
|
fillColor: o.WHITE,
|
|
@@ -140,12 +140,13 @@ class V {
|
|
|
140
140
|
style: C.FILL_AND_OUTLINE,
|
|
141
141
|
horizontalOrigin: f.CENTER,
|
|
142
142
|
verticalOrigin: S.CENTER,
|
|
143
|
-
pixelOffset: new
|
|
143
|
+
pixelOffset: new I(0, a),
|
|
144
144
|
//偏移量
|
|
145
|
+
disableDepthTestDistance: Number.POSITIVE_INFINITY
|
|
145
146
|
};
|
|
146
147
|
return {
|
|
147
148
|
position: e,
|
|
148
|
-
label:
|
|
149
|
+
label: n
|
|
149
150
|
};
|
|
150
151
|
}, this.createTmplabel = () => {
|
|
151
152
|
let i = {
|
|
@@ -158,12 +159,13 @@ class V {
|
|
|
158
159
|
backgroundColor: o.BLACK.withAlpha(0.6),
|
|
159
160
|
style: C.FILL_AND_OUTLINE,
|
|
160
161
|
horizontalOrigin: f.LEFT,
|
|
161
|
-
verticalOrigin: S.BOTTOM
|
|
162
|
+
verticalOrigin: S.BOTTOM,
|
|
163
|
+
disableDepthTestDistance: Number.POSITIVE_INFINITY
|
|
162
164
|
},
|
|
163
165
|
show: !1
|
|
164
166
|
};
|
|
165
167
|
return this.assistDataSource.entities.add(i);
|
|
166
|
-
}, this.viewer = t, this.viewer.dataSources.add(this.dataSource), this.viewer.dataSources.add(this.assistDataSource), this.init(
|
|
168
|
+
}, this.viewer = t, this.viewer.dataSources.add(this.dataSource), this.viewer.dataSources.add(this.assistDataSource), this.init(l);
|
|
167
169
|
}
|
|
168
170
|
start() {
|
|
169
171
|
var t;
|
|
@@ -192,14 +194,13 @@ class V {
|
|
|
192
194
|
}
|
|
193
195
|
const Z = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACwAAAMgCAYAAABYroDnAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyFpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTQ4IDc5LjE2NDAzNiwgMjAxOS8wOC8xMy0wMTowNjo1NyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzE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LvIgAAAABJRU5ErkJggg==";
|
|
194
196
|
class K {
|
|
195
|
-
constructor(t,
|
|
197
|
+
constructor(t, l) {
|
|
196
198
|
this.editCallback = (e, i) => {
|
|
197
199
|
const s = this.getLonLatStr(e);
|
|
198
200
|
i.label && i.label.text && (i.label.text = new u(s));
|
|
199
201
|
}, this.billboardCallback = (e) => {
|
|
200
|
-
console.log(e);
|
|
201
202
|
const i = this.getLonLatStr(e);
|
|
202
|
-
return
|
|
203
|
+
return this.viewer.entities.add({
|
|
203
204
|
position: e,
|
|
204
205
|
label: {
|
|
205
206
|
text: i,
|
|
@@ -207,7 +208,7 @@ class K {
|
|
|
207
208
|
style: C.FILL,
|
|
208
209
|
fillColor: o.WHITE,
|
|
209
210
|
outlineColor: o.BLACK,
|
|
210
|
-
pixelOffset: new
|
|
211
|
+
pixelOffset: new I(0, -90),
|
|
211
212
|
//偏移量
|
|
212
213
|
showBackground: !0,
|
|
213
214
|
backgroundColor: o.ORANGERED,
|
|
@@ -222,7 +223,7 @@ class K {
|
|
|
222
223
|
},
|
|
223
224
|
show: !0
|
|
224
225
|
});
|
|
225
|
-
}, this.viewer = t,
|
|
226
|
+
}, this.viewer = t, l ? (this.addPointFun = l.addBillboardFun ? l.addBillboardFun : this.billboardCallback, this.editPointFun = l.editPointFun ? l.editPointFun : this.editCallback, this.delConfirmFun = l.delConfirmFun) : (this.addPointFun = this.billboardCallback, this.editPointFun = this.editCallback), this.init();
|
|
226
227
|
}
|
|
227
228
|
start() {
|
|
228
229
|
var t;
|
|
@@ -253,70 +254,70 @@ class K {
|
|
|
253
254
|
addPointFun: this.addPointFun,
|
|
254
255
|
editPointFun: this.editPointFun
|
|
255
256
|
};
|
|
256
|
-
this.pointDrawer = new U(this.viewer, t);
|
|
257
|
+
this.delConfirmFun && (t.delConfirmFun = this.delConfirmFun), this.pointDrawer = new U(this.viewer, t);
|
|
257
258
|
}
|
|
258
259
|
getLonLatStr(t) {
|
|
259
|
-
const
|
|
260
|
+
const l = G.fromCartesian(t), e = O.toDegrees(l.longitude), i = O.toDegrees(l.latitude);
|
|
260
261
|
return `${e.toFixed(2)}, ${i.toFixed(2)}`;
|
|
261
262
|
}
|
|
262
263
|
}
|
|
263
264
|
class J {
|
|
264
|
-
constructor(t,
|
|
265
|
+
constructor(t, l) {
|
|
265
266
|
this.tmpLabel = null, this.totalLabel = null, this.dataSource = new L("gagugerDataSource"), this.assistDataSource = new L("assistDataSource"), this.afterAddPointFun = (e) => {
|
|
266
267
|
const i = this.lineDrawer.getPositions();
|
|
267
268
|
let s = i.length;
|
|
268
269
|
if (s > 1) {
|
|
269
|
-
const a =
|
|
270
|
+
const a = v(i[s - 2], e), n = A(i[s - 2], e), c = g(n);
|
|
270
271
|
let w = this.createTextlabel(a, c);
|
|
271
272
|
this.dataSource.entities.add(w);
|
|
272
273
|
}
|
|
273
274
|
}, this.movingCallbackFun = (e) => {
|
|
274
275
|
if (this.tmpLabel) {
|
|
275
276
|
const i = this.lineDrawer.getPositions(), s = i[i.length - 1];
|
|
276
|
-
let a = A(s, e),
|
|
277
|
-
this.tmpLabel.show = !0, this.tmpLabel.position = new d(e), this.tmpLabel.label && (this.tmpLabel.label.text = new u(
|
|
277
|
+
let a = A(s, e), n = g(a);
|
|
278
|
+
this.tmpLabel.show = !0, this.tmpLabel.position = new d(e), this.tmpLabel.label && (this.tmpLabel.label.text = new u(n));
|
|
278
279
|
}
|
|
279
280
|
}, this.editCallbackFun = (e, i) => {
|
|
280
281
|
const s = this.lineDrawer.getPositions();
|
|
281
|
-
let a = -1,
|
|
282
|
+
let a = -1, n = -1, c = 0, w = 0;
|
|
282
283
|
if (i > 0) {
|
|
283
284
|
a = i;
|
|
284
|
-
const h = this.dataSource.entities.values[i - 1], p = s[i - 1],
|
|
285
|
+
const h = this.dataSource.entities.values[i - 1], p = s[i - 1], m = v(p, e);
|
|
285
286
|
c = A(p, e);
|
|
286
|
-
const
|
|
287
|
-
h.position = new d(
|
|
287
|
+
const E = g(c);
|
|
288
|
+
h.position = new d(m), h.label.text = new u(E);
|
|
288
289
|
}
|
|
289
290
|
if (i < s.length - 1) {
|
|
290
|
-
|
|
291
|
-
const h = this.dataSource.entities.values[i], p = s[i + 1],
|
|
291
|
+
n = i + 1;
|
|
292
|
+
const h = this.dataSource.entities.values[i], p = s[i + 1], m = v(e, p);
|
|
292
293
|
w = A(e, p);
|
|
293
|
-
const
|
|
294
|
-
h.position = new d(
|
|
294
|
+
const E = g(w);
|
|
295
|
+
h.position = new d(m), h.label.text = new u(E);
|
|
295
296
|
}
|
|
296
297
|
i == s.length - 1 && this.totalLabel && (this.totalLabel.position = new d(e));
|
|
297
298
|
let D = 0;
|
|
298
299
|
for (let h = 1, p = s.length; h < p; h++) {
|
|
299
|
-
if (a == h ||
|
|
300
|
+
if (a == h || n == h)
|
|
300
301
|
continue;
|
|
301
|
-
const
|
|
302
|
-
D +=
|
|
302
|
+
const m = s[h - 1], E = s[h], k = A(m, E);
|
|
303
|
+
D += k;
|
|
303
304
|
}
|
|
304
305
|
D += c, D += w;
|
|
305
|
-
let
|
|
306
|
-
this.totalLabel && (this.totalLabel.label.text = new u(
|
|
306
|
+
let x = "共:" + g(D);
|
|
307
|
+
this.totalLabel && (this.totalLabel.label.text = new u(x));
|
|
307
308
|
}, this.overCallbackFun = () => {
|
|
308
309
|
if (this.tmpLabel && (this.tmpLabel.show = !1), !this.totalLabel) {
|
|
309
310
|
const e = this.lineDrawer.getPositions();
|
|
310
311
|
let i = 0, s = e.length;
|
|
311
312
|
for (let c = 1; c < s; c++) {
|
|
312
|
-
const w = e[c - 1], D = e[c],
|
|
313
|
-
i +=
|
|
313
|
+
const w = e[c - 1], D = e[c], x = A(w, D);
|
|
314
|
+
i += x;
|
|
314
315
|
}
|
|
315
|
-
let a = "共:" + g(i),
|
|
316
|
-
this.totalLabel = this.assistDataSource.entities.add(
|
|
316
|
+
let a = "共:" + g(i), n = this.createTextlabel(e[s - 1], a, o.BLACK, -20);
|
|
317
|
+
this.totalLabel = this.assistDataSource.entities.add(n);
|
|
317
318
|
}
|
|
318
319
|
}, this.createTextlabel = (e, i, s = o.DARKRED, a = 0) => {
|
|
319
|
-
const
|
|
320
|
+
const n = {
|
|
320
321
|
text: i,
|
|
321
322
|
font: "12px sans-serif bold",
|
|
322
323
|
fillColor: o.WHITE,
|
|
@@ -325,12 +326,13 @@ class J {
|
|
|
325
326
|
style: C.FILL_AND_OUTLINE,
|
|
326
327
|
horizontalOrigin: f.CENTER,
|
|
327
328
|
verticalOrigin: S.CENTER,
|
|
328
|
-
pixelOffset: new
|
|
329
|
+
pixelOffset: new I(0, a),
|
|
329
330
|
//偏移量
|
|
331
|
+
disableDepthTestDistance: Number.POSITIVE_INFINITY
|
|
330
332
|
};
|
|
331
333
|
return {
|
|
332
334
|
position: e,
|
|
333
|
-
label:
|
|
335
|
+
label: n
|
|
334
336
|
};
|
|
335
337
|
}, this.createTmplabel = () => {
|
|
336
338
|
let i = {
|
|
@@ -343,7 +345,8 @@ class J {
|
|
|
343
345
|
backgroundColor: o.RED.withAlpha(0.6),
|
|
344
346
|
style: C.FILL_AND_OUTLINE,
|
|
345
347
|
horizontalOrigin: f.LEFT,
|
|
346
|
-
verticalOrigin: S.BOTTOM
|
|
348
|
+
verticalOrigin: S.BOTTOM,
|
|
349
|
+
disableDepthTestDistance: Number.POSITIVE_INFINITY
|
|
347
350
|
},
|
|
348
351
|
show: !1
|
|
349
352
|
};
|
|
@@ -353,14 +356,14 @@ class J {
|
|
|
353
356
|
const e = this.lineDrawer.getPositions();
|
|
354
357
|
let i = 0, s = e.length;
|
|
355
358
|
for (let c = 1; c < s; c++) {
|
|
356
|
-
const w = e[c - 1], D = e[c],
|
|
359
|
+
const w = e[c - 1], D = e[c], x = v(w, D), h = A(w, D);
|
|
357
360
|
i += h;
|
|
358
|
-
let p = g(h),
|
|
359
|
-
this.dataSource.entities.add(
|
|
361
|
+
let p = g(h), m = this.createTextlabel(x, p);
|
|
362
|
+
this.dataSource.entities.add(m);
|
|
360
363
|
}
|
|
361
|
-
let a = "共:" + g(i),
|
|
362
|
-
this.totalLabel = this.assistDataSource.entities.add(
|
|
363
|
-
}, this.viewer = t, this.viewer.dataSources.add(this.dataSource), this.viewer.dataSources.add(this.assistDataSource), this.init(
|
|
364
|
+
let a = "共:" + g(i), n = this.createTextlabel(e[s - 1], a, o.BLACK, -20);
|
|
365
|
+
this.totalLabel = this.assistDataSource.entities.add(n);
|
|
366
|
+
}, this.viewer = t, this.viewer.dataSources.add(this.dataSource), this.viewer.dataSources.add(this.assistDataSource), this.init(l);
|
|
364
367
|
}
|
|
365
368
|
start() {
|
|
366
369
|
var t;
|
|
@@ -394,29 +397,29 @@ class J {
|
|
|
394
397
|
}
|
|
395
398
|
}
|
|
396
399
|
class Q {
|
|
397
|
-
constructor(t,
|
|
400
|
+
constructor(t, l = null) {
|
|
398
401
|
this.tmpLabel = null, this.totalLabel = null, this.openTmpLabel = !1, this.dataSource = new L("gagugerDataSource"), this.assistDataSource = new L("assistDataSource"), this.afterAddPointFun = () => {
|
|
399
402
|
this.polygonDrawer.getPositions().length > 1 && (this.openTmpLabel = !0);
|
|
400
403
|
}, this.movingCallbackFun = (e) => {
|
|
401
404
|
if (this.openTmpLabel && this.tmpLabel) {
|
|
402
|
-
const s = [...this.polygonDrawer.getPositions(), e], a =
|
|
403
|
-
a && (this.tmpLabel.show = !0, this.tmpLabel.position = new d(a), this.tmpLabel.label && (this.tmpLabel.label.text = new u(
|
|
405
|
+
const s = [...this.polygonDrawer.getPositions(), e], a = T(s), n = "面积:" + F(s);
|
|
406
|
+
a && (this.tmpLabel.show = !0, this.tmpLabel.position = new d(a), this.tmpLabel.label && (this.tmpLabel.label.text = new u(n)));
|
|
404
407
|
}
|
|
405
408
|
}, this.editCallbackFun = (e) => {
|
|
406
409
|
if (this.openTmpLabel && this.totalLabel) {
|
|
407
|
-
const s = [...this.polygonDrawer.getPositions(), e], a =
|
|
408
|
-
a && (this.totalLabel.show = !0, this.totalLabel.position = new d(a), this.totalLabel.label && (this.totalLabel.label.text = new u(
|
|
410
|
+
const s = [...this.polygonDrawer.getPositions(), e], a = T(s), n = "面积:" + F(s);
|
|
411
|
+
a && (this.totalLabel.show = !0, this.totalLabel.position = new d(a), this.totalLabel.label && (this.totalLabel.label.text = new u(n)));
|
|
409
412
|
}
|
|
410
413
|
}, this.overCallbackFun = () => {
|
|
411
414
|
if (this.tmpLabel && (this.tmpLabel.show = !1), !this.totalLabel) {
|
|
412
|
-
const e = this.polygonDrawer.getPositions(), i =
|
|
415
|
+
const e = this.polygonDrawer.getPositions(), i = T(e), s = "面积:" + F(e);
|
|
413
416
|
if (i) {
|
|
414
417
|
const a = this.createTextlabel(i, s, o.BLACK);
|
|
415
418
|
this.totalLabel = this.assistDataSource.entities.add(a);
|
|
416
419
|
}
|
|
417
420
|
}
|
|
418
421
|
}, this.createTextlabel = (e, i, s = o.DARKRED, a = 0) => {
|
|
419
|
-
const
|
|
422
|
+
const n = {
|
|
420
423
|
text: i,
|
|
421
424
|
font: "12px sans-serif bold",
|
|
422
425
|
fillColor: o.WHITE,
|
|
@@ -425,12 +428,13 @@ class Q {
|
|
|
425
428
|
style: C.FILL_AND_OUTLINE,
|
|
426
429
|
horizontalOrigin: f.CENTER,
|
|
427
430
|
verticalOrigin: S.CENTER,
|
|
428
|
-
pixelOffset: new
|
|
431
|
+
pixelOffset: new I(0, a),
|
|
429
432
|
//偏移量
|
|
433
|
+
disableDepthTestDistance: Number.POSITIVE_INFINITY
|
|
430
434
|
};
|
|
431
435
|
return {
|
|
432
436
|
position: e,
|
|
433
|
-
label:
|
|
437
|
+
label: n
|
|
434
438
|
};
|
|
435
439
|
}, this.createTmplabel = () => {
|
|
436
440
|
let i = {
|
|
@@ -442,20 +446,21 @@ class Q {
|
|
|
442
446
|
showBackground: !0,
|
|
443
447
|
backgroundColor: o.BLACK.withAlpha(0.6),
|
|
444
448
|
style: C.FILL_AND_OUTLINE,
|
|
445
|
-
horizontalOrigin: f.
|
|
446
|
-
verticalOrigin: S.
|
|
449
|
+
horizontalOrigin: f.CENTER,
|
|
450
|
+
verticalOrigin: S.CENTER,
|
|
451
|
+
disableDepthTestDistance: Number.POSITIVE_INFINITY
|
|
447
452
|
},
|
|
448
453
|
show: !1
|
|
449
454
|
};
|
|
450
455
|
return this.assistDataSource.entities.add(i);
|
|
451
456
|
}, this.reCreateAll = () => {
|
|
452
457
|
this.dataSource.entities.removeAll(), this.assistDataSource.entities.removeAll();
|
|
453
|
-
const e = this.polygonDrawer.getPositions(), i =
|
|
458
|
+
const e = this.polygonDrawer.getPositions(), i = T(e), s = F(e);
|
|
454
459
|
if (i) {
|
|
455
460
|
const a = this.createTextlabel(i, s, o.BLACK);
|
|
456
461
|
this.totalLabel = this.assistDataSource.entities.add(a);
|
|
457
462
|
}
|
|
458
|
-
}, this.viewer = t, this.viewer.dataSources.add(this.dataSource), this.viewer.dataSources.add(this.assistDataSource), this.init(
|
|
463
|
+
}, this.viewer = t, this.viewer.dataSources.add(this.dataSource), this.viewer.dataSources.add(this.assistDataSource), this.init(l);
|
|
459
464
|
}
|
|
460
465
|
start() {
|
|
461
466
|
var t;
|
|
@@ -490,9 +495,9 @@ class Q {
|
|
|
490
495
|
}
|
|
491
496
|
}
|
|
492
497
|
export {
|
|
493
|
-
|
|
498
|
+
H as C,
|
|
494
499
|
J as L,
|
|
495
500
|
K as P,
|
|
496
|
-
|
|
501
|
+
X as R,
|
|
497
502
|
Q as a
|
|
498
503
|
};
|
package/gauger.js
CHANGED
package/index.js
CHANGED
|
@@ -4,7 +4,7 @@ import { TrianglesDrawMode as tP, TriangleFanDrawMode as EA, TriangleStripDrawMo
|
|
|
4
4
|
import { Viewer as h, Math as _, Cartesian2 as eA, Cartesian3 as L, Cartographic as ZA, SceneTransforms as YP, Ray as NP, Color as KP, ScreenSpaceEventType as gA, ScreenSpaceEventHandler as XP, createWorldTerrainAsync as ZP, EllipsoidTerrainProvider as GP, WebMapTileServiceImageryProvider as Y, Credit as N } from "cesium";
|
|
5
5
|
import { P as G, a as fA, b as xP, c as WP, d as FP, C as UA } from "./index-CcaLwHv1.js";
|
|
6
6
|
import { C as Mn, a as un, b as pn, D as bn, P as fn, R as Un } from "./CircleDrawer-DotSQduG.js";
|
|
7
|
-
import { C as dn, L as jn, P as Hn, a as mn, R as kn } from "./PolygonGaguger-
|
|
7
|
+
import { C as dn, L as jn, P as Hn, a as mn, R as kn } from "./PolygonGaguger-DMt3tXsR.js";
|
|
8
8
|
function yA(D, A) {
|
|
9
9
|
if (A === tP)
|
|
10
10
|
return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."), D;
|
package/package.json
CHANGED