cesium-mars-op-cog 0.1.2 → 0.1.3
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/index.js +11 -16
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as u from "cesium";
|
|
2
|
-
import { Event as N, GeographicTilingScheme as k, Rectangle as
|
|
2
|
+
import { Event as N, GeographicTilingScheme as k, Rectangle as M } from "cesium";
|
|
3
3
|
import S from "proj4";
|
|
4
4
|
import { onUnmounted as _, ref as G, shallowRef as F } from "vue";
|
|
5
5
|
var R = class {
|
|
@@ -172,7 +172,7 @@ var x = {
|
|
|
172
172
|
timeout: 3e4,
|
|
173
173
|
tileCacheSize: 512,
|
|
174
174
|
alpha: 1
|
|
175
|
-
},
|
|
175
|
+
}, p = class {
|
|
176
176
|
tileWidth = 256;
|
|
177
177
|
tileHeight = 256;
|
|
178
178
|
tilingScheme = new k();
|
|
@@ -219,7 +219,7 @@ var x = {
|
|
|
219
219
|
const t = A.bbox, e = t[0], i = t[1], I = t[2], g = t[3];
|
|
220
220
|
if (!isFinite(e) || !isFinite(i) || !isFinite(I) || !isFinite(g)) throw new Error("COG 元数据无效: bbox 包含非数值");
|
|
221
221
|
const s = A.maxLevel ?? 17, a = A.minLevel ?? Math.max(0, s - 8), n = A.crsType ?? "4326";
|
|
222
|
-
this._bbox = this._normalizeBbox(e, i, I, g, n), this.maximumLevel = s, this.minimumLevel = a, this.rectangle =
|
|
222
|
+
this._bbox = this._normalizeBbox(e, i, I, g, n), this.maximumLevel = s, this.minimumLevel = a, this.rectangle = M.fromDegrees(this._bbox[0], this._bbox[1], this._bbox[2], this._bbox[3]), this._errorEvent = new N(), this._initialized = !0, console.log(`[COG] 初始化完成, 级别 ${a}-${s}, bbox: [${this._bbox.join(", ")}]`);
|
|
223
223
|
}
|
|
224
224
|
_normalizeBbox(A, t, e, i, I) {
|
|
225
225
|
if (Math.abs(A) <= 360 && Math.abs(e) <= 360 && Math.abs(t) <= 90 && Math.abs(i) <= 90) return [
|
|
@@ -292,11 +292,11 @@ function K(A, t = 0.3) {
|
|
|
292
292
|
};
|
|
293
293
|
}
|
|
294
294
|
async function T(A, t) {
|
|
295
|
-
const e = new
|
|
295
|
+
const e = new p(A, t);
|
|
296
296
|
return await e.init(), e;
|
|
297
297
|
}
|
|
298
298
|
async function O(A, t, e) {
|
|
299
|
-
const i = new
|
|
299
|
+
const i = new p(t, e);
|
|
300
300
|
await i.init();
|
|
301
301
|
const I = A.imageryLayers.addImageryProvider(i);
|
|
302
302
|
if (I.alpha = e?.alpha ?? 1, e?.flyTo !== !1 && A.camera) {
|
|
@@ -307,19 +307,14 @@ async function O(A, t, e) {
|
|
|
307
307
|
north: g[3]
|
|
308
308
|
}, 0.3);
|
|
309
309
|
A.camera.flyTo({
|
|
310
|
-
destination:
|
|
311
|
-
west: s.west,
|
|
312
|
-
south: s.south,
|
|
313
|
-
east: s.east,
|
|
314
|
-
north: s.north
|
|
315
|
-
},
|
|
310
|
+
destination: M.fromDegrees(s.west, s.south, s.east, s.north),
|
|
316
311
|
duration: 1.5
|
|
317
312
|
});
|
|
318
313
|
}
|
|
319
314
|
return I;
|
|
320
315
|
}
|
|
321
316
|
async function j(A, t, e) {
|
|
322
|
-
const i = new
|
|
317
|
+
const i = new p(t, e);
|
|
323
318
|
await i.init();
|
|
324
319
|
const I = i.bboxDegrees, g = i.maximumLevel, s = i.minimumLevel, a = await v(), { TileGrid: n } = a.tilegrid, r = 256, o = [];
|
|
325
320
|
for (let h = 0; h <= g; h++) o.push(360 / (r * Math.pow(2, h + 1)));
|
|
@@ -403,7 +398,7 @@ function H(A) {
|
|
|
403
398
|
};
|
|
404
399
|
let a = null, n = null;
|
|
405
400
|
try {
|
|
406
|
-
a = new
|
|
401
|
+
a = new p(i, s), await a.init(), n = g.imageryLayers.addImageryProvider(a), n.alpha = s.alpha;
|
|
407
402
|
const r = a.bboxDegrees, o = {
|
|
408
403
|
imageryLayer: n,
|
|
409
404
|
layerId: e,
|
|
@@ -411,7 +406,7 @@ function H(A) {
|
|
|
411
406
|
bbox: [...r]
|
|
412
407
|
};
|
|
413
408
|
if (t.set(e, o), s.flyTo !== !1) {
|
|
414
|
-
const [E, f, c, w] = r, h = c - E, d = w - f, Q = h * 0.3, l = d * 0.3, C =
|
|
409
|
+
const [E, f, c, w] = r, h = c - E, d = w - f, Q = h * 0.3, l = d * 0.3, C = M.fromDegrees(E - Q, f - l, c + Q, w + l);
|
|
415
410
|
g.camera.flyTo({
|
|
416
411
|
destination: C,
|
|
417
412
|
duration: 1.5
|
|
@@ -454,7 +449,7 @@ function H(A) {
|
|
|
454
449
|
}
|
|
455
450
|
const I = A();
|
|
456
451
|
if (!I) return;
|
|
457
|
-
const [g, s, a, n] = i.bbox, r = (a - g) * 0.3, o = (n - s) * 0.3, E =
|
|
452
|
+
const [g, s, a, n] = i.bbox, r = (a - g) * 0.3, o = (n - s) * 0.3, E = M.fromDegrees(g - r, s - o, a + r, n + o);
|
|
458
453
|
I.camera.flyTo({
|
|
459
454
|
destination: E,
|
|
460
455
|
duration: 1.5
|
|
@@ -570,7 +565,7 @@ function z(A = {}) {
|
|
|
570
565
|
};
|
|
571
566
|
}
|
|
572
567
|
export {
|
|
573
|
-
|
|
568
|
+
p as CogImageryProvider,
|
|
574
569
|
L as LRUCache,
|
|
575
570
|
O as addCogLayerToMap,
|
|
576
571
|
j as addCogLayerToOpenLayers,
|