cesium-pocket 0.6.3-alpha → 0.6.4-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.
- package/{CircleDrawer-Cpj_EwNA.js → CircleDrawer-vZ4-zoaH.js} +3 -3
- package/{LayersManager-CrNDU2TX.js → LayersManager-BElb5fPR.js} +0 -11
- package/{PolygonGaguger-l9qNeprR.js → PolygonGaguger-QdxgmZFu.js} +50 -50
- package/analysis.d.ts +3 -0
- package/drawer.js +1 -1
- package/gauger.js +1 -1
- package/index.d.ts +1 -0
- package/index.js +1040 -860
- package/package.json +5 -1
- package/src/analysis/analysis.d.ts +7 -0
- package/src/analysis/clipper.d.ts +28 -0
- package/src/analysis/submerger.d.ts +28 -0
- package/src/drawer/CP2dDrawer.d.ts +2 -2
- package/src/drawer/CircleDrawer.d.ts +2 -2
- package/src/drawer/RectDrawer.d.ts +2 -2
- package/src/gauger/CircleGaguger.d.ts +2 -2
- package/src/gauger/LineGaguger.d.ts +2 -2
- package/src/gauger/PointGaguger.d.ts +2 -2
- package/src/gauger/PolygonGaguger.d.ts +2 -2
- package/src/gauger/RectGaguger.d.ts +2 -2
- package/src/layers/index.d.ts +2 -2
- package/tianmap.js +1 -1
|
@@ -273,7 +273,7 @@ const L = {
|
|
|
273
273
|
//画面模式
|
|
274
274
|
};
|
|
275
275
|
class Z extends S {
|
|
276
|
-
constructor(e, t
|
|
276
|
+
constructor(e, t) {
|
|
277
277
|
super(e), this.handler = null, this.mainLineEntity = null, this.mainPolygonEntity = null, this.dashLineEntity = null, this.dashEndData = null, this.drawerMode = L.LINE, this.r_ClickEvent = () => {
|
|
278
278
|
var i;
|
|
279
279
|
(i = this.handler) == null || i.setInputAction(() => {
|
|
@@ -443,7 +443,7 @@ class Z extends S {
|
|
|
443
443
|
}
|
|
444
444
|
}
|
|
445
445
|
class V extends S {
|
|
446
|
-
constructor(e, t
|
|
446
|
+
constructor(e, t) {
|
|
447
447
|
super(e), this.handler = null, this.firstPoint = null, this.endPoint = null, this.lineEntity = null, this.polygonEntity = null, this.rect_L_ClickEvent = () => {
|
|
448
448
|
var i;
|
|
449
449
|
(i = this.handler) == null || i.setInputAction((a) => {
|
|
@@ -535,7 +535,7 @@ class V extends S {
|
|
|
535
535
|
}
|
|
536
536
|
}
|
|
537
537
|
class X extends S {
|
|
538
|
-
constructor(e, t
|
|
538
|
+
constructor(e, t) {
|
|
539
539
|
super(e), this.handler = null, this.firstPoint = new r(), this.endPoint = new r(), this.distance = 0, this.angle = 0, this.endPointEntity = null, this.ellipseEntity = null, this.circle_L_ClickEvent = () => {
|
|
540
540
|
var i;
|
|
541
541
|
(i = this.handler) == null || i.setInputAction((a) => {
|
|
@@ -192,17 +192,6 @@ class A {
|
|
|
192
192
|
this.addLayer(e, w, M, i);
|
|
193
193
|
}
|
|
194
194
|
}
|
|
195
|
-
// public getList() {
|
|
196
|
-
// const layers: any = this.viewer.imageryLayers._layers
|
|
197
|
-
// for (let i = 0, len = layers.length; i < len; i++) {
|
|
198
|
-
// const item = layers[i];
|
|
199
|
-
// let meta = this.getMetaByLayer(item)
|
|
200
|
-
// let obj = null
|
|
201
|
-
// if (meta) {
|
|
202
|
-
// obj = { code: meta.code, name: meta.name, layer: item }
|
|
203
|
-
// }
|
|
204
|
-
// }
|
|
205
|
-
// }
|
|
206
195
|
getMetaByLayer(t) {
|
|
207
196
|
let l = this.layerMap.get(t);
|
|
208
197
|
return l || null;
|
|
@@ -1,42 +1,42 @@
|
|
|
1
1
|
import { Cartographic as v, EllipsoidGeodesic as Y, Cartesian3 as g, BoundingSphere as N, Transforms as y, Matrix4 as M, CustomDataSource as L, ConstantPositionProperty as d, ConstantProperty as u, Color as c, Cartesian2 as B, VerticalOrigin as F, HorizontalOrigin as T, LabelStyle as x, Math as k } from "cesium";
|
|
2
|
-
import { a as j, R as U, P as W, D as G, C as O, b as Z } from "./CircleDrawer-
|
|
3
|
-
const A = (
|
|
4
|
-
const l = v.fromCartesian(
|
|
2
|
+
import { a as j, R as U, P as W, D as G, C as O, b as Z } from "./CircleDrawer-vZ4-zoaH.js";
|
|
3
|
+
const A = (n, t) => {
|
|
4
|
+
const l = v.fromCartesian(n), e = v.fromCartesian(t);
|
|
5
5
|
return new Y(l, e).surfaceDistance;
|
|
6
|
-
}, I = (
|
|
6
|
+
}, I = (n, t) => {
|
|
7
7
|
const l = new g();
|
|
8
|
-
return g.add(
|
|
9
|
-
}, p = (
|
|
8
|
+
return g.add(n, t, l), g.divideByScalar(l, 2, l), l;
|
|
9
|
+
}, p = (n) => {
|
|
10
10
|
let t = "";
|
|
11
|
-
return
|
|
12
|
-
}, C = (
|
|
13
|
-
if (!
|
|
11
|
+
return n > 1e3 * 100 ? t = (n / 1e3).toFixed(0) + " 公里" : n > 1e3 ? t = (n / 1e3).toFixed(2) + " 公里" : t = n.toFixed(2) + " 米", t;
|
|
12
|
+
}, C = (n) => {
|
|
13
|
+
if (!n || n.length === 0) return null;
|
|
14
14
|
let t = 0, l = 0, e = 0;
|
|
15
|
-
const i =
|
|
16
|
-
return
|
|
15
|
+
const i = n.length;
|
|
16
|
+
return n.forEach((a) => {
|
|
17
17
|
t += a.x, l += a.y, e += a.z;
|
|
18
18
|
}), new g(
|
|
19
19
|
t / i,
|
|
20
20
|
l / i,
|
|
21
21
|
e / i
|
|
22
22
|
);
|
|
23
|
-
}, m = (
|
|
24
|
-
if (
|
|
25
|
-
const l = N.fromPoints(
|
|
26
|
-
(
|
|
23
|
+
}, m = (n) => {
|
|
24
|
+
if (n.length < 3) return "0平方米";
|
|
25
|
+
const l = N.fromPoints(n).center, e = y.eastNorthUpToFixedFrame(l), i = M.inverse(e, new M()), s = n.map(
|
|
26
|
+
(r) => M.multiplyByPoint(i, r, new g())
|
|
27
27
|
);
|
|
28
28
|
let a = 0;
|
|
29
|
-
for (let
|
|
30
|
-
const o = (
|
|
31
|
-
a += s[
|
|
29
|
+
for (let r = 0; r < s.length; r++) {
|
|
30
|
+
const o = (r + 1) % s.length;
|
|
31
|
+
a += s[r].x * s[o].y, a -= s[o].x * s[r].y;
|
|
32
32
|
}
|
|
33
33
|
return a = Math.abs(a / 2), P(a);
|
|
34
|
-
}, P = (
|
|
34
|
+
}, P = (n) => {
|
|
35
35
|
let t = "";
|
|
36
|
-
return
|
|
36
|
+
return n > 1e3 * 1e3 * 1e3 ? t = (n / 1e3 / 1e3 / 1e4).toFixed(2) + "万平方公里" : n > 1e3 * 100 ? t = (n / 1e3 / 1e3).toFixed(2) + "平方公里" : t = n.toFixed(0) + "平方米", t;
|
|
37
37
|
};
|
|
38
38
|
class H {
|
|
39
|
-
constructor(t, l
|
|
39
|
+
constructor(t, l) {
|
|
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) {
|
|
@@ -45,8 +45,8 @@ class H {
|
|
|
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, r = "面积:" + P(a);
|
|
49
|
+
this.areaLabel.position = new d(e), this.areaLabel.label && (this.areaLabel.label.text = new u(r));
|
|
50
50
|
}
|
|
51
51
|
}, this.circleMovingFun = (e, i) => {
|
|
52
52
|
let s = 0;
|
|
@@ -56,15 +56,15 @@ class H {
|
|
|
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, r = "面积:" + P(a);
|
|
60
|
+
this.tmpAreaLabel.position = new d(e), this.tmpAreaLabel.label && (this.tmpAreaLabel.label.text = new u(r));
|
|
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 g(), "", c.DARKRED), a = this.createTextLabel(new g(), "", c.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 = c.DARKRED, a = -20) => {
|
|
67
|
-
const
|
|
67
|
+
const r = {
|
|
68
68
|
text: i,
|
|
69
69
|
font: "12px sans-serif bold",
|
|
70
70
|
fillColor: c.WHITE,
|
|
@@ -79,7 +79,7 @@ class H {
|
|
|
79
79
|
};
|
|
80
80
|
return {
|
|
81
81
|
position: e,
|
|
82
|
-
label:
|
|
82
|
+
label: r
|
|
83
83
|
};
|
|
84
84
|
}, this.viewer = t, this.viewer.dataSources.add(this.dataSource), this.viewer.dataSources.add(this.assistDataSource), this.init(l);
|
|
85
85
|
}
|
|
@@ -111,7 +111,7 @@ class H {
|
|
|
111
111
|
}
|
|
112
112
|
}
|
|
113
113
|
class K {
|
|
114
|
-
constructor(t, l
|
|
114
|
+
constructor(t, l) {
|
|
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
117
|
const i = C(e), s = "面积:" + m(e);
|
|
@@ -131,7 +131,7 @@ class K {
|
|
|
131
131
|
}
|
|
132
132
|
}
|
|
133
133
|
}, this.createTextlabel = (e, i, s = c.DARKRED, a = 0) => {
|
|
134
|
-
const
|
|
134
|
+
const r = {
|
|
135
135
|
text: i,
|
|
136
136
|
font: "12px sans-serif bold",
|
|
137
137
|
fillColor: c.WHITE,
|
|
@@ -146,7 +146,7 @@ class K {
|
|
|
146
146
|
};
|
|
147
147
|
return {
|
|
148
148
|
position: e,
|
|
149
|
-
label:
|
|
149
|
+
label: r
|
|
150
150
|
};
|
|
151
151
|
}, this.createTmplabel = () => {
|
|
152
152
|
let i = {
|
|
@@ -266,10 +266,10 @@ class Q {
|
|
|
266
266
|
this.tmpLabel = null, this.totalLabel = null, this.itemDisSource = new L("itemDisDataSource"), this.totalDisSource = new L("totalDisSource"), this.afterAddPointFun = (e) => {
|
|
267
267
|
var i, s, a;
|
|
268
268
|
if (((i = this.lineDrawer) == null ? void 0 : i.getStatus()) == G.DRAWABLE) {
|
|
269
|
-
const
|
|
269
|
+
const r = (s = e.position) == null ? void 0 : s.getValue(), o = this.lineDrawer.getPositions();
|
|
270
270
|
let b = o.length;
|
|
271
271
|
if (b > 1) {
|
|
272
|
-
const D = I(o[b - 2],
|
|
272
|
+
const D = I(o[b - 2], r), S = A(o[b - 2], r), h = p(S);
|
|
273
273
|
let w = this.createTextlabel(D, h);
|
|
274
274
|
this.itemDisSource.entities.add(w);
|
|
275
275
|
}
|
|
@@ -277,12 +277,12 @@ class Q {
|
|
|
277
277
|
}, this.movingCallbackFun = (e) => {
|
|
278
278
|
if (this.tmpLabel) {
|
|
279
279
|
const i = this.lineDrawer.getPositions(), s = i[i.length - 1];
|
|
280
|
-
let a = A(s, e),
|
|
281
|
-
this.tmpLabel.show = !0, this.tmpLabel.position = new d(e), this.tmpLabel.label && (this.tmpLabel.label.text = new u(
|
|
280
|
+
let a = A(s, e), r = p(a);
|
|
281
|
+
this.tmpLabel.show = !0, this.tmpLabel.position = new d(e), this.tmpLabel.label && (this.tmpLabel.label.text = new u(r));
|
|
282
282
|
}
|
|
283
283
|
}, this.editCallbackFun = (e, i) => {
|
|
284
284
|
const s = this.lineDrawer.getPositions();
|
|
285
|
-
let a = -1,
|
|
285
|
+
let a = -1, r = -1, o = 0, b = 0;
|
|
286
286
|
if (i > 0) {
|
|
287
287
|
a = i;
|
|
288
288
|
const h = this.itemDisSource.entities.values[i - 1], w = s[i - 1], f = I(w, e);
|
|
@@ -291,7 +291,7 @@ class Q {
|
|
|
291
291
|
h.position = new d(f), h.label.text = new u(E);
|
|
292
292
|
}
|
|
293
293
|
if (i < s.length - 1) {
|
|
294
|
-
|
|
294
|
+
r = i + 1;
|
|
295
295
|
const h = this.itemDisSource.entities.values[i], w = s[i + 1], f = I(e, w);
|
|
296
296
|
b = A(e, w);
|
|
297
297
|
const E = p(b);
|
|
@@ -300,7 +300,7 @@ class Q {
|
|
|
300
300
|
i == s.length - 1 && this.totalLabel && (this.totalLabel.position = new d(e));
|
|
301
301
|
let D = 0;
|
|
302
302
|
for (let h = 1, w = s.length; h < w; h++) {
|
|
303
|
-
if (a == h ||
|
|
303
|
+
if (a == h || r == h)
|
|
304
304
|
continue;
|
|
305
305
|
const f = s[h - 1], E = s[h], R = A(f, E);
|
|
306
306
|
D += R;
|
|
@@ -316,11 +316,11 @@ class Q {
|
|
|
316
316
|
const b = e[o - 1], D = e[o], S = A(b, D);
|
|
317
317
|
i += S;
|
|
318
318
|
}
|
|
319
|
-
let a = "共:" + p(i),
|
|
320
|
-
this.totalLabel = this.totalDisSource.entities.add(
|
|
319
|
+
let a = "共:" + p(i), r = this.createTextlabel(e[s - 1], a, c.BLACK, -20);
|
|
320
|
+
this.totalLabel = this.totalDisSource.entities.add(r);
|
|
321
321
|
}
|
|
322
322
|
}, this.createTextlabel = (e, i, s = c.DARKRED, a = 0) => {
|
|
323
|
-
const
|
|
323
|
+
const r = {
|
|
324
324
|
text: i,
|
|
325
325
|
font: "12px sans-serif bold",
|
|
326
326
|
fillColor: c.WHITE,
|
|
@@ -335,7 +335,7 @@ class Q {
|
|
|
335
335
|
};
|
|
336
336
|
return {
|
|
337
337
|
position: e,
|
|
338
|
-
label:
|
|
338
|
+
label: r
|
|
339
339
|
};
|
|
340
340
|
}, this.reCreateAll = () => {
|
|
341
341
|
this.itemDisSource.entities.removeAll(), this.totalDisSource.entities.removeAll();
|
|
@@ -347,8 +347,8 @@ class Q {
|
|
|
347
347
|
let w = p(h), f = this.createTextlabel(S, w);
|
|
348
348
|
this.itemDisSource.entities.add(f);
|
|
349
349
|
}
|
|
350
|
-
let a = "共:" + p(i),
|
|
351
|
-
this.totalLabel = this.totalDisSource.entities.add(
|
|
350
|
+
let a = "共:" + p(i), r = this.createTextlabel(e[s - 1], a, c.BLACK, -20);
|
|
351
|
+
this.totalLabel = this.totalDisSource.entities.add(r);
|
|
352
352
|
}, this.viewer = t, this.viewer.dataSources.add(this.itemDisSource), this.viewer.dataSources.add(this.totalDisSource), this.init(l);
|
|
353
353
|
}
|
|
354
354
|
/**
|
|
@@ -402,19 +402,19 @@ class Q {
|
|
|
402
402
|
}
|
|
403
403
|
}
|
|
404
404
|
class q {
|
|
405
|
-
constructor(t, l
|
|
405
|
+
constructor(t, l) {
|
|
406
406
|
this.tmpLabel = null, this.totalLabel = null, this.openTmpLabel = !1, this.dataSource = new L("gagugerDataSource"), this.assistDataSource = new L("totalAreaDataSource"), this.afterAddPointFun = () => {
|
|
407
407
|
var e, i;
|
|
408
408
|
((e = this.polygonDrawer) == null ? void 0 : e.getStatus()) == G.DRAWABLE ? this.polygonDrawer.getPositions().length > 1 && (this.openTmpLabel = !0) : ((i = this.polygonDrawer) == null ? void 0 : i.getStatus()) == G.EDITABLE && this.reCreateAll();
|
|
409
409
|
}, this.movingCallbackFun = (e) => {
|
|
410
410
|
if (this.openTmpLabel && this.tmpLabel) {
|
|
411
|
-
const s = [...this.polygonDrawer.getPositions(), e], a = C(s),
|
|
412
|
-
a && (this.tmpLabel.show = !0, this.tmpLabel.position = new d(a), this.tmpLabel.label && (this.tmpLabel.label.text = new u(
|
|
411
|
+
const s = [...this.polygonDrawer.getPositions(), e], a = C(s), r = "面积:" + m(s);
|
|
412
|
+
a && (this.tmpLabel.show = !0, this.tmpLabel.position = new d(a), this.tmpLabel.label && (this.tmpLabel.label.text = new u(r)));
|
|
413
413
|
}
|
|
414
414
|
}, this.editCallbackFun = (e) => {
|
|
415
415
|
if (this.openTmpLabel && this.totalLabel) {
|
|
416
|
-
const s = [...this.polygonDrawer.getPositions(), e], a = C(s),
|
|
417
|
-
a && (this.totalLabel.show = !0, this.totalLabel.position = new d(a), this.totalLabel.label && (this.totalLabel.label.text = new u(
|
|
416
|
+
const s = [...this.polygonDrawer.getPositions(), e], a = C(s), r = "面积:" + m(s);
|
|
417
|
+
a && (this.totalLabel.show = !0, this.totalLabel.position = new d(a), this.totalLabel.label && (this.totalLabel.label.text = new u(r)));
|
|
418
418
|
}
|
|
419
419
|
}, this.stopDrawCallbackFun = () => {
|
|
420
420
|
if (this.tmpLabel && (this.tmpLabel.show = !1), !this.totalLabel) {
|
|
@@ -425,7 +425,7 @@ class q {
|
|
|
425
425
|
}
|
|
426
426
|
}
|
|
427
427
|
}, this.createTextlabel = (e, i, s = c.DARKRED, a = 0) => {
|
|
428
|
-
const
|
|
428
|
+
const r = {
|
|
429
429
|
text: i,
|
|
430
430
|
font: "12px sans-serif bold",
|
|
431
431
|
fillColor: c.WHITE,
|
|
@@ -440,7 +440,7 @@ class q {
|
|
|
440
440
|
};
|
|
441
441
|
return {
|
|
442
442
|
position: e,
|
|
443
|
-
label:
|
|
443
|
+
label: r
|
|
444
444
|
};
|
|
445
445
|
}, this.createTmplabel = () => {
|
|
446
446
|
let i = {
|
package/analysis.d.ts
ADDED
package/drawer.js
CHANGED
package/gauger.js
CHANGED
package/index.d.ts
CHANGED