@poor-knight/cesium-utils 0.4.6 → 0.4.7
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/cesium-utils.cjs +5 -5
- package/dist/cesium-utils.js +32 -32
- package/dist/cesium-utils.umd.cjs +5 -5
- package/package.json +1 -1
package/dist/cesium-utils.js
CHANGED
|
@@ -257,7 +257,7 @@ const MAXBITS = 15, ENOUGH_LENS$1 = 852, ENOUGH_DISTS$1 = 592, CODES$1 = 0, LENS
|
|
|
257
257
|
const h = c.bits;
|
|
258
258
|
let a = 0, m = 0, y = 0, g = 0, p = 0, v = 0, w = 0, _ = 0, O = 0, b = 0, x, T, E, R, S, P = null, D;
|
|
259
259
|
const A = new Uint16Array(MAXBITS + 1), I = new Uint16Array(MAXBITS + 1);
|
|
260
|
-
let B = null, F, q,
|
|
260
|
+
let B = null, F, q, W;
|
|
261
261
|
for (a = 0; a <= MAXBITS; a++)
|
|
262
262
|
A[a] = 0;
|
|
263
263
|
for (m = 0; m < o; m++)
|
|
@@ -280,9 +280,9 @@ const MAXBITS = 15, ENOUGH_LENS$1 = 852, ENOUGH_DISTS$1 = 592, CODES$1 = 0, LENS
|
|
|
280
280
|
if (s === CODES$1 ? (P = B = l, D = 20) : s === LENS$1 ? (P = lbase, B = lext, D = 257) : (P = dbase, B = dext, D = 0), b = 0, m = 0, a = y, S = u, v = p, w = 0, E = -1, O = 1 << p, R = O - 1, s === LENS$1 && O > ENOUGH_LENS$1 || s === DISTS$1 && O > ENOUGH_DISTS$1)
|
|
281
281
|
return 1;
|
|
282
282
|
for (; ; ) {
|
|
283
|
-
F = a - w, l[m] + 1 < D ? (q = 0,
|
|
283
|
+
F = a - w, l[m] + 1 < D ? (q = 0, W = l[m]) : l[m] >= D ? (q = B[l[m] - D], W = P[l[m] - D]) : (q = 96, W = 0), x = 1 << a - w, T = 1 << v, y = T;
|
|
284
284
|
do
|
|
285
|
-
T -= x, d[S + (b >> w) + T] = F << 24 | q << 16 |
|
|
285
|
+
T -= x, d[S + (b >> w) + T] = F << 24 | q << 16 | W | 0;
|
|
286
286
|
while (T !== 0);
|
|
287
287
|
for (x = 1 << a - 1; b & x; )
|
|
288
288
|
x >>= 1;
|
|
@@ -4167,7 +4167,7 @@ function parse(s, i, r) {
|
|
|
4167
4167
|
M,
|
|
4168
4168
|
function(z) {
|
|
4169
4169
|
if (z === "option")
|
|
4170
|
-
|
|
4170
|
+
V(M, z), h(";");
|
|
4171
4171
|
else throw b(z);
|
|
4172
4172
|
},
|
|
4173
4173
|
function() {
|
|
@@ -4237,7 +4237,7 @@ function parse(s, i, r) {
|
|
|
4237
4237
|
function I(C, k) {
|
|
4238
4238
|
switch (k) {
|
|
4239
4239
|
case "option":
|
|
4240
|
-
return
|
|
4240
|
+
return V(C, k), h(";"), !0;
|
|
4241
4241
|
case "message":
|
|
4242
4242
|
return F(C, k), !0;
|
|
4243
4243
|
case "enum":
|
|
@@ -4292,7 +4292,7 @@ function parse(s, i, r) {
|
|
|
4292
4292
|
function q(C, k, N) {
|
|
4293
4293
|
var $ = u();
|
|
4294
4294
|
if ($ === "group") {
|
|
4295
|
-
|
|
4295
|
+
W(C, k);
|
|
4296
4296
|
return;
|
|
4297
4297
|
}
|
|
4298
4298
|
for (; $.endsWith(".") || c().startsWith("."); )
|
|
@@ -4306,7 +4306,7 @@ function parse(s, i, r) {
|
|
|
4306
4306
|
L,
|
|
4307
4307
|
function(Z) {
|
|
4308
4308
|
if (Z === "option")
|
|
4309
|
-
|
|
4309
|
+
V(L, Z), h(";");
|
|
4310
4310
|
else throw b(Z);
|
|
4311
4311
|
},
|
|
4312
4312
|
function() {
|
|
@@ -4324,7 +4324,7 @@ function parse(s, i, r) {
|
|
|
4324
4324
|
!0
|
|
4325
4325
|
);
|
|
4326
4326
|
}
|
|
4327
|
-
function
|
|
4327
|
+
function W(C, k) {
|
|
4328
4328
|
var N = u();
|
|
4329
4329
|
if (!nameRe.test(N)) throw b(N, "name");
|
|
4330
4330
|
var $ = util.lcFirst(N);
|
|
@@ -4335,7 +4335,7 @@ function parse(s, i, r) {
|
|
|
4335
4335
|
z.filename = parse.filename, B(L, function(Z) {
|
|
4336
4336
|
switch (Z) {
|
|
4337
4337
|
case "option":
|
|
4338
|
-
|
|
4338
|
+
V(L, Z), h(";");
|
|
4339
4339
|
break;
|
|
4340
4340
|
case "required":
|
|
4341
4341
|
case "repeated":
|
|
@@ -4372,7 +4372,7 @@ function parse(s, i, r) {
|
|
|
4372
4372
|
M,
|
|
4373
4373
|
function(z) {
|
|
4374
4374
|
if (z === "option")
|
|
4375
|
-
|
|
4375
|
+
V(M, z), h(";");
|
|
4376
4376
|
else throw b(z);
|
|
4377
4377
|
},
|
|
4378
4378
|
function() {
|
|
@@ -4384,7 +4384,7 @@ function parse(s, i, r) {
|
|
|
4384
4384
|
if (!nameRe.test(k = u())) throw b(k, "name");
|
|
4385
4385
|
var N = new OneOf(O(k));
|
|
4386
4386
|
B(N, function(M) {
|
|
4387
|
-
M === "option" ? (
|
|
4387
|
+
M === "option" ? (V(N, M), h(";")) : (l(M), q(N, "optional"));
|
|
4388
4388
|
}), C.add(N);
|
|
4389
4389
|
}
|
|
4390
4390
|
function U(C, k) {
|
|
@@ -4393,7 +4393,7 @@ function parse(s, i, r) {
|
|
|
4393
4393
|
B(N, function(M) {
|
|
4394
4394
|
switch (M) {
|
|
4395
4395
|
case "option":
|
|
4396
|
-
|
|
4396
|
+
V(N, M), h(";");
|
|
4397
4397
|
break;
|
|
4398
4398
|
case "reserved":
|
|
4399
4399
|
E(N.reserved || (N.reserved = []), !0);
|
|
@@ -4415,7 +4415,7 @@ function parse(s, i, r) {
|
|
|
4415
4415
|
$,
|
|
4416
4416
|
function(L) {
|
|
4417
4417
|
if (L === "option")
|
|
4418
|
-
|
|
4418
|
+
V($, L), h(";");
|
|
4419
4419
|
else throw b(L);
|
|
4420
4420
|
},
|
|
4421
4421
|
function() {
|
|
@@ -4423,7 +4423,7 @@ function parse(s, i, r) {
|
|
|
4423
4423
|
}
|
|
4424
4424
|
), C.add(k, N, $.comment, $.options);
|
|
4425
4425
|
}
|
|
4426
|
-
function
|
|
4426
|
+
function V(C, k) {
|
|
4427
4427
|
var N = h("(", !0);
|
|
4428
4428
|
if (!typeRefRe.test(k = u())) throw b(k, "name");
|
|
4429
4429
|
var $ = k, M = $, L;
|
|
@@ -4468,7 +4468,7 @@ function parse(s, i, r) {
|
|
|
4468
4468
|
function te(C) {
|
|
4469
4469
|
if (h("[", !0)) {
|
|
4470
4470
|
do
|
|
4471
|
-
|
|
4471
|
+
V(C, "option");
|
|
4472
4472
|
while (h(",", !0));
|
|
4473
4473
|
h("]");
|
|
4474
4474
|
}
|
|
@@ -4492,7 +4492,7 @@ function parse(s, i, r) {
|
|
|
4492
4492
|
var re = new Method(M, $, L, K, z, Z);
|
|
4493
4493
|
re.comment = N, B(re, function(ie) {
|
|
4494
4494
|
if (ie === "option")
|
|
4495
|
-
|
|
4495
|
+
V(re, ie), h(";");
|
|
4496
4496
|
else throw b(ie);
|
|
4497
4497
|
}), C.add(re);
|
|
4498
4498
|
}
|
|
@@ -4530,7 +4530,7 @@ function parse(s, i, r) {
|
|
|
4530
4530
|
A();
|
|
4531
4531
|
break;
|
|
4532
4532
|
case "option":
|
|
4533
|
-
|
|
4533
|
+
V(_, H), h(";");
|
|
4534
4534
|
break;
|
|
4535
4535
|
default:
|
|
4536
4536
|
if (I(_, H)) {
|
|
@@ -5831,23 +5831,23 @@ class ShipLayer extends EventEmitter {
|
|
|
5831
5831
|
), I.addSample(q, A);
|
|
5832
5832
|
}
|
|
5833
5833
|
if (o.position = I, x && (x.position = I), b && (b.position = I), o.properties)
|
|
5834
|
-
for (const [q,
|
|
5834
|
+
for (const [q, W] of Object.entries(r.properties ?? {})) {
|
|
5835
5835
|
if (q == "speedOverGround") {
|
|
5836
|
-
const G = o.properties.getValue().speedOverGround ?? 0, X = Number(G) > this.IS_MOVING_THRESHOLD, U = Number(
|
|
5836
|
+
const G = o.properties.getValue().speedOverGround ?? 0, X = Number(G) > this.IS_MOVING_THRESHOLD, U = Number(W) > this.IS_MOVING_THRESHOLD;
|
|
5837
5837
|
if (X !== U && (o.billboard && (o.billboard.image = new Cesium.ConstantProperty(
|
|
5838
5838
|
createShipIconUrl(E, U)
|
|
5839
5839
|
)), x != null && x.plane)) {
|
|
5840
|
-
const ee = ((a = r.properties) == null ? void 0 : a.designBeam) ?? ((y = (m = this.opt) == null ? void 0 : m.defaultValue) == null ? void 0 : y.designBeam) ?? 12,
|
|
5840
|
+
const ee = ((a = r.properties) == null ? void 0 : a.designBeam) ?? ((y = (m = this.opt) == null ? void 0 : m.defaultValue) == null ? void 0 : y.designBeam) ?? 12, V = ((g = r.properties) == null ? void 0 : g.designLength) ?? ((v = (p = this.opt) == null ? void 0 : p.defaultValue) == null ? void 0 : v.designLength) ?? 35, J = createShipIconV2({
|
|
5841
5841
|
color: E,
|
|
5842
5842
|
isMoving: U,
|
|
5843
5843
|
...r.properties,
|
|
5844
5844
|
designBeam: ee,
|
|
5845
|
-
designLength:
|
|
5845
|
+
designLength: V
|
|
5846
5846
|
}), Q = (w = x.plane) == null ? void 0 : w.material;
|
|
5847
5847
|
Q && (Q.image = new Cesium.ConstantProperty(J.url), x.plane.dimensions = new Cesium.ConstantProperty(
|
|
5848
|
-
new Cesium.Cartesian2(ee * J.scale.x,
|
|
5848
|
+
new Cesium.Cartesian2(ee * J.scale.x, V * J.scale.y)
|
|
5849
5849
|
)), x.plane.dimensions = new Cesium.CallbackProperty(
|
|
5850
|
-
() => new Cesium.Cartesian2(ee * J.scale.x,
|
|
5850
|
+
() => new Cesium.Cartesian2(ee * J.scale.x, V * J.scale.y),
|
|
5851
5851
|
!0
|
|
5852
5852
|
);
|
|
5853
5853
|
}
|
|
@@ -5855,7 +5855,7 @@ class ShipLayer extends EventEmitter {
|
|
|
5855
5855
|
if (q == "courseOverGroundTrue") {
|
|
5856
5856
|
const G = ((_ = r.properties) == null ? void 0 : _.courseOverGroundTrue) ?? 0;
|
|
5857
5857
|
o.billboard.rotation = new Cesium.ConstantProperty(
|
|
5858
|
-
typeof
|
|
5858
|
+
typeof W == "number" ? -1 * W : 0
|
|
5859
5859
|
);
|
|
5860
5860
|
const X = new Cesium.ConstantProperty(
|
|
5861
5861
|
Cesium.Transforms.headingPitchRollQuaternion(
|
|
@@ -5866,7 +5866,7 @@ class ShipLayer extends EventEmitter {
|
|
|
5866
5866
|
x && (x.orientation = X);
|
|
5867
5867
|
}
|
|
5868
5868
|
if (q == "updateTime") {
|
|
5869
|
-
const G = Cesium.JulianDate.fromDate(new Date(
|
|
5869
|
+
const G = Cesium.JulianDate.fromDate(new Date(W));
|
|
5870
5870
|
o.billboard.color = createAlphaSampled({
|
|
5871
5871
|
startTime: G
|
|
5872
5872
|
});
|
|
@@ -5877,7 +5877,7 @@ class ShipLayer extends EventEmitter {
|
|
|
5877
5877
|
const U = getHideAfterFiveMinutesProperty(G);
|
|
5878
5878
|
b != null && b.billboard && (b.billboard.show = U), o.point.show = U;
|
|
5879
5879
|
}
|
|
5880
|
-
o.properties[q] =
|
|
5880
|
+
o.properties[q] = W, x != null && x.properties && (x.properties[q] = W);
|
|
5881
5881
|
}
|
|
5882
5882
|
} else
|
|
5883
5883
|
this.renderFeature(r);
|
|
@@ -5936,7 +5936,7 @@ class ShipLayer extends EventEmitter {
|
|
|
5936
5936
|
});
|
|
5937
5937
|
}
|
|
5938
5938
|
createShipPlane(r) {
|
|
5939
|
-
var p;
|
|
5939
|
+
var p, v, w, _, O;
|
|
5940
5940
|
const o = new Cesium.Entity({
|
|
5941
5941
|
id: r.id + "_shadow",
|
|
5942
5942
|
position: r.position,
|
|
@@ -5944,7 +5944,7 @@ class ShipLayer extends EventEmitter {
|
|
|
5944
5944
|
properties: r.properties
|
|
5945
5945
|
});
|
|
5946
5946
|
this.shadowEntityMap.set(r, o), this.db.entities.add(o);
|
|
5947
|
-
const d = (p = r.properties) == null ? void 0 : p.getValue(), u = d != null && d.updateTime ? new Date(d.updateTime) : /* @__PURE__ */ new Date(), l = Cesium.JulianDate.fromDate(u), c = Number((d == null ? void 0 : d.speedOverGround) ?? 0), h = (d == null ? void 0 : d.
|
|
5947
|
+
const d = (p = r.properties) == null ? void 0 : p.getValue(), u = d != null && d.updateTime ? new Date(d.updateTime) : /* @__PURE__ */ new Date(), l = Cesium.JulianDate.fromDate(u), c = Number((d == null ? void 0 : d.speedOverGround) ?? 0), h = (d == null ? void 0 : d.designBeam) ?? ((w = (v = this.opt) == null ? void 0 : v.defaultValue) == null ? void 0 : w.designBeam) ?? 12, a = (d == null ? void 0 : d.designLength) ?? ((O = (_ = this.opt) == null ? void 0 : _.defaultValue) == null ? void 0 : O.designLength) ?? 35, m = (d == null ? void 0 : d.shipTypeId) ?? -1, y = shipTypeColorMap.get(m) ?? shipTypeColorMap.get(-1), g = createShipIconV2({
|
|
5948
5948
|
color: y,
|
|
5949
5949
|
isMoving: c > this.IS_MOVING_THRESHOLD,
|
|
5950
5950
|
...d,
|
|
@@ -5953,12 +5953,12 @@ class ShipLayer extends EventEmitter {
|
|
|
5953
5953
|
});
|
|
5954
5954
|
o.plane = new Cesium.PlaneGraphics({
|
|
5955
5955
|
plane: new Cesium.Plane(Cesium.Cartesian3.UNIT_Z, 0),
|
|
5956
|
-
dimensions: new Cesium.Cartesian2(
|
|
5956
|
+
dimensions: new Cesium.Cartesian2(h * g.scale.x, a * g.scale.y),
|
|
5957
5957
|
show: new Cesium.CallbackProperty(() => {
|
|
5958
|
-
var
|
|
5958
|
+
var E, R, S;
|
|
5959
5959
|
if (!this._viewer) return !0;
|
|
5960
|
-
const
|
|
5961
|
-
return
|
|
5960
|
+
const b = this._viewer.clock.currentTime, x = (E = r.position) == null ? void 0 : E.getValue(b);
|
|
5961
|
+
return x ? Cesium.Cartesian3.distance(this._viewer.camera.positionWC, x) <= (((S = (R = this.opt) == null ? void 0 : R.distanceDisplayConditions) == null ? void 0 : S.near) ?? 4e3) : !1;
|
|
5962
5962
|
}, !1),
|
|
5963
5963
|
// 用回调按距离控制显示
|
|
5964
5964
|
material: new Cesium.ImageMaterialProperty({
|